@intuned/runtime-dev 1.3.27-dev4 → 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.
@@ -22,7 +22,7 @@ function getMacKeychainBypassArgs() {
22
22
  if (process.env.INTUNED_MAC_DISABLE_KEYCHAIN_PROMPTS === "0") {
23
23
  return [];
24
24
  }
25
- return ["--use-mock-keychain", "--password-store=basic"];
25
+ return ["--use-mock-keychain"];
26
26
  }
27
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()];
28
28
  exports.getChromiumLaunchArgs = getChromiumLaunchArgs;
@@ -1,5 +1,11 @@
1
+ /// <reference types="node" />
1
2
  import * as playwright from "playwright";
2
3
  import { Result } from "neverthrow";
4
+ export declare function getEncryptedProfileChromeArgs({ encryptedProfile, platform, disableMacKeychainPrompts, }: {
5
+ encryptedProfile?: boolean;
6
+ platform?: NodeJS.Platform;
7
+ disableMacKeychainPrompts?: string;
8
+ }): string[];
3
9
  export interface Proxy {
4
10
  server: string;
5
11
  username: string;
@@ -23,12 +29,14 @@ export type LaunchChromiumStandaloneOptions = {
23
29
  executablePath?: string;
24
30
  ignoreHttpErrors?: boolean;
25
31
  profileTemplatePath?: string;
32
+ encryptedProfile?: boolean;
26
33
  timeout?: number;
27
34
  };
28
35
  export type LaunchChromiumCdpOptions = {
29
36
  cdpAddress: string;
30
37
  cdpTargetId?: string;
31
38
  profileTemplatePath?: string;
39
+ encryptedProfile?: boolean;
32
40
  timeout?: number;
33
41
  };
34
42
  export declare function launchChromium(options: LaunchChromiumStandaloneOptions): Promise<LaunchBrowserResult>;
@@ -5,6 +5,7 @@ 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;
@@ -25,9 +26,16 @@ var _intunedJson = require("./intunedJson");
25
26
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
26
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); }
27
28
  const execAsync = (0, _util.promisify)(_child_process.exec);
28
- function getKeychainBypassArgs() {
29
- const args = ["--password-store=basic"];
30
- if (process.platform === "darwin" && process.env.INTUNED_MAC_DISABLE_KEYCHAIN_PROMPTS !== "0") {
29
+ function getEncryptedProfileChromeArgs({
30
+ encryptedProfile,
31
+ platform = process.platform,
32
+ disableMacKeychainPrompts = process.env.INTUNED_MAC_DISABLE_KEYCHAIN_PROMPTS
33
+ }) {
34
+ const args = [];
35
+ if (encryptedProfile) {
36
+ args.unshift("--password-store=basic");
37
+ }
38
+ if (platform === "darwin" && disableMacKeychainPrompts !== "0") {
31
39
  args.unshift("--use-mock-keychain");
32
40
  }
33
41
  return args;
@@ -142,6 +150,7 @@ async function launchChromium(options) {
142
150
  downloadsPath,
143
151
  ignoreHttpErrors: ignoreHttpErrorsParam,
144
152
  profileTemplatePath,
153
+ encryptedProfile,
145
154
  timeout
146
155
  } = options;
147
156
  let {
@@ -150,8 +159,10 @@ async function launchChromium(options) {
150
159
  const ignoreHttpErrors = await getIgnoreHttpErrorsFromConfig(ignoreHttpErrorsParam);
151
160
  const defaultArgsToIgnore = ["--disable-extensions", "--disable-component-extensions-with-background-pages", "--disable-background-networking", "--disable-backgrounding-occluded-windows", "--disable-background-timer-throttling"];
152
161
  const extraArgs = ["--disable-notifications"];
153
- const keychainBypassArgs = getKeychainBypassArgs();
154
- extraArgs.push(...keychainBypassArgs);
162
+ const encryptedProfileArgs = getEncryptedProfileChromeArgs({
163
+ encryptedProfile
164
+ });
165
+ extraArgs.push(...encryptedProfileArgs);
155
166
  const stealthConfig = await (0, _intunedJson.getStealthModeConfig)();
156
167
  if (stealthConfig.enabled) {
157
168
  extraArgs.push("--stealth-mode");
@@ -194,7 +205,7 @@ async function launchChromium(options) {
194
205
  const viewport = null;
195
206
  const userAgent = process.env.__PLAYWRIGHT_USER_AGENT_OVERRIDE ?? (await getHeadlessUserAgent({
196
207
  executablePath,
197
- args: keychainBypassArgs
208
+ args: encryptedProfileArgs
198
209
  }));
199
210
  const context = await playwright.chromium.launchPersistentContext(userDataDir, {
200
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.3.27-dev4",
3
+ "version": "1.3.27-dev6",
4
4
  "description": "Intuned runtime",
5
5
  "packageManager": "yarn@4.12.0",
6
6
  "main": "./dist/index.js",
Binary file