@intuned/runtime-dev 1.3.19-new-cli.0 → 1.3.21-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.
- package/CHANGELOG.md +1 -0
- package/dist/commands/auth-sessions/load.js +4 -1
- package/dist/commands/auth-sessions/run-check.js +26 -17
- package/dist/commands/auth-sessions/run-create.js +10 -3
- package/dist/commands/common/browserUtils.js +10 -1
- package/dist/common/env.d.ts +6 -0
- package/dist/common/env.js +17 -0
- package/dist/common/intunedJson.d.ts +5 -0
- package/dist/common/intunedJson.js +1 -0
- package/dist/common/launchBrowser.d.ts +7 -0
- package/dist/common/launchBrowser.js +34 -2
- package/dist/common/playwrightContext.d.ts +2 -0
- package/dist/common/playwrightContext.js +10 -4
- package/dist/common/runApi/index.js +2 -0
- package/dist/common/settingsSchema.d.ts +3 -0
- package/dist/common/settingsSchema.js +2 -1
- package/dist/vendor/runtime-interface.js +34 -16
- package/package.json +2 -2
- package/.claude/settings.local.json +0 -7
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
|
|
@@ -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"
|
|
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 () =>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
cdpAddress
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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"
|
|
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
|
-
|
|
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,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
|
});
|
|
@@ -126,6 +126,7 @@ var require_errors = __commonJS({
|
|
|
126
126
|
var AutomationError = class extends RunAutomationError {
|
|
127
127
|
constructor(error) {
|
|
128
128
|
super(exports2.automationError, `[${error?.name ?? error}] ${error?.message}`);
|
|
129
|
+
this.error = error;
|
|
129
130
|
this.details = {
|
|
130
131
|
...error,
|
|
131
132
|
name: error?.name,
|
|
@@ -221,12 +222,14 @@ var require_types = __commonJS({
|
|
|
221
222
|
server: zod_1.default.string(),
|
|
222
223
|
username: zod_1.default.string(),
|
|
223
224
|
password: zod_1.default.string()
|
|
224
|
-
}).optional()
|
|
225
|
+
}).optional(),
|
|
226
|
+
ignoreHttpErrors: zod_1.default.boolean().optional()
|
|
225
227
|
});
|
|
226
228
|
exports2.runApiCdpRunOptionsSchema = zod_1.default.object({
|
|
227
229
|
environment: zod_1.default.literal("cdp"),
|
|
228
230
|
cdpAddress: zod_1.default.string(),
|
|
229
|
-
cdpTargetId: zod_1.default.string().optional()
|
|
231
|
+
cdpTargetId: zod_1.default.string().optional(),
|
|
232
|
+
ignoreHttpErrors: zod_1.default.boolean().optional()
|
|
230
233
|
});
|
|
231
234
|
exports2.runApiRunOptionsSchema = zod_1.default.discriminatedUnion("environment", [
|
|
232
235
|
exports2.runApiStandaloneRunOptionsSchema,
|
|
@@ -260,7 +263,6 @@ var require_types = __commonJS({
|
|
|
260
263
|
jobId: zod_1.default.string().optional(),
|
|
261
264
|
jobRunId: zod_1.default.string().optional(),
|
|
262
265
|
runId: zod_1.default.string().optional(),
|
|
263
|
-
queueId: zod_1.default.string().optional(),
|
|
264
266
|
authSessionId: zod_1.default.string().optional()
|
|
265
267
|
}).optional()
|
|
266
268
|
});
|
|
@@ -327,19 +329,29 @@ var require_interfaceClient = __commonJS({
|
|
|
327
329
|
}) : function(o, v) {
|
|
328
330
|
o["default"] = v;
|
|
329
331
|
});
|
|
330
|
-
var __importStar = exports2 && exports2.__importStar || function(
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
332
|
+
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
|
|
333
|
+
var ownKeys = function(o) {
|
|
334
|
+
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
335
|
+
var ar = [];
|
|
336
|
+
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
337
|
+
return ar;
|
|
338
|
+
};
|
|
339
|
+
return ownKeys(o);
|
|
340
|
+
};
|
|
341
|
+
return function(mod) {
|
|
342
|
+
if (mod && mod.__esModule) return mod;
|
|
343
|
+
var result = {};
|
|
344
|
+
if (mod != null) {
|
|
345
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
346
|
+
}
|
|
347
|
+
__setModuleDefault(result, mod);
|
|
348
|
+
return result;
|
|
349
|
+
};
|
|
350
|
+
})();
|
|
339
351
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
340
352
|
exports2.JSONLFileClient = exports2.TCPSocketClient = exports2.UnixSocketClient = exports2.SocketClient = void 0;
|
|
341
|
-
var net = __importStar(require("net"));
|
|
342
353
|
var fs = __importStar(require("fs-extra"));
|
|
354
|
+
var net = __importStar(require("net"));
|
|
343
355
|
var readline_1 = require("readline");
|
|
344
356
|
var promises_1 = require("timers/promises");
|
|
345
357
|
var SocketClient = class _SocketClient {
|
|
@@ -375,7 +387,13 @@ var require_interfaceClient = __commonJS({
|
|
|
375
387
|
if (!(chunk instanceof Buffer)) {
|
|
376
388
|
break;
|
|
377
389
|
}
|
|
378
|
-
buffer = Buffer.concat([
|
|
390
|
+
buffer = Buffer.concat([
|
|
391
|
+
buffer,
|
|
392
|
+
chunk
|
|
393
|
+
]);
|
|
394
|
+
if (buffer.length < _SocketClient.LENGTH_HEADER_LENGTH) {
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
379
397
|
const length = buffer.readUInt32BE(0);
|
|
380
398
|
if (buffer.length < length + _SocketClient.LENGTH_HEADER_LENGTH) {
|
|
381
399
|
continue;
|
|
@@ -433,8 +451,8 @@ var require_interfaceClient = __commonJS({
|
|
|
433
451
|
async close() {
|
|
434
452
|
this.fileStream.close();
|
|
435
453
|
await Promise.race([
|
|
436
|
-
new Promise((resolve) => this.fileStream.once("close", resolve)),
|
|
437
|
-
new Promise((resolve) => this.fileStream.once("error", resolve)),
|
|
454
|
+
new Promise((resolve) => this.fileStream.once("close", () => resolve(void 0))),
|
|
455
|
+
new Promise((resolve) => this.fileStream.once("error", () => resolve(void 0))),
|
|
438
456
|
(0, promises_1.setTimeout)(3e3)
|
|
439
457
|
]);
|
|
440
458
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intuned/runtime-dev",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.21-dev.0",
|
|
4
4
|
"description": "Intuned runtime",
|
|
5
5
|
"packageManager": "yarn@4.12.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"prettier": "2.8.0",
|
|
90
90
|
"promptly": "3.2.0",
|
|
91
91
|
"prompts": "^2.4.2",
|
|
92
|
-
"rollup": "3.
|
|
92
|
+
"rollup": "3.30.0",
|
|
93
93
|
"smol-toml": "^1.4.2",
|
|
94
94
|
"source-map": "0.7.4",
|
|
95
95
|
"terminal-kit": "^3.1.2",
|