@intuned/runtime-dev 1.2.0-dev-52 → 1.2.1-hooks.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +2 -2
- package/.npmrc.wtf +1 -0
- package/CHANGELOG.md +5 -1
- package/WebTemplate.zip +0 -0
- package/bin/intuned +2 -0
- package/dist/commands/api/run.js +4 -3
- package/dist/commands/common/getFirstLineNumber.js +2 -4
- package/dist/commands/interface/run.js +5 -6
- package/dist/commands/intuned-cli/commands/attempt.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/attempt.command.js +8 -0
- package/dist/commands/intuned-cli/commands/attempt_api.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/attempt_api.command.js +40 -0
- package/dist/commands/intuned-cli/commands/attempt_authsession.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +8 -0
- package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +24 -0
- package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +36 -0
- package/dist/commands/intuned-cli/commands/build.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/build.command.js +12 -0
- package/dist/commands/intuned-cli/commands/command.d.ts +2 -0
- package/dist/commands/intuned-cli/commands/command.js +9 -0
- package/dist/commands/intuned-cli/commands/deploy.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/deploy.command.js +46 -0
- package/dist/commands/intuned-cli/commands/index.d.ts +15 -0
- package/dist/commands/intuned-cli/commands/index.js +170 -0
- package/dist/commands/intuned-cli/commands/init.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/init.command.js +13 -0
- package/dist/commands/intuned-cli/commands/run.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/run.command.js +8 -0
- package/dist/commands/intuned-cli/commands/run_api.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/run_api.command.js +54 -0
- package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +20 -0
- package/dist/commands/intuned-cli/commands/run_authsession.command.js +13 -0
- package/dist/commands/intuned-cli/commands/run_authsession_create.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +39 -0
- package/dist/commands/intuned-cli/commands/run_authsession_update.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +39 -0
- package/dist/commands/intuned-cli/commands/run_authsession_validate.command.d.ts +1 -0
- package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +37 -0
- package/dist/commands/intuned-cli/commands/types.d.ts +21 -0
- package/dist/commands/intuned-cli/commands/types.js +21 -0
- package/dist/commands/intuned-cli/constants/index.d.ts +17 -0
- package/dist/commands/intuned-cli/constants/index.js +25 -0
- package/dist/commands/intuned-cli/controller/__test__/api.test.js +280 -0
- package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +676 -0
- package/dist/commands/intuned-cli/controller/api.d.ts +44 -0
- package/dist/commands/intuned-cli/controller/api.js +181 -0
- package/dist/commands/intuned-cli/controller/authSession.d.ts +198 -0
- package/dist/commands/intuned-cli/controller/authSession.js +292 -0
- package/dist/commands/intuned-cli/controller/build.d.ts +1 -0
- package/dist/commands/intuned-cli/controller/build.js +36 -0
- package/dist/commands/intuned-cli/controller/deploy.d.ts +15 -0
- package/dist/commands/{deploy/utils.js → intuned-cli/controller/deploy.js} +115 -109
- package/dist/commands/intuned-cli/controller/index.d.ts +1 -0
- package/dist/commands/intuned-cli/controller/index.js +46 -0
- package/dist/commands/intuned-cli/helpers/api.d.ts +3 -0
- package/dist/commands/intuned-cli/helpers/api.js +19 -0
- package/dist/commands/intuned-cli/helpers/auth.d.ts +41 -0
- package/dist/commands/intuned-cli/helpers/auth.js +129 -0
- package/dist/commands/intuned-cli/helpers/backend.d.ts +8 -0
- package/dist/commands/intuned-cli/helpers/backend.js +26 -0
- package/dist/commands/intuned-cli/helpers/context.d.ts +3 -0
- package/dist/commands/intuned-cli/helpers/context.js +33 -0
- package/dist/commands/intuned-cli/helpers/errors.d.ts +14 -0
- package/dist/commands/intuned-cli/helpers/errors.js +55 -0
- package/dist/commands/intuned-cli/helpers/index.d.ts +10 -0
- package/dist/commands/intuned-cli/helpers/index.js +115 -0
- package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +1 -0
- package/dist/{common/cli/utils.js → commands/intuned-cli/helpers/intunedJson.js} +0 -16
- package/dist/commands/intuned-cli/helpers/proxy.d.ts +5 -0
- package/dist/commands/intuned-cli/helpers/proxy.js +23 -0
- package/dist/commands/intuned-cli/helpers/terminal.d.ts +5 -0
- package/dist/commands/intuned-cli/helpers/terminal.js +13 -0
- package/dist/commands/intuned-cli/helpers/timeout.d.ts +1 -0
- package/dist/commands/intuned-cli/helpers/timeout.js +23 -0
- package/dist/commands/intuned-cli/helpers/validation.d.ts +2 -0
- package/dist/commands/intuned-cli/helpers/validation.js +12 -0
- package/dist/commands/intuned-cli/index.d.ts +1 -0
- package/dist/commands/intuned-cli/index.js +16 -0
- package/dist/commands/intuned-cli/main.d.ts +1 -0
- package/dist/commands/intuned-cli/main.js +15 -0
- package/dist/{common/cli → commands/intuned-cli}/types.d.ts +1 -34
- package/dist/{common/cli → commands/intuned-cli}/types.js +1 -2
- package/dist/common/assets/browser_scripts.js +2509 -2143
- package/dist/common/asyncLocalStorage/index.d.ts +1 -0
- package/dist/common/constants.d.ts +1 -0
- package/dist/common/constants.js +2 -1
- package/dist/common/getPlaywrightConstructs.d.ts +5 -4
- package/dist/common/getPlaywrightConstructs.js +71 -35
- package/dist/common/jwtTokenManager.js +3 -5
- package/dist/common/runApi/errors.js +5 -6
- package/dist/common/runApi/index.d.ts +3 -0
- package/dist/common/runApi/index.js +22 -21
- package/dist/common/runApi/types.d.ts +144 -13
- package/dist/common/runApi/types.js +28 -27
- package/dist/runtime/executionHelpers.test.js +3 -4
- package/dist/runtime/export.d.ts +17 -0
- package/dist/runtime/extendPayload.js +1 -1
- package/dist/runtime/getCdpAddress.d.ts +1 -0
- package/dist/runtime/getCdpAddress.js +11 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +8 -1
- package/package.json +11 -12
- package/tsconfig.json +2 -1
- package/bin/check-auth-session +0 -3
- package/bin/cli-build +0 -3
- package/bin/create-auth-session +0 -3
- package/bin/deploy +0 -3
- package/bin/init +0 -3
- package/bin/run-api +0 -3
- package/dist/commands/cli-auth-sessions/check.d.ts +0 -2
- package/dist/commands/cli-auth-sessions/check.js +0 -40
- package/dist/commands/cli-auth-sessions/create.d.ts +0 -2
- package/dist/commands/cli-auth-sessions/create.js +0 -53
- package/dist/commands/cli-auth-sessions/utils.d.ts +0 -28
- package/dist/commands/cli-auth-sessions/utils.js +0 -285
- package/dist/commands/cli-build/cli-build.d.ts +0 -2
- package/dist/commands/cli-build/cli-build.js +0 -20
- package/dist/commands/deploy/deploy.d.ts +0 -2
- package/dist/commands/deploy/deploy.js +0 -47
- package/dist/commands/deploy/utils.d.ts +0 -16
- package/dist/commands/init/init.d.ts +0 -2
- package/dist/commands/init/init.js +0 -22
- package/dist/commands/init/utils.d.ts +0 -11
- package/dist/commands/init/utils.js +0 -181
- package/dist/commands/run-api-cli/run-api.d.ts +0 -2
- package/dist/commands/run-api-cli/run-api.js +0 -57
- package/dist/commands/run-api-cli/utils.d.ts +0 -9
- package/dist/commands/run-api-cli/utils.js +0 -144
- package/dist/common/cli/cliReadme.d.ts +0 -1
- package/dist/common/cli/cliReadme.js +0 -92
- package/dist/common/cli/constants.d.ts +0 -33
- package/dist/common/cli/constants.js +0 -39
- package/dist/common/cli/utils.d.ts +0 -6
|
@@ -3,40 +3,41 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.runApiSessionSchema = exports.runApiParametersSchema = void 0;
|
|
6
|
+
exports.runApiStorageStateSchema = exports.runApiSessionSchema = exports.runApiParametersSchema = void 0;
|
|
7
7
|
var _zod = _interopRequireDefault(require("zod"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const runApiStorageStateSchema = exports.runApiStorageStateSchema = _zod.default.object({
|
|
10
|
+
cookies: _zod.default.array(_zod.default.object({
|
|
11
|
+
name: _zod.default.string(),
|
|
12
|
+
value: _zod.default.string(),
|
|
13
|
+
domain: _zod.default.string(),
|
|
14
|
+
path: _zod.default.string(),
|
|
15
|
+
expires: _zod.default.number(),
|
|
16
|
+
httpOnly: _zod.default.boolean(),
|
|
17
|
+
secure: _zod.default.boolean(),
|
|
18
|
+
sameSite: _zod.default.enum(["Strict", "Lax", "None"])
|
|
19
|
+
})),
|
|
20
|
+
origins: _zod.default.array(_zod.default.object({
|
|
21
|
+
origin: _zod.default.string(),
|
|
22
|
+
localStorage: _zod.default.array(_zod.default.object({
|
|
23
|
+
name: _zod.default.string(),
|
|
24
|
+
value: _zod.default.string()
|
|
25
|
+
}))
|
|
26
|
+
})),
|
|
27
|
+
sessionStorage: _zod.default.array(_zod.default.object({
|
|
28
|
+
origin: _zod.default.string(),
|
|
29
|
+
sessionStorage: _zod.default.array(_zod.default.object({
|
|
30
|
+
name: _zod.default.string(),
|
|
31
|
+
value: _zod.default.string()
|
|
32
|
+
}))
|
|
33
|
+
})).optional()
|
|
34
|
+
});
|
|
9
35
|
const runApiSessionSchema = exports.runApiSessionSchema = _zod.default.discriminatedUnion("type", [_zod.default.object({
|
|
10
36
|
type: _zod.default.literal("file"),
|
|
11
37
|
path: _zod.default.string()
|
|
12
38
|
}), _zod.default.object({
|
|
13
39
|
type: _zod.default.literal("state"),
|
|
14
|
-
state:
|
|
15
|
-
cookies: _zod.default.array(_zod.default.object({
|
|
16
|
-
name: _zod.default.string(),
|
|
17
|
-
value: _zod.default.string(),
|
|
18
|
-
domain: _zod.default.string(),
|
|
19
|
-
path: _zod.default.string(),
|
|
20
|
-
expires: _zod.default.number(),
|
|
21
|
-
httpOnly: _zod.default.boolean(),
|
|
22
|
-
secure: _zod.default.boolean(),
|
|
23
|
-
sameSite: _zod.default.enum(["Strict", "Lax", "None"])
|
|
24
|
-
})),
|
|
25
|
-
origins: _zod.default.array(_zod.default.object({
|
|
26
|
-
origin: _zod.default.string(),
|
|
27
|
-
localStorage: _zod.default.array(_zod.default.object({
|
|
28
|
-
name: _zod.default.string(),
|
|
29
|
-
value: _zod.default.string()
|
|
30
|
-
}))
|
|
31
|
-
})),
|
|
32
|
-
sessionStorage: _zod.default.array(_zod.default.object({
|
|
33
|
-
origin: _zod.default.string(),
|
|
34
|
-
sessionStorage: _zod.default.array(_zod.default.object({
|
|
35
|
-
name: _zod.default.string(),
|
|
36
|
-
value: _zod.default.string()
|
|
37
|
-
}))
|
|
38
|
-
})).optional()
|
|
39
|
-
}).nullable().optional()
|
|
40
|
+
state: runApiStorageStateSchema.nullable().optional()
|
|
40
41
|
})]);
|
|
41
42
|
const runApiParametersSchema = exports.runApiParametersSchema = _zod.default.object({
|
|
42
43
|
automationFunction: _zod.default.object({
|
|
@@ -24,13 +24,12 @@ var _enums = require("./enums");
|
|
|
24
24
|
runId: "test-run-id",
|
|
25
25
|
extendedPayloads: []
|
|
26
26
|
}, () => {
|
|
27
|
-
|
|
28
|
-
(0, _vitest.expect)((_getExecutionContext = (0, _asyncLocalStorage.getExecutionContext)()) === null || _getExecutionContext === void 0 ? void 0 : _getExecutionContext.extendedPayloads).toEqual([]);
|
|
27
|
+
(0, _vitest.expect)((0, _asyncLocalStorage.getExecutionContext)()?.extendedPayloads).toEqual([]);
|
|
29
28
|
(0, _.extendPayload)({
|
|
30
29
|
api: "test-api",
|
|
31
30
|
parameters: {}
|
|
32
31
|
});
|
|
33
|
-
(0, _vitest.expect)((
|
|
32
|
+
(0, _vitest.expect)((0, _asyncLocalStorage.getExecutionContext)()?.extendedPayloads).toEqual([{
|
|
34
33
|
api: "test-api",
|
|
35
34
|
parameters: {}
|
|
36
35
|
}]);
|
|
@@ -47,7 +46,7 @@ var _enums = require("./enums");
|
|
|
47
46
|
parameters: {}
|
|
48
47
|
});
|
|
49
48
|
const context = (0, _asyncLocalStorage.getExecutionContext)();
|
|
50
|
-
(0, _vitest.expect)(context
|
|
49
|
+
(0, _vitest.expect)(context?.extendedPayloads).toHaveLength(4);
|
|
51
50
|
});
|
|
52
51
|
});
|
|
53
52
|
});
|
package/dist/runtime/export.d.ts
CHANGED
|
@@ -201,3 +201,20 @@ export declare function requestMultipleChoice(
|
|
|
201
201
|
* ```
|
|
202
202
|
*/
|
|
203
203
|
export declare function requestOTP(message: string): unknown;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Retrieves the parameters for the authentication session currently being used.
|
|
207
|
+
*
|
|
208
|
+
* @returns {AuthSessionParameters} An object containing the parameters for the current authentication session.
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```typescript getAuthSessionParameters
|
|
212
|
+
* import { getAuthSessionParameters } from "@intuned/sdk/runtime"
|
|
213
|
+
*
|
|
214
|
+
* const authSessionParams = getAuthSessionParameters();
|
|
215
|
+
* console.log(authSessionParams);
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
export declare function getAuthSessionParameters(): Promise<any>;
|
|
219
|
+
|
|
220
|
+
export declare function getCdpAddress(): string | undefined;
|
|
@@ -16,6 +16,6 @@ function extendPayload(payload) {
|
|
|
16
16
|
context.extendedPayloads = [...items];
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
context
|
|
19
|
+
context?.extendedPayloads.push(...items);
|
|
20
20
|
(0, _extendTimeout.extendTimeout)();
|
|
21
21
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getCdpAddress(): string | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getCdpAddress = getCdpAddress;
|
|
7
|
+
var _asyncLocalStorage = require("../common/asyncLocalStorage");
|
|
8
|
+
function getCdpAddress() {
|
|
9
|
+
const context = (0, _asyncLocalStorage.getExecutionContext)();
|
|
10
|
+
return context?.cdpAddress;
|
|
11
|
+
}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -6,3 +6,4 @@ export { RunError } from "./RunError";
|
|
|
6
6
|
export { requestMultipleChoice, requestOTP } from "./requestMoreInfo";
|
|
7
7
|
export type { RequestMoreInfoDetails } from "./requestMoreInfo";
|
|
8
8
|
export { getDownloadDirectoryPath } from "./downloadDirectory";
|
|
9
|
+
export { getCdpAddress } from "./getCdpAddress";
|
package/dist/runtime/index.js
CHANGED
|
@@ -27,6 +27,12 @@ Object.defineProperty(exports, "getAuthSessionParameters", {
|
|
|
27
27
|
return _getAuthSessionParameters.getAuthSessionParameters;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
+
Object.defineProperty(exports, "getCdpAddress", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _getCdpAddress.getCdpAddress;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
30
36
|
Object.defineProperty(exports, "getDownloadDirectoryPath", {
|
|
31
37
|
enumerable: true,
|
|
32
38
|
get: function () {
|
|
@@ -57,4 +63,5 @@ var _getAuthSessionParameters = require("./getAuthSessionParameters");
|
|
|
57
63
|
var _runInfo = require("./runInfo");
|
|
58
64
|
var _RunError = require("./RunError");
|
|
59
65
|
var _requestMoreInfo = require("./requestMoreInfo");
|
|
60
|
-
var _downloadDirectory = require("./downloadDirectory");
|
|
66
|
+
var _downloadDirectory = require("./downloadDirectory");
|
|
67
|
+
var _getCdpAddress = require("./getCdpAddress");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intuned/runtime-dev",
|
|
3
|
-
"version": "1.2.0
|
|
3
|
+
"version": "1.2.1-hooks.0",
|
|
4
4
|
"description": "Intuned runtime",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"intuned-auth-session-refresh": "vite-node ./src/commands/auth/run-refresh.ts",
|
|
30
30
|
"intuned-auth-session-load": "vite-node ./src/commands/auth/load.ts",
|
|
31
31
|
"intuned-ts-check": "yarn prepublishOnly && vite-node ./src/commands/ts-check.ts",
|
|
32
|
+
"intuned": "vite-node ./src/commands/intuned-cli/main.ts",
|
|
32
33
|
"build": "rm -rf dist && tsc -p tsconfig.json && yarn copy-dts && babel src --out-dir dist --extensions '.ts' && cp -r ./src/common/assets dist/common/assets",
|
|
33
34
|
"test": "vitest run",
|
|
34
35
|
"test:watch": "vitest",
|
|
@@ -50,12 +51,7 @@
|
|
|
50
51
|
"intuned-browser-start": "./bin/intuned-browser-start",
|
|
51
52
|
"intuned-browser-save-state": "./bin/intuned-browser-save-state",
|
|
52
53
|
"intuned-ts-check": "./bin/intuned-ts-check",
|
|
53
|
-
"
|
|
54
|
-
"run-api": "./bin/run-api",
|
|
55
|
-
"deploy": "./bin/deploy",
|
|
56
|
-
"cli-build": "./bin/cli-build",
|
|
57
|
-
"create-auth-session": "./bin/create-auth-session",
|
|
58
|
-
"check-auth-session": "./bin/check-auth-session"
|
|
54
|
+
"intuned": "./bin/intuned"
|
|
59
55
|
},
|
|
60
56
|
"dependencies": {
|
|
61
57
|
"@babel/plugin-syntax-dynamic-import": "7.8.3",
|
|
@@ -69,12 +65,12 @@
|
|
|
69
65
|
"@types/node": "20.4.1",
|
|
70
66
|
"applicationinsights": "2.9.2",
|
|
71
67
|
"babel-plugin-dynamic-import-node": "2.3.3",
|
|
72
|
-
"boxen": "8.0.1",
|
|
73
68
|
"chalk": "^4.1.2",
|
|
74
|
-
"commander": "
|
|
69
|
+
"commander": "14.0.0",
|
|
75
70
|
"cross-fetch": "^4.0.0",
|
|
76
71
|
"dotenv": "^16.3.1",
|
|
77
72
|
"fs-extra": "^11.3.0",
|
|
73
|
+
"get-port": "^7.1.0",
|
|
78
74
|
"image-size": "^1.1.1",
|
|
79
75
|
"inquirer": "12.6.0",
|
|
80
76
|
"jsonwebtoken": "9.0.2",
|
|
@@ -88,6 +84,7 @@
|
|
|
88
84
|
"promptly": "3.2.0",
|
|
89
85
|
"rollup": "3.26.2",
|
|
90
86
|
"source-map": "0.7.4",
|
|
87
|
+
"terminal-kit": "^3.1.2",
|
|
91
88
|
"ts-morph": "21.0.1",
|
|
92
89
|
"ts-node": "10.9.1",
|
|
93
90
|
"tslib": "2.6.0",
|
|
@@ -106,7 +103,9 @@
|
|
|
106
103
|
"@ngneat/falso": "^7.2.0",
|
|
107
104
|
"@types/jest": "^29.5.3",
|
|
108
105
|
"@types/jsdom": "^21.1.1",
|
|
106
|
+
"@types/ms": "^2.1.0",
|
|
109
107
|
"@types/promptly": "^3.0.4",
|
|
108
|
+
"@types/terminal-kit": "^2.5.7",
|
|
110
109
|
"@types/wait-on": "^5.3.4",
|
|
111
110
|
"@typescript-eslint/eslint-plugin": "^5.47.1",
|
|
112
111
|
"@typescript-eslint/parser": "^7.5.0",
|
|
@@ -120,6 +119,7 @@
|
|
|
120
119
|
"eslint-plugin-deprecation": "^1.3.3",
|
|
121
120
|
"eslint-plugin-prettier": "^4.2.1",
|
|
122
121
|
"msw": "^2.1.2",
|
|
122
|
+
"playwright": "^1.55.0",
|
|
123
123
|
"typedoc": "^0.25.13",
|
|
124
124
|
"typedoc-plugin-frontmatter": "^1.0.0",
|
|
125
125
|
"typedoc-plugin-markdown": "^4.0.2",
|
|
@@ -130,7 +130,6 @@
|
|
|
130
130
|
"vitest": "^1.1.3"
|
|
131
131
|
},
|
|
132
132
|
"peerDependencies": {
|
|
133
|
-
"playwright": "*"
|
|
134
|
-
"playwright-core": "*"
|
|
133
|
+
"playwright": "*"
|
|
135
134
|
}
|
|
136
|
-
}
|
|
135
|
+
}
|
package/tsconfig.json
CHANGED
package/bin/check-auth-session
DELETED
package/bin/cli-build
DELETED
package/bin/create-auth-session
DELETED
package/bin/deploy
DELETED
package/bin/init
DELETED
package/bin/run-api
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
var _commander = require("commander");
|
|
5
|
-
var _dotenv = _interopRequireDefault(require("dotenv"));
|
|
6
|
-
var _utils = require("./utils");
|
|
7
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
_dotenv.default.config({
|
|
10
|
-
path: `.env`
|
|
11
|
-
});
|
|
12
|
-
_commander.program.description("Check an auth session, if it is still valid or not").argument("<auth-session>", "Name/id of the auth session instance to use").action(async authSession => {
|
|
13
|
-
try {
|
|
14
|
-
if (!authSession) {
|
|
15
|
-
throw new Error("Auth session instance is required, provide an ID/name for it");
|
|
16
|
-
}
|
|
17
|
-
const _isAuthEnabled = await (0, _utils.isAuthEnabled)();
|
|
18
|
-
if (!_isAuthEnabled) {
|
|
19
|
-
throw new Error("Auth session is not enabled, enable it in Intuned.json to be able to use it");
|
|
20
|
-
}
|
|
21
|
-
const checkApiExists = await (0, _utils.ensureAuthApi)("check");
|
|
22
|
-
if (!checkApiExists) {
|
|
23
|
-
throw new Error("Auth check API not implemented, please create it in the auth sessions specified directory");
|
|
24
|
-
}
|
|
25
|
-
const {
|
|
26
|
-
authSessionInstanceStoragePath
|
|
27
|
-
} = await (0, _utils.retrieveAuthSessionInstance)(authSession, true);
|
|
28
|
-
const checkResult = await (0, _utils.runCheckApi)(authSessionInstanceStoragePath);
|
|
29
|
-
if (checkResult) {
|
|
30
|
-
console.log(_chalk.default.green("✓ Auth session checked successfully"));
|
|
31
|
-
} else {
|
|
32
|
-
console.log(_chalk.default.red("✗ Auth session is not valid, check failed"));
|
|
33
|
-
}
|
|
34
|
-
} catch (error) {
|
|
35
|
-
console.error(_chalk.default.red(`Failed to check auth session: ${error.message}`));
|
|
36
|
-
} finally {
|
|
37
|
-
process.exit(0);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
_commander.program.parse(process.argv);
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
var _commander = require("commander");
|
|
5
|
-
var _dotenv = _interopRequireDefault(require("dotenv"));
|
|
6
|
-
var _utils = require("./utils");
|
|
7
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
|
-
var _utils2 = require("../run-api-cli/utils");
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
_dotenv.default.config({
|
|
11
|
-
path: `.env`
|
|
12
|
-
});
|
|
13
|
-
_commander.program.description("Create an auth session").argument("[auth-session-name]", "Name/id of the auth session instance to use (optional)").option("-i, --input <input>", "Auth session input parameters file").action(async (authSessionName, options) => {
|
|
14
|
-
try {
|
|
15
|
-
const _isAuthEnabled = await (0, _utils.isAuthEnabled)();
|
|
16
|
-
if (!_isAuthEnabled) {
|
|
17
|
-
throw new Error("Auth session is not enabled, enable it in Intuned.json to be able to use it");
|
|
18
|
-
}
|
|
19
|
-
const authType = await (0, _utils.getAuthType)();
|
|
20
|
-
let authSessionInstancePath;
|
|
21
|
-
if (authType === "MANUAL") {
|
|
22
|
-
const recorderConfig = await (0, _utils.ensureRecorderURLs)();
|
|
23
|
-
const {
|
|
24
|
-
startUrl,
|
|
25
|
-
endUrl
|
|
26
|
-
} = recorderConfig;
|
|
27
|
-
console.log(_chalk.default.blue("Starting auth session recorder..."));
|
|
28
|
-
const session = await (0, _utils.recordAuthSession)(startUrl, endUrl);
|
|
29
|
-
authSessionInstancePath = await (0, _utils.storeAuthSessionInstance)(session, authSessionName, {});
|
|
30
|
-
} else {
|
|
31
|
-
const createApiExists = await (0, _utils.ensureAuthApi)("create");
|
|
32
|
-
if (!createApiExists) {
|
|
33
|
-
throw new Error("Auth session create API not implemented, please create it in the auth sessions specified directory");
|
|
34
|
-
}
|
|
35
|
-
const authSessionInput = (await (0, _utils2.loadParameters)(options === null || options === void 0 ? void 0 : options.input)) ?? {};
|
|
36
|
-
const session = await (0, _utils.runCreateApi)(authSessionInput);
|
|
37
|
-
if (!session) {
|
|
38
|
-
console.error(_chalk.default.red("Failed to create auth session."));
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
authSessionInstancePath = await (0, _utils.storeAuthSessionInstance)(session, authSessionName, authSessionInput);
|
|
42
|
-
}
|
|
43
|
-
console.log(_chalk.default.green("✓ Auth session created successfully!"));
|
|
44
|
-
if (authSessionInstancePath) {
|
|
45
|
-
console.log(_chalk.default.underline.green.white(`🔒 Auth session instance and metadata stored at ${authSessionInstancePath}`));
|
|
46
|
-
}
|
|
47
|
-
} catch (error) {
|
|
48
|
-
console.error(_chalk.default.red(`Failed to create auth session: ${error.message}`));
|
|
49
|
-
} finally {
|
|
50
|
-
process.exit(0);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
_commander.program.parse(process.argv);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { StorageState } from "../../common/contextStorageStateHelpers";
|
|
2
|
-
import { AuthSessionMetadata, AuthSessionType } from "../../common/cli/types";
|
|
3
|
-
import * as playwright from "playwright";
|
|
4
|
-
export declare function isAuthEnabled(): Promise<boolean>;
|
|
5
|
-
export declare function getAuthType(): Promise<AuthSessionType>;
|
|
6
|
-
export declare function ensureRecorderURLs(): Promise<{
|
|
7
|
-
startUrl: string;
|
|
8
|
-
endUrl: string;
|
|
9
|
-
}>;
|
|
10
|
-
export declare function ensureAuthApi(operation: "create" | "check"): Promise<boolean>;
|
|
11
|
-
export declare function runCreateApi(authSessionInput: Record<string, any>): Promise<StorageState>;
|
|
12
|
-
export declare function runCheckApi(authSessionPath: string): Promise<boolean>;
|
|
13
|
-
export declare function runCreateApiViaCLI(authSessionInput: Record<string, any>): Promise<StorageState>;
|
|
14
|
-
export declare function runCheckApiViaCLI(authSessionPath: string): Promise<boolean>;
|
|
15
|
-
export declare function storeAuthSessionInstance(authSessionInstance: StorageState, customName?: string, authSessionInput?: Record<string, any>): Promise<string>;
|
|
16
|
-
export declare function retrieveAuthSessionInstance(authSessionId: string, pathsOnly?: boolean): Promise<{
|
|
17
|
-
authSessionInstanceStoragePath: string;
|
|
18
|
-
authSessionInstanceMetadataPath: string;
|
|
19
|
-
authSessionInstance?: undefined;
|
|
20
|
-
metadata?: undefined;
|
|
21
|
-
} | {
|
|
22
|
-
authSessionInstance: StorageState;
|
|
23
|
-
metadata: AuthSessionMetadata;
|
|
24
|
-
authSessionInstanceStoragePath?: undefined;
|
|
25
|
-
authSessionInstanceMetadataPath?: undefined;
|
|
26
|
-
}>;
|
|
27
|
-
export declare function getStorageState(context: playwright.BrowserContext): Promise<StorageState>;
|
|
28
|
-
export declare function recordAuthSession(startUrl: string, endUrl: string): Promise<StorageState>;
|