@intuned/runtime 1.3.16 → 1.3.17

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 (65) hide show
  1. package/InterfaceTemplate/index.playwright.ts +1 -1
  2. package/WebTemplate.zip +0 -0
  3. package/dist/commands/api/run.js +4 -8
  4. package/dist/commands/auth-sessions/load.js +2 -2
  5. package/dist/commands/auth-sessions/run-check.js +5 -5
  6. package/dist/commands/auth-sessions/run-create.js +3 -3
  7. package/dist/commands/build.js +1 -1
  8. package/dist/commands/common/projectExclusions.js +1 -1
  9. package/dist/commands/common/tsNodeImport.js +9 -0
  10. package/dist/commands/interface/run.js +1 -1
  11. package/dist/commands/intuned-cli/commands/attempt_api.command.js +1 -1
  12. package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +1 -1
  13. package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +2 -2
  14. package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +1 -1
  15. package/dist/commands/intuned-cli/commands/authsession.command.js +1 -1
  16. package/dist/commands/intuned-cli/commands/authsession_record.command.js +1 -1
  17. package/dist/commands/intuned-cli/commands/authsession_scaffold.command.d.ts +1 -0
  18. package/dist/commands/intuned-cli/commands/authsession_scaffold.command.js +16 -0
  19. package/dist/commands/intuned-cli/commands/deploy.command.js +13 -9
  20. package/dist/commands/intuned-cli/commands/index.d.ts +2 -2
  21. package/dist/commands/intuned-cli/commands/index.js +15 -15
  22. package/dist/commands/intuned-cli/commands/{save.command.d.ts → provision.command.d.ts} +1 -1
  23. package/dist/commands/intuned-cli/commands/provision.command.js +50 -0
  24. package/dist/commands/intuned-cli/commands/run_api.command.js +1 -1
  25. package/dist/commands/intuned-cli/commands/run_authsession.command.js +2 -2
  26. package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +1 -1
  27. package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +2 -2
  28. package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +2 -2
  29. package/dist/commands/intuned-cli/commands/types.js +2 -2
  30. package/dist/commands/intuned-cli/controller/__test__/api.test.js +6 -5
  31. package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +12 -11
  32. package/dist/commands/intuned-cli/controller/api.js +4 -1
  33. package/dist/commands/intuned-cli/controller/authSession.js +28 -28
  34. package/dist/commands/intuned-cli/controller/deploy.js +52 -10
  35. package/dist/commands/intuned-cli/controller/index.js +1 -1
  36. package/dist/commands/intuned-cli/controller/{save.d.ts → provision.d.ts} +5 -1
  37. package/dist/commands/intuned-cli/controller/provision.js +300 -0
  38. package/dist/commands/intuned-cli/controller/scaffold.d.ts +1 -0
  39. package/dist/commands/intuned-cli/controller/scaffold.js +77 -0
  40. package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +1 -0
  41. package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +1 -0
  42. package/dist/commands/intuned-cli/helpers/api.js +4 -7
  43. package/dist/commands/intuned-cli/helpers/auth.js +22 -19
  44. package/dist/commands/intuned-cli/helpers/backend.js +12 -4
  45. package/dist/commands/intuned-cli/helpers/context.js +2 -2
  46. package/dist/commands/intuned-cli/helpers/prompts.d.ts +3 -0
  47. package/dist/commands/intuned-cli/helpers/prompts.js +71 -0
  48. package/dist/commands/intuned-cli/helpers/wrapper.js +12 -2
  49. package/dist/commands/intuned-cli/main.js +21 -8
  50. package/dist/commands/intuned-cli/types.d.ts +42 -13
  51. package/dist/commands/intuned-cli/types.js +12 -2
  52. package/dist/common/backendFunctions/getAuthSessionParameters.js +1 -1
  53. package/dist/common/intunedJson.js +2 -2
  54. package/dist/common/jwtTokenManager.js +2 -2
  55. package/dist/common/launchBrowser.d.ts +2 -0
  56. package/dist/common/launchBrowser.js +28 -0
  57. package/dist/common/playwrightContext.js +7 -1
  58. package/dist/common/runApi/errors.js +1 -1
  59. package/dist/common/runApi/index.js +2 -2
  60. package/package.json +4 -2
  61. package/dist/commands/intuned-cli/commands/init.command.d.ts +0 -1
  62. package/dist/commands/intuned-cli/commands/init.command.js +0 -13
  63. package/dist/commands/intuned-cli/commands/save.command.js +0 -42
  64. package/dist/commands/intuned-cli/controller/save.js +0 -351
  65. /package/InterfaceTemplate/{utils.ts → __utils.ts} +0 -0
