@intuned/runtime-dev 1.3.27-dev5 → 1.3.27-dev6
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import * as playwright from "playwright";
|
|
3
3
|
import { Result } from "neverthrow";
|
|
4
|
-
export declare function
|
|
5
|
-
|
|
4
|
+
export declare function getEncryptedProfileChromeArgs({ encryptedProfile, platform, disableMacKeychainPrompts, }: {
|
|
5
|
+
encryptedProfile?: boolean;
|
|
6
6
|
platform?: NodeJS.Platform;
|
|
7
7
|
disableMacKeychainPrompts?: string;
|
|
8
8
|
}): string[];
|
|
@@ -29,12 +29,14 @@ export type LaunchChromiumStandaloneOptions = {
|
|
|
29
29
|
executablePath?: string;
|
|
30
30
|
ignoreHttpErrors?: boolean;
|
|
31
31
|
profileTemplatePath?: string;
|
|
32
|
+
encryptedProfile?: boolean;
|
|
32
33
|
timeout?: number;
|
|
33
34
|
};
|
|
34
35
|
export type LaunchChromiumCdpOptions = {
|
|
35
36
|
cdpAddress: string;
|
|
36
37
|
cdpTargetId?: string;
|
|
37
38
|
profileTemplatePath?: string;
|
|
39
|
+
encryptedProfile?: boolean;
|
|
38
40
|
timeout?: number;
|
|
39
41
|
};
|
|
40
42
|
export declare function launchChromium(options: LaunchChromiumStandaloneOptions): Promise<LaunchBrowserResult>;
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getBrowserExecutablePath = getBrowserExecutablePath;
|
|
7
7
|
exports.getCdpWebSocketUrl = getCdpWebSocketUrl;
|
|
8
|
+
exports.getEncryptedProfileChromeArgs = getEncryptedProfileChromeArgs;
|
|
8
9
|
exports.getHeadlessUserAgent = getHeadlessUserAgent;
|
|
9
10
|
exports.getIgnoreHttpErrorsFromConfig = getIgnoreHttpErrorsFromConfig;
|
|
10
11
|
exports.getLocalCdpAddress = getLocalCdpAddress;
|
|
11
|
-
exports.getPortableProfileChromeArgs = getPortableProfileChromeArgs;
|
|
12
12
|
exports.launchBrowser = launchBrowser;
|
|
13
13
|
exports.launchChromium = launchChromium;
|
|
14
14
|
var playwright = _interopRequireWildcard(require("playwright"));
|
|
@@ -26,13 +26,13 @@ var _intunedJson = require("./intunedJson");
|
|
|
26
26
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27
27
|
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); }
|
|
28
28
|
const execAsync = (0, _util.promisify)(_child_process.exec);
|
|
29
|
-
function
|
|
30
|
-
|
|
29
|
+
function getEncryptedProfileChromeArgs({
|
|
30
|
+
encryptedProfile,
|
|
31
31
|
platform = process.platform,
|
|
32
32
|
disableMacKeychainPrompts = process.env.INTUNED_MAC_DISABLE_KEYCHAIN_PROMPTS
|
|
33
33
|
}) {
|
|
34
34
|
const args = [];
|
|
35
|
-
if (
|
|
35
|
+
if (encryptedProfile) {
|
|
36
36
|
args.unshift("--password-store=basic");
|
|
37
37
|
}
|
|
38
38
|
if (platform === "darwin" && disableMacKeychainPrompts !== "0") {
|
|
@@ -150,6 +150,7 @@ async function launchChromium(options) {
|
|
|
150
150
|
downloadsPath,
|
|
151
151
|
ignoreHttpErrors: ignoreHttpErrorsParam,
|
|
152
152
|
profileTemplatePath,
|
|
153
|
+
encryptedProfile,
|
|
153
154
|
timeout
|
|
154
155
|
} = options;
|
|
155
156
|
let {
|
|
@@ -158,10 +159,10 @@ async function launchChromium(options) {
|
|
|
158
159
|
const ignoreHttpErrors = await getIgnoreHttpErrorsFromConfig(ignoreHttpErrorsParam);
|
|
159
160
|
const defaultArgsToIgnore = ["--disable-extensions", "--disable-component-extensions-with-background-pages", "--disable-background-networking", "--disable-backgrounding-occluded-windows", "--disable-background-timer-throttling"];
|
|
160
161
|
const extraArgs = ["--disable-notifications"];
|
|
161
|
-
const
|
|
162
|
-
|
|
162
|
+
const encryptedProfileArgs = getEncryptedProfileChromeArgs({
|
|
163
|
+
encryptedProfile
|
|
163
164
|
});
|
|
164
|
-
extraArgs.push(...
|
|
165
|
+
extraArgs.push(...encryptedProfileArgs);
|
|
165
166
|
const stealthConfig = await (0, _intunedJson.getStealthModeConfig)();
|
|
166
167
|
if (stealthConfig.enabled) {
|
|
167
168
|
extraArgs.push("--stealth-mode");
|
|
@@ -204,7 +205,7 @@ async function launchChromium(options) {
|
|
|
204
205
|
const viewport = null;
|
|
205
206
|
const userAgent = process.env.__PLAYWRIGHT_USER_AGENT_OVERRIDE ?? (await getHeadlessUserAgent({
|
|
206
207
|
executablePath,
|
|
207
|
-
args:
|
|
208
|
+
args: encryptedProfileArgs
|
|
208
209
|
}));
|
|
209
210
|
const context = await playwright.chromium.launchPersistentContext(userDataDir, {
|
|
210
211
|
userAgent,
|
|
@@ -19,11 +19,13 @@ export declare function withPlaywrightContext<R>(options: {
|
|
|
19
19
|
downloadsPath: string;
|
|
20
20
|
ignoreHttpErrors?: boolean;
|
|
21
21
|
profileTemplatePath?: string;
|
|
22
|
+
encryptedProfile?: boolean;
|
|
22
23
|
} & WithPlaywrightContextParameters, fn: WithPlaywrightContextWrappedFunction<R>): Promise<Ok<R, any> | Err<any, RunAutomationError>>;
|
|
23
24
|
export declare function withPlaywrightContext<R>(options: {
|
|
24
25
|
cdpAddress: string;
|
|
25
26
|
cdpTargetId?: string;
|
|
26
27
|
profileTemplatePath?: string;
|
|
28
|
+
encryptedProfile?: boolean;
|
|
27
29
|
} & WithPlaywrightContextParameters, fn: WithPlaywrightContextWrappedFunction<R>): Promise<Ok<R, any> | Err<any, RunAutomationError>>;
|
|
28
30
|
export declare function loadSessionToContext({ context, session, }: {
|
|
29
31
|
context: playwright.BrowserContext;
|
|
@@ -22,6 +22,7 @@ async function withPlaywrightContext({
|
|
|
22
22
|
downloadsPath,
|
|
23
23
|
ignoreHttpErrors: cliIgnoreHttpErrors,
|
|
24
24
|
profileTemplatePath,
|
|
25
|
+
encryptedProfile,
|
|
25
26
|
importFunction,
|
|
26
27
|
apiName,
|
|
27
28
|
apiParameters
|
|
@@ -45,7 +46,8 @@ async function withPlaywrightContext({
|
|
|
45
46
|
} = await (0, _launchBrowser.launchBrowser)({
|
|
46
47
|
cdpAddress,
|
|
47
48
|
cdpTargetId,
|
|
48
|
-
profileTemplatePath
|
|
49
|
+
profileTemplatePath,
|
|
50
|
+
encryptedProfile
|
|
49
51
|
}));
|
|
50
52
|
} else {
|
|
51
53
|
({
|
|
@@ -56,7 +58,8 @@ async function withPlaywrightContext({
|
|
|
56
58
|
headless,
|
|
57
59
|
downloadsPath,
|
|
58
60
|
ignoreHttpErrors,
|
|
59
|
-
profileTemplatePath
|
|
61
|
+
profileTemplatePath,
|
|
62
|
+
encryptedProfile
|
|
60
63
|
}));
|
|
61
64
|
}
|
|
62
65
|
return await fn(context, page);
|
|
@@ -70,7 +73,8 @@ async function withPlaywrightContext({
|
|
|
70
73
|
} = await (0, _launchBrowser.launchBrowser)({
|
|
71
74
|
cdpAddress,
|
|
72
75
|
cdpTargetId,
|
|
73
|
-
profileTemplatePath
|
|
76
|
+
profileTemplatePath,
|
|
77
|
+
encryptedProfile
|
|
74
78
|
}));
|
|
75
79
|
} else {
|
|
76
80
|
const port = await (0, _portfinder.getPort)({
|
|
@@ -85,7 +89,8 @@ async function withPlaywrightContext({
|
|
|
85
89
|
downloadsPath,
|
|
86
90
|
cdpPort: port,
|
|
87
91
|
ignoreHttpErrors,
|
|
88
|
-
profileTemplatePath
|
|
92
|
+
profileTemplatePath,
|
|
93
|
+
encryptedProfile
|
|
89
94
|
}));
|
|
90
95
|
hookCdpUrl = (0, _launchBrowser.getLocalCdpAddress)(port);
|
|
91
96
|
}
|
|
@@ -149,6 +149,7 @@ async function runApi({
|
|
|
149
149
|
downloadsPath,
|
|
150
150
|
ignoreHttpErrors: runOptions.ignoreHttpErrors,
|
|
151
151
|
profileTemplatePath: runOptions.profileTemplatePath,
|
|
152
|
+
encryptedProfile: runOptions.encryptedProfile,
|
|
152
153
|
...playwrightContextParameters
|
|
153
154
|
}, runAutomationWithContext);
|
|
154
155
|
} finally {
|
|
@@ -159,6 +160,7 @@ async function runApi({
|
|
|
159
160
|
cdpAddress: runOptions.cdpAddress,
|
|
160
161
|
cdpTargetId: runOptions.cdpTargetId,
|
|
161
162
|
profileTemplatePath: runOptions.profileTemplatePath,
|
|
163
|
+
encryptedProfile: runOptions.encryptedProfile,
|
|
162
164
|
...playwrightContextParameters
|
|
163
165
|
}, runAutomationWithContext);
|
|
164
166
|
}
|
|
@@ -227,13 +227,15 @@ var require_types = __commonJS({
|
|
|
227
227
|
headless: zod_1.default.boolean().default(true),
|
|
228
228
|
proxy: exports2.runApiProxySchema.optional(),
|
|
229
229
|
ignoreHttpErrors: zod_1.default.boolean().optional(),
|
|
230
|
-
profileTemplatePath: zod_1.default.string().optional()
|
|
230
|
+
profileTemplatePath: zod_1.default.string().optional(),
|
|
231
|
+
encryptedProfile: zod_1.default.boolean().optional()
|
|
231
232
|
});
|
|
232
233
|
exports2.runApiCdpRunOptionsSchema = zod_1.default.object({
|
|
233
234
|
environment: zod_1.default.literal("cdp"),
|
|
234
235
|
cdpAddress: zod_1.default.string(),
|
|
235
236
|
cdpTargetId: zod_1.default.string().optional(),
|
|
236
|
-
profileTemplatePath: zod_1.default.string().optional()
|
|
237
|
+
profileTemplatePath: zod_1.default.string().optional(),
|
|
238
|
+
encryptedProfile: zod_1.default.boolean().optional()
|
|
237
239
|
});
|
|
238
240
|
exports2.runApiRunOptionsSchema = zod_1.default.discriminatedUnion("environment", [
|
|
239
241
|
exports2.runApiStandaloneRunOptionsSchema,
|