@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,424 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports._runCreateWithRetries = exports._runCreate = exports._runCheckWithRetries = exports._runCheck = void 0;
|
|
7
|
-
exports.executeAttemptCheckAuthSessionCLI = executeAttemptCheckAuthSessionCLI;
|
|
8
|
-
exports.executeAttemptCreateAuthSessionCLI = executeAttemptCreateAuthSessionCLI;
|
|
9
|
-
exports.executeRecordAuthSessionCLI = executeRecordAuthSessionCLI;
|
|
10
|
-
exports.executeRunCreateAuthSessionCLI = executeRunCreateAuthSessionCLI;
|
|
11
|
-
exports.executeRunUpdateAuthSessionCLI = executeRunUpdateAuthSessionCLI;
|
|
12
|
-
exports.executeRunValidateAuthSessionCLI = executeRunValidateAuthSessionCLI;
|
|
13
|
-
var _helpers = require("../helpers");
|
|
14
|
-
var _runApi = require("../../../common/runApi");
|
|
15
|
-
var _constants = require("../../../common/constants");
|
|
16
|
-
var _tsNodeImport = require("../../common/tsNodeImport");
|
|
17
|
-
var _terminal = require("../helpers/terminal");
|
|
18
|
-
var _browser = require("../helpers/browser");
|
|
19
|
-
var _launchBrowser = require("../../../common/launchBrowser");
|
|
20
|
-
var _promises = require("timers/promises");
|
|
21
|
-
var _contextStorageStateHelpers = require("../../../common/contextStorageStateHelpers");
|
|
22
|
-
async function executeRunValidateAuthSessionCLI({
|
|
23
|
-
id,
|
|
24
|
-
autoRecreate,
|
|
25
|
-
checkRetries,
|
|
26
|
-
createRetries,
|
|
27
|
-
...rest
|
|
28
|
-
}) {
|
|
29
|
-
(0, _terminal.terminal)(`^+Validating auth session with id ^c${id}^:\n`);
|
|
30
|
-
const {
|
|
31
|
-
storageState
|
|
32
|
-
} = await (0, _helpers.loadAuthSessionInstance)(id);
|
|
33
|
-
await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "check");
|
|
34
|
-
(0, _helpers.registerGetAuthSessionParameters)(id);
|
|
35
|
-
const checkResult = await runCheckWithRetries({
|
|
36
|
-
auth: storageState,
|
|
37
|
-
retries: checkRetries,
|
|
38
|
-
...rest
|
|
39
|
-
});
|
|
40
|
-
if (!checkResult) {
|
|
41
|
-
if (!autoRecreate) {
|
|
42
|
-
throw new _helpers.CLIError("Auto recreate is disabled, please provide a new auth session or update it manually");
|
|
43
|
-
}
|
|
44
|
-
const {
|
|
45
|
-
metadata
|
|
46
|
-
} = await (0, _helpers.loadAuthSessionInstance)(id);
|
|
47
|
-
if (metadata?.authSessionType === "MANUAL") {
|
|
48
|
-
throw new _helpers.CLIError("Auth session is recorder-based, please provide a new one or update it manually");
|
|
49
|
-
}
|
|
50
|
-
(0, _terminal.terminal)("^+Auto recreate is enabled - trying to re-create it^:\n");
|
|
51
|
-
await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "create");
|
|
52
|
-
const authSessionInput = metadata?.authSessionInput ?? {};
|
|
53
|
-
const storageState = await runCreateWithRetries({
|
|
54
|
-
authSessionId: id,
|
|
55
|
-
authSessionInput,
|
|
56
|
-
retries: createRetries,
|
|
57
|
-
metadata,
|
|
58
|
-
...rest
|
|
59
|
-
});
|
|
60
|
-
const checkResult = await runCheckWithRetries({
|
|
61
|
-
auth: storageState,
|
|
62
|
-
retries: checkRetries,
|
|
63
|
-
...rest
|
|
64
|
-
});
|
|
65
|
-
if (!checkResult) {
|
|
66
|
-
throw new _helpers.CLIError("Failed to re-create auth session");
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
(0, _terminal.terminal)(`^+^gAuth session validated successfully^:\n`);
|
|
70
|
-
return storageState;
|
|
71
|
-
}
|
|
72
|
-
async function executeRunCreateAuthSessionCLI({
|
|
73
|
-
id,
|
|
74
|
-
input,
|
|
75
|
-
checkRetries,
|
|
76
|
-
createRetries,
|
|
77
|
-
log = true,
|
|
78
|
-
...rest
|
|
79
|
-
}) {
|
|
80
|
-
id = id ?? generateAuthSessionId();
|
|
81
|
-
(0, _terminal.terminal)(`^+Creating auth session with id ^c${id}^:\n`);
|
|
82
|
-
await Promise.all([await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "create"), await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "check")]);
|
|
83
|
-
const createdStorageState = await runCreateWithRetries({
|
|
84
|
-
authSessionId: id,
|
|
85
|
-
authSessionInput: input,
|
|
86
|
-
retries: createRetries,
|
|
87
|
-
...rest
|
|
88
|
-
});
|
|
89
|
-
const auth = createdStorageState;
|
|
90
|
-
const checkResult = await runCheckWithRetries({
|
|
91
|
-
auth,
|
|
92
|
-
retries: checkRetries,
|
|
93
|
-
...rest
|
|
94
|
-
});
|
|
95
|
-
if (!checkResult) {
|
|
96
|
-
throw new _helpers.CLIError("Failed to create auth session");
|
|
97
|
-
}
|
|
98
|
-
if (log) {
|
|
99
|
-
(0, _terminal.terminal)(`^+^gAuth session created successfully^:\n`);
|
|
100
|
-
}
|
|
101
|
-
return auth;
|
|
102
|
-
}
|
|
103
|
-
async function executeRunUpdateAuthSessionCLI({
|
|
104
|
-
id,
|
|
105
|
-
input,
|
|
106
|
-
checkRetries,
|
|
107
|
-
createRetries,
|
|
108
|
-
...rest
|
|
109
|
-
}) {
|
|
110
|
-
(0, _terminal.terminal)(`^+Updating auth session with id ^c${id}^:\n`);
|
|
111
|
-
let metadata = undefined;
|
|
112
|
-
if (input === undefined) {
|
|
113
|
-
({
|
|
114
|
-
metadata
|
|
115
|
-
} = await (0, _helpers.loadAuthSessionInstance)(id));
|
|
116
|
-
if (metadata?.authSessionType === "MANUAL") {
|
|
117
|
-
throw new _helpers.CLIError("Auth session is recorder-based, it cannot be updated.");
|
|
118
|
-
}
|
|
119
|
-
input = metadata?.authSessionInput ?? {};
|
|
120
|
-
}
|
|
121
|
-
await Promise.all([await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "create"), await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "check")]);
|
|
122
|
-
const authSession = await executeRunCreateAuthSessionCLI({
|
|
123
|
-
id,
|
|
124
|
-
input,
|
|
125
|
-
checkRetries,
|
|
126
|
-
createRetries,
|
|
127
|
-
log: false,
|
|
128
|
-
metadata,
|
|
129
|
-
...rest
|
|
130
|
-
});
|
|
131
|
-
(0, _terminal.terminal)(`^+^gAuth session updated successfully^:\n`);
|
|
132
|
-
return authSession;
|
|
133
|
-
}
|
|
134
|
-
async function executeAttemptCreateAuthSessionCLI({
|
|
135
|
-
id,
|
|
136
|
-
input,
|
|
137
|
-
...rest
|
|
138
|
-
}) {
|
|
139
|
-
id = id ?? generateAuthSessionId(true);
|
|
140
|
-
(0, _terminal.terminal)(`^+Executing create auth session attempt with id ^c${id}^:\n`);
|
|
141
|
-
await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "create");
|
|
142
|
-
return await runCreateWithRetries({
|
|
143
|
-
authSessionId: id,
|
|
144
|
-
authSessionInput: input,
|
|
145
|
-
...rest
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
async function executeAttemptCheckAuthSessionCLI({
|
|
149
|
-
id,
|
|
150
|
-
...rest
|
|
151
|
-
}) {
|
|
152
|
-
(0, _terminal.terminal)(`^+Executing check auth session attempt with id ^c${id}^:\n`);
|
|
153
|
-
await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "check");
|
|
154
|
-
(0, _helpers.registerGetAuthSessionParameters)(id);
|
|
155
|
-
const {
|
|
156
|
-
storageState
|
|
157
|
-
} = await (0, _helpers.loadAuthSessionInstance)(id);
|
|
158
|
-
const checkResult = await runCheckWithRetries({
|
|
159
|
-
auth: storageState,
|
|
160
|
-
...rest
|
|
161
|
-
});
|
|
162
|
-
if (!checkResult) {
|
|
163
|
-
throw new _helpers.CLIError("Check failed");
|
|
164
|
-
}
|
|
165
|
-
(0, _terminal.terminal)(`^+^gAuth session check passed^:\n`);
|
|
166
|
-
return storageState;
|
|
167
|
-
}
|
|
168
|
-
async function runCheck({
|
|
169
|
-
auth,
|
|
170
|
-
proxy,
|
|
171
|
-
headless,
|
|
172
|
-
timeout,
|
|
173
|
-
traceId,
|
|
174
|
-
keepBrowserOpen,
|
|
175
|
-
cdpUrl
|
|
176
|
-
}) {
|
|
177
|
-
return await (0, _helpers.withTimeout)(async abortSignal => (0, _helpers.withCLITrace)(async tracing => {
|
|
178
|
-
const runApiResult = await (0, _runApi.runApi)({
|
|
179
|
-
automationFunction: {
|
|
180
|
-
name: `${_constants.AUTH_SESSIONS_FOLDER_NAME}/check`
|
|
181
|
-
},
|
|
182
|
-
runOptions: await (0, _browser.getCLIRunOptions)({
|
|
183
|
-
headless,
|
|
184
|
-
proxy,
|
|
185
|
-
keepBrowserOpen,
|
|
186
|
-
cdpUrl
|
|
187
|
-
}),
|
|
188
|
-
auth: {
|
|
189
|
-
session: {
|
|
190
|
-
type: "state",
|
|
191
|
-
state: auth
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
tracing,
|
|
195
|
-
importFunction: _tsNodeImport.tsNodeImport,
|
|
196
|
-
abortSignal
|
|
197
|
-
});
|
|
198
|
-
if (runApiResult.isErr()) {
|
|
199
|
-
throw runApiResult.error;
|
|
200
|
-
}
|
|
201
|
-
const result = runApiResult.value.result;
|
|
202
|
-
if (!result) {
|
|
203
|
-
return false;
|
|
204
|
-
}
|
|
205
|
-
return result;
|
|
206
|
-
}, traceId), timeout);
|
|
207
|
-
}
|
|
208
|
-
const _runCheck = exports._runCheck = runCheck;
|
|
209
|
-
async function runCreate({
|
|
210
|
-
authSessionInput,
|
|
211
|
-
proxy,
|
|
212
|
-
headless,
|
|
213
|
-
timeout,
|
|
214
|
-
traceId,
|
|
215
|
-
keepBrowserOpen,
|
|
216
|
-
cdpUrl
|
|
217
|
-
}) {
|
|
218
|
-
return await (0, _helpers.withTimeout)(async abortSignal => (0, _helpers.withCLITrace)(async tracing => {
|
|
219
|
-
const result = await (0, _runApi.runApi)({
|
|
220
|
-
automationFunction: {
|
|
221
|
-
name: `${_constants.AUTH_SESSIONS_FOLDER_NAME}/create`,
|
|
222
|
-
params: authSessionInput
|
|
223
|
-
},
|
|
224
|
-
runOptions: await (0, _browser.getCLIRunOptions)({
|
|
225
|
-
headless,
|
|
226
|
-
proxy,
|
|
227
|
-
keepBrowserOpen,
|
|
228
|
-
cdpUrl
|
|
229
|
-
}),
|
|
230
|
-
retrieveSession: true,
|
|
231
|
-
tracing,
|
|
232
|
-
importFunction: _tsNodeImport.tsNodeImport,
|
|
233
|
-
abortSignal
|
|
234
|
-
});
|
|
235
|
-
if (result.isErr()) {
|
|
236
|
-
throw result.error;
|
|
237
|
-
}
|
|
238
|
-
return result.value.session;
|
|
239
|
-
}, traceId), timeout);
|
|
240
|
-
}
|
|
241
|
-
const _runCreate = exports._runCreate = runCreate;
|
|
242
|
-
async function runCheckWithRetries({
|
|
243
|
-
auth,
|
|
244
|
-
retries,
|
|
245
|
-
...rest
|
|
246
|
-
}) {
|
|
247
|
-
for (let i = 0; i < (retries ?? 1); i++) {
|
|
248
|
-
(0, _terminal.terminal)(`\n^+Running ^cauth session check${i === 0 ? "" : ` ^/(Attempt ${i + 1})`}^:...\n`);
|
|
249
|
-
try {
|
|
250
|
-
let traceId = undefined;
|
|
251
|
-
if (rest.trace) {
|
|
252
|
-
traceId = "authsession-check-attempt";
|
|
253
|
-
if (retries) {
|
|
254
|
-
traceId += `-${i + 1}`;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
const checkResult = await runCheck({
|
|
258
|
-
auth,
|
|
259
|
-
traceId,
|
|
260
|
-
...rest
|
|
261
|
-
});
|
|
262
|
-
if (checkResult) {
|
|
263
|
-
(0, _terminal.terminal)(`^+^gAuth session check passed^:\n`);
|
|
264
|
-
return true;
|
|
265
|
-
}
|
|
266
|
-
} catch (error) {
|
|
267
|
-
if (error instanceof _runApi.RunAutomationError) {
|
|
268
|
-
(0, _helpers.logAutomationError)(error);
|
|
269
|
-
} else {
|
|
270
|
-
throw error;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
(0, _terminal.terminal)(`^+^yAuth session check failed^:\n`);
|
|
274
|
-
}
|
|
275
|
-
(0, _terminal.terminal)(`^+^rAuth session check failed after ${retries} attempts^:\n`);
|
|
276
|
-
return false;
|
|
277
|
-
}
|
|
278
|
-
const _runCheckWithRetries = exports._runCheckWithRetries = runCheckWithRetries;
|
|
279
|
-
async function runCreateWithRetries({
|
|
280
|
-
authSessionId,
|
|
281
|
-
authSessionInput,
|
|
282
|
-
retries,
|
|
283
|
-
trace,
|
|
284
|
-
metadata,
|
|
285
|
-
...rest
|
|
286
|
-
}) {
|
|
287
|
-
let newAuthSessionInstance = null;
|
|
288
|
-
for (let i = 0; i < (retries ?? 1); i++) {
|
|
289
|
-
(0, _terminal.terminal)(`\n^+Running ^cauth session create${i === 0 ? "" : ` ^/(Attempt ${i + 1})`}^:...\n`);
|
|
290
|
-
try {
|
|
291
|
-
let traceId = undefined;
|
|
292
|
-
if (trace) {
|
|
293
|
-
traceId = "authsession-create-attempt";
|
|
294
|
-
if (retries) {
|
|
295
|
-
traceId += `-${i + 1}`;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
newAuthSessionInstance = await runCreate({
|
|
299
|
-
authSessionInput,
|
|
300
|
-
traceId,
|
|
301
|
-
...rest
|
|
302
|
-
});
|
|
303
|
-
(0, _terminal.terminal)(`^+^gAuth session create succeeded^:\n`);
|
|
304
|
-
break;
|
|
305
|
-
} catch (error) {
|
|
306
|
-
if (error instanceof _runApi.RunAutomationError) {
|
|
307
|
-
(0, _helpers.logAutomationError)(error);
|
|
308
|
-
} else {
|
|
309
|
-
throw error;
|
|
310
|
-
}
|
|
311
|
-
(0, _terminal.terminal)(`^+^yAuth session create failed^:\n`);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
if (!newAuthSessionInstance) {
|
|
315
|
-
throw new _helpers.CLIError(`Failed to create auth session after ${retries} retries`);
|
|
316
|
-
}
|
|
317
|
-
await (0, _helpers.storeAuthSessionInstance)({
|
|
318
|
-
state: newAuthSessionInstance,
|
|
319
|
-
id: authSessionId,
|
|
320
|
-
input: authSessionInput,
|
|
321
|
-
proxy: rest.proxy,
|
|
322
|
-
metadata
|
|
323
|
-
});
|
|
324
|
-
return newAuthSessionInstance;
|
|
325
|
-
}
|
|
326
|
-
const _runCreateWithRetries = exports._runCreateWithRetries = runCreateWithRetries;
|
|
327
|
-
async function executeRecordAuthSessionCLI({
|
|
328
|
-
id,
|
|
329
|
-
checkRetries,
|
|
330
|
-
timeout,
|
|
331
|
-
headless,
|
|
332
|
-
proxy,
|
|
333
|
-
trace = false,
|
|
334
|
-
keepBrowserOpen,
|
|
335
|
-
startUrl,
|
|
336
|
-
finishUrl
|
|
337
|
-
}) {
|
|
338
|
-
id = id ?? generateAuthSessionId();
|
|
339
|
-
(0, _terminal.terminal)(`^+Recording auth session with id ^c${id}^:\n`);
|
|
340
|
-
let authSession;
|
|
341
|
-
try {
|
|
342
|
-
authSession = await recordAuthSession({
|
|
343
|
-
startUrl,
|
|
344
|
-
finishUrl,
|
|
345
|
-
timeout,
|
|
346
|
-
proxy: proxy ? (0, _helpers.parseUrlProxy)(proxy) : undefined
|
|
347
|
-
});
|
|
348
|
-
} catch (error) {
|
|
349
|
-
if (error instanceof _helpers.CLIError) {
|
|
350
|
-
throw new _helpers.CLIError(`Failed to record auth session: ${error.message}`);
|
|
351
|
-
}
|
|
352
|
-
throw error;
|
|
353
|
-
}
|
|
354
|
-
await (0, _helpers.storeAuthSessionInstance)({
|
|
355
|
-
state: authSession,
|
|
356
|
-
id,
|
|
357
|
-
proxy,
|
|
358
|
-
metadata: {
|
|
359
|
-
createdAt: new Date().toISOString(),
|
|
360
|
-
updatedAt: new Date().toISOString(),
|
|
361
|
-
authSessionId: id,
|
|
362
|
-
authSessionType: "MANUAL",
|
|
363
|
-
recorderStartUrl: startUrl,
|
|
364
|
-
recorderEndUrl: finishUrl
|
|
365
|
-
}
|
|
366
|
-
});
|
|
367
|
-
await executeRunValidateAuthSessionCLI({
|
|
368
|
-
id,
|
|
369
|
-
headless,
|
|
370
|
-
timeout,
|
|
371
|
-
proxy,
|
|
372
|
-
autoRecreate: false,
|
|
373
|
-
checkRetries,
|
|
374
|
-
createRetries: 0,
|
|
375
|
-
trace,
|
|
376
|
-
keepBrowserOpen
|
|
377
|
-
});
|
|
378
|
-
(0, _terminal.terminal)(`^+^gAuth session ^c${id}^ ^+^grecorded successfully^:\n`);
|
|
379
|
-
}
|
|
380
|
-
async function recordAuthSession({
|
|
381
|
-
startUrl,
|
|
382
|
-
finishUrl,
|
|
383
|
-
timeout,
|
|
384
|
-
proxy
|
|
385
|
-
}) {
|
|
386
|
-
const {
|
|
387
|
-
context,
|
|
388
|
-
page
|
|
389
|
-
} = await (0, _launchBrowser.launchChromium)({
|
|
390
|
-
headless: false,
|
|
391
|
-
proxy,
|
|
392
|
-
appModeInitialUrl: startUrl
|
|
393
|
-
});
|
|
394
|
-
try {
|
|
395
|
-
if (!page.url().startsWith(startUrl)) {
|
|
396
|
-
await page.goto(startUrl);
|
|
397
|
-
}
|
|
398
|
-
(0, _terminal.terminal)(`^+Navigated to^ ^_${startUrl}^:\n`);
|
|
399
|
-
(0, _terminal.terminal)(`^+Waiting for^ ^_${finishUrl}^:...\n`);
|
|
400
|
-
const timeoutTimestamp = Date.now() + timeout;
|
|
401
|
-
while (true) {
|
|
402
|
-
if (Date.now() > timeoutTimestamp) {
|
|
403
|
-
throw new _helpers.CLIError("Timeout waiting for finish URL");
|
|
404
|
-
}
|
|
405
|
-
if (context.pages().length === 0) {
|
|
406
|
-
throw new _helpers.CLIError("Browser was closed before reaching the finish URL");
|
|
407
|
-
}
|
|
408
|
-
if (context.pages()[0].url().startsWith(finishUrl)) {
|
|
409
|
-
break;
|
|
410
|
-
}
|
|
411
|
-
await (0, _promises.setTimeout)(1000);
|
|
412
|
-
}
|
|
413
|
-
(0, _terminal.terminal)(`^+Finish URL reached, capturing auth session...^:\n`);
|
|
414
|
-
await page.waitForLoadState("load");
|
|
415
|
-
const authSession = await (0, _contextStorageStateHelpers.getStorageState)(context);
|
|
416
|
-
return authSession;
|
|
417
|
-
} finally {
|
|
418
|
-
await context.close();
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
function generateAuthSessionId(isAttempt = false) {
|
|
422
|
-
if (isAttempt) return `auth-session-attempt-${Date.now()}`;
|
|
423
|
-
return `auth-session-${Date.now()}`;
|
|
424
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const runBuild: () => Promise<boolean>;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.runBuild = void 0;
|
|
7
|
-
var fs = _interopRequireWildcard(require("fs-extra"));
|
|
8
|
-
var path = _interopRequireWildcard(require("path"));
|
|
9
|
-
var _child_process = require("child_process");
|
|
10
|
-
var _util = require("util");
|
|
11
|
-
var _terminal = require("../helpers/terminal");
|
|
12
|
-
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); }
|
|
13
|
-
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; }
|
|
14
|
-
const execPromise = (0, _util.promisify)(_child_process.exec);
|
|
15
|
-
const runBuild = async () => {
|
|
16
|
-
const distPath = path.join(process.cwd(), "dist");
|
|
17
|
-
if (await fs.exists(distPath)) {
|
|
18
|
-
await fs.remove(distPath);
|
|
19
|
-
}
|
|
20
|
-
const buildCommand = "tsc";
|
|
21
|
-
try {
|
|
22
|
-
await execPromise(buildCommand);
|
|
23
|
-
(0, _terminal.terminal)(`^g^+✨ Build completed successfully!^:\n`);
|
|
24
|
-
return true;
|
|
25
|
-
} catch (error) {
|
|
26
|
-
(0, _terminal.terminal)(`^r^+An error occurred during the build process:^:\n`);
|
|
27
|
-
if ("stdout" in error) {
|
|
28
|
-
(0, _terminal.terminal)(`${error.stdout}\n`);
|
|
29
|
-
} else {
|
|
30
|
-
(0, _terminal.terminal)(`^${error.message}^:\n`);
|
|
31
|
-
}
|
|
32
|
-
(0, _terminal.terminal)(`^r^+Build failed^:\n`);
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
exports.runBuild = runBuild;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { AuthCredentials } from "../types";
|
|
3
|
-
export declare const START_RUN_INPUT_QUERY_PARAM_KEY = "startRunInput";
|
|
4
|
-
export declare function runDeployProject(projectName: string, auth: AuthCredentials): Promise<void>;
|
|
5
|
-
export declare const projectNameSchema: z.ZodEffects<z.ZodString, string, string>;
|