@intuned/runtime 1.3.16 → 1.3.18-interface.6
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/bin/intuned +0 -0
- package/bin/intuned-interface +7 -0
- package/dist/chunk-6ZRJOUQS.mjs +16 -0
- package/dist/chunk-6ZRJOUQS.mjs.map +1 -0
- package/dist/chunk-7YL2JUTE.mjs +146 -0
- package/dist/chunk-7YL2JUTE.mjs.map +1 -0
- package/dist/chunk-B3T6RXPC.mjs +794 -0
- package/dist/chunk-B3T6RXPC.mjs.map +1 -0
- package/dist/chunk-FGV5T6SI.mjs +27 -0
- package/dist/chunk-FGV5T6SI.mjs.map +1 -0
- package/dist/chunk-G4PO5RIV.mjs +85 -0
- package/dist/chunk-G4PO5RIV.mjs.map +1 -0
- package/dist/chunk-LZOMFHX3.mjs +38 -0
- package/dist/chunk-LZOMFHX3.mjs.map +1 -0
- package/dist/{common/formatZodError.js → chunk-NDMVGENG.mjs} +9 -9
- package/dist/chunk-NDMVGENG.mjs.map +1 -0
- package/dist/chunk-W4UX6G4X.mjs +17 -0
- package/dist/chunk-W4UX6G4X.mjs.map +1 -0
- package/dist/chunk-XC75QGFG.mjs +1106 -0
- package/dist/chunk-XC75QGFG.mjs.map +1 -0
- package/dist/chunk-XOAZ2MGA.mjs +59 -0
- package/dist/chunk-XOAZ2MGA.mjs.map +1 -0
- package/dist/commands/interface/run.d.mts +3 -0
- package/dist/commands/interface/run.d.ts +3 -1
- package/dist/commands/interface/run.js +2060 -178
- package/dist/commands/interface/run.js.map +1 -0
- package/dist/commands/interface/run.mjs +255 -0
- package/dist/commands/interface/run.mjs.map +1 -0
- package/dist/common/asyncLocalStorage/index.d.mts +17 -0
- package/dist/common/asyncLocalStorage/index.d.ts +9 -8
- package/dist/common/asyncLocalStorage/index.js +34 -9
- package/dist/common/asyncLocalStorage/index.js.map +1 -0
- package/dist/common/asyncLocalStorage/index.mjs +12 -0
- package/dist/common/asyncLocalStorage/index.mjs.map +1 -0
- package/dist/common/binStartupScript.d.mts +2 -0
- package/dist/common/binStartupScript.d.ts +2 -1
- package/dist/common/binStartupScript.js +127 -11
- package/dist/common/binStartupScript.js.map +1 -0
- package/dist/common/binStartupScript.mjs +135 -0
- package/dist/common/binStartupScript.mjs.map +1 -0
- package/dist/common/cleanEnvironmentVariables.d.mts +3 -0
- package/dist/common/cleanEnvironmentVariables.d.ts +3 -1
- package/dist/common/cleanEnvironmentVariables.js +30 -7
- package/dist/common/cleanEnvironmentVariables.js.map +1 -0
- package/dist/common/cleanEnvironmentVariables.mjs +8 -0
- package/dist/common/cleanEnvironmentVariables.mjs.map +1 -0
- package/dist/common/constants.d.mts +13 -0
- package/dist/common/constants.d.ts +13 -10
- package/dist/common/constants.js +58 -14
- package/dist/common/constants.js.map +1 -0
- package/dist/common/constants.mjs +28 -0
- package/dist/common/constants.mjs.map +1 -0
- package/dist/common/contextStorageStateHelpers.d.mts +24 -0
- package/dist/common/contextStorageStateHelpers.d.ts +8 -5
- package/dist/common/contextStorageStateHelpers.js +51 -23
- package/dist/common/contextStorageStateHelpers.js.map +1 -0
- package/dist/common/contextStorageStateHelpers.mjs +10 -0
- package/dist/common/contextStorageStateHelpers.mjs.map +1 -0
- package/dist/common/jwtTokenManager.d.mts +19 -0
- package/dist/common/jwtTokenManager.d.ts +6 -4
- package/dist/common/jwtTokenManager.js +112 -40
- package/dist/common/jwtTokenManager.js.map +1 -0
- package/dist/common/jwtTokenManager.mjs +11 -0
- package/dist/common/jwtTokenManager.mjs.map +1 -0
- package/dist/common/runApi/index.d.mts +11 -0
- package/dist/common/runApi/index.d.ts +10 -10
- package/dist/common/runApi/index.js +1776 -93
- package/dist/common/runApi/index.js.map +1 -0
- package/dist/common/runApi/index.mjs +18 -0
- package/dist/common/runApi/index.mjs.map +1 -0
- package/dist/common/settingsSchema.d.mts +536 -0
- package/dist/common/settingsSchema.d.ts +9 -6
- package/dist/common/settingsSchema.js +55 -20
- package/dist/common/settingsSchema.js.map +1 -0
- package/dist/common/settingsSchema.mjs +10 -0
- package/dist/common/settingsSchema.mjs.map +1 -0
- package/dist/common/telemetry.d.mts +6 -0
- package/dist/common/telemetry.d.ts +6 -3
- package/dist/common/telemetry.js +41 -9
- package/dist/common/telemetry.js.map +1 -0
- package/dist/common/telemetry.mjs +31 -0
- package/dist/common/telemetry.mjs.map +1 -0
- package/dist/export.d-BAUMB-lG.d.mts +140 -0
- package/dist/export.d-BAUMB-lG.d.ts +140 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.js +783 -98
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +47 -0
- package/dist/index.mjs.map +1 -0
- package/dist/runtime/index.d.mts +163 -0
- package/dist/runtime/index.d.ts +163 -10
- package/dist/runtime/index.js +779 -88
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/index.mjs +42 -0
- package/dist/runtime/index.mjs.map +1 -0
- package/package.json +80 -23
- package/.babelrc +0 -21
- package/.eslintignore +0 -10
- package/.eslintrc.js +0 -39
- package/InterfaceTemplate/index.playwright.ts +0 -6
- package/InterfaceTemplate/utils.ts +0 -61
- package/dist/commands/api/run.d.ts +0 -6
- package/dist/commands/api/run.js +0 -123
- package/dist/commands/auth-sessions/load.d.ts +0 -2
- package/dist/commands/auth-sessions/load.js +0 -35
- package/dist/commands/auth-sessions/run-check.d.ts +0 -2
- package/dist/commands/auth-sessions/run-check.js +0 -74
- package/dist/commands/auth-sessions/run-create.d.ts +0 -2
- package/dist/commands/auth-sessions/run-create.js +0 -78
- package/dist/commands/browser/save-state.d.ts +0 -2
- package/dist/commands/browser/save-state.js +0 -17
- package/dist/commands/browser/start-browser.d.ts +0 -2
- package/dist/commands/browser/start-browser.js +0 -14
- package/dist/commands/build.d.ts +0 -1
- package/dist/commands/build.js +0 -84
- package/dist/commands/common/browserUtils.d.ts +0 -14
- package/dist/commands/common/browserUtils.js +0 -58
- package/dist/commands/common/getFirstLineNumber.d.ts +0 -9
- package/dist/commands/common/getFirstLineNumber.js +0 -101
- package/dist/commands/common/getFirstLineNumber.test.js +0 -228
- package/dist/commands/common/projectExclusions.d.ts +0 -2
- package/dist/commands/common/projectExclusions.js +0 -8
- package/dist/commands/common/sendMessageToClient.d.ts +0 -1
- package/dist/commands/common/sendMessageToClient.js +0 -10
- package/dist/commands/common/tsNodeImport.d.ts +0 -2
- package/dist/commands/common/tsNodeImport.js +0 -34
- package/dist/commands/common/utils/fileUtils.d.ts +0 -6
- package/dist/commands/common/utils/fileUtils.js +0 -33
- package/dist/commands/common/utils/settings.d.ts +0 -2
- package/dist/commands/common/utils/settings.js +0 -31
- package/dist/commands/common/utils/template.d.ts +0 -2
- package/dist/commands/common/utils/template.js +0 -31
- package/dist/commands/common/utils/unixSocket.d.ts +0 -23
- package/dist/commands/common/utils/unixSocket.js +0 -87
- package/dist/commands/get-headless-user-agent.d.ts +0 -1
- package/dist/commands/get-headless-user-agent.js +0 -18
- package/dist/commands/intuned-cli/commands/attempt.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/attempt.command.js +0 -8
- package/dist/commands/intuned-cli/commands/attempt_api.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/attempt_api.command.js +0 -30
- package/dist/commands/intuned-cli/commands/attempt_authsession.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +0 -8
- package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +0 -19
- package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +0 -24
- package/dist/commands/intuned-cli/commands/authsession.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/authsession.command.js +0 -8
- package/dist/commands/intuned-cli/commands/authsession_record.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/authsession_record.command.js +0 -32
- package/dist/commands/intuned-cli/commands/build.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/build.command.js +0 -12
- package/dist/commands/intuned-cli/commands/command.d.ts +0 -2
- package/dist/commands/intuned-cli/commands/command.js +0 -9
- package/dist/commands/intuned-cli/commands/deploy.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/deploy.command.js +0 -38
- package/dist/commands/intuned-cli/commands/index.d.ts +0 -18
- package/dist/commands/intuned-cli/commands/index.js +0 -203
- package/dist/commands/intuned-cli/commands/init.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/init.command.js +0 -13
- package/dist/commands/intuned-cli/commands/run.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/run.command.js +0 -8
- package/dist/commands/intuned-cli/commands/run_api.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/run_api.command.js +0 -46
- package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +0 -31
- package/dist/commands/intuned-cli/commands/run_authsession.command.js +0 -17
- package/dist/commands/intuned-cli/commands/run_authsession_create.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +0 -35
- package/dist/commands/intuned-cli/commands/run_authsession_update.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +0 -35
- package/dist/commands/intuned-cli/commands/run_authsession_validate.command.d.ts +0 -1
- package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +0 -33
- package/dist/commands/intuned-cli/commands/save.command.d.ts +0 -13
- package/dist/commands/intuned-cli/commands/save.command.js +0 -42
- package/dist/commands/intuned-cli/commands/types.d.ts +0 -35
- package/dist/commands/intuned-cli/commands/types.js +0 -31
- package/dist/commands/intuned-cli/constants/index.d.ts +0 -17
- package/dist/commands/intuned-cli/constants/index.js +0 -25
- package/dist/commands/intuned-cli/controller/__test__/api.test.js +0 -397
- package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +0 -1059
- package/dist/commands/intuned-cli/controller/api.d.ts +0 -42
- package/dist/commands/intuned-cli/controller/api.js +0 -191
- package/dist/commands/intuned-cli/controller/authSession.d.ts +0 -209
- package/dist/commands/intuned-cli/controller/authSession.js +0 -424
- package/dist/commands/intuned-cli/controller/build.d.ts +0 -1
- package/dist/commands/intuned-cli/controller/build.js +0 -36
- package/dist/commands/intuned-cli/controller/deploy.d.ts +0 -5
- package/dist/commands/intuned-cli/controller/deploy.js +0 -276
- package/dist/commands/intuned-cli/controller/index.d.ts +0 -1
- package/dist/commands/intuned-cli/controller/index.js +0 -46
- package/dist/commands/intuned-cli/controller/save.d.ts +0 -17
- package/dist/commands/intuned-cli/controller/save.js +0 -351
- package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +0 -114
- package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +0 -40
- package/dist/commands/intuned-cli/helpers/api.d.ts +0 -3
- package/dist/commands/intuned-cli/helpers/api.js +0 -19
- package/dist/commands/intuned-cli/helpers/auth.d.ts +0 -46
- package/dist/commands/intuned-cli/helpers/auth.js +0 -144
- package/dist/commands/intuned-cli/helpers/backend.d.ts +0 -8
- package/dist/commands/intuned-cli/helpers/backend.js +0 -27
- package/dist/commands/intuned-cli/helpers/browser.d.ts +0 -15
- package/dist/commands/intuned-cli/helpers/browser.js +0 -64
- package/dist/commands/intuned-cli/helpers/context.d.ts +0 -3
- package/dist/commands/intuned-cli/helpers/context.js +0 -33
- package/dist/commands/intuned-cli/helpers/errors.d.ts +0 -16
- package/dist/commands/intuned-cli/helpers/errors.js +0 -44
- package/dist/commands/intuned-cli/helpers/index.d.ts +0 -12
- package/dist/commands/intuned-cli/helpers/index.js +0 -137
- package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +0 -39
- package/dist/commands/intuned-cli/helpers/intunedJson.js +0 -20
- package/dist/commands/intuned-cli/helpers/proxy.d.ts +0 -5
- package/dist/commands/intuned-cli/helpers/proxy.js +0 -23
- package/dist/commands/intuned-cli/helpers/terminal.d.ts +0 -5
- package/dist/commands/intuned-cli/helpers/terminal.js +0 -13
- package/dist/commands/intuned-cli/helpers/timeout.d.ts +0 -1
- package/dist/commands/intuned-cli/helpers/timeout.js +0 -23
- package/dist/commands/intuned-cli/helpers/traces.d.ts +0 -2
- package/dist/commands/intuned-cli/helpers/traces.js +0 -32
- package/dist/commands/intuned-cli/helpers/validation.d.ts +0 -2
- package/dist/commands/intuned-cli/helpers/validation.js +0 -14
- package/dist/commands/intuned-cli/helpers/wrapper.d.ts +0 -2
- package/dist/commands/intuned-cli/helpers/wrapper.js +0 -66
- package/dist/commands/intuned-cli/index.d.ts +0 -1
- package/dist/commands/intuned-cli/index.js +0 -16
- package/dist/commands/intuned-cli/main.d.ts +0 -1
- package/dist/commands/intuned-cli/main.js +0 -23
- package/dist/commands/intuned-cli/types.d.ts +0 -41
- package/dist/commands/intuned-cli/types.js +0 -12
- package/dist/commands/ts-check.d.ts +0 -2
- package/dist/commands/ts-check.js +0 -56
- package/dist/common/Logger/Logger/index.d.ts +0 -12
- package/dist/common/Logger/Logger/index.js +0 -60
- package/dist/common/Logger/Logger/types.d.ts +0 -8
- package/dist/common/Logger/Logger/types.js +0 -5
- package/dist/common/Logger/index.d.ts +0 -12
- package/dist/common/Logger/index.js +0 -60
- package/dist/common/Logger/types.d.ts +0 -8
- package/dist/common/Logger/types.js +0 -5
- package/dist/common/backendFunctions/getAuthSessionParameters.d.ts +0 -1
- package/dist/common/backendFunctions/getAuthSessionParameters.js +0 -38
- package/dist/common/extension/extensionsHelpers.d.ts +0 -11
- package/dist/common/extension/extensionsHelpers.js +0 -147
- package/dist/common/extension/intunedExtensionServer.d.ts +0 -24
- package/dist/common/extension/intunedExtensionServer.js +0 -178
- package/dist/common/extension/types.d.ts +0 -212
- package/dist/common/extension/types.js +0 -51
- package/dist/common/formatZodError.d.ts +0 -2
- package/dist/common/intunedJson.d.ts +0 -229
- package/dist/common/intunedJson.js +0 -133
- package/dist/common/launchBrowser.d.ts +0 -31
- package/dist/common/launchBrowser.js +0 -207
- package/dist/common/playwrightContext.d.ts +0 -31
- package/dist/common/playwrightContext.js +0 -144
- package/dist/common/runApi/errors.d.ts +0 -72
- package/dist/common/runApi/errors.js +0 -169
- package/dist/common/runApi/importUsingImportFunction.d.ts +0 -9
- package/dist/common/runApi/importUsingImportFunction.js +0 -46
- package/dist/common/runApi/types.d.ts +0 -830
- package/dist/common/runApi/types.js +0 -73
- package/dist/common/setupContextHook.d.ts +0 -17
- package/dist/common/setupContextHook.js +0 -22
- package/dist/runtime/RunError.d.ts +0 -5
- package/dist/runtime/RunError.js +0 -19
- package/dist/runtime/attemptStore.d.ts +0 -2
- package/dist/runtime/attemptStore.js +0 -23
- package/dist/runtime/captcha.d.ts +0 -15
- package/dist/runtime/captcha.js +0 -191
- package/dist/runtime/captcha.test.js +0 -821
- package/dist/runtime/downloadDirectory.d.ts +0 -1
- package/dist/runtime/downloadDirectory.js +0 -19
- package/dist/runtime/enums.d.js +0 -5
- package/dist/runtime/enums.d.ts +0 -11
- package/dist/runtime/enums.js +0 -18
- package/dist/runtime/executionHelpers.test.js +0 -52
- package/dist/runtime/export.d.js +0 -5
- package/dist/runtime/export.d.ts +0 -284
- package/dist/runtime/extendPayload.d.ts +0 -2
- package/dist/runtime/extendPayload.js +0 -21
- package/dist/runtime/extendTimeout.d.ts +0 -1
- package/dist/runtime/extendTimeout.js +0 -23
- package/dist/runtime/getAiGatewayConfig.d.ts +0 -10
- package/dist/runtime/getAiGatewayConfig.js +0 -16
- package/dist/runtime/getAuthSessionParameters.d.ts +0 -1
- package/dist/runtime/getAuthSessionParameters.js +0 -20
- package/dist/runtime/persistentStore.d.ts +0 -2
- package/dist/runtime/persistentStore.js +0 -37
- package/dist/runtime/persistentStore.test.js +0 -101
- package/dist/runtime/runInfo.d.ts +0 -2
- package/dist/runtime/runInfo.js +0 -21
- package/template.tsconfig.json +0 -11
- package/tsconfig.eslint.json +0 -5
- package/tsconfig.json +0 -25
- package/typedoc.json +0 -49
- /package/dist/common/assets/{browser_scripts.js → assets/browser_scripts.js} +0 -0
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { LogEntry, LogMetadata } from "./types";
|
|
2
|
-
declare class Logger {
|
|
3
|
-
logFunction(entry: LogEntry): void;
|
|
4
|
-
private log;
|
|
5
|
-
trace(message: string, meta?: LogMetadata): void;
|
|
6
|
-
debug(message: string, meta?: LogMetadata): void;
|
|
7
|
-
info(message: string, meta?: LogMetadata): void;
|
|
8
|
-
warn(message: string, meta?: LogMetadata): void;
|
|
9
|
-
error(message: string, meta?: LogMetadata): void;
|
|
10
|
-
}
|
|
11
|
-
export declare const logger: Logger;
|
|
12
|
-
export {};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.logger = void 0;
|
|
7
|
-
var _nodeUtil = require("node:util");
|
|
8
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
const format = _nodeUtil.formatWithOptions.bind(undefined, {
|
|
11
|
-
colors: true
|
|
12
|
-
});
|
|
13
|
-
const LOG_LEVEL_COLORS = {
|
|
14
|
-
TRACE: _chalk.default.gray,
|
|
15
|
-
DEBUG: _chalk.default.blue,
|
|
16
|
-
INFO: _chalk.default.green,
|
|
17
|
-
WARN: _chalk.default.yellow,
|
|
18
|
-
ERROR: _chalk.default.red
|
|
19
|
-
};
|
|
20
|
-
class Logger {
|
|
21
|
-
logFunction(entry) {
|
|
22
|
-
const {
|
|
23
|
-
level,
|
|
24
|
-
timestamp,
|
|
25
|
-
message,
|
|
26
|
-
meta
|
|
27
|
-
} = entry;
|
|
28
|
-
const date = new Date(timestamp);
|
|
29
|
-
const levelColor = LOG_LEVEL_COLORS[level];
|
|
30
|
-
if (meta === undefined) {
|
|
31
|
-
process.stderr.write(`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message}\n`);
|
|
32
|
-
} else {
|
|
33
|
-
process.stderr.write(`${format(date)} [@intuned/sdk][${levelColor(level)}] ${message} ${format(meta)}\n`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
log(level, message, meta) {
|
|
37
|
-
this.logFunction({
|
|
38
|
-
level,
|
|
39
|
-
message,
|
|
40
|
-
meta: meta && Object.keys(meta).length === 0 ? undefined : meta,
|
|
41
|
-
timestamp: Date.now()
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
trace(message, meta) {
|
|
45
|
-
this.log("TRACE", message, meta);
|
|
46
|
-
}
|
|
47
|
-
debug(message, meta) {
|
|
48
|
-
this.log("DEBUG", message, meta);
|
|
49
|
-
}
|
|
50
|
-
info(message, meta) {
|
|
51
|
-
this.log("INFO", message, meta);
|
|
52
|
-
}
|
|
53
|
-
warn(message, meta) {
|
|
54
|
-
this.log("WARN", message, meta);
|
|
55
|
-
}
|
|
56
|
-
error(message, meta) {
|
|
57
|
-
this.log("ERROR", message, meta);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
const logger = exports.logger = new Logger();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getAuthSessionParameters(): Promise<any>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getAuthSessionParameters = getAuthSessionParameters;
|
|
7
|
-
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
|
8
|
-
var _asyncLocalStorage = require("../asyncLocalStorage");
|
|
9
|
-
var _zod = require("zod");
|
|
10
|
-
var _jwtTokenManager = require("../jwtTokenManager");
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
const authSessionParametersResponseSchema = _zod.z.object({
|
|
13
|
-
parameters: _zod.z.any().refine(v => v !== undefined)
|
|
14
|
-
});
|
|
15
|
-
async function getAuthSessionParameters() {
|
|
16
|
-
const context = (0, _asyncLocalStorage.getExecutionContext)();
|
|
17
|
-
if (!context) {
|
|
18
|
-
throw new Error("getAuthSessionParameters failed due to an internal error (context was not found).");
|
|
19
|
-
}
|
|
20
|
-
const authSessionId = context.authSessionId;
|
|
21
|
-
if ((0, _isNil.default)(authSessionId)) {
|
|
22
|
-
throw new Error("Auth sessions are not enabled");
|
|
23
|
-
}
|
|
24
|
-
const response = await (0, _jwtTokenManager.callBackendFunctionWithToken)(`auth-session/${authSessionId}/parameters`, {
|
|
25
|
-
method: "GET"
|
|
26
|
-
});
|
|
27
|
-
const body = await response.text();
|
|
28
|
-
if (!response.ok) {
|
|
29
|
-
throw new Error(`getAuthSessionParameters failed with status ${response.status}: ${body}`);
|
|
30
|
-
}
|
|
31
|
-
let json;
|
|
32
|
-
try {
|
|
33
|
-
json = JSON.parse(body);
|
|
34
|
-
} catch (e) {
|
|
35
|
-
throw new Error(`Expected JSON response, but got ${body}`);
|
|
36
|
-
}
|
|
37
|
-
return authSessionParametersResponseSchema.parse(json).parameters;
|
|
38
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * 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>;
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.buildExtensionsList = buildExtensionsList;
|
|
7
|
-
exports.getIntunedCaptchaSolverSettings = getIntunedCaptchaSolverSettings;
|
|
8
|
-
exports.getIntunedExtensionPath = getIntunedExtensionPath;
|
|
9
|
-
exports.getIntunedExtensionSettings = getIntunedExtensionSettings;
|
|
10
|
-
exports.getIntunedExtensionWorker = getIntunedExtensionWorker;
|
|
11
|
-
exports.isIntunedExtensionEnabled = isIntunedExtensionEnabled;
|
|
12
|
-
exports.isIntunedExtensionLoaded = isIntunedExtensionLoaded;
|
|
13
|
-
exports.resolveCaptchaSolverSettings = resolveCaptchaSolverSettings;
|
|
14
|
-
exports.setupIntunedExtension = setupIntunedExtension;
|
|
15
|
-
var _settings = require("../../commands/common/utils/settings");
|
|
16
|
-
var _settingsSchema = require("../settingsSchema");
|
|
17
|
-
var _constants = require("../constants");
|
|
18
|
-
var _jwtTokenManager = require("../jwtTokenManager");
|
|
19
|
-
var _path = _interopRequireDefault(require("path"));
|
|
20
|
-
var _promises = require("fs/promises");
|
|
21
|
-
var _intunedExtensionServer = require("./intunedExtensionServer");
|
|
22
|
-
var _portfinder = require("portfinder");
|
|
23
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
|
-
const INTUNED_WORKER = "intunedWorker.js";
|
|
25
|
-
const INTUNED_EXTENSION_SETTINGS_FILE_NAME = "intunedSettings.json";
|
|
26
|
-
const INTUNED_CAPTCHA_EXTENSION_PORT_ENV_VAR = "INTUNED_CAPTCHA_EXTENSION_PORT";
|
|
27
|
-
let captchaSolverSettings = null;
|
|
28
|
-
async function getIntunedCaptchaExtensionPort() {
|
|
29
|
-
if (process.env.INTUNED_CAPTCHA_EXTENSION_PORT) {
|
|
30
|
-
return parseInt(process.env.INTUNED_CAPTCHA_EXTENSION_PORT, 10);
|
|
31
|
-
}
|
|
32
|
-
return await (0, _portfinder.getPort)({});
|
|
33
|
-
}
|
|
34
|
-
async function resolveCaptchaSolverSettings(input) {
|
|
35
|
-
const parsed = _settingsSchema.captchaSolverSettingsSchema.parse(input || {});
|
|
36
|
-
if (!parsed.port) {
|
|
37
|
-
parsed.port = await getIntunedCaptchaExtensionPort();
|
|
38
|
-
}
|
|
39
|
-
return parsed;
|
|
40
|
-
}
|
|
41
|
-
function getIntunedCaptchaExtensionPortFromEnv() {
|
|
42
|
-
const raw = process.env[INTUNED_CAPTCHA_EXTENSION_PORT_ENV_VAR];
|
|
43
|
-
if (!raw) return null;
|
|
44
|
-
const parsed = Number(raw);
|
|
45
|
-
if (!Number.isFinite(parsed) || parsed <= 0 || parsed > 65535) {
|
|
46
|
-
throw new Error(`Invalid ${INTUNED_CAPTCHA_EXTENSION_PORT_ENV_VAR}: ${raw}`);
|
|
47
|
-
}
|
|
48
|
-
return parsed;
|
|
49
|
-
}
|
|
50
|
-
function isIntunedExtensionLoaded() {
|
|
51
|
-
return !!getIntunedExtensionPath();
|
|
52
|
-
}
|
|
53
|
-
function buildExtensionsList() {
|
|
54
|
-
const extensionsList = [];
|
|
55
|
-
if (isIntunedExtensionLoaded()) {
|
|
56
|
-
const intunedExtensionPath = getIntunedExtensionPath();
|
|
57
|
-
extensionsList.push(intunedExtensionPath);
|
|
58
|
-
}
|
|
59
|
-
return extensionsList;
|
|
60
|
-
}
|
|
61
|
-
function getIntunedExtensionPath() {
|
|
62
|
-
return process.env.INTUNED_EXTENSION_PATH;
|
|
63
|
-
}
|
|
64
|
-
async function isIntunedExtensionEnabled() {
|
|
65
|
-
const path = getIntunedExtensionPath();
|
|
66
|
-
if (!path) {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
const captchaSolverSettings = await getIntunedCaptchaSolverSettings();
|
|
70
|
-
return captchaSolverSettings.enabled;
|
|
71
|
-
}
|
|
72
|
-
async function getIntunedExtensionWorker(context) {
|
|
73
|
-
if (!(await isIntunedExtensionEnabled())) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
let attemptCount = 0;
|
|
77
|
-
while (attemptCount < 4) {
|
|
78
|
-
const intunedServiceWorker = context.serviceWorkers().find(serviceWorker => serviceWorker.url().includes(INTUNED_WORKER));
|
|
79
|
-
if (intunedServiceWorker) {
|
|
80
|
-
return intunedServiceWorker;
|
|
81
|
-
}
|
|
82
|
-
try {
|
|
83
|
-
await context.waitForEvent("serviceworker", {
|
|
84
|
-
timeout: 3000
|
|
85
|
-
});
|
|
86
|
-
} catch (err) {
|
|
87
|
-
console.log(`Error accessing service workers (attempt ${attemptCount})`);
|
|
88
|
-
}
|
|
89
|
-
attemptCount++;
|
|
90
|
-
}
|
|
91
|
-
console.error("Failed to get intuned worker after 5 attmepts");
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
async function getIntunedExtensionSettings(captchaSolverSettings) {
|
|
95
|
-
const [domain, workspaceId, projectId] = [process.env.FUNCTIONS_DOMAIN, process.env[_constants.WORKSPACE_ID_ENV_VAR_KEY], process.env.INTUNED_INTEGRATION_ID ?? process.env[_constants.PROJECT_ID_ENV_VAR_KEY]];
|
|
96
|
-
if (!domain || !workspaceId || !projectId) {
|
|
97
|
-
const missingEnvVars = [domain && "FUNCTIONS_DOMAIN", workspaceId && _constants.WORKSPACE_ID_ENV_VAR_KEY, projectId && `INTUNED_INTEGRATION_ID OR ${_constants.PROJECT_ID_ENV_VAR_KEY}`];
|
|
98
|
-
throw new Error(`Missing required environment variables: ${missingEnvVars}`);
|
|
99
|
-
}
|
|
100
|
-
const authentication = (() => {
|
|
101
|
-
if (process.env.INTUNED_API_KEY) {
|
|
102
|
-
return {
|
|
103
|
-
type: "apiKey",
|
|
104
|
-
apiKey: process.env.INTUNED_API_KEY
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
if (process.env.INTUNED_BASIC_AUTH_USERNAME && process.env.INTUNED_BASIC_AUTH_PASSWORD) {
|
|
108
|
-
const credentials = `${process.env.INTUNED_BASIC_AUTH_USERNAME}:${process.env.INTUNED_BASIC_AUTH_PASSWORD}`;
|
|
109
|
-
const token = Buffer.from(credentials, "utf-8").toString("base64");
|
|
110
|
-
return {
|
|
111
|
-
type: "basic",
|
|
112
|
-
token
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
return {
|
|
116
|
-
type: "bearer",
|
|
117
|
-
token: _jwtTokenManager.backendFunctionsTokenManager.token
|
|
118
|
-
};
|
|
119
|
-
})();
|
|
120
|
-
const baseUrl = process.env.INTUNED_API_BASE_URL ?? domain;
|
|
121
|
-
return {
|
|
122
|
-
...captchaSolverSettings,
|
|
123
|
-
workspaceId,
|
|
124
|
-
projectId,
|
|
125
|
-
baseUrl,
|
|
126
|
-
authentication
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
async function getIntunedCaptchaSolverSettings() {
|
|
130
|
-
if (captchaSolverSettings) {
|
|
131
|
-
return captchaSolverSettings;
|
|
132
|
-
}
|
|
133
|
-
const settings = await (0, _settings.getSettings)();
|
|
134
|
-
captchaSolverSettings = await resolveCaptchaSolverSettings(settings.captchaSolver);
|
|
135
|
-
return captchaSolverSettings;
|
|
136
|
-
}
|
|
137
|
-
async function setupIntunedExtension() {
|
|
138
|
-
if (!(await isIntunedExtensionEnabled())) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
const intunedExtensionPath = getIntunedExtensionPath();
|
|
142
|
-
const intunedExtensionSettingsPath = _path.default.join(intunedExtensionPath, INTUNED_EXTENSION_SETTINGS_FILE_NAME);
|
|
143
|
-
const captchaSolverSettings = await getIntunedCaptchaSolverSettings();
|
|
144
|
-
await (0, _intunedExtensionServer.setupIntunedExtensionServer)(captchaSolverSettings);
|
|
145
|
-
const captchaSolverSettingsWithRunContext = await getIntunedExtensionSettings(captchaSolverSettings);
|
|
146
|
-
await (0, _promises.writeFile)(intunedExtensionSettingsPath, JSON.stringify(captchaSolverSettingsWithRunContext));
|
|
147
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type * as playwright from "playwright";
|
|
2
|
-
import { Captcha, CaptchaCallback, CaptchaStatus } from "./types";
|
|
3
|
-
import { CaptchaSolverSettings } from "../settingsSchema";
|
|
4
|
-
export declare class ExtensionServer {
|
|
5
|
-
private tabs;
|
|
6
|
-
private app;
|
|
7
|
-
constructor();
|
|
8
|
-
private getOrCreateTab;
|
|
9
|
-
handleUpsertCaptcha(captcha: Captcha): Promise<void>;
|
|
10
|
-
start({ port, host, }: {
|
|
11
|
-
port: number;
|
|
12
|
-
host?: string;
|
|
13
|
-
}): Promise<void>;
|
|
14
|
-
stop(): Promise<void>;
|
|
15
|
-
getCaptchas(page: playwright.Page, status?: CaptchaStatus): Promise<Captcha[]>;
|
|
16
|
-
subscribe(page: playwright.Page, handler: CaptchaCallback, status?: CaptchaStatus): Promise<void>;
|
|
17
|
-
unsubscribe(page: playwright.Page, handler: CaptchaCallback, status?: CaptchaStatus): Promise<void>;
|
|
18
|
-
removeTab(tabId: number): void;
|
|
19
|
-
getTabId(page: playwright.Page): Promise<number>;
|
|
20
|
-
}
|
|
21
|
-
export declare function getIntunedExtensionServer(): ExtensionServer;
|
|
22
|
-
export declare function setupIntunedExtensionServer(captchaSolverSettings?: CaptchaSolverSettings): Promise<void>;
|
|
23
|
-
export declare function cleanIntunedExtensionServer(): Promise<void>;
|
|
24
|
-
export declare function getTabId(page: playwright.Page): Promise<number>;
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ExtensionServer = void 0;
|
|
7
|
-
exports.cleanIntunedExtensionServer = cleanIntunedExtensionServer;
|
|
8
|
-
exports.getIntunedExtensionServer = getIntunedExtensionServer;
|
|
9
|
-
exports.getTabId = getTabId;
|
|
10
|
-
exports.setupIntunedExtensionServer = setupIntunedExtensionServer;
|
|
11
|
-
var _fastify = _interopRequireDefault(require("fastify"));
|
|
12
|
-
var _types = require("./types");
|
|
13
|
-
var _extensionsHelpers = require("./extensionsHelpers");
|
|
14
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
class TabCaptchaState {
|
|
16
|
-
constructor(tabId) {
|
|
17
|
-
this.tabId = tabId;
|
|
18
|
-
this.captchasById = new Map();
|
|
19
|
-
this.subscribers = new Array();
|
|
20
|
-
}
|
|
21
|
-
subscribe(handler) {
|
|
22
|
-
this.subscribers.push(handler);
|
|
23
|
-
}
|
|
24
|
-
unsubscribe(handler, status) {
|
|
25
|
-
const index = this.subscribers.findIndex(subscriber => subscriber.handler === handler && (subscriber.status === status || !status));
|
|
26
|
-
if (index !== -1) {
|
|
27
|
-
this.subscribers.splice(index, 1);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
getCaptchas() {
|
|
31
|
-
return [...this.captchasById.values()];
|
|
32
|
-
}
|
|
33
|
-
async upsertCaptcha(captcha) {
|
|
34
|
-
this.captchasById.set(captcha.id, captcha);
|
|
35
|
-
for (const subscriber of this.subscribers) {
|
|
36
|
-
if (!subscriber.status || subscriber.status === captcha.status) {
|
|
37
|
-
await subscriber.handler(captcha);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
class ExtensionServer {
|
|
43
|
-
app = null;
|
|
44
|
-
constructor() {
|
|
45
|
-
this.tabs = new Map();
|
|
46
|
-
}
|
|
47
|
-
getOrCreateTab(tabId) {
|
|
48
|
-
const existing = this.tabs.get(tabId);
|
|
49
|
-
if (existing) return existing;
|
|
50
|
-
const created = new TabCaptchaState(tabId);
|
|
51
|
-
this.tabs.set(tabId, created);
|
|
52
|
-
return created;
|
|
53
|
-
}
|
|
54
|
-
async handleUpsertCaptcha(captcha) {
|
|
55
|
-
const tab = this.getOrCreateTab(captcha.tabId);
|
|
56
|
-
await tab.upsertCaptcha(captcha);
|
|
57
|
-
}
|
|
58
|
-
async start({
|
|
59
|
-
port,
|
|
60
|
-
host = "0.0.0.0"
|
|
61
|
-
}) {
|
|
62
|
-
if (this.app) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
this.app = (0, _fastify.default)({
|
|
66
|
-
logger: false,
|
|
67
|
-
bodyLimit: 1_000_000
|
|
68
|
-
});
|
|
69
|
-
this.app.post("/state", async (request, reply) => {
|
|
70
|
-
try {
|
|
71
|
-
const result = _types.captchaSchema.safeParse(request.body);
|
|
72
|
-
if (!result.success) {
|
|
73
|
-
return reply.code(400).send({
|
|
74
|
-
error: "Invalid captcha payload",
|
|
75
|
-
details: result.error.flatten().fieldErrors
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
await this.handleUpsertCaptcha(result.data);
|
|
79
|
-
return reply.code(200).send({});
|
|
80
|
-
} catch (error) {
|
|
81
|
-
console.error("Error processing captcha state update:", error);
|
|
82
|
-
return reply.code(500).send({
|
|
83
|
-
error: "Internal server error",
|
|
84
|
-
message: error?.message ?? String(error)
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
this.app.setNotFoundHandler((_request, reply) => {
|
|
89
|
-
return reply.code(404).send({
|
|
90
|
-
error: "Not found"
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
await this.app.listen({
|
|
94
|
-
port,
|
|
95
|
-
host
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
async stop() {
|
|
99
|
-
if (!this.app) return;
|
|
100
|
-
const toClose = this.app;
|
|
101
|
-
this.app = null;
|
|
102
|
-
await toClose.close();
|
|
103
|
-
}
|
|
104
|
-
async getCaptchas(page, status) {
|
|
105
|
-
const tabId = await getTabId(page);
|
|
106
|
-
const tab = this.tabs.get(tabId);
|
|
107
|
-
if (!tab) return [];
|
|
108
|
-
const captchas = tab.getCaptchas();
|
|
109
|
-
if (!status) return captchas;
|
|
110
|
-
return captchas.filter(c => c.status === status && c.tabId === tabId);
|
|
111
|
-
}
|
|
112
|
-
async subscribe(page, handler, status) {
|
|
113
|
-
const tabId = await getTabId(page);
|
|
114
|
-
const tab = this.getOrCreateTab(tabId);
|
|
115
|
-
tab.subscribe({
|
|
116
|
-
handler,
|
|
117
|
-
status
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
async unsubscribe(page, handler, status) {
|
|
121
|
-
const tabId = await getTabId(page);
|
|
122
|
-
const tab = this.tabs.get(tabId);
|
|
123
|
-
if (!tab) return;
|
|
124
|
-
tab.unsubscribe(handler, status);
|
|
125
|
-
}
|
|
126
|
-
removeTab(tabId) {
|
|
127
|
-
this.tabs.delete(tabId);
|
|
128
|
-
}
|
|
129
|
-
async getTabId(page) {
|
|
130
|
-
return await getTabId(page);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
exports.ExtensionServer = ExtensionServer;
|
|
134
|
-
let extensionServerSingleton = null;
|
|
135
|
-
function getIntunedExtensionServer() {
|
|
136
|
-
if (!extensionServerSingleton) {
|
|
137
|
-
throw new Error("Intuned Extension Server is not initialized.");
|
|
138
|
-
}
|
|
139
|
-
return extensionServerSingleton;
|
|
140
|
-
}
|
|
141
|
-
async function setupIntunedExtensionServer(captchaSolverSettings) {
|
|
142
|
-
if (!captchaSolverSettings) {
|
|
143
|
-
captchaSolverSettings = await (0, _extensionsHelpers.resolveCaptchaSolverSettings)();
|
|
144
|
-
}
|
|
145
|
-
if (!extensionServerSingleton) {
|
|
146
|
-
extensionServerSingleton = new ExtensionServer();
|
|
147
|
-
}
|
|
148
|
-
await extensionServerSingleton.start({
|
|
149
|
-
port: captchaSolverSettings.port ?? 9000
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
async function cleanIntunedExtensionServer() {
|
|
153
|
-
if (extensionServerSingleton) {
|
|
154
|
-
await extensionServerSingleton.stop();
|
|
155
|
-
extensionServerSingleton = null;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
const TAB_ID_CACHE_KEY = "__INTUNED_CACHED_TAB_ID__";
|
|
159
|
-
async function getTabId(page) {
|
|
160
|
-
const cached = page[TAB_ID_CACHE_KEY];
|
|
161
|
-
if (cached !== undefined && typeof cached === "number") {
|
|
162
|
-
return cached;
|
|
163
|
-
}
|
|
164
|
-
let tabId;
|
|
165
|
-
try {
|
|
166
|
-
tabId = await page.evaluate("window.__INTUNED_TAB_ID__", {
|
|
167
|
-
timeout: 100
|
|
168
|
-
});
|
|
169
|
-
} catch {
|
|
170
|
-
await page.waitForFunction("window.__INTUNED_TAB_ID__ !== undefined", {
|
|
171
|
-
timeout: 15_000
|
|
172
|
-
});
|
|
173
|
-
tabId = await page.evaluate("window.__INTUNED_TAB_ID__");
|
|
174
|
-
}
|
|
175
|
-
const numericTabId = Number(tabId);
|
|
176
|
-
page[TAB_ID_CACHE_KEY] = numericTabId;
|
|
177
|
-
return numericTabId;
|
|
178
|
-
}
|