@intuned/runtime-dev 1.3.21-fix.0 → 1.3.22-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/bin/intuned +20 -2
  3. package/dist/commands/api/run.js +1 -1
  4. package/dist/commands/auth-sessions/load.js +4 -1
  5. package/dist/commands/auth-sessions/run-check.js +26 -17
  6. package/dist/commands/auth-sessions/run-create.js +10 -3
  7. package/dist/commands/common/browserUtils.js +10 -1
  8. package/dist/common/env.d.ts +6 -0
  9. package/dist/common/env.js +17 -0
  10. package/dist/common/intunedJson.d.ts +5 -0
  11. package/dist/common/intunedJson.js +1 -0
  12. package/dist/common/launchBrowser.d.ts +7 -0
  13. package/dist/common/launchBrowser.js +34 -2
  14. package/dist/common/playwrightContext.d.ts +2 -0
  15. package/dist/common/playwrightContext.js +10 -4
  16. package/dist/common/runApi/index.js +2 -0
  17. package/dist/common/settingsSchema.d.ts +3 -0
  18. package/dist/common/settingsSchema.js +2 -1
  19. package/dist/vendor/runtime-interface.js +4 -2
  20. package/package.json +3 -3
  21. package/.claude/settings.local.json +0 -7
  22. package/dist/commands/intuned-cli/commands/attempt.command.d.ts +0 -1
  23. package/dist/commands/intuned-cli/commands/attempt.command.js +0 -8
  24. package/dist/commands/intuned-cli/commands/attempt_api.command.d.ts +0 -1
  25. package/dist/commands/intuned-cli/commands/attempt_api.command.js +0 -30
  26. package/dist/commands/intuned-cli/commands/attempt_authsession.command.d.ts +0 -1
  27. package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +0 -8
  28. package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.d.ts +0 -1
  29. package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +0 -19
  30. package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.d.ts +0 -1
  31. package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +0 -24
  32. package/dist/commands/intuned-cli/commands/authsession.command.d.ts +0 -1
  33. package/dist/commands/intuned-cli/commands/authsession.command.js +0 -8
  34. package/dist/commands/intuned-cli/commands/authsession_record.command.d.ts +0 -1
  35. package/dist/commands/intuned-cli/commands/authsession_record.command.js +0 -32
  36. package/dist/commands/intuned-cli/commands/authsession_scaffold.command.d.ts +0 -1
  37. package/dist/commands/intuned-cli/commands/authsession_scaffold.command.js +0 -16
  38. package/dist/commands/intuned-cli/commands/build.command.d.ts +0 -1
  39. package/dist/commands/intuned-cli/commands/build.command.js +0 -12
  40. package/dist/commands/intuned-cli/commands/command.d.ts +0 -2
  41. package/dist/commands/intuned-cli/commands/command.js +0 -9
  42. package/dist/commands/intuned-cli/commands/deploy.command.d.ts +0 -1
  43. package/dist/commands/intuned-cli/commands/deploy.command.js +0 -42
  44. package/dist/commands/intuned-cli/commands/index.d.ts +0 -18
  45. package/dist/commands/intuned-cli/commands/index.js +0 -203
  46. package/dist/commands/intuned-cli/commands/provision.command.d.ts +0 -13
  47. package/dist/commands/intuned-cli/commands/provision.command.js +0 -50
  48. package/dist/commands/intuned-cli/commands/run.command.d.ts +0 -1
  49. package/dist/commands/intuned-cli/commands/run.command.js +0 -8
  50. package/dist/commands/intuned-cli/commands/run_api.command.d.ts +0 -1
  51. package/dist/commands/intuned-cli/commands/run_api.command.js +0 -46
  52. package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +0 -35
  53. package/dist/commands/intuned-cli/commands/run_authsession.command.js +0 -17
  54. package/dist/commands/intuned-cli/commands/run_authsession_create.command.d.ts +0 -1
  55. package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +0 -35
  56. package/dist/commands/intuned-cli/commands/run_authsession_update.command.d.ts +0 -1
  57. package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +0 -35
  58. package/dist/commands/intuned-cli/commands/run_authsession_validate.command.d.ts +0 -1
  59. package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +0 -33
  60. package/dist/commands/intuned-cli/commands/types.d.ts +0 -39
  61. package/dist/commands/intuned-cli/commands/types.js +0 -33
  62. package/dist/commands/intuned-cli/constants/index.d.ts +0 -17
  63. package/dist/commands/intuned-cli/constants/index.js +0 -25
  64. package/dist/commands/intuned-cli/controller/__test__/api.test.js +0 -399
  65. package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +0 -1061
  66. package/dist/commands/intuned-cli/controller/api.d.ts +0 -42
  67. package/dist/commands/intuned-cli/controller/api.js +0 -194
  68. package/dist/commands/intuned-cli/controller/authSession.d.ts +0 -209
  69. package/dist/commands/intuned-cli/controller/authSession.js +0 -425
  70. package/dist/commands/intuned-cli/controller/build.d.ts +0 -1
  71. package/dist/commands/intuned-cli/controller/build.js +0 -35
  72. package/dist/commands/intuned-cli/controller/deploy.d.ts +0 -5
  73. package/dist/commands/intuned-cli/controller/deploy.js +0 -317
  74. package/dist/commands/intuned-cli/controller/index.d.ts +0 -1
  75. package/dist/commands/intuned-cli/controller/index.js +0 -45
  76. package/dist/commands/intuned-cli/controller/provision.d.ts +0 -21
  77. package/dist/commands/intuned-cli/controller/provision.js +0 -299
  78. package/dist/commands/intuned-cli/controller/scaffold.d.ts +0 -1
  79. package/dist/commands/intuned-cli/controller/scaffold.js +0 -77
  80. package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +0 -152
  81. package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +0 -41
  82. package/dist/commands/intuned-cli/helpers/api.d.ts +0 -3
  83. package/dist/commands/intuned-cli/helpers/api.js +0 -16
  84. package/dist/commands/intuned-cli/helpers/auth.d.ts +0 -46
  85. package/dist/commands/intuned-cli/helpers/auth.js +0 -147
  86. package/dist/commands/intuned-cli/helpers/backend.d.ts +0 -8
  87. package/dist/commands/intuned-cli/helpers/backend.js +0 -35
  88. package/dist/commands/intuned-cli/helpers/browser.d.ts +0 -14
  89. package/dist/commands/intuned-cli/helpers/browser.js +0 -93
  90. package/dist/commands/intuned-cli/helpers/context.d.ts +0 -3
  91. package/dist/commands/intuned-cli/helpers/context.js +0 -33
  92. package/dist/commands/intuned-cli/helpers/errors.d.ts +0 -16
  93. package/dist/commands/intuned-cli/helpers/errors.js +0 -44
  94. package/dist/commands/intuned-cli/helpers/index.d.ts +0 -12
  95. package/dist/commands/intuned-cli/helpers/index.js +0 -137
  96. package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +0 -40
  97. package/dist/commands/intuned-cli/helpers/intunedJson.js +0 -20
  98. package/dist/commands/intuned-cli/helpers/prompts.d.ts +0 -3
  99. package/dist/commands/intuned-cli/helpers/prompts.js +0 -71
  100. package/dist/commands/intuned-cli/helpers/proxy.d.ts +0 -5
  101. package/dist/commands/intuned-cli/helpers/proxy.js +0 -23
  102. package/dist/commands/intuned-cli/helpers/terminal.d.ts +0 -5
  103. package/dist/commands/intuned-cli/helpers/terminal.js +0 -13
  104. package/dist/commands/intuned-cli/helpers/timeout.d.ts +0 -1
  105. package/dist/commands/intuned-cli/helpers/timeout.js +0 -23
  106. package/dist/commands/intuned-cli/helpers/traces.d.ts +0 -2
  107. package/dist/commands/intuned-cli/helpers/traces.js +0 -32
  108. package/dist/commands/intuned-cli/helpers/validation.d.ts +0 -2
  109. package/dist/commands/intuned-cli/helpers/validation.js +0 -14
  110. package/dist/commands/intuned-cli/helpers/wrapper.d.ts +0 -2
  111. package/dist/commands/intuned-cli/helpers/wrapper.js +0 -76
  112. package/dist/commands/intuned-cli/index.d.ts +0 -1
  113. package/dist/commands/intuned-cli/index.js +0 -16
  114. package/dist/commands/intuned-cli/main.d.ts +0 -1
  115. package/dist/commands/intuned-cli/main.js +0 -35
  116. package/dist/commands/intuned-cli/types.d.ts +0 -70
  117. package/dist/commands/intuned-cli/types.js +0 -22
