@intuned/runtime-dev 1.2.8-dev-peer-script → 1.3.0-responseLimits.1

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 (144) hide show
  1. package/.babelrc +2 -2
  2. package/CHANGELOG.md +5 -1
  3. package/bin/intuned +2 -0
  4. package/dist/commands/api/run.js +10 -3
  5. package/dist/commands/auth-sessions/run-check.js +18 -4
  6. package/dist/commands/auth-sessions/run-create.js +2 -1
  7. package/dist/commands/common/browserUtils.d.ts +1 -1
  8. package/dist/commands/common/browserUtils.js +1 -1
  9. package/dist/commands/common/getFirstLineNumber.js +2 -4
  10. package/dist/commands/interface/run.js +7 -6
  11. package/dist/commands/intuned-cli/commands/attempt.command.d.ts +1 -0
  12. package/dist/commands/intuned-cli/commands/attempt.command.js +8 -0
  13. package/dist/commands/intuned-cli/commands/attempt_api.command.d.ts +1 -0
  14. package/dist/commands/intuned-cli/commands/attempt_api.command.js +40 -0
  15. package/dist/commands/intuned-cli/commands/attempt_authsession.command.d.ts +1 -0
  16. package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +8 -0
  17. package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.d.ts +1 -0
  18. package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +24 -0
  19. package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.d.ts +1 -0
  20. package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +36 -0
  21. package/dist/commands/intuned-cli/commands/build.command.d.ts +1 -0
  22. package/dist/commands/intuned-cli/commands/build.command.js +12 -0
  23. package/dist/commands/intuned-cli/commands/command.d.ts +2 -0
  24. package/dist/commands/intuned-cli/commands/command.js +9 -0
  25. package/dist/commands/intuned-cli/commands/deploy.command.d.ts +1 -0
  26. package/dist/commands/intuned-cli/commands/deploy.command.js +46 -0
  27. package/dist/commands/intuned-cli/commands/index.d.ts +15 -0
  28. package/dist/commands/intuned-cli/commands/index.js +170 -0
  29. package/dist/commands/intuned-cli/commands/init.command.d.ts +1 -0
  30. package/dist/commands/intuned-cli/commands/init.command.js +13 -0
  31. package/dist/commands/intuned-cli/commands/run.command.d.ts +1 -0
  32. package/dist/commands/intuned-cli/commands/run.command.js +8 -0
  33. package/dist/commands/intuned-cli/commands/run_api.command.d.ts +1 -0
  34. package/dist/commands/intuned-cli/commands/run_api.command.js +54 -0
  35. package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +20 -0
  36. package/dist/commands/intuned-cli/commands/run_authsession.command.js +13 -0
  37. package/dist/commands/intuned-cli/commands/run_authsession_create.command.d.ts +1 -0
  38. package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +39 -0
  39. package/dist/commands/intuned-cli/commands/run_authsession_update.command.d.ts +1 -0
  40. package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +39 -0
  41. package/dist/commands/intuned-cli/commands/run_authsession_validate.command.d.ts +1 -0
  42. package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +37 -0
  43. package/dist/commands/intuned-cli/commands/types.d.ts +21 -0
  44. package/dist/commands/intuned-cli/commands/types.js +21 -0
  45. package/dist/commands/intuned-cli/constants/index.d.ts +17 -0
  46. package/dist/commands/intuned-cli/constants/index.js +25 -0
  47. package/dist/commands/intuned-cli/controller/__test__/api.test.js +280 -0
  48. package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +676 -0
  49. package/dist/commands/intuned-cli/controller/api.d.ts +44 -0
  50. package/dist/commands/intuned-cli/controller/api.js +181 -0
  51. package/dist/commands/intuned-cli/controller/authSession.d.ts +198 -0
  52. package/dist/commands/intuned-cli/controller/authSession.js +292 -0
  53. package/dist/commands/intuned-cli/controller/build.d.ts +1 -0
  54. package/dist/commands/intuned-cli/controller/build.js +36 -0
  55. package/dist/commands/intuned-cli/controller/deploy.d.ts +15 -0
  56. package/dist/commands/{deploy/utils.js → intuned-cli/controller/deploy.js} +115 -109
  57. package/dist/commands/intuned-cli/controller/index.d.ts +1 -0
  58. package/dist/commands/intuned-cli/controller/index.js +46 -0
  59. package/dist/commands/intuned-cli/helpers/api.d.ts +3 -0
  60. package/dist/commands/intuned-cli/helpers/api.js +19 -0
  61. package/dist/commands/intuned-cli/helpers/auth.d.ts +41 -0
  62. package/dist/commands/intuned-cli/helpers/auth.js +129 -0
  63. package/dist/commands/intuned-cli/helpers/backend.d.ts +8 -0
  64. package/dist/commands/intuned-cli/helpers/backend.js +26 -0
  65. package/dist/commands/intuned-cli/helpers/context.d.ts +3 -0
  66. package/dist/commands/intuned-cli/helpers/context.js +33 -0
  67. package/dist/commands/intuned-cli/helpers/errors.d.ts +14 -0
  68. package/dist/commands/intuned-cli/helpers/errors.js +55 -0
  69. package/dist/commands/intuned-cli/helpers/index.d.ts +10 -0
  70. package/dist/commands/intuned-cli/helpers/index.js +115 -0
  71. package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +1 -0
  72. package/dist/{common/cli/utils.js → commands/intuned-cli/helpers/intunedJson.js} +0 -16
  73. package/dist/commands/intuned-cli/helpers/proxy.d.ts +5 -0
  74. package/dist/commands/intuned-cli/helpers/proxy.js +23 -0
  75. package/dist/commands/intuned-cli/helpers/terminal.d.ts +5 -0
  76. package/dist/commands/intuned-cli/helpers/terminal.js +13 -0
  77. package/dist/commands/intuned-cli/helpers/timeout.d.ts +1 -0
  78. package/dist/commands/intuned-cli/helpers/timeout.js +23 -0
  79. package/dist/commands/intuned-cli/helpers/validation.d.ts +2 -0
  80. package/dist/commands/intuned-cli/helpers/validation.js +12 -0
  81. package/dist/commands/intuned-cli/index.d.ts +1 -0
  82. package/dist/commands/intuned-cli/index.js +16 -0
  83. package/dist/commands/intuned-cli/main.d.ts +1 -0
  84. package/dist/commands/intuned-cli/main.js +15 -0
  85. package/dist/{common/cli → commands/intuned-cli}/types.d.ts +1 -34
  86. package/dist/{common/cli → commands/intuned-cli}/types.js +1 -2
  87. package/dist/common/assets/browser_scripts.js +2509 -2143
  88. package/dist/common/asyncLocalStorage/index.d.ts +1 -2
  89. package/dist/common/backendFunctions/getAuthSessionParameters.d.ts +1 -0
  90. package/dist/common/backendFunctions/getAuthSessionParameters.js +38 -0
  91. package/dist/common/constants.d.ts +1 -0
  92. package/dist/common/constants.js +2 -1
  93. package/dist/common/getPlaywrightConstructs.d.ts +1 -1
  94. package/dist/common/getPlaywrightConstructs.js +4 -12
  95. package/dist/common/jwtTokenManager.js +3 -5
  96. package/dist/common/runApi/errors.d.ts +10 -3
  97. package/dist/common/runApi/errors.js +21 -8
  98. package/dist/common/runApi/index.d.ts +4 -1
  99. package/dist/common/runApi/index.js +33 -21
  100. package/dist/common/runApi/types.d.ts +140 -9
  101. package/dist/common/runApi/types.js +28 -27
  102. package/dist/index.d.ts +1 -1
  103. package/dist/index.js +6 -0
  104. package/dist/runtime/executionHelpers.test.js +3 -4
  105. package/dist/runtime/export.d.ts +16 -0
  106. package/dist/runtime/extendPayload.js +1 -1
  107. package/dist/runtime/extendTimeout.js +0 -7
  108. package/dist/runtime/getAuthSessionParameters.d.ts +1 -0
  109. package/dist/runtime/getAuthSessionParameters.js +20 -0
  110. package/dist/runtime/index.d.ts +1 -0
  111. package/dist/runtime/index.js +7 -0
  112. package/package.json +12 -11
  113. package/template.tsconfig.json +4 -7
  114. package/tsconfig.json +2 -1
  115. package/bin/check-auth-session +0 -3
  116. package/bin/cli-build +0 -3
  117. package/bin/create-auth-session +0 -3
  118. package/bin/deploy +0 -3
  119. package/bin/init +0 -3
  120. package/bin/run-api +0 -3
  121. package/dist/commands/cli-auth-sessions/check.d.ts +0 -2
  122. package/dist/commands/cli-auth-sessions/check.js +0 -40
  123. package/dist/commands/cli-auth-sessions/create.d.ts +0 -2
  124. package/dist/commands/cli-auth-sessions/create.js +0 -53
  125. package/dist/commands/cli-auth-sessions/utils.d.ts +0 -28
  126. package/dist/commands/cli-auth-sessions/utils.js +0 -285
  127. package/dist/commands/cli-build/cli-build.d.ts +0 -2
  128. package/dist/commands/cli-build/cli-build.js +0 -20
  129. package/dist/commands/deploy/deploy.d.ts +0 -2
  130. package/dist/commands/deploy/deploy.js +0 -47
  131. package/dist/commands/deploy/utils.d.ts +0 -16
  132. package/dist/commands/init/init.d.ts +0 -2
  133. package/dist/commands/init/init.js +0 -22
  134. package/dist/commands/init/utils.d.ts +0 -11
  135. package/dist/commands/init/utils.js +0 -181
  136. package/dist/commands/run-api-cli/run-api.d.ts +0 -2
  137. package/dist/commands/run-api-cli/run-api.js +0 -57
  138. package/dist/commands/run-api-cli/utils.d.ts +0 -9
  139. package/dist/commands/run-api-cli/utils.js +0 -144
  140. package/dist/common/cli/cliReadme.d.ts +0 -1
  141. package/dist/common/cli/cliReadme.js +0 -92
  142. package/dist/common/cli/constants.d.ts +0 -33
  143. package/dist/common/cli/constants.js +0 -39
  144. package/dist/common/cli/utils.d.ts +0 -6