@@ -10,6 +10,8 @@ var _browser = require("./browser");
10
10
  var _errors = require("./errors");
11
11
  var _zod = require("zod");
12
12
  var _validation = require("./validation");
13
+ var _pressAnyKey = _interopRequireDefault(require("press-any-key"));
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
15
  function cliCommandWrapper(argsSchema, optionsSchema, fn) {
14
16
  return async (...input) => {
15
17
  let keepBrowserOpen = false;
@@ -61,6 +63,14 @@ function cliCommandWrapper(argsSchema, optionsSchema, fn) {
61
63
  async function waitForUserInput() {
62
64
  if (!(0, _browser.isCliBrowserLaunched)()) return;
63
65
  if (!_terminal.terminalStdout.isTTY) return;
64
- (0, _terminal.terminal)("Press Enter to continue...");
65
- await _terminal.terminal.inputField().promise;
66
+ (0, _terminal.terminal)("Press any key to continue...");
67
+ try {
68
+ await (0, _pressAnyKey.default)("", {
69
+ ctrlC: "reject",
70
+ hideMessage: true
71
+ });
72
+ } catch {
73
+ throw new _errors.AbortedCLIError();
74
+ }
75
+ (0, _terminal.terminal)("\n");
66
76
  }
@@ -3,9 +3,10 @@
3
3
  var _dotenv = _interopRequireDefault(require("dotenv"));
4
4
  var _constants = require("../../common/constants");
5
5
  var _backend = require("./helpers/backend");
6
- var _commands = require("./commands");
7
- var _helpers = require("./helpers");
6
+ var _intunedJson = require("../../common/intunedJson");
8
7
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
8
+ 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); }
9
+ 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; }
9
10
  require("../../common/binStartupScript");
