@intuned/runtime-dev 1.3.17-ws.0 → 1.3.18-dev.2

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 (120) hide show
  1. package/.babelrc +6 -0
  2. package/CHANGELOG.md +1 -1
  3. package/InterfaceTemplate/{utils.ts → __utils.ts} +3 -1
  4. package/InterfaceTemplate/index.playwright.ts +1 -1
  5. package/bin/intuned +0 -0
  6. package/bin/intuned-interface +7 -0
  7. package/dist/commands/api/run.js +7 -11
  8. package/dist/commands/auth-sessions/load.js +2 -2
  9. package/dist/commands/auth-sessions/run-check.js +8 -8
  10. package/dist/commands/auth-sessions/run-create.js +6 -6
  11. package/dist/commands/build.js +2 -3
  12. package/dist/commands/common/browserUtils.d.ts +3 -3
  13. package/dist/commands/common/browserUtils.js +3 -4
  14. package/dist/commands/common/getFirstLineNumber.test.js +1 -2
  15. package/dist/commands/common/projectExclusions.js +1 -1
  16. package/dist/commands/common/tsNodeImport.d.ts +1 -1
  17. package/dist/commands/common/tsNodeImport.js +10 -2
  18. package/dist/commands/common/utils/fileUtils.js +1 -2
  19. package/dist/commands/common/utils/{unixSocket.d.ts → interfaceClient.d.ts} +10 -2
  20. package/dist/commands/common/utils/{unixSocket.js → interfaceClient.js} +16 -5
  21. package/dist/commands/common/utils/template.js +1 -2
  22. package/dist/commands/interface/run.js +23 -49
  23. package/dist/commands/intuned-cli/commands/attempt_api.command.js +1 -1
  24. package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +1 -1
  25. package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +2 -2
  26. package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +1 -1
  27. package/dist/commands/intuned-cli/commands/authsession.command.js +1 -1
  28. package/dist/commands/intuned-cli/commands/authsession_record.command.js +1 -1
  29. package/dist/commands/intuned-cli/commands/authsession_scaffold.command.d.ts +1 -0
  30. package/dist/commands/intuned-cli/commands/authsession_scaffold.command.js +16 -0
  31. package/dist/commands/intuned-cli/commands/deploy.command.js +13 -9
  32. package/dist/commands/intuned-cli/commands/index.d.ts +2 -2
  33. package/dist/commands/intuned-cli/commands/index.js +15 -15
  34. package/dist/commands/intuned-cli/commands/{save.command.d.ts → provision.command.d.ts} +3 -3
  35. package/dist/commands/intuned-cli/commands/provision.command.js +50 -0
  36. package/dist/commands/intuned-cli/commands/run_api.command.js +1 -1
  37. package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +8 -1
  38. package/dist/commands/intuned-cli/commands/run_authsession.command.js +2 -2
  39. package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +1 -1
  40. package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +2 -2
  41. package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +2 -2
  42. package/dist/commands/intuned-cli/commands/types.d.ts +9 -1
  43. package/dist/commands/intuned-cli/commands/types.js +9 -5
  44. package/dist/commands/intuned-cli/controller/__test__/api.test.js +30 -19
  45. package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +140 -77
  46. package/dist/commands/intuned-cli/controller/api.d.ts +2 -2
  47. package/dist/commands/intuned-cli/controller/api.js +6 -3
  48. package/dist/commands/intuned-cli/controller/authSession.d.ts +16 -16
  49. package/dist/commands/intuned-cli/controller/authSession.js +50 -39
  50. package/dist/commands/intuned-cli/controller/build.js +1 -2
  51. package/dist/commands/intuned-cli/controller/deploy.js +53 -12
  52. package/dist/commands/intuned-cli/controller/index.js +2 -3
  53. package/dist/commands/intuned-cli/controller/{save.d.ts → provision.d.ts} +5 -1
  54. package/dist/commands/intuned-cli/controller/provision.js +299 -0
  55. package/dist/commands/intuned-cli/controller/scaffold.d.ts +1 -0
  56. package/dist/commands/intuned-cli/controller/scaffold.js +77 -0
  57. package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +45 -5
  58. package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +4 -3
  59. package/dist/commands/intuned-cli/helpers/api.js +4 -7
  60. package/dist/commands/intuned-cli/helpers/auth.d.ts +4 -4
  61. package/dist/commands/intuned-cli/helpers/auth.js +24 -21
  62. package/dist/commands/intuned-cli/helpers/backend.js +12 -4
  63. package/dist/commands/intuned-cli/helpers/browser.d.ts +4 -4
  64. package/dist/commands/intuned-cli/helpers/browser.js +40 -5
  65. package/dist/commands/intuned-cli/helpers/context.js +2 -2
  66. package/dist/commands/intuned-cli/helpers/errors.d.ts +1 -1
  67. package/dist/commands/intuned-cli/helpers/errors.js +2 -2
  68. package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +6 -5
  69. package/dist/commands/intuned-cli/helpers/prompts.d.ts +3 -0
  70. package/dist/commands/intuned-cli/helpers/prompts.js +71 -0
  71. package/dist/commands/intuned-cli/helpers/timeout.js +2 -2
  72. package/dist/commands/intuned-cli/helpers/traces.d.ts +1 -1
  73. package/dist/commands/intuned-cli/helpers/wrapper.js +14 -4
  74. package/dist/commands/intuned-cli/main.js +1 -2
  75. package/dist/commands/intuned-cli/types.d.ts +41 -12
  76. package/dist/commands/intuned-cli/types.js +12 -2
  77. package/dist/commands/ts-check.js +1 -2
  78. package/dist/common/backendFunctions/getAuthSessionParameters.js +1 -1
  79. package/dist/common/binStartupScript.js +1 -2
  80. package/dist/common/browserTabs.d.ts +72 -0
  81. package/dist/common/browserTabs.js +74 -0
  82. package/dist/common/constants.d.ts +1 -0
  83. package/dist/common/constants.js +2 -1
  84. package/dist/common/contextStorageStateHelpers.d.ts +4 -3
  85. package/dist/common/contextStorageStateHelpers.js +4 -1
  86. package/dist/common/extension/extensionsHelpers.d.ts +1 -1
  87. package/dist/common/extension/types.d.ts +14 -7
  88. package/dist/common/formatZodError.d.ts +1 -1
  89. package/dist/common/intunedJson.d.ts +19 -14
  90. package/dist/common/intunedJson.js +4 -4
  91. package/dist/common/jwtTokenManager.js +10 -6
  92. package/dist/common/launchBrowser.d.ts +10 -0
  93. package/dist/common/launchBrowser.js +67 -7
  94. package/dist/common/playwrightContext.d.ts +5 -5
  95. package/dist/common/playwrightContext.js +24 -14
  96. package/dist/common/runApi/importUsingImportFunction.d.ts +1 -3
  97. package/dist/common/runApi/importUsingImportFunction.js +7 -7
  98. package/dist/common/runApi/index.d.ts +3 -6
  99. package/dist/common/runApi/index.js +28 -52
  100. package/dist/common/settingsSchema.d.ts +52 -45
  101. package/dist/common/settingsSchema.js +3 -3
  102. package/dist/common/setupContextHook.d.ts +1 -2
  103. package/dist/common/setupContextHook.js +2 -2
  104. package/dist/common/telemetry.js +1 -2
  105. package/dist/index.d.ts +0 -1
  106. package/dist/index.js +0 -7
  107. package/dist/runtime/downloadDirectory.js +2 -2
  108. package/dist/vendor/runtime-interface.d.ts +1 -0
  109. package/dist/vendor/runtime-interface.js +493 -0
  110. package/package.json +19 -11
  111. package/tsup.config.ts +12 -0
  112. package/WebTemplate.zip +0 -0
  113. package/dist/commands/intuned-cli/commands/init.command.d.ts +0 -1
  114. package/dist/commands/intuned-cli/commands/init.command.js +0 -13
  115. package/dist/commands/intuned-cli/commands/save.command.js +0 -42
  116. package/dist/commands/intuned-cli/controller/save.js +0 -357
  117. package/dist/common/runApi/errors.d.ts +0 -72
  118. package/dist/common/runApi/errors.js +0 -169
  119. package/dist/common/runApi/types.d.ts +0 -830
  120. package/dist/common/runApi/types.js +0 -73
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Tab management utilities using CDP HTTP API.
3
+ *
4
+ * Provides functions to interact with browser tabs via Chrome DevTools Protocol HTTP endpoints.
5
+ * Refer to https://chromedevtools.github.io/devtools-protocol/ for the endpoints documentation.
6
+ * This approach is simpler than using the playwright API because it doesn't require us to create a playwright context.
7
+ */
8
+ export interface CDPTabInfo {
9
+ id: string;
10
+ type: string;
11
+ title: string;
12
+ url: string;
13
+ webSocketDebuggerUrl?: string;
14
+ devtoolsFrontendUrl?: string;
15
+ faviconUrl?: string;
16
+ description?: string;
17
+ }
18
+ /**
19
+ * Fetch current tabs from CDP /json endpoint.
20
+ *
21
+ * @param cdpAddress - CDP address (e.g., "http://localhost:9222")
22
+ * @returns List of tab info dictionaries from CDP (filtered to only "page" type)
23
+ *
24
+ * @example
25
+ * const tabs = await getCDPTabs("http://localhost:9222");
26
+ * // Returns:
27
+ * // [
28
+ * // {
29
+ * // "id": "1234",
30
+ * // "type": "page",
31
+ * // "title": "Google",
32
+ * // "url": "https://google.com",
33
+ * // ...
34
+ * // }
35
+ * // ]
36
+ */
37
+ export declare function getCDPTabs(cdpAddress: string): Promise<CDPTabInfo[]>;
38
+ /**
39
+ * Create new tab via CDP /json/new endpoint with optional URL.
40
+ *
41
+ * @param cdpAddress - CDP address (e.g., "http://localhost:9222")
42
+ * @param url - Initial URL for the tab (default: "about:blank")
43
+ * @returns Tab info dictionary from CDP
44
+ *
45
+ * @example
46
+ * const tab = await createCDPTab("http://localhost:9222", "https://google.com");
47
+ * // Returns:
48
+ * // {
49
+ * // "id": "1234",
50
+ * // "type": "page",
51
+ * // "title": "New Tab",
52
+ * // "url": "about:blank",
53
+ * // ...
54
+ * // }
55
+ */
56
+ export declare function createCDPTab(cdpAddress: string, url?: string): Promise<CDPTabInfo>;
57
+ /**
58
+ * Close tab via CDP /json/close/{id} endpoint.
59
+ *
60
+ * @param cdpAddress - CDP address (e.g., "http://localhost:9222")
61
+ * @param cdpTargetId - Full CDP target ID to close
62
+ * @returns True if successful, False otherwise
63
+ */
64
+ export declare function closeCDPTab(cdpAddress: string, cdpTargetId: string): Promise<boolean>;
65
+ /**
66
+ * Activate/bring to front a tab via CDP /json/activate/{id} endpoint.
67
+ *
68
+ * @param cdpAddress - CDP address (e.g., "http://localhost:9222")
69
+ * @param cdpTargetId - Full CDP target ID to activate
70
+ * @returns True if successful, False otherwise
71
+ */
72
+ export declare function activateCDPTab(cdpAddress: string, cdpTargetId: string): Promise<boolean>;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.activateCDPTab = activateCDPTab;
7
+ exports.closeCDPTab = closeCDPTab;
8
+ exports.createCDPTab = createCDPTab;
9
+ exports.getCDPTabs = getCDPTabs;
10
+ const DEFAULT_TIMEOUT = 5000;
11
+ async function getCDPTabs(cdpAddress) {
12
+ const controller = new AbortController();
13
+ const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT);
14
+ try {
15
+ const response = await fetch(`${cdpAddress}/json`, {
16
+ signal: controller.signal
17
+ });
18
+ if (!response.ok) {
19
+ throw new Error(`HTTP error! status: ${response.status}`);
20
+ }
21
+ const tabs = await response.json();
22
+ return tabs.filter(tab => tab.type === "page");
23
+ } finally {
24
+ clearTimeout(timeoutId);
25
+ }
26
+ }
27
+ async function createCDPTab(cdpAddress, url = "about:blank") {
28
+ const controller = new AbortController();
29
+ const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT);
30
+ try {
31
+ let endpoint = `${cdpAddress}/json/new`;
32
+ if (url && url !== "about:blank") {
33
+ endpoint = `${endpoint}?${url}`;
34
+ }
35
+ const response = await fetch(endpoint, {
36
+ method: "PUT",
37
+ signal: controller.signal
38
+ });
39
+ if (!response.ok) {
40
+ throw new Error(`HTTP error! status: ${response.status}`);
41
+ }
42
+ return await response.json();
43
+ } finally {
44
+ clearTimeout(timeoutId);
45
+ }
46
+ }
47
+ async function closeCDPTab(cdpAddress, cdpTargetId) {
48
+ const controller = new AbortController();
49
+ const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT);
50
+ try {
51
+ const response = await fetch(`${cdpAddress}/json/close/${cdpTargetId}`, {
52
+ signal: controller.signal
53
+ });
54
+ return response.status === 200;
55
+ } catch {
56
+ return false;
57
+ } finally {
58
+ clearTimeout(timeoutId);
59
+ }
60
+ }
61
+ async function activateCDPTab(cdpAddress, cdpTargetId) {
62
+ const controller = new AbortController();
63
+ const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT);
64
+ try {
65
+ const response = await fetch(`${cdpAddress}/json/activate/${cdpTargetId}`, {
66
+ signal: controller.signal
67
+ });
68
+ return response.status === 200;
69
+ } catch {
70
+ return false;
71
+ } finally {
72
+ clearTimeout(timeoutId);
73
+ }
74
+ }
@@ -5,6 +5,7 @@ export declare const WORKSPACE_ID_ENV_VAR_KEY = "INTUNED_WORKSPACE_ID";
5
5
  export declare const EXTENSION_PATH_ENV_VAR_KEY = "INTUNED_EXTENSION_PATH";