package/CHANGELOG.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # UNRELEASED
2
2
 
3
+ - Add support for `ignoreHttpErrors` parameter to handle HTTP errors during browser navigation. Can be configured via `IGNORE_HTTP_ERRORS` environment variable or `ignoreHttpErrors` field in Intuned.json config file.
3
4
  - Add `timeout` parameter (in seconds, defaults to 30) to `launchBrowser` and `launchChromium` functions
4
5
 
5
6
  # 1.3.11
package/bin/intuned CHANGED
@@ -1,4 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require("../dist/common/binStartupScript.js");
4
- require("../dist/commands/intuned-cli/main.js");
3
+ // detect `intunedctl` in PATH and run it with the provided arguments
4
+ const spawn = require("child_process").spawn;
5
+ const which = require("which");
6
+
7
+ const intunedctlPath = which.sync("intunedctl", { nothrow: true });
8
+
9
+ if (!intunedctlPath) {
10
+ console.error(
11
+ "Install Intuned CLI globally with `npm install -g @intuned/cli` to run this command."
12
+ );
13
+ process.exit(1);
14
+ }
15
+
16
+ const child = spawn(intunedctlPath, process.argv.slice(2), {
17
+ stdio: "inherit",
18
+ });
19
+
20
+ child.on("exit", (code) => {
21
+ process.exit(code ?? 0);
22
+ });
@@ -113,7 +113,7 @@ _commander.program.description("run the user function in the cli for testing pur
113
113
  runId: (0, _nanoid.nanoid)(),
114
114
  proxy: options.proxy,
115
115
  getAuthSessionParameters: authSessionParametersJson !== undefined ? async () => authSessionParametersJson : undefined
116
- }, async () => await executeCLI(apiName, mode, inputData, options));
116
+ }, () => executeCLI(apiName, mode, inputData, options));
117
117
  process.exit(0);
118
118
  });
119
119
  _commander.program.parse(process.argv);
@@ -6,6 +6,7 @@ var _playwrightContext = require("../../common/playwrightContext");
6
6
  var _settings = require("../common/utils/settings");
7
7
  var _dotenv = _interopRequireDefault(require("dotenv"));
8
8
  var _neverthrow = require("neverthrow");
9
+ var _launchBrowser = require("../../common/launchBrowser");
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
11
  _dotenv.default.config({
11
12
  path: `.env`
@@ -18,8 +19,10 @@ _commander.program.description("load AuthSession to browser").option("--cdpAddre
18
19
  if (!setting.authSessions.enabled) {
19
20
  throw new Error("Authentication required but not configured.\n" + "Enable AuthSessions in Intuned.json to use this feature.\n" + "See https://docs.intunedhq.com/docs/cli/auth-sessions for more information.");
20
21
  }
22
+ const ignoreHttpErrors = await (0, _launchBrowser.getIgnoreHttpErrorsFromConfig)();
21
23
  await (0, _playwrightContext.withPlaywrightContext)({
22
- cdpAddress
24
+ cdpAddress,
25
+ ignoreHttpErrors
23
26
  }, async context => {
24
27
  await (0, _playwrightContext.loadSessionToContext)({
25
28
  context,
@@ -14,12 +14,13 @@ var _enums = require("../../runtime/enums");
14
14
  var _nanoid = require("nanoid");
15
15
  var _asyncLocalStorage = require("../../common/asyncLocalStorage");
16
16
  var _isNil = _interopRequireDefault(require("lodash/isNil"));
17
+ var _launchBrowser = require("../../common/launchBrowser");
17
18
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
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); }
19
20
  _dotenv.default.config({
20
21
  path: `.env`
21
22
  });
22
- _commander.program.description("run AuthSession check").option("--cdpAddress <cdpAddress>", "CDP address", "http://localhost:9222").option("--authSessionPath <authSession>", "AuthSession to use when executing the check").option("--authSessionParameters <authSessionParameters>", "parameters used to create the used AuthSession").allowUnknownOption().addArgument(new _commander.Argument("<mode>", "mode of execution").choices(["vanilla", "playwright", "playwright-standalone"]).default("playwright-standalone").argOptional()).action(async (mode, {
23
+ _commander.program.description("run AuthSession check").option("--cdpAddress <cdpAddress>", "CDP address").option("--authSessionPath <authSession>", "AuthSession to use when executing the check").option("--authSessionParameters <authSessionParameters>", "parameters used to create the used AuthSession").allowUnknownOption().addArgument(new _commander.Argument("<mode>", "mode of execution").choices(["vanilla", "playwright", "playwright-standalone"]).default("playwright-standalone").argOptional()).action(async (mode, {
23
24
  cdpAddress,
24
25
  authSessionPath,
25
26
  authSessionParameters
@@ -41,22 +42,30 @@ _commander.program.description("run AuthSession check").option("--cdpAddress <cd
41
42
  extendedPayloads: [],
42
43
  runId: (0, _nanoid.nanoid)(),
43
44
  getAuthSessionParameters: authSessionParametersJson !== undefined ? async () => authSessionParametersJson : undefined
44
- }, async () => await (0, _runApi.runApi)({
45
- automationFunction: {
46
- name: `${_constants.AUTH_SESSIONS_FOLDER_NAME}/check`
47
- },
48
- runOptions: {
49
- environment: "cdp",
50
- cdpAddress
51
- },
52
- auth: {
53
- session: {
54
- type: "file",
55
- path: authSessionPath
56
- }
57
- },
58
- importFunction: _tsNodeImport.tsNodeImport
59
- }));
45
+ }, async () => {
46
+ const ignoreHttpErrors = await (0, _launchBrowser.getIgnoreHttpErrorsFromConfig)();
47
+ return await (0, _runApi.runApi)({
48
+ automationFunction: {
49
+ name: `${_constants.AUTH_SESSIONS_FOLDER_NAME}/check`
50
+ },
51
+ runOptions: cdpAddress !== undefined ? {
52
+ environment: "cdp",
53
+ cdpAddress,
54
+ ignoreHttpErrors
55
+ } : {
56
+ environment: "standalone",
57
+ headless: mode !== "playwright",
58
+ ignoreHttpErrors
59
+ },
60
+ auth: {
61
+ session: {
62
+ type: "file",
63
+ path: authSessionPath
64
+ }
65
+ },
66
+ importFunction: _tsNodeImport.tsNodeImport
67
+ });
68
+ });
60
69
  if (runApiResult.isErr()) {
61
70
  if (runApiResult.error instanceof _runtimeInterface.AutomationError) {
62
71
  throw runApiResult.error.error;
@@ -13,12 +13,13 @@ var _asyncLocalStorage = require("../../common/asyncLocalStorage");
13
13
  var _nanoid = require("nanoid");
14
14
  var _enums = require("../../runtime/enums");
15
15
  var _tsNodeImport = require("../common/tsNodeImport");
16
+ var _launchBrowser = require("../../common/launchBrowser");
16
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
18
  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); }
18
19
  _dotenv.default.config({
19
20
  path: `.env`
20
21
  });
21
- _commander.program.description("run AuthSession create").option("--cdpAddress <cdpAddress>", "CDP address", "http://localhost:9222").option("-i, --input [file]", "input json file").option("-j, --json [json]", "input json string").option("--authSessionPath <authSession>", "AuthSession to use when executing the api").option("--pathToSave <pathToSave>", "path to save the AuthSession, if not provided, will discard the AuthSession").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 AuthSession create").option("--cdpAddress <cdpAddress>", "CDP address").option("-i, --input [file]", "input json file").option("-j, --json [json]", "input json string").option("--authSessionPath <authSession>", "AuthSession to use when executing the api").option("--pathToSave <pathToSave>", "path to save the AuthSession, if not provided, will discard the AuthSession").allowUnknownOption().addArgument(new _commander.Argument("<mode>", "mode of execution").choices(["vanilla", "playwright", "playwright-standalone"]).default("playwright-standalone").argOptional()).action(async (mode, {
22
23
  cdpAddress,
23
24
  pathToSave,
24
25
  input,
@@ -41,14 +42,20 @@ _commander.program.description("run AuthSession create").option("--cdpAddress <c
41
42
  throw new Error("AuthSession create file not found");
42
43
  }
43
44
  async function runCreate() {
45
+ const ignoreHttpErrors = await (0, _launchBrowser.getIgnoreHttpErrorsFromConfig)();
44
46
  const result = await (0, _runApi.runApi)({
45
47
  automationFunction: {
46
48
  name: `${_constants.AUTH_SESSIONS_FOLDER_NAME}/create`,
47
49
  params: inputData
48
50
  },
49
- runOptions: {
51
+ runOptions: cdpAddress !== undefined ? {
50
52
  environment: "cdp",
51
- cdpAddress
53
+ cdpAddress,
54
+ ignoreHttpErrors
55
+ } : {
56
+ environment: "standalone",
57
+ headless: mode !== "playwright",
58
+ ignoreHttpErrors
52
59
  },
53
60
  retrieveSession: true,
54
61
  importFunction: _tsNodeImport.tsNodeImport
@@ -15,7 +15,16 @@ var _contextStorageStateHelpers = require("../../common/contextStorageStateHelpe
15
15
  var playwright = _interopRequireWildcard(require("playwright"));
16
16
  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); }
17
17
  const REMOTE_DEBUGGING_PORT = exports.REMOTE_DEBUGGING_PORT = 9222;
18
- const getChromiumLaunchArgs = () => ["--no-sandbox", `--remote-debugging-port=${REMOTE_DEBUGGING_PORT}`, `--user-data-dir=/tmp/${Date.now()}`, "--new-window", "--start-maximized", "--disable-popup-blocking"];
18
+ function getMacKeychainBypassArgs() {
19
+ if (process.platform !== "darwin") {
20
+ return [];
21
+ }
22
+ if (process.env.INTUNED_MAC_DISABLE_KEYCHAIN_PROMPTS === "0") {
23
+ return [];
24
+ }
25
+ return ["--use-mock-keychain", "--password-store=basic"];
26
+ }
27
+ const getChromiumLaunchArgs = () => ["--no-sandbox", `--remote-debugging-port=${REMOTE_DEBUGGING_PORT}`, `--user-data-dir=/tmp/${Date.now()}`, "--new-window", "--start-maximized", "--disable-popup-blocking", ...getMacKeychainBypassArgs()];
19
28
  exports.getChromiumLaunchArgs = getChromiumLaunchArgs;
20
29
  async function getBrowser() {
21
30
  let playwrightBrowser = null;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Environment configuration module
3
+ * Simple functions to read environment variables
4
+ */
5
+ export declare function getBrowserType(): string | undefined;
6
+ export declare function getIgnoreHttpErrors(): boolean | undefined;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getBrowserType = getBrowserType;
7
+ exports.getIgnoreHttpErrors = getIgnoreHttpErrors;
8
+ function getBrowserType() {
9
+ return process.env.BROWSER_TYPE;
10
+ }
11
+ function getIgnoreHttpErrors() {
12
+ const envValue = process.env.IGNORE_HTTP_ERRORS;
13
+ if (envValue === undefined) {
14
+ return undefined;
15
+ }
16
+ return envValue.toLowerCase() === "true" || envValue === "1" || envValue.toLowerCase() === "yes";
17
+ }
@@ -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>>>;
@@ -29,6 +30,7 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
29
30
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
30
31
  projectName: z.ZodOptional<z.ZodString>;
31
32
  workspaceId: z.ZodOptional<z.ZodString>;
33
+ ignoreHttpErrors: z.ZodOptional<z.ZodBoolean>;
32
34
  metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
33
35
  defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
34
36
  defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
@@ -55,6 +57,7 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
55
57
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
56
58
  projectName: z.ZodOptional<z.ZodString>;
57
59
  workspaceId: z.ZodOptional<z.ZodString>;
60
+ ignoreHttpErrors: z.ZodOptional<z.ZodBoolean>;
58
61
  metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
59
62
  defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
60
63
  defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
@@ -169,6 +172,7 @@ export declare function loadIntunedJson(): Promise<Err<never, string> | Ok<{
169
172
  type: "intunedBrowser" | "patchright";
170
173
  enabled: boolean;
171
174
  } | undefined;
175
+ ignoreHttpErrors?: boolean | undefined;
172
176
  workspaceId?: string | undefined;
173
177
  projectName?: string | undefined;
174
178
  metadata?: {
@@ -209,6 +213,7 @@ export declare function loadIntunedJsonSync(): Err<never, string> | Ok<{
209
213
  type: "intunedBrowser" | "patchright";
210
214
  enabled: boolean;
211
215
  } | undefined;
216
+ ignoreHttpErrors?: boolean | undefined;
212
217
  workspaceId?: string | undefined;
213
218
  projectName?: string | undefined;
214
219
  metadata?: {
@@ -23,6 +23,7 @@ const playwright = undefined;
23
23
  const intunedJsonSchema = exports.intunedJsonSchema = _zod.z.object({
24
24
  projectName: _zod.z.string().optional(),
25
25
  workspaceId: _zod.z.string().optional(),
26
+ ignoreHttpErrors: _zod.z.boolean().optional(),
26
27
  metadata: _zod.z.object({
27
28
  defaultJobInput: _zod.z.record(_zod.z.any()).optional().catch(undefined),
28
29
  defaultRunPlaygroundInput: _zod.z.record(_zod.z.any()).optional().catch(undefined),
@@ -5,6 +5,11 @@ export interface Proxy {
5
5
  username: string;
6
6
  password: string;
7
7
  }
8
+ /**
9
+ * Get ignore_http_errors setting from CLI option, Intuned.json, or environment variable.
10
+ * Priority: cliOption > Intuned.json > environment variable > false
11
+ */
12
+ export declare function getIgnoreHttpErrorsFromConfig(cliOption?: boolean): Promise<boolean>;
8
13
  export type LaunchBrowserResult = {
9
14
  page: playwright.Page;
10
15
  context: playwright.BrowserContext;
@@ -16,11 +21,13 @@ export type LaunchChromiumStandaloneOptions = {
16
21
  cdpPort?: number;
17
22
  appModeInitialUrl?: string;
18
23
  executablePath?: string;
24
+ ignoreHttpErrors?: boolean;
19
25
  timeout?: number;
20
26
  };
21
27
  export type LaunchChromiumCdpOptions = {
22
28
  cdpAddress: string;
23
29
  cdpTargetId?: string;
30
+ ignoreHttpErrors?: boolean;
24
31
  timeout?: number;
25
32
  };
26
33
  export declare function launchChromium(options: LaunchChromiumStandaloneOptions): Promise<LaunchBrowserResult>;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getBrowserExecutablePath = getBrowserExecutablePath;
7
7
  exports.getCdpWebSocketUrl = getCdpWebSocketUrl;
8
8
  exports.getHeadlessUserAgent = getHeadlessUserAgent;
9
+ exports.getIgnoreHttpErrorsFromConfig = getIgnoreHttpErrorsFromConfig;
9
10
  exports.getLocalCdpAddress = getLocalCdpAddress;
10
11
  exports.launchBrowser = launchBrowser;
11
12
  exports.launchChromium = launchChromium;
@@ -24,6 +25,15 @@ var _intunedJson = require("./intunedJson");
24
25
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
25
26
  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); }
26
27
  const execAsync = (0, _util.promisify)(_child_process.exec);
28
+ function getMacKeychainBypassArgs() {
29
+ if (process.platform !== "darwin") {
30
+ return [];
31
+ }
32
+ if (process.env.INTUNED_MAC_DISABLE_KEYCHAIN_PROMPTS === "0") {
33
+ return [];
34
+ }
35
+ return ["--use-mock-keychain", "--password-store=basic"];
36
+ }
27
37
  async function createUserDirWithPreferences() {
28
38
  const playwrightTempDir = await (0, _fsExtra.mkdtemp)("/tmp/pw-");
29
39
  const userDir = (0, _path.join)(playwrightTempDir, "userdir");
@@ -39,6 +49,22 @@ async function createUserDirWithPreferences() {
39
49
  await (0, _fsExtra.writeFile)((0, _path.join)(defaultDir, "Preferences"), JSON.stringify(preferences));
40
50
  return userDir;
41
51
  }
52
+ async function getIgnoreHttpErrorsFromConfig(cliOption) {
53
+ if (cliOption !== undefined) {
54
+ return cliOption;
55
+ }
56
+ try {
57
+ const intunedJsonResult = await (0, _intunedJson.loadIntunedJson)();
58
+ if (intunedJsonResult.isOk() && intunedJsonResult.value.ignoreHttpErrors !== undefined) {
59
+ return intunedJsonResult.value.ignoreHttpErrors;
60
+ }
61
+ } catch (error) {}
62
+ const envValue = process.env.IGNORE_HTTP_ERRORS;
63
+ if (envValue !== undefined) {
64
+ return envValue.toLowerCase() === "true" || envValue === "1" || envValue.toLowerCase() === "yes";
65
+ }
66
+ return false;
67
+ }
42
68
  async function launchChromium(options) {
43
69
  if ("cdpAddress" in options) {
44
70
  if (await (0, _extensionsHelpers.isIntunedExtensionEnabled)()) {
@@ -80,13 +106,17 @@ async function launchChromium(options) {
80
106
  cdpPort,
81
107
  proxy,
82
108
  downloadsPath,
109
+ ignoreHttpErrors: ignoreHttpErrorsParam,
83
110
  timeout
84
111
  } = options;
85
112
  let {
86
113
  executablePath
87
114
  } = options;
115
+ const ignoreHttpErrors = await getIgnoreHttpErrorsFromConfig(ignoreHttpErrorsParam);
88
116
  const defaultArgsToIgnore = ["--disable-extensions", "--disable-component-extensions-with-background-pages", "--disable-background-networking", "--disable-backgrounding-occluded-windows", "--disable-background-timer-throttling"];
89
117
  const extraArgs = [];
118
+ const macKeychainBypassArgs = getMacKeychainBypassArgs();
119
+ extraArgs.push(...macKeychainBypassArgs);
90
120
  const stealthConfig = await (0, _intunedJson.getStealthModeConfig)();
91
121
  if (stealthConfig.enabled && stealthConfig.type === "intunedBrowser") {
92
122
  extraArgs.push("--stealth-mode");
@@ -126,7 +156,8 @@ async function launchChromium(options) {
126
156
  }
127
157
  const viewport = null;
128
158
  const userAgent = process.env.__PLAYWRIGHT_USER_AGENT_OVERRIDE ?? (await getHeadlessUserAgent({
129
- executablePath
159
+ executablePath,
160
+ args: macKeychainBypassArgs
130
161
  }));
131
162
  const context = await playwright.chromium.launchPersistentContext(userDataDir, {
132
163
  userAgent,
@@ -136,7 +167,8 @@ async function launchChromium(options) {
136
167
  proxy,
137
168
  downloadsPath,
138
169
  args: extraArgs,
139
- ignoreDefaultArgs: defaultArgsToIgnore
170
+ ignoreDefaultArgs: defaultArgsToIgnore,
171
+ ignoreHTTPSErrors: ignoreHttpErrors
140
172
  });
141
173
  if (timeout !== undefined) {
142
174
  context.setDefaultTimeout(timeout * 1000);
@@ -17,10 +17,12 @@ export declare function withPlaywrightContext<R>(options: {
17
17
  proxy?: Proxy;
18
18
  headless: boolean;
19
19
  downloadsPath: string;
20
+ ignoreHttpErrors?: boolean;
20
21
  } & WithPlaywrightContextParameters, fn: WithPlaywrightContextWrappedFunction<R>): Promise<Ok<R, any> | Err<any, RunAutomationError>>;
21
22
  export declare function withPlaywrightContext<R>(options: {
22
23
  cdpAddress: string;
23
24
  cdpTargetId?: string;
25
+ ignoreHttpErrors?: boolean;
24
26
  } & WithPlaywrightContextParameters, fn: WithPlaywrightContextWrappedFunction<R>): Promise<Ok<R, any> | Err<any, RunAutomationError>>;
25
27
  export declare function loadSessionToContext({ context, session, }: {
26
28
  context: playwright.BrowserContext;
@@ -20,6 +20,7 @@ async function withPlaywrightContext({
20
20
  proxy,
21
21
  headless = true,
22
22
  downloadsPath,
23
+ ignoreHttpErrors: cliIgnoreHttpErrors,
23
24
  importFunction,
24
25
  apiName,
25
26
  apiParameters
@@ -27,6 +28,7 @@ async function withPlaywrightContext({
27
28
  let context;
28
29
  let page;
29
30
  try {
31
+ const ignoreHttpErrors = await (0, _launchBrowser.getIgnoreHttpErrorsFromConfig)(cliIgnoreHttpErrors);
30
32
  const setupContextHookResult = importFunction ? await (0, _setupContextHook.loadSetupContextHook)({
31
33
  importFunction
32
34
  }) : (0, _neverthrow.ok)(null);
@@ -41,7 +43,8 @@ async function withPlaywrightContext({
41
43
  context
42
44
  } = await (0, _launchBrowser.launchBrowser)({
43
45
  cdpAddress,
44
- cdpTargetId
46
+ cdpTargetId,
47
+ ignoreHttpErrors
45
48
  }));
46
49
  } else {
47
50
  ({
@@ -50,7 +53,8 @@ async function withPlaywrightContext({
50
53
  } = await (0, _launchBrowser.launchBrowser)({
51
54
  proxy,
52
55
  headless,
53
- downloadsPath
56
+ downloadsPath,
57
+ ignoreHttpErrors
54
58
  }));
55
59
  }
56
60
  return await fn(context, page);
@@ -63,7 +67,8 @@ async function withPlaywrightContext({
63
67
  page
64
68
  } = await (0, _launchBrowser.launchBrowser)({
65
69
  cdpAddress,
66
- cdpTargetId
70
+ cdpTargetId,
71
+ ignoreHttpErrors
67
72
  }));
68
73
  } else {
69
74
  const port = await (0, _portfinder.getPort)({
@@ -76,7 +81,8 @@ async function withPlaywrightContext({
76
81
  proxy,
77
82
  headless,
78
83
  downloadsPath,
79
- cdpPort: port
84
+ cdpPort: port,
85
+ ignoreHttpErrors
80
86
  }));
81
87
  hookCdpUrl = (0, _launchBrowser.getLocalCdpAddress)(port);
82
88
  }
@@ -147,6 +147,7 @@ async function runApi({
147
147
  headless: runOptions.headless,
148
148
  proxy: runOptions.proxy,
149
149
  downloadsPath,
150
+ ignoreHttpErrors: runOptions.ignoreHttpErrors,
150
151
  ...playwrightContextParameters
151
152
  }, runAutomationWithContext);
152
153
  } finally {
@@ -156,6 +157,7 @@ async function runApi({
156
157
  return await (0, _playwrightContext.withPlaywrightContext)({
157
158
  cdpAddress: runOptions.cdpAddress,
158
159
  cdpTargetId: runOptions.cdpTargetId,
160
+ ignoreHttpErrors: runOptions.ignoreHttpErrors,
159
161
  ...playwrightContextParameters
160
162
  }, runAutomationWithContext);
161
163
  }
@@ -427,6 +427,7 @@ export declare const settingsSchema: z.ZodObject<{
427
427
  timeout?: number | undefined;
428
428
  } | undefined;
429
429
  }>>>;
430
+ ignoreHttpErrors: z.ZodOptional<z.ZodBoolean>;
430
431
  }, "strip", z.ZodTypeAny, {
431
432
  authSessions: {
432
433
  enabled: boolean;
@@ -480,6 +481,7 @@ export declare const settingsSchema: z.ZodObject<{
480
481
  labelLocators: string[];
481
482
  } | undefined;
482
483
  } | undefined;
484
+ ignoreHttpErrors?: boolean | undefined;
483
485
  }, {
484
486
  authSessions?: {
485
487
  enabled: boolean;
@@ -533,5 +535,6 @@ export declare const settingsSchema: z.ZodObject<{
533
535
  timeout?: number | undefined;
534
536
  } | undefined;
535
537
  } | undefined;
538
+ ignoreHttpErrors?: boolean | undefined;
536
539
  }>;
537
540
  export type IntunedSettings = z.infer<typeof settingsSchema>;
@@ -53,5 +53,6 @@ const stealthModeSchema = z.object({
53
53
  const settingsSchema = exports.settingsSchema = z.object({
54
54
  authSessions: authSessionsSchema,
55
55
  stealthMode: stealthModeSchema,
56
- captchaSolver: captchaSolverSettingsSchema.optional()
56
+ captchaSolver: captchaSolverSettingsSchema.optional(),
57
+ ignoreHttpErrors: z.boolean().optional()
57
58
  });
@@ -222,12 +222,14 @@ var require_types = __commonJS({
222
222
  server: zod_1.default.string(),
223
223
  username: zod_1.default.string(),
224
224
  password: zod_1.default.string()
225
- }).optional()
225
+ }).optional(),
226
+ ignoreHttpErrors: zod_1.default.boolean().optional()
226
227
  });
227
228
  exports2.runApiCdpRunOptionsSchema = zod_1.default.object({
228
229
  environment: zod_1.default.literal("cdp"),
229
230
  cdpAddress: zod_1.default.string(),
230
- cdpTargetId: zod_1.default.string().optional()
231
+ cdpTargetId: zod_1.default.string().optional(),
232
+ ignoreHttpErrors: zod_1.default.boolean().optional()
231
233
  });
232
234
  exports2.runApiRunOptionsSchema = zod_1.default.discriminatedUnion("environment", [
233
235
  exports2.runApiStandaloneRunOptionsSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.3.21-fix.0",
3
+ "version": "1.3.22-dev.0",
4
4
  "description": "Intuned runtime",
5
5
  "packageManager": "yarn@4.12.0",
6
6
  "main": "./dist/index.js",
@@ -33,7 +33,6 @@
33
33
  "intuned-auth-session-create": "vite-node ./src/commands/auth/run-create.ts",
34
34
  "intuned-auth-session-load": "vite-node ./src/commands/auth/load.ts",
35
35
  "intuned-ts-check": "yarn prepublishOnly && vite-node ./src/commands/ts-check.ts",
36
- "intuned": "vite-node ./src/commands/intuned-cli/main.ts",
37
36
  "intuned-get-headless-user-agent": "vite-node ./src/commands/get-headless-user-agent.ts",
38
37
  "build": "rm -rf dist && tsc -p tsconfig.json && yarn copy-dts && babel src --out-dir dist --extensions '.ts' && tsup && cp -r ./src/common/assets dist/common/assets",
39
38
  "test": "vitest run",
@@ -90,7 +89,7 @@
90
89
  "prettier": "2.8.0",
91
90
  "promptly": "3.2.0",
92
91
  "prompts": "^2.4.2",
93
- "rollup": "3.26.2",
92
+ "rollup": "3.30.0",
94
93
  "smol-toml": "^1.4.2",
95
94
  "source-map": "0.7.4",
96
95
  "terminal-kit": "^3.1.2",
@@ -101,6 +100,7 @@
101
100
  "typescript": "5.1.6",
102
101
  "uuid": "11.1.0",
103
102
  "wait-on": "7.2.0",
103
+ "which": "^6.0.1",
104
104
  "yaml": "2.8.1",
105
105
  "zod": "^3.21.4"
106
106
  },
@@ -1,7 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(npm info:*)"
5
- ]
6
- }
7
- }
@@ -1 +0,0 @@
1
- export declare const attemptCommand: import("commander").Command;
@@ -1,8 +0,0 @@
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");
@@ -1 +0,0 @@
1
- export declare const attemptApiCommand: import("commander").Command;
@@ -1,30 +0,0 @@
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 argsSchema = _zod.z.tuple([_zod.z.string().min(1, "API name is required"), _zod.z.string().min(1, "Parameters are required")]);
14
- const optionsSchema = _types.baseCommandOptionsSchema.extend({
15
- authSession: _zod.z.string().optional(),
16
- outputFile: _zod.z.string().optional()
17
- });
18
- const attemptApiCommand = exports.attemptApiCommand = (0, _types.withBaseOptions)(_attempt.attemptCommand.command("api").description("Execute an Intuned API attempt with parameters").argument("<api-name>", "Name of the API to run").argument("<parameters>", "Path to the JSON file containing API parameters OR the parameters as a JSON string").option("-a, --auth-session <id>", "ID of the AuthSession to use for the API. This is expected to be in ./auth-sessions-instances/<id>.json").option("-o, --output-file <path>", "output file path")).action((0, _helpers.cliCommandWrapper)(argsSchema, optionsSchema, async ([apiName, parameters], {
19
- authSession,
20
- ...rest
21
- }) => {
22
- await (0, _helpers.assertAuthConsistent)(authSession);
23
- const parametersData = await (0, _controller.loadParameters)(parameters);
24
- await (0, _api.executeAttemptApiCLI)({
25
- apiName,
26
- inputData: parametersData,
27
- authSessionId: authSession,
28
- ...rest
29
- });
30
- }));
@@ -1 +0,0 @@
1
- export declare const attemptAuthSessionCommand: import("commander").Command;
@@ -1,8 +0,0 @@
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 AuthSessions");
@@ -1 +0,0 @@
1
- export declare const attemptAuthSessionCheckCommand: import("commander").Command;
@@ -1,19 +0,0 @@
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 argsSchema = _zod.z.tuple([_zod.z.string().min(1, "ID of the AuthSession is required")]);
13
- const attemptAuthSessionCheckCommand = exports.attemptAuthSessionCheckCommand = (0, _types.withBaseOptions)(_attempt_authsession.attemptAuthSessionCommand.command("check").description("Check an existing AuthSession").argument("<id>", "ID of the AuthSession to check")).action((0, _helpers.cliCommandWrapper)(argsSchema, _types.baseCommandOptionsSchema, async ([id], options) => {
14
- await (0, _helpers.assertAuthEnabled)();
15
- await (0, _authSession.executeAttemptCheckAuthSessionCLI)({
16
- id,
17
- ...options
18
- });
19
- }));
@@ -1 +0,0 @@
1
- export declare const attemptAuthSessionCreateCommand: import("commander").Command;