@intuned/runtime-dev 1.3.18-interface.4 → 1.3.18-interface.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-6ZRJOUQS.mjs +16 -0
- package/dist/chunk-6ZRJOUQS.mjs.map +1 -0
- package/dist/chunk-7YL2JUTE.mjs +146 -0
- package/dist/chunk-7YL2JUTE.mjs.map +1 -0
- package/dist/chunk-B3T6RXPC.mjs +794 -0
- package/dist/chunk-B3T6RXPC.mjs.map +1 -0
- package/dist/chunk-FGV5T6SI.mjs +27 -0
- package/dist/chunk-FGV5T6SI.mjs.map +1 -0
- package/dist/chunk-G4PO5RIV.mjs +85 -0
- package/dist/chunk-G4PO5RIV.mjs.map +1 -0
- package/dist/chunk-LZOMFHX3.mjs +38 -0
- package/dist/chunk-LZOMFHX3.mjs.map +1 -0
- package/dist/{common/formatZodError.js → chunk-NDMVGENG.mjs} +9 -9
- package/dist/chunk-NDMVGENG.mjs.map +1 -0
- package/dist/chunk-W4UX6G4X.mjs +17 -0
- package/dist/chunk-W4UX6G4X.mjs.map +1 -0
- package/dist/chunk-XC75QGFG.mjs +1106 -0
- package/dist/chunk-XC75QGFG.mjs.map +1 -0
- package/dist/chunk-XOAZ2MGA.mjs +59 -0
- package/dist/chunk-XOAZ2MGA.mjs.map +1 -0
- package/dist/commands/interface/run.d.mts +3 -0
- package/dist/commands/interface/run.d.ts +3 -1
- package/dist/commands/interface/run.js +2047 -140
- package/dist/commands/interface/run.js.map +1 -0
- package/dist/commands/interface/run.mjs +255 -0
- package/dist/commands/interface/run.mjs.map +1 -0
- package/dist/common/asyncLocalStorage/index.d.mts +17 -0
- package/dist/common/asyncLocalStorage/index.d.ts +9 -8
- package/dist/common/asyncLocalStorage/index.js +34 -9
- package/dist/common/asyncLocalStorage/index.js.map +1 -0
- package/dist/common/asyncLocalStorage/index.mjs +12 -0
- package/dist/common/asyncLocalStorage/index.mjs.map +1 -0
- package/dist/common/binStartupScript.d.mts +2 -0
- package/dist/common/binStartupScript.d.ts +2 -1
- package/dist/common/binStartupScript.js +127 -11
- package/dist/common/binStartupScript.js.map +1 -0
- package/dist/common/binStartupScript.mjs +135 -0
- package/dist/common/binStartupScript.mjs.map +1 -0
- package/dist/common/cleanEnvironmentVariables.d.mts +3 -0
- package/dist/common/cleanEnvironmentVariables.d.ts +3 -1
- package/dist/common/cleanEnvironmentVariables.js +30 -7
- package/dist/common/cleanEnvironmentVariables.js.map +1 -0
- package/dist/common/cleanEnvironmentVariables.mjs +8 -0
- package/dist/common/cleanEnvironmentVariables.mjs.map +1 -0
- package/dist/common/constants.d.mts +13 -0
- package/dist/common/constants.d.ts +13 -11
- package/dist/common/constants.js +58 -15
- package/dist/common/constants.js.map +1 -0
- package/dist/common/constants.mjs +28 -0
- package/dist/common/constants.mjs.map +1 -0
- package/dist/common/contextStorageStateHelpers.d.mts +24 -0
- package/dist/common/contextStorageStateHelpers.d.ts +8 -6
- package/dist/common/contextStorageStateHelpers.js +47 -22
- package/dist/common/contextStorageStateHelpers.js.map +1 -0
- package/dist/common/contextStorageStateHelpers.mjs +10 -0
- package/dist/common/contextStorageStateHelpers.mjs.map +1 -0
- package/dist/common/jwtTokenManager.d.mts +19 -0
- package/dist/common/jwtTokenManager.d.ts +6 -4
- package/dist/common/jwtTokenManager.js +108 -41
- package/dist/common/jwtTokenManager.js.map +1 -0
- package/dist/common/jwtTokenManager.mjs +11 -0
- package/dist/common/jwtTokenManager.mjs.map +1 -0
- package/dist/common/runApi/index.d.mts +11 -0
- package/dist/common/runApi/index.d.ts +9 -6
- package/dist/common/runApi/index.js +1774 -74
- package/dist/common/runApi/index.js.map +1 -0
- package/dist/common/runApi/index.mjs +18 -0
- package/dist/common/runApi/index.mjs.map +1 -0
- package/dist/common/settingsSchema.d.mts +540 -0
- package/dist/common/settingsSchema.d.ts +58 -51
- package/dist/common/settingsSchema.js +55 -20
- package/dist/common/settingsSchema.js.map +1 -0
- package/dist/common/settingsSchema.mjs +10 -0
- package/dist/common/settingsSchema.mjs.map +1 -0
- package/dist/common/telemetry.d.mts +6 -0
- package/dist/common/telemetry.d.ts +6 -3
- package/dist/common/telemetry.js +41 -9
- package/dist/common/telemetry.js.map +1 -0
- package/dist/common/telemetry.mjs +31 -0
- package/dist/common/telemetry.mjs.map +1 -0
- package/dist/export.d-BAUMB-lG.d.mts +140 -0
- package/dist/export.d-BAUMB-lG.d.ts +140 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.js +784 -92
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +47 -0
- package/dist/index.mjs.map +1 -0
- package/dist/runtime/index.d.mts +168 -0
- package/dist/runtime/index.d.ts +168 -10
- package/dist/runtime/index.js +779 -88
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/index.mjs +42 -0
- package/dist/runtime/index.mjs.map +1 -0
- package/package.json +77 -16
- package/.babelrc +0 -21
- package/.eslintignore +0 -10
- package/.eslintrc.js +0 -39
- package/.turbo/turbo-build.log +0 -2
- package/InterfaceTemplate/__utils.ts +0 -61
- package/InterfaceTemplate/index.playwright.ts +0 -6
- package/WebTemplate.zip +0 -0
- package/dist/commands/api/run.d.ts +0 -6
- package/dist/commands/api/run.js +0 -120
- package/dist/commands/auth-sessions/load.d.ts +0 -2
- package/dist/commands/auth-sessions/load.js +0 -35
- package/dist/commands/auth-sessions/run-check.d.ts +0 -2
- package/dist/commands/auth-sessions/run-check.js +0 -75
- package/dist/commands/auth-sessions/run-create.d.ts +0 -2
- package/dist/commands/auth-sessions/run-create.js +0 -79
- package/dist/commands/browser/save-state.d.ts +0 -2
- package/dist/commands/browser/save-state.js +0 -17
- package/dist/commands/browser/start-browser.d.ts +0 -2
- package/dist/commands/browser/start-browser.js +0 -14
- package/dist/commands/build.d.ts +0 -1
- package/dist/commands/build.js +0 -84
- package/dist/commands/common/browserUtils.d.ts +0 -14
- package/dist/commands/common/browserUtils.js +0 -58
- package/dist/commands/common/getFirstLineNumber.d.ts +0 -9
- package/dist/commands/common/getFirstLineNumber.js +0 -101
- package/dist/commands/common/getFirstLineNumber.test.js +0 -228
- package/dist/commands/common/projectExclusions.d.ts +0 -2
- package/dist/commands/common/projectExclusions.js +0 -8
- package/dist/commands/common/sendMessageToClient.d.ts +0 -1
- package/dist/commands/common/sendMessageToClient.js +0 -10
- package/dist/commands/common/tsNodeImport.d.ts +0 -2
- package/dist/commands/common/tsNodeImport.js +0 -43
- package/dist/commands/common/utils/fileUtils.d.ts +0 -6
- package/dist/commands/common/utils/fileUtils.js +0 -33
- package/dist/commands/common/utils/interfaceClient.d.ts +0 -31
- package/dist/commands/common/utils/interfaceClient.js +0 -99
- package/dist/commands/common/utils/settings.d.ts +0 -2
- package/dist/commands/common/utils/settings.js +0 -31
- package/dist/commands/common/utils/template.d.ts +0 -2
- package/dist/commands/common/utils/template.js +0 -31
- package/dist/commands/get-headless-user-agent.d.ts +0 -1
- package/dist/commands/get-headless-user-agent.js +0 -18
- package/dist/commands/interface/pingPong.d.ts +0 -2
- package/dist/commands/interface/pingPong.js +0 -11
- package/dist/commands/interface/runApi.d.ts +0 -1
- package/dist/commands/interface/runApi.js +0 -102
- package/dist/commands/intuned-cli/commands/attempt.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/attempt.command.js +0 -8
- package/dist/commands/intuned-cli/commands/attempt_api.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/attempt_api.command.js +0 -30
- package/dist/commands/intuned-cli/commands/attempt_authsession.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +0 -8
- package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +0 -19
- package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +0 -24
- package/dist/commands/intuned-cli/commands/authsession.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/authsession.command.js +0 -8
- package/dist/commands/intuned-cli/commands/authsession_record.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/authsession_record.command.js +0 -32
- package/dist/commands/intuned-cli/commands/authsession_scaffold.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/authsession_scaffold.command.js +0 -16
- package/dist/commands/intuned-cli/commands/build.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/build.command.js +0 -12
- package/dist/commands/intuned-cli/commands/command.d.ts +0 -2
- package/dist/commands/intuned-cli/commands/command.js +0 -9
- package/dist/commands/intuned-cli/commands/deploy.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/deploy.command.js +0 -42
- package/dist/commands/intuned-cli/commands/index.d.ts +0 -18
- package/dist/commands/intuned-cli/commands/index.js +0 -203
- package/dist/commands/intuned-cli/commands/provision.command.d.ts +0 -13
- package/dist/commands/intuned-cli/commands/provision.command.js +0 -50
- package/dist/commands/intuned-cli/commands/run.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/run.command.js +0 -8
- package/dist/commands/intuned-cli/commands/run_api.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/run_api.command.js +0 -46
- package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +0 -34
- package/dist/commands/intuned-cli/commands/run_authsession.command.js +0 -17
- package/dist/commands/intuned-cli/commands/run_authsession_create.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +0 -35
- package/dist/commands/intuned-cli/commands/run_authsession_update.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +0 -35
- package/dist/commands/intuned-cli/commands/run_authsession_validate.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +0 -33
- package/dist/commands/intuned-cli/commands/types.d.ts +0 -39
- package/dist/commands/intuned-cli/commands/types.js +0 -33
- package/dist/commands/intuned-cli/constants/index.d.ts +0 -17
- package/dist/commands/intuned-cli/constants/index.js +0 -25
- package/dist/commands/intuned-cli/controller/__test__/api.test.js +0 -398
- package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +0 -1060
- package/dist/commands/intuned-cli/controller/api.d.ts +0 -42
- package/dist/commands/intuned-cli/controller/api.js +0 -195
- package/dist/commands/intuned-cli/controller/authSession.d.ts +0 -209
- package/dist/commands/intuned-cli/controller/authSession.js +0 -425
- package/dist/commands/intuned-cli/controller/build.d.ts +0 -1
- package/dist/commands/intuned-cli/controller/build.js +0 -36
- package/dist/commands/intuned-cli/controller/deploy.d.ts +0 -5
- package/dist/commands/intuned-cli/controller/deploy.js +0 -318
- package/dist/commands/intuned-cli/controller/index.d.ts +0 -1
- package/dist/commands/intuned-cli/controller/index.js +0 -46
- package/dist/commands/intuned-cli/controller/provision.d.ts +0 -21
- package/dist/commands/intuned-cli/controller/provision.js +0 -300
- package/dist/commands/intuned-cli/controller/scaffold.d.ts +0 -1
- package/dist/commands/intuned-cli/controller/scaffold.js +0 -77
- package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +0 -152
- package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +0 -41
- package/dist/commands/intuned-cli/helpers/api.d.ts +0 -3
- package/dist/commands/intuned-cli/helpers/api.js +0 -16
- package/dist/commands/intuned-cli/helpers/auth.d.ts +0 -46
- package/dist/commands/intuned-cli/helpers/auth.js +0 -147
- package/dist/commands/intuned-cli/helpers/backend.d.ts +0 -8
- package/dist/commands/intuned-cli/helpers/backend.js +0 -35
- package/dist/commands/intuned-cli/helpers/browser.d.ts +0 -14
- package/dist/commands/intuned-cli/helpers/browser.js +0 -93
- package/dist/commands/intuned-cli/helpers/context.d.ts +0 -3
- package/dist/commands/intuned-cli/helpers/context.js +0 -33
- package/dist/commands/intuned-cli/helpers/errors.d.ts +0 -16
- package/dist/commands/intuned-cli/helpers/errors.js +0 -44
- package/dist/commands/intuned-cli/helpers/index.d.ts +0 -12
- package/dist/commands/intuned-cli/helpers/index.js +0 -137
- package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +0 -39
- package/dist/commands/intuned-cli/helpers/intunedJson.js +0 -20
- package/dist/commands/intuned-cli/helpers/prompts.d.ts +0 -3
- package/dist/commands/intuned-cli/helpers/prompts.js +0 -71
- package/dist/commands/intuned-cli/helpers/proxy.d.ts +0 -5
- package/dist/commands/intuned-cli/helpers/proxy.js +0 -23
- package/dist/commands/intuned-cli/helpers/terminal.d.ts +0 -5
- package/dist/commands/intuned-cli/helpers/terminal.js +0 -13
- package/dist/commands/intuned-cli/helpers/timeout.d.ts +0 -1
- package/dist/commands/intuned-cli/helpers/timeout.js +0 -23
- package/dist/commands/intuned-cli/helpers/traces.d.ts +0 -2
- package/dist/commands/intuned-cli/helpers/traces.js +0 -32
- package/dist/commands/intuned-cli/helpers/validation.d.ts +0 -2
- package/dist/commands/intuned-cli/helpers/validation.js +0 -14
- package/dist/commands/intuned-cli/helpers/wrapper.d.ts +0 -2
- package/dist/commands/intuned-cli/helpers/wrapper.js +0 -76
- package/dist/commands/intuned-cli/index.d.ts +0 -1
- package/dist/commands/intuned-cli/index.js +0 -16
- package/dist/commands/intuned-cli/main.d.ts +0 -1
- package/dist/commands/intuned-cli/main.js +0 -36
- package/dist/commands/intuned-cli/types.d.ts +0 -70
- package/dist/commands/intuned-cli/types.js +0 -22
- package/dist/commands/ts-check.d.ts +0 -2
- package/dist/commands/ts-check.js +0 -56
- package/dist/common/Logger/Logger/index.d.ts +0 -12
- package/dist/common/Logger/Logger/index.js +0 -60
- package/dist/common/Logger/Logger/types.d.ts +0 -8
- package/dist/common/Logger/Logger/types.js +0 -5
- package/dist/common/Logger/index.d.ts +0 -12
- package/dist/common/Logger/index.js +0 -60
- package/dist/common/Logger/types.d.ts +0 -8
- package/dist/common/Logger/types.js +0 -5
- package/dist/common/backendFunctions/getAuthSessionParameters.d.ts +0 -1
- package/dist/common/backendFunctions/getAuthSessionParameters.js +0 -38
- package/dist/common/browserTabs.d.ts +0 -72
- package/dist/common/browserTabs.js +0 -74
- package/dist/common/extension/extensionsHelpers.d.ts +0 -11
- package/dist/common/extension/extensionsHelpers.js +0 -147
- package/dist/common/extension/intunedExtensionServer.d.ts +0 -24
- package/dist/common/extension/intunedExtensionServer.js +0 -178
- package/dist/common/extension/types.d.ts +0 -212
- package/dist/common/extension/types.js +0 -51
- package/dist/common/formatZodError.d.ts +0 -2
- package/dist/common/intunedJson.d.ts +0 -229
- package/dist/common/intunedJson.js +0 -133
- package/dist/common/launchBrowser.d.ts +0 -34
- package/dist/common/launchBrowser.js +0 -248
- package/dist/common/playwrightContext.d.ts +0 -30
- package/dist/common/playwrightContext.js +0 -153
- package/dist/common/runApi/importUsingImportFunction.d.ts +0 -7
- package/dist/common/runApi/importUsingImportFunction.js +0 -46
- package/dist/common/setupContextHook.d.ts +0 -16
- package/dist/common/setupContextHook.js +0 -22
- package/dist/runtime/RunError.d.ts +0 -5
- package/dist/runtime/RunError.js +0 -19
- package/dist/runtime/attemptStore.d.ts +0 -2
- package/dist/runtime/attemptStore.js +0 -23
- package/dist/runtime/captcha.d.ts +0 -15
- package/dist/runtime/captcha.js +0 -191
- package/dist/runtime/captcha.test.js +0 -821
- package/dist/runtime/downloadDirectory.d.ts +0 -1
- package/dist/runtime/downloadDirectory.js +0 -19
- package/dist/runtime/enums.d.js +0 -5
- package/dist/runtime/enums.d.ts +0 -11
- package/dist/runtime/enums.js +0 -18
- package/dist/runtime/executionHelpers.test.js +0 -52
- package/dist/runtime/export.d.js +0 -5
- package/dist/runtime/export.d.ts +0 -284
- package/dist/runtime/extendPayload.d.ts +0 -2
- package/dist/runtime/extendPayload.js +0 -21
- package/dist/runtime/extendTimeout.d.ts +0 -1
- package/dist/runtime/extendTimeout.js +0 -23
- package/dist/runtime/getAiGatewayConfig.d.ts +0 -10
- package/dist/runtime/getAiGatewayConfig.js +0 -16
- package/dist/runtime/getAuthSessionParameters.d.ts +0 -1
- package/dist/runtime/getAuthSessionParameters.js +0 -20
- package/dist/runtime/persistentStore.d.ts +0 -2
- package/dist/runtime/persistentStore.js +0 -37
- package/dist/runtime/persistentStore.test.js +0 -101
- package/dist/runtime/runInfo.d.ts +0 -2
- package/dist/runtime/runInfo.js +0 -21
- package/template.tsconfig.json +0 -11
- package/tsconfig.eslint.json +0 -5
- package/tsconfig.json +0 -25
- package/typedoc.json +0 -49
- /package/dist/common/assets/{browser_scripts.js → assets/browser_scripts.js} +0 -0
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { type Err, type Ok } from "neverthrow";
|
|
3
|
-
export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
|
|
4
|
-
projectName: z.ZodOptional<z.ZodString>;
|
|
5
|
-
workspaceId: z.ZodOptional<z.ZodString>;
|
|
6
|
-
metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
7
|
-
defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
8
|
-
defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
9
|
-
testAuthSessionInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
10
|
-
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
defaultJobInput?: Record<string, any> | undefined;
|
|
12
|
-
defaultRunPlaygroundInput?: Record<string, any> | undefined;
|
|
13
|
-
testAuthSessionInput?: Record<string, any> | undefined;
|
|
14
|
-
}, {
|
|
15
|
-
defaultJobInput?: unknown;
|
|
16
|
-
defaultRunPlaygroundInput?: unknown;
|
|
17
|
-
testAuthSessionInput?: unknown;
|
|
18
|
-
}>>>;
|
|
19
|
-
stealthMode: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
20
|
-
enabled: z.ZodBoolean;
|
|
21
|
-
}, "strip", z.ZodTypeAny, {
|
|
22
|
-
enabled: boolean;
|
|
23
|
-
}, {
|
|
24
|
-
enabled: boolean;
|
|
25
|
-
}>>>;
|
|
26
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
27
|
-
projectName: z.ZodOptional<z.ZodString>;
|
|
28
|
-
workspaceId: z.ZodOptional<z.ZodString>;
|
|
29
|
-
metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
30
|
-
defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
31
|
-
defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
32
|
-
testAuthSessionInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
33
|
-
}, "strip", z.ZodTypeAny, {
|
|
34
|
-
defaultJobInput?: Record<string, any> | undefined;
|
|
35
|
-
defaultRunPlaygroundInput?: Record<string, any> | undefined;
|
|
36
|
-
testAuthSessionInput?: Record<string, any> | undefined;
|
|
37
|
-
}, {
|
|
38
|
-
defaultJobInput?: unknown;
|
|
39
|
-
defaultRunPlaygroundInput?: unknown;
|
|
40
|
-
testAuthSessionInput?: unknown;
|
|
41
|
-
}>>>;
|
|
42
|
-
stealthMode: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
43
|
-
enabled: z.ZodBoolean;
|
|
44
|
-
}, "strip", z.ZodTypeAny, {
|
|
45
|
-
enabled: boolean;
|
|
46
|
-
}, {
|
|
47
|
-
enabled: boolean;
|
|
48
|
-
}>>>;
|
|
49
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
50
|
-
projectName: z.ZodOptional<z.ZodString>;
|
|
51
|
-
workspaceId: z.ZodOptional<z.ZodString>;
|
|
52
|
-
metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
53
|
-
defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
54
|
-
defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
55
|
-
testAuthSessionInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
56
|
-
}, "strip", z.ZodTypeAny, {
|
|
57
|
-
defaultJobInput?: Record<string, any> | undefined;
|
|
58
|
-
defaultRunPlaygroundInput?: Record<string, any> | undefined;
|
|
59
|
-
testAuthSessionInput?: Record<string, any> | undefined;
|
|
60
|
-
}, {
|
|
61
|
-
defaultJobInput?: unknown;
|
|
62
|
-
defaultRunPlaygroundInput?: unknown;
|
|
63
|
-
testAuthSessionInput?: unknown;
|
|
64
|
-
}>>>;
|
|
65
|
-
stealthMode: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
66
|
-
enabled: z.ZodBoolean;
|
|
67
|
-
}, "strip", z.ZodTypeAny, {
|
|
68
|
-
enabled: boolean;
|
|
69
|
-
}, {
|
|
70
|
-
enabled: boolean;
|
|
71
|
-
}>>>;
|
|
72
|
-
}, z.ZodTypeAny, "passthrough">>, z.ZodUnion<[z.ZodObject<{
|
|
73
|
-
authSessions: z.ZodObject<{
|
|
74
|
-
enabled: z.ZodLiteral<false>;
|
|
75
|
-
}, "strip", z.ZodTypeAny, {
|
|
76
|
-
enabled: false;
|
|
77
|
-
}, {
|
|
78
|
-
enabled: false;
|
|
79
|
-
}>;
|
|
80
|
-
apiAccess: z.ZodObject<{
|
|
81
|
-
enabled: z.ZodLiteral<false>;
|
|
82
|
-
}, "strip", z.ZodTypeAny, {
|
|
83
|
-
enabled: false;
|
|
84
|
-
}, {
|
|
85
|
-
enabled: false;
|
|
86
|
-
}>;
|
|
87
|
-
}, "strip", z.ZodTypeAny, {
|
|
88
|
-
authSessions: {
|
|
89
|
-
enabled: false;
|
|
90
|
-
};
|
|
91
|
-
apiAccess: {
|
|
92
|
-
enabled: false;
|
|
93
|
-
};
|
|
94
|
-
}, {
|
|
95
|
-
authSessions: {
|
|
96
|
-
enabled: false;
|
|
97
|
-
};
|
|
98
|
-
apiAccess: {
|
|
99
|
-
enabled: false;
|
|
100
|
-
};
|
|
101
|
-
}>, z.ZodObject<{
|
|
102
|
-
authSessions: z.ZodUnion<[z.ZodObject<{
|
|
103
|
-
enabled: z.ZodLiteral<false>;
|
|
104
|
-
}, "strip", z.ZodTypeAny, {
|
|
105
|
-
enabled: false;
|
|
106
|
-
}, {
|
|
107
|
-
enabled: false;
|
|
108
|
-
}>, z.ZodObject<{
|
|
109
|
-
enabled: z.ZodLiteral<true>;
|
|
110
|
-
type: z.ZodEnum<["MANUAL", "API"]>;
|
|
111
|
-
startUrl: z.ZodOptional<z.ZodString>;
|
|
112
|
-
finishUrl: z.ZodOptional<z.ZodString>;
|
|
113
|
-
}, "strip", z.ZodTypeAny, {
|
|
114
|
-
type: "API" | "MANUAL";
|
|
115
|
-
enabled: true;
|
|
116
|
-
startUrl?: string | undefined;
|
|
117
|
-
finishUrl?: string | undefined;
|
|
118
|
-
}, {
|
|
119
|
-
type: "API" | "MANUAL";
|
|
120
|
-
enabled: true;
|
|
121
|
-
startUrl?: string | undefined;
|
|
122
|
-
finishUrl?: string | undefined;
|
|
123
|
-
}>]>;
|
|
124
|
-
apiAccess: z.ZodObject<{
|
|
125
|
-
enabled: z.ZodLiteral<true>;
|
|
126
|
-
}, "strip", z.ZodTypeAny, {
|
|
127
|
-
enabled: true;
|
|
128
|
-
}, {
|
|
129
|
-
enabled: true;
|
|
130
|
-
}>;
|
|
131
|
-
}, "strip", z.ZodTypeAny, {
|
|
132
|
-
authSessions: {
|
|
133
|
-
enabled: false;
|
|
134
|
-
} | {
|
|
135
|
-
type: "API" | "MANUAL";
|
|
136
|
-
enabled: true;
|
|
137
|
-
startUrl?: string | undefined;
|
|
138
|
-
finishUrl?: string | undefined;
|
|
139
|
-
};
|
|
140
|
-
apiAccess: {
|
|
141
|
-
enabled: true;
|
|
142
|
-
};
|
|
143
|
-
}, {
|
|
144
|
-
authSessions: {
|
|
145
|
-
enabled: false;
|
|
146
|
-
} | {
|
|
147
|
-
type: "API" | "MANUAL";
|
|
148
|
-
enabled: true;
|
|
149
|
-
startUrl?: string | undefined;
|
|
150
|
-
finishUrl?: string | undefined;
|
|
151
|
-
};
|
|
152
|
-
apiAccess: {
|
|
153
|
-
enabled: true;
|
|
154
|
-
};
|
|
155
|
-
}>]>>;
|
|
156
|
-
export type IntunedJson = z.infer<typeof intunedJsonSchema>;
|
|
157
|
-
export declare const intunedSettingsFileNames: readonly ["Intuned.json", "Intuned.jsonc", "Intuned.yaml", "Intuned.yml", "Intuned.toml"];
|
|
158
|
-
export declare function loadIntunedJson(): Promise<Err<never, string> | Ok<{
|
|
159
|
-
projectName?: string | undefined;
|
|
160
|
-
workspaceId?: string | undefined;
|
|
161
|
-
metadata?: {
|
|
162
|
-
defaultJobInput?: Record<string, any> | undefined;
|
|
163
|
-
defaultRunPlaygroundInput?: Record<string, any> | undefined;
|
|
164
|
-
testAuthSessionInput?: Record<string, any> | undefined;
|
|
165
|
-
} | undefined;
|
|
166
|
-
stealthMode?: {
|
|
167
|
-
enabled: boolean;
|
|
168
|
-
} | undefined;
|
|
169
|
-
} & {
|
|
170
|
-
[k: string]: unknown;
|
|
171
|
-
} & ({
|
|
172
|
-
authSessions: {
|
|
173
|
-
enabled: false;
|
|
174
|
-
};
|
|
175
|
-
apiAccess: {
|
|
176
|
-
enabled: false;
|
|
177
|
-
};
|
|
178
|
-
} | {
|
|
179
|
-
authSessions: {
|
|
180
|
-
enabled: false;
|
|
181
|
-
} | {
|
|
182
|
-
type: "API" | "MANUAL";
|
|
183
|
-
enabled: true;
|
|
184
|
-
startUrl?: string | undefined;
|
|
185
|
-
finishUrl?: string | undefined;
|
|
186
|
-
};
|
|
187
|
-
apiAccess: {
|
|
188
|
-
enabled: true;
|
|
189
|
-
};
|
|
190
|
-
}), never>>;
|
|
191
|
-
export declare function getIntunedSettingsFile(): Promise<Ok<{
|
|
192
|
-
name: typeof intunedSettingsFileNames[number];
|
|
193
|
-
path: string;
|
|
194
|
-
parse: (content: string) => any;
|
|
195
|
-
}, never> | Err<never, string>>;
|
|
196
|
-
export declare function getIntunedSettingsFileName(): Promise<Err<never, string> | Ok<"Intuned.json" | "Intuned.jsonc" | "Intuned.yaml" | "Intuned.yml" | "Intuned.toml", never>>;
|
|
197
|
-
export declare function loadIntunedJsonSync(): Err<never, string> | Ok<{
|
|
198
|
-
projectName?: string | undefined;
|
|
199
|
-
workspaceId?: string | undefined;
|
|
200
|
-
metadata?: {
|
|
201
|
-
defaultJobInput?: Record<string, any> | undefined;
|
|
202
|
-
defaultRunPlaygroundInput?: Record<string, any> | undefined;
|
|
203
|
-
testAuthSessionInput?: Record<string, any> | undefined;
|
|
204
|
-
} | undefined;
|
|
205
|
-
stealthMode?: {
|
|
206
|
-
enabled: boolean;
|
|
207
|
-
} | undefined;
|
|
208
|
-
} & {
|
|
209
|
-
[k: string]: unknown;
|
|
210
|
-
} & ({
|
|
211
|
-
authSessions: {
|
|
212
|
-
enabled: false;
|
|
213
|
-
};
|
|
214
|
-
apiAccess: {
|
|
215
|
-
enabled: false;
|
|
216
|
-
};
|
|
217
|
-
} | {
|
|
218
|
-
authSessions: {
|
|
219
|
-
enabled: false;
|
|
220
|
-
} | {
|
|
221
|
-
type: "API" | "MANUAL";
|
|
222
|
-
enabled: true;
|
|
223
|
-
startUrl?: string | undefined;
|
|
224
|
-
finishUrl?: string | undefined;
|
|
225
|
-
};
|
|
226
|
-
apiAccess: {
|
|
227
|
-
enabled: true;
|
|
228
|
-
};
|
|
229
|
-
}), never>;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getIntunedSettingsFile = getIntunedSettingsFile;
|
|
7
|
-
exports.getIntunedSettingsFileName = getIntunedSettingsFileName;
|
|
8
|
-
exports.intunedSettingsFileNames = exports.intunedJsonSchema = void 0;
|
|
9
|
-
exports.loadIntunedJson = loadIntunedJson;
|
|
10
|
-
exports.loadIntunedJsonSync = loadIntunedJsonSync;
|
|
11
|
-
var _path = _interopRequireDefault(require("path"));
|
|
12
|
-
var fs = _interopRequireWildcard(require("fs-extra"));
|
|
13
|
-
var _zod = require("zod");
|
|
14
|
-
var JSONC = _interopRequireWildcard(require("jsonc-parser"));
|
|
15
|
-
var YAML = _interopRequireWildcard(require("yaml"));
|
|
16
|
-
var TOML = _interopRequireWildcard(require("smol-toml"));
|
|
17
|
-
var _neverthrow = require("neverthrow");
|
|
18
|
-
var _formatZodError = require("./formatZodError");
|
|
19
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
-
const playwright = undefined;
|
|
23
|
-
const intunedJsonSchema = exports.intunedJsonSchema = _zod.z.object({
|
|
24
|
-
projectName: _zod.z.string().optional(),
|
|
25
|
-
workspaceId: _zod.z.string().optional(),
|
|
26
|
-
metadata: _zod.z.object({
|
|
27
|
-
defaultJobInput: _zod.z.record(_zod.z.any()).optional().catch(undefined),
|
|
28
|
-
defaultRunPlaygroundInput: _zod.z.record(_zod.z.any()).optional().catch(undefined),
|
|
29
|
-
testAuthSessionInput: _zod.z.record(_zod.z.any()).optional().catch(undefined)
|
|
30
|
-
}).optional().catch(undefined),
|
|
31
|
-
stealthMode: _zod.z.object({
|
|
32
|
-
enabled: _zod.z.boolean()
|
|
33
|
-
}).optional().catch(undefined)
|
|
34
|
-
}).passthrough().and(_zod.z.union([_zod.z.object({
|
|
35
|
-
authSessions: _zod.z.object({
|
|
36
|
-
enabled: _zod.z.literal(false)
|
|
37
|
-
}),
|
|
38
|
-
apiAccess: _zod.z.object({
|
|
39
|
-
enabled: _zod.z.literal(false)
|
|
40
|
-
})
|
|
41
|
-
}), _zod.z.object({
|
|
42
|
-
authSessions: _zod.z.union([_zod.z.object({
|
|
43
|
-
enabled: _zod.z.literal(false)
|
|
44
|
-
}), _zod.z.object({
|
|
45
|
-
enabled: _zod.z.literal(true),
|
|
46
|
-
type: _zod.z.enum(["MANUAL", "API"]),
|
|
47
|
-
startUrl: _zod.z.string().optional(),
|
|
48
|
-
finishUrl: _zod.z.string().optional()
|
|
49
|
-
})]),
|
|
50
|
-
apiAccess: _zod.z.object({
|
|
51
|
-
enabled: _zod.z.literal(true)
|
|
52
|
-
})
|
|
53
|
-
})]));
|
|
54
|
-
const intunedSettingsFileNames = exports.intunedSettingsFileNames = ["Intuned.json", "Intuned.jsonc", "Intuned.yaml", "Intuned.yml", "Intuned.toml"];
|
|
55
|
-
async function loadIntunedJson() {
|
|
56
|
-
const settingsFileResult = await getIntunedSettingsFile();
|
|
57
|
-
if (!settingsFileResult.isOk()) {
|
|
58
|
-
return settingsFileResult;
|
|
59
|
-
}
|
|
60
|
-
const settingsFile = settingsFileResult.value;
|
|
61
|
-
const intunedJsonContent = await fs.readFile(settingsFile.path, "utf-8");
|
|
62
|
-
let intunedJson;
|
|
63
|
-
try {
|
|
64
|
-
intunedJson = settingsFile.parse(intunedJsonContent);
|
|
65
|
-
} catch (e) {
|
|
66
|
-
return (0, _neverthrow.err)(`Failed to parse ${settingsFile.name}: ${e.message}`);
|
|
67
|
-
}
|
|
68
|
-
const parseResult = intunedJsonSchema.safeParse(intunedJson);
|
|
69
|
-
if (!parseResult.success) {
|
|
70
|
-
return (0, _neverthrow.err)(`${settingsFile.name} is not valid:\n${(0, _formatZodError.formatZodError)(parseResult.error)}\nPlease fix the errors and try again.`);
|
|
71
|
-
}
|
|
72
|
-
return (0, _neverthrow.ok)(parseResult.data);
|
|
73
|
-
}
|
|
74
|
-
const intunedSettingsParsers = {
|
|
75
|
-
"Intuned.json": JSON.parse,
|
|
76
|
-
"Intuned.jsonc": JSONC.parse,
|
|
77
|
-
"Intuned.yaml": YAML.parse,
|
|
78
|
-
"Intuned.yml": YAML.parse,
|
|
79
|
-
"Intuned.toml": TOML.parse
|
|
80
|
-
};
|
|
81
|
-
async function getIntunedSettingsFile() {
|
|
82
|
-
for (const fileName of intunedSettingsFileNames) {
|
|
83
|
-
const filePath = _path.default.join(process.cwd(), fileName);
|
|
84
|
-
if (await fs.exists(filePath)) {
|
|
85
|
-
return (0, _neverthrow.ok)({
|
|
86
|
-
name: fileName,
|
|
87
|
-
path: filePath,
|
|
88
|
-
parse: intunedSettingsParsers[fileName]
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return (0, _neverthrow.err)("No Intuned settings file found.");
|
|
93
|
-
}
|
|
94
|
-
async function getIntunedSettingsFileName() {
|
|
95
|
-
const settingsFileResult = await getIntunedSettingsFile();
|
|
96
|
-
if (!settingsFileResult.isOk()) {
|
|
97
|
-
return settingsFileResult;
|
|
98
|
-
}
|
|
99
|
-
return (0, _neverthrow.ok)(settingsFileResult.value.name);
|
|
100
|
-
}
|
|
101
|
-
function loadIntunedJsonSync() {
|
|
102
|
-
const settingsFileResult = getIntunedSettingsFileSync();
|
|
103
|
-
if (!settingsFileResult.isOk()) {
|
|
104
|
-
return settingsFileResult;
|
|
105
|
-
}
|
|
106
|
-
const settingsFile = settingsFileResult.value;
|
|
107
|
-
const intunedJsonContent = fs.readFileSync(settingsFile.path, "utf-8");
|
|
108
|
-
let intunedJson;
|
|
109
|
-
try {
|
|
110
|
-
intunedJson = settingsFile.parse(intunedJsonContent);
|
|
111
|
-
} catch (e) {
|
|
112
|
-
return (0, _neverthrow.err)(`Failed to parse ${settingsFile.name}: ${e.message}`);
|
|
113
|
-
}
|
|
114
|
-
const parseResult = intunedJsonSchema.safeParse(intunedJson);
|
|
115
|
-
if (!parseResult.success) {
|
|
116
|
-
const formattedError = parseResult.error.errors.map(e => `- ${e.path.join(".")}: ${e.message}`).join("\n");
|
|
117
|
-
return (0, _neverthrow.err)(`${settingsFile.name} is not valid:\n${formattedError}\nPlease fix the errors and try again.`);
|
|
118
|
-
}
|
|
119
|
-
return (0, _neverthrow.ok)(parseResult.data);
|
|
120
|
-
}
|
|
121
|
-
function getIntunedSettingsFileSync() {
|
|
122
|
-
for (const fileName of intunedSettingsFileNames) {
|
|
123
|
-
const filePath = _path.default.join(process.cwd(), fileName);
|
|
124
|
-
if (fs.existsSync(filePath)) {
|
|
125
|
-
return (0, _neverthrow.ok)({
|
|
126
|
-
name: fileName,
|
|
127
|
-
path: filePath,
|
|
128
|
-
parse: intunedSettingsParsers[fileName]
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return (0, _neverthrow.err)("No Intuned settings file found.");
|
|
133
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as playwright from "playwright";
|
|
2
|
-
import { Result } from "neverthrow";
|
|
3
|
-
export interface Proxy {
|
|
4
|
-
server: string;
|
|
5
|
-
username: string;
|
|
6
|
-
password: string;
|
|
7
|
-
}
|
|
8
|
-
export type LaunchBrowserResult = {
|
|
9
|
-
page: playwright.Page;
|
|
10
|
-
context: playwright.BrowserContext;
|
|
11
|
-
};
|
|
12
|
-
export type LaunchChromiumStandaloneOptions = {
|
|
13
|
-
proxy?: Proxy;
|
|
14
|
-
headless: boolean;
|
|
15
|
-
downloadsPath?: string;
|
|
16
|
-
cdpPort?: number;
|
|
17
|
-
appModeInitialUrl?: string;
|
|
18
|
-
executablePath?: string;
|
|
19
|
-
};
|
|
20
|
-
export type LaunchChromiumCdpOptions = {
|
|
21
|
-
cdpAddress: string;
|
|
22
|
-
cdpTargetId?: string;
|
|
23
|
-
};
|
|
24
|
-
export declare function launchChromium(options: LaunchChromiumStandaloneOptions): Promise<LaunchBrowserResult>;
|
|
25
|
-
export declare function launchChromium(options: LaunchChromiumCdpOptions): Promise<LaunchBrowserResult>;
|
|
26
|
-
export declare function getBrowserExecutablePath(): Promise<string | undefined>;
|
|
27
|
-
export declare function launchBrowser(options: Omit<LaunchChromiumStandaloneOptions, "executablePath"> | LaunchChromiumCdpOptions): Promise<LaunchBrowserResult>;
|
|
28
|
-
export declare function getLocalCdpAddress(port: number): string;
|
|
29
|
-
export declare function getCdpWebSocketUrl(cdpAddress: string): Promise<Result<string, string>>;
|
|
30
|
-
export declare function getHeadlessUserAgent({ executablePath, args, ignoreDefaultArgs, }: {
|
|
31
|
-
executablePath?: string;
|
|
32
|
-
args?: string[];
|
|
33
|
-
ignoreDefaultArgs?: string[];
|
|
34
|
-
}): Promise<string | undefined>;
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getBrowserExecutablePath = getBrowserExecutablePath;
|
|
7
|
-
exports.getCdpWebSocketUrl = getCdpWebSocketUrl;
|
|
8
|
-
exports.getHeadlessUserAgent = getHeadlessUserAgent;
|
|
9
|
-
exports.getLocalCdpAddress = getLocalCdpAddress;
|
|
10
|
-
exports.launchBrowser = launchBrowser;
|
|
11
|
-
exports.launchChromium = launchChromium;
|
|
12
|
-
var playwright = _interopRequireWildcard(require("playwright"));
|
|
13
|
-
var _fsExtra = _interopRequireWildcard(require("fs-extra"));
|
|
14
|
-
var fs = _fsExtra;
|
|
15
|
-
var _path = require("path");
|
|
16
|
-
var _waitOn = _interopRequireDefault(require("wait-on"));
|
|
17
|
-
var _child_process = require("child_process");
|
|
18
|
-
var _extensionsHelpers = require("./extension/extensionsHelpers");
|
|
19
|
-
var _intunedExtensionServer = require("./extension/intunedExtensionServer");
|
|
20
|
-
var _util = require("util");
|
|
21
|
-
var _neverthrow = require("neverthrow");
|
|
22
|
-
var _zod = require("zod");
|
|
23
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
25
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
|
-
const execAsync = (0, _util.promisify)(_child_process.exec);
|
|
27
|
-
async function createUserDirWithPreferences() {
|
|
28
|
-
const playwrightTempDir = await (0, _fsExtra.mkdtemp)("/tmp/pw-");
|
|
29
|
-
const userDir = (0, _path.join)(playwrightTempDir, "userdir");
|
|
30
|
-
const defaultDir = (0, _path.join)(userDir, "Default");
|
|
31
|
-
await (0, _fsExtra.mkdir)(defaultDir, {
|
|
32
|
-
recursive: true
|
|
33
|
-
});
|
|
34
|
-
const preferences = {
|
|
35
|
-
plugins: {
|
|
36
|
-
always_open_pdf_externally: true
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
await (0, _fsExtra.writeFile)((0, _path.join)(defaultDir, "Preferences"), JSON.stringify(preferences));
|
|
40
|
-
return userDir;
|
|
41
|
-
}
|
|
42
|
-
async function launchChromium(options) {
|
|
43
|
-
if ("cdpAddress" in options) {
|
|
44
|
-
if (await (0, _extensionsHelpers.isIntunedExtensionEnabled)()) {
|
|
45
|
-
await (0, _intunedExtensionServer.setupIntunedExtensionServer)();
|
|
46
|
-
}
|
|
47
|
-
const browser = await playwright.chromium.connectOverCDP(options.cdpAddress);
|
|
48
|
-
if (browser.contexts().length === 0) {
|
|
49
|
-
throw new Error("No browser contexts found in the connected browser");
|
|
50
|
-
}
|
|
51
|
-
const context = browser.contexts()[0];
|
|
52
|
-
let page = context.pages().at(0) ?? (await context.newPage());
|
|
53
|
-
const targetId = options.cdpTargetId;
|
|
54
|
-
if (targetId) {
|
|
55
|
-
for (const p of context.pages()) {
|
|
56
|
-
let cdp = null;
|
|
57
|
-
try {
|
|
58
|
-
cdp = await context.newCDPSession(p);
|
|
59
|
-
const result = await cdp.send("Target.getTargetInfo");
|
|
60
|
-
if (result.targetInfo.targetId === targetId) {
|
|
61
|
-
page = p;
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
} catch (error) {} finally {
|
|
65
|
-
await cdp?.detach();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return {
|
|
70
|
-
page,
|
|
71
|
-
context
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
const {
|
|
75
|
-
headless,
|
|
76
|
-
appModeInitialUrl,
|
|
77
|
-
cdpPort,
|
|
78
|
-
proxy,
|
|
79
|
-
downloadsPath
|
|
80
|
-
} = options;
|
|
81
|
-
let {
|
|
82
|
-
executablePath
|
|
83
|
-
} = options;
|
|
84
|
-
const defaultArgsToIgnore = ["--disable-extensions", "--disable-component-extensions-with-background-pages", "--disable-background-networking", "--disable-backgrounding-occluded-windows", "--disable-background-timer-throttling"];
|
|
85
|
-
const extraArgs = [];
|
|
86
|
-
const userDataDir = await createUserDirWithPreferences();
|
|
87
|
-
if ((0, _extensionsHelpers.isIntunedExtensionLoaded)()) {
|
|
88
|
-
const extensionsList = (0, _extensionsHelpers.buildExtensionsList)();
|
|
89
|
-
const extensions = extensionsList.join(",");
|
|
90
|
-
extraArgs.push(`--disable-extensions-except=${extensions}`);
|
|
91
|
-
extraArgs.push(`--load-extension=${extensions}`);
|
|
92
|
-
}
|
|
93
|
-
if (await (0, _extensionsHelpers.isIntunedExtensionEnabled)()) {
|
|
94
|
-
await (0, _extensionsHelpers.setupIntunedExtension)();
|
|
95
|
-
if (proxy) {
|
|
96
|
-
extraArgs.push('--proxy-bypass-list="<-loopback>"');
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
if (cdpPort) {
|
|
100
|
-
extraArgs.push(`--remote-debugging-port=${cdpPort}`);
|
|
101
|
-
}
|
|
102
|
-
if (headless) {
|
|
103
|
-
defaultArgsToIgnore.push("--headless=old");
|
|
104
|
-
extraArgs.push("--headless=new");
|
|
105
|
-
}
|
|
106
|
-
if (appModeInitialUrl) {
|
|
107
|
-
extraArgs.push(`--app=${appModeInitialUrl}`);
|
|
108
|
-
}
|
|
109
|
-
if (executablePath) {
|
|
110
|
-
executablePath = await fs.realpath(executablePath);
|
|
111
|
-
if (!(await fs.exists(executablePath))) {
|
|
112
|
-
console.log(`Warning: Executable path ${executablePath} does not exist. Falling back to default.`);
|
|
113
|
-
executablePath = undefined;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
const viewport = null;
|
|
117
|
-
const userAgent = process.env.__PLAYWRIGHT_USER_AGENT_OVERRIDE ?? (await getHeadlessUserAgent({
|
|
118
|
-
executablePath
|
|
119
|
-
}));
|
|
120
|
-
const context = await playwright.chromium.launchPersistentContext(userDataDir, {
|
|
121
|
-
userAgent,
|
|
122
|
-
executablePath,
|
|
123
|
-
headless,
|
|
124
|
-
viewport,
|
|
125
|
-
proxy,
|
|
126
|
-
downloadsPath,
|
|
127
|
-
args: extraArgs,
|
|
128
|
-
ignoreDefaultArgs: defaultArgsToIgnore
|
|
129
|
-
});
|
|
130
|
-
context.once("close", async () => {
|
|
131
|
-
try {
|
|
132
|
-
await (0, _fsExtra.rm)(userDataDir, {
|
|
133
|
-
recursive: true,
|
|
134
|
-
force: true,
|
|
135
|
-
retryDelay: 1000,
|
|
136
|
-
maxRetries: 5
|
|
137
|
-
});
|
|
138
|
-
if (await (0, _extensionsHelpers.isIntunedExtensionEnabled)()) {
|
|
139
|
-
await (0, _intunedExtensionServer.cleanIntunedExtensionServer)();
|
|
140
|
-
}
|
|
141
|
-
} catch (error) {
|
|
142
|
-
console.error("Failed to remove user data dir", error);
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
if (cdpPort) {
|
|
146
|
-
const createdCdpAddress = getLocalCdpAddress(cdpPort);
|
|
147
|
-
await waitOnCdpAddress(createdCdpAddress);
|
|
148
|
-
}
|
|
149
|
-
const page = context.pages().at(0) ?? (await context.newPage());
|
|
150
|
-
if (await (0, _extensionsHelpers.isIntunedExtensionEnabled)()) {
|
|
151
|
-
await (0, _extensionsHelpers.getIntunedExtensionWorker)(context);
|
|
152
|
-
}
|
|
153
|
-
return {
|
|
154
|
-
page,
|
|
155
|
-
context
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
async function getBrowserExecutablePath() {
|
|
159
|
-
const browserType = getBrowserType();
|
|
160
|
-
if (browserType === "brave") {
|
|
161
|
-
return await getBraveExecutablePath();
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
async function launchBrowser(options) {
|
|
165
|
-
if ("cdpAddress" in options) {
|
|
166
|
-
return launchChromium(options);
|
|
167
|
-
}
|
|
168
|
-
return launchChromium({
|
|
169
|
-
...options,
|
|
170
|
-
executablePath: await getBrowserExecutablePath()
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
function getBrowserType() {
|
|
174
|
-
if (process.env.BROWSER_TYPE === "brave") {
|
|
175
|
-
return "brave";
|
|
176
|
-
}
|
|
177
|
-
return "chromium";
|
|
178
|
-
}
|
|
179
|
-
async function getBraveExecutablePath() {
|
|
180
|
-
const {
|
|
181
|
-
stdout
|
|
182
|
-
} = await execAsync("which brave-browser-stable");
|
|
183
|
-
const bravePath = stdout.trim();
|
|
184
|
-
if (bravePath.length === 0) {
|
|
185
|
-
throw new Error("Brave browser not found");
|
|
186
|
-
}
|
|
187
|
-
return bravePath;
|
|
188
|
-
}
|
|
189
|
-
function getLocalCdpAddress(port) {
|
|
190
|
-
return `http://localhost:${port}`;
|
|
191
|
-
}
|
|
192
|
-
async function getCdpWebSocketUrl(cdpAddress) {
|
|
193
|
-
let response;
|
|
194
|
-
try {
|
|
195
|
-
response = await fetch(`${cdpAddress}/json/version`);
|
|
196
|
-
} catch (error) {
|
|
197
|
-
return (0, _neverthrow.err)(`Failed to fetch CDP version from ${cdpAddress}: ${error instanceof Error ? error.message : String(error)}`);
|
|
198
|
-
}
|
|
199
|
-
if (!response.ok) {
|
|
200
|
-
return (0, _neverthrow.err)(`Failed to get CDP WebSocket URL from ${cdpAddress}: ${response.status} ${response.statusText}`);
|
|
201
|
-
}
|
|
202
|
-
let data;
|
|
203
|
-
try {
|
|
204
|
-
data = await response.json();
|
|
205
|
-
} catch (error) {
|
|
206
|
-
return (0, _neverthrow.err)(`Invalid CDP version response from ${cdpAddress}: ${error instanceof Error ? error.message : String(error)}`);
|
|
207
|
-
}
|
|
208
|
-
const cdpJsonVersionResponseSchema = _zod.z.object({
|
|
209
|
-
webSocketDebuggerUrl: _zod.z.string().url()
|
|
210
|
-
});
|
|
211
|
-
const parseResult = cdpJsonVersionResponseSchema.safeParse(data);
|
|
212
|
-
if (!parseResult.success) {
|
|
213
|
-
return (0, _neverthrow.err)(`Invalid CDP version response from ${cdpAddress}: ${JSON.stringify(parseResult.error.format())}`);
|
|
214
|
-
}
|
|
215
|
-
return (0, _neverthrow.ok)(parseResult.data.webSocketDebuggerUrl);
|
|
216
|
-
}
|
|
217
|
-
async function waitOnCdpAddress(cdpAddress) {
|
|
218
|
-
const cdpAddressWithoutProtocol = cdpAddress.replace("http://", "").replace("https://", "").replace("localhost", "127.0.0.1");
|
|
219
|
-
await (0, _waitOn.default)({
|
|
220
|
-
resources: [`http-get://${cdpAddressWithoutProtocol}/json/version`],
|
|
221
|
-
delay: 100,
|
|
222
|
-
interval: 100,
|
|
223
|
-
timeout: 5000,
|
|
224
|
-
tcpTimeout: 1000,
|
|
225
|
-
window: 1000
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
async function getHeadlessUserAgent({
|
|
229
|
-
executablePath,
|
|
230
|
-
args,
|
|
231
|
-
ignoreDefaultArgs
|
|
232
|
-
}) {
|
|
233
|
-
const browser = await playwright.chromium.launch({
|
|
234
|
-
headless: true,
|
|
235
|
-
executablePath,
|
|
236
|
-
args,
|
|
237
|
-
ignoreDefaultArgs
|
|
238
|
-
});
|
|
239
|
-
const context = await browser.newContext();
|
|
240
|
-
const page = await context.newPage();
|
|
241
|
-
let userAgent = await page.evaluate(() => navigator.userAgent);
|
|
242
|
-
await browser.close();
|
|
243
|
-
if (!userAgent || typeof userAgent !== "string") {
|
|
244
|
-
return undefined;
|
|
245
|
-
}
|
|
246
|
-
userAgent = userAgent.replace("HeadlessChrome", "Chrome");
|
|
247
|
-
return userAgent;
|
|
248
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type * as playwright from "playwright";
|
|
2
|
-
import { Err, Ok } from "neverthrow";
|
|
3
|
-
import { type Proxy } from "./launchBrowser";
|
|
4
|
-
import { ImportFunction, RunAutomationError, RunApiSession } from "@intuned/runtime-interface";
|
|
5
|
-
export declare const browserScriptsFile: string;
|
|
6
|
-
type WithPlaywrightContextParameters = {
|
|
7
|
-
importFunction: ImportFunction;
|
|
8
|
-
apiName: string;
|
|
9
|
-
apiParameters: any;
|
|
10
|
-
} | {
|
|
11
|
-
importFunction?: undefined;
|
|
12
|
-
apiName?: undefined;
|
|
13
|
-
apiParameters?: undefined;
|
|
14
|
-
};
|
|
15
|
-
type WithPlaywrightContextWrappedFunctionReturn<R> = Ok<R, any> | Err<any, RunAutomationError>;
|
|
16
|
-
export type WithPlaywrightContextWrappedFunction<R> = (context: playwright.BrowserContext, page: playwright.Page) => Promise<WithPlaywrightContextWrappedFunctionReturn<R>>;
|
|
17
|
-
export declare function withPlaywrightContext<R>(options: {
|
|
18
|
-
proxy?: Proxy;
|
|
19
|
-
headless: boolean;
|
|
20
|
-
downloadsPath: string;
|
|
21
|
-
} & WithPlaywrightContextParameters, fn: WithPlaywrightContextWrappedFunction<R>): Promise<Ok<R, any> | Err<any, RunAutomationError>>;
|
|
22
|
-
export declare function withPlaywrightContext<R>(options: {
|
|
23
|
-
cdpAddress: string;
|
|
24
|
-
cdpTargetId?: string;
|
|
25
|
-
} & WithPlaywrightContextParameters, fn: WithPlaywrightContextWrappedFunction<R>): Promise<Ok<R, any> | Err<any, RunAutomationError>>;
|
|
26
|
-
export declare function loadSessionToContext({ context, session, }: {
|
|
27
|
-
context: playwright.BrowserContext;
|
|
28
|
-
session: RunApiSession;
|
|
29
|
-
}): Promise<void>;
|
|
30
|
-
export {};
|