@intuned/runtime-dev 1.3.28-dev1 → 1.3.32
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 +13 -0
- package/dist/commands/common/utils/settings.d.ts +5 -0
- package/dist/commands/common/utils/settings.js +5 -17
- package/dist/common/asyncLocalStorage/index.d.ts +11 -0
- package/dist/common/asyncLocalStorage/index.js +4 -0
- package/dist/common/extension/intunedExtensionServer.js +3 -0
- package/dist/common/extension/types.d.ts +49 -25
- package/dist/common/extension/types.js +3 -2
- package/dist/common/launchBrowser.d.ts +11 -4
- package/dist/common/launchBrowser.js +27 -55
- package/dist/common/playwrightContext.d.ts +7 -3
- package/dist/common/playwrightContext.js +11 -7
- package/dist/common/runApi/index.js +24 -6
- package/dist/common/settingsSchema.d.ts +431 -25
- package/dist/common/settingsSchema.js +18 -2
- package/dist/runtime/captcha.js +15 -13
- package/dist/vendor/runtime-interface.js +14 -6
- package/{dist → package/dist}/commands/api/run.js +11 -7
- package/{dist → package/dist}/commands/auth-sessions/load.js +2 -2
- package/{dist → package/dist}/commands/auth-sessions/run-check.js +8 -8
- package/{dist → package/dist}/commands/auth-sessions/run-create.js +6 -6
- package/package/dist/commands/browser/save-state.d.ts +2 -0
- package/package/dist/commands/browser/save-state.js +17 -0
- package/package/dist/commands/browser/start-browser.d.ts +2 -0
- package/package/dist/commands/browser/start-browser.js +14 -0
- package/package/dist/commands/build.d.ts +1 -0
- package/package/dist/commands/build.js +84 -0
- package/package/dist/commands/common/browserUtils.d.ts +14 -0
- package/package/dist/commands/common/browserUtils.js +58 -0
- package/package/dist/commands/common/getFirstLineNumber.d.ts +9 -0
- package/package/dist/commands/common/getFirstLineNumber.js +101 -0
- package/package/dist/commands/common/getFirstLineNumber.test.js +228 -0
- package/package/dist/commands/common/projectExclusions.d.ts +2 -0
- package/package/dist/commands/common/projectExclusions.js +8 -0
- package/package/dist/commands/common/sendMessageToClient.d.ts +1 -0
- package/package/dist/commands/common/sendMessageToClient.js +10 -0
- package/package/dist/commands/common/tsNodeImport.d.ts +2 -0
- package/package/dist/commands/common/tsNodeImport.js +34 -0
- package/package/dist/commands/common/utils/fileUtils.d.ts +6 -0
- package/package/dist/commands/common/utils/fileUtils.js +33 -0
- package/package/dist/commands/common/utils/settings.d.ts +2 -0
- package/package/dist/commands/common/utils/settings.js +31 -0
- package/package/dist/commands/common/utils/template.d.ts +2 -0
- package/package/dist/commands/common/utils/template.js +31 -0
- package/package/dist/commands/common/utils/unixSocket.d.ts +9 -0
- package/package/dist/commands/common/utils/unixSocket.js +44 -0
- package/package/dist/commands/interface/run.d.ts +1 -0
- package/package/dist/commands/interface/run.js +216 -0
- package/package/dist/commands/intuned-cli/commands/attempt.command.d.ts +1 -0
- package/package/dist/commands/intuned-cli/commands/attempt.command.js +8 -0
- package/package/dist/commands/intuned-cli/commands/attempt_api.command.d.ts +1 -0
- package/package/dist/commands/intuned-cli/commands/attempt_api.command.js +30 -0
- package/package/dist/commands/intuned-cli/commands/attempt_authsession.command.d.ts +1 -0
- package/package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +8 -0
- package/package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.d.ts +1 -0
- package/package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +19 -0
- package/package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.d.ts +1 -0
- package/package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +24 -0
- package/package/dist/commands/intuned-cli/commands/authsession.command.d.ts +1 -0
- package/package/dist/commands/intuned-cli/commands/authsession.command.js +8 -0
- package/package/dist/commands/intuned-cli/commands/authsession_record.command.d.ts +1 -0
- package/package/dist/commands/intuned-cli/commands/authsession_record.command.js +31 -0
- package/package/dist/commands/intuned-cli/commands/build.command.d.ts +1 -0
- package/package/dist/commands/intuned-cli/commands/build.command.js +12 -0
- package/package/dist/commands/intuned-cli/commands/command.d.ts +2 -0
- package/package/dist/commands/intuned-cli/commands/command.js +9 -0
- package/package/dist/commands/intuned-cli/commands/deploy.command.d.ts +1 -0
- package/package/dist/commands/intuned-cli/commands/deploy.command.js +38 -0
- package/package/dist/commands/intuned-cli/commands/index.d.ts +18 -0
- package/package/dist/commands/intuned-cli/commands/index.js +203 -0
- package/package/dist/commands/intuned-cli/commands/init.command.d.ts +1 -0
- package/package/dist/commands/intuned-cli/commands/init.command.js +13 -0
- package/package/dist/commands/intuned-cli/commands/run.command.d.ts +1 -0
- package/package/dist/commands/intuned-cli/commands/run.command.js +8 -0
- package/package/dist/commands/intuned-cli/commands/run_api.command.d.ts +1 -0
- package/package/dist/commands/intuned-cli/commands/run_api.command.js +46 -0
- package/package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +28 -0
- package/package/dist/commands/intuned-cli/commands/run_authsession.command.js +17 -0
- package/package/dist/commands/intuned-cli/commands/run_authsession_create.command.d.ts +1 -0
- package/package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +35 -0
- package/package/dist/commands/intuned-cli/commands/run_authsession_update.command.d.ts +1 -0
- package/package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +35 -0
- package/package/dist/commands/intuned-cli/commands/run_authsession_validate.command.d.ts +1 -0
- package/package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +33 -0
- package/package/dist/commands/intuned-cli/commands/save.command.d.ts +13 -0
- package/package/dist/commands/intuned-cli/commands/save.command.js +42 -0
- package/package/dist/commands/intuned-cli/commands/types.d.ts +31 -0
- package/package/dist/commands/intuned-cli/commands/types.js +29 -0
- package/package/dist/commands/intuned-cli/constants/index.d.ts +17 -0
- package/package/dist/commands/intuned-cli/constants/index.js +25 -0
- package/package/dist/commands/intuned-cli/controller/__test__/api.test.js +397 -0
- package/package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +1059 -0
- package/package/dist/commands/intuned-cli/controller/api.d.ts +42 -0
- package/package/dist/commands/intuned-cli/controller/api.js +189 -0
- package/package/dist/commands/intuned-cli/controller/authSession.d.ts +209 -0
- package/package/dist/commands/intuned-cli/controller/authSession.js +420 -0
- package/package/dist/commands/intuned-cli/controller/build.d.ts +1 -0
- package/package/dist/commands/intuned-cli/controller/build.js +36 -0
- package/package/dist/commands/intuned-cli/controller/deploy.d.ts +4 -0
- package/package/dist/commands/intuned-cli/controller/deploy.js +139 -0
- package/package/dist/commands/intuned-cli/controller/index.d.ts +1 -0
- package/package/dist/commands/intuned-cli/controller/index.js +46 -0
- package/package/dist/commands/intuned-cli/controller/save.d.ts +14 -0
- package/package/dist/commands/intuned-cli/controller/save.js +345 -0
- package/package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +103 -0
- package/package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +40 -0
- package/package/dist/commands/intuned-cli/helpers/api.d.ts +3 -0
- package/package/dist/commands/intuned-cli/helpers/api.js +19 -0
- package/package/dist/commands/intuned-cli/helpers/auth.d.ts +46 -0
- package/package/dist/commands/intuned-cli/helpers/auth.js +144 -0
- package/package/dist/commands/intuned-cli/helpers/backend.d.ts +8 -0
- package/package/dist/commands/intuned-cli/helpers/backend.js +27 -0
- package/package/dist/commands/intuned-cli/helpers/browser.d.ts +14 -0
- package/package/dist/commands/intuned-cli/helpers/browser.js +57 -0
- package/package/dist/commands/intuned-cli/helpers/context.d.ts +3 -0
- package/package/dist/commands/intuned-cli/helpers/context.js +33 -0
- package/package/dist/commands/intuned-cli/helpers/errors.d.ts +13 -0
- package/package/dist/commands/intuned-cli/helpers/errors.js +37 -0
- package/package/dist/commands/intuned-cli/helpers/index.d.ts +12 -0
- package/package/dist/commands/intuned-cli/helpers/index.js +137 -0
- package/package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +69 -0
- package/package/dist/commands/intuned-cli/helpers/intunedJson.js +71 -0
- package/package/dist/commands/intuned-cli/helpers/proxy.d.ts +5 -0
- package/package/dist/commands/intuned-cli/helpers/proxy.js +23 -0
- package/package/dist/commands/intuned-cli/helpers/terminal.d.ts +5 -0
- package/package/dist/commands/intuned-cli/helpers/terminal.js +13 -0
- package/package/dist/commands/intuned-cli/helpers/timeout.d.ts +1 -0
- package/package/dist/commands/intuned-cli/helpers/timeout.js +23 -0
- package/package/dist/commands/intuned-cli/helpers/traces.d.ts +2 -0
- package/package/dist/commands/intuned-cli/helpers/traces.js +32 -0
- package/package/dist/commands/intuned-cli/helpers/validation.d.ts +2 -0
- package/package/dist/commands/intuned-cli/helpers/validation.js +14 -0
- package/package/dist/commands/intuned-cli/helpers/wrapper.d.ts +2 -0
- package/package/dist/commands/intuned-cli/helpers/wrapper.js +60 -0
- package/package/dist/commands/intuned-cli/index.d.ts +1 -0
- package/package/dist/commands/intuned-cli/index.js +16 -0
- package/package/dist/commands/intuned-cli/main.d.ts +1 -0
- package/package/dist/commands/intuned-cli/main.js +22 -0
- package/package/dist/commands/intuned-cli/types.d.ts +41 -0
- package/package/dist/commands/intuned-cli/types.js +12 -0
- package/package/dist/commands/ts-check.d.ts +2 -0
- package/package/dist/commands/ts-check.js +56 -0
- package/package/dist/common/Logger/Logger/index.d.ts +12 -0
- package/package/dist/common/Logger/Logger/index.js +60 -0
- package/package/dist/common/Logger/Logger/types.d.ts +8 -0
- package/package/dist/common/Logger/Logger/types.js +5 -0
- package/package/dist/common/Logger/index.d.ts +12 -0
- package/package/dist/common/Logger/index.js +60 -0
- package/package/dist/common/Logger/types.d.ts +8 -0
- package/package/dist/common/Logger/types.js +5 -0
- package/package/dist/common/assets/browser_scripts.js +2580 -0
- package/package/dist/common/asyncLocalStorage/index.d.ts +16 -0
- package/package/dist/common/asyncLocalStorage/index.js +17 -0
- package/package/dist/common/backendFunctions/getAuthSessionParameters.d.ts +1 -0
- package/package/dist/common/backendFunctions/getAuthSessionParameters.js +38 -0
- package/package/dist/common/cleanEnvironmentVariables.d.ts +1 -0
- package/package/dist/common/cleanEnvironmentVariables.js +16 -0
- package/package/dist/common/constants.d.ts +10 -0
- package/package/dist/common/constants.js +16 -0
- package/package/dist/common/contextStorageStateHelpers.d.ts +21 -0
- package/package/dist/common/contextStorageStateHelpers.js +81 -0
- package/package/dist/common/extensionsHelpers.d.ts +8 -0
- package/package/dist/common/extensionsHelpers.js +80 -0
- package/package/dist/common/formatZodError.d.ts +2 -0
- package/package/dist/common/formatZodError.js +18 -0
- package/package/dist/common/jwtTokenManager.d.ts +17 -0
- package/package/dist/common/jwtTokenManager.js +109 -0
- package/package/dist/common/launchBrowser.d.ts +25 -0
- package/package/dist/common/launchBrowser.js +172 -0
- package/package/dist/common/playwrightContext.d.ts +31 -0
- package/package/dist/common/playwrightContext.js +144 -0
- package/package/dist/common/runApi/errors.d.ts +72 -0
- package/package/dist/common/runApi/errors.js +169 -0
- package/package/dist/common/runApi/importUsingImportFunction.d.ts +9 -0
- package/package/dist/common/runApi/importUsingImportFunction.js +46 -0
- package/package/dist/common/runApi/index.d.ts +11 -0
- package/package/dist/common/runApi/index.js +199 -0
- package/package/dist/common/runApi/types.d.ts +830 -0
- package/package/dist/common/runApi/types.js +73 -0
- package/package/dist/common/settingsSchema.d.ts +518 -0
- package/package/dist/common/settingsSchema.js +57 -0
- package/package/dist/common/setupContextHook.d.ts +17 -0
- package/package/dist/common/setupContextHook.js +22 -0
- package/package/dist/common/telemetry.d.ts +3 -0
- package/package/dist/common/telemetry.js +32 -0
- package/package/dist/index.d.ts +4 -0
- package/package/dist/index.js +69 -0
- package/package/dist/runtime/RunError.d.ts +5 -0
- package/package/dist/runtime/RunError.js +19 -0
- package/package/dist/runtime/attemptStore.d.ts +2 -0
- package/package/dist/runtime/attemptStore.js +23 -0
- package/package/dist/runtime/downloadDirectory.d.ts +1 -0
- package/package/dist/runtime/downloadDirectory.js +19 -0
- package/package/dist/runtime/enums.d.js +5 -0
- package/package/dist/runtime/enums.d.ts +11 -0
- package/package/dist/runtime/enums.js +18 -0
- package/package/dist/runtime/executionHelpers.test.js +52 -0
- package/package/dist/runtime/export.d.js +5 -0
- package/package/dist/runtime/export.d.ts +228 -0
- package/package/dist/runtime/extendPayload.d.ts +2 -0
- package/package/dist/runtime/extendPayload.js +21 -0
- package/package/dist/runtime/extendTimeout.d.ts +1 -0
- package/package/dist/runtime/extendTimeout.js +23 -0
- package/package/dist/runtime/getAuthSessionParameters.d.ts +1 -0
- package/package/dist/runtime/getAuthSessionParameters.js +20 -0
- package/package/dist/runtime/index.d.ts +7 -0
- package/package/dist/runtime/index.js +54 -0
- package/package/dist/runtime/runInfo.d.ts +2 -0
- package/package/dist/runtime/runInfo.js +21 -0
- package/package.json +2 -10
- package/bin/intuned-api-run +0 -4
- package/bin/intuned-auth-session-check +0 -4
- package/bin/intuned-auth-session-create +0 -4
- package/bin/intuned-auth-session-load +0 -4
- package/dist/common/intunedJson.d.ts +0 -252
- package/dist/common/intunedJson.js +0 -162
- /package/{dist → package/dist}/commands/api/run.d.ts +0 -0
- /package/{dist → package/dist}/commands/auth-sessions/load.d.ts +0 -0
- /package/{dist → package/dist}/commands/auth-sessions/run-check.d.ts +0 -0
- /package/{dist → package/dist}/commands/auth-sessions/run-create.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# UNRELEASED
|
|
2
2
|
|
|
3
|
+
- add Math captcha auto-solver via LLM image recognition (image-based arithmetic captchas configured by CSS selectors)
|
|
4
|
+
- add Temu captcha auto-solver via SadCaptcha API (semantic shapes challenge type)
|
|
5
|
+
|
|
6
|
+
# 1.3.29
|
|
7
|
+
|
|
8
|
+
- add TikTok captcha auto-solver via SadCaptcha API (puzzle and rotate challenge types)
|
|
9
|
+
- fix headless browser user agent mismatch when running in stealth browser
|
|
10
|
+
|
|
11
|
+
# 1.3.28
|
|
12
|
+
|
|
13
|
+
- accept and log captcha event messages from the browser extension, including Cloudflare Waiting Room progress
|
|
14
|
+
- add DataDome captcha solver configuration and event type support
|
|
15
|
+
|
|
3
16
|
# 1.3.27
|
|
4
17
|
|
|
5
18
|
- add profile templates support
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { IntunedSettings } from "../../../common/settingsSchema";
|
|
2
|
+
/**
|
|
3
|
+
* Assembles runtime settings from config supplied via the interface (no longer
|
|
4
|
+
* reads Intuned.json). Only captcha-solver config is consumed by the runtime;
|
|
5
|
+
* authSessions/stealthMode are handled by the caller (CLI/UDAS) and default here.
|
|
6
|
+
*/
|
|
2
7
|
export declare function getSettings(): Promise<IntunedSettings>;
|
|
@@ -4,28 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getSettings = getSettings;
|
|
7
|
-
var _fileUtils = require("./fileUtils");
|
|
8
7
|
var _settingsSchema = require("../../../common/settingsSchema");
|
|
9
|
-
var
|
|
8
|
+
var _asyncLocalStorage = require("../../../common/asyncLocalStorage");
|
|
10
9
|
async function getSettings() {
|
|
11
|
-
|
|
12
|
-
const settings = await (0, _promises.readFile)(settingsFilePath, {
|
|
13
|
-
encoding: "utf-8"
|
|
14
|
-
});
|
|
15
|
-
if (settings) {
|
|
16
|
-
const parsed = _settingsSchema.settingsSchema.safeParse(JSON.parse(settings));
|
|
17
|
-
if (parsed.success) {
|
|
18
|
-
return parsed.data;
|
|
19
|
-
} else {
|
|
20
|
-
throw new Error(parsed.error.message);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
10
|
+
return _settingsSchema.settingsSchema.parse({
|
|
24
11
|
authSessions: {
|
|
25
12
|
enabled: false
|
|
26
13
|
},
|
|
27
14
|
stealthMode: {
|
|
28
15
|
enabled: false
|
|
29
|
-
}
|
|
30
|
-
|
|
16
|
+
},
|
|
17
|
+
captchaSolver: (0, _asyncLocalStorage.getCaptchaSolverConfig)()
|
|
18
|
+
});
|
|
31
19
|
}
|
|
@@ -11,6 +11,17 @@ export interface InternalRunInfo extends RunInfo {
|
|
|
11
11
|
timeoutInfo?: TimeoutInfo;
|
|
12
12
|
store?: Record<string, any>;
|
|
13
13
|
getAuthSessionParameters?: () => Promise<any>;
|
|
14
|
+
/**
|
|
15
|
+
* Captcha-solver config forwarded by the caller (CLI/UDAS) through the
|
|
16
|
+
* interface. Consumed by the Intuned browser extension setup. Replaces the
|
|
17
|
+
* previous read from Intuned.json.
|
|
18
|
+
*/
|
|
19
|
+
captchaSolver?: Record<string, any>;
|
|
14
20
|
}
|
|
15
21
|
export declare function getExecutionContext(): InternalRunInfo | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Captcha-solver config supplied via the interface, or undefined when running
|
|
24
|
+
* outside an execution context.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getCaptchaSolverConfig(): Record<string, any> | undefined;
|
|
16
27
|
export {};
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.asyncLocalStorage = void 0;
|
|
7
|
+
exports.getCaptchaSolverConfig = getCaptchaSolverConfig;
|
|
7
8
|
exports.getExecutionContext = getExecutionContext;
|
|
8
9
|
exports.runWithContext = runWithContext;
|
|
9
10
|
var _nodeAsync_hooks = require("node:async_hooks");
|
|
@@ -14,4 +15,7 @@ function runWithContext(contextData, callback, ...args) {
|
|
|
14
15
|
function getExecutionContext() {
|
|
15
16
|
const contextData = asyncLocalStorage.getStore();
|
|
16
17
|
return contextData;
|
|
18
|
+
}
|
|
19
|
+
function getCaptchaSolverConfig() {
|
|
20
|
+
return getExecutionContext()?.captchaSolver;
|
|
17
21
|
}
|
|
@@ -75,6 +75,9 @@ class ExtensionServer {
|
|
|
75
75
|
details: result.error.flatten().fieldErrors
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
+
if (result.data.message) {
|
|
79
|
+
console.info(`Captcha event: tab=${result.data.tabId} type=${result.data.type} status=${result.data.status} message=${result.data.message}`);
|
|
80
|
+
}
|
|
78
81
|
await this.handleUpsertCaptcha(result.data);
|
|
79
82
|
return reply.code(200).send({});
|
|
80
83
|
} catch (error) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const captchaTypeSchema: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
2
|
+
export declare const captchaTypeSchema: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
|
|
3
3
|
export type CaptchaType = z.infer<typeof captchaTypeSchema>;
|
|
4
4
|
export declare const captchaStatusSchema: z.ZodEnum<["attached", "solving", "solved", "error", "detached"]>;
|
|
5
5
|
export type CaptchaStatus = z.infer<typeof captchaStatusSchema>;
|
|
@@ -19,46 +19,53 @@ export type CaptchaError = z.infer<typeof captchaErrorSchema>;
|
|
|
19
19
|
declare const captchaBaseSchema: z.ZodObject<{
|
|
20
20
|
id: z.ZodString;
|
|
21
21
|
tabId: z.ZodNumber;
|
|
22
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
22
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
|
|
23
23
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
message: z.ZodOptional<z.ZodString>;
|
|
24
25
|
}, "strip", z.ZodTypeAny, {
|
|
25
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
26
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
26
27
|
id: string;
|
|
27
28
|
tabId: number;
|
|
29
|
+
message?: string | undefined;
|
|
28
30
|
retryCount?: number | undefined;
|
|
29
31
|
}, {
|
|
30
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
32
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
31
33
|
id: string;
|
|
32
34
|
tabId: number;
|
|
35
|
+
message?: string | undefined;
|
|
33
36
|
retryCount?: number | undefined;
|
|
34
37
|
}>;
|
|
35
38
|
export type CaptchaBase = z.infer<typeof captchaBaseSchema>;
|
|
36
39
|
declare const captchaNonErrorSchema: z.ZodObject<{
|
|
37
40
|
id: z.ZodString;
|
|
38
41
|
tabId: z.ZodNumber;
|
|
39
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
42
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
|
|
40
43
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
message: z.ZodOptional<z.ZodString>;
|
|
41
45
|
} & {
|
|
42
46
|
status: z.ZodEnum<["attached", "solving", "solved", "detached"]>;
|
|
43
47
|
}, "strip", z.ZodTypeAny, {
|
|
44
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
48
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
45
49
|
status: "attached" | "solving" | "solved" | "detached";
|
|
46
50
|
id: string;
|
|
47
51
|
tabId: number;
|
|
52
|
+
message?: string | undefined;
|
|
48
53
|
retryCount?: number | undefined;
|
|
49
54
|
}, {
|
|
50
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
55
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
51
56
|
status: "attached" | "solving" | "solved" | "detached";
|
|
52
57
|
id: string;
|
|
53
58
|
tabId: number;
|
|
59
|
+
message?: string | undefined;
|
|
54
60
|
retryCount?: number | undefined;
|
|
55
61
|
}>;
|
|
56
62
|
export type CaptchaNonError = z.infer<typeof captchaNonErrorSchema>;
|
|
57
63
|
declare const captchaErrorStatusSchema: z.ZodObject<{
|
|
58
64
|
id: z.ZodString;
|
|
59
65
|
tabId: z.ZodNumber;
|
|
60
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
66
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
|
|
61
67
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
message: z.ZodOptional<z.ZodString>;
|
|
62
69
|
} & {
|
|
63
70
|
status: z.ZodLiteral<"error">;
|
|
64
71
|
error: z.ZodObject<{
|
|
@@ -76,104 +83,119 @@ declare const captchaErrorStatusSchema: z.ZodObject<{
|
|
|
76
83
|
code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
|
|
77
84
|
error?: unknown;
|
|
78
85
|
};
|
|
79
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
86
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
80
87
|
status: "error";
|
|
81
88
|
id: string;
|
|
82
89
|
tabId: number;
|
|
90
|
+
message?: string | undefined;
|
|
83
91
|
retryCount?: number | undefined;
|
|
84
92
|
}, {
|
|
85
93
|
error: {
|
|
86
94
|
code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
|
|
87
95
|
error?: unknown;
|
|
88
96
|
};
|
|
89
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
97
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
90
98
|
status: "error";
|
|
91
99
|
id: string;
|
|
92
100
|
tabId: number;
|
|
101
|
+
message?: string | undefined;
|
|
93
102
|
retryCount?: number | undefined;
|
|
94
103
|
}>;
|
|
95
104
|
export type CaptchaErrorStatus = z.infer<typeof captchaErrorStatusSchema>;
|
|
96
105
|
export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
|
|
97
106
|
id: z.ZodString;
|
|
98
107
|
tabId: z.ZodNumber;
|
|
99
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
108
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
|
|
100
109
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
110
|
+
message: z.ZodOptional<z.ZodString>;
|
|
101
111
|
} & {
|
|
102
112
|
status: z.ZodLiteral<"attached">;
|
|
103
113
|
}, "strip", z.ZodTypeAny, {
|
|
104
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
114
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
105
115
|
status: "attached";
|
|
106
116
|
id: string;
|
|
107
117
|
tabId: number;
|
|
118
|
+
message?: string | undefined;
|
|
108
119
|
retryCount?: number | undefined;
|
|
109
120
|
}, {
|
|
110
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
121
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
111
122
|
status: "attached";
|
|
112
123
|
id: string;
|
|
113
124
|
tabId: number;
|
|
125
|
+
message?: string | undefined;
|
|
114
126
|
retryCount?: number | undefined;
|
|
115
127
|
}>, z.ZodObject<{
|
|
116
128
|
id: z.ZodString;
|
|
117
129
|
tabId: z.ZodNumber;
|
|
118
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
130
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
|
|
119
131
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
132
|
+
message: z.ZodOptional<z.ZodString>;
|
|
120
133
|
} & {
|
|
121
134
|
status: z.ZodLiteral<"solving">;
|
|
122
135
|
}, "strip", z.ZodTypeAny, {
|
|
123
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
136
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
124
137
|
status: "solving";
|
|
125
138
|
id: string;
|
|
126
139
|
tabId: number;
|
|
140
|
+
message?: string | undefined;
|
|
127
141
|
retryCount?: number | undefined;
|
|
128
142
|
}, {
|
|
129
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
143
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
130
144
|
status: "solving";
|
|
131
145
|
id: string;
|
|
132
146
|
tabId: number;
|
|
147
|
+
message?: string | undefined;
|
|
133
148
|
retryCount?: number | undefined;
|
|
134
149
|
}>, z.ZodObject<{
|
|
135
150
|
id: z.ZodString;
|
|
136
151
|
tabId: z.ZodNumber;
|
|
137
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
152
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
|
|
138
153
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
154
|
+
message: z.ZodOptional<z.ZodString>;
|
|
139
155
|
} & {
|
|
140
156
|
status: z.ZodLiteral<"solved">;
|
|
141
157
|
}, "strip", z.ZodTypeAny, {
|
|
142
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
158
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
143
159
|
status: "solved";
|
|
144
160
|
id: string;
|
|
145
161
|
tabId: number;
|
|
162
|
+
message?: string | undefined;
|
|
146
163
|
retryCount?: number | undefined;
|
|
147
164
|
}, {
|
|
148
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
165
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
149
166
|
status: "solved";
|
|
150
167
|
id: string;
|
|
151
168
|
tabId: number;
|
|
169
|
+
message?: string | undefined;
|
|
152
170
|
retryCount?: number | undefined;
|
|
153
171
|
}>, z.ZodObject<{
|
|
154
172
|
id: z.ZodString;
|
|
155
173
|
tabId: z.ZodNumber;
|
|
156
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
174
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
|
|
157
175
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
176
|
+
message: z.ZodOptional<z.ZodString>;
|
|
158
177
|
} & {
|
|
159
178
|
status: z.ZodLiteral<"detached">;
|
|
160
179
|
}, "strip", z.ZodTypeAny, {
|
|
161
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
180
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
162
181
|
status: "detached";
|
|
163
182
|
id: string;
|
|
164
183
|
tabId: number;
|
|
184
|
+
message?: string | undefined;
|
|
165
185
|
retryCount?: number | undefined;
|
|
166
186
|
}, {
|
|
167
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
187
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
168
188
|
status: "detached";
|
|
169
189
|
id: string;
|
|
170
190
|
tabId: number;
|
|
191
|
+
message?: string | undefined;
|
|
171
192
|
retryCount?: number | undefined;
|
|
172
193
|
}>, z.ZodObject<{
|
|
173
194
|
id: z.ZodString;
|
|
174
195
|
tabId: z.ZodNumber;
|
|
175
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]>;
|
|
196
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
|
|
176
197
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
198
|
+
message: z.ZodOptional<z.ZodString>;
|
|
177
199
|
} & {
|
|
178
200
|
status: z.ZodLiteral<"error">;
|
|
179
201
|
error: z.ZodObject<{
|
|
@@ -191,20 +213,22 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
|
|
|
191
213
|
code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
|
|
192
214
|
error?: unknown;
|
|
193
215
|
};
|
|
194
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
216
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
195
217
|
status: "error";
|
|
196
218
|
id: string;
|
|
197
219
|
tabId: number;
|
|
220
|
+
message?: string | undefined;
|
|
198
221
|
retryCount?: number | undefined;
|
|
199
222
|
}, {
|
|
200
223
|
error: {
|
|
201
224
|
code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
|
|
202
225
|
error?: unknown;
|
|
203
226
|
};
|
|
204
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha";
|
|
227
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
205
228
|
status: "error";
|
|
206
229
|
id: string;
|
|
207
230
|
tabId: number;
|
|
231
|
+
message?: string | undefined;
|
|
208
232
|
retryCount?: number | undefined;
|
|
209
233
|
}>]>;
|
|
210
234
|
export type Captcha = z.infer<typeof captchaSchema>;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.captchaTypeSchema = exports.captchaStatusSchema = exports.captchaSchema = exports.captchaErrorSchema = exports.captchaErrorCodeSchema = exports.TimeoutError = exports.CaptchaSolveError = void 0;
|
|
7
7
|
var _zod = require("zod");
|
|
8
|
-
const captchaTypeSchema = exports.captchaTypeSchema = _zod.z.enum(["aws", "cloudflare", "customcaptcha", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha"]);
|
|
8
|
+
const captchaTypeSchema = exports.captchaTypeSchema = _zod.z.enum(["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]);
|
|
9
9
|
const captchaStatusSchema = exports.captchaStatusSchema = _zod.z.enum(["attached", "solving", "solved", "error", "detached"]);
|
|
10
10
|
const captchaErrorCodeSchema = exports.captchaErrorCodeSchema = _zod.z.enum(["HIT_LIMIT", "MAX_RETRIES", "UNEXPECTED_SERVER_RESPONSE", "UNEXPECTED_ERROR"]);
|
|
11
11
|
const captchaErrorSchema = exports.captchaErrorSchema = _zod.z.object({
|
|
@@ -16,7 +16,8 @@ const captchaBaseSchema = _zod.z.object({
|
|
|
16
16
|
id: _zod.z.string().min(1),
|
|
17
17
|
tabId: _zod.z.number().int().positive(),
|
|
18
18
|
type: captchaTypeSchema,
|
|
19
|
-
retryCount: _zod.z.number().int().nonnegative().optional()
|
|
19
|
+
retryCount: _zod.z.number().int().nonnegative().optional(),
|
|
20
|
+
message: _zod.z.string().optional()
|
|
20
21
|
});
|
|
21
22
|
const captchaNonErrorSchema = captchaBaseSchema.extend({
|
|
22
23
|
status: captchaStatusSchema.exclude(["error"])
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import * as playwright from "playwright";
|
|
3
3
|
import { Result } from "neverthrow";
|
|
4
|
-
import type { ProfileMode } from "@intuned/runtime-interface";
|
|
5
4
|
export declare function getEncryptedProfileChromeArgs({ encryptedProfile, platform, disableMacKeychainPrompts, }: {
|
|
6
5
|
encryptedProfile?: boolean;
|
|
7
6
|
platform?: NodeJS.Platform;
|
|
@@ -31,21 +30,29 @@ export type LaunchChromiumStandaloneOptions = {
|
|
|
31
30
|
ignoreHttpErrors?: boolean;
|
|
32
31
|
profileTemplatePath?: string;
|
|
33
32
|
encryptedProfile?: boolean;
|
|
34
|
-
profileMode?: ProfileMode;
|
|
35
33
|
timeout?: number;
|
|
34
|
+
/** Extra Chrome args supplied by the caller (e.g. `--stealth-mode`). */
|
|
35
|
+
browserArgs?: string[];
|
|
36
|
+
/** Browser window size supplied by the caller; defaults to 1280x800. */
|
|
37
|
+
browserSize?: {
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
};
|
|
36
41
|
};
|
|
37
42
|
export type LaunchChromiumCdpOptions = {
|
|
38
43
|
cdpAddress: string;
|
|
39
44
|
cdpTargetId?: string;
|
|
40
45
|
profileTemplatePath?: string;
|
|
41
46
|
encryptedProfile?: boolean;
|
|
42
|
-
profileMode?: ProfileMode;
|
|
43
47
|
timeout?: number;
|
|
44
48
|
};
|
|
45
49
|
export declare function launchChromium(options: LaunchChromiumStandaloneOptions): Promise<LaunchBrowserResult>;
|
|
46
50
|
export declare function launchChromium(options: LaunchChromiumCdpOptions): Promise<LaunchBrowserResult>;
|
|
47
51
|
export declare function getBrowserExecutablePath(): Promise<string | undefined>;
|
|
48
|
-
export declare function launchBrowser(options: Omit<LaunchChromiumStandaloneOptions, "executablePath">
|
|
52
|
+
export declare function launchBrowser(options: (Omit<LaunchChromiumStandaloneOptions, "executablePath"> & {
|
|
53
|
+
/** Browser executable path supplied by the caller (e.g. the Intuned stealth browser). */
|
|
54
|
+
browserPath?: string;
|
|
55
|
+
}) | LaunchChromiumCdpOptions): Promise<LaunchBrowserResult>;
|
|
49
56
|
export declare function getLocalCdpAddress(port: number): string;
|
|
50
57
|
export declare function getCdpWebSocketUrl(cdpAddress: string): Promise<Result<string, string>>;
|
|
51
58
|
export declare function getHeadlessUserAgent({ executablePath, args, ignoreDefaultArgs, }: {
|
|
@@ -22,10 +22,13 @@ var _intunedExtensionServer = require("./extension/intunedExtensionServer");
|
|
|
22
22
|
var _util = require("util");
|
|
23
23
|
var _neverthrow = require("neverthrow");
|
|
24
24
|
var _zod = require("zod");
|
|
25
|
-
var _intunedJson = require("./intunedJson");
|
|
26
25
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27
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); }
|
|
28
27
|
const execAsync = (0, _util.promisify)(_child_process.exec);
|
|
28
|
+
const DEFAULT_BROWSER_SIZE = {
|
|
29
|
+
width: 1280,
|
|
30
|
+
height: 800
|
|
31
|
+
};
|
|
29
32
|
function getEncryptedProfileChromeArgs({
|
|
30
33
|
encryptedProfile,
|
|
31
34
|
platform = process.platform,
|
|
@@ -50,21 +53,7 @@ const DEFAULT_USER_PREFERENCES = {
|
|
|
50
53
|
password_manager_enabled: false
|
|
51
54
|
}
|
|
52
55
|
};
|
|
53
|
-
async function createUserDirWithPreferences(profileTemplatePath
|
|
54
|
-
if (profileMode === "persistent" && profileTemplatePath && (await fs.pathExists(profileTemplatePath))) {
|
|
55
|
-
const defaultDir = (0, _path.join)(profileTemplatePath, "Default");
|
|
56
|
-
const preferencesPath = (0, _path.join)(defaultDir, "Preferences");
|
|
57
|
-
await (0, _fsExtra.mkdir)(defaultDir, {
|
|
58
|
-
recursive: true
|
|
59
|
-
});
|
|
60
|
-
if (!(await fs.pathExists(preferencesPath))) {
|
|
61
|
-
await (0, _fsExtra.writeFile)(preferencesPath, JSON.stringify(DEFAULT_USER_PREFERENCES));
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
userDir: profileTemplatePath,
|
|
65
|
-
ephemeral: false
|
|
66
|
-
};
|
|
67
|
-
}
|
|
56
|
+
async function createUserDirWithPreferences(profileTemplatePath) {
|
|
68
57
|
const playwrightTempDir = await (0, _fsExtra.mkdtemp)("/tmp/pw-");
|
|
69
58
|
const userDir = (0, _path.join)(playwrightTempDir, "userdir");
|
|
70
59
|
const defaultDir = (0, _path.join)(userDir, "Default");
|
|
@@ -87,19 +76,13 @@ async function createUserDirWithPreferences(profileTemplatePath, profileMode = "
|
|
|
87
76
|
}
|
|
88
77
|
const mergedPreferences = mergePreferences(templatePreferences, DEFAULT_USER_PREFERENCES);
|
|
89
78
|
await (0, _fsExtra.writeFile)(preferencesPath, JSON.stringify(mergedPreferences));
|
|
90
|
-
return
|
|
91
|
-
userDir,
|
|
92
|
-
ephemeral: true
|
|
93
|
-
};
|
|
79
|
+
return userDir;
|
|
94
80
|
}
|
|
95
81
|
await (0, _fsExtra.mkdir)(defaultDir, {
|
|
96
82
|
recursive: true
|
|
97
83
|
});
|
|
98
84
|
await (0, _fsExtra.writeFile)(preferencesPath, JSON.stringify(DEFAULT_USER_PREFERENCES));
|
|
99
|
-
return
|
|
100
|
-
userDir,
|
|
101
|
-
ephemeral: true
|
|
102
|
-
};
|
|
85
|
+
return userDir;
|
|
103
86
|
}
|
|
104
87
|
function isPlainObject(value) {
|
|
105
88
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -172,8 +155,9 @@ async function launchChromium(options) {
|
|
|
172
155
|
ignoreHttpErrors: ignoreHttpErrorsParam,
|
|
173
156
|
profileTemplatePath,
|
|
174
157
|
encryptedProfile,
|
|
175
|
-
|
|
176
|
-
|
|
158
|
+
timeout,
|
|
159
|
+
browserArgs,
|
|
160
|
+
browserSize: browserSizeOption
|
|
177
161
|
} = options;
|
|
178
162
|
let {
|
|
179
163
|
executablePath
|
|
@@ -185,14 +169,10 @@ async function launchChromium(options) {
|
|
|
185
169
|
encryptedProfile
|
|
186
170
|
});
|
|
187
171
|
extraArgs.push(...encryptedProfileArgs);
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
extraArgs.push("--stealth-mode");
|
|
172
|
+
if (browserArgs) {
|
|
173
|
+
extraArgs.push(...browserArgs);
|
|
191
174
|
}
|
|
192
|
-
const
|
|
193
|
-
userDir: userDataDir,
|
|
194
|
-
ephemeral: shouldCleanupUserDir
|
|
195
|
-
} = await createUserDirWithPreferences(profileTemplatePath, profileMode);
|
|
175
|
+
const userDataDir = await createUserDirWithPreferences(profileTemplatePath);
|
|
196
176
|
if ((0, _extensionsHelpers.isIntunedExtensionLoaded)()) {
|
|
197
177
|
const extensionsList = (0, _extensionsHelpers.buildExtensionsList)();
|
|
198
178
|
const extensions = extensionsList.join(",");
|
|
@@ -215,17 +195,14 @@ async function launchChromium(options) {
|
|
|
215
195
|
if (appModeInitialUrl) {
|
|
216
196
|
extraArgs.push(`--app=${appModeInitialUrl}`);
|
|
217
197
|
}
|
|
218
|
-
if (
|
|
219
|
-
const stealthExecutablePath = await getIntunedBrowserExecutablePath();
|
|
220
|
-
executablePath = stealthExecutablePath;
|
|
221
|
-
} else if (executablePath) {
|
|
198
|
+
if (executablePath) {
|
|
222
199
|
executablePath = await fs.realpath(executablePath);
|
|
223
200
|
if (!(await fs.exists(executablePath))) {
|
|
224
201
|
console.log(`Warning: Executable path ${executablePath} does not exist. Falling back to default.`);
|
|
225
202
|
executablePath = undefined;
|
|
226
203
|
}
|
|
227
204
|
}
|
|
228
|
-
const browserSize =
|
|
205
|
+
const browserSize = browserSizeOption ?? DEFAULT_BROWSER_SIZE;
|
|
229
206
|
extraArgs.push(`--window-size=${browserSize.width},${browserSize.height}`);
|
|
230
207
|
const viewport = null;
|
|
231
208
|
const userAgent = process.env.__PLAYWRIGHT_USER_AGENT_OVERRIDE ?? (await getHeadlessUserAgent({
|
|
@@ -248,14 +225,12 @@ async function launchChromium(options) {
|
|
|
248
225
|
}
|
|
249
226
|
context.once("close", async () => {
|
|
250
227
|
try {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
});
|
|
258
|
-
}
|
|
228
|
+
await (0, _fsExtra.rm)(userDataDir, {
|
|
229
|
+
recursive: true,
|
|
230
|
+
force: true,
|
|
231
|
+
retryDelay: 1000,
|
|
232
|
+
maxRetries: 5
|
|
233
|
+
});
|
|
259
234
|
if (await (0, _extensionsHelpers.isIntunedExtensionEnabled)()) {
|
|
260
235
|
await (0, _intunedExtensionServer.cleanIntunedExtensionServer)();
|
|
261
236
|
}
|
|
@@ -276,13 +251,6 @@ async function launchChromium(options) {
|
|
|
276
251
|
context
|
|
277
252
|
};
|
|
278
253
|
}
|
|
279
|
-
async function getIntunedBrowserExecutablePath() {
|
|
280
|
-
const intunedPath = process.env.INTUNED_STEALTH_CHROMIUM_PATH;
|
|
281
|
-
if (intunedPath && (await fs.exists(intunedPath))) {
|
|
282
|
-
return intunedPath;
|
|
283
|
-
}
|
|
284
|
-
return undefined;
|
|
285
|
-
}
|
|
286
254
|
async function getBrowserExecutablePath() {
|
|
287
255
|
const browserType = getBrowserType();
|
|
288
256
|
if (browserType === "brave") {
|
|
@@ -293,9 +261,13 @@ async function launchBrowser(options) {
|
|
|
293
261
|
if ("cdpAddress" in options) {
|
|
294
262
|
return launchChromium(options);
|
|
295
263
|
}
|
|
264
|
+
const {
|
|
265
|
+
browserPath,
|
|
266
|
+
...standaloneOptions
|
|
267
|
+
} = options;
|
|
296
268
|
return launchChromium({
|
|
297
|
-
...
|
|
298
|
-
executablePath: await getBrowserExecutablePath()
|
|
269
|
+
...standaloneOptions,
|
|
270
|
+
executablePath: browserPath ?? (await getBrowserExecutablePath())
|
|
299
271
|
});
|
|
300
272
|
}
|
|
301
273
|
function getBrowserType() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as playwright from "playwright";
|
|
2
2
|
import { Err, Ok } from "neverthrow";
|
|
3
3
|
import { type Proxy } from "./launchBrowser";
|
|
4
|
-
import { ImportFunction, RunAutomationError, RunApiSession
|
|
4
|
+
import { ImportFunction, RunAutomationError, RunApiSession } from "@intuned/runtime-interface";
|
|
5
5
|
type WithPlaywrightContextParameters = {
|
|
6
6
|
importFunction: ImportFunction;
|
|
7
7
|
apiName: string;
|
|
@@ -20,14 +20,18 @@ export declare function withPlaywrightContext<R>(options: {
|
|
|
20
20
|
ignoreHttpErrors?: boolean;
|
|
21
21
|
profileTemplatePath?: string;
|
|
22
22
|
encryptedProfile?: boolean;
|
|
23
|
-
|
|
23
|
+
browserPath?: string;
|
|
24
|
+
browserArgs?: string[];
|
|
25
|
+
browserSize?: {
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
};
|
|
24
29
|
} & WithPlaywrightContextParameters, fn: WithPlaywrightContextWrappedFunction<R>): Promise<Ok<R, any> | Err<any, RunAutomationError>>;
|
|
25
30
|
export declare function withPlaywrightContext<R>(options: {
|
|
26
31
|
cdpAddress: string;
|
|
27
32
|
cdpTargetId?: string;
|
|
28
33
|
profileTemplatePath?: string;
|
|
29
34
|
encryptedProfile?: boolean;
|
|
30
|
-
profileMode?: ProfileMode;
|
|
31
35
|
} & WithPlaywrightContextParameters, fn: WithPlaywrightContextWrappedFunction<R>): Promise<Ok<R, any> | Err<any, RunAutomationError>>;
|
|
32
36
|
export declare function loadSessionToContext({ context, session, }: {
|
|
33
37
|
context: playwright.BrowserContext;
|
|
@@ -23,7 +23,9 @@ async function withPlaywrightContext({
|
|
|
23
23
|
ignoreHttpErrors: cliIgnoreHttpErrors,
|
|
24
24
|
profileTemplatePath,
|
|
25
25
|
encryptedProfile,
|
|
26
|
-
|
|
26
|
+
browserPath,
|
|
27
|
+
browserArgs,
|
|
28
|
+
browserSize,
|
|
27
29
|
importFunction,
|
|
28
30
|
apiName,
|
|
29
31
|
apiParameters
|
|
@@ -48,8 +50,7 @@ async function withPlaywrightContext({
|
|
|
48
50
|
cdpAddress,
|
|
49
51
|
cdpTargetId,
|
|
50
52
|
profileTemplatePath,
|
|
51
|
-
encryptedProfile
|
|
52
|
-
profileMode
|
|
53
|
+
encryptedProfile
|
|
53
54
|
}));
|
|
54
55
|
} else {
|
|
55
56
|
({
|
|
@@ -62,7 +63,9 @@ async function withPlaywrightContext({
|
|
|
62
63
|
ignoreHttpErrors,
|
|
63
64
|
profileTemplatePath,
|
|
64
65
|
encryptedProfile,
|
|
65
|
-
|
|
66
|
+
browserPath,
|
|
67
|
+
browserArgs,
|
|
68
|
+
browserSize
|
|
66
69
|
}));
|
|
67
70
|
}
|
|
68
71
|
return await fn(context, page);
|
|
@@ -77,8 +80,7 @@ async function withPlaywrightContext({
|
|
|
77
80
|
cdpAddress,
|
|
78
81
|
cdpTargetId,
|
|
79
82
|
profileTemplatePath,
|
|
80
|
-
encryptedProfile
|
|
81
|
-
profileMode
|
|
83
|
+
encryptedProfile
|
|
82
84
|
}));
|
|
83
85
|
} else {
|
|
84
86
|
const port = await (0, _portfinder.getPort)({
|
|
@@ -95,7 +97,9 @@ async function withPlaywrightContext({
|
|
|
95
97
|
ignoreHttpErrors,
|
|
96
98
|
profileTemplatePath,
|
|
97
99
|
encryptedProfile,
|
|
98
|
-
|
|
100
|
+
browserPath,
|
|
101
|
+
browserArgs,
|
|
102
|
+
browserSize
|
|
99
103
|
}));
|
|
100
104
|
hookCdpUrl = (0, _launchBrowser.getLocalCdpAddress)(port);
|
|
101
105
|
}
|