package/.babelrc CHANGED
@@ -4,8 +4,8 @@
4
4
  "@babel/preset-env",
5
5
  {
6
6
  "targets": {
7
- "chrome": 115,
8
- "node": "16"
7
+ "chrome": 130,
8
+ "node": "20"
9
9
  },
10
10
  "modules": "commonjs"
11
11
  }
package/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # UNRELEASED
2
2
 
3
- -
3
+ -
4
+
5
+ # 1.2.0
6
+
7
+ - Release CLI v1
4
8
 
5
9
  # 1.0.3
6
10
 
package/bin/intuned ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require("../dist/commands/intuned-cli/main.js");
@@ -17,6 +17,8 @@ var _nanoid = require("nanoid");
17
17
  var _chalk = _interopRequireDefault(require("chalk"));
18
18
  var _runApi = require("../../common/runApi");
19
19
  var _tsNodeImport = require("../common/tsNodeImport");
20
+ var _isNil = _interopRequireDefault(require("lodash/isNil"));
21
+ var _constants = require("../../common/constants");
20
22
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
23
  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); }
22
24
  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; }
@@ -39,7 +41,7 @@ async function executeCLI(apiName, mode, inputData, options) {
39
41
  }
40
42
  const runApiResult = await (0, _runApi.runApi)({
41
43
  automationFunction: {
42
- name: `api/${apiName}`,
44
+ name: `${_constants.API_FOLDER_NAME}/${apiName}`,
43
45
  params: inputData
44
46
  },
45
47
  auth: authSessionPathToUse ? {
@@ -95,7 +97,7 @@ async function executeCLI(apiName, mode, inputData, options) {
95
97
  _Logger.logger.info("This will only take an effect if this API run was part of a job.");
96
98
  }
97
99
  }
98
- _commander.program.description("run the user function in the cli for testing purposes").option("-i, --input [file]", "input json file").option("-j, --json [json]", "input json string").option("--cdpAddress <cdpAddress>", "CDP address", "http://localhost:9222").option("--authSessionPath <authSession>", "auth session to use when executing the api").option("--outputFileId <outputFileId>", "the output file id to save the result in").option("--proxy <proxy>", "proxy to use").argument("[apiName]", "name of the api", "default").allowUnknownOption().addArgument(new _commander.Argument("<mode>", "mode of execution").choices(["vanilla", "playwright", "playwright-standalone", "playwright-headless"]).default("playwright-standalone").argOptional()).action(async (apiName, mode, options) => {
100
+ _commander.program.description("run the user function in the cli for testing purposes").option("-i, --input [file]", "input json file").option("-j, --json [json]", "input json string").option("--cdpAddress <cdpAddress>", "CDP address", "http://localhost:9222").option("--authSessionPath <authSession>", "auth session to use when executing the api").option("--outputFileId <outputFileId>", "the output file id to save the result in").option("--proxy <proxy>", "proxy to use").option("--authSessionParameters <authSessionParameters>", "parameters used to create the used auth session").argument("[apiName]", "name of the api", "default").allowUnknownOption().addArgument(new _commander.Argument("<mode>", "mode of execution").choices(["vanilla", "playwright", "playwright-standalone", "playwright-headless"]).default("playwright-standalone").argOptional()).action(async (apiName, mode, options) => {
99
101
  let inputData = null;
100
102
  if (options.input) {
101
103
  inputData = await fs.readJSON(options.input);
@@ -104,11 +106,16 @@ _commander.program.description("run the user function in the cli for testing pur
104
106
  } else {
105
107
  inputData = {};
106
108
  }
109
+ let authSessionParametersJson = undefined;
110
+ if (!(0, _isNil.default)(options?.authSessionParameters)) {
111
+ authSessionParametersJson = JSON.parse(options.authSessionParameters);
112
+ }
107
113
  await (0, _asyncLocalStorage.runWithContext)({
108
114
  runEnvironment: _enums.RunEnvironment.IDE,
109
115
  extendedPayloads: [],
110
116
  runId: (0, _nanoid.nanoid)(),
111
- proxy: options.proxy
117
+ proxy: options.proxy,
118
+ getAuthSessionParameters: authSessionParametersJson !== undefined ? async () => authSessionParametersJson : undefined
112
119
  }, () => executeCLI(apiName, mode, inputData, options));
113
120
  process.exit(0);
114
121
  });
@@ -9,15 +9,20 @@ var _dotenv = _interopRequireDefault(require("dotenv"));
9
9
  var _constants = require("../../common/constants");
10
10
  var _runApi = require("../../common/runApi");
11
11
  var _tsNodeImport = require("../common/tsNodeImport");
12
+ var _enums = require("../../runtime/enums");
13
+ var _nanoid = require("nanoid");
14
+ var _asyncLocalStorage = require("../../common/asyncLocalStorage");
15
+ var _isNil = _interopRequireDefault(require("lodash/isNil"));
12
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
17
  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); }
14
18
  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; }
15
19
  _dotenv.default.config({
16
20
  path: `.env`
17
21
  });
18
- _commander.program.description("run auth session check").option("--cdpAddress <cdpAddress>", "CDP address", "http://localhost:9222").option("--authSessionPath <authSession>", "auth session to use when executing the check").allowUnknownOption().addArgument(new _commander.Argument("<mode>", "mode of execution").choices(["vanilla", "playwright", "playwright-standalone"]).default("playwright-standalone").argOptional()).action(async (mode, {
22
+ _commander.program.description("run auth session check").option("--cdpAddress <cdpAddress>", "CDP address", "http://localhost:9222").option("--authSessionPath <authSession>", "auth session to use when executing the check").option("--authSessionParameters <authSessionParameters>", "parameters used to create the used auth session").allowUnknownOption().addArgument(new _commander.Argument("<mode>", "mode of execution").choices(["vanilla", "playwright", "playwright-standalone"]).default("playwright-standalone").argOptional()).action(async (mode, {
19
23
  cdpAddress,
20
- authSessionPath
24
+ authSessionPath,
25
+ authSessionParameters
21
26
  }) => {
22
27
  const setting = await (0, _settings.getSettings)();
23
28
  if (!setting.authSessions.enabled) {
@@ -27,7 +32,16 @@ _commander.program.description("run auth session check").option("--cdpAddress <c
27
32
  if (!fs.exists(checkFilePath)) {
28
33
  throw new Error("auth session check file not found");
29
34
  }
30
- const runApiResult = await (0, _runApi.runApi)({
35
+ let authSessionParametersJson = undefined;
36
+ if (!(0, _isNil.default)(authSessionParameters)) {
37
+ authSessionParametersJson = JSON.parse(authSessionParameters);
38
+ }
39
+ const runApiResult = await (0, _asyncLocalStorage.runWithContext)({
40
+ runEnvironment: _enums.RunEnvironment.IDE,
41
+ extendedPayloads: [],
42
+ runId: (0, _nanoid.nanoid)(),
43
+ getAuthSessionParameters: authSessionParametersJson !== undefined ? async () => authSessionParametersJson : undefined
44
+ }, async () => await (0, _runApi.runApi)({
31
45
  automationFunction: {
32
46
  name: `${_constants.AUTH_SESSIONS_FOLDER_NAME}/check`
33
47
  },
@@ -44,7 +58,7 @@ _commander.program.description("run auth session check").option("--cdpAddress <c
44
58
  runCheck: false
45
59
  },
46
60
  importFunction: _tsNodeImport.tsNodeImport
47
- });
61
+ }));
48
62
  if (runApiResult.isErr()) {
49
63
  if (runApiResult.error instanceof _runApi.AutomationError) {
50
64
  throw runApiResult.error.error;
@@ -94,7 +94,8 @@ _commander.program.description("run auth session create").option("--cdpAddress <
94
94
  await (0, _asyncLocalStorage.runWithContext)({
95
95
  runEnvironment: _enums.RunEnvironment.IDE,
96
96
  extendedPayloads: [],
97
- runId: (0, _nanoid.nanoid)()
97
+ runId: (0, _nanoid.nanoid)(),
98
+ getAuthSessionParameters: async () => inputData
98
99
  }, runCreate);
99
100
  process.exit(0);
100
101
  });
@@ -1,4 +1,4 @@
1
- import { BrowserContext } from "playwright-core";
1
+ import { BrowserContext } from "playwright";
2
2
  export declare const REMOTE_DEBUGGING_PORT = 9222;
3
3
  export declare const getChromiumLaunchArgs: () => string[];
4
4
  export declare function startOrRestartBrowser(): Promise<void>;
@@ -9,7 +9,7 @@ exports.saveSession = saveSession;
9
9
  exports.saveSessionFromOpenedBrowser = saveSessionFromOpenedBrowser;
10
10
  exports.startOrRestartBrowser = startOrRestartBrowser;
11
11
  var _child_process = require("child_process");
12
- var playwright = _interopRequireWildcard(require("playwright-core"));
12
+ var playwright = _interopRequireWildcard(require("playwright"));
13
13
  var fs = _interopRequireWildcard(require("fs-extra"));
14
14
  var _fileUtils = require("./utils/fileUtils");
15
15
  var _contextStorageStateHelpers = require("../../common/contextStorageStateHelpers");
@@ -32,10 +32,9 @@ function compileTypeScript(apiFilePath) {
32
32
  };
33
33
  }
34
34
  function findFirstExecutableLine(sourceFile) {
35
- var _defaultExportSymbol$;
36
35
  let functionBody;
37
36
  const defaultExportSymbol = sourceFile.getDefaultExportSymbol();
38
- const defaultExportDeclaration = defaultExportSymbol === null || defaultExportSymbol === void 0 || (_defaultExportSymbol$ = defaultExportSymbol.getDeclarations()) === null || _defaultExportSymbol$ === void 0 ? void 0 : _defaultExportSymbol$[0];
37
+ const defaultExportDeclaration = defaultExportSymbol?.getDeclarations()?.[0];
39
38
  if (defaultExportDeclaration) {
40
39
  if (defaultExportDeclaration.getKind() === _tsMorph.ts.SyntaxKind.FunctionDeclaration) {
41
40
  functionBody = defaultExportDeclaration.getBody();
@@ -45,9 +44,8 @@ function findFirstExecutableLine(sourceFile) {
45
44
  const expression = exportAssignment.getExpression();
46
45
  if (!expression) continue;
47
46
  if (expression.getKind() === _tsMorph.ts.SyntaxKind.Identifier || expression.getKind() === _tsMorph.ts.SyntaxKind.FunctionExpression || expression.getKind() === _tsMorph.ts.SyntaxKind.ArrowFunction) {
48
- var _sourceFile$getVariab;
49
47
  const identifier = expression.getText();
50
- const possiblyExportedFunction = sourceFile.getFunction(identifier) || ((_sourceFile$getVariab = sourceFile.getVariableStatement(identifier)) === null || _sourceFile$getVariab === void 0 ? void 0 : _sourceFile$getVariab.getDescendants().find(node => node.getKind() === _tsMorph.ts.SyntaxKind.FunctionExpression || node.getKind() === _tsMorph.ts.SyntaxKind.ArrowFunction));
48
+ const possiblyExportedFunction = sourceFile.getFunction(identifier) || sourceFile.getVariableStatement(identifier)?.getDescendants().find(node => node.getKind() === _tsMorph.ts.SyntaxKind.FunctionExpression || node.getKind() === _tsMorph.ts.SyntaxKind.ArrowFunction);
51
49
  if (possiblyExportedFunction) {
52
50
  functionBody = possiblyExportedFunction.getBody();
53
51
  break;
@@ -16,6 +16,7 @@ var _promises = require("timers/promises");
16
16
  var _jwtTokenManager = require("../../common/jwtTokenManager");
17
17
  var _formatZodError = require("../../common/formatZodError");
18
18
  var _neverthrow = require("neverthrow");
19
+ var _getAuthSessionParameters = require("../../common/backendFunctions/getAuthSessionParameters");
19
20
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
20
21
  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
22
  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; }
@@ -28,7 +29,8 @@ const startRunApiSchema = _zod.default.object({
28
29
  jobId: _zod.default.string().optional(),
29
30
  jobRunId: _zod.default.string().optional(),
30
31
  runId: _zod.default.string().optional(),
31
- queueId: _zod.default.string().optional()
32
+ queueId: _zod.default.string().optional(),
33
+ authSessionId: _zod.default.string().optional()
32
34
  }).optional()
33
35
  })
34
36
  });
@@ -65,14 +67,12 @@ function runAutomationCLI(importFunction) {
65
67
  let generator = null;
66
68
  const abortController = new AbortController();
67
69
  client.on("error", err => {
68
- var _generator;
69
- void ((_generator = generator) === null || _generator === void 0 ? void 0 : _generator.throw(err).catch(() => undefined));
70
+ void generator?.throw(err).catch(() => undefined);
70
71
  });
71
72
  const interruptSignalHandler = async () => {
72
- var _generator2;
73
73
  abortController.abort();
74
74
  await (0, _promises.setTimeout)(60_000);
75
- void ((_generator2 = generator) === null || _generator2 === void 0 ? void 0 : _generator2.throw(new Error("Interrupted")).catch(() => undefined));
75
+ void generator?.throw(new Error("Interrupted")).catch(() => undefined);
76
76
  client.end();
77
77
  process.exit(1);
78
78
  };
@@ -124,6 +124,7 @@ function runAutomationCLI(importFunction) {
124
124
  });
125
125
  }
126
126
  },
127
+ getAuthSessionParameters: _getAuthSessionParameters.getAuthSessionParameters,
127
128
  ...(message.parameters.context ?? {}),
128
129
  proxy: getProxyUrlFromRunOptions(message.parameters.runOptions)
129
130
  };
@@ -212,7 +213,7 @@ function runAutomationCLI(importFunction) {
212
213
  _commander.program.parse(process.argv);
213
214
  }
214
215
  function getProxyUrlFromRunOptions(runOptions) {
215
- if ((runOptions === null || runOptions === void 0 ? void 0 : runOptions.environment) !== "standalone") return undefined;
216
+ if (runOptions?.environment !== "standalone") return undefined;
216
217
  const proxy = runOptions.proxy;
217
218
  if (!proxy) return undefined;
218
219
  const url = new URL(proxy.server);
@@ -0,0 +1 @@
1
+ export declare const attemptCommand: import("commander").Command;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.attemptCommand = void 0;
7
+ var _command = require("./command");
8
+ const attemptCommand = exports.attemptCommand = _command.program.command("attempt").description("Execute an Intuned attempt");
@@ -0,0 +1 @@
1
+ export declare const attemptApiCommand: import("commander").Command;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.attemptApiCommand = void 0;
7
+ var _api = require("../controller/api");
8
+ var _controller = require("../controller");
9
+ var _zod = require("zod");
10
+ var _types = require("./types");
11
+ var _helpers = require("../helpers");
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({
14
+ authSession: _zod.z.string().optional(),
15
+ 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;
29
+ await (0, _helpers.assertAuthConsistent)(authSession);
30
+ const inputData = await (0, _controller.loadParameters)(parameters);
31
+ await (0, _api.executeAttemptApiCLI)({
32
+ apiName,
33
+ inputData: inputData,
34
+ authSessionId: authSession,
35
+ proxy,
36
+ headless,
37
+ timeout,
38
+ outputFile
39
+ });
40
+ }));
@@ -0,0 +1 @@
1
+ export declare const attemptAuthSessionCommand: import("commander").Command;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.attemptAuthSessionCommand = void 0;
7
+ var _attempt = require("./attempt.command");
8
+ const attemptAuthSessionCommand = exports.attemptAuthSessionCommand = _attempt.attemptCommand.command("authsession").description("Manage authentication sessions");
@@ -0,0 +1 @@
1
+ export declare const attemptAuthSessionCheckCommand: import("commander").Command;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.attemptAuthSessionCheckCommand = void 0;
7
+ var _zod = require("zod");
8
+ var _authSession = require("../controller/authSession");
9
+ var _attempt_authsession = require("./attempt_authsession.command");
10
+ var _helpers = require("../helpers");
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;
19
+ await (0, _helpers.assertAuthEnabled)();
20
+ await (0, _authSession.executeAttemptCheckAuthSessionCLI)({
21
+ id,
22
+ ...options
23
+ });
24
+ }));
@@ -0,0 +1 @@
1
+ export declare const attemptAuthSessionCreateCommand: import("commander").Command;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.attemptAuthSessionCreateCommand = void 0;
7
+ var _controller = require("../controller");
8
+ var _zod = require("zod");
9
+ var _authSession = require("../controller/authSession");
10
+ var _attempt_authsession = require("./attempt_authsession.command");
11
+ var _helpers = require("../helpers");
12
+ var _types = require("./types");
13
+ const attemptAuthSessionCreateInputSchema = _zod.z.tuple([_zod.z.string().min(1, "Parameters are required"), _types.baseCommandOptionsSchema.extend({
14
+ 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;
27
+ await (0, _helpers.assertAuthEnabled)();
28
+ const authSessionInput = (await (0, _controller.loadParameters)(parameters)) ?? {};
29
+ await (0, _authSession.executeAttemptCreateAuthSessionCLI)({
30
+ id,
31
+ input: authSessionInput,
32
+ headless,
33
+ timeout,
34
+ proxy
35
+ });
36
+ }));
@@ -0,0 +1 @@
1
+ export declare const buildCommand: import("commander").Command;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.buildCommand = void 0;
7
+ var _command = require("./command");
8
+ var _build = require("../controller/build");
9
+ var _helpers = require("../helpers");
10
+ const buildCommand = exports.buildCommand = _command.program.command("build").description("Build Intuned project").action((0, _helpers.withErrorLogging)(async () => {
11
+ await (0, _build.runBuild)();
12
+ }));
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare const program: Command;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.program = void 0;
7
+ var _commander = require("commander");
8
+ const program = exports.program = new _commander.Command();
9
+ program.name("intuned").description("Intuned CLI for creating, developing and deploying Intuned projects").version("1.0.0").enablePositionalOptions(true);
@@ -0,0 +1 @@
1
+ export declare const deployCommand: import("commander").Command;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.deployCommand = void 0;
7
+ var _command = require("./command");
8
+ var _dotenv = _interopRequireDefault(require("dotenv"));
9
+ var _deploy = require("../controller/deploy");
10
+ var _helpers = require("../helpers");
11
+ var _zod = require("zod");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ _dotenv.default.config({
14
+ path: `.env`
15
+ });
16
+ const deployCommandSchema = _zod.z.tuple([_zod.z.union([_zod.z.string(), _zod.z.undefined()]), _zod.z.object({
17
+ workspaceId: _zod.z.string().optional(),
18
+ apiKey: _zod.z.string().optional()
19
+ })]);
20
+ 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.withErrorLogging)(async (inputProjectName, inputOptions) => {
21
+ const parseResult = deployCommandSchema.safeParse([inputProjectName, inputOptions]);
22
+ if (!parseResult.success) {
23
+ return (0, _helpers.logInvalidInput)(parseResult);
24
+ }
25
+ const [projectName, options] = parseResult.data;
26
+ const {
27
+ isValid,
28
+ errorMessage
29
+ } = await (0, _deploy.validateIntunedProject)();
30
+ if (!isValid) {
31
+ const message = `^r^+Project to be deployed is not a valid Intuned project:^:^R ${errorMessage}:\n`;
32
+ throw new _helpers.CLIError(message, {
33
+ autoColor: false
34
+ });
35
+ }
36
+ const _projectName = projectName || (await (0, _helpers.getSettingIntunedJSON)("projectName"));
37
+ if (!_projectName) {
38
+ throw new _helpers.CLIError("Project name is required");
39
+ }
40
+ const projectNameValidation = (0, _deploy.validateProjectName)(_projectName);
41
+ if (!projectNameValidation.isValid) {
42
+ throw new _helpers.CLIError(projectNameValidation.errorMessage);
43
+ }
44
+ const auth = await (0, _helpers.getAuthCredentials)(options);
45
+ await (0, _deploy.runDeployProject)(_projectName, auth);
46
+ }));
@@ -0,0 +1,15 @@
1
+ export * from "./command";
2
+ export * from "./build.command";
3
+ export * from "./deploy.command";
4
+ export * from "./init.command";
5
+ export * from "./run.command";
6
+ export * from "./run_api.command";
7
+ export * from "./run_authsession.command";
8
+ export * from "./run_authsession_create.command";
9
+ export * from "./run_authsession_update.command";
10
+ export * from "./run_authsession_validate.command";
11
+ export * from "./attempt.command";
12
+ export * from "./attempt_api.command";
13
+ export * from "./attempt_authsession.command";
14
+ export * from "./attempt_authsession_create.command";
15
+ export * from "./attempt_authsession_check.command";
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _command = require("./command");
7
+ Object.keys(_command).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _command[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _command[key];
14
+ }
15
+ });
16
+ });
17
+ var _build = require("./build.command");
18
+ Object.keys(_build).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _build[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _build[key];
25
+ }
26
+ });
27
+ });
28
+ var _deploy = require("./deploy.command");
29
+ Object.keys(_deploy).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _deploy[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _deploy[key];
36
+ }
37
+ });
38
+ });
39
+ var _init = require("./init.command");
40
+ Object.keys(_init).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _init[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _init[key];
47
+ }
48
+ });
49
+ });
50
+ var _run = require("./run.command");
51
+ Object.keys(_run).forEach(function (key) {
52
+ if (key === "default" || key === "__esModule") return;
53
+ if (key in exports && exports[key] === _run[key]) return;
54
+ Object.defineProperty(exports, key, {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _run[key];
58
+ }
59
+ });
60
+ });
61
+ var _run_api = require("./run_api.command");
62
+ Object.keys(_run_api).forEach(function (key) {
63
+ if (key === "default" || key === "__esModule") return;
64
+ if (key in exports && exports[key] === _run_api[key]) return;
65
+ Object.defineProperty(exports, key, {
66
+ enumerable: true,
67
+ get: function () {
68
+ return _run_api[key];
69
+ }
70
+ });
71
+ });
72
+ var _run_authsession = require("./run_authsession.command");
73
+ Object.keys(_run_authsession).forEach(function (key) {
74
+ if (key === "default" || key === "__esModule") return;
75
+ if (key in exports && exports[key] === _run_authsession[key]) return;
76
+ Object.defineProperty(exports, key, {
77
+ enumerable: true,
78
+ get: function () {
79
+ return _run_authsession[key];
80
+ }
81
+ });
82
+ });
83
+ var _run_authsession_create = require("./run_authsession_create.command");
84
+ Object.keys(_run_authsession_create).forEach(function (key) {
85
+ if (key === "default" || key === "__esModule") return;
86
+ if (key in exports && exports[key] === _run_authsession_create[key]) return;
87
+ Object.defineProperty(exports, key, {
88
+ enumerable: true,
89
+ get: function () {
90
+ return _run_authsession_create[key];
91
+ }
92
+ });
93
+ });
94
+ var _run_authsession_update = require("./run_authsession_update.command");
95
+ Object.keys(_run_authsession_update).forEach(function (key) {
96
+ if (key === "default" || key === "__esModule") return;
97
+ if (key in exports && exports[key] === _run_authsession_update[key]) return;
98
+ Object.defineProperty(exports, key, {
99
+ enumerable: true,
100
+ get: function () {
101
+ return _run_authsession_update[key];
102
+ }
103
+ });
104
+ });
105
+ var _run_authsession_validate = require("./run_authsession_validate.command");
106
+ Object.keys(_run_authsession_validate).forEach(function (key) {
107
+ if (key === "default" || key === "__esModule") return;
108
+ if (key in exports && exports[key] === _run_authsession_validate[key]) return;
109
+ Object.defineProperty(exports, key, {
110
+ enumerable: true,
111
+ get: function () {
112
+ return _run_authsession_validate[key];
113
+ }
114
+ });
115
+ });
116
+ var _attempt = require("./attempt.command");
117
+ Object.keys(_attempt).forEach(function (key) {
118
+ if (key === "default" || key === "__esModule") return;
119
+ if (key in exports && exports[key] === _attempt[key]) return;
120
+ Object.defineProperty(exports, key, {
121
+ enumerable: true,
122
+ get: function () {
123
+ return _attempt[key];
124
+ }
125
+ });
126
+ });
127
+ var _attempt_api = require("./attempt_api.command");
128
+ Object.keys(_attempt_api).forEach(function (key) {
129
+ if (key === "default" || key === "__esModule") return;
130
+ if (key in exports && exports[key] === _attempt_api[key]) return;
131
+ Object.defineProperty(exports, key, {
132
+ enumerable: true,
133
+ get: function () {
134
+ return _attempt_api[key];
135
+ }
136
+ });
137
+ });
138
+ var _attempt_authsession = require("./attempt_authsession.command");
139
+ Object.keys(_attempt_authsession).forEach(function (key) {
140
+ if (key === "default" || key === "__esModule") return;
141
+ if (key in exports && exports[key] === _attempt_authsession[key]) return;
142
+ Object.defineProperty(exports, key, {
143
+ enumerable: true,
144
+ get: function () {
145
+ return _attempt_authsession[key];
146
+ }
147
+ });
148
+ });
149
+ var _attempt_authsession_create = require("./attempt_authsession_create.command");
150
+ Object.keys(_attempt_authsession_create).forEach(function (key) {
151
+ if (key === "default" || key === "__esModule") return;
152
+ if (key in exports && exports[key] === _attempt_authsession_create[key]) return;
153
+ Object.defineProperty(exports, key, {
154
+ enumerable: true,
155
+ get: function () {
156
+ return _attempt_authsession_create[key];
157
+ }
158
+ });
159
+ });
160
+ var _attempt_authsession_check = require("./attempt_authsession_check.command");
161
+ Object.keys(_attempt_authsession_check).forEach(function (key) {
162
+ if (key === "default" || key === "__esModule") return;
163
+ if (key in exports && exports[key] === _attempt_authsession_check[key]) return;
164
+ Object.defineProperty(exports, key, {
165
+ enumerable: true,
166
+ get: function () {
167
+ return _attempt_authsession_check[key];
168
+ }
169
+ });
170
+ });
@@ -0,0 +1 @@
1
+ export declare const initCommand: import("commander").Command;