10
11
  _dotenv.default.config({
11
12
  path: `.env`
@@ -15,9 +16,21 @@ process.env.RUN_ENVIRONMENT = "AUTHORING";
15
16
  if (!process.env.FUNCTIONS_DOMAIN) {
16
17
  process.env.FUNCTIONS_DOMAIN = (0, _backend.getBaseUrl)().replace(/\/$/, "");
17
18
  }
18
- _commands.program.configureHelp({
19
- sortSubcommands: true
20
- });
21
- void (0, _helpers.withCLIContext)(async () => {
22
- _commands.program.parse(process.argv);
23
- });
19
+ void (async () => {
20
+ const intunedJson = await (0, _intunedJson.loadIntunedJson)();
21
+ if (intunedJson.isOk() && intunedJson.value.workspaceId) {
22
+ process.env[_constants.WORKSPACE_ID_ENV_VAR_KEY] = intunedJson.value.workspaceId;
23
+ }
24
+ const {
25
+ program
26
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("./commands")));
27
+ const {
28
+ withCLIContext
29
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("./helpers/context")));
30
+ await withCLIContext(async () => {
31
+ program.configureHelp({
32
+ sortSubcommands: true
33
+ });
34
+ program.parse(process.argv);
35
+ });
36
+ })();
@@ -1,17 +1,45 @@
1
- export interface FileSystemTree {
2
- [name: string]: DirectoryNode | FileNode;
3
- }
4
- export interface DirectoryNode {
5
- directory: FileSystemTree;
6
- }
7
- export interface FileNode {
1
+ import { z } from "zod";
2
+ declare const fileNodeSchema: z.ZodObject<{
3
+ file: z.ZodObject<{
4
+ contents: z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>]>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ contents: (string | Uint8Array) & (string | Uint8Array | undefined);
7
+ }, {
8
+ contents: (string | Uint8Array) & (string | Uint8Array | undefined);
9
+ }>;
10
+ }, "strip", z.ZodTypeAny, {
8
11
  file: {
9
- /**
10
- * The contents of the file, either as a UTF-8 string or as raw binary.
11
- */
12
- contents: string | Uint8Array;
12
+ contents: (string | Uint8Array) & (string | Uint8Array | undefined);
13
13
  };
14
- }
14
+ }, {
15
+ file: {
16
+ contents: (string | Uint8Array) & (string | Uint8Array | undefined);
17
+ };
18
+ }>;
19
+ export type FileNode = z.infer<typeof fileNodeSchema>;
20
+ export type DirectoryNode = {
21
+ directory: {
22
+ [key: string]: FileNode | DirectoryNode;
23
+ };
24
+ };
25
+ export declare const fileSystemTreeSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodType<DirectoryNode, z.ZodTypeDef, DirectoryNode>, z.ZodObject<{
26
+ file: z.ZodObject<{
27
+ contents: z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>]>;
28
+ }, "strip", z.ZodTypeAny, {
29
+ contents: (string | Uint8Array) & (string | Uint8Array | undefined);
30
+ }, {
31
+ contents: (string | Uint8Array) & (string | Uint8Array | undefined);
32
+ }>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ file: {
35
+ contents: (string | Uint8Array) & (string | Uint8Array | undefined);
36
+ };
37
+ }, {
38
+ file: {
39
+ contents: (string | Uint8Array) & (string | Uint8Array | undefined);
40
+ };
41
+ }>]>>;
42
+ export type FileSystemTree = z.infer<typeof fileSystemTreeSchema>;
15
43
  export interface AuthCredentials {
16
44
  workspaceId: string;
17
45
  apiKey: string;
@@ -20,7 +48,7 @@ export declare enum ApiAuthSessionBehavior {
20
48
  PERFORM_CHECK_AND_REFRESH = "PERFORM_CHECK_AND_REFRESH",
21
49
  SKIP_CHECK_AND_REFRESH = "SKIP_CHECK_AND_REFRESH"
22
50
  }
23
- export declare const CHECK_FAILED_ERROR_MESSAGE = "Auth session check failed";
51
+ export declare const CHECK_FAILED_ERROR_MESSAGE = "AuthSession check failed";
24
52
  export type AuthSessionType = "API" | "MANUAL";
25
53
  export type AuthSessionMetadata = {
26
54
  createdAt: string;
@@ -39,3 +67,4 @@ export interface SessionStorageState {
39
67
  value: string;
40
68
  }[];
41
69
  }
70
+ export {};
@@ -3,10 +3,20 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.CHECK_FAILED_ERROR_MESSAGE = exports.ApiAuthSessionBehavior = void 0;
6
+ exports.fileSystemTreeSchema = exports.CHECK_FAILED_ERROR_MESSAGE = exports.ApiAuthSessionBehavior = void 0;
7
+ var _zod = require("zod");
8
+ const fileNodeSchema = _zod.z.object({
9
+ file: _zod.z.object({
10
+ contents: _zod.z.union([_zod.z.string(), _zod.z.instanceof(Uint8Array)])
11
+ })
12
+ });
13
+ const directoryNodeSchema = _zod.z.lazy(() => _zod.z.object({
14
+ directory: fileSystemTreeSchema
15
+ }));
16
+ const fileSystemTreeSchema = exports.fileSystemTreeSchema = _zod.z.record(_zod.z.union([directoryNodeSchema, fileNodeSchema]));
7
17
  let ApiAuthSessionBehavior = exports.ApiAuthSessionBehavior = function (ApiAuthSessionBehavior) {
8
18
  ApiAuthSessionBehavior["PERFORM_CHECK_AND_REFRESH"] = "PERFORM_CHECK_AND_REFRESH";
9
19
  ApiAuthSessionBehavior["SKIP_CHECK_AND_REFRESH"] = "SKIP_CHECK_AND_REFRESH";
10
20
  return ApiAuthSessionBehavior;
11
21
  }({});
12
- const CHECK_FAILED_ERROR_MESSAGE = exports.CHECK_FAILED_ERROR_MESSAGE = "Auth session check failed";
22
+ const CHECK_FAILED_ERROR_MESSAGE = exports.CHECK_FAILED_ERROR_MESSAGE = "AuthSession check failed";
@@ -19,7 +19,7 @@ async function getAuthSessionParameters() {
19
19
  }
20
20
  const authSessionId = context.authSessionId;
21
21
  if ((0, _isNil.default)(authSessionId)) {
22
- throw new Error("Auth sessions are not enabled");
22
+ throw new Error("AuthSessions are not enabled");
23
23
  }
24
24
  const response = await (0, _jwtTokenManager.callBackendFunctionWithToken)(`auth-session/${authSessionId}/parameters`, {
25
25
  method: "GET"
@@ -15,6 +15,7 @@ var JSONC = _interopRequireWildcard(require("jsonc-parser"));
15
15
  var YAML = _interopRequireWildcard(require("yaml"));
16
16
  var TOML = _interopRequireWildcard(require("smol-toml"));
17
17
  var _neverthrow = require("neverthrow");
18
+ var _formatZodError = require("./formatZodError");
18
19
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
19
20
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
21
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -66,8 +67,7 @@ async function loadIntunedJson() {
66
67
  }
67
68
  const parseResult = intunedJsonSchema.safeParse(intunedJson);
68
69
  if (!parseResult.success) {
69
- const formattedError = parseResult.error.errors.map(e => `- ${e.path.join(".")}: ${e.message}`).join("\n");
70
- return (0, _neverthrow.err)(`${settingsFile.name} is not valid:\n${formattedError}\nPlease fix the errors and try again.`);
70
+ return (0, _neverthrow.err)(`${settingsFile.name} is not valid:\n${(0, _formatZodError.formatZodError)(parseResult.error)}\nPlease fix the errors and try again.`);
71
71
  }
72
72
  return (0, _neverthrow.ok)(parseResult.data);
73
73
  }
@@ -76,7 +76,7 @@ class JwtTokenManager {
76
76
  headers
77
77
  });
78
78
  if (result.status === 401 && process.env[_constants.CLI_ENV_VAR_KEY] === "true") {
79
- console.warn("Unauthorized backend function call - make sure to save your project to Intuned to set up the correct API credentials");
79
+ console.warn("Unauthorized backend function call - make sure to provision your project to Intuned to set up the correct API credentials.\n" + "Run 'intuned provision' or see https://docs.intunedhq.com/docs/05-references/cli#provision-project for more information.");
80
80
  }
81
81
  return result;
82
82
  }
@@ -97,7 +97,7 @@ class JwtTokenManager {
97
97
  return `${domain}/api/${workspaceId}/functions/${projectId}`;
98
98
  } catch (e) {
99
99
  if (process.env[_constants.CLI_ENV_VAR_KEY] === "true") {
100
- throw new Error(`API credentials not set - make sure to save your project to Intuned to set up the correct API credentials.\nOriginal error: ${e.message}`);
100
+ throw new Error(`API credentials not set - make sure to provision your project to Intuned to set up the correct API credentials.\n` + `Run 'intuned provision' or see https://docs.intunedhq.com/docs/05-references/cli#provision-project for more information.\n` + `Original error: ${e.message}`);
101
101
  }
102
102
  }
103
103
  }
@@ -1,4 +1,5 @@
1
1
  import * as playwright from "playwright";
2
+ import { Result } from "neverthrow";
2
3
  export interface Proxy {
3
4
  server: string;
4
5
  username: string;
@@ -24,6 +25,7 @@ export declare function launchChromium(options: LaunchChromiumCdpOptions): Promi
24
25
  export declare function getBrowserExecutablePath(): Promise<string | undefined>;
25
26
  export declare function launchBrowser(options: Omit<LaunchChromiumStandaloneOptions, "executablePath"> | LaunchChromiumCdpOptions): Promise<LaunchBrowserResult>;
26
27
  export declare function getLocalCdpAddress(port: number): string;
28
+ export declare function getCdpWebSocketUrl(cdpAddress: string): Promise<Result<string, string>>;
27
29
  export declare function getHeadlessUserAgent({ executablePath, args, ignoreDefaultArgs, }: {
28
30
  executablePath?: string;
29
31
  args?: string[];
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getBrowserExecutablePath = getBrowserExecutablePath;
7
+ exports.getCdpWebSocketUrl = getCdpWebSocketUrl;
7
8
  exports.getHeadlessUserAgent = getHeadlessUserAgent;
8
9
  exports.getLocalCdpAddress = getLocalCdpAddress;
9
10
  exports.launchBrowser = launchBrowser;
@@ -17,6 +18,8 @@ var _child_process = require("child_process");
17
18
  var _extensionsHelpers = require("./extension/extensionsHelpers");
18
19
  var _intunedExtensionServer = require("./extension/intunedExtensionServer");
19
20
  var _util = require("util");
21
+ var _neverthrow = require("neverthrow");
22
+ var _zod = require("zod");
20
23
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
24
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
22
25
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -173,6 +176,31 @@ async function getBraveExecutablePath() {
173
176
  function getLocalCdpAddress(port) {
174
177
  return `http://localhost:${port}`;
175
178
  }
179
+ async function getCdpWebSocketUrl(cdpAddress) {
180
+ let response;
181
+ try {
182
+ response = await fetch(`${cdpAddress}/json/version`);
183
+ } catch (error) {
184
+ return (0, _neverthrow.err)(`Failed to fetch CDP version from ${cdpAddress}: ${error instanceof Error ? error.message : String(error)}`);
185
+ }
186
+ if (!response.ok) {
187
+ return (0, _neverthrow.err)(`Failed to get CDP WebSocket URL from ${cdpAddress}: ${response.status} ${response.statusText}`);
188
+ }
189
+ let data;
190
+ try {
191
+ data = await response.json();
192
+ } catch (error) {
193
+ return (0, _neverthrow.err)(`Invalid CDP version response from ${cdpAddress}: ${error instanceof Error ? error.message : String(error)}`);
194
+ }
195
+ const cdpJsonVersionResponseSchema = _zod.z.object({
196
+ webSocketDebuggerUrl: _zod.z.string().url()
197
+ });
198
+ const parseResult = cdpJsonVersionResponseSchema.safeParse(data);
199
+ if (!parseResult.success) {
200
+ return (0, _neverthrow.err)(`Invalid CDP version response from ${cdpAddress}: ${JSON.stringify(parseResult.error.format())}`);
201
+ }
202
+ return (0, _neverthrow.ok)(parseResult.data.webSocketDebuggerUrl);
203
+ }
176
204
  async function waitOnCdpAddress(cdpAddress) {
177
205
  const cdpAddressWithoutProtocol = cdpAddress.replace("http://", "").replace("https://", "").replace("localhost", "127.0.0.1");
178
206
  await (0, _waitOn.default)({
@@ -71,7 +71,6 @@ async function withPlaywrightContext({
71
71
  const port = await (0, _portfinder.getPort)({
72
72
  port: 9222
73
73
  });
74
- hookCdpUrl = (0, _launchBrowser.getLocalCdpAddress)(port);
75
74
  ({
76
75
  context,
77
76
  page
@@ -81,9 +80,16 @@ async function withPlaywrightContext({
81
80
  downloadsPath,
82
81
  cdpPort: port
83
82
  }));
83
+ hookCdpUrl = (0, _launchBrowser.getLocalCdpAddress)(port);
84
84
  }
85
85
  let hookResult;
86
86
  try {
87
+ const wsUrlResult = await (0, _launchBrowser.getCdpWebSocketUrl)(hookCdpUrl);
88
+ if (wsUrlResult.isOk()) {
89
+ hookCdpUrl = wsUrlResult.value;
90
+ } else {
91
+ throw new Error(wsUrlResult.error);
92
+ }
87
93
  hookResult = await setupContextHook({
88
94
  apiName: apiName,
89
95
  apiParameters: apiParameters,
@@ -92,7 +92,7 @@ class AuthCheckFailedError extends RunAutomationError {
92
92
  super();
93
93
  this.code = authCheckFailedErrorCode;
94
94
  this.statusCode = 401;
95
- this.message = "auth session check failed";
95
+ this.message = "AuthSession check failed";
96
96
  this.wrapped = true;
97
97
  }
98
98
  }
@@ -141,7 +141,7 @@ async function runApi({
141
141
  (0, _cleanEnvironmentVariables.cleanEnvironmentVariables)();
142
142
  const automationFunctionParameters = [...(params !== undefined ? [params] : []), page, context];
143
143
  try {
144
- const automationFunctionResult = await automationFunction(...automationFunctionParameters);
144
+ const [automationFunctionResult] = await Promise.all([automationFunction(...automationFunctionParameters)]);
145
145
  const MAX_RESULT_SIZE_BYTES = 2 * 1024 * 1024;
146
146
  const resultSizeInBytes = getObjectSizeInBytes(automationFunctionResult);
147
147
  if (resultSizeInBytes > MAX_RESULT_SIZE_BYTES) {
@@ -193,7 +193,7 @@ async function checkAuthSessionWithRetries(page, context, checkFn, retries = 3)
193
193
  return (0, _neverthrow.ok)(false);
194
194
  }
195
195
  let tryNumber = 0;
196
- console.log("Checking auth session with retries", `${_constants.AUTH_SESSIONS_FOLDER_NAME}/check`);
196
+ console.log("Checking AuthSession with retries", `${_constants.AUTH_SESSIONS_FOLDER_NAME}/check`);
197
197
  while (retries > tryNumber) {
198
198
  const result = await checkFn(page, context);
199
199
  if (result) return (0, _neverthrow.ok)(true);
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@intuned/runtime",
3
- "version": "1.3.16",
3
+ "version": "1.3.17",
4
4
  "description": "Intuned runtime",
5
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
5
6
  "exports": {
6
7
  ".": "./dist/index.js",
7
8
  "./dist/runtime": "./dist/runtime/index.js",
@@ -72,16 +73,17 @@
72
73
  "dotenv": "^16.3.1",
73
74
  "fastify": "4.29.1",
74
75
  "fs-extra": "^11.3.0",
76
+ "ignore": "^7.0.5",
75
77
  "image-size": "^1.1.1",
76
78
  "jsonc-parser": "^3.3.1",
77
79
  "jsonwebtoken": "9.0.2",
78
80
  "lodash": "4.17.21",
79
81
  "milliparsec": "2.3.0",
80
- "minimatch": "10.0.1",
81
82
  "nanoid": "3",
82
83
  "neverthrow": "6.1.0",
83
84
  "playwright-extra": "4.3.6",
84
85
  "portfinder": "^1.0.37",
86
+ "press-any-key": "^1.1.0",
85
87
  "prettier": "2.8.0",
86
88
  "promptly": "3.2.0",
87
89
  "prompts": "^2.4.2",
@@ -1 +0,0 @@
1
- export declare const initCommand: import("commander").Command;
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.initCommand = void 0;
7
- var _command = require("./command");
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.cliCommandWrapper)(undefined, undefined, async () => {
10
- throw new _helpers.CLIError("^r^+The init command has been deprecated. Please use^ ^c^/npx create-intuned-project^ ^r^+instead.^:", {
11
- autoColor: false
12
- });
13
- }));
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.saveOrDeployOptionsSchema = exports.saveOrDeployArgsSchema = exports.saveCommand = void 0;
7
- var _command = require("./command");
8
- var _dotenv = _interopRequireDefault(require("dotenv"));
9
- var _save = require("../controller/save");
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 saveOrDeployArgsSchema = exports.saveOrDeployArgsSchema = _zod.z.tuple([_zod.z.union([_zod.z.string(), _zod.z.undefined()])]);
17
- const saveOrDeployOptionsSchema = exports.saveOrDeployOptionsSchema = _zod.z.object({
18
- workspaceId: _zod.z.string().optional(),
19
- apiKey: _zod.z.string().optional()
20
- });
21
- const saveCommand = exports.saveCommand = _command.program.command("save").description("Save an Intuned project to the platform without deploying it").argument("[project-name]", "Name of the project to save").option("-w, --workspace-id <id>", "Your Intuned workspace ID").option("-k, --api-key <key>", "Your Intuned API key").action((0, _helpers.cliCommandWrapper)(saveOrDeployArgsSchema, saveOrDeployOptionsSchema, async ([projectName], options) => {
22
- const {
23
- isValid,
24
- errorMessage
25
- } = await (0, _save.validateIntunedProject)();
26
- if (!isValid) {
27
- const message = `^r^+Project to be saved is not a valid Intuned project:^:^R ${errorMessage}:\n`;
28
- throw new _helpers.CLIError(message, {
29
- autoColor: false
30
- });
31
- }
32
- const _projectName = projectName || (await (0, _helpers.loadIntunedJson)()).projectName;
33
- if (!_projectName) {
34
- throw new _helpers.CLIError("Project name is required");
35
- }
36
- const projectNameValidation = (0, _save.validateProjectName)(_projectName);
37
- if (!projectNameValidation.isValid) {
38
- throw new _helpers.CLIError(projectNameValidation.errorMessage);
39
- }
40
- const auth = await (0, _helpers.getAuthCredentials)(options);
41
- await (0, _save.runSaveProject)(_projectName, auth);
42
- }));