@intuned/runtime-dev 1.3.22-dev.0 → 1.3.22-dev.5

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.
package/CHANGELOG.md CHANGED
@@ -1,6 +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
+ - Add support for `ignoreHttpErrors` parameter to handle HTTP errors during browser navigation via `INTUNED_PLAYWRIGHT_CONTEXT_IGNORE_HTTP_ERRORS` environment variable.
4
4
  - Add `timeout` parameter (in seconds, defaults to 30) to `launchBrowser` and `launchChromium` functions
5
5
 
6
6
  # 1.3.11
@@ -6,7 +6,6 @@ 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");
10
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
10
  _dotenv.default.config({
12
11
  path: `.env`
@@ -19,10 +18,8 @@ _commander.program.description("load AuthSession to browser").option("--cdpAddre
19
18
  if (!setting.authSessions.enabled) {
20
19
  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.");
21
20
  }
22
- const ignoreHttpErrors = await (0, _launchBrowser.getIgnoreHttpErrorsFromConfig)();
23
21
  await (0, _playwrightContext.withPlaywrightContext)({
24
- cdpAddress,
25
- ignoreHttpErrors
22
+ cdpAddress
26
23
  }, async context => {
27
24
  await (0, _playwrightContext.loadSessionToContext)({
28
25
  context,
@@ -14,13 +14,12 @@ 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");
18
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
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); }
20
19
  _dotenv.default.config({
21
20
  path: `.env`
22
21
  });
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, {
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, {
24
23
  cdpAddress,
25
24
  authSessionPath,
26
25
  authSessionParameters
@@ -42,30 +41,22 @@ _commander.program.description("run AuthSession check").option("--cdpAddress <cd
42
41
  extendedPayloads: [],
43
42
  runId: (0, _nanoid.nanoid)(),
44
43
  getAuthSessionParameters: authSessionParametersJson !== undefined ? async () => authSessionParametersJson : undefined
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
- });
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
+ }));
69
60
  if (runApiResult.isErr()) {
70
61
  if (runApiResult.error instanceof _runtimeInterface.AutomationError) {
71
62
  throw runApiResult.error.error;
@@ -13,13 +13,12 @@ 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");
17
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
17
  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
18
  _dotenv.default.config({
20
19
  path: `.env`
21
20
  });
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, {
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, {
23
22
  cdpAddress,
24
23
  pathToSave,
25
24
  input,
@@ -42,20 +41,14 @@ _commander.program.description("run AuthSession create").option("--cdpAddress <c
42
41
  throw new Error("AuthSession create file not found");
43
42
  }
44
43
  async function runCreate() {
45
- const ignoreHttpErrors = await (0, _launchBrowser.getIgnoreHttpErrorsFromConfig)();
46
44
  const result = await (0, _runApi.runApi)({
47
45
  automationFunction: {
48
46
  name: `${_constants.AUTH_SESSIONS_FOLDER_NAME}/create`,
49
47
  params: inputData
50
48
  },
51
- runOptions: cdpAddress !== undefined ? {
49
+ runOptions: {
52
50
  environment: "cdp",
53
- cdpAddress,
54
- ignoreHttpErrors
55
- } : {
56
- environment: "standalone",
57
- headless: mode !== "playwright",
58
- ignoreHttpErrors
51
+ cdpAddress
59
52
  },
60
53
  retrieveSession: true,
61
54
  importFunction: _tsNodeImport.tsNodeImport
@@ -3,7 +3,6 @@ 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>;
7
6
  metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
8
7
  defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
9
8
  defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
@@ -30,7 +29,6 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
30
29
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
31
30
  projectName: z.ZodOptional<z.ZodString>;
32
31
  workspaceId: z.ZodOptional<z.ZodString>;
33
- ignoreHttpErrors: z.ZodOptional<z.ZodBoolean>;
34
32
  metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
35
33
  defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
36
34
  defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
@@ -57,7 +55,6 @@ export declare const intunedJsonSchema: z.ZodIntersection<z.ZodObject<{
57
55
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
58
56
  projectName: z.ZodOptional<z.ZodString>;
59
57
  workspaceId: z.ZodOptional<z.ZodString>;
60
- ignoreHttpErrors: z.ZodOptional<z.ZodBoolean>;
61
58
  metadata: z.ZodCatch<z.ZodOptional<z.ZodObject<{
62
59
  defaultJobInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
63
60
  defaultRunPlaygroundInput: z.ZodCatch<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
@@ -172,7 +169,6 @@ export declare function loadIntunedJson(): Promise<Err<never, string> | Ok<{
172
169
  type: "intunedBrowser" | "patchright";
173
170
  enabled: boolean;
174
171
  } | undefined;
175
- ignoreHttpErrors?: boolean | undefined;
176
172
  workspaceId?: string | undefined;
177
173
  projectName?: string | undefined;
178
174
  metadata?: {
@@ -213,7 +209,6 @@ export declare function loadIntunedJsonSync(): Err<never, string> | Ok<{
213
209
  type: "intunedBrowser" | "patchright";
214
210
  enabled: boolean;
215
211
  } | undefined;
216
- ignoreHttpErrors?: boolean | undefined;
217
212
  workspaceId?: string | undefined;
218
213
  projectName?: string | undefined;
219
214
  metadata?: {
@@ -23,7 +23,6 @@ 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(),
27
26
  metadata: _zod.z.object({
28
27
  defaultJobInput: _zod.z.record(_zod.z.any()).optional().catch(undefined),
29
28
  defaultRunPlaygroundInput: _zod.z.record(_zod.z.any()).optional().catch(undefined),
@@ -6,8 +6,8 @@ export interface Proxy {
6
6
  password: string;
7
7
  }
8
8
  /**
9
- * Get ignore_http_errors setting from CLI option, Intuned.json, or environment variable.
10
- * Priority: cliOption > Intuned.json > environment variable > false
9
+ * Get ignore_http_errors setting from CLI option or environment variable.
10
+ * Priority: cliOption > environment variable > false
11
11
  */
12
12
  export declare function getIgnoreHttpErrorsFromConfig(cliOption?: boolean): Promise<boolean>;
13
13
  export type LaunchBrowserResult = {
@@ -51,22 +51,21 @@ async function createUserDirWithPreferences() {
51
51
  }
52
52
  async function getIgnoreHttpErrorsFromConfig(cliOption) {
53
53
  if (cliOption !== undefined) {
54
+ console.log(`[ignore_http_errors] using cli option value: ${cliOption}`);
54
55
  return cliOption;
55
56
  }
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;
57
+ const envValue = process.env.INTUNED_PLAYWRIGHT_CONTEXT_IGNORE_HTTP_ERRORS;
63
58
  if (envValue !== undefined) {
64
- return envValue.toLowerCase() === "true" || envValue === "1" || envValue.toLowerCase() === "yes";
59
+ const parsedValue = envValue.toLowerCase() === "true" || envValue === "1" || envValue.toLowerCase() === "yes";
60
+ console.log(`[ignore_http_errors] using env value: ${parsedValue}`);
61
+ return parsedValue;
65
62
  }
63
+ console.log("[ignore_http_errors] env not set, using default: false");
66
64
  return false;
67
65
  }
68
66
  async function launchChromium(options) {
69
67
  if ("cdpAddress" in options) {
68
+ console.log(`[ignore_http_errors] launchChromium (cdp) received value: ${options.ignoreHttpErrors}`);
70
69
  if (await (0, _extensionsHelpers.isIntunedExtensionEnabled)()) {
71
70
  await (0, _intunedExtensionServer.setupIntunedExtensionServer)();
72
71
  }
@@ -113,6 +112,7 @@ async function launchChromium(options) {
113
112
  executablePath
114
113
  } = options;
115
114
  const ignoreHttpErrors = await getIgnoreHttpErrorsFromConfig(ignoreHttpErrorsParam);
115
+ console.log(`[ignore_http_errors] launchChromium resolved value: ${ignoreHttpErrors}`);
116
116
  const defaultArgsToIgnore = ["--disable-extensions", "--disable-component-extensions-with-background-pages", "--disable-background-networking", "--disable-backgrounding-occluded-windows", "--disable-background-timer-throttling"];
117
117
  const extraArgs = [];
118
118
  const macKeychainBypassArgs = getMacKeychainBypassArgs();
@@ -427,7 +427,6 @@ export declare const settingsSchema: z.ZodObject<{
427
427
  timeout?: number | undefined;
428
428
  } | undefined;
429
429
  }>>>;
430
- ignoreHttpErrors: z.ZodOptional<z.ZodBoolean>;
431
430
  }, "strip", z.ZodTypeAny, {
432
431
  authSessions: {
433
432
  enabled: boolean;
@@ -481,7 +480,6 @@ export declare const settingsSchema: z.ZodObject<{
481
480
  labelLocators: string[];
482
481
  } | undefined;
483
482
  } | undefined;
484
- ignoreHttpErrors?: boolean | undefined;
485
483
  }, {
486
484
  authSessions?: {
487
485
  enabled: boolean;
@@ -535,6 +533,5 @@ export declare const settingsSchema: z.ZodObject<{
535
533
  timeout?: number | undefined;
536
534
  } | undefined;
537
535
  } | undefined;
538
- ignoreHttpErrors?: boolean | undefined;
539
536
  }>;
540
537
  export type IntunedSettings = z.infer<typeof settingsSchema>;
@@ -53,6 +53,5 @@ const stealthModeSchema = z.object({
53
53
  const settingsSchema = exports.settingsSchema = z.object({
54
54
  authSessions: authSessionsSchema,
55
55
  stealthMode: stealthModeSchema,
56
- captchaSolver: captchaSolverSettingsSchema.optional(),
57
- ignoreHttpErrors: z.boolean().optional()
56
+ captchaSolver: captchaSolverSettingsSchema.optional()
58
57
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.3.22-dev.0",
3
+ "version": "1.3.22-dev.5",
4
4
  "description": "Intuned runtime",
5
5
  "packageManager": "yarn@4.12.0",
6
6
  "main": "./dist/index.js",
@@ -1,6 +0,0 @@
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;
@@ -1,17 +0,0 @@
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
- }