6
6
  export declare const PROJECT_ID_ENV_VAR_KEY = "INTUNED_PROJECT_ID";
7
7
  export declare const API_KEY_ENV_VAR_KEY = "INTUNED_API_KEY";
8
+ export declare const AUTH_TOKEN_ENV_VAR_KEY = "INTUNED_AUTH_TOKEN";
8
9
  export declare const API_KEY_HEADER_NAME = "x-api-key";
9
10
  export declare const API_BASE_URL_ENV_VAR_KEY = "INTUNED_API_BASE_URL";
10
11
  export declare const CLI_ENV_VAR_KEY = "INTUNED_CLI";
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WORKSPACE_ID_ENV_VAR_KEY = exports.PROJECT_ID_ENV_VAR_KEY = exports.EXTENSION_PATH_ENV_VAR_KEY = exports.CLI_ENV_VAR_KEY = exports.AUTH_SESSIONS_INSTANCES_FOLDER_NAME = exports.AUTH_SESSIONS_FOLDER_NAME = exports.API_KEY_HEADER_NAME = exports.API_KEY_ENV_VAR_KEY = exports.API_FOLDER_NAME = exports.API_BASE_URL_ENV_VAR_KEY = void 0;
6
+ exports.WORKSPACE_ID_ENV_VAR_KEY = exports.PROJECT_ID_ENV_VAR_KEY = exports.EXTENSION_PATH_ENV_VAR_KEY = exports.CLI_ENV_VAR_KEY = exports.AUTH_TOKEN_ENV_VAR_KEY = exports.AUTH_SESSIONS_INSTANCES_FOLDER_NAME = exports.AUTH_SESSIONS_FOLDER_NAME = exports.API_KEY_HEADER_NAME = exports.API_KEY_ENV_VAR_KEY = exports.API_FOLDER_NAME = exports.API_BASE_URL_ENV_VAR_KEY = void 0;
7
7
  const API_FOLDER_NAME = exports.API_FOLDER_NAME = "api";
8
8
  const AUTH_SESSIONS_FOLDER_NAME = exports.AUTH_SESSIONS_FOLDER_NAME = "auth-sessions";
9
9
  const AUTH_SESSIONS_INSTANCES_FOLDER_NAME = exports.AUTH_SESSIONS_INSTANCES_FOLDER_NAME = "auth-sessions-instances";
@@ -11,6 +11,7 @@ const WORKSPACE_ID_ENV_VAR_KEY = exports.WORKSPACE_ID_ENV_VAR_KEY = "INTUNED_WOR
11
11
  const EXTENSION_PATH_ENV_VAR_KEY = exports.EXTENSION_PATH_ENV_VAR_KEY = "INTUNED_EXTENSION_PATH";
12
12
  const PROJECT_ID_ENV_VAR_KEY = exports.PROJECT_ID_ENV_VAR_KEY = "INTUNED_PROJECT_ID";
13
13
  const API_KEY_ENV_VAR_KEY = exports.API_KEY_ENV_VAR_KEY = "INTUNED_API_KEY";
14
+ const AUTH_TOKEN_ENV_VAR_KEY = exports.AUTH_TOKEN_ENV_VAR_KEY = "INTUNED_AUTH_TOKEN";
14
15
  const API_KEY_HEADER_NAME = exports.API_KEY_HEADER_NAME = "x-api-key";
15
16
  const API_BASE_URL_ENV_VAR_KEY = exports.API_BASE_URL_ENV_VAR_KEY = "INTUNED_API_BASE_URL";
16
17
  const CLI_ENV_VAR_KEY = exports.CLI_ENV_VAR_KEY = "INTUNED_CLI";
@@ -1,4 +1,5 @@
1
- import * as playwright from "playwright";
1
+ import type * as playwright from "playwright";
2
+ import type { RunApiStorageState } from "@intuned/runtime-interface";
2
3
  interface StorageEntry {
3
4
  name: string;
4
5
  value: string;
@@ -16,6 +17,6 @@ export interface StorageState {
16
17
  origins?: LocalStorageState[] | null;
17
18
  sessionStorage?: SessionStorageState[] | null;
18
19
  }
19
- export declare function setStorageState(context: playwright.BrowserContext, state: StorageState): Promise<void>;
20
- export declare function getStorageState(context: playwright.BrowserContext): Promise<StorageState>;
20
+ export declare function setStorageState(context: playwright.BrowserContext, state: RunApiStorageState): Promise<void>;
21
+ export declare function getStorageState(context: playwright.BrowserContext): Promise<RunApiStorageState>;
21
22
  export {};
@@ -50,7 +50,10 @@ async function setStorageState(context, state) {
50
50
  await page.close();
51
51
  }
52
52
  async function getStorageState(context) {
53
- const result = {};
53
+ const result = {
54
+ cookies: [],
55
+ origins: []
56
+ };
54
57
  const storageState = await context.storageState();
55
58
  result.cookies = storageState.cookies;
56
59
  result.origins = storageState.origins;
@@ -1,4 +1,4 @@
1
- import * as playwright from "playwright";
1
+ import type * as playwright from "playwright";
2
2
  import { CaptchaSolverSettings, CaptchaSolverSettingsWithRunContext } from "../settingsSchema";
3
3
  export declare function resolveCaptchaSolverSettings(input?: unknown): Promise<CaptchaSolverSettings>;
4
4
  export declare function isIntunedExtensionLoaded(): boolean;
@@ -34,10 +34,11 @@ declare const captchaBaseSchema: z.ZodObject<{
34
34
  }>;
35
35
  export type CaptchaBase = z.infer<typeof captchaBaseSchema>;
36
36
  declare const captchaNonErrorSchema: z.ZodObject<{
37
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
38
37
  id: z.ZodString;
39
38
  tabId: z.ZodNumber;
39
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
40
40
  retryCount: z.ZodOptional<z.ZodNumber>;
41
+ } & {
41
42
  status: z.ZodEnum<["attached", "solving", "solved", "detached"]>;
42
43
  }, "strip", z.ZodTypeAny, {
43
44
  type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
@@ -54,10 +55,11 @@ declare const captchaNonErrorSchema: z.ZodObject<{
54
55
  }>;
55
56
  export type CaptchaNonError = z.infer<typeof captchaNonErrorSchema>;
56
57
  declare const captchaErrorStatusSchema: z.ZodObject<{
57
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
58
58
  id: z.ZodString;
59
59
  tabId: z.ZodNumber;
60
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
60
61
  retryCount: z.ZodOptional<z.ZodNumber>;
62
+ } & {
61
63
  status: z.ZodLiteral<"error">;
62
64
  error: z.ZodObject<{
63
65
  code: z.ZodEnum<["HIT_LIMIT", "MAX_RETRIES", "UNEXPECTED_SERVER_RESPONSE", "UNEXPECTED_ERROR"]>;
@@ -92,10 +94,11 @@ declare const captchaErrorStatusSchema: z.ZodObject<{
92
94
  }>;
93
95
  export type CaptchaErrorStatus = z.infer<typeof captchaErrorStatusSchema>;
94
96
  export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
95
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
96
97
  id: z.ZodString;
97
98
  tabId: z.ZodNumber;
99
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
98
100
  retryCount: z.ZodOptional<z.ZodNumber>;
101
+ } & {
99
102
  status: z.ZodLiteral<"attached">;
100
103
  }, "strip", z.ZodTypeAny, {
101
104
  type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
@@ -110,10 +113,11 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
110
113
  tabId: number;
111
114
  retryCount?: number | undefined;
112
115
  }>, z.ZodObject<{
113
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
114
116
  id: z.ZodString;
115
117
  tabId: z.ZodNumber;
118
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
116
119
  retryCount: z.ZodOptional<z.ZodNumber>;
120
+ } & {
117
121
  status: z.ZodLiteral<"solving">;
118
122
  }, "strip", z.ZodTypeAny, {
119
123
  type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
@@ -128,10 +132,11 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
128
132
  tabId: number;
129
133
  retryCount?: number | undefined;
130
134
  }>, z.ZodObject<{
131
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
132
135
  id: z.ZodString;
133
136
  tabId: z.ZodNumber;
137
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
134
138
  retryCount: z.ZodOptional<z.ZodNumber>;
139
+ } & {
135
140
  status: z.ZodLiteral<"solved">;
136
141
  }, "strip", z.ZodTypeAny, {
137
142
  type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
@@ -146,10 +151,11 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
146
151
  tabId: number;
147
152
  retryCount?: number | undefined;
148
153
  }>, z.ZodObject<{
149
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
150
154
  id: z.ZodString;
151
155
  tabId: z.ZodNumber;
156
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
152
157
  retryCount: z.ZodOptional<z.ZodNumber>;
158
+ } & {
153
159
  status: z.ZodLiteral<"detached">;
154
160
  }, "strip", z.ZodTypeAny, {
155
161
  type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
@@ -164,10 +170,11 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
164
170
  tabId: number;
165
171
  retryCount?: number | undefined;
166
172
  }>, z.ZodObject<{
167
- type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
168
173
  id: z.ZodString;
169
174
  tabId: z.ZodNumber;
175
+ type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
170
176
  retryCount: z.ZodOptional<z.ZodNumber>;
177
+ } & {
171
178
  status: z.ZodLiteral<"error">;
172
179
  error: z.ZodObject<{
173
180
  code: z.ZodEnum<["HIT_LIMIT", "MAX_RETRIES", "UNEXPECTED_SERVER_RESPONSE", "UNEXPECTED_ERROR"]>;
@@ -1,2 +1,2 @@
1
- import { ZodError } from "zod";
1
+ import { ZodError } from "zod/v3";
2
2
  export declare function formatZodError(zodError: ZodError): string[];
@@ -3,6 +3,7 @@ import { type Err, type Ok } from "neverthrow";
3
3
  export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
4
4
  projectName: z.ZodOptional<z.ZodString>;
5
5
  workspaceId: z.ZodOptional<z.ZodString>;
6
+ ignoreHttpErrors: z.ZodOptional<z.ZodBoolean>;
6
7
  metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
7
8
  defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
8
9
  defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
@@ -26,6 +27,7 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
26
27
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
27
28
  projectName: z.ZodOptional<z.ZodString>;
28
29
  workspaceId: z.ZodOptional<z.ZodString>;
30
+ ignoreHttpErrors: z.ZodOptional<z.ZodBoolean>;
29
31
  metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
30
32
  defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
31
33
  defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
@@ -49,6 +51,7 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
49
51
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
50
52
  projectName: z.ZodOptional<z.ZodString>;
51
53
  workspaceId: z.ZodOptional<z.ZodString>;
54
+ ignoreHttpErrors: z.ZodOptional<z.ZodBoolean>;
52
55
  metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
53
56
  defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
54
57
  defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
@@ -111,12 +114,12 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
111
114
  startUrl: z.ZodOptional<z.ZodString>;
112
115
  finishUrl: z.ZodOptional<z.ZodString>;
113
116
  }, "strip", z.ZodTypeAny, {
114
- type: "API" | "MANUAL";
117
+ type: "MANUAL" | "API";
115
118
  enabled: true;
116
119
  startUrl?: string | undefined;
117
120
  finishUrl?: string | undefined;
118
121
  }, {
119
- type: "API" | "MANUAL";
122
+ type: "MANUAL" | "API";
120
123
  enabled: true;
121
124
  startUrl?: string | undefined;
122
125
  finishUrl?: string | undefined;
@@ -132,7 +135,7 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
132
135
  authSessions: {
133
136
  enabled: false;
134
137
  } | {
135
- type: "API" | "MANUAL";
138
+ type: "MANUAL" | "API";
136
139
  enabled: true;
137
140
  startUrl?: string | undefined;
138
141
  finishUrl?: string | undefined;
@@ -144,7 +147,7 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
144
147
  authSessions: {
145
148
  enabled: false;
146
149
  } | {
147
- type: "API" | "MANUAL";
150
+ type: "MANUAL" | "API";
148
151
  enabled: true;
149
152
  startUrl?: string | undefined;
150
153
  finishUrl?: string | undefined;
@@ -156,16 +159,17 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
156
159
  export type IntunedJson = z.infer<typeof intunedJsonSchema>;
157
160
  export declare const intunedSettingsFileNames: readonly ["Intuned.json", "Intuned.jsonc", "Intuned.yaml", "Intuned.yml", "Intuned.toml"];
158
161
  export declare function loadIntunedJson(): Promise<Err<never, string> | Ok<{
159
- projectName?: string | undefined;
162
+ stealthMode?: {
163
+ enabled: boolean;
164
+ } | undefined;
165
+ ignoreHttpErrors?: boolean | undefined;
160
166
  workspaceId?: string | undefined;
167
+ projectName?: string | undefined;
161
168
  metadata?: {
162
169
  defaultJobInput?: Record<string, any> | undefined;
163
170
  defaultRunPlaygroundInput?: Record<string, any> | undefined;
164
171
  testAuthSessionInput?: Record<string, any> | undefined;
165
172
  } | undefined;
166
- stealthMode?: {
167
- enabled: boolean;
168
- } | undefined;
169
173
  } & {
170
174
  [k: string]: unknown;
171
175
  } & ({
@@ -179,7 +183,7 @@ export declare function loadIntunedJson(): Promise<Err<never, string> | Ok<{
179
183
  authSessions: {
180
184
  enabled: false;
181
185
  } | {
182
- type: "API" | "MANUAL";
186
+ type: "MANUAL" | "API";
183
187
  enabled: true;
184
188
  startUrl?: string | undefined;
185
189
  finishUrl?: string | undefined;
@@ -195,16 +199,17 @@ export declare function getIntunedSettingsFile(): Promise<Ok<{
195
199
  }, never> | Err<never, string>>;
196
200
  export declare function getIntunedSettingsFileName(): Promise<Err<never, string> | Ok<"Intuned.json" | "Intuned.jsonc" | "Intuned.yaml" | "Intuned.yml" | "Intuned.toml", never>>;
197
201
  export declare function loadIntunedJsonSync(): Err<never, string> | Ok<{
198
- projectName?: string | undefined;
202
+ stealthMode?: {
203
+ enabled: boolean;
204
+ } | undefined;
205
+ ignoreHttpErrors?: boolean | undefined;
199
206
  workspaceId?: string | undefined;
207
+ projectName?: string | undefined;
200
208
  metadata?: {
201
209
  defaultJobInput?: Record<string, any> | undefined;
202
210
  defaultRunPlaygroundInput?: Record<string, any> | undefined;
203
211
  testAuthSessionInput?: Record<string, any> | undefined;
204
212
  } | undefined;
205
- stealthMode?: {
206
- enabled: boolean;
207
- } | undefined;
208
213
  } & {
209
214
  [k: string]: unknown;
210
215
  } & ({
@@ -218,7 +223,7 @@ export declare function loadIntunedJsonSync(): Err<never, string> | Ok<{
218
223
  authSessions: {
219
224
  enabled: false;
220
225
  } | {
221
- type: "API" | "MANUAL";
226
+ type: "MANUAL" | "API";
222
227
  enabled: true;
223
228
  startUrl?: string | undefined;
224
229
  finishUrl?: string | undefined;
@@ -15,13 +15,14 @@ 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
- 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
- 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; }
18
+ var _formatZodError = require("./formatZodError");
19
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
20
20
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
21
  const playwright = undefined;
22
22
  const intunedJsonSchema = exports.intunedJsonSchema = _zod.z.object({
23
23
  projectName: _zod.z.string().optional(),
24
24
  workspaceId: _zod.z.string().optional(),
25
+ ignoreHttpErrors: _zod.z.boolean().optional(),
25
26
  metadata: _zod.z.object({
26
27
  defaultJobInput: _zod.z.record(_zod.z.any()).optional().catch(undefined),
27
28
  defaultRunPlaygroundInput: _zod.z.record(_zod.z.any()).optional().catch(undefined),
@@ -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
  }
@@ -9,8 +9,7 @@ var _crossFetch = _interopRequireDefault(require("cross-fetch"));
9
9
  var jwt = _interopRequireWildcard(require("jsonwebtoken"));
10
10
  var _neverthrow = require("neverthrow");
11
11
  var _constants = require("./constants");
12
- 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); }
13
- 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; }
12
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
14
  class JwtTokenManager {
16
15
  constructor(refreshTokenPath) {
@@ -65,8 +64,13 @@ class JwtTokenManager {
65
64
  }
66
65
  async fetchWithToken(...[input, init]) {
67
66
  const headers = new Headers(init?.headers);
68
- if (process.env[_constants.API_KEY_ENV_VAR_KEY]) {
69
- headers.set(_constants.API_KEY_HEADER_NAME, process.env[_constants.API_KEY_ENV_VAR_KEY]);
67
+ const apiKey = process.env[_constants.API_KEY_ENV_VAR_KEY];
68
+ if (apiKey) {
69
+ headers.set(_constants.API_KEY_HEADER_NAME, apiKey);
70
+ }
71
+ const token = process.env[_constants.AUTH_TOKEN_ENV_VAR_KEY];
72
+ if (token) {
73
+ headers.set("Authorization", `Bearer ${token}`);
70
74
  }
71
75
  if (this.token !== undefined) {
72
76
  headers.set("Authorization", `Bearer ${this.token}`);
@@ -76,7 +80,7 @@ class JwtTokenManager {
76
80
  headers
77
81
  });
78
82
  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");
83
+ 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
84
  }
81
85
  return result;
82
86
  }
@@ -97,7 +101,7 @@ class JwtTokenManager {
97
101
  return `${domain}/api/${workspaceId}/functions/${projectId}`;
98
102
  } catch (e) {
99
103
  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}`);
104
+ 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
105
  }
102
106
  }
103
107
  }
@@ -1,9 +1,15 @@
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;
5
6
  password: string;
6
7
  }
8
+ /**
9
+ * Get ignore_http_errors setting from CLI option, Intuned.json, or environment variable.
10
+ * Priority: cliOption > environment variable > Intuned.json > false
11
+ */
12
+ export declare function getIgnoreHttpErrorsFromConfig(cliOption?: boolean): Promise<boolean>;
7
13
  export type LaunchBrowserResult = {
8
14
  page: playwright.Page;
9
15
  context: playwright.BrowserContext;
@@ -15,15 +21,19 @@ export type LaunchChromiumStandaloneOptions = {
15
21
  cdpPort?: number;
16
22
  appModeInitialUrl?: string;
17
23
  executablePath?: string;
24
+ ignoreHttpErrors?: boolean;
18
25
  };
19
26
  export type LaunchChromiumCdpOptions = {
20
27
  cdpAddress: string;
28
+ cdpTargetId?: string;
29
+ ignoreHttpErrors?: boolean;
21
30
  };
22
31
  export declare function launchChromium(options: LaunchChromiumStandaloneOptions): Promise<LaunchBrowserResult>;
23
32
  export declare function launchChromium(options: LaunchChromiumCdpOptions): Promise<LaunchBrowserResult>;
24
33
  export declare function getBrowserExecutablePath(): Promise<string | undefined>;
25
34
  export declare function launchBrowser(options: Omit<LaunchChromiumStandaloneOptions, "executablePath"> | LaunchChromiumCdpOptions): Promise<LaunchBrowserResult>;
26
35
  export declare function getLocalCdpAddress(port: number): string;
36
+ export declare function getCdpWebSocketUrl(cdpAddress: string): Promise<Result<string, string>>;
27
37
  export declare function getHeadlessUserAgent({ executablePath, args, ignoreDefaultArgs, }: {
28
38
  executablePath?: string;
29
39
  args?: string[];