fix(js-sandbox): resolve errors with pw.env namespace in legacy sandbox (#5433)
This commit is contained in:
parent
6bbfb9b8b7
commit
11b07db12c
2 changed files with 22 additions and 15 deletions
|
|
@ -256,9 +256,11 @@ declare namespace pw {
|
|||
headers: HoppRESTResponseHeader[]
|
||||
}>
|
||||
namespace env {
|
||||
function set(key: string, value: string): void
|
||||
function unset(key: string): void
|
||||
function get(key: string): string
|
||||
function getResolve(key: string): string
|
||||
function resolve(key: string): string
|
||||
function resolve(value: string): string
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -158,21 +158,24 @@ export function getSharedEnvMethods(
|
|||
}
|
||||
|
||||
/**
|
||||
* Legacy sandbox version - Returns flat methods for `pw` namespace only
|
||||
* Legacy sandbox version - Methods pre-wrapped in `env` for direct `pw` namespace assignment
|
||||
* (Experimental sandbox powered by `faraday-cage` handles this wrapping via bootstrap code)
|
||||
*/
|
||||
export function getSharedEnvMethods(
|
||||
envs: TestResult["envs"],
|
||||
isHoppNamespace?: false
|
||||
): {
|
||||
methods: {
|
||||
get: (key: string, options?: EnvAPIOptions) => string | null | undefined
|
||||
getResolve: (
|
||||
key: string,
|
||||
options?: EnvAPIOptions
|
||||
) => string | null | undefined
|
||||
set: (key: string, value: string, options?: EnvAPIOptions) => void
|
||||
unset: (key: string, options?: EnvAPIOptions) => void
|
||||
resolve: (key: string) => string
|
||||
env: {
|
||||
get: (key: string, options?: EnvAPIOptions) => string | null | undefined
|
||||
getResolve: (
|
||||
key: string,
|
||||
options?: EnvAPIOptions
|
||||
) => string | null | undefined
|
||||
set: (key: string, value: string, options?: EnvAPIOptions) => void
|
||||
unset: (key: string, options?: EnvAPIOptions) => void
|
||||
resolve: (key: string) => string
|
||||
}
|
||||
}
|
||||
updatedEnvs: TestResult["envs"]
|
||||
}
|
||||
|
|
@ -380,11 +383,13 @@ export function getSharedEnvMethods(
|
|||
// Legacy scripting sandbox (Only `pw` namespace)
|
||||
return {
|
||||
methods: {
|
||||
get: envGetFn,
|
||||
getResolve: envGetResolveFn,
|
||||
set: envSetFn,
|
||||
unset: envUnsetFn,
|
||||
resolve: envResolveFn,
|
||||
env: {
|
||||
get: envGetFn,
|
||||
getResolve: envGetResolveFn,
|
||||
set: envSetFn,
|
||||
unset: envUnsetFn,
|
||||
resolve: envResolveFn,
|
||||
},
|
||||
},
|
||||
updatedEnvs,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue