@intuned/runtime-dev 1.3.4-dev.3 → 1.3.4-enhancements.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.
Files changed (70) hide show
  1. package/WebTemplate.zip +0 -0
  2. package/bin/intuned +0 -0
  3. package/dist/commands/api/run.js +1 -2
  4. package/dist/commands/auth-sessions/run-check.js +0 -1
  5. package/dist/commands/auth-sessions/run-create.js +0 -1
  6. package/dist/commands/common/projectExclusions.js +1 -1
  7. package/dist/commands/common/tsNodeImport.js +1 -1
  8. package/dist/commands/common/utils/settings.js +5 -7
  9. package/dist/commands/intuned-cli/commands/attempt_api.command.js +10 -20
  10. package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +2 -7
  11. package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +5 -17
  12. package/dist/commands/intuned-cli/commands/authsession.command.d.ts +1 -0
  13. package/dist/commands/intuned-cli/commands/authsession.command.js +8 -0
  14. package/dist/commands/intuned-cli/commands/authsession_record.command.d.ts +1 -0
  15. package/dist/commands/intuned-cli/commands/authsession_record.command.js +31 -0
  16. package/dist/commands/intuned-cli/commands/build.command.js +1 -1
  17. package/dist/commands/intuned-cli/commands/deploy.command.js +2 -7
  18. package/dist/commands/intuned-cli/commands/index.d.ts +2 -0
  19. package/dist/commands/intuned-cli/commands/index.js +22 -0
  20. package/dist/commands/intuned-cli/commands/init.command.js +1 -1
  21. package/dist/commands/intuned-cli/commands/run_api.command.js +13 -21
  22. package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +9 -1
  23. package/dist/commands/intuned-cli/commands/run_authsession.command.js +5 -1
  24. package/dist/commands/intuned-cli/commands/run_authsession_create.command.d.ts +1 -1
  25. package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +16 -20
  26. package/dist/commands/intuned-cli/commands/run_authsession_update.command.d.ts +1 -1
  27. package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +16 -20
  28. package/dist/commands/intuned-cli/commands/run_authsession_validate.command.d.ts +1 -1
  29. package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +16 -20
  30. package/dist/commands/intuned-cli/commands/save.command.d.ts +3 -2
  31. package/dist/commands/intuned-cli/commands/save.command.js +6 -10
  32. package/dist/commands/intuned-cli/commands/types.d.ts +10 -0
  33. package/dist/commands/intuned-cli/commands/types.js +11 -3
  34. package/dist/commands/intuned-cli/controller/__test__/api.test.js +128 -10
  35. package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +428 -45
  36. package/dist/commands/intuned-cli/controller/api.d.ts +5 -7
  37. package/dist/commands/intuned-cli/controller/api.js +16 -7
  38. package/dist/commands/intuned-cli/controller/authSession.d.ts +18 -7
  39. package/dist/commands/intuned-cli/controller/authSession.js +153 -24
  40. package/dist/commands/intuned-cli/controller/save.js +10 -3
  41. package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +103 -0
  42. package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +40 -0
  43. package/dist/commands/intuned-cli/helpers/auth.d.ts +7 -2
  44. package/dist/commands/intuned-cli/helpers/auth.js +38 -23
  45. package/dist/commands/intuned-cli/helpers/backend.d.ts +1 -1
  46. package/dist/commands/intuned-cli/helpers/backend.js +2 -2
  47. package/dist/commands/intuned-cli/helpers/browser.d.ts +14 -0
  48. package/dist/commands/intuned-cli/helpers/browser.js +57 -0
  49. package/dist/commands/intuned-cli/helpers/errors.d.ts +0 -1
  50. package/dist/commands/intuned-cli/helpers/errors.js +0 -22
  51. package/dist/commands/intuned-cli/helpers/index.d.ts +2 -0
  52. package/dist/commands/intuned-cli/helpers/index.js +22 -0
  53. package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +69 -1
  54. package/dist/commands/intuned-cli/helpers/intunedJson.js +59 -7
  55. package/dist/commands/intuned-cli/helpers/traces.d.ts +2 -0
  56. package/dist/commands/intuned-cli/helpers/traces.js +32 -0
  57. package/dist/commands/intuned-cli/helpers/validation.js +5 -3
  58. package/dist/commands/intuned-cli/helpers/wrapper.d.ts +2 -0
  59. package/dist/commands/intuned-cli/helpers/wrapper.js +60 -0
  60. package/dist/common/constants.d.ts +0 -1
  61. package/dist/common/constants.js +1 -2
  62. package/dist/common/playwrightContext.d.ts +1 -0
  63. package/dist/common/playwrightContext.js +5 -18
  64. package/dist/common/runApi/types.d.ts +0 -5
  65. package/dist/common/runApi/types.js +1 -2
  66. package/dist/common/settingsSchema.d.ts +0 -513
  67. package/dist/common/settingsSchema.js +2 -40
  68. package/package.json +4 -1
  69. package/dist/common/extensionsHelpers.d.ts +0 -15
  70. package/dist/common/extensionsHelpers.js +0 -81
Binary file
package/bin/intuned CHANGED
File without changes
@@ -52,8 +52,7 @@ async function executeCLI(apiName, mode, inputData, options) {
52
52
  } : undefined,
53
53
  runOptions: {
54
54
  environment: "cdp",
55
- cdpAddress: options.cdpAddress,
56
- mode
55
+ cdpAddress: options.cdpAddress
57
56
  },
58
57
  importFunction: _tsNodeImport.tsNodeImport
59
58
  });
@@ -47,7 +47,6 @@ _commander.program.description("run auth session check").option("--cdpAddress <c
47
47
  },
48
48
  runOptions: {
49
49
  environment: "cdp",
50
- mode,
51
50
  cdpAddress
52
51
  },
53
52
  auth: {
@@ -48,7 +48,6 @@ _commander.program.description("run auth session create").option("--cdpAddress <
48
48
  },
49
49
  runOptions: {
50
50
  environment: "cdp",
51
- mode,
52
51
  cdpAddress
53
52
  },
54
53
  retrieveSession: true,
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- const exclusions = ["node_modules/**", ".git/**", "dist/**", "build/**", "coverage/**", ".next/**", ".cache/**", "out/**", "tmp/**", ".DS_Store", "npm-debug.log*", "yarn-debug.log*", "yarn-error.log*", ".env", ".env.*", "**/*.map", "**/*.tsbuildinfo", "tsconfig.json", "output/**", "auth-sessions-instances/**", "README.md"];
7
+ const exclusions = ["node_modules/**", ".git/**", "dist/**", "build/**", "coverage/**", ".next/**", ".cache/**", "out/**", "tmp/**", ".DS_Store", "npm-debug.log*", "yarn-debug.log*", "yarn-error.log*", ".env", ".env.*", "**/*.map", "**/*.tsbuildinfo", "tsconfig.json", "output/**", "auth-sessions-instances/**", "README.md", "traces/**"];
8
8
  var _default = exports.default = exclusions;
@@ -20,7 +20,7 @@ const tsNodeImport = async apiName => {
20
20
  const imported = await (specifier => new Promise(r => r(`${specifier}`)).then(s => _interopRequireWildcard(require(s))))(path);
21
21
  return (0, _neverthrow.ok)(imported);
22
22
  } catch (e) {
23
- if ("code" in e && e.code === "MODULE_NOT_FOUND") {
23
+ if ("code" in e && e.code.includes("MODULE_NOT_FOUND")) {
24
24
  return (0, _neverthrow.err)({
25
25
  type: "not_found"
26
26
  });
@@ -6,15 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getSettings = getSettings;
7
7
  var _fileUtils = require("./fileUtils");
8
8
  var _settingsSchema = require("../../../common/settingsSchema");
9
- var _promises = require("fs/promises");
9
+ 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); }
10
+ 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; }
10
11
  async function getSettings() {
11
12
  const settingsFilePath = (0, _fileUtils.getFullPathInProject)("Intuned.json");
12
- console.log("loading settings");
13
- const settings = await (0, _promises.readFile)(settingsFilePath, {
14
- encoding: "utf-8"
15
- });
16
- if (settings) {
17
- const parsed = _settingsSchema.settingsSchema.safeParse(JSON.parse(settings));
13
+ const settings = await (specifier => new Promise(r => r(`${specifier}`)).then(s => _interopRequireWildcard(require(s))))(settingsFilePath);
14
+ if (settings.default) {
15
+ const parsed = _settingsSchema.settingsSchema.safeParse(settings.default);
18
16
  if (parsed.success) {
19
17
  return parsed.data;
20
18
  } else {
@@ -10,31 +10,21 @@ var _zod = require("zod");
10
10
  var _types = require("./types");
11
11
  var _helpers = require("../helpers");
12
12
  var _attempt = require("./attempt.command");
13
- const attemptApiCommandInputSchema = _zod.z.tuple([_zod.z.string().min(1, "API name is required"), _zod.z.string().min(1, "Parameters are required"), _types.baseCommandOptionsSchema.extend({
13
+ const argsSchema = _zod.z.tuple([_zod.z.string().min(1, "API name is required"), _zod.z.string().min(1, "Parameters are required")]);
14
+ const optionsSchema = _types.baseCommandOptionsSchema.extend({
14
15
  authSession: _zod.z.string().optional(),
15
16
  outputFile: _zod.z.string().optional()
16
- })]);
17
- const attemptApiCommand = exports.attemptApiCommand = _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-session-instances/<id>.json").option("--proxy <url>", "proxy URL to use").option("--timeout <time>", "timeout - milliseconds or ms-formatted string", "10 mins").option("--headless", "Run the API in headless mode (default: false). This will not open a browser window.").option("-o, --output-file <path>", "output file path").action((0, _helpers.withErrorLogging)(async (inputApiName, inputParameters, inputOptions) => {
18
- const parseResult = attemptApiCommandInputSchema.safeParse([inputApiName, inputParameters, inputOptions]);
19
- if (!parseResult.success) {
20
- return (0, _helpers.logInvalidInput)(parseResult);
21
- }
22
- const [apiName, parameters, {
23
- headless,
24
- authSession,
25
- outputFile,
26
- timeout,
27
- proxy
28
- }] = parseResult.data;
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-session-instances/<id>.json").option("-o, --output-file <path>", "output file path")).action((0, _helpers.cliCommandWrapper)(argsSchema, optionsSchema, async ([apiName, parameters], {
19
+ authSession,
20
+ ...rest
21
+ }) => {
29
22
  await (0, _helpers.assertAuthConsistent)(authSession);
30
- const inputData = await (0, _controller.loadParameters)(parameters);
23
+ const parametersData = await (0, _controller.loadParameters)(parameters);
31
24
  await (0, _api.executeAttemptApiCLI)({
32
25
  apiName,
33
- inputData: inputData,
26
+ inputData: parametersData,
34
27
  authSessionId: authSession,
35
- proxy,
36
- headless,
37
- timeout,
38
- outputFile
28
+ ...rest
39
29
  });
40
30
  }));
@@ -9,13 +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 attemptAuthSessionCheckSchema = _zod.z.tuple([_zod.z.string().min(1, "ID of the auth session is required"), _types.baseCommandOptionsSchema]);
13
- const attemptAuthSessionCheckCommand = exports.attemptAuthSessionCheckCommand = _attempt_authsession.attemptAuthSessionCommand.command("check").description("Check an existing auth session").argument("<id>", "ID of the auth session to check").option("--proxy <url>", "Proxy URL to use for the auth session command").option("--timeout <time>", "Timeout for the auth session command - milliseconds or ms-formatted string", "10 mins").option("--headless", "Run the API in headless mode (default: false). This will not open a browser window.").action((0, _helpers.withErrorLogging)(async (inputId, inputOptions) => {
14
- const parseResult = attemptAuthSessionCheckSchema.safeParse([inputId, inputOptions]);
15
- if (!parseResult.success) {
16
- return (0, _helpers.logInvalidInput)(parseResult);
17
- }
18
- const [id, options] = parseResult.data;
12
+ const argsSchema = _zod.z.tuple([_zod.z.string().min(1, "ID of the auth session is required")]);
13
+ const attemptAuthSessionCheckCommand = exports.attemptAuthSessionCheckCommand = (0, _types.withBaseOptions)(_attempt_authsession.attemptAuthSessionCommand.command("check").description("Check an existing auth session").argument("<id>", "ID of the auth session to check")).action((0, _helpers.cliCommandWrapper)(argsSchema, _types.baseCommandOptionsSchema, async ([id], options) => {
19
14
  await (0, _helpers.assertAuthEnabled)();
20
15
  await (0, _authSession.executeAttemptCheckAuthSessionCLI)({
21
16
  id,
@@ -10,27 +10,15 @@ var _authSession = require("../controller/authSession");
10
10
  var _attempt_authsession = require("./attempt_authsession.command");
11
11
  var _helpers = require("../helpers");
12
12
  var _types = require("./types");
13
- const attemptAuthSessionCreateInputSchema = _zod.z.tuple([_zod.z.string().min(1, "Parameters are required"), _types.baseCommandOptionsSchema.extend({
13
+ const argsSchema = _zod.z.tuple([_zod.z.string().min(1, "Parameters are required")]);
14
+ const optionsSchema = _types.baseCommandOptionsSchema.extend({
14
15
  id: _zod.z.string().optional()
15
- })]);
16
- const attemptAuthSessionCreateCommand = exports.attemptAuthSessionCreateCommand = _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-session-instances/[current timestamp].json").option("--proxy <url>", "Proxy URL to use for the auth session command").option("--timeout <time>", "Timeout for the auth session command - milliseconds or ms-formatted string", "10 mins").option("--headless", "Run the API in headless mode (default: false). This will not open a browser window.").action((0, _helpers.withErrorLogging)(async (inputParameters, inputOptions) => {
17
- const parseResult = attemptAuthSessionCreateInputSchema.safeParse([inputParameters, inputOptions]);
18
- if (!parseResult.success) {
19
- return (0, _helpers.logInvalidInput)(parseResult);
20
- }
21
- const [parameters, {
22
- headless,
23
- id,
24
- timeout,
25
- proxy
26
- }] = parseResult.data;
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-session-instances/[current timestamp].json")).action((0, _helpers.cliCommandWrapper)(argsSchema, optionsSchema, async ([parameters], options) => {
27
18
  await (0, _helpers.assertAuthEnabled)();
28
19
  const authSessionInput = (await (0, _controller.loadParameters)(parameters)) ?? {};
29
20
  await (0, _authSession.executeAttemptCreateAuthSessionCLI)({
30
- id,
31
21
  input: authSessionInput,
32
- headless,
33
- timeout,
34
- proxy
22
+ ...options
35
23
  });
36
24
  }));
@@ -0,0 +1 @@
1
+ export declare const authSessionCommand: import("commander").Command;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.authSessionCommand = void 0;
7
+ var _command = require("./command");
8
+ const authSessionCommand = exports.authSessionCommand = _command.program.command("authsession").description("Manage Auth Sessions");
@@ -0,0 +1 @@
1
+ export declare const authSessionRecordCommand: import("commander").Command;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.authSessionRecordCommand = void 0;
7
+ var _zod = require("zod");
8
+ var _authSession = require("../controller/authSession");
9
+ var _helpers = require("../helpers");
10
+ var _authsession = require("./authsession.command");
11
+ var _run_authsession = require("./run_authsession.command");
12
+ var _types = require("./types");
13
+ const optionsSchema = _run_authsession.baseRunAuthSessionCommandOptionsSchema.extend({
14
+ id: _zod.z.string().optional()
15
+ });
16
+ const authSessionRecordCommand = exports.authSessionRecordCommand = (0, _types.withBaseOptions)(_authsession.authSessionCommand.command("record").description("Record a new auth session").option("--id <id>", "ID of the auth session to use for the command. Defaults to auth-session-[current timestamp]").option("--check-attempts <number>", "Number of attempts to check the auth session validity", "1")).action((0, _helpers.cliCommandWrapper)(undefined, optionsSchema, async (_, {
17
+ checkAttempts,
18
+ ...rest
19
+ }) => {
20
+ await (0, _helpers.assertAuthEnabled)();
21
+ const {
22
+ startUrl,
23
+ finishUrl
24
+ } = await (0, _helpers.getAuthSessionRecorderParameters)();
25
+ await (0, _authSession.executeRecordAuthSessionCLI)({
26
+ checkRetries: checkAttempts,
27
+ startUrl,
28
+ finishUrl,
29
+ ...rest
30
+ });
31
+ }));
@@ -7,6 +7,6 @@ exports.buildCommand = void 0;
7
7
  var _command = require("./command");
8
8
  var _build = require("../controller/build");
9
9
  var _helpers = require("../helpers");
10
- const buildCommand = exports.buildCommand = _command.program.command("build").description("Build Intuned project").action((0, _helpers.withErrorLogging)(async () => {
10
+ const buildCommand = exports.buildCommand = _command.program.command("build").description("Build Intuned project").action((0, _helpers.cliCommandWrapper)(undefined, undefined, async () => {
11
11
  await (0, _build.runBuild)();
12
12
  }));
@@ -14,12 +14,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
14
14
  _dotenv.default.config({
15
15
  path: `.env`
16
16
  });
17
- const deployCommand = exports.deployCommand = _command.program.command("deploy").description("Save and 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.withErrorLogging)(async (inputProjectName, inputOptions) => {
18
- const parseResult = _save2.saveOrDeployCommandSchema.safeParse([inputProjectName, inputOptions]);
19
- if (!parseResult.success) {
20
- return (0, _helpers.logInvalidInput)(parseResult);
21
- }
22
- const [projectName, options] = parseResult.data;
17
+ const deployCommand = exports.deployCommand = _command.program.command("deploy").description("Save and 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)(_save2.saveOrDeployArgsSchema, _save2.saveOrDeployOptionsSchema, async ([projectName], options) => {
23
18
  const {
24
19
  isValid,
25
20
  errorMessage
@@ -30,7 +25,7 @@ const deployCommand = exports.deployCommand = _command.program.command("deploy")
30
25
  autoColor: false
31
26
  });
32
27
  }
33
- const _projectName = projectName || (await (0, _helpers.getSettingIntunedJSON)("projectName"));
28
+ const _projectName = projectName || (await (0, _helpers.loadIntunedJson)()).projectName;
34
29
  if (!_projectName) {
35
30
  throw new _helpers.CLIError("Project name is required");
36
31
  }
@@ -14,3 +14,5 @@ export * from "./attempt_api.command";
14
14
  export * from "./attempt_authsession.command";
15
15
  export * from "./attempt_authsession_create.command";
16
16
  export * from "./attempt_authsession_check.command";
17
+ export * from "./authsession.command";
18
+ export * from "./authsession_record.command";
@@ -178,4 +178,26 @@ Object.keys(_attempt_authsession_check).forEach(function (key) {
178
178
  return _attempt_authsession_check[key];
179
179
  }
180
180
  });
181
+ });
182
+ var _authsession = require("./authsession.command");
183
+ Object.keys(_authsession).forEach(function (key) {
184
+ if (key === "default" || key === "__esModule") return;
185
+ if (key in exports && exports[key] === _authsession[key]) return;
186
+ Object.defineProperty(exports, key, {
187
+ enumerable: true,
188
+ get: function () {
189
+ return _authsession[key];
190
+ }
191
+ });
192
+ });
193
+ var _authsession_record = require("./authsession_record.command");
194
+ Object.keys(_authsession_record).forEach(function (key) {
195
+ if (key === "default" || key === "__esModule") return;
196
+ if (key in exports && exports[key] === _authsession_record[key]) return;
197
+ Object.defineProperty(exports, key, {
198
+ enumerable: true,
199
+ get: function () {
200
+ return _authsession_record[key];
201
+ }
202
+ });
181
203
  });
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.initCommand = void 0;
7
7
  var _command = require("./command");
8
8
  var _helpers = require("../helpers");
9
- const initCommand = exports.initCommand = _command.program.command("init").description("Deprecated: Initialize a new Intuned project").allowExcessArguments(true).allowUnknownOption(true).action((0, _helpers.withErrorLogging)(async () => {
9
+ const initCommand = exports.initCommand = _command.program.command("init").description("Deprecated: Initialize a new Intuned project").allowExcessArguments(true).allowUnknownOption(true).action((0, _helpers.cliCommandWrapper)(undefined, undefined, async () => {
10
10
  throw new _helpers.CLIError("^r^+The init command has been deprecated. Please use^ ^c^/npx create-intuned-project^ ^r^+instead.^:", {
11
11
  autoColor: false
12
12
  });
@@ -10,30 +10,24 @@ var _controller = require("../controller");
10
10
  var _zod = require("zod");
11
11
  var _types = require("./types");
12
12
  var _helpers = require("../helpers");
13
- const runApiCommandInputSchema = _zod.z.tuple([_zod.z.string().min(1, "API name is required"), _zod.z.string().min(1, "Parameters are required"), _types.baseCommandOptionsSchema.extend({
13
+ const argsSchema = _zod.z.tuple([_zod.z.string().min(1, "API name is required"), _zod.z.string().min(1, "Parameters are required")]);
14
+ const optionsSchema = _types.baseCommandOptionsSchema.extend({
14
15
  retries: _zod.z.coerce.number().default(1),
15
16
  authSession: _zod.z.string().optional(),
16
17
  authSessionAutoRecreate: _zod.z.boolean().default(true),
17
18
  outputFile: _zod.z.string().optional(),
18
19
  authSessionCheckAttempts: _types.authSessionCheckAttemptsSchema,
19
20
  authSessionCreateAttempts: _types.authSessionCreateAttemptsSchema
20
- })]);
21
- const runApiCommand = exports.runApiCommand = _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-session-instances/<id>").option("--retries <number>", "Number of retries for the API call", "1").option("--proxy <url>", "proxy URL to use").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("--timeout <time>", "timeout - milliseconds or ms-formatted string", "10 mins").option("--headless", "Run the API in headless mode (default: false). This will not open a browser window.").option("-o, --output-file <path>", "output file path").action((0, _helpers.withErrorLogging)(async (inputApiName, inputParameters, inputOptions) => {
22
- const parseResult = runApiCommandInputSchema.safeParse([inputApiName, inputParameters, inputOptions]);
23
- if (!parseResult.success) {
24
- return (0, _helpers.logInvalidInput)(parseResult);
25
- }
26
- const [apiName, parameters, {
27
- retries,
28
- headless,
29
- timeout,
30
- outputFile,
31
- proxy,
32
- authSession,
33
- authSessionAutoRecreate,
34
- authSessionCreateAttempts,
35
- authSessionCheckAttempts
36
- }] = parseResult.data;
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-session-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
+ retries,
24
+ outputFile,
25
+ authSession,
26
+ authSessionAutoRecreate,
27
+ authSessionCreateAttempts,
28
+ authSessionCheckAttempts,
29
+ ...rest
30
+ }) => {
37
31
  await (0, _helpers.assertAuthConsistent)(authSession);
38
32
  const inputData = await (0, _controller.loadParameters)(parameters);
39
33
  await (0, _api.executeRunApiCLI)({
@@ -47,8 +41,6 @@ const runApiCommand = exports.runApiCommand = _run.runCommand.command("api").des
47
41
  } : undefined,
48
42
  retries,
49
43
  outputFile,
50
- proxy,
51
- headless,
52
- timeout
44
+ ...rest
53
45
  });
54
46
  }));
@@ -1,20 +1,28 @@
1
+ import { Command } from "commander";
1
2
  export declare const baseRunAuthSessionCommandOptionsSchema: import("zod").ZodObject<{
2
3
  proxy: import("zod").ZodOptional<import("zod").ZodString>;
3
4
  headless: import("zod").ZodDefault<import("zod").ZodBoolean>;
5
+ keepBrowserOpen: import("zod").ZodDefault<import("zod").ZodBoolean>;
4
6
  timeout: import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodDefault<import("zod").ZodString>, import("ms").StringValue, string | undefined>, number, string | undefined>;
7
+ trace: import("zod").ZodDefault<import("zod").ZodBoolean>;
5
8
  checkAttempts: import("zod").ZodDefault<import("zod").ZodNumber>;
6
9
  createAttempts: import("zod").ZodDefault<import("zod").ZodNumber>;
7
10
  }, "strip", import("zod").ZodTypeAny, {
8
11
  headless: boolean;
12
+ keepBrowserOpen: boolean;
9
13
  timeout: number;
14
+ trace: boolean;
10
15
  checkAttempts: number;
11
16
  createAttempts: number;
12
17
  proxy?: string | undefined;
13
18
  }, {
14
19
  proxy?: string | undefined;
15
20
  headless?: boolean | undefined;
21
+ keepBrowserOpen?: boolean | undefined;
16
22
  timeout?: string | undefined;
23
+ trace?: boolean | undefined;
17
24
  checkAttempts?: number | undefined;
18
25
  createAttempts?: number | undefined;
19
26
  }>;
20
- export declare const runAuthSessionCommand: import("commander").Command;
27
+ export declare const runAuthSessionCommand: Command;
28
+ export declare function withAuthSessionBaseOptions(command: Command): Command;
@@ -4,10 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.runAuthSessionCommand = exports.baseRunAuthSessionCommandOptionsSchema = void 0;
7
+ exports.withAuthSessionBaseOptions = withAuthSessionBaseOptions;
7
8
  var _types = require("./types");
8
9
  var _run = require("./run.command");
9
10
  const baseRunAuthSessionCommandOptionsSchema = exports.baseRunAuthSessionCommandOptionsSchema = _types.baseCommandOptionsSchema.extend({
10
11
  checkAttempts: _types.authSessionCheckAttemptsSchema,
11
12
  createAttempts: _types.authSessionCreateAttemptsSchema
12
13
  });
13
- const runAuthSessionCommand = exports.runAuthSessionCommand = _run.runCommand.command("authsession").description("Manage authentication sessions");
14
+ const runAuthSessionCommand = exports.runAuthSessionCommand = _run.runCommand.command("authsession").description("Manage authentication sessions");
15
+ function withAuthSessionBaseOptions(command) {
16
+ return (0, _types.withBaseOptions)(command.option("--check-attempts <number>", "Number of attempts to check the auth session validity", "1").option("--create-attempts <number>", "Number of attempts to create a new auth session if it is invalid", "1"));
17
+ }
@@ -1 +1 @@
1
- export declare const runAuthSessionCreateCommand: import("commander").Command;
1
+ export declare const runAuthSessionCreateCommand: import("commander").Command, authSessionCreateCommand: import("commander").Command;
@@ -3,28 +3,24 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.runAuthSessionCreateCommand = void 0;
6
+ exports.runAuthSessionCreateCommand = exports.authSessionCreateCommand = void 0;
7
7
  var _controller = require("../controller");
8
8
  var _zod = require("zod");
9
9
  var _authSession = require("../controller/authSession");
10
10
  var _run_authsession = require("./run_authsession.command");
11
11
  var _helpers = require("../helpers");
12
- const runAuthSessionCreateInputSchema = _zod.z.tuple([_zod.z.string().min(1, "Parameters are required"), _run_authsession.baseRunAuthSessionCommandOptionsSchema.extend({
12
+ var _authsession = require("./authsession.command");
13
+ const argsSchema = _zod.z.tuple([_zod.z.string().min(1, "Parameters are required")]);
14
+ const optionsSchema = _run_authsession.baseRunAuthSessionCommandOptionsSchema.extend({
13
15
  id: _zod.z.string().optional()
14
- })]);
15
- const runAuthSessionCreateCommand = exports.runAuthSessionCreateCommand = _run_authsession.runAuthSessionCommand.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-session-[current timestamp]").option("--check-attempts <number>", "Number of attempts to check the auth session validity", "1").option("--create-attempts <number>", "Number of attempts to create a new auth session if it is invalid", "1").option("--proxy <url>", "Proxy URL to use for the auth session command").option("--timeout <time>", "Timeout for the auth session command - milliseconds or ms-formatted string", "10 mins").option("--headless", "Run the API in headless mode (default: false). This will not open a browser window.").action((0, _helpers.withErrorLogging)(async (inputParameters, inputOptions) => {
16
- const parseResult = runAuthSessionCreateInputSchema.safeParse([inputParameters, inputOptions]);
17
- if (!parseResult.success) {
18
- return (0, _helpers.logInvalidInput)(parseResult);
19
- }
20
- const [parameters, {
21
- checkAttempts,
22
- createAttempts,
23
- id,
24
- proxy,
25
- timeout,
26
- headless
27
- }] = parseResult.data;
16
+ });
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 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-session-[current timestamp]")).action((0, _helpers.cliCommandWrapper)(argsSchema, optionsSchema, async ([parameters], {
19
+ checkAttempts,
20
+ createAttempts,
21
+ id,
22
+ ...rest
23
+ }) => {
28
24
  await (0, _helpers.assertAuthEnabled)();
29
25
  const authSessionInput = (await (0, _controller.loadParameters)(parameters)) ?? {};
30
26
  await (0, _authSession.executeRunCreateAuthSessionCLI)({
@@ -32,8 +28,8 @@ const runAuthSessionCreateCommand = exports.runAuthSessionCreateCommand = _run_a
32
28
  checkRetries: checkAttempts,
33
29
  createRetries: createAttempts,
34
30
  input: authSessionInput,
35
- headless,
36
- proxy,
37
- timeout
31
+ ...rest
38
32
  });
39
- }));
33
+ })));
34
+ exports.authSessionCreateCommand = authSessionCreateCommand;
35
+ exports.runAuthSessionCreateCommand = runAuthSessionCreateCommand;
@@ -1 +1 @@
1
- export declare const runAuthSessionUpdateCommand: import("commander").Command;
1
+ export declare const runAuthSessionUpdateCommand: import("commander").Command, authSessionUpdateCommand: import("commander").Command;
@@ -3,28 +3,24 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.runAuthSessionUpdateCommand = void 0;
6
+ exports.runAuthSessionUpdateCommand = exports.authSessionUpdateCommand = void 0;
7
7
  var _controller = require("../controller");
8
8
  var _zod = require("zod");
9
9
  var _authSession = require("../controller/authSession");
10
10
  var _run_authsession = require("./run_authsession.command");
11
11
  var _helpers = require("../helpers");
12
- const runAuthSessionUpdateSchema = _zod.z.tuple([_zod.z.string().min(1, "ID of the auth session is required"), _run_authsession.baseRunAuthSessionCommandOptionsSchema.extend({
12
+ var _authsession = require("./authsession.command");
13
+ const argsSchema = _zod.z.tuple([_zod.z.string().min(1, "ID of the auth session is required")]);
14
+ const optionsSchema = _run_authsession.baseRunAuthSessionCommandOptionsSchema.extend({
13
15
  parameters: _zod.z.string().optional()
14
- })]);
15
- const runAuthSessionUpdateCommand = exports.runAuthSessionUpdateCommand = _run_authsession.runAuthSessionCommand.command("update").description("Update an existing auth session").argument("<id>", "ID of the auth session to update").option("--parameters <parameters>", "Parameters for the auth session command. If not provided, it will use the existing parameters").option("--check-attempts <number>", "Number of attempts to check the auth session validity", "1").option("--create-attempts <number>", "Number of attempts to create a new auth session if it is invalid", "1").option("--proxy <url>", "Proxy URL to use for the auth session command").option("--timeout <time>", "Timeout for the auth session command - milliseconds or ms-formatted string", "10 mins").option("--headless", "Run the API in headless mode (default: false). This will not open a browser window.").action((0, _helpers.withErrorLogging)(async (inputId, inputOptions) => {
16
- const parseResult = runAuthSessionUpdateSchema.safeParse([inputId, inputOptions]);
17
- if (!parseResult.success) {
18
- return (0, _helpers.logInvalidInput)(parseResult);
19
- }
20
- const [id, {
21
- checkAttempts,
22
- createAttempts,
23
- parameters,
24
- proxy,
25
- timeout,
26
- headless
27
- }] = parseResult.data;
16
+ });
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 auth session").argument("<id>", "ID of the auth session to update").option("--parameters <parameters>", "Parameters for the auth session command. If not provided, it will use the existing parameters")).action((0, _helpers.cliCommandWrapper)(argsSchema, optionsSchema, async ([id], {
19
+ checkAttempts,
20
+ createAttempts,
21
+ parameters,
22
+ ...rest
23
+ }) => {
28
24
  await (0, _helpers.assertAuthEnabled)();
29
25
  const authSessionInput = parameters ? await (0, _controller.loadParameters)(parameters) : undefined;
30
26
  await (0, _authSession.executeRunUpdateAuthSessionCLI)({
@@ -32,8 +28,8 @@ const runAuthSessionUpdateCommand = exports.runAuthSessionUpdateCommand = _run_a
32
28
  input: authSessionInput,
33
29
  checkRetries: checkAttempts,
34
30
  createRetries: createAttempts,
35
- headless,
36
- proxy,
37
- timeout
31
+ ...rest
38
32
  });
39
- }));
33
+ })));
34
+ exports.authSessionUpdateCommand = authSessionUpdateCommand;
35
+ exports.runAuthSessionUpdateCommand = runAuthSessionUpdateCommand;
@@ -1 +1 @@
1
- export declare const runAuthSessionValidateCommand: import("commander").Command;
1
+ export declare const runAuthSessionValidateCommand: import("commander").Command, authSessionValidateCommand: import("commander").Command;
@@ -3,35 +3,31 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.runAuthSessionValidateCommand = void 0;
6
+ exports.runAuthSessionValidateCommand = exports.authSessionValidateCommand = void 0;
7
7
  var _zod = require("zod");
