@intuned/runtime-dev 1.3.9-dev8 → 1.3.11-deployment.0
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/InterfaceTemplate/index.playwright.ts +1 -1
- package/WebTemplate.zip +0 -0
- package/bin/intuned +1 -1
- package/bin/intuned-api-run +1 -1
- package/bin/intuned-auth-session-check +1 -1
- package/bin/intuned-auth-session-create +1 -1
- package/bin/intuned-auth-session-load +1 -1
- package/dist/commands/intuned-cli/commands/attempt_api.command.js +1 -1
- package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +1 -1
- package/dist/commands/intuned-cli/commands/run_api.command.js +1 -1
- package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +3 -0
- package/dist/commands/intuned-cli/commands/types.d.ts +4 -0
- package/dist/commands/intuned-cli/commands/types.js +5 -3
- package/dist/commands/intuned-cli/controller/api.d.ts +1 -1
- package/dist/commands/intuned-cli/controller/api.js +4 -2
- package/dist/commands/intuned-cli/controller/authSession.d.ts +2 -2
- package/dist/commands/intuned-cli/controller/authSession.js +8 -4
- package/dist/commands/intuned-cli/controller/deploy.d.ts +1 -0
- package/dist/commands/intuned-cli/controller/deploy.js +141 -6
- package/dist/commands/intuned-cli/controller/save.d.ts +4 -1
- package/dist/commands/intuned-cli/controller/save.js +8 -2
- package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +11 -0
- package/dist/commands/intuned-cli/helpers/backend.js +1 -1
- package/dist/commands/intuned-cli/helpers/browser.d.ts +2 -1
- package/dist/commands/intuned-cli/helpers/browser.js +8 -1
- package/dist/commands/intuned-cli/helpers/errors.d.ts +3 -0
- package/dist/commands/intuned-cli/helpers/errors.js +8 -1
- package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +113 -11
- package/dist/commands/intuned-cli/helpers/intunedJson.js +19 -3
- package/dist/commands/intuned-cli/helpers/wrapper.js +7 -1
- package/dist/commands/intuned-cli/main.js +1 -0
- package/{package/dist/commands/common/utils/fileUtils.js → dist/common/binStartupScript.js} +26 -25
- package/package.json +6 -2
- package/bin/common.js +0 -30
- package/package/dist/commands/api/run.d.ts +0 -6
- package/package/dist/commands/api/run.js +0 -123
- package/package/dist/commands/auth-sessions/load.d.ts +0 -2
- package/package/dist/commands/auth-sessions/load.js +0 -35
- package/package/dist/commands/auth-sessions/run-check.d.ts +0 -2
- package/package/dist/commands/auth-sessions/run-check.js +0 -74
- package/package/dist/commands/auth-sessions/run-create.d.ts +0 -2
- package/package/dist/commands/auth-sessions/run-create.js +0 -78
- package/package/dist/commands/browser/save-state.d.ts +0 -2
- package/package/dist/commands/browser/save-state.js +0 -17
- package/package/dist/commands/browser/start-browser.d.ts +0 -2
- package/package/dist/commands/browser/start-browser.js +0 -14
- package/package/dist/commands/build.js +0 -84
- package/package/dist/commands/common/browserUtils.d.ts +0 -14
- package/package/dist/commands/common/browserUtils.js +0 -58
- package/package/dist/commands/common/getFirstLineNumber.d.ts +0 -9
- package/package/dist/commands/common/getFirstLineNumber.js +0 -101
- package/package/dist/commands/common/getFirstLineNumber.test.js +0 -228
- package/package/dist/commands/common/projectExclusions.d.ts +0 -2
- package/package/dist/commands/common/projectExclusions.js +0 -8
- package/package/dist/commands/common/sendMessageToClient.d.ts +0 -1
- package/package/dist/commands/common/sendMessageToClient.js +0 -10
- package/package/dist/commands/common/tsNodeImport.d.ts +0 -2
- package/package/dist/commands/common/tsNodeImport.js +0 -34
- package/package/dist/commands/common/utils/fileUtils.d.ts +0 -6
- package/package/dist/commands/common/utils/settings.d.ts +0 -2
- package/package/dist/commands/common/utils/settings.js +0 -31
- package/package/dist/commands/common/utils/template.d.ts +0 -2
- package/package/dist/commands/common/utils/template.js +0 -31
- package/package/dist/commands/common/utils/unixSocket.d.ts +0 -9
- package/package/dist/commands/common/utils/unixSocket.js +0 -44
- package/package/dist/commands/interface/run.d.ts +0 -1
- package/package/dist/commands/interface/run.js +0 -216
- package/package/dist/commands/intuned-cli/commands/attempt.command.d.ts +0 -1
- package/package/dist/commands/intuned-cli/commands/attempt.command.js +0 -8
- package/package/dist/commands/intuned-cli/commands/attempt_api.command.d.ts +0 -1
- package/package/dist/commands/intuned-cli/commands/attempt_api.command.js +0 -30
- package/package/dist/commands/intuned-cli/commands/attempt_authsession.command.d.ts +0 -1
- package/package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +0 -8
- package/package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.d.ts +0 -1
- package/package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +0 -19
- package/package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.d.ts +0 -1
- package/package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +0 -24
- package/package/dist/commands/intuned-cli/commands/authsession.command.d.ts +0 -1
- package/package/dist/commands/intuned-cli/commands/authsession.command.js +0 -8
- package/package/dist/commands/intuned-cli/commands/authsession_record.command.d.ts +0 -1
- package/package/dist/commands/intuned-cli/commands/authsession_record.command.js +0 -31
- package/package/dist/commands/intuned-cli/commands/build.command.d.ts +0 -1
- package/package/dist/commands/intuned-cli/commands/build.command.js +0 -12
- package/package/dist/commands/intuned-cli/commands/command.d.ts +0 -2
- package/package/dist/commands/intuned-cli/commands/command.js +0 -9
- package/package/dist/commands/intuned-cli/commands/deploy.command.d.ts +0 -1
- package/package/dist/commands/intuned-cli/commands/deploy.command.js +0 -38
- package/package/dist/commands/intuned-cli/commands/index.d.ts +0 -18
- package/package/dist/commands/intuned-cli/commands/index.js +0 -203
- package/package/dist/commands/intuned-cli/commands/init.command.d.ts +0 -1
- package/package/dist/commands/intuned-cli/commands/init.command.js +0 -13
- package/package/dist/commands/intuned-cli/commands/run.command.d.ts +0 -1
- package/package/dist/commands/intuned-cli/commands/run.command.js +0 -8
- package/package/dist/commands/intuned-cli/commands/run_api.command.d.ts +0 -1
- package/package/dist/commands/intuned-cli/commands/run_api.command.js +0 -46
- package/package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +0 -28
- package/package/dist/commands/intuned-cli/commands/run_authsession.command.js +0 -17
- package/package/dist/commands/intuned-cli/commands/run_authsession_create.command.d.ts +0 -1
- package/package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +0 -35
- package/package/dist/commands/intuned-cli/commands/run_authsession_update.command.d.ts +0 -1
- package/package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +0 -35
- package/package/dist/commands/intuned-cli/commands/run_authsession_validate.command.d.ts +0 -1
- package/package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +0 -33
- package/package/dist/commands/intuned-cli/commands/save.command.d.ts +0 -13
- package/package/dist/commands/intuned-cli/commands/save.command.js +0 -42
- package/package/dist/commands/intuned-cli/commands/types.d.ts +0 -31
- package/package/dist/commands/intuned-cli/commands/types.js +0 -29
- package/package/dist/commands/intuned-cli/constants/index.d.ts +0 -17
- package/package/dist/commands/intuned-cli/constants/index.js +0 -25
- package/package/dist/commands/intuned-cli/controller/__test__/api.test.js +0 -397
- package/package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +0 -1059
- package/package/dist/commands/intuned-cli/controller/api.d.ts +0 -42
- package/package/dist/commands/intuned-cli/controller/api.js +0 -189
- package/package/dist/commands/intuned-cli/controller/authSession.d.ts +0 -209
- package/package/dist/commands/intuned-cli/controller/authSession.js +0 -420
- package/package/dist/commands/intuned-cli/controller/build.d.ts +0 -1
- package/package/dist/commands/intuned-cli/controller/build.js +0 -36
- package/package/dist/commands/intuned-cli/controller/deploy.d.ts +0 -4
- package/package/dist/commands/intuned-cli/controller/deploy.js +0 -139
- package/package/dist/commands/intuned-cli/controller/index.d.ts +0 -1
- package/package/dist/commands/intuned-cli/controller/index.js +0 -46
- package/package/dist/commands/intuned-cli/controller/save.d.ts +0 -14
- package/package/dist/commands/intuned-cli/controller/save.js +0 -345
- package/package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +0 -103
- package/package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +0 -40
- package/package/dist/commands/intuned-cli/helpers/api.d.ts +0 -3
- package/package/dist/commands/intuned-cli/helpers/api.js +0 -19
- package/package/dist/commands/intuned-cli/helpers/auth.d.ts +0 -46
- package/package/dist/commands/intuned-cli/helpers/auth.js +0 -144
- package/package/dist/commands/intuned-cli/helpers/backend.d.ts +0 -8
- package/package/dist/commands/intuned-cli/helpers/backend.js +0 -27
- package/package/dist/commands/intuned-cli/helpers/browser.d.ts +0 -14
- package/package/dist/commands/intuned-cli/helpers/browser.js +0 -57
- package/package/dist/commands/intuned-cli/helpers/context.d.ts +0 -3
- package/package/dist/commands/intuned-cli/helpers/context.js +0 -33
- package/package/dist/commands/intuned-cli/helpers/errors.d.ts +0 -13
- package/package/dist/commands/intuned-cli/helpers/errors.js +0 -37
- package/package/dist/commands/intuned-cli/helpers/index.d.ts +0 -12
- package/package/dist/commands/intuned-cli/helpers/index.js +0 -137
- package/package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +0 -69
- package/package/dist/commands/intuned-cli/helpers/intunedJson.js +0 -71
- package/package/dist/commands/intuned-cli/helpers/proxy.d.ts +0 -5
- package/package/dist/commands/intuned-cli/helpers/proxy.js +0 -23
- package/package/dist/commands/intuned-cli/helpers/terminal.d.ts +0 -5
- package/package/dist/commands/intuned-cli/helpers/terminal.js +0 -13
- package/package/dist/commands/intuned-cli/helpers/timeout.d.ts +0 -1
- package/package/dist/commands/intuned-cli/helpers/timeout.js +0 -23
- package/package/dist/commands/intuned-cli/helpers/traces.d.ts +0 -2
- package/package/dist/commands/intuned-cli/helpers/traces.js +0 -32
- package/package/dist/commands/intuned-cli/helpers/validation.d.ts +0 -2
- package/package/dist/commands/intuned-cli/helpers/validation.js +0 -14
- package/package/dist/commands/intuned-cli/helpers/wrapper.d.ts +0 -2
- package/package/dist/commands/intuned-cli/helpers/wrapper.js +0 -60
- package/package/dist/commands/intuned-cli/index.d.ts +0 -1
- package/package/dist/commands/intuned-cli/index.js +0 -16
- package/package/dist/commands/intuned-cli/main.d.ts +0 -1
- package/package/dist/commands/intuned-cli/main.js +0 -22
- package/package/dist/commands/intuned-cli/types.d.ts +0 -41
- package/package/dist/commands/intuned-cli/types.js +0 -12
- package/package/dist/commands/ts-check.d.ts +0 -2
- package/package/dist/commands/ts-check.js +0 -56
- package/package/dist/common/Logger/Logger/index.d.ts +0 -12
- package/package/dist/common/Logger/Logger/index.js +0 -60
- package/package/dist/common/Logger/Logger/types.d.ts +0 -8
- package/package/dist/common/Logger/Logger/types.js +0 -5
- package/package/dist/common/Logger/index.d.ts +0 -12
- package/package/dist/common/Logger/index.js +0 -60
- package/package/dist/common/Logger/types.d.ts +0 -8
- package/package/dist/common/Logger/types.js +0 -5
- package/package/dist/common/assets/browser_scripts.js +0 -2580
- package/package/dist/common/asyncLocalStorage/index.d.ts +0 -16
- package/package/dist/common/asyncLocalStorage/index.js +0 -17
- package/package/dist/common/backendFunctions/getAuthSessionParameters.d.ts +0 -1
- package/package/dist/common/backendFunctions/getAuthSessionParameters.js +0 -38
- package/package/dist/common/cleanEnvironmentVariables.d.ts +0 -1
- package/package/dist/common/cleanEnvironmentVariables.js +0 -16
- package/package/dist/common/constants.d.ts +0 -10
- package/package/dist/common/constants.js +0 -16
- package/package/dist/common/contextStorageStateHelpers.d.ts +0 -21
- package/package/dist/common/contextStorageStateHelpers.js +0 -81
- package/package/dist/common/extensionsHelpers.d.ts +0 -8
- package/package/dist/common/extensionsHelpers.js +0 -80
- package/package/dist/common/formatZodError.d.ts +0 -2
- package/package/dist/common/formatZodError.js +0 -18
- package/package/dist/common/jwtTokenManager.d.ts +0 -17
- package/package/dist/common/jwtTokenManager.js +0 -109
- package/package/dist/common/launchBrowser.d.ts +0 -25
- package/package/dist/common/launchBrowser.js +0 -172
- package/package/dist/common/playwrightContext.d.ts +0 -31
- package/package/dist/common/playwrightContext.js +0 -144
- package/package/dist/common/runApi/errors.d.ts +0 -72
- package/package/dist/common/runApi/errors.js +0 -169
- package/package/dist/common/runApi/importUsingImportFunction.d.ts +0 -9
- package/package/dist/common/runApi/importUsingImportFunction.js +0 -46
- package/package/dist/common/runApi/index.d.ts +0 -11
- package/package/dist/common/runApi/index.js +0 -199
- package/package/dist/common/runApi/types.d.ts +0 -830
- package/package/dist/common/runApi/types.js +0 -73
- package/package/dist/common/settingsSchema.d.ts +0 -518
- package/package/dist/common/settingsSchema.js +0 -57
- package/package/dist/common/setupContextHook.d.ts +0 -17
- package/package/dist/common/setupContextHook.js +0 -22
- package/package/dist/common/telemetry.d.ts +0 -3
- package/package/dist/common/telemetry.js +0 -32
- package/package/dist/index.d.ts +0 -4
- package/package/dist/index.js +0 -69
- package/package/dist/runtime/RunError.d.ts +0 -5
- package/package/dist/runtime/RunError.js +0 -19
- package/package/dist/runtime/attemptStore.d.ts +0 -2
- package/package/dist/runtime/attemptStore.js +0 -23
- package/package/dist/runtime/downloadDirectory.d.ts +0 -1
- package/package/dist/runtime/downloadDirectory.js +0 -19
- package/package/dist/runtime/enums.d.js +0 -5
- package/package/dist/runtime/enums.d.ts +0 -11
- package/package/dist/runtime/enums.js +0 -18
- package/package/dist/runtime/executionHelpers.test.js +0 -52
- package/package/dist/runtime/export.d.js +0 -5
- package/package/dist/runtime/export.d.ts +0 -228
- package/package/dist/runtime/extendPayload.d.ts +0 -2
- package/package/dist/runtime/extendPayload.js +0 -21
- package/package/dist/runtime/extendTimeout.d.ts +0 -1
- package/package/dist/runtime/extendTimeout.js +0 -23
- package/package/dist/runtime/getAuthSessionParameters.d.ts +0 -1
- package/package/dist/runtime/getAuthSessionParameters.js +0 -20
- package/package/dist/runtime/index.d.ts +0 -7
- package/package/dist/runtime/index.js +0 -54
- package/package/dist/runtime/runInfo.d.ts +0 -2
- package/package/dist/runtime/runInfo.js +0 -21
- /package/{package/dist/commands/build.d.ts → dist/common/binStartupScript.d.ts} +0 -0
package/WebTemplate.zip
ADDED
|
Binary file
|
package/bin/intuned
CHANGED
package/bin/intuned-api-run
CHANGED
|
@@ -15,7 +15,7 @@ const optionsSchema = _types.baseCommandOptionsSchema.extend({
|
|
|
15
15
|
authSession: _zod.z.string().optional(),
|
|
16
16
|
outputFile: _zod.z.string().optional()
|
|
17
17
|
});
|
|
18
|
-
const attemptApiCommand = exports.attemptApiCommand = (0, _types.withBaseOptions)(_attempt.attemptCommand.command("api").description("Execute an Intuned API attempt with parameters").argument("<api-name>", "Name of the API to run").argument("<parameters>", "Path to the JSON file containing API parameters OR the parameters as a JSON string").option("-a, --auth-session <id>", "ID of the auth session to use for the API. This is expected to be in ./auth-
|
|
18
|
+
const attemptApiCommand = exports.attemptApiCommand = (0, _types.withBaseOptions)(_attempt.attemptCommand.command("api").description("Execute an Intuned API attempt with parameters").argument("<api-name>", "Name of the API to run").argument("<parameters>", "Path to the JSON file containing API parameters OR the parameters as a JSON string").option("-a, --auth-session <id>", "ID of the auth session to use for the API. This is expected to be in ./auth-sessions-instances/<id>.json").option("-o, --output-file <path>", "output file path")).action((0, _helpers.cliCommandWrapper)(argsSchema, optionsSchema, async ([apiName, parameters], {
|
|
19
19
|
authSession,
|
|
20
20
|
...rest
|
|
21
21
|
}) => {
|
|
@@ -14,7 +14,7 @@ const argsSchema = _zod.z.tuple([_zod.z.string().min(1, "Parameters are required
|
|
|
14
14
|
const optionsSchema = _types.baseCommandOptionsSchema.extend({
|
|
15
15
|
id: _zod.z.string().optional()
|
|
16
16
|
});
|
|
17
|
-
const attemptAuthSessionCreateCommand = exports.attemptAuthSessionCreateCommand = (0, _types.withBaseOptions)(_attempt_authsession.attemptAuthSessionCommand.command("create").description("Create a new auth session").argument("<parameters>", "Parameters for the auth session command").option("--id <id>", "ID of the auth session to use for the command. Defaults to ./auth-
|
|
17
|
+
const attemptAuthSessionCreateCommand = exports.attemptAuthSessionCreateCommand = (0, _types.withBaseOptions)(_attempt_authsession.attemptAuthSessionCommand.command("create").description("Create a new auth session").argument("<parameters>", "Parameters for the auth session command").option("--id <id>", "ID of the auth session to use for the command. Defaults to ./auth-sessions-instances/[current timestamp].json")).action((0, _helpers.cliCommandWrapper)(argsSchema, optionsSchema, async ([parameters], options) => {
|
|
18
18
|
await (0, _helpers.assertAuthEnabled)();
|
|
19
19
|
const authSessionInput = (await (0, _controller.loadParameters)(parameters)) ?? {};
|
|
20
20
|
await (0, _authSession.executeAttemptCreateAuthSessionCLI)({
|
|
@@ -19,7 +19,7 @@ const optionsSchema = _types.baseCommandOptionsSchema.extend({
|
|
|
19
19
|
authSessionCheckAttempts: _types.authSessionCheckAttemptsSchema,
|
|
20
20
|
authSessionCreateAttempts: _types.authSessionCreateAttemptsSchema
|
|
21
21
|
});
|
|
22
|
-
const runApiCommand = exports.runApiCommand = (0, _types.withBaseOptions)(_run.runCommand.command("api").description("Execute an Intuned API run with parameters").argument("<api-name>", "Name of the API to run").argument("<parameters>", "Path to the JSON file containing API parameters OR the parameters as a JSON string").option("-a, --auth-session <id>", "ID of the auth session to use for the API. This is expected to be in ./auth-
|
|
22
|
+
const runApiCommand = exports.runApiCommand = (0, _types.withBaseOptions)(_run.runCommand.command("api").description("Execute an Intuned API run with parameters").argument("<api-name>", "Name of the API to run").argument("<parameters>", "Path to the JSON file containing API parameters OR the parameters as a JSON string").option("-a, --auth-session <id>", "ID of the auth session to use for the API. This is expected to be in ./auth-sessions-instances/<id>").option("--retries <number>", "Number of retries for the API call", "1").option("--no-auth-session-auto-recreate", "disable auto recreate for auth session").option("--auth-session-check-attempts <number>", "auth session check attempts", "1").option("--auth-session-create-attempts <number>", "auth session create attempts", "1").option("-o, --output-file <path>", "output file path")).action((0, _helpers.cliCommandWrapper)(argsSchema, optionsSchema, async ([apiName, parameters], {
|
|
23
23
|
retries,
|
|
24
24
|
outputFile,
|
|
25
25
|
authSession,
|
|
@@ -4,6 +4,7 @@ export declare const baseRunAuthSessionCommandOptionsSchema: import("zod").ZodOb
|
|
|
4
4
|
headless: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
5
5
|
timeout: import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodDefault<import("zod").ZodString>, import("ms").StringValue, string | undefined>, number, string | undefined>;
|
|
6
6
|
keepBrowserOpen: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
7
|
+
cdpUrl: import("zod").ZodOptional<import("zod").ZodString>;
|
|
7
8
|
trace: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
8
9
|
checkAttempts: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
9
10
|
createAttempts: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
@@ -15,11 +16,13 @@ export declare const baseRunAuthSessionCommandOptionsSchema: import("zod").ZodOb
|
|
|
15
16
|
checkAttempts: number;
|
|
16
17
|
createAttempts: number;
|
|
17
18
|
proxy?: string | undefined;
|
|
19
|
+
cdpUrl?: string | undefined;
|
|
18
20
|
}, {
|
|
19
21
|
proxy?: string | undefined;
|
|
20
22
|
headless?: boolean | undefined;
|
|
21
23
|
timeout?: string | undefined;
|
|
22
24
|
keepBrowserOpen?: boolean | undefined;
|
|
25
|
+
cdpUrl?: string | undefined;
|
|
23
26
|
trace?: boolean | undefined;
|
|
24
27
|
checkAttempts?: number | undefined;
|
|
25
28
|
createAttempts?: number | undefined;
|
|
@@ -8,24 +8,28 @@ export declare const timeoutSchema: z.ZodEffects<z.ZodEffects<z.ZodDefault<z.Zod
|
|
|
8
8
|
export declare const headlessSchema: z.ZodDefault<z.ZodBoolean>;
|
|
9
9
|
export declare const traceSchema: z.ZodDefault<z.ZodBoolean>;
|
|
10
10
|
export declare const keepBrowserOpenSchema: z.ZodDefault<z.ZodBoolean>;
|
|
11
|
+
export declare const cdpUrlSchema: z.ZodOptional<z.ZodString>;
|
|
11
12
|
export declare const baseCommandOptionsSchema: z.ZodObject<{
|
|
12
13
|
proxy: z.ZodOptional<z.ZodString>;
|
|
13
14
|
timeout: z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodString>, ms.StringValue, string | undefined>, number, string | undefined>;
|
|
14
15
|
headless: z.ZodDefault<z.ZodBoolean>;
|
|
15
16
|
trace: z.ZodDefault<z.ZodBoolean>;
|
|
16
17
|
keepBrowserOpen: z.ZodDefault<z.ZodBoolean>;
|
|
18
|
+
cdpUrl: z.ZodOptional<z.ZodString>;
|
|
17
19
|
}, "strip", z.ZodTypeAny, {
|
|
18
20
|
headless: boolean;
|
|
19
21
|
timeout: number;
|
|
20
22
|
keepBrowserOpen: boolean;
|
|
21
23
|
trace: boolean;
|
|
22
24
|
proxy?: string | undefined;
|
|
25
|
+
cdpUrl?: string | undefined;
|
|
23
26
|
}, {
|
|
24
27
|
proxy?: string | undefined;
|
|
25
28
|
timeout?: string | undefined;
|
|
26
29
|
headless?: boolean | undefined;
|
|
27
30
|
trace?: boolean | undefined;
|
|
28
31
|
keepBrowserOpen?: boolean | undefined;
|
|
32
|
+
cdpUrl?: string | undefined;
|
|
29
33
|
}>;
|
|
30
34
|
export type BaseCommandOptions = z.infer<typeof baseCommandOptionsSchema>;
|
|
31
35
|
export declare function withBaseOptions(command: Command): Command;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.traceSchema = exports.timeoutSchema = exports.proxySchema = exports.keepBrowserOpenSchema = exports.headlessSchema = exports.baseCommandOptionsSchema = exports.authSessionCreateAttemptsSchema = exports.authSessionCheckAttemptsSchema = void 0;
|
|
6
|
+
exports.traceSchema = exports.timeoutSchema = exports.proxySchema = exports.keepBrowserOpenSchema = exports.headlessSchema = exports.cdpUrlSchema = exports.baseCommandOptionsSchema = exports.authSessionCreateAttemptsSchema = exports.authSessionCheckAttemptsSchema = void 0;
|
|
7
7
|
exports.withBaseOptions = withBaseOptions;
|
|
8
8
|
var _ms = _interopRequireDefault(require("ms"));
|
|
9
9
|
var _zod = require("zod");
|
|
@@ -17,13 +17,15 @@ const timeoutSchema = exports.timeoutSchema = _zod.z.string().default("10 mins")
|
|
|
17
17
|
const headlessSchema = exports.headlessSchema = _zod.z.boolean().default(false);
|
|
18
18
|
const traceSchema = exports.traceSchema = _zod.z.boolean().default(false);
|
|
19
19
|
const keepBrowserOpenSchema = exports.keepBrowserOpenSchema = _zod.z.boolean().default(false);
|
|
20
|
+
const cdpUrlSchema = exports.cdpUrlSchema = _zod.z.string().url().optional();
|
|
20
21
|
const baseCommandOptionsSchema = exports.baseCommandOptionsSchema = _zod.z.object({
|
|
21
22
|
proxy: proxySchema,
|
|
22
23
|
timeout: timeoutSchema,
|
|
23
24
|
headless: headlessSchema,
|
|
24
25
|
trace: traceSchema,
|
|
25
|
-
keepBrowserOpen: keepBrowserOpenSchema
|
|
26
|
+
keepBrowserOpen: keepBrowserOpenSchema,
|
|
27
|
+
cdpUrl: cdpUrlSchema
|
|
26
28
|
});
|
|
27
29
|
function withBaseOptions(command) {
|
|
28
|
-
return command.option("--proxy <url>", "Proxy URL to use for browser").option("--timeout <time>", "Timeout for each attempt - milliseconds or ms-formatted string", "10 mins").option("--headless", "Run the attempts in a headless browser (default: false). This will not open a browser window.").option("--trace", "Capture a trace of each attempt, useful for debugging.").option("--keep-browser-open", "Keep the last browser open after the command completes, useful for debugging.");
|
|
30
|
+
return command.option("--proxy <url>", "Proxy URL to use for browser").option("--timeout <time>", "Timeout for each attempt - milliseconds or ms-formatted string", "10 mins").option("--headless", "Run the attempts in a headless browser (default: false). This will not open a browser window.").option("--trace", "Capture a trace of each attempt, useful for debugging.").option("--keep-browser-open", "Keep the last browser open after the command completes, useful for debugging.").option("--cdp-url <url>", "[Experimental] Chrome DevTools Protocol URL to connect to an existing browser instance. Disables proxy, headless, keep_browser_open options.");
|
|
29
31
|
}
|
|
@@ -29,7 +29,7 @@ declare function handleApiResult({ apiResult, outputFile, }: {
|
|
|
29
29
|
export declare const _handleApiResult: typeof handleApiResult;
|
|
30
30
|
declare function writeResultToFile(outputFile: string, result: any, payloadToAppend?: Payload[]): Promise<void>;
|
|
31
31
|
export declare const _writeResultToFile: typeof writeResultToFile;
|
|
32
|
-
declare function attemptApi({ apiName, inputData, auth, proxy, headless, timeout, traceId, keepBrowserOpen, }: {
|
|
32
|
+
declare function attemptApi({ apiName, inputData, auth, proxy, headless, timeout, traceId, keepBrowserOpen, cdpUrl, }: {
|
|
33
33
|
apiName: string;
|
|
34
34
|
inputData: object | null | undefined;
|
|
35
35
|
auth?: RunApiStorageState;
|
|
@@ -150,7 +150,8 @@ async function attemptApi({
|
|
|
150
150
|
headless,
|
|
151
151
|
timeout,
|
|
152
152
|
traceId,
|
|
153
|
-
keepBrowserOpen
|
|
153
|
+
keepBrowserOpen,
|
|
154
|
+
cdpUrl
|
|
154
155
|
}) {
|
|
155
156
|
return await (0, _helpers.withTimeout)(async abortSignal => (0, _helpers.withCLITrace)(async tracing => {
|
|
156
157
|
const runApiResult = await (0, _runApi.runApi)({
|
|
@@ -161,7 +162,8 @@ async function attemptApi({
|
|
|
161
162
|
runOptions: await (0, _browser.getCLIRunOptions)({
|
|
162
163
|
headless,
|
|
163
164
|
proxy,
|
|
164
|
-
keepBrowserOpen
|
|
165
|
+
keepBrowserOpen,
|
|
166
|
+
cdpUrl
|
|
165
167
|
}),
|
|
166
168
|
auth: auth ? {
|
|
167
169
|
session: {
|
|
@@ -128,12 +128,12 @@ export declare function executeAttemptCheckAuthSessionCLI({ id, ...rest }: {
|
|
|
128
128
|
origin: string;
|
|
129
129
|
}[] | undefined;
|
|
130
130
|
}>;
|
|
131
|
-
declare function runCheck({ auth, proxy, headless, timeout, traceId, keepBrowserOpen, }: {
|
|
131
|
+
declare function runCheck({ auth, proxy, headless, timeout, traceId, keepBrowserOpen, cdpUrl, }: {
|
|
132
132
|
auth: RunApiStorageState;
|
|
133
133
|
traceId?: string;
|
|
134
134
|
} & Omit<BaseCommandOptions, "trace">): Promise<boolean>;
|
|
135
135
|
export declare const _runCheck: typeof runCheck;
|
|
136
|
-
declare function runCreate({ authSessionInput, proxy, headless, timeout, traceId, keepBrowserOpen, }: {
|
|
136
|
+
declare function runCreate({ authSessionInput, proxy, headless, timeout, traceId, keepBrowserOpen, cdpUrl, }: {
|
|
137
137
|
authSessionInput: Record<string, any>;
|
|
138
138
|
traceId?: string;
|
|
139
139
|
} & Omit<BaseCommandOptions, "trace">): Promise<{
|
|
@@ -171,7 +171,8 @@ async function runCheck({
|
|
|
171
171
|
headless,
|
|
172
172
|
timeout,
|
|
173
173
|
traceId,
|
|
174
|
-
keepBrowserOpen
|
|
174
|
+
keepBrowserOpen,
|
|
175
|
+
cdpUrl
|
|
175
176
|
}) {
|
|
176
177
|
return await (0, _helpers.withTimeout)(async abortSignal => (0, _helpers.withCLITrace)(async tracing => {
|
|
177
178
|
const runApiResult = await (0, _runApi.runApi)({
|
|
@@ -181,7 +182,8 @@ async function runCheck({
|
|
|
181
182
|
runOptions: await (0, _browser.getCLIRunOptions)({
|
|
182
183
|
headless,
|
|
183
184
|
proxy,
|
|
184
|
-
keepBrowserOpen
|
|
185
|
+
keepBrowserOpen,
|
|
186
|
+
cdpUrl
|
|
185
187
|
}),
|
|
186
188
|
auth: {
|
|
187
189
|
session: {
|
|
@@ -210,7 +212,8 @@ async function runCreate({
|
|
|
210
212
|
headless,
|
|
211
213
|
timeout,
|
|
212
214
|
traceId,
|
|
213
|
-
keepBrowserOpen
|
|
215
|
+
keepBrowserOpen,
|
|
216
|
+
cdpUrl
|
|
214
217
|
}) {
|
|
215
218
|
return await (0, _helpers.withTimeout)(async abortSignal => (0, _helpers.withCLITrace)(async tracing => {
|
|
216
219
|
const result = await (0, _runApi.runApi)({
|
|
@@ -221,7 +224,8 @@ async function runCreate({
|
|
|
221
224
|
runOptions: await (0, _browser.getCLIRunOptions)({
|
|
222
225
|
headless,
|
|
223
226
|
proxy,
|
|
224
|
-
keepBrowserOpen
|
|
227
|
+
keepBrowserOpen,
|
|
228
|
+
cdpUrl
|
|
225
229
|
}),
|
|
226
230
|
retrieveSession: true,
|
|
227
231
|
tracing,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { AuthCredentials } from "../types";
|
|
3
|
+
export declare const START_RUN_INPUT_QUERY_PARAM_KEY = "startRunInput";
|
|
3
4
|
export declare function runDeployProject(projectName: string, auth: AuthCredentials): Promise<void>;
|
|
4
5
|
export declare const projectNameSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.projectNameSchema = void 0;
|
|
6
|
+
exports.projectNameSchema = exports.START_RUN_INPUT_QUERY_PARAM_KEY = void 0;
|
|
7
7
|
exports.runDeployProject = runDeployProject;
|
|
8
8
|
var _zod = require("zod");
|
|
9
9
|
var _constants = require("../constants");
|
|
@@ -13,9 +13,22 @@ var _promises = require("timers/promises");
|
|
|
13
13
|
var _ms = _interopRequireDefault(require("ms"));
|
|
14
14
|
var _save = require("./save");
|
|
15
15
|
var _constants2 = require("../../../common/constants");
|
|
16
|
+
var _path = _interopRequireDefault(require("path"));
|
|
17
|
+
var fs = _interopRequireWildcard(require("fs-extra"));
|
|
18
|
+
var _prompts = _interopRequireDefault(require("prompts"));
|
|
19
|
+
var _terminalLink = _interopRequireDefault(require("terminal-link"));
|
|
20
|
+
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); }
|
|
21
|
+
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; }
|
|
16
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
|
+
const START_RUN_INPUT_QUERY_PARAM_KEY = exports.START_RUN_INPUT_QUERY_PARAM_KEY = "startRunInput";
|
|
17
24
|
async function runDeployProject(projectName, auth) {
|
|
18
|
-
await (0, _save.runSaveProject)(projectName, auth);
|
|
25
|
+
const result = await (0, _save.runSaveProject)(projectName, auth);
|
|
26
|
+
const enableFirstRunExperience = result?.enableFirstRunExperience ?? false;
|
|
27
|
+
let firstRunExperienceInput = undefined;
|
|
28
|
+
const settings = await (0, _helpers.loadIntunedJson)();
|
|
29
|
+
if (enableFirstRunExperience) {
|
|
30
|
+
firstRunExperienceInput = await promptFirstRunExperience(settings);
|
|
31
|
+
}
|
|
19
32
|
const {
|
|
20
33
|
workspaceId,
|
|
21
34
|
apiKey
|
|
@@ -28,7 +41,10 @@ async function runDeployProject(projectName, auth) {
|
|
|
28
41
|
};
|
|
29
42
|
const response = await fetch(url, {
|
|
30
43
|
headers,
|
|
31
|
-
method: "POST"
|
|
44
|
+
method: "POST",
|
|
45
|
+
body: JSON.stringify({
|
|
46
|
+
firstRunExperienceInput
|
|
47
|
+
})
|
|
32
48
|
});
|
|
33
49
|
if (!response.ok) {
|
|
34
50
|
if (response.status === 401) {
|
|
@@ -85,8 +101,40 @@ async function runDeployProject(projectName, auth) {
|
|
|
85
101
|
}
|
|
86
102
|
if (status === "completed") {
|
|
87
103
|
const url = (0, _helpers.getBaseUrl)();
|
|
88
|
-
(0, _terminal.terminal)(`\n^g^+Project deployed successfully!^:\n`);
|
|
89
|
-
|
|
104
|
+
(0, _terminal.terminal)(`\n^g^+Project deployed successfully!^:\n\n`);
|
|
105
|
+
const projectUrl = `${url}/projects/${projectId}`;
|
|
106
|
+
const runsUrl = `${projectUrl}/runs`;
|
|
107
|
+
const jobsUrl = `${projectUrl}/jobs`;
|
|
108
|
+
const runsPlaygroundUrl = `${runsUrl}?${buildRunsPlaygroundQueryParams({
|
|
109
|
+
enableFirstRunExperience,
|
|
110
|
+
settings,
|
|
111
|
+
testAuthSessionId: rest.testAuthSessionId
|
|
112
|
+
})}`;
|
|
113
|
+
const defaultJobTriggerUrl = rest.defaultJobId ? `${jobsUrl}/${rest.defaultJobId}?action=trigger` : undefined;
|
|
114
|
+
const actions = [{
|
|
115
|
+
label: "View Project",
|
|
116
|
+
url: runsUrl
|
|
117
|
+
}, ...(settings.apiAccess.enabled ? [{
|
|
118
|
+
label: "Run Playground",
|
|
119
|
+
url: runsPlaygroundUrl
|
|
120
|
+
}] : []), {
|
|
121
|
+
label: "Manage Jobs",
|
|
122
|
+
url: jobsUrl
|
|
123
|
+
}, ...(defaultJobTriggerUrl !== undefined ? [{
|
|
124
|
+
label: "Trigger Default Job",
|
|
125
|
+
url: defaultJobTriggerUrl
|
|
126
|
+
}] : [])];
|
|
127
|
+
if (_terminalLink.default.isSupported) {
|
|
128
|
+
for (const action of actions) {
|
|
129
|
+
const link = (0, _terminalLink.default)(`[ ${action.label} ]`, action.url);
|
|
130
|
+
(0, _terminal.terminal)(`^+${link.replaceAll("%", "%%")}^ `);
|
|
131
|
+
}
|
|
132
|
+
(0, _terminal.terminal)("\n");
|
|
133
|
+
} else {
|
|
134
|
+
for (const action of actions) {
|
|
135
|
+
(0, _terminal.terminal)(`^+${action.label}:^ ^c^_${action.url}^:\n`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
90
138
|
return;
|
|
91
139
|
}
|
|
92
140
|
let errorMessage = `^r^+An error occurred while deploying project:^:\n^R${message}^:\n`;
|
|
@@ -136,4 +184,91 @@ const checkIntunedProjectDeployStatus = async (workspaceId, projectName, apiKey)
|
|
|
136
184
|
status: "failed",
|
|
137
185
|
message: `Deployment failed, please try again: ${data.message}`
|
|
138
186
|
};
|
|
139
|
-
};
|
|
187
|
+
};
|
|
188
|
+
async function promptFirstRunExperience(settings) {
|
|
189
|
+
let testAuthSessionInput = undefined;
|
|
190
|
+
const shouldPromptForTestAuthSession = settings.authSessions.enabled && settings.authSessions.type === "API";
|
|
191
|
+
const defaultJobInput = settings.metadata?.defaultJobInput;
|
|
192
|
+
const shouldPromptForDefaultJob = defaultJobInput !== undefined;
|
|
193
|
+
if (shouldPromptForTestAuthSession) {
|
|
194
|
+
testAuthSessionInput = await promptFirstRunExperienceTestAuthSessionParameters({
|
|
195
|
+
shouldPromptForDefaultJob
|
|
196
|
+
});
|
|
197
|
+
if (!testAuthSessionInput) {
|
|
198
|
+
return {};
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
testAuthSessionInput,
|
|
203
|
+
defaultJobInput: shouldPromptForDefaultJob ? await promptFirstRunExperienceDefaultJobParameters({
|
|
204
|
+
defaultJobInput
|
|
205
|
+
}) : undefined
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
async function promptFirstRunExperienceTestAuthSessionParameters({
|
|
209
|
+
shouldPromptForDefaultJob
|
|
210
|
+
}) {
|
|
211
|
+
const authSessionInstancesDirectory = _path.default.join(process.cwd(), _constants2.AUTH_SESSIONS_INSTANCES_FOLDER_NAME);
|
|
212
|
+
if (!(await fs.exists(authSessionInstancesDirectory))) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const authSessionId = (await fs.readdir(authSessionInstancesDirectory)).shift();
|
|
216
|
+
if (!authSessionId) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const {
|
|
220
|
+
metadata
|
|
221
|
+
} = await (0, _helpers.loadAuthSessionInstance)(authSessionId);
|
|
222
|
+
if (!metadata.authSessionId) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
const message = shouldPromptForDefaultJob ? `^:^+Create a test auth session using^ ^c${authSessionId}^:^+ parameters?^ ^/(required for creating default job)^:` : `^:^+Create a test auth session using^ ^c${authSessionId}^:^+ parameters?^:`;
|
|
226
|
+
const {
|
|
227
|
+
value
|
|
228
|
+
} = await (0, _prompts.default)({
|
|
229
|
+
type: "confirm",
|
|
230
|
+
name: "value",
|
|
231
|
+
message: _terminal.terminal.str(message).toString(),
|
|
232
|
+
initial: true
|
|
233
|
+
});
|
|
234
|
+
if (value === undefined) {
|
|
235
|
+
throw new _helpers.AbortedCLIError();
|
|
236
|
+
}
|
|
237
|
+
if (value) {
|
|
238
|
+
return metadata.authSessionInput;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
async function promptFirstRunExperienceDefaultJobParameters({
|
|
242
|
+
defaultJobInput
|
|
243
|
+
}) {
|
|
244
|
+
const {
|
|
245
|
+
value
|
|
246
|
+
} = await (0, _prompts.default)({
|
|
247
|
+
type: "confirm",
|
|
248
|
+
name: "value",
|
|
249
|
+
message: _terminal.terminal.str(`^:^+Create a default job with sample parameters?^:`).toString(),
|
|
250
|
+
initial: true
|
|
251
|
+
});
|
|
252
|
+
if (value === undefined) {
|
|
253
|
+
throw new _helpers.AbortedCLIError();
|
|
254
|
+
}
|
|
255
|
+
if (value) {
|
|
256
|
+
return defaultJobInput;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
function buildRunsPlaygroundQueryParams({
|
|
260
|
+
enableFirstRunExperience,
|
|
261
|
+
settings,
|
|
262
|
+
testAuthSessionId
|
|
263
|
+
}) {
|
|
264
|
+
const params = new URLSearchParams();
|
|
265
|
+
if (!enableFirstRunExperience) return params.toString();
|
|
266
|
+
const input = settings.metadata?.defaultRunPlaygroundInput ?? {};
|
|
267
|
+
if (testAuthSessionId) {
|
|
268
|
+
input.authSessionId = testAuthSessionId;
|
|
269
|
+
}
|
|
270
|
+
params.append(START_RUN_INPUT_QUERY_PARAM_KEY, JSON.stringify({
|
|
271
|
+
...input
|
|
272
|
+
}));
|
|
273
|
+
return params.toString();
|
|
274
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { AuthCredentials } from "../types";
|
|
3
|
-
export declare function runSaveProject(projectName: string, auth: AuthCredentials): Promise<
|
|
3
|
+
export declare function runSaveProject(projectName: string, auth: AuthCredentials): Promise<{
|
|
4
|
+
projectId: string;
|
|
5
|
+
enableFirstRunExperience: boolean | undefined;
|
|
6
|
+
} | undefined>;
|
|
4
7
|
export declare const projectNameSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
5
8
|
export declare const validateProjectName: (projectName: string) => {
|
|
6
9
|
isValid: true;
|
|
@@ -33,7 +33,8 @@ const saveProjectApiResponseSchema = _zod.z.string().transform((val, ctx) => {
|
|
|
33
33
|
return _zod.z.NEVER;
|
|
34
34
|
}
|
|
35
35
|
}).pipe(_zod.z.object({
|
|
36
|
-
id: _zod.z.string().uuid()
|
|
36
|
+
id: _zod.z.string().uuid(),
|
|
37
|
+
enableFirstRunExperience: _zod.z.boolean().optional()
|
|
37
38
|
}));
|
|
38
39
|
async function runSaveProject(projectName, auth) {
|
|
39
40
|
const {
|
|
@@ -86,7 +87,8 @@ async function runSaveProject(projectName, auth) {
|
|
|
86
87
|
return;
|
|
87
88
|
}
|
|
88
89
|
const {
|
|
89
|
-
id: projectId
|
|
90
|
+
id: projectId,
|
|
91
|
+
enableFirstRunExperience
|
|
90
92
|
} = parseResult.data;
|
|
91
93
|
const dotEnvPath = path.join(projectPath, ".env");
|
|
92
94
|
if (!(await fs.exists(dotEnvPath))) {
|
|
@@ -111,6 +113,10 @@ ${_constants2.API_KEY_ENV_VAR_KEY}=${apiKey}`);
|
|
|
111
113
|
await fs.appendFile(dotEnvPath, contentToAppend + "\n");
|
|
112
114
|
(0, _terminal.terminal)(`^g^+Updated .env file with project credentials.^:\n`);
|
|
113
115
|
}
|
|
116
|
+
return {
|
|
117
|
+
projectId,
|
|
118
|
+
enableFirstRunExperience
|
|
119
|
+
};
|
|
114
120
|
}
|
|
115
121
|
const projectNameSchema = exports.projectNameSchema = _zod.z.string().min(1, "Project Name is required").max(200, "Name must be 200 characters or less").regex(/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/, "Name can only contain lowercase letters, numbers, hyphens, and underscores in between").refine(value => !_zod.z.string().uuid().safeParse(value).success, {
|
|
116
122
|
message: "Name cannot be a UUID"
|
|
@@ -39,6 +39,17 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
39
39
|
};
|
|
40
40
|
});
|
|
41
41
|
(0, _vitest.describe)("Browser CLI options", () => {
|
|
42
|
+
(0, _vitest.it)("returns cdp options if cdpUrl is set", async () => {
|
|
43
|
+
const options = await (0, _browser.getCLIRunOptions)({
|
|
44
|
+
keepBrowserOpen: true,
|
|
45
|
+
headless: true,
|
|
46
|
+
cdpUrl: "cdp_url"
|
|
47
|
+
});
|
|
48
|
+
(0, _vitest.expect)(options).toEqual(_vitest.expect.objectContaining({
|
|
49
|
+
environment: "cdp",
|
|
50
|
+
cdpAddress: "cdp_url"
|
|
51
|
+
}));
|
|
52
|
+
});
|
|
42
53
|
(0, _vitest.it)("returns standalone options if keepBrowserOpen is not set", async () => {
|
|
43
54
|
const options = await (0, _browser.getCLIRunOptions)({
|
|
44
55
|
keepBrowserOpen: false,
|
|
@@ -23,5 +23,5 @@ async function getAuthCredentials(options) {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
function getBaseUrl() {
|
|
26
|
-
return process.env[_constants.API_BASE_URL_ENV_VAR_KEY] || process.env.INTUNED_API_DOMAIN || `https://app.intuned.io
|
|
26
|
+
return new URL(process.env[_constants.API_BASE_URL_ENV_VAR_KEY] || process.env.INTUNED_API_DOMAIN || `https://app.intuned.io`).origin;
|
|
27
27
|
}
|
|
@@ -4,10 +4,11 @@ import { z } from "zod";
|
|
|
4
4
|
declare let context: BrowserContext | null;
|
|
5
5
|
export declare function _getContextForTest(): typeof context;
|
|
6
6
|
type RunApiRunOptions = z.infer<typeof runApiParametersSchema>["runOptions"];
|
|
7
|
-
export declare function getCLIRunOptions({ headless, proxy, keepBrowserOpen, }: {
|
|
7
|
+
export declare function getCLIRunOptions({ headless, proxy, keepBrowserOpen, cdpUrl, }: {
|
|
8
8
|
headless: boolean;
|
|
9
9
|
proxy?: string;
|
|
10
10
|
keepBrowserOpen: boolean;
|
|
11
|
+
cdpUrl?: string;
|
|
11
12
|
}): Promise<RunApiRunOptions>;
|
|
12
13
|
export declare function isCliBrowserLaunched(): boolean;
|
|
13
14
|
export declare function closeCliBrowser(): Promise<void>;
|
|
@@ -20,11 +20,18 @@ function _getContextForTest() {
|
|
|
20
20
|
async function getCLIRunOptions({
|
|
21
21
|
headless,
|
|
22
22
|
proxy,
|
|
23
|
-
keepBrowserOpen
|
|
23
|
+
keepBrowserOpen,
|
|
24
|
+
cdpUrl
|
|
24
25
|
}) {
|
|
25
26
|
if (context) {
|
|
26
27
|
await closeCliBrowser();
|
|
27
28
|
}
|
|
29
|
+
if (cdpUrl) {
|
|
30
|
+
return {
|
|
31
|
+
environment: "cdp",
|
|
32
|
+
cdpAddress: cdpUrl
|
|
33
|
+
};
|
|
34
|
+
}
|
|
28
35
|
if (!keepBrowserOpen) {
|
|
29
36
|
return {
|
|
30
37
|
environment: "standalone",
|
|
@@ -5,6 +5,9 @@ export declare class CLIError extends Error {
|
|
|
5
5
|
autoColor?: boolean;
|
|
6
6
|
});
|
|
7
7
|
}
|
|
8
|
+
export declare class AbortedCLIError extends CLIError {
|
|
9
|
+
constructor();
|
|
10
|
+
}
|
|
8
11
|
export declare class CLIAssertionError extends CLIError {
|
|
9
12
|
constructor(message: string, options?: {
|
|
10
13
|
autoColor?: boolean;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.CLIError = exports.CLIAssertionError = void 0;
|
|
6
|
+
exports.CLIError = exports.CLIAssertionError = exports.AbortedCLIError = void 0;
|
|
7
7
|
exports.logAutomationError = logAutomationError;
|
|
8
8
|
var _runApi = require("../../../common/runApi");
|
|
9
9
|
var _terminal = require("./terminal");
|
|
@@ -15,6 +15,13 @@ class CLIError extends Error {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
exports.CLIError = CLIError;
|
|
18
|
+
class AbortedCLIError extends CLIError {
|
|
19
|
+
constructor() {
|
|
20
|
+
super("Aborted");
|
|
21
|
+
this.name = "AbortedCLIError";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.AbortedCLIError = AbortedCLIError;
|
|
18
25
|
class CLIAssertionError extends CLIError {
|
|
19
26
|
constructor(message, options) {
|
|
20
27
|
super(message, options);
|