@intuned/runtime-dev 1.3.17-ws.0 → 1.3.18-dev.3
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/.babelrc +6 -0
- package/CHANGELOG.md +1 -1
- package/InterfaceTemplate/{utils.ts → __utils.ts} +3 -1
- package/InterfaceTemplate/index.playwright.ts +1 -1
- package/bin/intuned +0 -0
- package/bin/intuned-interface +7 -0
- package/dist/commands/api/run.js +7 -11
- package/dist/commands/auth-sessions/load.js +2 -2
- package/dist/commands/auth-sessions/run-check.js +8 -8
- package/dist/commands/auth-sessions/run-create.js +6 -6
- package/dist/commands/build.js +2 -3
- package/dist/commands/common/browserUtils.d.ts +3 -3
- package/dist/commands/common/browserUtils.js +3 -4
- package/dist/commands/common/getFirstLineNumber.test.js +1 -2
- package/dist/commands/common/projectExclusions.js +1 -1
- package/dist/commands/common/tsNodeImport.d.ts +1 -1
- package/dist/commands/common/tsNodeImport.js +10 -2
- package/dist/commands/common/utils/fileUtils.js +1 -2
- package/dist/commands/common/utils/{unixSocket.d.ts → interfaceClient.d.ts} +10 -2
- package/dist/commands/common/utils/{unixSocket.js → interfaceClient.js} +16 -5
- package/dist/commands/common/utils/template.js +1 -2
- package/dist/commands/interface/run.js +23 -49
- package/dist/commands/intuned-cli/commands/attempt_api.command.js +1 -1
- package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +1 -1
- package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +2 -2
- package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +1 -1
- package/dist/commands/intuned-cli/commands/authsession.command.js +1 -1
- package/dist/commands/intuned-cli/commands/authsession_record.command.js +1 -1
- package/dist/commands/intuned-cli/commands/authsession_scaffold.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/authsession_scaffold.command.js +16 -0
- package/dist/commands/intuned-cli/commands/deploy.command.js +13 -9
- package/dist/commands/intuned-cli/commands/index.d.ts +2 -2
- package/dist/commands/intuned-cli/commands/index.js +15 -15
- package/dist/commands/intuned-cli/commands/{save.command.d.ts → provision.command.d.ts} +3 -3
- package/dist/commands/intuned-cli/commands/provision.command.js +50 -0
- package/dist/commands/intuned-cli/commands/run_api.command.js +1 -1
- package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +8 -1
- package/dist/commands/intuned-cli/commands/run_authsession.command.js +2 -2
- package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +1 -1
- package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +2 -2
- package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +2 -2
- package/dist/commands/intuned-cli/commands/types.d.ts +9 -1
- package/dist/commands/intuned-cli/commands/types.js +9 -5
- package/dist/commands/intuned-cli/controller/__test__/api.test.js +30 -19
- package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +140 -77
- package/dist/commands/intuned-cli/controller/api.d.ts +2 -2
- package/dist/commands/intuned-cli/controller/api.js +6 -3
- package/dist/commands/intuned-cli/controller/authSession.d.ts +16 -16
- package/dist/commands/intuned-cli/controller/authSession.js +50 -39
- package/dist/commands/intuned-cli/controller/build.js +1 -2
- package/dist/commands/intuned-cli/controller/deploy.js +53 -12
- package/dist/commands/intuned-cli/controller/index.js +2 -3
- package/dist/commands/intuned-cli/controller/{save.d.ts → provision.d.ts} +5 -1
- package/dist/commands/intuned-cli/controller/provision.js +299 -0
- package/dist/commands/intuned-cli/controller/scaffold.d.ts +1 -0
- package/dist/commands/intuned-cli/controller/scaffold.js +77 -0
- package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +45 -5
- package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +4 -3
- package/dist/commands/intuned-cli/helpers/api.js +4 -7
- package/dist/commands/intuned-cli/helpers/auth.d.ts +4 -4
- package/dist/commands/intuned-cli/helpers/auth.js +24 -21
- package/dist/commands/intuned-cli/helpers/backend.js +12 -4
- package/dist/commands/intuned-cli/helpers/browser.d.ts +4 -4
- package/dist/commands/intuned-cli/helpers/browser.js +40 -5
- package/dist/commands/intuned-cli/helpers/context.js +2 -2
- package/dist/commands/intuned-cli/helpers/errors.d.ts +1 -1
- package/dist/commands/intuned-cli/helpers/errors.js +2 -2
- package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +6 -5
- package/dist/commands/intuned-cli/helpers/prompts.d.ts +3 -0
- package/dist/commands/intuned-cli/helpers/prompts.js +71 -0
- package/dist/commands/intuned-cli/helpers/timeout.js +2 -2
- package/dist/commands/intuned-cli/helpers/traces.d.ts +1 -1
- package/dist/commands/intuned-cli/helpers/wrapper.js +14 -4
- package/dist/commands/intuned-cli/main.js +1 -2
- package/dist/commands/intuned-cli/types.d.ts +41 -12
- package/dist/commands/intuned-cli/types.js +12 -2
- package/dist/commands/ts-check.js +1 -2
- package/dist/common/backendFunctions/getAuthSessionParameters.js +1 -1
- package/dist/common/binStartupScript.js +1 -2
- package/dist/common/browserTabs.d.ts +72 -0
- package/dist/common/browserTabs.js +74 -0
- package/dist/common/constants.d.ts +1 -0
- package/dist/common/constants.js +2 -1
- package/dist/common/contextStorageStateHelpers.d.ts +4 -3
- package/dist/common/contextStorageStateHelpers.js +4 -1
- package/dist/common/env.d.ts +6 -0
- package/dist/common/env.js +17 -0
- package/dist/common/extension/extensionsHelpers.d.ts +1 -1
- package/dist/common/extension/types.d.ts +14 -7
- package/dist/common/formatZodError.d.ts +1 -1
- package/dist/common/intunedJson.d.ts +19 -14
- package/dist/common/intunedJson.js +4 -4
- package/dist/common/jwtTokenManager.js +10 -6
- package/dist/common/launchBrowser.d.ts +10 -0
- package/dist/common/launchBrowser.js +74 -8
- package/dist/common/playwrightContext.d.ts +5 -5
- package/dist/common/playwrightContext.js +24 -14
- package/dist/common/runApi/importUsingImportFunction.d.ts +1 -3
- package/dist/common/runApi/importUsingImportFunction.js +7 -7
- package/dist/common/runApi/index.d.ts +3 -6
- package/dist/common/runApi/index.js +28 -52
- package/dist/common/settingsSchema.d.ts +52 -45
- package/dist/common/settingsSchema.js +3 -3
- package/dist/common/setupContextHook.d.ts +1 -2
- package/dist/common/setupContextHook.js +2 -2
- package/dist/common/telemetry.js +1 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -7
- package/dist/runtime/downloadDirectory.js +2 -2
- package/dist/vendor/runtime-interface.d.ts +1 -0
- package/dist/vendor/runtime-interface.js +493 -0
- package/package.json +19 -11
- package/tsup.config.ts +12 -0
- package/WebTemplate.zip +0 -0
- package/dist/commands/intuned-cli/commands/init.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/init.command.js +0 -13
- package/dist/commands/intuned-cli/commands/save.command.js +0 -42
- package/dist/commands/intuned-cli/controller/save.js +0 -357
- package/dist/common/runApi/errors.d.ts +0 -72
- package/dist/common/runApi/errors.js +0 -169
- package/dist/common/runApi/types.d.ts +0 -830
- package/dist/common/runApi/types.js +0 -73
|
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.attemptAuthSessionCommand = void 0;
|
|
7
7
|
var _attempt = require("./attempt.command");
|
|
8
|
-
const attemptAuthSessionCommand = exports.attemptAuthSessionCommand = _attempt.attemptCommand.command("authsession").description("Manage
|
|
8
|
+
const attemptAuthSessionCommand = exports.attemptAuthSessionCommand = _attempt.attemptCommand.command("authsession").description("Manage AuthSessions");
|
|
@@ -9,8 +9,8 @@ var _authSession = require("../controller/authSession");
|
|
|
9
9
|
var _attempt_authsession = require("./attempt_authsession.command");
|
|
10
10
|
var _helpers = require("../helpers");
|
|
11
11
|
var _types = require("./types");
|
|
12
|
-
const argsSchema = _zod.z.tuple([_zod.z.string().min(1, "ID of the
|
|
13
|
-
const attemptAuthSessionCheckCommand = exports.attemptAuthSessionCheckCommand = (0, _types.withBaseOptions)(_attempt_authsession.attemptAuthSessionCommand.command("check").description("Check an existing
|
|
12
|
+
const argsSchema = _zod.z.tuple([_zod.z.string().min(1, "ID of the AuthSession is required")]);
|
|
13
|
+
const attemptAuthSessionCheckCommand = exports.attemptAuthSessionCheckCommand = (0, _types.withBaseOptions)(_attempt_authsession.attemptAuthSessionCommand.command("check").description("Check an existing AuthSession").argument("<id>", "ID of the AuthSession to check")).action((0, _helpers.cliCommandWrapper)(argsSchema, _types.baseCommandOptionsSchema, async ([id], options) => {
|
|
14
14
|
await (0, _helpers.assertAuthEnabled)();
|
|
15
15
|
await (0, _authSession.executeAttemptCheckAuthSessionCLI)({
|
|
16
16
|
id,
|
|
@@ -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
|
|
17
|
+
const attemptAuthSessionCreateCommand = exports.attemptAuthSessionCreateCommand = (0, _types.withBaseOptions)(_attempt_authsession.attemptAuthSessionCommand.command("create").description("Create a new AuthSession").argument("<parameters>", "Parameters for the AuthSession command").option("--id <id>", "ID of the AuthSession 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)({
|
|
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.authSessionCommand = void 0;
|
|
7
7
|
var _command = require("./command");
|
|
8
|
-
const authSessionCommand = exports.authSessionCommand = _command.program.command("authsession").description("Manage
|
|
8
|
+
const authSessionCommand = exports.authSessionCommand = _command.program.command("authsession").description("Manage AuthSessions");
|
|
@@ -14,7 +14,7 @@ const optionsSchema = _run_authsession.baseRunAuthSessionCommandOptionsSchema.ex
|
|
|
14
14
|
id: _zod.z.string().optional()
|
|
15
15
|
});
|
|
16
16
|
const isAuthSessionRecorderEnabled = process.env.INTUNED_AUTH_SESSION_RECORDER_ENABLED === "true";
|
|
17
|
-
const authSessionRecordCommand = exports.authSessionRecordCommand = isAuthSessionRecorderEnabled ? (0, _types.withBaseOptions)(_authsession.authSessionCommand.command("record").description("Record a new
|
|
17
|
+
const authSessionRecordCommand = exports.authSessionRecordCommand = isAuthSessionRecorderEnabled ? (0, _types.withBaseOptions)(_authsession.authSessionCommand.command("record").description("Record a new AuthSession").option("--id <id>", "ID of the AuthSession to use for the command. Defaults to auth-session-[current timestamp]").option("--check-attempts <number>", "Number of attempts to check the AuthSession validity", "1")).action((0, _helpers.cliCommandWrapper)(undefined, optionsSchema, async (_, {
|
|
18
18
|
checkAttempts,
|
|
19
19
|
...rest
|
|
20
20
|
}) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const authSessionScaffoldCommand: import("commander").Command;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.authSessionScaffoldCommand = void 0;
|
|
7
|
+
var _zod = require("zod");
|
|
8
|
+
var _helpers = require("../helpers");
|
|
9
|
+
var _authsession = require("./authsession.command");
|
|
10
|
+
var _types = require("./types");
|
|
11
|
+
var _scaffold = require("../controller/scaffold");
|
|
12
|
+
const optionsSchema = _zod.z.object({});
|
|
13
|
+
const authSessionScaffoldCommand = exports.authSessionScaffoldCommand = (0, _types.withBaseOptions)(_authsession.authSessionCommand.command("scaffold").description("Scaffold AuthSession files")).action((0, _helpers.cliCommandWrapper)(undefined, optionsSchema, async _ => {
|
|
14
|
+
await (0, _helpers.assertAuthEnabled)();
|
|
15
|
+
await (0, _scaffold.scaffoldAuthSessionFiles)();
|
|
16
|
+
}));
|
|
@@ -6,32 +6,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.deployCommand = void 0;
|
|
7
7
|
var _command = require("./command");
|
|
8
8
|
var _dotenv = _interopRequireDefault(require("dotenv"));
|
|
9
|
-
var
|
|
9
|
+
var _provision = require("../controller/provision");
|
|
10
10
|
var _deploy = require("../controller/deploy");
|
|
11
11
|
var _helpers = require("../helpers");
|
|
12
|
-
var
|
|
12
|
+
var _provision2 = require("./provision.command");
|
|
13
|
+
var _prompts = require("../helpers/prompts");
|
|
13
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
15
|
_dotenv.default.config({
|
|
15
16
|
path: `.env`
|
|
16
17
|
});
|
|
17
|
-
const deployCommand = exports.deployCommand = _command.program.command("deploy").description("
|
|
18
|
+
const deployCommand = exports.deployCommand = _command.program.command("deploy").description("Deploy an Intuned project to the platform").argument("[project-name]", "Name of the project to deploy").option("-w, --workspace-id <id>", "Your Intuned workspace ID").option("-k, --api-key <key>", "Your Intuned API key").action((0, _helpers.cliCommandWrapper)(_provision2.saveOrDeployArgsSchema, _provision2.saveOrDeployOptionsSchema, async ([projectName], options) => {
|
|
18
19
|
const {
|
|
19
20
|
isValid,
|
|
20
21
|
errorMessage
|
|
21
|
-
} = await (0,
|
|
22
|
+
} = await (0, _provision.validateIntunedProject)();
|
|
22
23
|
if (!isValid) {
|
|
23
|
-
const message = `^r^+Project to be deployed is not
|
|
24
|
+
const message = `^r^+Project to be deployed is not valid:^:^R ${errorMessage}:\n`;
|
|
24
25
|
throw new _helpers.CLIError(message, {
|
|
25
26
|
autoColor: false
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
|
-
const _projectName = projectName || (await (0, _helpers.loadIntunedJson)()).projectName
|
|
29
|
+
const _projectName = projectName || (await (0, _helpers.loadIntunedJson)()).projectName || (await (0, _prompts.promptForProjectName)(name => {
|
|
30
|
+
const result = (0, _provision.validateProjectName)(name);
|
|
31
|
+
return result.isValid || result.errorMessage;
|
|
32
|
+
}));
|
|
29
33
|
if (!_projectName) {
|
|
30
|
-
throw new _helpers.CLIError(
|
|
34
|
+
throw new _helpers.CLIError(`Project name is required. Set it in ${await (0, _helpers.getIntunedSettingsFile)()} or provide it as an argument by running 'intuned deploy <project-name>'.`);
|
|
31
35
|
}
|
|
32
|
-
const projectNameValidation = (0,
|
|
36
|
+
const projectNameValidation = (0, _provision.validateProjectName)(_projectName);
|
|
33
37
|
if (!projectNameValidation.isValid) {
|
|
34
|
-
throw new _helpers.CLIError(projectNameValidation.errorMessage);
|
|
38
|
+
throw new _helpers.CLIError(`Invalid project name: ${projectNameValidation.errorMessage}`);
|
|
35
39
|
}
|
|
36
40
|
const auth = await (0, _helpers.getAuthCredentials)(options);
|
|
37
41
|
await (0, _deploy.runDeployProject)(_projectName, auth);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export * from "./command";
|
|
2
2
|
export * from "./build.command";
|
|
3
3
|
export * from "./deploy.command";
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./init.command";
|
|
4
|
+
export * from "./provision.command";
|
|
6
5
|
export * from "./run.command";
|
|
7
6
|
export * from "./run_api.command";
|
|
8
7
|
export * from "./run_authsession.command";
|
|
@@ -16,3 +15,4 @@ export * from "./attempt_authsession_create.command";
|
|
|
16
15
|
export * from "./attempt_authsession_check.command";
|
|
17
16
|
export * from "./authsession.command";
|
|
18
17
|
export * from "./authsession_record.command";
|
|
18
|
+
export * from "./authsession_scaffold.command";
|
|
@@ -36,25 +36,14 @@ Object.keys(_deploy).forEach(function (key) {
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
|
-
var
|
|
40
|
-
Object.keys(
|
|
39
|
+
var _provision = require("./provision.command");
|
|
40
|
+
Object.keys(_provision).forEach(function (key) {
|
|
41
41
|
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (key in exports && exports[key] ===
|
|
42
|
+
if (key in exports && exports[key] === _provision[key]) return;
|
|
43
43
|
Object.defineProperty(exports, key, {
|
|
44
44
|
enumerable: true,
|
|
45
45
|
get: function () {
|
|
46
|
-
return
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
var _init = require("./init.command");
|
|
51
|
-
Object.keys(_init).forEach(function (key) {
|
|
52
|
-
if (key === "default" || key === "__esModule") return;
|
|
53
|
-
if (key in exports && exports[key] === _init[key]) return;
|
|
54
|
-
Object.defineProperty(exports, key, {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _init[key];
|
|
46
|
+
return _provision[key];
|
|
58
47
|
}
|
|
59
48
|
});
|
|
60
49
|
});
|
|
@@ -200,4 +189,15 @@ Object.keys(_authsession_record).forEach(function (key) {
|
|
|
200
189
|
return _authsession_record[key];
|
|
201
190
|
}
|
|
202
191
|
});
|
|
192
|
+
});
|
|
193
|
+
var _authsession_scaffold = require("./authsession_scaffold.command");
|
|
194
|
+
Object.keys(_authsession_scaffold).forEach(function (key) {
|
|
195
|
+
if (key === "default" || key === "__esModule") return;
|
|
196
|
+
if (key in exports && exports[key] === _authsession_scaffold[key]) return;
|
|
197
|
+
Object.defineProperty(exports, key, {
|
|
198
|
+
enumerable: true,
|
|
199
|
+
get: function () {
|
|
200
|
+
return _authsession_scaffold[key];
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
203
|
});
|
|
@@ -4,10 +4,10 @@ export declare const saveOrDeployOptionsSchema: z.ZodObject<{
|
|
|
4
4
|
workspaceId: z.ZodOptional<z.ZodString>;
|
|
5
5
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
6
6
|
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
workspaceId?: string | undefined;
|
|
8
7
|
apiKey?: string | undefined;
|
|
9
|
-
}, {
|
|
10
8
|
workspaceId?: string | undefined;
|
|
9
|
+
}, {
|
|
11
10
|
apiKey?: string | undefined;
|
|
11
|
+
workspaceId?: string | undefined;
|
|
12
12
|
}>;
|
|
13
|
-
export declare const saveCommand: import("commander").Command;
|
|
13
|
+
export declare const provisionCommand: import("commander").Command, saveCommand: import("commander").Command;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.saveOrDeployOptionsSchema = exports.saveOrDeployArgsSchema = exports.saveCommand = exports.provisionCommand = void 0;
|
|
7
|
+
var _command = require("./command");
|
|
8
|
+
var _dotenv = _interopRequireDefault(require("dotenv"));
|
|
9
|
+
var _provision = require("../controller/provision");
|
|
10
|
+
var _helpers = require("../helpers");
|
|
11
|
+
var _zod = require("zod");
|
|
12
|
+
var _prompts = require("../helpers/prompts");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
_dotenv.default.config({
|
|
15
|
+
path: `.env`
|
|
16
|
+
});
|
|
17
|
+
const saveOrDeployArgsSchema = exports.saveOrDeployArgsSchema = _zod.z.tuple([_zod.z.union([_zod.z.string(), _zod.z.undefined()])]);
|
|
18
|
+
const saveOrDeployOptionsSchema = exports.saveOrDeployOptionsSchema = _zod.z.object({
|
|
19
|
+
workspaceId: _zod.z.string().optional(),
|
|
20
|
+
apiKey: _zod.z.string().optional()
|
|
21
|
+
});
|
|
22
|
+
const description = "Provision an Intuned project to the platform";
|
|
23
|
+
const commands = [_command.program.command("save").description(`${description}. (Deprecated, use 'provision' instead)`), _command.program.command("provision").description(description)];
|
|
24
|
+
const [provisionCommand, saveCommand] = commands.map(command => command.argument("[project-name]", "Project name").option("-w, --workspace-id <id>", "Intuned Workspace ID").option("-k, --api-key <key>", "Intuned API key").action((0, _helpers.cliCommandWrapper)(saveOrDeployArgsSchema, saveOrDeployOptionsSchema, async ([projectName], options) => {
|
|
25
|
+
const {
|
|
26
|
+
isValid,
|
|
27
|
+
errorMessage
|
|
28
|
+
} = await (0, _provision.validateIntunedProject)();
|
|
29
|
+
if (!isValid) {
|
|
30
|
+
const message = `^r^+Project to be provisioned is not a valid Intuned project:^:^R ${errorMessage}:\n`;
|
|
31
|
+
throw new _helpers.CLIError(message, {
|
|
32
|
+
autoColor: false
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const _projectName = projectName || (await (0, _helpers.loadIntunedJson)()).projectName || (await (0, _prompts.promptForProjectName)(name => {
|
|
36
|
+
const result = (0, _provision.validateProjectName)(name);
|
|
37
|
+
return result.isValid || result.errorMessage;
|
|
38
|
+
}));
|
|
39
|
+
if (!_projectName) {
|
|
40
|
+
throw new _helpers.CLIError(`Project name is required. Set it in ${await (0, _helpers.getIntunedSettingsFile)()} or provide it as an argument by running 'intuned provision <project-name>'.`);
|
|
41
|
+
}
|
|
42
|
+
const projectNameValidation = (0, _provision.validateProjectName)(_projectName);
|
|
43
|
+
if (!projectNameValidation.isValid) {
|
|
44
|
+
throw new _helpers.CLIError(`Invalid project name: ${projectNameValidation.errorMessage}`);
|
|
45
|
+
}
|
|
46
|
+
const auth = await (0, _helpers.getAuthCredentials)(options);
|
|
47
|
+
await (0, _provision.runProvisionProject)(_projectName, auth);
|
|
48
|
+
})));
|
|
49
|
+
exports.saveCommand = saveCommand;
|
|
50
|
+
exports.provisionCommand = provisionCommand;
|
|
@@ -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
|
|
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 AuthSession 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 AuthSession").option("--auth-session-check-attempts <number>", "AuthSession check attempts", "1").option("--auth-session-create-attempts <number>", "AuthSession 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,
|
|
@@ -2,14 +2,18 @@ import { Command } from "commander";
|
|
|
2
2
|
export declare const baseRunAuthSessionCommandOptionsSchema: import("zod").ZodObject<{
|
|
3
3
|
proxy: import("zod").ZodOptional<import("zod").ZodString>;
|
|
4
4
|
timeout: import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodDefault<import("zod").ZodString>, import("ms").StringValue, string | undefined>, number, string | undefined>;
|
|
5
|
-
trace: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
6
5
|
headless: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
6
|
+
trace: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
7
7
|
keepBrowserOpen: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
8
8
|
cdpUrl: import("zod").ZodOptional<import("zod").ZodString>;
|
|
9
|
+
cdpTabId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
10
|
+
ignoreHttpErrors: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
11
|
+
} & {
|
|
9
12
|
checkAttempts: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
10
13
|
createAttempts: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
11
14
|
}, "strip", import("zod").ZodTypeAny, {
|
|
12
15
|
timeout: number;
|
|
16
|
+
ignoreHttpErrors: boolean;
|
|
13
17
|
trace: boolean;
|
|
14
18
|
headless: boolean;
|
|
15
19
|
keepBrowserOpen: boolean;
|
|
@@ -17,13 +21,16 @@ export declare const baseRunAuthSessionCommandOptionsSchema: import("zod").ZodOb
|
|
|
17
21
|
createAttempts: number;
|
|
18
22
|
proxy?: string | undefined;
|
|
19
23
|
cdpUrl?: string | undefined;
|
|
24
|
+
cdpTabId?: string | undefined;
|
|
20
25
|
}, {
|
|
21
26
|
proxy?: string | undefined;
|
|
22
27
|
timeout?: string | undefined;
|
|
28
|
+
ignoreHttpErrors?: boolean | undefined;
|
|
23
29
|
trace?: boolean | undefined;
|
|
24
30
|
headless?: boolean | undefined;
|
|
25
31
|
keepBrowserOpen?: boolean | undefined;
|
|
26
32
|
cdpUrl?: string | undefined;
|
|
33
|
+
cdpTabId?: string | undefined;
|
|
27
34
|
checkAttempts?: number | undefined;
|
|
28
35
|
createAttempts?: number | undefined;
|
|
29
36
|
}>;
|
|
@@ -11,7 +11,7 @@ const baseRunAuthSessionCommandOptionsSchema = exports.baseRunAuthSessionCommand
|
|
|
11
11
|
checkAttempts: _types.authSessionCheckAttemptsSchema,
|
|
12
12
|
createAttempts: _types.authSessionCreateAttemptsSchema
|
|
13
13
|
});
|
|
14
|
-
const runAuthSessionCommand = exports.runAuthSessionCommand = _run.runCommand.command("authsession").description("
|
|
14
|
+
const runAuthSessionCommand = exports.runAuthSessionCommand = _run.runCommand.command("authsession").description("Execute AuthSession Runs");
|
|
15
15
|
function withAuthSessionBaseOptions(command) {
|
|
16
|
-
return (0, _types.withBaseOptions)(command.option("--check-attempts <number>", "Number of attempts to check the
|
|
16
|
+
return (0, _types.withBaseOptions)(command.option("--check-attempts <number>", "Number of attempts to check the AuthSession validity", "1").option("--create-attempts <number>", "Number of attempts to create a new AuthSession if it is invalid", "1"));
|
|
17
17
|
}
|
|
@@ -15,7 +15,7 @@ const optionsSchema = _run_authsession.baseRunAuthSessionCommandOptionsSchema.ex
|
|
|
15
15
|
id: _zod.z.string().optional()
|
|
16
16
|
});
|
|
17
17
|
const commands = [_run_authsession.runAuthSessionCommand.command("create"), _authsession.authSessionCommand.command("create")];
|
|
18
|
-
const [runAuthSessionCreateCommand, authSessionCreateCommand] = commands.map(command => (0, _run_authsession.withAuthSessionBaseOptions)(command.description("Create a new
|
|
18
|
+
const [runAuthSessionCreateCommand, authSessionCreateCommand] = commands.map(command => (0, _run_authsession.withAuthSessionBaseOptions)(command.description("Create a new AuthSession").argument("<parameters>", "Parameters for the AuthSession command").option("--id <id>", "ID of the AuthSession to use for the command. Defaults to auth-session-[current timestamp]")).action((0, _helpers.cliCommandWrapper)(argsSchema, optionsSchema, async ([parameters], {
|
|
19
19
|
checkAttempts,
|
|
20
20
|
createAttempts,
|
|
21
21
|
id,
|
|
@@ -10,12 +10,12 @@ var _authSession = require("../controller/authSession");
|
|
|
10
10
|
var _run_authsession = require("./run_authsession.command");
|
|
11
11
|
var _helpers = require("../helpers");
|
|
12
12
|
var _authsession = require("./authsession.command");
|
|
13
|
-
const argsSchema = _zod.z.tuple([_zod.z.string().min(1, "ID of the
|
|
13
|
+
const argsSchema = _zod.z.tuple([_zod.z.string().min(1, "ID of the AuthSession is required")]);
|
|
14
14
|
const optionsSchema = _run_authsession.baseRunAuthSessionCommandOptionsSchema.extend({
|
|
15
15
|
parameters: _zod.z.string().optional()
|
|
16
16
|
});
|
|
17
17
|
const commands = [_run_authsession.runAuthSessionCommand.command("update"), _authsession.authSessionCommand.command("update")];
|
|
18
|
-
const [runAuthSessionUpdateCommand, authSessionUpdateCommand] = commands.map(command => (0, _run_authsession.withAuthSessionBaseOptions)(command.description("Update an existing
|
|
18
|
+
const [runAuthSessionUpdateCommand, authSessionUpdateCommand] = commands.map(command => (0, _run_authsession.withAuthSessionBaseOptions)(command.description("Update an existing AuthSession").argument("<id>", "ID of the AuthSession to update").option("--parameters <parameters>", "Parameters for the AuthSession command. If not provided, it will use the existing parameters")).action((0, _helpers.cliCommandWrapper)(argsSchema, optionsSchema, async ([id], {
|
|
19
19
|
checkAttempts,
|
|
20
20
|
createAttempts,
|
|
21
21
|
parameters,
|
|
@@ -9,12 +9,12 @@ var _authSession = require("../controller/authSession");
|
|
|
9
9
|
var _run_authsession = require("./run_authsession.command");
|
|
10
10
|
var _helpers = require("../helpers");
|
|
11
11
|
var _authsession = require("./authsession.command");
|
|
12
|
-
const argsSchema = _zod.z.tuple([_zod.z.string().min(1, "ID of the
|
|
12
|
+
const argsSchema = _zod.z.tuple([_zod.z.string().min(1, "ID of the AuthSession is required")]);
|
|
13
13
|
const optionsSchema = _run_authsession.baseRunAuthSessionCommandOptionsSchema.extend({
|
|
14
14
|
autoRecreate: _zod.z.boolean().default(true)
|
|
15
15
|
});
|
|
16
16
|
const commands = [_run_authsession.runAuthSessionCommand.command("validate"), _authsession.authSessionCommand.command("validate")];
|
|
17
|
-
const [runAuthSessionValidateCommand, authSessionValidateCommand] = commands.map(command => (0, _run_authsession.withAuthSessionBaseOptions)(command.description("Validate an existing
|
|
17
|
+
const [runAuthSessionValidateCommand, authSessionValidateCommand] = commands.map(command => (0, _run_authsession.withAuthSessionBaseOptions)(command.description("Validate an existing AuthSession").argument("<id>", "ID of the AuthSession to validate").option("--no-auto-recreate", "Disable auto recreation of the AuthSession if it is invalid")).action((0, _helpers.cliCommandWrapper)(argsSchema, optionsSchema, async ([id], {
|
|
18
18
|
autoRecreate,
|
|
19
19
|
checkAttempts,
|
|
20
20
|
createAttempts,
|
|
@@ -9,6 +9,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
11
|
export declare const cdpUrlSchema: z.ZodOptional<z.ZodString>;
|
|
12
|
+
export declare const cdpTabIdSchema: z.ZodOptional<z.ZodString>;
|
|
13
|
+
export declare const ignoreHttpErrorsSchema: z.ZodDefault<z.ZodBoolean>;
|
|
12
14
|
export declare const baseCommandOptionsSchema: z.ZodObject<{
|
|
13
15
|
proxy: z.ZodOptional<z.ZodString>;
|
|
14
16
|
timeout: z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodString>, ms.StringValue, string | undefined>, number, string | undefined>;
|
|
@@ -16,20 +18,26 @@ export declare const baseCommandOptionsSchema: z.ZodObject<{
|
|
|
16
18
|
trace: z.ZodDefault<z.ZodBoolean>;
|
|
17
19
|
keepBrowserOpen: z.ZodDefault<z.ZodBoolean>;
|
|
18
20
|
cdpUrl: z.ZodOptional<z.ZodString>;
|
|
21
|
+
cdpTabId: z.ZodOptional<z.ZodString>;
|
|
22
|
+
ignoreHttpErrors: z.ZodDefault<z.ZodBoolean>;
|
|
19
23
|
}, "strip", z.ZodTypeAny, {
|
|
20
24
|
timeout: number;
|
|
25
|
+
ignoreHttpErrors: boolean;
|
|
21
26
|
trace: boolean;
|
|
22
27
|
headless: boolean;
|
|
23
28
|
keepBrowserOpen: boolean;
|
|
24
29
|
proxy?: string | undefined;
|
|
25
30
|
cdpUrl?: string | undefined;
|
|
31
|
+
cdpTabId?: string | undefined;
|
|
26
32
|
}, {
|
|
27
33
|
proxy?: string | undefined;
|
|
28
34
|
timeout?: string | undefined;
|
|
29
|
-
|
|
35
|
+
ignoreHttpErrors?: boolean | undefined;
|
|
30
36
|
trace?: boolean | undefined;
|
|
37
|
+
headless?: boolean | undefined;
|
|
31
38
|
keepBrowserOpen?: boolean | undefined;
|
|
32
39
|
cdpUrl?: string | undefined;
|
|
40
|
+
cdpTabId?: string | undefined;
|
|
33
41
|
}>;
|
|
34
42
|
export type BaseCommandOptions = z.infer<typeof baseCommandOptionsSchema>;
|
|
35
43
|
export declare function withBaseOptions(command: Command): Command;
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.traceSchema = exports.timeoutSchema = exports.proxySchema = exports.keepBrowserOpenSchema = exports.headlessSchema = exports.cdpUrlSchema = exports.baseCommandOptionsSchema = exports.authSessionCreateAttemptsSchema = exports.authSessionCheckAttemptsSchema = void 0;
|
|
6
|
+
exports.traceSchema = exports.timeoutSchema = exports.proxySchema = exports.keepBrowserOpenSchema = exports.ignoreHttpErrorsSchema = exports.headlessSchema = exports.cdpUrlSchema = exports.cdpTabIdSchema = 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");
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
const authSessionCheckAttemptsSchema = exports.authSessionCheckAttemptsSchema = _zod.z.coerce.number().int().min(1, "
|
|
12
|
-
const authSessionCreateAttemptsSchema = exports.authSessionCreateAttemptsSchema = _zod.z.coerce.number().int().min(1, "
|
|
11
|
+
const authSessionCheckAttemptsSchema = exports.authSessionCheckAttemptsSchema = _zod.z.coerce.number().int().min(1, "AuthSession check attempts must be at least 1").default(1);
|
|
12
|
+
const authSessionCreateAttemptsSchema = exports.authSessionCreateAttemptsSchema = _zod.z.coerce.number().int().min(1, "AuthSession create attempts must be at least 1").default(1);
|
|
13
13
|
const proxySchema = exports.proxySchema = _zod.z.string().url("--proxy must be a valid URL").optional();
|
|
14
14
|
const timeoutSchema = exports.timeoutSchema = _zod.z.string().default("10 mins").refine(val => {
|
|
15
15
|
return (0, _ms.default)(val) !== undefined;
|
|
@@ -18,14 +18,18 @@ 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
20
|
const cdpUrlSchema = exports.cdpUrlSchema = _zod.z.string().url().optional();
|
|
21
|
+
const cdpTabIdSchema = exports.cdpTabIdSchema = _zod.z.string().min(1).optional();
|
|
22
|
+
const ignoreHttpErrorsSchema = exports.ignoreHttpErrorsSchema = _zod.z.boolean().default(false);
|
|
21
23
|
const baseCommandOptionsSchema = exports.baseCommandOptionsSchema = _zod.z.object({
|
|
22
24
|
proxy: proxySchema,
|
|
23
25
|
timeout: timeoutSchema,
|
|
24
26
|
headless: headlessSchema,
|
|
25
27
|
trace: traceSchema,
|
|
26
28
|
keepBrowserOpen: keepBrowserOpenSchema,
|
|
27
|
-
cdpUrl: cdpUrlSchema
|
|
29
|
+
cdpUrl: cdpUrlSchema,
|
|
30
|
+
cdpTabId: cdpTabIdSchema,
|
|
31
|
+
ignoreHttpErrors: ignoreHttpErrorsSchema
|
|
28
32
|
});
|
|
29
33
|
function withBaseOptions(command) {
|
|
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>", "
|
|
34
|
+
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>", "Chrome DevTools Protocol URL to connect to an existing browser instance. Disables proxy, headless, keep_browser_open options.").option("--cdp-tab-id <tab_id>", "Browser tab ID to execute on. Requires --cdp-url. If not specified, uses the first tab. Defaults to None.").option("--ignore-http-errors", "Ignore HTTP errors during navigation (e.g., SSL errors, 4xx/5xx status codes).");
|
|
31
35
|
}
|
|
@@ -6,6 +6,7 @@ var _authSession = require("../authSession");
|
|
|
6
6
|
var _helpers = require("../../helpers");
|
|
7
7
|
var _neverthrow = require("neverthrow");
|
|
8
8
|
var _runApi = require("../../../../common/runApi");
|
|
9
|
+
var _runtimeInterface = require("../../../../vendor/runtime-interface");
|
|
9
10
|
var _fsExtra = require("fs-extra");
|
|
10
11
|
var _browser = require("../../helpers/browser");
|
|
11
12
|
function getTerminal() {
|
|
@@ -15,6 +16,7 @@ function getTerminal() {
|
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
18
|
_vitest.vi.mock("fs-extra", () => ({
|
|
19
|
+
ensureDir: _vitest.vi.fn(),
|
|
18
20
|
writeJSON: _vitest.vi.fn(),
|
|
19
21
|
exists: _vitest.vi.fn().mockResolvedValue(true)
|
|
20
22
|
}));
|
|
@@ -75,7 +77,8 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
75
77
|
inputData: {},
|
|
76
78
|
headless: false,
|
|
77
79
|
timeout: 6000,
|
|
78
|
-
keepBrowserOpen: false
|
|
80
|
+
keepBrowserOpen: false,
|
|
81
|
+
ignoreHttpErrors: false
|
|
79
82
|
});
|
|
80
83
|
(0, _vitest.expect)(_helpers.withTimeout).toHaveBeenCalledWith(_vitest.expect.any(Function), 6000);
|
|
81
84
|
});
|
|
@@ -85,7 +88,8 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
85
88
|
inputData: {},
|
|
86
89
|
headless: false,
|
|
87
90
|
timeout: 6000,
|
|
88
|
-
keepBrowserOpen: false
|
|
91
|
+
keepBrowserOpen: false,
|
|
92
|
+
ignoreHttpErrors: false
|
|
89
93
|
});
|
|
90
94
|
(0, _vitest.expect)(_helpers.withCLITrace).toHaveBeenCalledWith(_vitest.expect.any(Function), undefined);
|
|
91
95
|
_vitest.vi.mocked(_helpers.withCLITrace).mockClear();
|
|
@@ -96,7 +100,8 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
96
100
|
headless: false,
|
|
97
101
|
timeout: 6000,
|
|
98
102
|
keepBrowserOpen: false,
|
|
99
|
-
traceId: "trace-id"
|
|
103
|
+
traceId: "trace-id",
|
|
104
|
+
ignoreHttpErrors: false
|
|
100
105
|
});
|
|
101
106
|
(0, _vitest.expect)(_helpers.withCLITrace).toHaveBeenCalledWith(_vitest.expect.any(Function), "trace-id");
|
|
102
107
|
});
|
|
@@ -106,7 +111,8 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
106
111
|
inputData: {},
|
|
107
112
|
headless: false,
|
|
108
113
|
timeout: 6000,
|
|
109
|
-
keepBrowserOpen: false
|
|
114
|
+
keepBrowserOpen: false,
|
|
115
|
+
ignoreHttpErrors: false
|
|
110
116
|
});
|
|
111
117
|
(0, _vitest.expect)(_browser.getCLIRunOptions).toHaveBeenCalledWith(_vitest.expect.objectContaining({
|
|
112
118
|
headless: false,
|
|
@@ -119,7 +125,8 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
119
125
|
inputData: {},
|
|
120
126
|
headless: true,
|
|
121
127
|
timeout: 6000,
|
|
122
|
-
keepBrowserOpen: true
|
|
128
|
+
keepBrowserOpen: true,
|
|
129
|
+
ignoreHttpErrors: false
|
|
123
130
|
});
|
|
124
131
|
(0, _vitest.expect)(_browser.getCLIRunOptions).toHaveBeenCalledWith(_vitest.expect.objectContaining({
|
|
125
132
|
headless: true,
|
|
@@ -135,7 +142,8 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
135
142
|
auth: "auth",
|
|
136
143
|
proxy: "proxy",
|
|
137
144
|
timeout: 999999999,
|
|
138
|
-
keepBrowserOpen: false
|
|
145
|
+
keepBrowserOpen: false,
|
|
146
|
+
ignoreHttpErrors: false
|
|
139
147
|
});
|
|
140
148
|
(0, _vitest.expect)(_helpers.parseUrlProxy).toHaveBeenCalledWith("proxy");
|
|
141
149
|
(0, _vitest.expect)(_runApi.runApi).toHaveBeenCalledWith(_vitest.expect.objectContaining({
|
|
@@ -146,7 +154,8 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
146
154
|
runOptions: {
|
|
147
155
|
headless: "headless",
|
|
148
156
|
environment: "standalone",
|
|
149
|
-
proxy: "parsed-proxy"
|
|
157
|
+
proxy: "parsed-proxy",
|
|
158
|
+
ignoreHttpErrors: false
|
|
150
159
|
},
|
|
151
160
|
auth: {
|
|
152
161
|
session: {
|
|
@@ -168,7 +177,8 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
168
177
|
headless: "headless",
|
|
169
178
|
auth: "auth",
|
|
170
179
|
timeout: 999999999,
|
|
171
|
-
keepBrowserOpen: false
|
|
180
|
+
keepBrowserOpen: false,
|
|
181
|
+
ignoreHttpErrors: false
|
|
172
182
|
});
|
|
173
183
|
(0, _vitest.expect)(result).toEqual({
|
|
174
184
|
result: "result",
|
|
@@ -184,7 +194,8 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
184
194
|
headless: "headless",
|
|
185
195
|
auth: "auth",
|
|
186
196
|
timeout: 999999999,
|
|
187
|
-
keepBrowserOpen: false
|
|
197
|
+
keepBrowserOpen: false,
|
|
198
|
+
ignoreHttpErrors: false
|
|
188
199
|
})).rejects.toThrow(error);
|
|
189
200
|
});
|
|
190
201
|
});
|
|
@@ -223,7 +234,7 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
223
234
|
(0, _vitest.expect)(_runApi.runApi).toHaveBeenCalledTimes(1);
|
|
224
235
|
});
|
|
225
236
|
(0, _vitest.it)("stops retrying after max retries", async () => {
|
|
226
|
-
_vitest.vi.mocked(_runApi.runApi).mockResolvedValue((0, _neverthrow.err)(new
|
|
237
|
+
_vitest.vi.mocked(_runApi.runApi).mockResolvedValue((0, _neverthrow.err)(new _runtimeInterface.AutomationError("runApi failed")));
|
|
227
238
|
await (0, _vitest.expect)((0, _api.executeRunApiCLI)({
|
|
228
239
|
apiName: "testApi",
|
|
229
240
|
inputData: {},
|
|
@@ -241,7 +252,7 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
241
252
|
(0, _vitest.expect)(_runApi.runApi).toHaveBeenCalledTimes(1);
|
|
242
253
|
});
|
|
243
254
|
(0, _vitest.it)("stops retrying on success", async () => {
|
|
244
|
-
_vitest.vi.mocked(_runApi.runApi).mockResolvedValueOnce((0, _neverthrow.err)(new
|
|
255
|
+
_vitest.vi.mocked(_runApi.runApi).mockResolvedValueOnce((0, _neverthrow.err)(new _runtimeInterface.AutomationError("runApi failed"))).mockResolvedValue((0, _neverthrow.ok)({
|
|
245
256
|
result: "success"
|
|
246
257
|
}));
|
|
247
258
|
await (0, _api.executeRunApiCLI)({
|
|
@@ -251,8 +262,8 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
251
262
|
});
|
|
252
263
|
(0, _vitest.expect)(_runApi.runApi).toHaveBeenCalledTimes(2);
|
|
253
264
|
});
|
|
254
|
-
(0, _vitest.it)("validates
|
|
255
|
-
_vitest.vi.mocked(_runApi.runApi).mockResolvedValueOnce((0, _neverthrow.err)(new
|
|
265
|
+
(0, _vitest.it)("validates AuthSession before each attempt if provided", async () => {
|
|
266
|
+
_vitest.vi.mocked(_runApi.runApi).mockResolvedValueOnce((0, _neverthrow.err)(new _runtimeInterface.AutomationError("runApi failed"))).mockResolvedValue((0, _neverthrow.ok)({
|
|
256
267
|
result: "success"
|
|
257
268
|
}));
|
|
258
269
|
await (0, _api.executeRunApiCLI)({
|
|
@@ -274,7 +285,7 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
274
285
|
createRetries: 2
|
|
275
286
|
}));
|
|
276
287
|
});
|
|
277
|
-
(0, _vitest.it)("doesn't validate
|
|
288
|
+
(0, _vitest.it)("doesn't validate AuthSession if not provided", async () => {
|
|
278
289
|
_vitest.vi.mocked(_runApi.runApi).mockResolvedValue((0, _neverthrow.ok)({
|
|
279
290
|
result: "success"
|
|
280
291
|
}));
|
|
@@ -285,8 +296,8 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
285
296
|
});
|
|
286
297
|
(0, _vitest.expect)(_authSession.executeRunValidateAuthSessionCLI).not.toHaveBeenCalled();
|
|
287
298
|
});
|
|
288
|
-
(0, _vitest.it)("fails if
|
|
289
|
-
_vitest.vi.mocked(_authSession.executeRunValidateAuthSessionCLI).mockRejectedValue(new _helpers.CLIError("
|
|
299
|
+
(0, _vitest.it)("fails if AuthSession is provided but not valid", async () => {
|
|
300
|
+
_vitest.vi.mocked(_authSession.executeRunValidateAuthSessionCLI).mockRejectedValue(new _helpers.CLIError("AuthSession validation failed"));
|
|
290
301
|
await (0, _vitest.expect)((0, _api.executeRunApiCLI)({
|
|
291
302
|
apiName: "testApi",
|
|
292
303
|
inputData: {},
|
|
@@ -297,7 +308,7 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
297
308
|
createRetries: 2
|
|
298
309
|
},
|
|
299
310
|
retries: 10
|
|
300
|
-
})).rejects.toThrow("
|
|
311
|
+
})).rejects.toThrow("AuthSession validation failed");
|
|
301
312
|
(0, _vitest.expect)(_authSession.executeRunValidateAuthSessionCLI).toHaveBeenCalledWith(_vitest.expect.objectContaining({
|
|
302
313
|
id: "authSessionId",
|
|
303
314
|
autoRecreate: false,
|
|
@@ -363,11 +374,11 @@ _vitest.vi.mock("../../helpers", async importOriginal => {
|
|
|
363
374
|
});
|
|
364
375
|
(0, _vitest.expect)(_runApi.runApi).toHaveBeenCalledTimes(1);
|
|
365
376
|
_vitest.vi.mocked(_runApi.runApi).mockReset();
|
|
366
|
-
_vitest.vi.mocked(_runApi.runApi).mockResolvedValue((0, _neverthrow.err)(new
|
|
377
|
+
_vitest.vi.mocked(_runApi.runApi).mockResolvedValue((0, _neverthrow.err)(new _runtimeInterface.AutomationError("runApi failed")));
|
|
367
378
|
await (0, _vitest.expect)((0, _api.executeAttemptApiCLI)({
|
|
368
379
|
apiName: "testApi",
|
|
369
380
|
inputData: {}
|
|
370
|
-
})).rejects.toThrow(
|
|
381
|
+
})).rejects.toThrow(_runtimeInterface.AutomationError);
|
|
371
382
|
(0, _vitest.expect)(_runApi.runApi).toHaveBeenCalledTimes(1);
|
|
372
383
|
});
|
|
373
384
|
(0, _vitest.it)("writes result to file if outputFile is provided", async () => {
|