@intuned/runtime-dev 1.3.0-dev-52 → 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 +4 -3
- 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 +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/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 +9 -2
- 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/runtime/executionHelpers.test.js +3 -4
- package/dist/runtime/export.d.ts +15 -0
- package/dist/runtime/extendPayload.js +1 -1
- package/package.json +14 -13
- 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
package/.babelrc
CHANGED
package/CHANGELOG.md
CHANGED
package/bin/intuned
ADDED
package/dist/commands/api/run.js
CHANGED
|
@@ -18,6 +18,7 @@ var _chalk = _interopRequireDefault(require("chalk"));
|
|
|
18
18
|
var _runApi = require("../../common/runApi");
|
|
19
19
|
var _tsNodeImport = require("../common/tsNodeImport");
|
|
20
20
|
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
|
21
|
+
var _constants = require("../../common/constants");
|
|
21
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
23
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
23
24
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -40,7 +41,7 @@ async function executeCLI(apiName, mode, inputData, options) {
|
|
|
40
41
|
}
|
|
41
42
|
const runApiResult = await (0, _runApi.runApi)({
|
|
42
43
|
automationFunction: {
|
|
43
|
-
name:
|
|
44
|
+
name: `${_constants.API_FOLDER_NAME}/${apiName}`,
|
|
44
45
|
params: inputData
|
|
45
46
|
},
|
|
46
47
|
auth: authSessionPathToUse ? {
|
|
@@ -96,7 +97,7 @@ async function executeCLI(apiName, mode, inputData, options) {
|
|
|
96
97
|
_Logger.logger.info("This will only take an effect if this API run was part of a job.");
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
|
-
_commander.program.description("run the user function in the cli for testing purposes").option("-i, --input [file]", "input json file").option("-j, --json [json]", "input json string").option("--cdpAddress <cdpAddress>", "CDP address", "http://localhost:9222").option("--authSessionPath <authSession>", "auth session to use when executing the api").option("--outputFileId <outputFileId>", "the output file id to save the result in").option("--proxy <proxy>", "proxy to use").option("--
|
|
100
|
+
_commander.program.description("run the user function in the cli for testing purposes").option("-i, --input [file]", "input json file").option("-j, --json [json]", "input json string").option("--cdpAddress <cdpAddress>", "CDP address", "http://localhost:9222").option("--authSessionPath <authSession>", "auth session to use when executing the api").option("--outputFileId <outputFileId>", "the output file id to save the result in").option("--proxy <proxy>", "proxy to use").option("--authSessionParameters <authSessionParameters>", "parameters used to create the used auth session").argument("[apiName]", "name of the api", "default").allowUnknownOption().addArgument(new _commander.Argument("<mode>", "mode of execution").choices(["vanilla", "playwright", "playwright-standalone", "playwright-headless"]).default("playwright-standalone").argOptional()).action(async (apiName, mode, options) => {
|
|
100
101
|
let inputData = null;
|
|
101
102
|
if (options.input) {
|
|
102
103
|
inputData = await fs.readJSON(options.input);
|
|
@@ -106,7 +107,7 @@ _commander.program.description("run the user function in the cli for testing pur
|
|
|
106
107
|
inputData = {};
|
|
107
108
|
}
|
|
108
109
|
let authSessionParametersJson = undefined;
|
|
109
|
-
if (!(0, _isNil.default)(options
|
|
110
|
+
if (!(0, _isNil.default)(options?.authSessionParameters)) {
|
|
110
111
|
authSessionParametersJson = JSON.parse(options.authSessionParameters);
|
|
111
112
|
}
|
|
112
113
|
await (0, _asyncLocalStorage.runWithContext)({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BrowserContext } from "playwright
|
|
1
|
+
import { BrowserContext } from "playwright";
|
|
2
2
|
export declare const REMOTE_DEBUGGING_PORT = 9222;
|
|
3
3
|
export declare const getChromiumLaunchArgs: () => string[];
|
|
4
4
|
export declare function startOrRestartBrowser(): Promise<void>;
|
|
@@ -9,7 +9,7 @@ exports.saveSession = saveSession;
|
|
|
9
9
|
exports.saveSessionFromOpenedBrowser = saveSessionFromOpenedBrowser;
|
|
10
10
|
exports.startOrRestartBrowser = startOrRestartBrowser;
|
|
11
11
|
var _child_process = require("child_process");
|
|
12
|
-
var playwright = _interopRequireWildcard(require("playwright
|
|
12
|
+
var playwright = _interopRequireWildcard(require("playwright"));
|
|
13
13
|
var fs = _interopRequireWildcard(require("fs-extra"));
|
|
14
14
|
var _fileUtils = require("./utils/fileUtils");
|
|
15
15
|
var _contextStorageStateHelpers = require("../../common/contextStorageStateHelpers");
|
|
@@ -32,10 +32,9 @@ function compileTypeScript(apiFilePath) {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
function findFirstExecutableLine(sourceFile) {
|
|
35
|
-
var _defaultExportSymbol$;
|
|
36
35
|
let functionBody;
|
|
37
36
|
const defaultExportSymbol = sourceFile.getDefaultExportSymbol();
|
|
38
|
-
const defaultExportDeclaration = defaultExportSymbol
|
|
37
|
+
const defaultExportDeclaration = defaultExportSymbol?.getDeclarations()?.[0];
|
|
39
38
|
if (defaultExportDeclaration) {
|
|
40
39
|
if (defaultExportDeclaration.getKind() === _tsMorph.ts.SyntaxKind.FunctionDeclaration) {
|
|
41
40
|
functionBody = defaultExportDeclaration.getBody();
|
|
@@ -45,9 +44,8 @@ function findFirstExecutableLine(sourceFile) {
|
|
|
45
44
|
const expression = exportAssignment.getExpression();
|
|
46
45
|
if (!expression) continue;
|
|
47
46
|
if (expression.getKind() === _tsMorph.ts.SyntaxKind.Identifier || expression.getKind() === _tsMorph.ts.SyntaxKind.FunctionExpression || expression.getKind() === _tsMorph.ts.SyntaxKind.ArrowFunction) {
|
|
48
|
-
var _sourceFile$getVariab;
|
|
49
47
|
const identifier = expression.getText();
|
|
50
|
-
const possiblyExportedFunction = sourceFile.getFunction(identifier) ||
|
|
48
|
+
const possiblyExportedFunction = sourceFile.getFunction(identifier) || sourceFile.getVariableStatement(identifier)?.getDescendants().find(node => node.getKind() === _tsMorph.ts.SyntaxKind.FunctionExpression || node.getKind() === _tsMorph.ts.SyntaxKind.ArrowFunction);
|
|
51
49
|
if (possiblyExportedFunction) {
|
|
52
50
|
functionBody = possiblyExportedFunction.getBody();
|
|
53
51
|
break;
|
|
@@ -29,7 +29,8 @@ const startRunApiSchema = _zod.default.object({
|
|
|
29
29
|
jobId: _zod.default.string().optional(),
|
|
30
30
|
jobRunId: _zod.default.string().optional(),
|
|
31
31
|
runId: _zod.default.string().optional(),
|
|
32
|
-
queueId: _zod.default.string().optional()
|
|
32
|
+
queueId: _zod.default.string().optional(),
|
|
33
|
+
authSessionId: _zod.default.string().optional()
|
|
33
34
|
}).optional()
|
|
34
35
|
})
|
|
35
36
|
});
|
|
@@ -66,14 +67,12 @@ function runAutomationCLI(importFunction) {
|
|
|
66
67
|
let generator = null;
|
|
67
68
|
const abortController = new AbortController();
|
|
68
69
|
client.on("error", err => {
|
|
69
|
-
|
|
70
|
-
void ((_generator = generator) === null || _generator === void 0 ? void 0 : _generator.throw(err).catch(() => undefined));
|
|
70
|
+
void generator?.throw(err).catch(() => undefined);
|
|
71
71
|
});
|
|
72
72
|
const interruptSignalHandler = async () => {
|
|
73
|
-
var _generator2;
|
|
74
73
|
abortController.abort();
|
|
75
74
|
await (0, _promises.setTimeout)(60_000);
|
|
76
|
-
void
|
|
75
|
+
void generator?.throw(new Error("Interrupted")).catch(() => undefined);
|
|
77
76
|
client.end();
|
|
78
77
|
process.exit(1);
|
|
79
78
|
};
|
|
@@ -214,7 +213,7 @@ function runAutomationCLI(importFunction) {
|
|
|
214
213
|
_commander.program.parse(process.argv);
|
|
215
214
|
}
|
|
216
215
|
function getProxyUrlFromRunOptions(runOptions) {
|
|
217
|
-
if (
|
|
216
|
+
if (runOptions?.environment !== "standalone") return undefined;
|
|
218
217
|
const proxy = runOptions.proxy;
|
|
219
218
|
if (!proxy) return undefined;
|
|
220
219
|
const url = new URL(proxy.server);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const attemptCommand: import("commander").Command;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.attemptCommand = void 0;
|
|
7
|
+
var _command = require("./command");
|
|
8
|
+
const attemptCommand = exports.attemptCommand = _command.program.command("attempt").description("Execute an Intuned attempt");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const attemptApiCommand: import("commander").Command;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.attemptApiCommand = void 0;
|
|
7
|
+
var _api = require("../controller/api");
|
|
8
|
+
var _controller = require("../controller");
|
|
9
|
+
var _zod = require("zod");
|
|
10
|
+
var _types = require("./types");
|
|
11
|
+
var _helpers = require("../helpers");
|
|
12
|
+
var _attempt = require("./attempt.command");
|
|
13
|
+
const attemptApiCommandInputSchema = _zod.z.tuple([_zod.z.string().min(1, "API name is required"), _zod.z.string().min(1, "Parameters are required"), _types.baseCommandOptionsSchema.extend({
|
|
14
|
+
authSession: _zod.z.string().optional(),
|
|
15
|
+
outputFile: _zod.z.string().optional()
|
|
16
|
+
})]);
|
|
17
|
+
const attemptApiCommand = exports.attemptApiCommand = _attempt.attemptCommand.command("api").description("Execute an Intuned API attempt with parameters").argument("<api-name>", "Name of the API to run").argument("<parameters>", "Path to the JSON file containing API parameters OR the parameters as a JSON string").option("-a, --auth-session <id>", "ID of the auth session to use for the API. This is expected to be in ./auth-session-instances/<id>.json").option("--proxy <url>", "proxy URL to use").option("--timeout <time>", "timeout - milliseconds or ms-formatted string", "10 mins").option("--headless", "Run the API in headless mode (default: false). This will not open a browser window.").option("-o, --output-file <path>", "output file path").action((0, _helpers.withErrorLogging)(async (inputApiName, inputParameters, inputOptions) => {
|
|
18
|
+
const parseResult = attemptApiCommandInputSchema.safeParse([inputApiName, inputParameters, inputOptions]);
|
|
19
|
+
if (!parseResult.success) {
|
|
20
|
+
return (0, _helpers.logInvalidInput)(parseResult);
|
|
21
|
+
}
|
|
22
|
+
const [apiName, parameters, {
|
|
23
|
+
headless,
|
|
24
|
+
authSession,
|
|
25
|
+
outputFile,
|
|
26
|
+
timeout,
|
|
27
|
+
proxy
|
|
28
|
+
}] = parseResult.data;
|
|
29
|
+
await (0, _helpers.assertAuthConsistent)(authSession);
|
|
30
|
+
const inputData = await (0, _controller.loadParameters)(parameters);
|
|
31
|
+
await (0, _api.executeAttemptApiCLI)({
|
|
32
|
+
apiName,
|
|
33
|
+
inputData: inputData,
|
|
34
|
+
authSessionId: authSession,
|
|
35
|
+
proxy,
|
|
36
|
+
headless,
|
|
37
|
+
timeout,
|
|
38
|
+
outputFile
|
|
39
|
+
});
|
|
40
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const attemptAuthSessionCommand: import("commander").Command;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.attemptAuthSessionCommand = void 0;
|
|
7
|
+
var _attempt = require("./attempt.command");
|
|
8
|
+
const attemptAuthSessionCommand = exports.attemptAuthSessionCommand = _attempt.attemptCommand.command("authsession").description("Manage authentication sessions");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const attemptAuthSessionCheckCommand: import("commander").Command;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.attemptAuthSessionCheckCommand = void 0;
|
|
7
|
+
var _zod = require("zod");
|
|
8
|
+
var _authSession = require("../controller/authSession");
|
|
9
|
+
var _attempt_authsession = require("./attempt_authsession.command");
|
|
10
|
+
var _helpers = require("../helpers");
|
|
11
|
+
var _types = require("./types");
|
|
12
|
+
const attemptAuthSessionCheckSchema = _zod.z.tuple([_zod.z.string().min(1, "ID of the auth session is required"), _types.baseCommandOptionsSchema]);
|
|
13
|
+
const attemptAuthSessionCheckCommand = exports.attemptAuthSessionCheckCommand = _attempt_authsession.attemptAuthSessionCommand.command("check").description("Check an existing auth session").argument("<id>", "ID of the auth session to check").option("--proxy <url>", "Proxy URL to use for the auth session command").option("--timeout <time>", "Timeout for the auth session command - milliseconds or ms-formatted string", "10 mins").option("--headless", "Run the API in headless mode (default: false). This will not open a browser window.").action((0, _helpers.withErrorLogging)(async (inputId, inputOptions) => {
|
|
14
|
+
const parseResult = attemptAuthSessionCheckSchema.safeParse([inputId, inputOptions]);
|
|
15
|
+
if (!parseResult.success) {
|
|
16
|
+
return (0, _helpers.logInvalidInput)(parseResult);
|
|
17
|
+
}
|
|
18
|
+
const [id, options] = parseResult.data;
|
|
19
|
+
await (0, _helpers.assertAuthEnabled)();
|
|
20
|
+
await (0, _authSession.executeAttemptCheckAuthSessionCLI)({
|
|
21
|
+
id,
|
|
22
|
+
...options
|
|
23
|
+
});
|
|
24
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const attemptAuthSessionCreateCommand: import("commander").Command;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.attemptAuthSessionCreateCommand = void 0;
|
|
7
|
+
var _controller = require("../controller");
|
|
8
|
+
var _zod = require("zod");
|
|
9
|
+
var _authSession = require("../controller/authSession");
|
|
10
|
+
var _attempt_authsession = require("./attempt_authsession.command");
|
|
11
|
+
var _helpers = require("../helpers");
|
|
12
|
+
var _types = require("./types");
|
|
13
|
+
const attemptAuthSessionCreateInputSchema = _zod.z.tuple([_zod.z.string().min(1, "Parameters are required"), _types.baseCommandOptionsSchema.extend({
|
|
14
|
+
id: _zod.z.string().optional()
|
|
15
|
+
})]);
|
|
16
|
+
const attemptAuthSessionCreateCommand = exports.attemptAuthSessionCreateCommand = _attempt_authsession.attemptAuthSessionCommand.command("create").description("Create a new auth session").argument("<parameters>", "Parameters for the auth session command").option("--id <id>", "ID of the auth session to use for the command. Defaults to ./auth-session-instances/[current timestamp].json").option("--proxy <url>", "Proxy URL to use for the auth session command").option("--timeout <time>", "Timeout for the auth session command - milliseconds or ms-formatted string", "10 mins").option("--headless", "Run the API in headless mode (default: false). This will not open a browser window.").action((0, _helpers.withErrorLogging)(async (inputParameters, inputOptions) => {
|
|
17
|
+
const parseResult = attemptAuthSessionCreateInputSchema.safeParse([inputParameters, inputOptions]);
|
|
18
|
+
if (!parseResult.success) {
|
|
19
|
+
return (0, _helpers.logInvalidInput)(parseResult);
|
|
20
|
+
}
|
|
21
|
+
const [parameters, {
|
|
22
|
+
headless,
|
|
23
|
+
id,
|
|
24
|
+
timeout,
|
|
25
|
+
proxy
|
|
26
|
+
}] = parseResult.data;
|
|
27
|
+
await (0, _helpers.assertAuthEnabled)();
|
|
28
|
+
const authSessionInput = (await (0, _controller.loadParameters)(parameters)) ?? {};
|
|
29
|
+
await (0, _authSession.executeAttemptCreateAuthSessionCLI)({
|
|
30
|
+
id,
|
|
31
|
+
input: authSessionInput,
|
|
32
|
+
headless,
|
|
33
|
+
timeout,
|
|
34
|
+
proxy
|
|
35
|
+
});
|
|
36
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const buildCommand: import("commander").Command;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buildCommand = void 0;
|
|
7
|
+
var _command = require("./command");
|
|
8
|
+
var _build = require("../controller/build");
|
|
9
|
+
var _helpers = require("../helpers");
|
|
10
|
+
const buildCommand = exports.buildCommand = _command.program.command("build").description("Build Intuned project").action((0, _helpers.withErrorLogging)(async () => {
|
|
11
|
+
await (0, _build.runBuild)();
|
|
12
|
+
}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.program = void 0;
|
|
7
|
+
var _commander = require("commander");
|
|
8
|
+
const program = exports.program = new _commander.Command();
|
|
9
|
+
program.name("intuned").description("Intuned CLI for creating, developing and deploying Intuned projects").version("1.0.0").enablePositionalOptions(true);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const deployCommand: import("commander").Command;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.deployCommand = void 0;
|
|
7
|
+
var _command = require("./command");
|
|
8
|
+
var _dotenv = _interopRequireDefault(require("dotenv"));
|
|
9
|
+
var _deploy = require("../controller/deploy");
|
|
10
|
+
var _helpers = require("../helpers");
|
|
11
|
+
var _zod = require("zod");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
_dotenv.default.config({
|
|
14
|
+
path: `.env`
|
|
15
|
+
});
|
|
16
|
+
const deployCommandSchema = _zod.z.tuple([_zod.z.union([_zod.z.string(), _zod.z.undefined()]), _zod.z.object({
|
|
17
|
+
workspaceId: _zod.z.string().optional(),
|
|
18
|
+
apiKey: _zod.z.string().optional()
|
|
19
|
+
})]);
|
|
20
|
+
const deployCommand = exports.deployCommand = _command.program.command("deploy").description("Deploy an Intuned project to the platform").argument("[project-name]", "Name of the project to deploy").option("-w, --workspace-id <id>", "Your Intuned workspace ID").option("-k, --api-key <key>", "Your Intuned API key").action((0, _helpers.withErrorLogging)(async (inputProjectName, inputOptions) => {
|
|
21
|
+
const parseResult = deployCommandSchema.safeParse([inputProjectName, inputOptions]);
|
|
22
|
+
if (!parseResult.success) {
|
|
23
|
+
return (0, _helpers.logInvalidInput)(parseResult);
|
|
24
|
+
}
|
|
25
|
+
const [projectName, options] = parseResult.data;
|
|
26
|
+
const {
|
|
27
|
+
isValid,
|
|
28
|
+
errorMessage
|
|
29
|
+
} = await (0, _deploy.validateIntunedProject)();
|
|
30
|
+
if (!isValid) {
|
|
31
|
+
const message = `^r^+Project to be deployed is not a valid Intuned project:^:^R ${errorMessage}:\n`;
|
|
32
|
+
throw new _helpers.CLIError(message, {
|
|
33
|
+
autoColor: false
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const _projectName = projectName || (await (0, _helpers.getSettingIntunedJSON)("projectName"));
|
|
37
|
+
if (!_projectName) {
|
|
38
|
+
throw new _helpers.CLIError("Project name is required");
|
|
39
|
+
}
|
|
40
|
+
const projectNameValidation = (0, _deploy.validateProjectName)(_projectName);
|
|
41
|
+
if (!projectNameValidation.isValid) {
|
|
42
|
+
throw new _helpers.CLIError(projectNameValidation.errorMessage);
|
|
43
|
+
}
|
|
44
|
+
const auth = await (0, _helpers.getAuthCredentials)(options);
|
|
45
|
+
await (0, _deploy.runDeployProject)(_projectName, auth);
|
|
46
|
+
}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "./command";
|
|
2
|
+
export * from "./build.command";
|
|
3
|
+
export * from "./deploy.command";
|
|
4
|
+
export * from "./init.command";
|
|
5
|
+
export * from "./run.command";
|
|
6
|
+
export * from "./run_api.command";
|
|
7
|
+
export * from "./run_authsession.command";
|
|
8
|
+
export * from "./run_authsession_create.command";
|
|
9
|
+
export * from "./run_authsession_update.command";
|
|
10
|
+
export * from "./run_authsession_validate.command";
|
|
11
|
+
export * from "./attempt.command";
|
|
12
|
+
export * from "./attempt_api.command";
|
|
13
|
+
export * from "./attempt_authsession.command";
|
|
14
|
+
export * from "./attempt_authsession_create.command";
|
|
15
|
+
export * from "./attempt_authsession_check.command";
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _command = require("./command");
|
|
7
|
+
Object.keys(_command).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _command[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _command[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _build = require("./build.command");
|
|
18
|
+
Object.keys(_build).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _build[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _build[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _deploy = require("./deploy.command");
|
|
29
|
+
Object.keys(_deploy).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _deploy[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _deploy[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _init = require("./init.command");
|
|
40
|
+
Object.keys(_init).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _init[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _init[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _run = require("./run.command");
|
|
51
|
+
Object.keys(_run).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _run[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _run[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _run_api = require("./run_api.command");
|
|
62
|
+
Object.keys(_run_api).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _run_api[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _run_api[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
var _run_authsession = require("./run_authsession.command");
|
|
73
|
+
Object.keys(_run_authsession).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (key in exports && exports[key] === _run_authsession[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _run_authsession[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
var _run_authsession_create = require("./run_authsession_create.command");
|
|
84
|
+
Object.keys(_run_authsession_create).forEach(function (key) {
|
|
85
|
+
if (key === "default" || key === "__esModule") return;
|
|
86
|
+
if (key in exports && exports[key] === _run_authsession_create[key]) return;
|
|
87
|
+
Object.defineProperty(exports, key, {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () {
|
|
90
|
+
return _run_authsession_create[key];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
var _run_authsession_update = require("./run_authsession_update.command");
|
|
95
|
+
Object.keys(_run_authsession_update).forEach(function (key) {
|
|
96
|
+
if (key === "default" || key === "__esModule") return;
|
|
97
|
+
if (key in exports && exports[key] === _run_authsession_update[key]) return;
|
|
98
|
+
Object.defineProperty(exports, key, {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: function () {
|
|
101
|
+
return _run_authsession_update[key];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
var _run_authsession_validate = require("./run_authsession_validate.command");
|
|
106
|
+
Object.keys(_run_authsession_validate).forEach(function (key) {
|
|
107
|
+
if (key === "default" || key === "__esModule") return;
|
|
108
|
+
if (key in exports && exports[key] === _run_authsession_validate[key]) return;
|
|
109
|
+
Object.defineProperty(exports, key, {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function () {
|
|
112
|
+
return _run_authsession_validate[key];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
var _attempt = require("./attempt.command");
|
|
117
|
+
Object.keys(_attempt).forEach(function (key) {
|
|
118
|
+
if (key === "default" || key === "__esModule") return;
|
|
119
|
+
if (key in exports && exports[key] === _attempt[key]) return;
|
|
120
|
+
Object.defineProperty(exports, key, {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function () {
|
|
123
|
+
return _attempt[key];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
var _attempt_api = require("./attempt_api.command");
|
|
128
|
+
Object.keys(_attempt_api).forEach(function (key) {
|
|
129
|
+
if (key === "default" || key === "__esModule") return;
|
|
130
|
+
if (key in exports && exports[key] === _attempt_api[key]) return;
|
|
131
|
+
Object.defineProperty(exports, key, {
|
|
132
|
+
enumerable: true,
|
|
133
|
+
get: function () {
|
|
134
|
+
return _attempt_api[key];
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
var _attempt_authsession = require("./attempt_authsession.command");
|
|
139
|
+
Object.keys(_attempt_authsession).forEach(function (key) {
|
|
140
|
+
if (key === "default" || key === "__esModule") return;
|
|
141
|
+
if (key in exports && exports[key] === _attempt_authsession[key]) return;
|
|
142
|
+
Object.defineProperty(exports, key, {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
get: function () {
|
|
145
|
+
return _attempt_authsession[key];
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
var _attempt_authsession_create = require("./attempt_authsession_create.command");
|
|
150
|
+
Object.keys(_attempt_authsession_create).forEach(function (key) {
|
|
151
|
+
if (key === "default" || key === "__esModule") return;
|
|
152
|
+
if (key in exports && exports[key] === _attempt_authsession_create[key]) return;
|
|
153
|
+
Object.defineProperty(exports, key, {
|
|
154
|
+
enumerable: true,
|
|
155
|
+
get: function () {
|
|
156
|
+
return _attempt_authsession_create[key];
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
var _attempt_authsession_check = require("./attempt_authsession_check.command");
|
|
161
|
+
Object.keys(_attempt_authsession_check).forEach(function (key) {
|
|
162
|
+
if (key === "default" || key === "__esModule") return;
|
|
163
|
+
if (key in exports && exports[key] === _attempt_authsession_check[key]) return;
|
|
164
|
+
Object.defineProperty(exports, key, {
|
|
165
|
+
enumerable: true,
|
|
166
|
+
get: function () {
|
|
167
|
+
return _attempt_authsession_check[key];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const initCommand: import("commander").Command;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.initCommand = void 0;
|
|
7
|
+
var _command = require("./command");
|
|
8
|
+
var _helpers = require("../helpers");
|
|
9
|
+
const initCommand = exports.initCommand = _command.program.command("init").description("Deprecated: Initialize a new Intuned project").allowExcessArguments(true).allowUnknownOption(true).action((0, _helpers.withErrorLogging)(async () => {
|
|
10
|
+
throw new _helpers.CLIError("^r^+The init command has been deprecated. Please use^ ^c^/npx create-intuned-project^ ^r^+instead.^:", {
|
|
11
|
+
autoColor: false
|
|
12
|
+
});
|
|
13
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const runCommand: import("commander").Command;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.runCommand = void 0;
|
|
7
|
+
var _command = require("./command");
|
|
8
|
+
const runCommand = exports.runCommand = _command.program.command("run").description("Execute an Intuned run");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const runApiCommand: import("commander").Command;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.runApiCommand = void 0;
|
|
7
|
+
var _run = require("./run.command");
|
|
8
|
+
var _api = require("../controller/api");
|
|
9
|
+
var _controller = require("../controller");
|
|
10
|
+
var _zod = require("zod");
|
|
11
|
+
var _types = require("./types");
|
|
12
|
+
var _helpers = require("../helpers");
|
|
13
|
+
const runApiCommandInputSchema = _zod.z.tuple([_zod.z.string().min(1, "API name is required"), _zod.z.string().min(1, "Parameters are required"), _types.baseCommandOptionsSchema.extend({
|
|
14
|
+
retries: _zod.z.coerce.number().default(1),
|
|
15
|
+
authSession: _zod.z.string().optional(),
|
|
16
|
+
authSessionAutoRecreate: _zod.z.boolean().default(true),
|
|
17
|
+
outputFile: _zod.z.string().optional(),
|
|
18
|
+
authSessionCheckAttempts: _types.authSessionCheckAttemptsSchema,
|
|
19
|
+
authSessionCreateAttempts: _types.authSessionCreateAttemptsSchema
|
|
20
|
+
})]);
|
|
21
|
+
const runApiCommand = exports.runApiCommand = _run.runCommand.command("api").description("Execute an Intuned API run with parameters").argument("<api-name>", "Name of the API to run").argument("<parameters>", "Path to the JSON file containing API parameters OR the parameters as a JSON string").option("-a, --auth-session <id>", "ID of the auth session to use for the API. This is expected to be in ./auth-session-instances/<id>").option("--retries <number>", "Number of retries for the API call", "1").option("--proxy <url>", "proxy URL to use").option("--no-auth-session-auto-recreate", "disable auto recreate for auth session").option("--auth-session-check-attempts <number>", "auth session check attempts", "1").option("--auth-session-create-attempts <number>", "auth session create attempts", "1").option("--timeout <time>", "timeout - milliseconds or ms-formatted string", "10 mins").option("--headless", "Run the API in headless mode (default: false). This will not open a browser window.").option("-o, --output-file <path>", "output file path").action((0, _helpers.withErrorLogging)(async (inputApiName, inputParameters, inputOptions) => {
|
|
22
|
+
const parseResult = runApiCommandInputSchema.safeParse([inputApiName, inputParameters, inputOptions]);
|
|
23
|
+
if (!parseResult.success) {
|
|
24
|
+
return (0, _helpers.logInvalidInput)(parseResult);
|
|
25
|
+
}
|
|
26
|
+
const [apiName, parameters, {
|
|
27
|
+
retries,
|
|
28
|
+
headless,
|
|
29
|
+
timeout,
|
|
30
|
+
outputFile,
|
|
31
|
+
proxy,
|
|
32
|
+
authSession,
|
|
33
|
+
authSessionAutoRecreate,
|
|
34
|
+
authSessionCreateAttempts,
|
|
35
|
+
authSessionCheckAttempts
|
|
36
|
+
}] = parseResult.data;
|
|
37
|
+
await (0, _helpers.assertAuthConsistent)(authSession);
|
|
38
|
+
const inputData = await (0, _controller.loadParameters)(parameters);
|
|
39
|
+
await (0, _api.executeRunApiCLI)({
|
|
40
|
+
apiName,
|
|
41
|
+
inputData: inputData,
|
|
42
|
+
authSession: authSession ? {
|
|
43
|
+
id: authSession,
|
|
44
|
+
autoRecreate: authSessionAutoRecreate,
|
|
45
|
+
checkRetries: authSessionCheckAttempts,
|
|
46
|
+
createRetries: authSessionCreateAttempts
|
|
47
|
+
} : undefined,
|
|
48
|
+
retries,
|
|
49
|
+
outputFile,
|
|
50
|
+
proxy,
|
|
51
|
+
headless,
|
|
52
|
+
timeout
|
|
53
|
+
});
|
|
54
|
+
}));
|