8
8
  var _authSession = require("../controller/authSession");
9
9
  var _run_authsession = require("./run_authsession.command");
10
10
  var _helpers = require("../helpers");
11
- const runAuthSessionValidateSchema = _zod.z.tuple([_zod.z.string().min(1, "ID of the auth session is required"), _run_authsession.baseRunAuthSessionCommandOptionsSchema.extend({
11
+ var _authsession = require("./authsession.command");
12
+ const argsSchema = _zod.z.tuple([_zod.z.string().min(1, "ID of the auth session is required")]);
13
+ const optionsSchema = _run_authsession.baseRunAuthSessionCommandOptionsSchema.extend({
12
14
  autoRecreate: _zod.z.boolean().default(true)
13
- })]);
14
- const runAuthSessionValidateCommand = exports.runAuthSessionValidateCommand = _run_authsession.runAuthSessionCommand.command("validate").description("Validate an existing auth session").argument("<id>", "ID of the auth session to validate").option("--check-attempts <number>", "Number of attempts to check the auth session validity", "1").option("--create-attempts <number>", "Number of attempts to create a new auth session if it is invalid", "1").option("--proxy <url>", "Proxy URL to use for the auth session command").option("--timeout <time>", "Timeout for the auth session command - milliseconds or ms-formatted string", "10 mins").option("--no-auto-recreate", "Disable auto recreation of the auth session if it is invalid").option("--headless", "Run the API in headless mode (default: false). This will not open a browser window.").action((0, _helpers.withErrorLogging)(async (inputId, inputOptions) => {
15
- const parseResult = runAuthSessionValidateSchema.safeParse([inputId, inputOptions]);
16
- if (!parseResult.success) {
17
- return (0, _helpers.logInvalidInput)(parseResult);
18
- }
19
- const [id, {
20
- autoRecreate,
21
- checkAttempts,
22
- createAttempts,
23
- headless,
24
- proxy,
25
- timeout
26
- }] = parseResult.data;
15
+ });
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 auth session").argument("<id>", "ID of the auth session to validate").option("--no-auto-recreate", "Disable auto recreation of the auth session if it is invalid")).action((0, _helpers.cliCommandWrapper)(argsSchema, optionsSchema, async ([id], {
18
+ autoRecreate,
19
+ checkAttempts,
20
+ createAttempts,
21
+ ...rest
22
+ }) => {
27
23
  await (0, _helpers.assertAuthEnabled)();
28
24
  await (0, _authSession.executeRunValidateAuthSessionCLI)({
29
25
  id,
30
26
  autoRecreate,
31
27
  checkRetries: checkAttempts,
32
28
  createRetries: createAttempts,
33
- headless,
34
- proxy,
35
- timeout
29
+ ...rest
36
30
  });
37
- }));
31
+ })));
32
+ exports.authSessionValidateCommand = authSessionValidateCommand;
33
+ exports.runAuthSessionValidateCommand = runAuthSessionValidateCommand;
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
- export declare const saveOrDeployCommandSchema: z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodUndefined]>, z.ZodObject<{
2
+ export declare const saveOrDeployArgsSchema: z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodUndefined]>], null>;
3
+ export declare const saveOrDeployOptionsSchema: z.ZodObject<{
3
4
  workspaceId: z.ZodOptional<z.ZodString>;
4
5
  apiKey: z.ZodOptional<z.ZodString>;
5
6
  }, "strip", z.ZodTypeAny, {
@@ -8,5 +9,5 @@ export declare const saveOrDeployCommandSchema: z.ZodTuple<[z.ZodUnion<[z.ZodStr
8
9
  }, {
9
10
  workspaceId?: string | undefined;
10
11
  apiKey?: string | undefined;
11
- }>], null>;
12
+ }>;
12
13
  export declare const saveCommand: import("commander").Command;