@intuned/runtime-dev 1.3.18-interface.13 → 1.3.18-interface.4
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/.babelrc +21 -0
- package/.eslintignore +10 -0
- package/.eslintrc.js +39 -0
- package/.turbo/turbo-build.log +2 -0
- package/WebTemplate.zip +0 -0
- package/dist/commands/api/run.d.ts +1 -3
- package/dist/commands/api/run.js +65 -2039
- package/dist/commands/auth-sessions/load.d.ts +1 -0
- package/dist/commands/auth-sessions/load.js +28 -1552
- package/dist/commands/auth-sessions/run-check.d.ts +1 -0
- package/dist/commands/auth-sessions/run-check.js +72 -1961
- package/dist/commands/auth-sessions/run-create.d.ts +1 -0
- package/dist/commands/auth-sessions/run-create.js +66 -1955
- package/dist/commands/browser/save-state.d.ts +1 -0
- package/dist/commands/browser/save-state.js +11 -102
- package/dist/commands/browser/start-browser.d.ts +1 -0
- package/dist/commands/browser/start-browser.js +9 -62
- package/dist/commands/build.d.ts +1 -2
- package/dist/commands/build.js +53 -172
- package/dist/commands/common/browserUtils.d.ts +14 -0
- package/dist/commands/common/browserUtils.js +58 -0
- package/dist/commands/common/getFirstLineNumber.d.ts +9 -0
- package/dist/commands/common/getFirstLineNumber.js +101 -0
- package/dist/commands/common/getFirstLineNumber.test.js +228 -0
- package/dist/commands/common/projectExclusions.d.ts +2 -0
- package/dist/commands/common/projectExclusions.js +8 -0
- package/dist/commands/common/sendMessageToClient.d.ts +1 -0
- package/dist/commands/common/sendMessageToClient.js +10 -0
- package/dist/commands/common/tsNodeImport.d.ts +2 -5
- package/dist/commands/common/tsNodeImport.js +16 -55
- package/dist/commands/common/utils/fileUtils.d.ts +6 -0
- package/dist/commands/common/utils/fileUtils.js +33 -0
- package/dist/commands/common/utils/interfaceClient.d.ts +31 -0
- package/dist/commands/common/utils/interfaceClient.js +99 -0
- package/dist/commands/common/utils/settings.d.ts +2 -0
- package/dist/commands/common/utils/settings.js +31 -0
- package/dist/commands/common/utils/template.d.ts +2 -0
- package/dist/commands/common/utils/template.js +31 -0
- package/dist/commands/get-headless-user-agent.d.ts +1 -2
- package/dist/commands/get-headless-user-agent.js +12 -348
- package/dist/commands/interface/pingPong.d.ts +2 -0
- package/dist/commands/interface/pingPong.js +11 -0
- package/dist/commands/interface/run.d.ts +1 -3
- package/dist/commands/interface/run.js +140 -2034
- package/dist/commands/interface/runApi.d.ts +1 -0
- package/dist/commands/interface/runApi.js +102 -0
- package/dist/commands/intuned-cli/commands/attempt.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/attempt.command.js +8 -0
- package/dist/commands/intuned-cli/commands/attempt_api.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/attempt_api.command.js +30 -0
- package/dist/commands/intuned-cli/commands/attempt_authsession.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +8 -0
- package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +19 -0
- package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +24 -0
- package/dist/commands/intuned-cli/commands/authsession.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/authsession.command.js +8 -0
- package/dist/commands/intuned-cli/commands/authsession_record.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/authsession_record.command.js +32 -0
- package/dist/commands/intuned-cli/commands/authsession_scaffold.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/authsession_scaffold.command.js +16 -0
- package/dist/commands/intuned-cli/commands/build.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/build.command.js +12 -0
- package/dist/commands/intuned-cli/commands/command.d.ts +2 -0
- package/dist/commands/intuned-cli/commands/command.js +9 -0
- package/dist/commands/intuned-cli/commands/deploy.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/deploy.command.js +42 -0
- package/dist/commands/intuned-cli/commands/index.d.ts +18 -0
- package/dist/commands/intuned-cli/commands/index.js +203 -0
- package/dist/commands/intuned-cli/commands/provision.command.d.ts +13 -0
- package/dist/commands/intuned-cli/commands/provision.command.js +50 -0
- package/dist/commands/intuned-cli/commands/run.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/run.command.js +8 -0
- package/dist/commands/intuned-cli/commands/run_api.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/run_api.command.js +46 -0
- package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +34 -0
- package/dist/commands/intuned-cli/commands/run_authsession.command.js +17 -0
- package/dist/commands/intuned-cli/commands/run_authsession_create.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +35 -0
- package/dist/commands/intuned-cli/commands/run_authsession_update.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +35 -0
- package/dist/commands/intuned-cli/commands/run_authsession_validate.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +33 -0
- package/dist/commands/intuned-cli/commands/types.d.ts +39 -0
- package/dist/commands/intuned-cli/commands/types.js +33 -0
- package/dist/commands/intuned-cli/constants/index.d.ts +17 -0
- package/dist/commands/intuned-cli/constants/index.js +25 -0
- package/dist/commands/intuned-cli/controller/__test__/api.test.js +398 -0
- package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +1060 -0
- package/dist/commands/intuned-cli/controller/api.d.ts +42 -0
- package/dist/commands/intuned-cli/controller/api.js +195 -0
- package/dist/commands/intuned-cli/controller/authSession.d.ts +209 -0
- package/dist/commands/intuned-cli/controller/authSession.js +425 -0
- package/dist/commands/intuned-cli/controller/build.d.ts +1 -0
- package/dist/commands/intuned-cli/controller/build.js +36 -0
- package/dist/commands/intuned-cli/controller/deploy.d.ts +5 -0
- package/dist/commands/intuned-cli/controller/deploy.js +318 -0
- package/dist/commands/intuned-cli/controller/index.d.ts +1 -0
- package/dist/commands/intuned-cli/controller/index.js +46 -0
- package/dist/commands/intuned-cli/controller/provision.d.ts +21 -0
- package/dist/commands/intuned-cli/controller/provision.js +300 -0
- package/dist/commands/intuned-cli/controller/scaffold.d.ts +1 -0
- package/dist/commands/intuned-cli/controller/scaffold.js +77 -0
- package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +152 -0
- package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +41 -0
- package/dist/commands/intuned-cli/helpers/api.d.ts +3 -0
- package/dist/commands/intuned-cli/helpers/api.js +16 -0
- package/dist/commands/intuned-cli/helpers/auth.d.ts +46 -0
- package/dist/commands/intuned-cli/helpers/auth.js +147 -0
- package/dist/commands/intuned-cli/helpers/backend.d.ts +8 -0
- package/dist/commands/intuned-cli/helpers/backend.js +35 -0
- package/dist/commands/intuned-cli/helpers/browser.d.ts +14 -0
- package/dist/commands/intuned-cli/helpers/browser.js +93 -0
- package/dist/commands/intuned-cli/helpers/context.d.ts +3 -0
- package/dist/commands/intuned-cli/helpers/context.js +33 -0
- package/dist/commands/intuned-cli/helpers/errors.d.ts +16 -0
- package/dist/commands/intuned-cli/helpers/errors.js +44 -0
- package/dist/commands/intuned-cli/helpers/index.d.ts +12 -0
- package/dist/commands/intuned-cli/helpers/index.js +137 -0
- package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +39 -0
- package/dist/commands/intuned-cli/helpers/intunedJson.js +20 -0
- package/dist/commands/intuned-cli/helpers/prompts.d.ts +3 -0
- package/dist/commands/intuned-cli/helpers/prompts.js +71 -0
- package/dist/commands/intuned-cli/helpers/proxy.d.ts +5 -0
- package/dist/commands/intuned-cli/helpers/proxy.js +23 -0
- package/dist/commands/intuned-cli/helpers/terminal.d.ts +5 -0
- package/dist/commands/intuned-cli/helpers/terminal.js +13 -0
- package/dist/commands/intuned-cli/helpers/timeout.d.ts +1 -0
- package/dist/commands/intuned-cli/helpers/timeout.js +23 -0
- package/dist/commands/intuned-cli/helpers/traces.d.ts +2 -0
- package/dist/commands/intuned-cli/helpers/traces.js +32 -0
- package/dist/commands/intuned-cli/helpers/validation.d.ts +2 -0
- package/dist/commands/intuned-cli/helpers/validation.js +14 -0
- package/dist/commands/intuned-cli/helpers/wrapper.d.ts +2 -0
- package/dist/commands/intuned-cli/helpers/wrapper.js +76 -0
- package/dist/commands/intuned-cli/index.d.ts +1 -0
- package/dist/commands/intuned-cli/index.js +16 -0
- package/dist/commands/intuned-cli/main.d.ts +1 -2
- package/dist/commands/intuned-cli/main.js +25 -5392
- package/dist/commands/intuned-cli/types.d.ts +70 -0
- package/dist/commands/intuned-cli/types.js +22 -0
- package/dist/commands/ts-check.d.ts +1 -0
- package/dist/commands/ts-check.js +29 -131
- package/dist/common/Logger/Logger/index.d.ts +12 -0
- package/dist/common/Logger/Logger/index.js +60 -0
- package/dist/common/Logger/Logger/types.d.ts +8 -0
- package/dist/common/Logger/Logger/types.js +5 -0
- package/dist/common/Logger/index.d.ts +12 -0
- package/dist/common/Logger/index.js +60 -0
- package/dist/common/Logger/types.d.ts +8 -0
- package/dist/common/Logger/types.js +5 -0
- package/dist/common/asyncLocalStorage/index.d.ts +8 -9
- package/dist/common/asyncLocalStorage/index.js +9 -33
- package/dist/common/backendFunctions/getAuthSessionParameters.d.ts +1 -0
- package/dist/common/backendFunctions/getAuthSessionParameters.js +38 -0
- package/dist/common/binStartupScript.d.ts +1 -2
- package/dist/common/binStartupScript.js +11 -126
- package/dist/common/browserTabs.d.ts +72 -0
- package/dist/common/browserTabs.js +74 -0
- package/dist/common/cleanEnvironmentVariables.d.ts +1 -3
- package/dist/common/cleanEnvironmentVariables.js +7 -29
- package/dist/common/constants.d.ts +11 -13
- package/dist/common/constants.js +15 -57
- package/dist/common/contextStorageStateHelpers.d.ts +6 -8
- package/dist/common/contextStorageStateHelpers.js +22 -46
- package/dist/common/extension/extensionsHelpers.d.ts +11 -0
- package/dist/common/extension/extensionsHelpers.js +147 -0
- package/dist/common/extension/intunedExtensionServer.d.ts +24 -0
- package/dist/common/extension/intunedExtensionServer.js +178 -0
- package/dist/common/extension/types.d.ts +212 -0
- package/dist/common/extension/types.js +51 -0
- package/dist/common/formatZodError.d.ts +2 -0
- package/dist/common/formatZodError.js +18 -0
- package/dist/common/intunedJson.d.ts +229 -0
- package/dist/common/intunedJson.js +133 -0
- package/dist/common/jwtTokenManager.d.ts +4 -6
- package/dist/common/jwtTokenManager.js +41 -107
- package/dist/common/launchBrowser.d.ts +34 -0
- package/dist/common/launchBrowser.js +248 -0
- package/dist/common/playwrightContext.d.ts +30 -0
- package/dist/common/playwrightContext.js +153 -0
- package/dist/common/runApi/importUsingImportFunction.d.ts +7 -0
- package/dist/common/runApi/importUsingImportFunction.js +46 -0
- package/dist/common/runApi/index.d.ts +6 -9
- package/dist/common/runApi/index.js +78 -1765
- package/dist/common/settingsSchema.d.ts +51 -58
- package/dist/common/settingsSchema.js +20 -54
- package/dist/common/setupContextHook.d.ts +16 -0
- package/dist/common/setupContextHook.js +22 -0
- package/dist/common/telemetry.d.ts +3 -6
- package/dist/common/telemetry.js +9 -40
- package/dist/index.d.ts +4 -6
- package/dist/index.js +92 -783
- package/dist/runtime/RunError.d.ts +5 -0
- package/dist/runtime/RunError.js +19 -0
- package/dist/runtime/attemptStore.d.ts +2 -0
- package/dist/runtime/attemptStore.js +23 -0
- package/dist/runtime/captcha.d.ts +15 -0
- package/dist/runtime/captcha.js +191 -0
- package/dist/runtime/captcha.test.js +821 -0
- package/dist/runtime/downloadDirectory.d.ts +1 -0
- package/dist/runtime/downloadDirectory.js +19 -0
- package/dist/runtime/enums.d.js +5 -0
- package/dist/runtime/enums.d.ts +11 -0
- package/dist/runtime/enums.js +18 -0
- package/dist/runtime/executionHelpers.test.js +52 -0
- package/dist/runtime/export.d.js +5 -0
- package/dist/runtime/export.d.ts +284 -0
- package/dist/runtime/extendPayload.d.ts +2 -0
- package/dist/runtime/extendPayload.js +21 -0
- package/dist/runtime/extendTimeout.d.ts +1 -0
- package/dist/runtime/extendTimeout.js +23 -0
- package/dist/runtime/getAiGatewayConfig.d.ts +10 -0
- package/dist/runtime/getAiGatewayConfig.js +16 -0
- package/dist/runtime/getAuthSessionParameters.d.ts +1 -0
- package/dist/runtime/getAuthSessionParameters.js +20 -0
- package/dist/runtime/index.d.ts +10 -168
- package/dist/runtime/index.js +88 -778
- package/dist/runtime/persistentStore.d.ts +2 -0
- package/dist/runtime/persistentStore.js +37 -0
- package/dist/runtime/persistentStore.test.js +101 -0
- package/dist/runtime/runInfo.d.ts +2 -0
- package/dist/runtime/runInfo.js +21 -0
- package/package.json +16 -77
- package/template.tsconfig.json +11 -0
- package/tsconfig.eslint.json +5 -0
- package/tsconfig.json +25 -0
- package/typedoc.json +49 -0
- package/dist/export.d-BAUMB-lG.d.ts +0 -140
|
@@ -1,132 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
-
for (let key of __getOwnPropNames(from))
|
|
10
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
11
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
-
}
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
-
mod
|
|
22
|
-
));
|
|
23
|
-
|
|
24
|
-
// src/common/binStartupScript.ts
|
|
25
|
-
var import_dotenv = __toESM(require("dotenv"));
|
|
26
|
-
var path2 = __toESM(require("path"));
|
|
27
|
-
|
|
28
|
-
// src/common/intunedJson.ts
|
|
29
|
-
var import_path = __toESM(require("path"));
|
|
30
|
-
var fs = __toESM(require("fs-extra"));
|
|
31
|
-
var import_zod = require("zod");
|
|
32
|
-
var JSONC = __toESM(require("jsonc-parser"));
|
|
33
|
-
var YAML = __toESM(require("yaml"));
|
|
34
|
-
var TOML = __toESM(require("smol-toml"));
|
|
35
|
-
var import_neverthrow = require("neverthrow");
|
|
36
|
-
var intunedJsonSchema = import_zod.z.object({
|
|
37
|
-
projectName: import_zod.z.string().optional(),
|
|
38
|
-
workspaceId: import_zod.z.string().optional(),
|
|
39
|
-
metadata: import_zod.z.object({
|
|
40
|
-
defaultJobInput: import_zod.z.record(import_zod.z.any()).optional().catch(void 0),
|
|
41
|
-
defaultRunPlaygroundInput: import_zod.z.record(import_zod.z.any()).optional().catch(void 0),
|
|
42
|
-
testAuthSessionInput: import_zod.z.record(import_zod.z.any()).optional().catch(void 0)
|
|
43
|
-
}).optional().catch(void 0),
|
|
44
|
-
stealthMode: import_zod.z.object({
|
|
45
|
-
enabled: import_zod.z.boolean()
|
|
46
|
-
}).optional().catch(void 0)
|
|
47
|
-
}).passthrough().and(
|
|
48
|
-
import_zod.z.union([
|
|
49
|
-
import_zod.z.object({
|
|
50
|
-
authSessions: import_zod.z.object({ enabled: import_zod.z.literal(false) }),
|
|
51
|
-
apiAccess: import_zod.z.object({
|
|
52
|
-
enabled: import_zod.z.literal(false)
|
|
53
|
-
})
|
|
54
|
-
}),
|
|
55
|
-
import_zod.z.object({
|
|
56
|
-
authSessions: import_zod.z.union([
|
|
57
|
-
import_zod.z.object({ enabled: import_zod.z.literal(false) }),
|
|
58
|
-
import_zod.z.object({
|
|
59
|
-
enabled: import_zod.z.literal(true),
|
|
60
|
-
type: import_zod.z.enum(["MANUAL", "API"]),
|
|
61
|
-
startUrl: import_zod.z.string().optional(),
|
|
62
|
-
finishUrl: import_zod.z.string().optional()
|
|
63
|
-
})
|
|
64
|
-
]),
|
|
65
|
-
apiAccess: import_zod.z.object({
|
|
66
|
-
enabled: import_zod.z.literal(true)
|
|
67
|
-
})
|
|
68
|
-
})
|
|
69
|
-
])
|
|
70
|
-
);
|
|
71
|
-
var intunedSettingsFileNames = [
|
|
72
|
-
"Intuned.json",
|
|
73
|
-
"Intuned.jsonc",
|
|
74
|
-
"Intuned.yaml",
|
|
75
|
-
"Intuned.yml",
|
|
76
|
-
"Intuned.toml"
|
|
77
|
-
];
|
|
78
|
-
var intunedSettingsParsers = {
|
|
79
|
-
"Intuned.json": JSON.parse,
|
|
80
|
-
"Intuned.jsonc": JSONC.parse,
|
|
81
|
-
"Intuned.yaml": YAML.parse,
|
|
82
|
-
"Intuned.yml": YAML.parse,
|
|
83
|
-
"Intuned.toml": TOML.parse
|
|
84
|
-
};
|
|
85
|
-
function loadIntunedJsonSync() {
|
|
86
|
-
const settingsFileResult = getIntunedSettingsFileSync();
|
|
87
|
-
if (!settingsFileResult.isOk()) {
|
|
88
|
-
return settingsFileResult;
|
|
89
|
-
}
|
|
90
|
-
const settingsFile = settingsFileResult.value;
|
|
91
|
-
const intunedJsonContent = fs.readFileSync(settingsFile.path, "utf-8");
|
|
92
|
-
let intunedJson;
|
|
93
|
-
try {
|
|
94
|
-
intunedJson = settingsFile.parse(intunedJsonContent);
|
|
95
|
-
} catch (e) {
|
|
96
|
-
return (0, import_neverthrow.err)(`Failed to parse ${settingsFile.name}: ${e.message}`);
|
|
97
|
-
}
|
|
98
|
-
const parseResult = intunedJsonSchema.safeParse(intunedJson);
|
|
99
|
-
if (!parseResult.success) {
|
|
100
|
-
const formattedError = parseResult.error.errors.map((e) => `- ${e.path.join(".")}: ${e.message}`).join("\n");
|
|
101
|
-
return (0, import_neverthrow.err)(
|
|
102
|
-
`${settingsFile.name} is not valid:
|
|
103
|
-
${formattedError}
|
|
104
|
-
Please fix the errors and try again.`
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
return (0, import_neverthrow.ok)(parseResult.data);
|
|
108
|
-
}
|
|
109
|
-
function getIntunedSettingsFileSync() {
|
|
110
|
-
for (const fileName of intunedSettingsFileNames) {
|
|
111
|
-
const filePath = import_path.default.join(process.cwd(), fileName);
|
|
112
|
-
if (fs.existsSync(filePath)) {
|
|
113
|
-
return (0, import_neverthrow.ok)({
|
|
114
|
-
name: fileName,
|
|
115
|
-
path: filePath,
|
|
116
|
-
parse: intunedSettingsParsers[fileName]
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return (0, import_neverthrow.err)("No Intuned settings file found.");
|
|
121
|
-
}
|
|
1
|
+
"use strict";
|
|
122
2
|
|
|
123
|
-
|
|
124
|
-
|
|
3
|
+
var _dotenv = _interopRequireDefault(require("dotenv"));
|
|
4
|
+
var path = _interopRequireWildcard(require("path"));
|
|
5
|
+
var _intunedJson = require("./intunedJson");
|
|
6
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
7
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
_dotenv.default.config({
|
|
125
10
|
path: `.env`
|
|
126
11
|
});
|
|
127
12
|
function isStealthModeEnabled() {
|
|
128
13
|
try {
|
|
129
|
-
const settingsResult = loadIntunedJsonSync();
|
|
14
|
+
const settingsResult = (0, _intunedJson.loadIntunedJsonSync)();
|
|
130
15
|
if (settingsResult.isErr()) {
|
|
131
16
|
console.error(`Warning: Failed to load Intuned settings: ${settingsResult.error}
|
|
132
17
|
Stealth mode will not be enabled.`);
|
|
@@ -140,7 +25,7 @@ Stealth mode will not be enabled.`);
|
|
|
140
25
|
}
|
|
141
26
|
try {
|
|
142
27
|
if (isStealthModeEnabled()) {
|
|
143
|
-
const currentNodeModules =
|
|
28
|
+
const currentNodeModules = path.resolve(process.cwd(), "node_modules");
|
|
144
29
|
process.env.NODE_PATH = process.env.NODE_PATH ? `${process.env.NODE_PATH}:${currentNodeModules}` : currentNodeModules;
|
|
145
30
|
require("module").Module._initPaths();
|
|
146
31
|
if (process.env.PLAYWRIGHT_PATCH_SCRIPT_PATH) {
|
|
@@ -149,4 +34,4 @@ try {
|
|
|
149
34
|
}
|
|
150
35
|
} catch (e) {
|
|
151
36
|
console.error("Failed to apply stealth mode");
|
|
152
|
-
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tab management utilities using CDP HTTP API.
|
|
3
|
+
*
|
|
4
|
+
* Provides functions to interact with browser tabs via Chrome DevTools Protocol HTTP endpoints.
|
|
5
|
+
* Refer to https://chromedevtools.github.io/devtools-protocol/ for the endpoints documentation.
|
|
6
|
+
* This approach is simpler than using the playwright API because it doesn't require us to create a playwright context.
|
|
7
|
+
*/
|
|
8
|
+
export interface CDPTabInfo {
|
|
9
|
+
id: string;
|
|
10
|
+
type: string;
|
|
11
|
+
title: string;
|
|
12
|
+
url: string;
|
|
13
|
+
webSocketDebuggerUrl?: string;
|
|
14
|
+
devtoolsFrontendUrl?: string;
|
|
15
|
+
faviconUrl?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Fetch current tabs from CDP /json endpoint.
|
|
20
|
+
*
|
|
21
|
+
* @param cdpAddress - CDP address (e.g., "http://localhost:9222")
|
|
22
|
+
* @returns List of tab info dictionaries from CDP (filtered to only "page" type)
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const tabs = await getCDPTabs("http://localhost:9222");
|
|
26
|
+
* // Returns:
|
|
27
|
+
* // [
|
|
28
|
+
* // {
|
|
29
|
+
* // "id": "1234",
|
|
30
|
+
* // "type": "page",
|
|
31
|
+
* // "title": "Google",
|
|
32
|
+
* // "url": "https://google.com",
|
|
33
|
+
* // ...
|
|
34
|
+
* // }
|
|
35
|
+
* // ]
|
|
36
|
+
*/
|
|
37
|
+
export declare function getCDPTabs(cdpAddress: string): Promise<CDPTabInfo[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Create new tab via CDP /json/new endpoint with optional URL.
|
|
40
|
+
*
|
|
41
|
+
* @param cdpAddress - CDP address (e.g., "http://localhost:9222")
|
|
42
|
+
* @param url - Initial URL for the tab (default: "about:blank")
|
|
43
|
+
* @returns Tab info dictionary from CDP
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* const tab = await createCDPTab("http://localhost:9222", "https://google.com");
|
|
47
|
+
* // Returns:
|
|
48
|
+
* // {
|
|
49
|
+
* // "id": "1234",
|
|
50
|
+
* // "type": "page",
|
|
51
|
+
* // "title": "New Tab",
|
|
52
|
+
* // "url": "about:blank",
|
|
53
|
+
* // ...
|
|
54
|
+
* // }
|
|
55
|
+
*/
|
|
56
|
+
export declare function createCDPTab(cdpAddress: string, url?: string): Promise<CDPTabInfo>;
|
|
57
|
+
/**
|
|
58
|
+
* Close tab via CDP /json/close/{id} endpoint.
|
|
59
|
+
*
|
|
60
|
+
* @param cdpAddress - CDP address (e.g., "http://localhost:9222")
|
|
61
|
+
* @param cdpTargetId - Full CDP target ID to close
|
|
62
|
+
* @returns True if successful, False otherwise
|
|
63
|
+
*/
|
|
64
|
+
export declare function closeCDPTab(cdpAddress: string, cdpTargetId: string): Promise<boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* Activate/bring to front a tab via CDP /json/activate/{id} endpoint.
|
|
67
|
+
*
|
|
68
|
+
* @param cdpAddress - CDP address (e.g., "http://localhost:9222")
|
|
69
|
+
* @param cdpTargetId - Full CDP target ID to activate
|
|
70
|
+
* @returns True if successful, False otherwise
|
|
71
|
+
*/
|
|
72
|
+
export declare function activateCDPTab(cdpAddress: string, cdpTargetId: string): Promise<boolean>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.activateCDPTab = activateCDPTab;
|
|
7
|
+
exports.closeCDPTab = closeCDPTab;
|
|
8
|
+
exports.createCDPTab = createCDPTab;
|
|
9
|
+
exports.getCDPTabs = getCDPTabs;
|
|
10
|
+
const DEFAULT_TIMEOUT = 5000;
|
|
11
|
+
async function getCDPTabs(cdpAddress) {
|
|
12
|
+
const controller = new AbortController();
|
|
13
|
+
const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT);
|
|
14
|
+
try {
|
|
15
|
+
const response = await fetch(`${cdpAddress}/json`, {
|
|
16
|
+
signal: controller.signal
|
|
17
|
+
});
|
|
18
|
+
if (!response.ok) {
|
|
19
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
20
|
+
}
|
|
21
|
+
const tabs = await response.json();
|
|
22
|
+
return tabs.filter(tab => tab.type === "page");
|
|
23
|
+
} finally {
|
|
24
|
+
clearTimeout(timeoutId);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async function createCDPTab(cdpAddress, url = "about:blank") {
|
|
28
|
+
const controller = new AbortController();
|
|
29
|
+
const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT);
|
|
30
|
+
try {
|
|
31
|
+
let endpoint = `${cdpAddress}/json/new`;
|
|
32
|
+
if (url && url !== "about:blank") {
|
|
33
|
+
endpoint = `${endpoint}?${url}`;
|
|
34
|
+
}
|
|
35
|
+
const response = await fetch(endpoint, {
|
|
36
|
+
method: "PUT",
|
|
37
|
+
signal: controller.signal
|
|
38
|
+
});
|
|
39
|
+
if (!response.ok) {
|
|
40
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
41
|
+
}
|
|
42
|
+
return await response.json();
|
|
43
|
+
} finally {
|
|
44
|
+
clearTimeout(timeoutId);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function closeCDPTab(cdpAddress, cdpTargetId) {
|
|
48
|
+
const controller = new AbortController();
|
|
49
|
+
const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT);
|
|
50
|
+
try {
|
|
51
|
+
const response = await fetch(`${cdpAddress}/json/close/${cdpTargetId}`, {
|
|
52
|
+
signal: controller.signal
|
|
53
|
+
});
|
|
54
|
+
return response.status === 200;
|
|
55
|
+
} catch {
|
|
56
|
+
return false;
|
|
57
|
+
} finally {
|
|
58
|
+
clearTimeout(timeoutId);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async function activateCDPTab(cdpAddress, cdpTargetId) {
|
|
62
|
+
const controller = new AbortController();
|
|
63
|
+
const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT);
|
|
64
|
+
try {
|
|
65
|
+
const response = await fetch(`${cdpAddress}/json/activate/${cdpTargetId}`, {
|
|
66
|
+
signal: controller.signal
|
|
67
|
+
});
|
|
68
|
+
return response.status === 200;
|
|
69
|
+
} catch {
|
|
70
|
+
return false;
|
|
71
|
+
} finally {
|
|
72
|
+
clearTimeout(timeoutId);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -1,38 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";
|
|
18
2
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
__export(cleanEnvironmentVariables_exports, {
|
|
22
|
-
cleanEnvironmentVariables: () => cleanEnvironmentVariables
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
23
5
|
});
|
|
24
|
-
|
|
6
|
+
exports.cleanEnvironmentVariables = cleanEnvironmentVariables;
|
|
25
7
|
function cleanEnvironmentVariables() {
|
|
26
|
-
Object.keys(process.env).filter(
|
|
8
|
+
Object.keys(process.env).filter(i => {
|
|
27
9
|
if (i.toLocaleLowerCase().startsWith("npm")) {
|
|
28
10
|
return true;
|
|
29
11
|
}
|
|
30
12
|
if (i.toLocaleLowerCase().startsWith("fly") && i !== "FLY_ALLOC_ID") {
|
|
31
13
|
return true;
|
|
32
14
|
}
|
|
33
|
-
}).forEach(
|
|
34
|
-
}
|
|
35
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
-
0 && (module.exports = {
|
|
37
|
-
cleanEnvironmentVariables
|
|
38
|
-
});
|
|
15
|
+
}).forEach(i => delete process.env[i]);
|
|
16
|
+
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
declare const API_FOLDER_NAME = "api";
|
|
2
|
-
declare const AUTH_SESSIONS_FOLDER_NAME = "auth-sessions";
|
|
3
|
-
declare const AUTH_SESSIONS_INSTANCES_FOLDER_NAME = "auth-sessions-instances";
|
|
4
|
-
declare const WORKSPACE_ID_ENV_VAR_KEY = "INTUNED_WORKSPACE_ID";
|
|
5
|
-
declare const EXTENSION_PATH_ENV_VAR_KEY = "INTUNED_EXTENSION_PATH";
|
|
6
|
-
declare const PROJECT_ID_ENV_VAR_KEY = "INTUNED_PROJECT_ID";
|
|
7
|
-
declare const API_KEY_ENV_VAR_KEY = "INTUNED_API_KEY";
|
|
8
|
-
declare const AUTH_TOKEN_ENV_VAR_KEY = "INTUNED_AUTH_TOKEN";
|
|
9
|
-
declare const API_KEY_HEADER_NAME = "x-api-key";
|
|
10
|
-
declare const API_BASE_URL_ENV_VAR_KEY = "INTUNED_API_BASE_URL";
|
|
11
|
-
declare const CLI_ENV_VAR_KEY = "INTUNED_CLI";
|
|
12
|
-
|
|
13
|
-
export { API_BASE_URL_ENV_VAR_KEY, API_FOLDER_NAME, API_KEY_ENV_VAR_KEY, API_KEY_HEADER_NAME, AUTH_SESSIONS_FOLDER_NAME, AUTH_SESSIONS_INSTANCES_FOLDER_NAME, AUTH_TOKEN_ENV_VAR_KEY, CLI_ENV_VAR_KEY, EXTENSION_PATH_ENV_VAR_KEY, PROJECT_ID_ENV_VAR_KEY, WORKSPACE_ID_ENV_VAR_KEY };
|
|
1
|
+
export declare const API_FOLDER_NAME = "api";
|
|
2
|
+
export declare const AUTH_SESSIONS_FOLDER_NAME = "auth-sessions";
|
|
3
|
+
export declare const AUTH_SESSIONS_INSTANCES_FOLDER_NAME = "auth-sessions-instances";
|
|
4
|
+
export declare const WORKSPACE_ID_ENV_VAR_KEY = "INTUNED_WORKSPACE_ID";
|
|
5
|
+
export declare const EXTENSION_PATH_ENV_VAR_KEY = "INTUNED_EXTENSION_PATH";
|
|
6
|
+
export declare const PROJECT_ID_ENV_VAR_KEY = "INTUNED_PROJECT_ID";
|
|
7
|
+
export declare const API_KEY_ENV_VAR_KEY = "INTUNED_API_KEY";
|
|
8
|
+
export declare const AUTH_TOKEN_ENV_VAR_KEY = "INTUNED_AUTH_TOKEN";
|
|
9
|
+
export declare const API_KEY_HEADER_NAME = "x-api-key";
|
|
10
|
+
export declare const API_BASE_URL_ENV_VAR_KEY = "INTUNED_API_BASE_URL";
|
|
11
|
+
export declare const CLI_ENV_VAR_KEY = "INTUNED_CLI";
|
package/dist/common/constants.js
CHANGED
|
@@ -1,59 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";
|
|
18
2
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
__export(constants_exports, {
|
|
22
|
-
API_BASE_URL_ENV_VAR_KEY: () => API_BASE_URL_ENV_VAR_KEY,
|
|
23
|
-
API_FOLDER_NAME: () => API_FOLDER_NAME,
|
|
24
|
-
API_KEY_ENV_VAR_KEY: () => API_KEY_ENV_VAR_KEY,
|
|
25
|
-
API_KEY_HEADER_NAME: () => API_KEY_HEADER_NAME,
|
|
26
|
-
AUTH_SESSIONS_FOLDER_NAME: () => AUTH_SESSIONS_FOLDER_NAME,
|
|
27
|
-
AUTH_SESSIONS_INSTANCES_FOLDER_NAME: () => AUTH_SESSIONS_INSTANCES_FOLDER_NAME,
|
|
28
|
-
AUTH_TOKEN_ENV_VAR_KEY: () => AUTH_TOKEN_ENV_VAR_KEY,
|
|
29
|
-
CLI_ENV_VAR_KEY: () => CLI_ENV_VAR_KEY,
|
|
30
|
-
EXTENSION_PATH_ENV_VAR_KEY: () => EXTENSION_PATH_ENV_VAR_KEY,
|
|
31
|
-
PROJECT_ID_ENV_VAR_KEY: () => PROJECT_ID_ENV_VAR_KEY,
|
|
32
|
-
WORKSPACE_ID_ENV_VAR_KEY: () => WORKSPACE_ID_ENV_VAR_KEY
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(constants_exports);
|
|
35
|
-
var API_FOLDER_NAME = "api";
|
|
36
|
-
var AUTH_SESSIONS_FOLDER_NAME = "auth-sessions";
|
|
37
|
-
var AUTH_SESSIONS_INSTANCES_FOLDER_NAME = "auth-sessions-instances";
|
|
38
|
-
var WORKSPACE_ID_ENV_VAR_KEY = "INTUNED_WORKSPACE_ID";
|
|
39
|
-
var EXTENSION_PATH_ENV_VAR_KEY = "INTUNED_EXTENSION_PATH";
|
|
40
|
-
var PROJECT_ID_ENV_VAR_KEY = "INTUNED_PROJECT_ID";
|
|
41
|
-
var API_KEY_ENV_VAR_KEY = "INTUNED_API_KEY";
|
|
42
|
-
var AUTH_TOKEN_ENV_VAR_KEY = "INTUNED_AUTH_TOKEN";
|
|
43
|
-
var API_KEY_HEADER_NAME = "x-api-key";
|
|
44
|
-
var API_BASE_URL_ENV_VAR_KEY = "INTUNED_API_BASE_URL";
|
|
45
|
-
var CLI_ENV_VAR_KEY = "INTUNED_CLI";
|
|
46
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
-
0 && (module.exports = {
|
|
48
|
-
API_BASE_URL_ENV_VAR_KEY,
|
|
49
|
-
API_FOLDER_NAME,
|
|
50
|
-
API_KEY_ENV_VAR_KEY,
|
|
51
|
-
API_KEY_HEADER_NAME,
|
|
52
|
-
AUTH_SESSIONS_FOLDER_NAME,
|
|
53
|
-
AUTH_SESSIONS_INSTANCES_FOLDER_NAME,
|
|
54
|
-
AUTH_TOKEN_ENV_VAR_KEY,
|
|
55
|
-
CLI_ENV_VAR_KEY,
|
|
56
|
-
EXTENSION_PATH_ENV_VAR_KEY,
|
|
57
|
-
PROJECT_ID_ENV_VAR_KEY,
|
|
58
|
-
WORKSPACE_ID_ENV_VAR_KEY
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
59
5
|
});
|
|
6
|
+
exports.WORKSPACE_ID_ENV_VAR_KEY = exports.PROJECT_ID_ENV_VAR_KEY = exports.EXTENSION_PATH_ENV_VAR_KEY = exports.CLI_ENV_VAR_KEY = exports.AUTH_TOKEN_ENV_VAR_KEY = exports.AUTH_SESSIONS_INSTANCES_FOLDER_NAME = exports.AUTH_SESSIONS_FOLDER_NAME = exports.API_KEY_HEADER_NAME = exports.API_KEY_ENV_VAR_KEY = exports.API_FOLDER_NAME = exports.API_BASE_URL_ENV_VAR_KEY = void 0;
|
|
7
|
+
const API_FOLDER_NAME = exports.API_FOLDER_NAME = "api";
|
|
8
|
+
const AUTH_SESSIONS_FOLDER_NAME = exports.AUTH_SESSIONS_FOLDER_NAME = "auth-sessions";
|
|
9
|
+
const AUTH_SESSIONS_INSTANCES_FOLDER_NAME = exports.AUTH_SESSIONS_INSTANCES_FOLDER_NAME = "auth-sessions-instances";
|
|
10
|
+
const WORKSPACE_ID_ENV_VAR_KEY = exports.WORKSPACE_ID_ENV_VAR_KEY = "INTUNED_WORKSPACE_ID";
|
|
11
|
+
const EXTENSION_PATH_ENV_VAR_KEY = exports.EXTENSION_PATH_ENV_VAR_KEY = "INTUNED_EXTENSION_PATH";
|
|
12
|
+
const PROJECT_ID_ENV_VAR_KEY = exports.PROJECT_ID_ENV_VAR_KEY = "INTUNED_PROJECT_ID";
|
|
13
|
+
const API_KEY_ENV_VAR_KEY = exports.API_KEY_ENV_VAR_KEY = "INTUNED_API_KEY";
|
|
14
|
+
const AUTH_TOKEN_ENV_VAR_KEY = exports.AUTH_TOKEN_ENV_VAR_KEY = "INTUNED_AUTH_TOKEN";
|
|
15
|
+
const API_KEY_HEADER_NAME = exports.API_KEY_HEADER_NAME = "x-api-key";
|
|
16
|
+
const API_BASE_URL_ENV_VAR_KEY = exports.API_BASE_URL_ENV_VAR_KEY = "INTUNED_API_BASE_URL";
|
|
17
|
+
const CLI_ENV_VAR_KEY = exports.CLI_ENV_VAR_KEY = "INTUNED_CLI";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as playwright from
|
|
2
|
-
import { RunApiStorageState } from
|
|
3
|
-
|
|
1
|
+
import type * as playwright from "playwright";
|
|
2
|
+
import type { RunApiStorageState } from "@intuned/runtime-interface";
|
|
4
3
|
interface StorageEntry {
|
|
5
4
|
name: string;
|
|
6
5
|
value: string;
|
|
@@ -13,12 +12,11 @@ interface SessionStorageState {
|
|
|
13
12
|
origin: string;
|
|
14
13
|
sessionStorage: StorageEntry[];
|
|
15
14
|
}
|
|
16
|
-
interface StorageState {
|
|
15
|
+
export interface StorageState {
|
|
17
16
|
cookies?: playwright.Cookie[] | null;
|
|
18
17
|
origins?: LocalStorageState[] | null;
|
|
19
18
|
sessionStorage?: SessionStorageState[] | null;
|
|
20
19
|
}
|
|
21
|
-
declare function setStorageState(context: playwright.BrowserContext, state: RunApiStorageState): Promise<void>;
|
|
22
|
-
declare function getStorageState(context: playwright.BrowserContext): Promise<RunApiStorageState>;
|
|
23
|
-
|
|
24
|
-
export { type StorageState, getStorageState, setStorageState };
|
|
20
|
+
export declare function setStorageState(context: playwright.BrowserContext, state: RunApiStorageState): Promise<void>;
|
|
21
|
+
export declare function getStorageState(context: playwright.BrowserContext): Promise<RunApiStorageState>;
|
|
22
|
+
export {};
|
|
@@ -1,28 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";
|
|
18
2
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
__export(contextStorageStateHelpers_exports, {
|
|
22
|
-
getStorageState: () => getStorageState,
|
|
23
|
-
setStorageState: () => setStorageState
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
24
5
|
});
|
|
25
|
-
|
|
6
|
+
exports.getStorageState = getStorageState;
|
|
7
|
+
exports.setStorageState = setStorageState;
|
|
26
8
|
async function setStorageState(context, state) {
|
|
27
9
|
if ("cookies" in state && state.cookies) {
|
|
28
10
|
await context.addCookies(state.cookies);
|
|
@@ -31,23 +13,17 @@ async function setStorageState(context, state) {
|
|
|
31
13
|
if ("origins" in state && state.origins) {
|
|
32
14
|
for (const originData of state.origins || []) {
|
|
33
15
|
const origin = originData.origin;
|
|
34
|
-
await page.route(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
status: 200
|
|
40
|
-
})
|
|
41
|
-
);
|
|
16
|
+
await page.route(`${origin}/*`, route => route.fulfill({
|
|
17
|
+
body: "<html><head><title>Set Storage</title></head><body><h1>Set Storage</h1></body></html>",
|
|
18
|
+
contentType: "text/html",
|
|
19
|
+
status: 200
|
|
20
|
+
}));
|
|
42
21
|
try {
|
|
43
22
|
await page.goto(origin);
|
|
44
23
|
for (const item of originData.localStorage) {
|
|
45
|
-
await page.evaluate(
|
|
46
|
-
(
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
[item.name, item.value]
|
|
50
|
-
);
|
|
24
|
+
await page.evaluate(([key, value]) => {
|
|
25
|
+
window.localStorage.setItem(key, value);
|
|
26
|
+
}, [item.name, item.value]);
|
|
51
27
|
}
|
|
52
28
|
} finally {
|
|
53
29
|
await page.unroute(`${origin}/*`);
|
|
@@ -55,8 +31,11 @@ async function setStorageState(context, state) {
|
|
|
55
31
|
}
|
|
56
32
|
}
|
|
57
33
|
if ("sessionStorage" in state && state.sessionStorage) {
|
|
58
|
-
await context.addInitScript(
|
|
59
|
-
for (const {
|
|
34
|
+
await context.addInitScript(storage => {
|
|
35
|
+
for (const {
|
|
36
|
+
origin,
|
|
37
|
+
sessionStorage
|
|
38
|
+
} of storage) {
|
|
60
39
|
if (window.location.origin === origin) {
|
|
61
40
|
for (const item of sessionStorage) {
|
|
62
41
|
const value = window.sessionStorage.getItem(item.name);
|
|
@@ -84,7 +63,9 @@ async function getStorageState(context) {
|
|
|
84
63
|
if (page.isClosed()) continue;
|
|
85
64
|
try {
|
|
86
65
|
const sessionData = await page.evaluate(() => {
|
|
87
|
-
const items = {
|
|
66
|
+
const items = {
|
|
67
|
+
...window.sessionStorage
|
|
68
|
+
};
|
|
88
69
|
return {
|
|
89
70
|
origin: window.location.origin,
|
|
90
71
|
sessionStorage: Object.entries(items).map(([name, value]) => ({
|
|
@@ -100,9 +81,4 @@ async function getStorageState(context) {
|
|
|
100
81
|
}
|
|
101
82
|
result["sessionStorage"] = sessionDataList;
|
|
102
83
|
return result;
|
|
103
|
-
}
|
|
104
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
105
|
-
0 && (module.exports = {
|
|
106
|
-
getStorageState,
|
|
107
|
-
setStorageState
|
|
108
|
-
});
|
|
84
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as playwright from "playwright";
|
|
2
|
+
import { CaptchaSolverSettings, CaptchaSolverSettingsWithRunContext } from "../settingsSchema";
|
|
3
|
+
export declare function resolveCaptchaSolverSettings(input?: unknown): Promise<CaptchaSolverSettings>;
|
|
4
|
+
export declare function isIntunedExtensionLoaded(): boolean;
|
|
5
|
+
export declare function buildExtensionsList(): string[];
|
|
6
|
+
export declare function getIntunedExtensionPath(): string;
|
|
7
|
+
export declare function isIntunedExtensionEnabled(): Promise<boolean>;
|
|
8
|
+
export declare function getIntunedExtensionWorker(context: playwright.BrowserContext): Promise<playwright.Worker | null>;
|
|
9
|
+
export declare function getIntunedExtensionSettings(captchaSolverSettings: CaptchaSolverSettings): Promise<CaptchaSolverSettingsWithRunContext>;
|
|
10
|
+
export declare function getIntunedCaptchaSolverSettings(): Promise<CaptchaSolverSettings>;
|
|
11
|
+
export declare function setupIntunedExtension(): Promise<void>;
|