@intuned/runtime-dev 1.2.8-dev-peer-script → 1.3.0-responseLimits.1
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/CHANGELOG.md +5 -1
- package/bin/intuned +2 -0
- package/dist/commands/api/run.js +10 -3
- package/dist/commands/auth-sessions/run-check.js +18 -4
- package/dist/commands/auth-sessions/run-create.js +2 -1
- package/dist/commands/common/browserUtils.d.ts +1 -1
- package/dist/commands/common/browserUtils.js +1 -1
- package/dist/commands/common/getFirstLineNumber.js +2 -4
- package/dist/commands/interface/run.js +7 -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 -2
- package/dist/common/backendFunctions/getAuthSessionParameters.d.ts +1 -0
- package/dist/common/backendFunctions/getAuthSessionParameters.js +38 -0
- package/dist/common/constants.d.ts +1 -0
- package/dist/common/constants.js +2 -1
- package/dist/common/getPlaywrightConstructs.d.ts +1 -1
- package/dist/common/getPlaywrightConstructs.js +4 -12
- package/dist/common/jwtTokenManager.js +3 -5
- package/dist/common/runApi/errors.d.ts +10 -3
- package/dist/common/runApi/errors.js +21 -8
- package/dist/common/runApi/index.d.ts +4 -1
- package/dist/common/runApi/index.js +33 -21
- package/dist/common/runApi/types.d.ts +140 -9
- package/dist/common/runApi/types.js +28 -27
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -0
- package/dist/runtime/executionHelpers.test.js +3 -4
- package/dist/runtime/export.d.ts +16 -0
- package/dist/runtime/extendPayload.js +1 -1
- package/dist/runtime/extendTimeout.js +0 -7
- package/dist/runtime/getAuthSessionParameters.d.ts +1 -0
- package/dist/runtime/getAuthSessionParameters.js +20 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +7 -0
- package/package.json +12 -11
- package/template.tsconfig.json +4 -7
- 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({
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { extendPayload, extendTimeout, runInfo, RunError, requestMultipleChoice, requestOTP, } from "./runtime";
|
|
1
|
+
export { extendPayload, extendTimeout, runInfo, RunError, requestMultipleChoice, requestOTP, getAuthSessionParameters, } from "./runtime";
|
|
2
2
|
export { runWithContext, getExecutionContext, } from "./common/asyncLocalStorage";
|
|
3
3
|
export { getDownloadDirectoryPath } from "./runtime/downloadDirectory";
|
|
4
4
|
export { getProductionPlaywrightConstructs } from "./common/getPlaywrightConstructs";
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "extendTimeout", {
|
|
|
21
21
|
return _runtime.extendTimeout;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "getAuthSessionParameters", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _runtime.getAuthSessionParameters;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
24
30
|
Object.defineProperty(exports, "getDownloadDirectoryPath", {
|
|
25
31
|
enumerable: true,
|
|
26
32
|
get: function () {
|
|
@@ -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
|
@@ -99,6 +99,7 @@ export interface RunInfo {
|
|
|
99
99
|
jobRunId?: string;
|
|
100
100
|
queueId?: string;
|
|
101
101
|
proxy?: string;
|
|
102
|
+
authSessionId?: string;
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
/**
|
|
@@ -200,3 +201,18 @@ export declare function requestMultipleChoice(
|
|
|
200
201
|
* ```
|
|
201
202
|
*/
|
|
202
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>;
|
|
@@ -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
|
}
|
|
@@ -17,13 +17,6 @@ function extendTimeout() {
|
|
|
17
17
|
if (!timeoutInfo) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
if (timeoutInfo.timeoutTimestamp !== undefined && timeoutInfo.timeoutDuration !== undefined) {
|
|
21
|
-
const newTimeoutStamp = Date.now() + timeoutInfo.timeoutDuration;
|
|
22
|
-
if (newTimeoutStamp - timeoutInfo.timeoutTimestamp < _DEBOUNCE_TIME) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
timeoutInfo.timeoutTimestamp = newTimeoutStamp;
|
|
26
|
-
}
|
|
27
20
|
if (timeoutInfo.extendTimeoutCallback !== undefined) {
|
|
28
21
|
void timeoutInfo.extendTimeoutCallback().catch(() => undefined);
|
|
29
22
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getAuthSessionParameters(): Promise<any>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getAuthSessionParameters = getAuthSessionParameters;
|
|
7
|
+
var _asyncLocalStorage = require("../common/asyncLocalStorage");
|
|
8
|
+
async function getAuthSessionParameters() {
|
|
9
|
+
const context = (0, _asyncLocalStorage.getExecutionContext)();
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error("getAuthSessionParameters failed due to an internal error (context was not found).");
|
|
12
|
+
}
|
|
13
|
+
const {
|
|
14
|
+
getAuthSessionParameters
|
|
15
|
+
} = context;
|
|
16
|
+
if (!getAuthSessionParameters) {
|
|
17
|
+
throw new Error("getAuthSessionParameters failed due to an internal error (helper was not found on context).");
|
|
18
|
+
}
|
|
19
|
+
return await getAuthSessionParameters();
|
|
20
|
+
}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { extendPayload } from "./extendPayload";
|
|
2
2
|
export { extendTimeout } from "./extendTimeout";
|
|
3
|
+
export { getAuthSessionParameters } from "./getAuthSessionParameters";
|
|
3
4
|
export { runInfo } from "./runInfo";
|
|
4
5
|
export { RunError } from "./RunError";
|
|
5
6
|
export { requestMultipleChoice, requestOTP } from "./requestMoreInfo";
|
package/dist/runtime/index.js
CHANGED
|
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "extendTimeout", {
|
|
|
21
21
|
return _extendTimeout.extendTimeout;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "getAuthSessionParameters", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _getAuthSessionParameters.getAuthSessionParameters;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
24
30
|
Object.defineProperty(exports, "getDownloadDirectoryPath", {
|
|
25
31
|
enumerable: true,
|
|
26
32
|
get: function () {
|
|
@@ -47,6 +53,7 @@ Object.defineProperty(exports, "runInfo", {
|
|
|
47
53
|
});
|
|
48
54
|
var _extendPayload = require("./extendPayload");
|
|
49
55
|
var _extendTimeout = require("./extendTimeout");
|
|
56
|
+
var _getAuthSessionParameters = require("./getAuthSessionParameters");
|
|
50
57
|
var _runInfo = require("./runInfo");
|
|
51
58
|
var _RunError = require("./RunError");
|
|
52
59
|
var _requestMoreInfo = require("./requestMoreInfo");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intuned/runtime-dev",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-responseLimits.1",
|
|
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,9 +65,8 @@
|
|
|
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",
|
|
@@ -83,17 +78,21 @@
|
|
|
83
78
|
"minimatch": "10.0.1",
|
|
84
79
|
"nanoid": "3",
|
|
85
80
|
"neverthrow": "6.1.0",
|
|
81
|
+
"playwright-extra": "4.3.6",
|
|
86
82
|
"prettier": "2.8.0",
|
|
87
83
|
"promptly": "3.2.0",
|
|
88
84
|
"rollup": "3.26.2",
|
|
89
85
|
"source-map": "0.7.4",
|
|
86
|
+
"terminal-kit": "^3.1.2",
|
|
90
87
|
"ts-morph": "21.0.1",
|
|
91
88
|
"ts-node": "10.9.1",
|
|
92
89
|
"tslib": "2.6.0",
|
|
93
90
|
"typescript": "5.1.6",
|
|
94
91
|
"uuid": "11.1.0",
|
|
95
92
|
"wait-on": "7.2.0",
|
|
96
|
-
"zod": "^3.21.4"
|
|
93
|
+
"zod": "^3.21.4",
|
|
94
|
+
"playwright": "^1.44.0",
|
|
95
|
+
"playwright-core": "^1.44.0"
|
|
97
96
|
},
|
|
98
97
|
"devDependencies": {
|
|
99
98
|
"@babel/cli": "^7.23.4",
|
|
@@ -105,7 +104,9 @@
|
|
|
105
104
|
"@ngneat/falso": "^7.2.0",
|
|
106
105
|
"@types/jest": "^29.5.3",
|
|
107
106
|
"@types/jsdom": "^21.1.1",
|
|
107
|
+
"@types/ms": "^2.1.0",
|
|
108
108
|
"@types/promptly": "^3.0.4",
|
|
109
|
+
"@types/terminal-kit": "^2.5.7",
|
|
109
110
|
"@types/wait-on": "^5.3.4",
|
|
110
111
|
"@typescript-eslint/eslint-plugin": "^5.47.1",
|
|
111
112
|
"@typescript-eslint/parser": "^7.5.0",
|
|
@@ -131,4 +132,4 @@
|
|
|
131
132
|
"peerDependencies": {
|
|
132
133
|
"playwright": "*"
|
|
133
134
|
}
|
|
134
|
-
}
|
|
135
|
+
}
|
package/template.tsconfig.json
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"module": "ESNext",
|
|
4
3
|
"target": "ES2021",
|
|
5
|
-
"lib": [
|
|
6
|
-
"dom",
|
|
7
|
-
"es2021"
|
|
8
|
-
],
|
|
4
|
+
"lib": ["dom", "es2021"],
|
|
9
5
|
"resolveJsonModule": true,
|
|
10
6
|
"esModuleInterop": true,
|
|
11
|
-
"moduleResolution": "
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"module": "esnext",
|
|
12
9
|
"skipLibCheck": true
|
|
13
10
|
}
|
|
14
|
-
}
|
|
11
|
+
}
|
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-core";
|
|
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>;
|