@intuned/runtime-dev 1.3.29-stealth.0 → 1.3.33
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 +14 -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/types.d.ts +25 -25
- package/dist/common/extension/types.js +1 -1
- package/dist/common/jwtTokenManager.d.ts +6 -1
- package/dist/common/jwtTokenManager.js +10 -4
- package/dist/common/launchBrowser.d.ts +11 -1
- package/dist/common/launchBrowser.js +16 -19
- package/dist/common/playwrightContext.d.ts +6 -0
- package/dist/common/playwrightContext.js +11 -2
- package/dist/common/runApi/index.js +18 -4
- package/dist/common/settingsSchema.d.ts +144 -6
- package/dist/common/settingsSchema.js +3 -0
- package/dist/runtime/persistentStore.js +4 -0
- package/dist/runtime/persistentStore.test.js +4 -0
- package/dist/vendor/runtime-interface.js +14 -3
- 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 +1 -9
- package/.claude/settings.local.json +0 -7
- 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,6 +1,20 @@
|
|
|
1
1
|
# UNRELEASED
|
|
2
2
|
|
|
3
|
+
- `persistentStore` now works in runs without a project id by falling back to the workspace-scoped kv-store endpoint
|
|
4
|
+
|
|
5
|
+
# 1.3.32
|
|
6
|
+
|
|
7
|
+
- add support for `__INTUNED__MAX_RESULT_SIZE_BYTES` env var to limit the size of the run result payload sent to the backend;
|
|
8
|
+
|
|
9
|
+
# 1.3.31
|
|
10
|
+
|
|
11
|
+
- add Math captcha auto-solver via LLM image recognition (image-based arithmetic captchas configured by CSS selectors)
|
|
12
|
+
- add Temu captcha auto-solver via SadCaptcha API (semantic shapes challenge type)
|
|
13
|
+
|
|
14
|
+
# 1.3.29
|
|
15
|
+
|
|
3
16
|
- add TikTok captcha auto-solver via SadCaptcha API (puzzle and rotate challenge types)
|
|
17
|
+
- fix headless browser user agent mismatch when running in stealth browser
|
|
4
18
|
|
|
5
19
|
# 1.3.28
|
|
6
20
|
|
|
@@ -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
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const captchaTypeSchema: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]>;
|
|
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,17 +19,17 @@ 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", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]>;
|
|
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
24
|
message: z.ZodOptional<z.ZodString>;
|
|
25
25
|
}, "strip", z.ZodTypeAny, {
|
|
26
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
|
|
26
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
27
27
|
id: string;
|
|
28
28
|
tabId: number;
|
|
29
29
|
message?: string | undefined;
|
|
30
30
|
retryCount?: number | undefined;
|
|
31
31
|
}, {
|
|
32
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
|
|
32
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
33
33
|
id: string;
|
|
34
34
|
tabId: number;
|
|
35
35
|
message?: string | undefined;
|
|
@@ -39,20 +39,20 @@ export type CaptchaBase = z.infer<typeof captchaBaseSchema>;
|
|
|
39
39
|
declare const captchaNonErrorSchema: z.ZodObject<{
|
|
40
40
|
id: z.ZodString;
|
|
41
41
|
tabId: z.ZodNumber;
|
|
42
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]>;
|
|
42
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
|
|
43
43
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
44
44
|
message: z.ZodOptional<z.ZodString>;
|
|
45
45
|
} & {
|
|
46
46
|
status: z.ZodEnum<["attached", "solving", "solved", "detached"]>;
|
|
47
47
|
}, "strip", z.ZodTypeAny, {
|
|
48
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
|
|
48
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
49
49
|
status: "attached" | "solving" | "solved" | "detached";
|
|
50
50
|
id: string;
|
|
51
51
|
tabId: number;
|
|
52
52
|
message?: string | undefined;
|
|
53
53
|
retryCount?: number | undefined;
|
|
54
54
|
}, {
|
|
55
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
|
|
55
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
56
56
|
status: "attached" | "solving" | "solved" | "detached";
|
|
57
57
|
id: string;
|
|
58
58
|
tabId: number;
|
|
@@ -63,7 +63,7 @@ export type CaptchaNonError = z.infer<typeof captchaNonErrorSchema>;
|
|
|
63
63
|
declare const captchaErrorStatusSchema: z.ZodObject<{
|
|
64
64
|
id: z.ZodString;
|
|
65
65
|
tabId: z.ZodNumber;
|
|
66
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]>;
|
|
66
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
|
|
67
67
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
68
68
|
message: z.ZodOptional<z.ZodString>;
|
|
69
69
|
} & {
|
|
@@ -83,7 +83,7 @@ declare const captchaErrorStatusSchema: z.ZodObject<{
|
|
|
83
83
|
code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
|
|
84
84
|
error?: unknown;
|
|
85
85
|
};
|
|
86
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
|
|
86
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
87
87
|
status: "error";
|
|
88
88
|
id: string;
|
|
89
89
|
tabId: number;
|
|
@@ -94,7 +94,7 @@ declare const captchaErrorStatusSchema: z.ZodObject<{
|
|
|
94
94
|
code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
|
|
95
95
|
error?: unknown;
|
|
96
96
|
};
|
|
97
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
|
|
97
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
98
98
|
status: "error";
|
|
99
99
|
id: string;
|
|
100
100
|
tabId: number;
|
|
@@ -105,20 +105,20 @@ export type CaptchaErrorStatus = z.infer<typeof captchaErrorStatusSchema>;
|
|
|
105
105
|
export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
|
|
106
106
|
id: z.ZodString;
|
|
107
107
|
tabId: z.ZodNumber;
|
|
108
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]>;
|
|
108
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
|
|
109
109
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
110
110
|
message: z.ZodOptional<z.ZodString>;
|
|
111
111
|
} & {
|
|
112
112
|
status: z.ZodLiteral<"attached">;
|
|
113
113
|
}, "strip", z.ZodTypeAny, {
|
|
114
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
|
|
114
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
115
115
|
status: "attached";
|
|
116
116
|
id: string;
|
|
117
117
|
tabId: number;
|
|
118
118
|
message?: string | undefined;
|
|
119
119
|
retryCount?: number | undefined;
|
|
120
120
|
}, {
|
|
121
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
|
|
121
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
122
122
|
status: "attached";
|
|
123
123
|
id: string;
|
|
124
124
|
tabId: number;
|
|
@@ -127,20 +127,20 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
|
|
|
127
127
|
}>, z.ZodObject<{
|
|
128
128
|
id: z.ZodString;
|
|
129
129
|
tabId: z.ZodNumber;
|
|
130
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]>;
|
|
130
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
|
|
131
131
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
132
132
|
message: z.ZodOptional<z.ZodString>;
|
|
133
133
|
} & {
|
|
134
134
|
status: z.ZodLiteral<"solving">;
|
|
135
135
|
}, "strip", z.ZodTypeAny, {
|
|
136
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
|
|
136
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
137
137
|
status: "solving";
|
|
138
138
|
id: string;
|
|
139
139
|
tabId: number;
|
|
140
140
|
message?: string | undefined;
|
|
141
141
|
retryCount?: number | undefined;
|
|
142
142
|
}, {
|
|
143
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
|
|
143
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
144
144
|
status: "solving";
|
|
145
145
|
id: string;
|
|
146
146
|
tabId: number;
|
|
@@ -149,20 +149,20 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
|
|
|
149
149
|
}>, z.ZodObject<{
|
|
150
150
|
id: z.ZodString;
|
|
151
151
|
tabId: z.ZodNumber;
|
|
152
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]>;
|
|
152
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
|
|
153
153
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
154
154
|
message: z.ZodOptional<z.ZodString>;
|
|
155
155
|
} & {
|
|
156
156
|
status: z.ZodLiteral<"solved">;
|
|
157
157
|
}, "strip", z.ZodTypeAny, {
|
|
158
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
|
|
158
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
159
159
|
status: "solved";
|
|
160
160
|
id: string;
|
|
161
161
|
tabId: number;
|
|
162
162
|
message?: string | undefined;
|
|
163
163
|
retryCount?: number | undefined;
|
|
164
164
|
}, {
|
|
165
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
|
|
165
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
166
166
|
status: "solved";
|
|
167
167
|
id: string;
|
|
168
168
|
tabId: number;
|
|
@@ -171,20 +171,20 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
|
|
|
171
171
|
}>, z.ZodObject<{
|
|
172
172
|
id: z.ZodString;
|
|
173
173
|
tabId: z.ZodNumber;
|
|
174
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]>;
|
|
174
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
|
|
175
175
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
176
176
|
message: z.ZodOptional<z.ZodString>;
|
|
177
177
|
} & {
|
|
178
178
|
status: z.ZodLiteral<"detached">;
|
|
179
179
|
}, "strip", z.ZodTypeAny, {
|
|
180
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
|
|
180
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
181
181
|
status: "detached";
|
|
182
182
|
id: string;
|
|
183
183
|
tabId: number;
|
|
184
184
|
message?: string | undefined;
|
|
185
185
|
retryCount?: number | undefined;
|
|
186
186
|
}, {
|
|
187
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
|
|
187
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
188
188
|
status: "detached";
|
|
189
189
|
id: string;
|
|
190
190
|
tabId: number;
|
|
@@ -193,7 +193,7 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
|
|
|
193
193
|
}>, z.ZodObject<{
|
|
194
194
|
id: z.ZodString;
|
|
195
195
|
tabId: z.ZodNumber;
|
|
196
|
-
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]>;
|
|
196
|
+
type: z.ZodEnum<["aws", "cloudflare", "customcaptcha", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "mathcaptcha", "recaptcha", "textcaptcha", "tiktok", "temu"]>;
|
|
197
197
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
198
198
|
message: z.ZodOptional<z.ZodString>;
|
|
199
199
|
} & {
|
|
@@ -213,7 +213,7 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
|
|
|
213
213
|
code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
|
|
214
214
|
error?: unknown;
|
|
215
215
|
};
|
|
216
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
|
|
216
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
217
217
|
status: "error";
|
|
218
218
|
id: string;
|
|
219
219
|
tabId: number;
|
|
@@ -224,7 +224,7 @@ export declare const captchaSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObje
|
|
|
224
224
|
code: "HIT_LIMIT" | "MAX_RETRIES" | "UNEXPECTED_SERVER_RESPONSE" | "UNEXPECTED_ERROR";
|
|
225
225
|
error?: unknown;
|
|
226
226
|
};
|
|
227
|
-
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "recaptcha" | "textcaptcha" | "tiktok";
|
|
227
|
+
type: "aws" | "cloudflare" | "customcaptcha" | "datadome" | "funcaptcha" | "geetest" | "hcaptcha" | "lemincaptcha" | "mathcaptcha" | "recaptcha" | "textcaptcha" | "tiktok" | "temu";
|
|
228
228
|
status: "error";
|
|
229
229
|
id: string;
|
|
230
230
|
tabId: number;
|
|
@@ -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", "datadome", "funcaptcha", "geetest", "hcaptcha", "lemincaptcha", "recaptcha", "textcaptcha", "tiktok"]);
|
|
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({
|
|
@@ -11,7 +11,12 @@ declare class JwtTokenManager {
|
|
|
11
11
|
private refreshToken;
|
|
12
12
|
fetchWithToken(...[input, init]: Parameters<typeof fetch>): Promise<Response>;
|
|
13
13
|
get backendFunctionsBaseUrl(): string | undefined;
|
|
14
|
+
getBackendFunctionsBaseUrl(options?: {
|
|
15
|
+
allowMissingProjectId?: boolean;
|
|
16
|
+
}): string | undefined;
|
|
14
17
|
}
|
|
15
18
|
export declare const backendFunctionsTokenManager: JwtTokenManager;
|
|
16
|
-
export declare function callBackendFunctionWithToken(path: string, init?: Parameters<typeof fetch>[1]
|
|
19
|
+
export declare function callBackendFunctionWithToken(path: string, init?: Parameters<typeof fetch>[1], options?: {
|
|
20
|
+
allowMissingProjectId?: boolean;
|
|
21
|
+
}): Promise<Response>;
|
|
17
22
|
export {};
|
|
@@ -85,6 +85,9 @@ class JwtTokenManager {
|
|
|
85
85
|
return result;
|
|
86
86
|
}
|
|
87
87
|
get backendFunctionsBaseUrl() {
|
|
88
|
+
return this.getBackendFunctionsBaseUrl();
|
|
89
|
+
}
|
|
90
|
+
getBackendFunctionsBaseUrl(options) {
|
|
88
91
|
try {
|
|
89
92
|
if (!process.env.FUNCTIONS_DOMAIN) {
|
|
90
93
|
throw new Error(`Cannot call backend function - FUNCTIONS_DOMAIN not set`);
|
|
@@ -94,10 +97,13 @@ class JwtTokenManager {
|
|
|
94
97
|
throw new Error(`Cannot call backend function - ${_constants.WORKSPACE_ID_ENV_VAR_KEY} not set`);
|
|
95
98
|
}
|
|
96
99
|
const workspaceId = process.env[_constants.WORKSPACE_ID_ENV_VAR_KEY];
|
|
97
|
-
|
|
100
|
+
const projectId = process.env.INTUNED_INTEGRATION_ID ?? process.env[_constants.PROJECT_ID_ENV_VAR_KEY];
|
|
101
|
+
if (!projectId) {
|
|
102
|
+
if (options?.allowMissingProjectId) {
|
|
103
|
+
return `${domain}/api/${workspaceId}/functions`;
|
|
104
|
+
}
|
|
98
105
|
throw new Error(`Cannot call backend function - ${_constants.PROJECT_ID_ENV_VAR_KEY} or INTUNED_INTEGRATION_ID not set`);
|
|
99
106
|
}
|
|
100
|
-
const projectId = process.env.INTUNED_INTEGRATION_ID ?? process.env[_constants.PROJECT_ID_ENV_VAR_KEY];
|
|
101
107
|
return `${domain}/api/${workspaceId}/functions/${projectId}`;
|
|
102
108
|
} catch (e) {
|
|
103
109
|
if (process.env[_constants.CLI_ENV_VAR_KEY] === "true") {
|
|
@@ -108,6 +114,6 @@ class JwtTokenManager {
|
|
|
108
114
|
}
|
|
109
115
|
const backendFunctionsTokenManager = exports.backendFunctionsTokenManager = new JwtTokenManager(`refreshBackendFunctionsToken`);
|
|
110
116
|
backendFunctionsTokenManager.token = process.env.INTUNED_AUTHORING_SESSION_BACKEND_FUNCTIONS_TOKEN;
|
|
111
|
-
function callBackendFunctionWithToken(path, init) {
|
|
112
|
-
return backendFunctionsTokenManager.fetchWithToken(`${backendFunctionsTokenManager.
|
|
117
|
+
function callBackendFunctionWithToken(path, init, options) {
|
|
118
|
+
return backendFunctionsTokenManager.fetchWithToken(`${backendFunctionsTokenManager.getBackendFunctionsBaseUrl(options)}/${path}`, init);
|
|
113
119
|
}
|
|
@@ -31,6 +31,13 @@ export type LaunchChromiumStandaloneOptions = {
|
|
|
31
31
|
profileTemplatePath?: string;
|
|
32
32
|
encryptedProfile?: boolean;
|
|
33
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
|
+
};
|
|
34
41
|
};
|
|
35
42
|
export type LaunchChromiumCdpOptions = {
|
|
36
43
|
cdpAddress: string;
|
|
@@ -42,7 +49,10 @@ export type LaunchChromiumCdpOptions = {
|
|
|
42
49
|
export declare function launchChromium(options: LaunchChromiumStandaloneOptions): Promise<LaunchBrowserResult>;
|
|
43
50
|
export declare function launchChromium(options: LaunchChromiumCdpOptions): Promise<LaunchBrowserResult>;
|
|
44
51
|
export declare function getBrowserExecutablePath(): Promise<string | undefined>;
|
|
45
|
-
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>;
|
|
46
56
|
export declare function getLocalCdpAddress(port: number): string;
|
|
47
57
|
export declare function getCdpWebSocketUrl(cdpAddress: string): Promise<Result<string, string>>;
|
|
48
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,
|
|
@@ -152,7 +155,9 @@ async function launchChromium(options) {
|
|
|
152
155
|
ignoreHttpErrors: ignoreHttpErrorsParam,
|
|
153
156
|
profileTemplatePath,
|
|
154
157
|
encryptedProfile,
|
|
155
|
-
timeout
|
|
158
|
+
timeout,
|
|
159
|
+
browserArgs,
|
|
160
|
+
browserSize: browserSizeOption
|
|
156
161
|
} = options;
|
|
157
162
|
let {
|
|
158
163
|
executablePath
|
|
@@ -164,9 +169,8 @@ async function launchChromium(options) {
|
|
|
164
169
|
encryptedProfile
|
|
165
170
|
});
|
|
166
171
|
extraArgs.push(...encryptedProfileArgs);
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
extraArgs.push("--stealth-mode");
|
|
172
|
+
if (browserArgs) {
|
|
173
|
+
extraArgs.push(...browserArgs);
|
|
170
174
|
}
|
|
171
175
|
const userDataDir = await createUserDirWithPreferences(profileTemplatePath);
|
|
172
176
|
if ((0, _extensionsHelpers.isIntunedExtensionLoaded)()) {
|
|
@@ -198,7 +202,7 @@ async function launchChromium(options) {
|
|
|
198
202
|
executablePath = undefined;
|
|
199
203
|
}
|
|
200
204
|
}
|
|
201
|
-
const browserSize =
|
|
205
|
+
const browserSize = browserSizeOption ?? DEFAULT_BROWSER_SIZE;
|
|
202
206
|
extraArgs.push(`--window-size=${browserSize.width},${browserSize.height}`);
|
|
203
207
|
const viewport = null;
|
|
204
208
|
const userAgent = process.env.__PLAYWRIGHT_USER_AGENT_OVERRIDE ?? (await getHeadlessUserAgent({
|
|
@@ -247,30 +251,23 @@ async function launchChromium(options) {
|
|
|
247
251
|
context
|
|
248
252
|
};
|
|
249
253
|
}
|
|
250
|
-
async function getIntunedBrowserExecutablePath() {
|
|
251
|
-
const intunedPath = process.env.INTUNED_STEALTH_CHROMIUM_PATH;
|
|
252
|
-
if (intunedPath && (await fs.exists(intunedPath))) {
|
|
253
|
-
return intunedPath;
|
|
254
|
-
}
|
|
255
|
-
return undefined;
|
|
256
|
-
}
|
|
257
254
|
async function getBrowserExecutablePath() {
|
|
258
255
|
const browserType = getBrowserType();
|
|
259
256
|
if (browserType === "brave") {
|
|
260
257
|
return await getBraveExecutablePath();
|
|
261
258
|
}
|
|
262
|
-
const stealthConfig = await (0, _intunedJson.getStealthModeConfig)();
|
|
263
|
-
if (stealthConfig.enabled) {
|
|
264
|
-
return await getIntunedBrowserExecutablePath();
|
|
265
|
-
}
|
|
266
259
|
}
|
|
267
260
|
async function launchBrowser(options) {
|
|
268
261
|
if ("cdpAddress" in options) {
|
|
269
262
|
return launchChromium(options);
|
|
270
263
|
}
|
|
264
|
+
const {
|
|
265
|
+
browserPath,
|
|
266
|
+
...standaloneOptions
|
|
267
|
+
} = options;
|
|
271
268
|
return launchChromium({
|
|
272
|
-
...
|
|
273
|
-
executablePath: await getBrowserExecutablePath()
|
|
269
|
+
...standaloneOptions,
|
|
270
|
+
executablePath: browserPath ?? (await getBrowserExecutablePath())
|
|
274
271
|
});
|
|
275
272
|
}
|
|
276
273
|
function getBrowserType() {
|
|
@@ -20,6 +20,12 @@ export declare function withPlaywrightContext<R>(options: {
|
|
|
20
20
|
ignoreHttpErrors?: boolean;
|
|
21
21
|
profileTemplatePath?: string;
|
|
22
22
|
encryptedProfile?: boolean;
|
|
23
|
+
browserPath?: string;
|
|
24
|
+
browserArgs?: string[];
|
|
25
|
+
browserSize?: {
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
};
|
|
23
29
|
} & WithPlaywrightContextParameters, fn: WithPlaywrightContextWrappedFunction<R>): Promise<Ok<R, any> | Err<any, RunAutomationError>>;
|
|
24
30
|
export declare function withPlaywrightContext<R>(options: {
|
|
25
31
|
cdpAddress: string;
|
|
@@ -23,6 +23,9 @@ async function withPlaywrightContext({
|
|
|
23
23
|
ignoreHttpErrors: cliIgnoreHttpErrors,
|
|
24
24
|
profileTemplatePath,
|
|
25
25
|
encryptedProfile,
|
|
26
|
+
browserPath,
|
|
27
|
+
browserArgs,
|
|
28
|
+
browserSize,
|
|
26
29
|
importFunction,
|
|
27
30
|
apiName,
|
|
28
31
|
apiParameters
|
|
@@ -59,7 +62,10 @@ async function withPlaywrightContext({
|
|
|
59
62
|
downloadsPath,
|
|
60
63
|
ignoreHttpErrors,
|
|
61
64
|
profileTemplatePath,
|
|
62
|
-
encryptedProfile
|
|
65
|
+
encryptedProfile,
|
|
66
|
+
browserPath,
|
|
67
|
+
browserArgs,
|
|
68
|
+
browserSize
|
|
63
69
|
}));
|
|
64
70
|
}
|
|
65
71
|
return await fn(context, page);
|
|
@@ -90,7 +96,10 @@ async function withPlaywrightContext({
|
|
|
90
96
|
cdpPort: port,
|
|
91
97
|
ignoreHttpErrors,
|
|
92
98
|
profileTemplatePath,
|
|
93
|
-
encryptedProfile
|
|
99
|
+
encryptedProfile,
|
|
100
|
+
browserPath,
|
|
101
|
+
browserArgs,
|
|
102
|
+
browserSize
|
|
94
103
|
}));
|
|
95
104
|
hookCdpUrl = (0, _launchBrowser.getLocalCdpAddress)(port);
|
|
96
105
|
}
|
|
@@ -17,6 +17,7 @@ var _cleanEnvironmentVariables = require("../cleanEnvironmentVariables");
|
|
|
17
17
|
var _importUsingImportFunction = require("./importUsingImportFunction");
|
|
18
18
|
var _runtimeInterface = require("../../vendor/runtime-interface");
|
|
19
19
|
var _contextStorageStateHelpers = require("../contextStorageStateHelpers");
|
|
20
|
+
var _zod = require("zod");
|
|
20
21
|
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); }
|
|
21
22
|
function getObjectSizeInBytes(obj) {
|
|
22
23
|
try {
|
|
@@ -25,6 +26,12 @@ function getObjectSizeInBytes(obj) {
|
|
|
25
26
|
return new TextEncoder().encode(String(obj)).length;
|
|
26
27
|
}
|
|
27
28
|
}
|
|
29
|
+
const DEFAULT_MAX_RESULT_SIZE_BYTES = 2 * 1024 * 1024;
|
|
30
|
+
const MAX_RESULT_SIZE_BYTES_ENV_VAR = "__INTUNED__MAX_RESULT_SIZE_BYTES";
|
|
31
|
+
const maxResultSizeBytesSchema = _zod.z.coerce.number().positive().finite().transform(Math.floor).catch(DEFAULT_MAX_RESULT_SIZE_BYTES);
|
|
32
|
+
function getMaxResultSizeBytes() {
|
|
33
|
+
return maxResultSizeBytesSchema.parse(process.env[MAX_RESULT_SIZE_BYTES_ENV_VAR]);
|
|
34
|
+
}
|
|
28
35
|
async function runApi({
|
|
29
36
|
abortSignal,
|
|
30
37
|
importFunction,
|
|
@@ -43,7 +50,8 @@ async function runApi({
|
|
|
43
50
|
},
|
|
44
51
|
runOptions,
|
|
45
52
|
tracing,
|
|
46
|
-
auth
|
|
53
|
+
auth,
|
|
54
|
+
captchaSolver
|
|
47
55
|
} = inputParseResult.data;
|
|
48
56
|
const abortSymbol = Symbol("abort");
|
|
49
57
|
const abortPromise = new Promise(resolve => {
|
|
@@ -73,6 +81,9 @@ async function runApi({
|
|
|
73
81
|
importFunction
|
|
74
82
|
};
|
|
75
83
|
const intunedContext = (0, _asyncLocalStorage.getExecutionContext)();
|
|
84
|
+
if (intunedContext) {
|
|
85
|
+
intunedContext.captchaSolver = captchaSolver;
|
|
86
|
+
}
|
|
76
87
|
const runAutomationWithContext = async (context, page) => {
|
|
77
88
|
async function saveTraceIfNeeded({
|
|
78
89
|
errorMessage
|
|
@@ -113,10 +124,10 @@ async function runApi({
|
|
|
113
124
|
if (automationFunctionResult === abortSymbol) {
|
|
114
125
|
return (0, _neverthrow.err)(new _runtimeInterface.AbortedError());
|
|
115
126
|
}
|
|
116
|
-
const
|
|
127
|
+
const maxResultSizeBytes = getMaxResultSizeBytes();
|
|
117
128
|
const resultSizeInBytes = getObjectSizeInBytes(automationFunctionResult);
|
|
118
|
-
if (resultSizeInBytes >
|
|
119
|
-
return (0, _neverthrow.err)(new _runtimeInterface.ResultTooBigError(resultSizeInBytes,
|
|
129
|
+
if (resultSizeInBytes > maxResultSizeBytes) {
|
|
130
|
+
return (0, _neverthrow.err)(new _runtimeInterface.ResultTooBigError(resultSizeInBytes, maxResultSizeBytes));
|
|
120
131
|
}
|
|
121
132
|
if (retrieveSession) {
|
|
122
133
|
return (0, _neverthrow.ok)({
|
|
@@ -150,6 +161,9 @@ async function runApi({
|
|
|
150
161
|
ignoreHttpErrors: runOptions.ignoreHttpErrors,
|
|
151
162
|
profileTemplatePath: runOptions.profileTemplatePath,
|
|
152
163
|
encryptedProfile: runOptions.encryptedProfile,
|
|
164
|
+
browserPath: runOptions.browserPath,
|
|
165
|
+
browserArgs: runOptions.browserArgs,
|
|
166
|
+
browserSize: runOptions.browserSize,
|
|
153
167
|
...playwrightContextParameters
|
|
154
168
|
}, runAutomationWithContext);
|
|
155
169
|
} finally {
|