@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,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _vitest = require("vitest");
|
|
4
|
-
var _browser = require("../browser");
|
|
5
|
-
var _launchBrowser = require("../../../../common/launchBrowser");
|
|
6
|
-
function getTerminal() {
|
|
7
|
-
return new Proxy(() => ({}), {
|
|
8
|
-
get: () => getTerminal(),
|
|
9
|
-
apply: () => ({})
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
_vitest.vi.mock("fs-extra", () => ({
|
|
13
|
-
exists: _vitest.vi.fn().mockResolvedValue(true)
|
|
14
|
-
}));
|
|
15
|
-
_vitest.vi.mock("portfinder", () => ({
|
|
16
|
-
getPort: _vitest.vi.fn().mockResolvedValue(1234)
|
|
17
|
-
}));
|
|
18
|
-
_vitest.vi.mock("../../../../common/launchBrowser", () => ({
|
|
19
|
-
launchChromium: _vitest.vi.fn().mockImplementation(async () => ({
|
|
20
|
-
context: {
|
|
21
|
-
close: _vitest.vi.fn().mockResolvedValue(undefined)
|
|
22
|
-
},
|
|
23
|
-
page: {}
|
|
24
|
-
}))
|
|
25
|
-
}));
|
|
26
|
-
_vitest.vi.mock("../../helpers/terminal", () => ({
|
|
27
|
-
terminal: getTerminal()
|
|
28
|
-
}));
|
|
29
|
-
_vitest.vi.mock("../../helpers/proxy", () => {
|
|
30
|
-
return {
|
|
31
|
-
parseUrlProxy: _vitest.vi.fn(v => v)
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
_vitest.vi.mock("../../helpers", async importOriginal => {
|
|
35
|
-
const original = await importOriginal();
|
|
36
|
-
return {
|
|
37
|
-
...original,
|
|
38
|
-
terminal: getTerminal()
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
|
-
(0, _vitest.describe)("Browser CLI options", () => {
|
|
42
|
-
(0, _vitest.it)("returns cdp options if cdpUrl is set", async () => {
|
|
43
|
-
const options = await (0, _browser.getCLIRunOptions)({
|
|
44
|
-
keepBrowserOpen: true,
|
|
45
|
-
headless: true,
|
|
46
|
-
cdpUrl: "cdp_url"
|
|
47
|
-
});
|
|
48
|
-
(0, _vitest.expect)(options).toEqual(_vitest.expect.objectContaining({
|
|
49
|
-
environment: "cdp",
|
|
50
|
-
cdpAddress: "cdp_url"
|
|
51
|
-
}));
|
|
52
|
-
});
|
|
53
|
-
(0, _vitest.it)("returns standalone options if keepBrowserOpen is not set", async () => {
|
|
54
|
-
const options = await (0, _browser.getCLIRunOptions)({
|
|
55
|
-
keepBrowserOpen: false,
|
|
56
|
-
headless: false
|
|
57
|
-
});
|
|
58
|
-
(0, _vitest.expect)(options).toEqual(_vitest.expect.objectContaining({
|
|
59
|
-
environment: "standalone",
|
|
60
|
-
headless: false
|
|
61
|
-
}));
|
|
62
|
-
});
|
|
63
|
-
(0, _vitest.describe)("when keepBrowserOpen is set", () => {
|
|
64
|
-
beforeEach(async () => {
|
|
65
|
-
_vitest.vi.clearAllMocks();
|
|
66
|
-
await (0, _browser.closeCliBrowser)();
|
|
67
|
-
});
|
|
68
|
-
(0, _vitest.it)("launches a browser with correct parameters and returns cdp options", async () => {
|
|
69
|
-
const options = await (0, _browser.getCLIRunOptions)({
|
|
70
|
-
keepBrowserOpen: true,
|
|
71
|
-
headless: false,
|
|
72
|
-
proxy: "proxy"
|
|
73
|
-
});
|
|
74
|
-
(0, _vitest.expect)(_launchBrowser.launchChromium).toHaveBeenCalledWith({
|
|
75
|
-
headless: false,
|
|
76
|
-
cdpPort: 1234,
|
|
77
|
-
proxy: "proxy"
|
|
78
|
-
});
|
|
79
|
-
(0, _vitest.expect)(options).toEqual(_vitest.expect.objectContaining({
|
|
80
|
-
environment: "cdp",
|
|
81
|
-
cdpAddress: "http://localhost:1234"
|
|
82
|
-
}));
|
|
83
|
-
});
|
|
84
|
-
(0, _vitest.it)("keeps context open until new context", async () => {
|
|
85
|
-
await (0, _browser.getCLIRunOptions)({
|
|
86
|
-
keepBrowserOpen: true,
|
|
87
|
-
headless: false,
|
|
88
|
-
proxy: "proxy"
|
|
89
|
-
});
|
|
90
|
-
const firstContext = (0, _browser._getContextForTest)();
|
|
91
|
-
(0, _vitest.expect)(firstContext).not.toBeNull();
|
|
92
|
-
(0, _vitest.expect)(_launchBrowser.launchChromium).toHaveBeenCalledTimes(1);
|
|
93
|
-
await (0, _browser.getCLIRunOptions)({
|
|
94
|
-
keepBrowserOpen: true,
|
|
95
|
-
headless: false,
|
|
96
|
-
proxy: "proxy"
|
|
97
|
-
});
|
|
98
|
-
const secondContext = (0, _browser._getContextForTest)();
|
|
99
|
-
(0, _vitest.expect)(secondContext).not.toBeNull();
|
|
100
|
-
(0, _vitest.expect)(firstContext).not.toBe(secondContext);
|
|
101
|
-
(0, _vitest.expect)(_launchBrowser.launchChromium).toHaveBeenCalledTimes(2);
|
|
102
|
-
});
|
|
103
|
-
(0, _vitest.it)("keeps context open until explicitly closed", async () => {
|
|
104
|
-
await (0, _browser.getCLIRunOptions)({
|
|
105
|
-
keepBrowserOpen: true,
|
|
106
|
-
headless: false,
|
|
107
|
-
proxy: "proxy"
|
|
108
|
-
});
|
|
109
|
-
(0, _vitest.expect)((0, _browser._getContextForTest)()).not.toBeNull();
|
|
110
|
-
await (0, _browser.closeCliBrowser)();
|
|
111
|
-
(0, _vitest.expect)((0, _browser._getContextForTest)()).toBeNull();
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _vitest = require("vitest");
|
|
4
|
-
var _ = require("..");
|
|
5
|
-
function getTerminal() {
|
|
6
|
-
return new Proxy(() => ({}), {
|
|
7
|
-
get: () => getTerminal(),
|
|
8
|
-
apply: () => ({})
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_vitest.vi.mock("fs-extra", () => ({
|
|
12
|
-
exists: _vitest.vi.fn().mockResolvedValue(true)
|
|
13
|
-
}));
|
|
14
|
-
_vitest.vi.mock("../../helpers/terminal", () => ({
|
|
15
|
-
terminal: getTerminal()
|
|
16
|
-
}));
|
|
17
|
-
_vitest.vi.mock("../../helpers", async importOriginal => {
|
|
18
|
-
const original = await importOriginal();
|
|
19
|
-
return {
|
|
20
|
-
...original,
|
|
21
|
-
terminal: getTerminal()
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
(0, _vitest.describe)("Tracing wrapper", () => {
|
|
25
|
-
(0, _vitest.it)("calls wrapped function with disabled tracing when id is undefined", async () => {
|
|
26
|
-
const fn = _vitest.vi.fn();
|
|
27
|
-
await (0, _.withCLITrace)(fn, undefined);
|
|
28
|
-
(0, _vitest.expect)(fn).toHaveBeenCalledWith({
|
|
29
|
-
enabled: false
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
(0, _vitest.it)("calls wrapped function with enabled tracing when id is defined", async () => {
|
|
33
|
-
const fn = _vitest.vi.fn();
|
|
34
|
-
await (0, _.withCLITrace)(fn, "trace-id");
|
|
35
|
-
(0, _vitest.expect)(fn).toHaveBeenCalledWith({
|
|
36
|
-
enabled: true,
|
|
37
|
-
filePath: _vitest.expect.stringContaining("trace-id")
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
});
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { API_FOLDER_NAME, AUTH_SESSIONS_FOLDER_NAME } from "../../../common/constants";
|
|
2
|
-
export declare function assertApiFileExists(dirname: typeof AUTH_SESSIONS_FOLDER_NAME, api: "create" | "check"): Promise<void>;
|
|
3
|
-
export declare function assertApiFileExists(dirname: typeof API_FOLDER_NAME, api: string): Promise<void>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.assertApiFileExists = assertApiFileExists;
|
|
7
|
-
var _path = _interopRequireDefault(require("path"));
|
|
8
|
-
var _fsExtra = require("fs-extra");
|
|
9
|
-
var _errors = require("./errors");
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
async function assertApiFileExists(dirname, api) {
|
|
12
|
-
const file = `${dirname}/${api}.ts`;
|
|
13
|
-
const filePath = _path.default.join(process.cwd(), file);
|
|
14
|
-
if (!(await (0, _fsExtra.exists)(filePath))) {
|
|
15
|
-
throw new _errors.CLIAssertionError(`^+^r API^ ^+${dirname}/${api}^ ^r^+is not implemented.^:`, {
|
|
16
|
-
autoColor: false
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { AuthSessionMetadata } from "../types";
|
|
2
|
-
import { RunApiStorageState as StorageState } from "../../../common/runApi";
|
|
3
|
-
export declare function isAuthEnabled(): Promise<boolean>;
|
|
4
|
-
export declare function assertAuthEnabled(): Promise<void>;
|
|
5
|
-
export declare function assertAuthConsistent(authSession: string | undefined): Promise<void>;
|
|
6
|
-
export declare function loadAuthSessionInstance(authSessionId: string): Promise<{
|
|
7
|
-
storageState: {
|
|
8
|
-
cookies: {
|
|
9
|
-
path: string;
|
|
10
|
-
value: string;
|
|
11
|
-
domain: string;
|
|
12
|
-
name: string;
|
|
13
|
-
expires: number;
|
|
14
|
-
httpOnly: boolean;
|
|
15
|
-
secure: boolean;
|
|
16
|
-
sameSite: "Strict" | "Lax" | "None";
|
|
17
|
-
}[];
|
|
18
|
-
origins: {
|
|
19
|
-
origin: string;
|
|
20
|
-
localStorage: {
|
|
21
|
-
value: string;
|
|
22
|
-
name: string;
|
|
23
|
-
}[];
|
|
24
|
-
}[];
|
|
25
|
-
sessionStorage?: {
|
|
26
|
-
origin: string;
|
|
27
|
-
sessionStorage: {
|
|
28
|
-
value: string;
|
|
29
|
-
name: string;
|
|
30
|
-
}[];
|
|
31
|
-
}[] | undefined;
|
|
32
|
-
};
|
|
33
|
-
metadata: AuthSessionMetadata;
|
|
34
|
-
}>;
|
|
35
|
-
export declare function storeAuthSessionInstance({ state, id, input, proxy, metadata, }: {
|
|
36
|
-
state: StorageState;
|
|
37
|
-
id: string;
|
|
38
|
-
input?: Record<string, any>;
|
|
39
|
-
proxy?: string;
|
|
40
|
-
metadata?: AuthSessionMetadata;
|
|
41
|
-
}): Promise<string>;
|
|
42
|
-
export declare function registerGetAuthSessionParameters(authSessionId?: string): void;
|
|
43
|
-
export declare function getAuthSessionRecorderParameters(): Promise<{
|
|
44
|
-
startUrl: string;
|
|
45
|
-
finishUrl: string;
|
|
46
|
-
}>;
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.assertAuthConsistent = assertAuthConsistent;
|
|
7
|
-
exports.assertAuthEnabled = assertAuthEnabled;
|
|
8
|
-
exports.getAuthSessionRecorderParameters = getAuthSessionRecorderParameters;
|
|
9
|
-
exports.isAuthEnabled = isAuthEnabled;
|
|
10
|
-
exports.loadAuthSessionInstance = loadAuthSessionInstance;
|
|
11
|
-
exports.registerGetAuthSessionParameters = registerGetAuthSessionParameters;
|
|
12
|
-
exports.storeAuthSessionInstance = storeAuthSessionInstance;
|
|
13
|
-
var _constants = require("../../../common/constants");
|
|
14
|
-
var _path = _interopRequireDefault(require("path"));
|
|
15
|
-
var _fsExtra = require("fs-extra");
|
|
16
|
-
var _intunedJson = require("./intunedJson");
|
|
17
|
-
var _errors = require("./errors");
|
|
18
|
-
var _runApi = require("../../../common/runApi");
|
|
19
|
-
var _formatZodError = require("../../../common/formatZodError");
|
|
20
|
-
var _asyncLocalStorage = require("../../../common/asyncLocalStorage");
|
|
21
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
-
async function isAuthEnabled() {
|
|
23
|
-
try {
|
|
24
|
-
const intunedJson = await (0, _intunedJson.loadIntunedJson)();
|
|
25
|
-
return Boolean(intunedJson?.authSessions?.enabled);
|
|
26
|
-
} catch (error) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
async function assertAuthEnabled() {
|
|
31
|
-
if (!(await isAuthEnabled())) {
|
|
32
|
-
throw new _errors.CLIAssertionError(`Auth session is not enabled, enable it in ${await (0, _intunedJson.getIntunedSettingsFileName)()} to use it`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
async function assertAuthConsistent(authSession) {
|
|
36
|
-
const _isAuthEnabled = await isAuthEnabled();
|
|
37
|
-
if (_isAuthEnabled && !authSession) {
|
|
38
|
-
throw new _errors.CLIAssertionError("Auth session is enabled, but no auth session is provided. Please provide an auth session ID.");
|
|
39
|
-
}
|
|
40
|
-
if (!_isAuthEnabled && authSession) {
|
|
41
|
-
throw new _errors.CLIAssertionError(`Auth session is not enabled, enable it in ${await (0, _intunedJson.getIntunedSettingsFileName)()} to use it`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
async function loadAuthSessionInstance(authSessionId) {
|
|
45
|
-
try {
|
|
46
|
-
const authSessionInstancePath = _path.default.join(process.cwd(), _constants.AUTH_SESSIONS_INSTANCES_FOLDER_NAME, authSessionId);
|
|
47
|
-
const authSessionInstanceStoragePath = _path.default.join(authSessionInstancePath, `auth-session.json`);
|
|
48
|
-
const authSessionInstanceMetadataPath = _path.default.join(authSessionInstancePath, `metadata.json`);
|
|
49
|
-
if (!(await (0, _fsExtra.exists)(authSessionInstanceStoragePath))) {
|
|
50
|
-
throw new _errors.CLIError(`Auth session instance with ID ${authSessionId} not found`);
|
|
51
|
-
}
|
|
52
|
-
const authSessionInstanceJson = await (0, _fsExtra.readJSON)(authSessionInstanceStoragePath);
|
|
53
|
-
const authSessionInstanceParseResult = _runApi.runApiStorageStateSchema.safeParse(authSessionInstanceJson);
|
|
54
|
-
if (!authSessionInstanceParseResult.success) {
|
|
55
|
-
throw new _errors.CLIError(`Auth session instance with ID ${authSessionId} is not valid: ${(0, _formatZodError.formatZodError)(authSessionInstanceParseResult.error)}`);
|
|
56
|
-
}
|
|
57
|
-
const metadata = await (0, _fsExtra.readJSON)(authSessionInstanceMetadataPath);
|
|
58
|
-
return {
|
|
59
|
-
storageState: authSessionInstanceParseResult.data,
|
|
60
|
-
metadata
|
|
61
|
-
};
|
|
62
|
-
} catch (error) {
|
|
63
|
-
throw new _errors.CLIError(`Error retrieving auth session instance: ${error.message}`);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
async function storeAuthSessionInstance({
|
|
67
|
-
state,
|
|
68
|
-
id,
|
|
69
|
-
input,
|
|
70
|
-
proxy,
|
|
71
|
-
metadata
|
|
72
|
-
}) {
|
|
73
|
-
try {
|
|
74
|
-
const authSessionsDirectoryPath = _path.default.join(process.cwd(), _constants.AUTH_SESSIONS_INSTANCES_FOLDER_NAME);
|
|
75
|
-
await (0, _fsExtra.ensureDir)(authSessionsDirectoryPath);
|
|
76
|
-
const authSessionInstancePath = _path.default.join(authSessionsDirectoryPath, id);
|
|
77
|
-
await (0, _fsExtra.ensureDir)(authSessionInstancePath);
|
|
78
|
-
const authSessionInstanceStoragePath = _path.default.join(authSessionInstancePath, `auth-session.json`);
|
|
79
|
-
await (0, _fsExtra.writeJSON)(authSessionInstanceStoragePath, state, {
|
|
80
|
-
spaces: 2
|
|
81
|
-
});
|
|
82
|
-
const projectAuthConfig = (await (0, _intunedJson.loadIntunedJson)()).authSessions;
|
|
83
|
-
if (!projectAuthConfig.enabled) {
|
|
84
|
-
throw new _errors.CLIError(`Auth sessions are not enabled in ${await (0, _intunedJson.getIntunedSettingsFileName)()}`);
|
|
85
|
-
}
|
|
86
|
-
const authSessionInstanceMetadataPath = _path.default.join(authSessionInstancePath, `metadata.json`);
|
|
87
|
-
const authSessionMetadata = {
|
|
88
|
-
createdAt: metadata?.createdAt ?? new Date().toISOString(),
|
|
89
|
-
updatedAt: new Date().toISOString(),
|
|
90
|
-
...(projectAuthConfig.type === "API" && {
|
|
91
|
-
authSessionInput: input || metadata?.authSessionInput || {}
|
|
92
|
-
}),
|
|
93
|
-
authSessionId: id,
|
|
94
|
-
authSessionType: projectAuthConfig.type ?? metadata?.authSessionType ?? "API",
|
|
95
|
-
...(projectAuthConfig.type === "MANUAL" && {
|
|
96
|
-
recorderStartUrl: projectAuthConfig.startUrl,
|
|
97
|
-
recorderEndUrl: projectAuthConfig.finishUrl
|
|
98
|
-
}),
|
|
99
|
-
authSessionInput: input || metadata?.authSessionInput || {},
|
|
100
|
-
authSessionProxy: proxy || metadata?.authSessionProxy
|
|
101
|
-
};
|
|
102
|
-
await (0, _fsExtra.writeJSON)(authSessionInstanceMetadataPath, authSessionMetadata, {
|
|
103
|
-
spaces: 2
|
|
104
|
-
});
|
|
105
|
-
return authSessionInstancePath;
|
|
106
|
-
} catch (error) {
|
|
107
|
-
throw new _errors.CLIError(`Error storing auth session instance: ${error.message}`);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
function registerGetAuthSessionParameters(authSessionId) {
|
|
111
|
-
async function getAuthSessionParameters() {
|
|
112
|
-
if (!authSessionId) {
|
|
113
|
-
throw new Error("getAuthSessionParameters cannot be called without using an auth session");
|
|
114
|
-
}
|
|
115
|
-
const {
|
|
116
|
-
metadata
|
|
117
|
-
} = await loadAuthSessionInstance(authSessionId);
|
|
118
|
-
if (metadata?.authSessionType === "MANUAL") {
|
|
119
|
-
throw new Error("Auth session is recorder-based, it does not have parameters.");
|
|
120
|
-
}
|
|
121
|
-
return metadata?.authSessionInput ?? {};
|
|
122
|
-
}
|
|
123
|
-
(0, _asyncLocalStorage.getExecutionContext)().getAuthSessionParameters = getAuthSessionParameters;
|
|
124
|
-
}
|
|
125
|
-
async function getAuthSessionRecorderParameters() {
|
|
126
|
-
const intunedJson = await (0, _intunedJson.loadIntunedJson)();
|
|
127
|
-
if (!intunedJson.authSessions.enabled) {
|
|
128
|
-
throw new _errors.CLIError(`Auth sessions are not enabled in ${await (0, _intunedJson.getIntunedSettingsFileName)()}`);
|
|
129
|
-
}
|
|
130
|
-
if (intunedJson.authSessions.type !== "MANUAL") {
|
|
131
|
-
throw new _errors.CLIError(`Auth session type is not recorder-based in ${await (0, _intunedJson.getIntunedSettingsFileName)()}`);
|
|
132
|
-
}
|
|
133
|
-
const {
|
|
134
|
-
startUrl,
|
|
135
|
-
finishUrl
|
|
136
|
-
} = intunedJson.authSessions;
|
|
137
|
-
if (startUrl === undefined || finishUrl === undefined) {
|
|
138
|
-
throw new _errors.CLIError(`Auth session type is recorder-based but start_url or finish_url is not set in ${await (0, _intunedJson.getIntunedSettingsFileName)()}`);
|
|
139
|
-
}
|
|
140
|
-
return {
|
|
141
|
-
startUrl,
|
|
142
|
-
finishUrl
|
|
143
|
-
};
|
|
144
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getAuthCredentials = getAuthCredentials;
|
|
7
|
-
exports.getBaseUrl = getBaseUrl;
|
|
8
|
-
var _constants = require("../../../common/constants");
|
|
9
|
-
var _errors = require("./errors");
|
|
10
|
-
var _intunedJson = require("./intunedJson");
|
|
11
|
-
async function getAuthCredentials(options) {
|
|
12
|
-
const workspaceId = options.workspaceId || (await (0, _intunedJson.loadIntunedJson)()).workspaceId;
|
|
13
|
-
const apiKey = options.apiKey || process.env[_constants.API_KEY_ENV_VAR_KEY];
|
|
14
|
-
if (!workspaceId) {
|
|
15
|
-
throw new _errors.CLIError(`Workspace ID is required. Please provide it via command line options or ${await (0, _intunedJson.getIntunedSettingsFileName)()}`);
|
|
16
|
-
}
|
|
17
|
-
if (!apiKey) {
|
|
18
|
-
throw new _errors.CLIError(`API key is required. Please provide it via command line options or ${_constants.API_KEY_ENV_VAR_KEY} environment variable.`);
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
workspaceId,
|
|
22
|
-
apiKey
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function getBaseUrl() {
|
|
26
|
-
return new URL(process.env[_constants.API_BASE_URL_ENV_VAR_KEY] || process.env.INTUNED_API_DOMAIN || `https://app.intuned.io`).origin;
|
|
27
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { BrowserContext } from "playwright";
|
|
2
|
-
import type { runApiParametersSchema } from "../../../common/runApi";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
declare let context: BrowserContext | null;
|
|
5
|
-
export declare function _getContextForTest(): typeof context;
|
|
6
|
-
type RunApiRunOptions = z.infer<typeof runApiParametersSchema>["runOptions"];
|
|
7
|
-
export declare function getCLIRunOptions({ headless, proxy, keepBrowserOpen, cdpUrl, }: {
|
|
8
|
-
headless: boolean;
|
|
9
|
-
proxy?: string;
|
|
10
|
-
keepBrowserOpen: boolean;
|
|
11
|
-
cdpUrl?: string;
|
|
12
|
-
}): Promise<RunApiRunOptions>;
|
|
13
|
-
export declare function isCliBrowserLaunched(): boolean;
|
|
14
|
-
export declare function closeCliBrowser(): Promise<void>;
|
|
15
|
-
export {};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports._getContextForTest = _getContextForTest;
|
|
7
|
-
exports.closeCliBrowser = closeCliBrowser;
|
|
8
|
-
exports.getCLIRunOptions = getCLIRunOptions;
|
|
9
|
-
exports.isCliBrowserLaunched = isCliBrowserLaunched;
|
|
10
|
-
var _launchBrowser = require("../../../common/launchBrowser");
|
|
11
|
-
var _portfinder = require("portfinder");
|
|
12
|
-
var _proxy = require("./proxy");
|
|
13
|
-
let context = null;
|
|
14
|
-
function _getContextForTest() {
|
|
15
|
-
if (process.env.NODE_ENV !== "test") {
|
|
16
|
-
throw new Error("_getContextForTest should only be used in tests");
|
|
17
|
-
}
|
|
18
|
-
return context;
|
|
19
|
-
}
|
|
20
|
-
async function getCLIRunOptions({
|
|
21
|
-
headless,
|
|
22
|
-
proxy,
|
|
23
|
-
keepBrowserOpen,
|
|
24
|
-
cdpUrl
|
|
25
|
-
}) {
|
|
26
|
-
if (context) {
|
|
27
|
-
await closeCliBrowser();
|
|
28
|
-
}
|
|
29
|
-
if (cdpUrl) {
|
|
30
|
-
return {
|
|
31
|
-
environment: "cdp",
|
|
32
|
-
cdpAddress: cdpUrl
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
if (!keepBrowserOpen) {
|
|
36
|
-
return {
|
|
37
|
-
environment: "standalone",
|
|
38
|
-
headless,
|
|
39
|
-
proxy: proxy ? (0, _proxy.parseUrlProxy)(proxy) : undefined
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
const port = await (0, _portfinder.getPort)({});
|
|
43
|
-
({
|
|
44
|
-
context
|
|
45
|
-
} = await (0, _launchBrowser.launchChromium)({
|
|
46
|
-
headless,
|
|
47
|
-
proxy: proxy ? (0, _proxy.parseUrlProxy)(proxy) : undefined,
|
|
48
|
-
cdpPort: port
|
|
49
|
-
}));
|
|
50
|
-
return {
|
|
51
|
-
environment: "cdp",
|
|
52
|
-
cdpAddress: `http://localhost:${port}`
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function isCliBrowserLaunched() {
|
|
56
|
-
return context !== null;
|
|
57
|
-
}
|
|
58
|
-
async function closeCliBrowser() {
|
|
59
|
-
if (!context) return;
|
|
60
|
-
try {
|
|
61
|
-
await context.close();
|
|
62
|
-
context = null;
|
|
63
|
-
} catch (e) {}
|
|
64
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.withCLIContext = withCLIContext;
|
|
7
|
-
var _nanoid = require("nanoid");
|
|
8
|
-
var _asyncLocalStorage = require("../../../common/asyncLocalStorage");
|
|
9
|
-
var _enums = require("../../../runtime/enums");
|
|
10
|
-
var _auth = require("./auth");
|
|
11
|
-
async function withCLIContext(fn, options) {
|
|
12
|
-
const runId = (0, _nanoid.nanoid)();
|
|
13
|
-
async function getAuthSessionParameters() {
|
|
14
|
-
const id = options?.authSessionId;
|
|
15
|
-
if (!id) {
|
|
16
|
-
throw new Error("getAuthSessionParameters cannot be called without using an auth session");
|
|
17
|
-
}
|
|
18
|
-
const {
|
|
19
|
-
metadata
|
|
20
|
-
} = await (0, _auth.loadAuthSessionInstance)(id);
|
|
21
|
-
if (metadata?.authSessionType === "MANUAL") {
|
|
22
|
-
throw new Error("Auth session is recorder-based, it does not have parameters.");
|
|
23
|
-
}
|
|
24
|
-
return metadata?.authSessionInput ?? {};
|
|
25
|
-
}
|
|
26
|
-
return await (0, _asyncLocalStorage.runWithContext)({
|
|
27
|
-
runEnvironment: _enums.RunEnvironment.IDE,
|
|
28
|
-
runId,
|
|
29
|
-
extendedPayloads: [],
|
|
30
|
-
timeoutInfo: {},
|
|
31
|
-
getAuthSessionParameters
|
|
32
|
-
}, fn);
|
|
33
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { RunAutomationError } from "../../../common/runApi/errors";
|
|
2
|
-
export declare class CLIError extends Error {
|
|
3
|
-
autoColor: boolean;
|
|
4
|
-
constructor(message: string, options?: {
|
|
5
|
-
autoColor?: boolean;
|
|
6
|
-
});
|
|
7
|
-
}
|
|
8
|
-
export declare class AbortedCLIError extends CLIError {
|
|
9
|
-
constructor();
|
|
10
|
-
}
|
|
11
|
-
export declare class CLIAssertionError extends CLIError {
|
|
12
|
-
constructor(message: string, options?: {
|
|
13
|
-
autoColor?: boolean;
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
export declare function logAutomationError(error: RunAutomationError): void;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.CLIError = exports.CLIAssertionError = exports.AbortedCLIError = void 0;
|
|
7
|
-
exports.logAutomationError = logAutomationError;
|
|
8
|
-
var _errors = require("../../../common/runApi/errors");
|
|
9
|
-
var _terminal = require("./terminal");
|
|
10
|
-
class CLIError extends Error {
|
|
11
|
-
constructor(message, options) {
|
|
12
|
-
super(message);
|
|
13
|
-
this.name = "CLIError";
|
|
14
|
-
this.autoColor = options?.autoColor ?? true;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.CLIError = CLIError;
|
|
18
|
-
class AbortedCLIError extends CLIError {
|
|
19
|
-
constructor() {
|
|
20
|
-
super("Aborted");
|
|
21
|
-
this.name = "AbortedCLIError";
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.AbortedCLIError = AbortedCLIError;
|
|
25
|
-
class CLIAssertionError extends CLIError {
|
|
26
|
-
constructor(message, options) {
|
|
27
|
-
super(message, options);
|
|
28
|
-
this.name = "CLIAssertionError";
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.CLIAssertionError = CLIAssertionError;
|
|
32
|
-
function logAutomationError(error) {
|
|
33
|
-
(0, _terminal.terminal)(`^r^+An error occurred while running the API:^:\n`);
|
|
34
|
-
if (error instanceof _errors.AutomationError) {
|
|
35
|
-
if (error.error.stack) {
|
|
36
|
-
const stackLines = error.error.stack.split("\n").filter(line => !line.includes("@intuned/runtime") && !line.includes("node:"));
|
|
37
|
-
(0, _terminal.terminal)(`^r${stackLines.join("\n")}^:\n`);
|
|
38
|
-
} else {
|
|
39
|
-
(0, _terminal.terminal)(`^r${error.error.message}^:\n`);
|
|
40
|
-
}
|
|
41
|
-
} else {
|
|
42
|
-
(0, _terminal.terminal)(`^r${error.message}^:\n`);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from "./api";
|
|
2
|
-
export * from "./auth";
|
|
3
|
-
export * from "./context";
|
|
4
|
-
export * from "./errors";
|
|
5
|
-
export * from "./proxy";
|
|
6
|
-
export * from "./terminal";
|
|
7
|
-
export * from "./timeout";
|
|
8
|
-
export * from "./validation";
|
|
9
|
-
export * from "./intunedJson";
|
|
10
|
-
export * from "./backend";
|
|
11
|
-
export * from "./traces";
|
|
12
|
-
export * from "./wrapper";
|