@intuned/runtime-dev 1.2.0-cli.3 → 1.2.0-cli.5
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/dist/commands/intuned-cli/commands/attempt_api.command.js +1 -1
- package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +1 -1
- package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +1 -1
- package/dist/commands/intuned-cli/commands/build.command.js +1 -1
- package/dist/commands/intuned-cli/commands/deploy.command.js +3 -4
- package/dist/commands/intuned-cli/commands/init.command.js +1 -1
- package/dist/commands/intuned-cli/commands/run_api.command.js +1 -1
- package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +1 -1
- package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +1 -1
- package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +1 -1
- package/dist/commands/intuned-cli/constants/index.d.ts +36 -0
- package/dist/commands/intuned-cli/constants/index.js +63 -0
- package/dist/commands/intuned-cli/constants/readme.d.ts +1 -0
- package/dist/commands/intuned-cli/constants/readme.js +81 -0
- package/dist/commands/intuned-cli/controller/api.js +10 -9
- package/dist/commands/intuned-cli/controller/authSession.js +30 -27
- package/dist/commands/intuned-cli/controller/build.js +1 -1
- package/dist/commands/intuned-cli/controller/deploy.d.ts +1 -1
- package/dist/commands/intuned-cli/controller/deploy.js +9 -11
- package/dist/commands/intuned-cli/controller/index.js +5 -4
- package/dist/commands/intuned-cli/controller/init.d.ts +1 -1
- package/dist/commands/intuned-cli/controller/init.js +12 -15
- 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 +17 -0
- package/dist/commands/intuned-cli/helpers/auth.js +105 -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/commands/intuned-cli/helpers/intunedJson.js +19 -0
- 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/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/types.d.ts +42 -0
- package/dist/commands/intuned-cli/types.js +13 -0
- package/dist/common/cli/cliReadme.d.ts +0 -1
- package/dist/common/cli/cliReadme.js +1 -83
- package/dist/common/cli/constants.d.ts +0 -35
- package/dist/common/cli/constants.js +1 -43
- package/dist/common/cli/types.d.ts +0 -74
- package/dist/common/cli/types.js +1 -13
- package/dist/common/cli/utils.d.ts +0 -9
- package/dist/common/cli/utils.js +1 -39
- package/package.json +1 -7
- 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 -284
- 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/deploy/utils.js +0 -407
- 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 -175
- package/dist/commands/intuned-cli/commands/helpers.d.ts +0 -31
- package/dist/commands/intuned-cli/commands/helpers.js +0 -142
- 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/commands/intuned-cli/{terminal.d.ts → helpers/terminal.d.ts} +0 -0
- /package/dist/commands/intuned-cli/{terminal.js → helpers/terminal.js} +0 -0
|
@@ -8,7 +8,7 @@ var _api = require("../controller/api");
|
|
|
8
8
|
var _controller = require("../controller");
|
|
9
9
|
var _zod = require("zod");
|
|
10
10
|
var _types = require("./types");
|
|
11
|
-
var _helpers = require("
|
|
11
|
+
var _helpers = require("../helpers");
|
|
12
12
|
var _attempt = require("./attempt.command");
|
|
13
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
14
|
authSession: _zod.z.string().optional(),
|
|
@@ -7,7 +7,7 @@ exports.attemptAuthSessionCheckCommand = void 0;
|
|
|
7
7
|
var _zod = require("zod");
|
|
8
8
|
var _authSession = require("../controller/authSession");
|
|
9
9
|
var _attempt_authsession = require("./attempt_authsession.command");
|
|
10
|
-
var _helpers = require("
|
|
10
|
+
var _helpers = require("../helpers");
|
|
11
11
|
var _types = require("./types");
|
|
12
12
|
const attemptAuthSessionCheckSchema = _zod.z.tuple([_zod.z.string().min(1, "ID of the auth session is required"), _types.baseCommandOptionsSchema]);
|
|
13
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) => {
|
|
@@ -8,7 +8,7 @@ var _controller = require("../controller");
|
|
|
8
8
|
var _zod = require("zod");
|
|
9
9
|
var _authSession = require("../controller/authSession");
|
|
10
10
|
var _attempt_authsession = require("./attempt_authsession.command");
|
|
11
|
-
var _helpers = require("
|
|
11
|
+
var _helpers = require("../helpers");
|
|
12
12
|
var _types = require("./types");
|
|
13
13
|
const attemptAuthSessionCreateInputSchema = _zod.z.tuple([_zod.z.string().min(1, "Parameters are required"), _types.baseCommandOptionsSchema.extend({
|
|
14
14
|
id: _zod.z.string().optional()
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.buildCommand = void 0;
|
|
7
7
|
var _command = require("./command");
|
|
8
8
|
var _build = require("../controller/build");
|
|
9
|
-
var _helpers = require("
|
|
9
|
+
var _helpers = require("../helpers");
|
|
10
10
|
const buildCommand = exports.buildCommand = _command.program.command("build").description("Build Intuned project").action((0, _helpers.withErrorLogging)(async () => {
|
|
11
11
|
await (0, _build.runBuild)();
|
|
12
12
|
}));
|
|
@@ -7,9 +7,8 @@ exports.deployCommand = void 0;
|
|
|
7
7
|
var _command = require("./command");
|
|
8
8
|
var _dotenv = _interopRequireDefault(require("dotenv"));
|
|
9
9
|
var _deploy = require("../controller/deploy");
|
|
10
|
-
var
|
|
10
|
+
var _helpers = require("../helpers");
|
|
11
11
|
var _zod = require("zod");
|
|
12
|
-
var _helpers = require("./helpers");
|
|
13
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
13
|
_dotenv.default.config({
|
|
15
14
|
path: `.env`
|
|
@@ -34,7 +33,7 @@ const deployCommand = exports.deployCommand = _command.program.command("deploy")
|
|
|
34
33
|
autoColor: false
|
|
35
34
|
});
|
|
36
35
|
}
|
|
37
|
-
const _projectName = projectName || (await (0,
|
|
36
|
+
const _projectName = projectName || (await (0, _helpers.getSettingIntunedJSON)("projectName"));
|
|
38
37
|
if (!_projectName) {
|
|
39
38
|
throw new _helpers.CLIError("Project name is required");
|
|
40
39
|
}
|
|
@@ -42,6 +41,6 @@ const deployCommand = exports.deployCommand = _command.program.command("deploy")
|
|
|
42
41
|
if (!projectNameValidation.isValid) {
|
|
43
42
|
throw new _helpers.CLIError(projectNameValidation.errorMessage);
|
|
44
43
|
}
|
|
45
|
-
const auth = await (0,
|
|
44
|
+
const auth = await (0, _helpers.getAuthCredentials)(options);
|
|
46
45
|
await (0, _deploy.runDeployProject)(_projectName, auth);
|
|
47
46
|
}));
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.initCommand = void 0;
|
|
7
7
|
var _init = require("../controller/init");
|
|
8
8
|
var _command = require("./command");
|
|
9
|
-
var _helpers = require("
|
|
9
|
+
var _helpers = require("../helpers");
|
|
10
10
|
const initCommand = exports.initCommand = _command.program.command("init").description("Initialize a new Intuned project from a template").argument("[template-name]", "Name of the template to use").action((0, _helpers.withErrorLogging)(async templateName => {
|
|
11
11
|
const template = await (0, _init.selectTemplate)(templateName);
|
|
12
12
|
const isTargetDirectoryEmpty = await (0, _init.checkEmptyDirectory)();
|
|
@@ -9,7 +9,7 @@ var _api = require("../controller/api");
|
|
|
9
9
|
var _controller = require("../controller");
|
|
10
10
|
var _zod = require("zod");
|
|
11
11
|
var _types = require("./types");
|
|
12
|
-
var _helpers = require("
|
|
12
|
+
var _helpers = require("../helpers");
|
|
13
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
14
|
retries: _zod.z.coerce.number().default(1),
|
|
15
15
|
authSession: _zod.z.string().optional(),
|
|
@@ -8,7 +8,7 @@ var _controller = require("../controller");
|
|
|
8
8
|
var _zod = require("zod");
|
|
9
9
|
var _authSession = require("../controller/authSession");
|
|
10
10
|
var _run_authsession = require("./run_authsession.command");
|
|
11
|
-
var _helpers = require("
|
|
11
|
+
var _helpers = require("../helpers");
|
|
12
12
|
const runAuthSessionCreateInputSchema = _zod.z.tuple([_zod.z.string().min(1, "Parameters are required"), _run_authsession.baseRunAuthSessionCommandOptionsSchema.extend({
|
|
13
13
|
id: _zod.z.string().optional()
|
|
14
14
|
})]);
|
|
@@ -8,7 +8,7 @@ var _controller = require("../controller");
|
|
|
8
8
|
var _zod = require("zod");
|
|
9
9
|
var _authSession = require("../controller/authSession");
|
|
10
10
|
var _run_authsession = require("./run_authsession.command");
|
|
11
|
-
var _helpers = require("
|
|
11
|
+
var _helpers = require("../helpers");
|
|
12
12
|
const runAuthSessionUpdateSchema = _zod.z.tuple([_zod.z.string().min(1, "ID of the auth session is required"), _run_authsession.baseRunAuthSessionCommandOptionsSchema.extend({
|
|
13
13
|
parameters: _zod.z.string().optional()
|
|
14
14
|
})]);
|
|
@@ -7,7 +7,7 @@ exports.runAuthSessionValidateCommand = void 0;
|
|
|
7
7
|
var _zod = require("zod");
|
|
8
8
|
var _authSession = require("../controller/authSession");
|
|
9
9
|
var _run_authsession = require("./run_authsession.command");
|
|
10
|
-
var _helpers = require("
|
|
10
|
+
var _helpers = require("../helpers");
|
|
11
11
|
const runAuthSessionValidateSchema = _zod.z.tuple([_zod.z.string().min(1, "ID of the auth session is required"), _run_authsession.baseRunAuthSessionCommandOptionsSchema.extend({
|
|
12
12
|
autoRecreate: _zod.z.boolean().default(true)
|
|
13
13
|
})]);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const CURRENT_PLAYWRIGHT_VERSION = "1.44.1";
|
|
2
|
+
export declare const ProjectDeploymentStatus: readonly ["completed", "failed", "pending", "not_found"];
|
|
3
|
+
export declare const PROJECT_DEPLOY_TIMEOUT: number;
|
|
4
|
+
export declare const PROJECT_DEPLOY_CHECK_PERIOD: number;
|
|
5
|
+
export declare const userCLIScripts: {
|
|
6
|
+
"dev:local": string;
|
|
7
|
+
dev: string;
|
|
8
|
+
build: string;
|
|
9
|
+
"types-check": string;
|
|
10
|
+
"pre-publish": string;
|
|
11
|
+
start: string;
|
|
12
|
+
"run-api": string;
|
|
13
|
+
"cli-build": string;
|
|
14
|
+
deploy: string;
|
|
15
|
+
"cli-create-auth-session": string;
|
|
16
|
+
"cli-check-auth-session": string;
|
|
17
|
+
"browser-save-state": string;
|
|
18
|
+
"auth-session-check": string;
|
|
19
|
+
"auth-session-create": string;
|
|
20
|
+
"auth-session-refresh": string;
|
|
21
|
+
"auth-session-load": string;
|
|
22
|
+
};
|
|
23
|
+
export declare const tsConfigCli: {
|
|
24
|
+
compilerOptions: {
|
|
25
|
+
moduleResolution: string;
|
|
26
|
+
module: string;
|
|
27
|
+
target: string;
|
|
28
|
+
outDir: string;
|
|
29
|
+
sourceMap: boolean;
|
|
30
|
+
declaration: boolean;
|
|
31
|
+
esModuleInterop: boolean;
|
|
32
|
+
};
|
|
33
|
+
include: string[];
|
|
34
|
+
exclude: string[];
|
|
35
|
+
};
|
|
36
|
+
export * from "./readme";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
CURRENT_PLAYWRIGHT_VERSION: true,
|
|
8
|
+
ProjectDeploymentStatus: true,
|
|
9
|
+
PROJECT_DEPLOY_TIMEOUT: true,
|
|
10
|
+
PROJECT_DEPLOY_CHECK_PERIOD: true,
|
|
11
|
+
userCLIScripts: true,
|
|
12
|
+
tsConfigCli: true
|
|
13
|
+
};
|
|
14
|
+
exports.userCLIScripts = exports.tsConfigCli = exports.ProjectDeploymentStatus = exports.PROJECT_DEPLOY_TIMEOUT = exports.PROJECT_DEPLOY_CHECK_PERIOD = exports.CURRENT_PLAYWRIGHT_VERSION = void 0;
|
|
15
|
+
var _ms = _interopRequireDefault(require("ms"));
|
|
16
|
+
var _readme = require("./readme");
|
|
17
|
+
Object.keys(_readme).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
|
+
if (key in exports && exports[key] === _readme[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _readme[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
29
|
+
const CURRENT_PLAYWRIGHT_VERSION = exports.CURRENT_PLAYWRIGHT_VERSION = "1.44.1";
|
|
30
|
+
const ProjectDeploymentStatus = exports.ProjectDeploymentStatus = ["completed", "failed", "pending", "not_found"];
|
|
31
|
+
const PROJECT_DEPLOY_TIMEOUT = exports.PROJECT_DEPLOY_TIMEOUT = (0, _ms.default)("10 minutes");
|
|
32
|
+
const PROJECT_DEPLOY_CHECK_PERIOD = exports.PROJECT_DEPLOY_CHECK_PERIOD = (0, _ms.default)("5 seconds");
|
|
33
|
+
const userCLIScripts = exports.userCLIScripts = {
|
|
34
|
+
"dev:local": "intuned-api-run sample playwright -j '{}'",
|
|
35
|
+
dev: "intuned-api-run",
|
|
36
|
+
build: "intuned-build",
|
|
37
|
+
"types-check": "intuned-ts-check",
|
|
38
|
+
"pre-publish": "intuned-ts-check && intuned-build",
|
|
39
|
+
start: "node ./output/bundle_v2.js",
|
|
40
|
+
"run-api": "run-api",
|
|
41
|
+
"cli-build": "cli-build",
|
|
42
|
+
deploy: "deploy",
|
|
43
|
+
"cli-create-auth-session": "create-auth-session",
|
|
44
|
+
"cli-check-auth-session": "check-auth-session",
|
|
45
|
+
"browser-save-state": "intuned-browser-save-state",
|
|
46
|
+
"auth-session-check": "intuned-auth-session-check",
|
|
47
|
+
"auth-session-create": "intuned-auth-session-create",
|
|
48
|
+
"auth-session-refresh": "intuned-auth-session-refresh",
|
|
49
|
+
"auth-session-load": "intuned-auth-session-load"
|
|
50
|
+
};
|
|
51
|
+
const tsConfigCli = exports.tsConfigCli = {
|
|
52
|
+
compilerOptions: {
|
|
53
|
+
moduleResolution: "NodeNext",
|
|
54
|
+
module: "NodeNext",
|
|
55
|
+
target: "ES2021",
|
|
56
|
+
outDir: "./dist",
|
|
57
|
+
sourceMap: false,
|
|
58
|
+
declaration: true,
|
|
59
|
+
esModuleInterop: true
|
|
60
|
+
},
|
|
61
|
+
include: ["**/*.ts"],
|
|
62
|
+
exclude: ["node_modules", "dist"]
|
|
63
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const readme = "# Intuned CLI\n## Introduction\nThe Intuned CLI exposes a variety of commands to develop your Intuned projects locally\n\n## Development Commands\n\nFor each command, add `--help` to see more details and options.\n\n### Initialize a Project\n`npx -p @intuned/runtime intuned init`\n\n### Run an API\n`yarn intuned run api <api-name> <parameters>`\nor\n`npm run intuned run api <api-name> <parameters>`\n\n\n### Build a Project\n`yarn intuned build`\n\n### Deploy a Project\n`yarn intuned deploy [project-name]`\nor\n`npm run intuned deploy [project-name]`\n\n\n\n### Create an auth session\n`yarn intuned run authsession create <parameters>`\nor\n`npm run intuned run authsession create <parameters>`\n\n\n\n### Validate an auth session\n`yarn intuned run authsession validate <auth-session-name>`\nor\n`npm run intuned run authsession validate <auth-session-name>`\n\n## Configuration\n\n### Environment Variables and Settings\n- `workspaceId`: Your Intuned workspace ID ([How to get your workspaceId](https://docs.intunedhq.com/docs/guides/platform/how-to-get-a-workspace-id))\n - Set in `intuned.json` file under the `workspaceId` property\n - Or provide via CLI with `--workspace-id` flag during deployment\n \n- `projectName`: The name of your Intuned project\n - Set in `intuned.json` file under the `projectName` property\n - Or override via command line when deploying with `yarn intuned deploy my-project-name` or `npm run intuned deploy my-project-name`\n\n- `INTUNED_API_KEY`: Your Intuned API key\n - Set as an environment variable: `export INTUNED_API_KEY=your_api_key_here`\n - Or include in your .env file for development\n - Or provide via CLI with `--api-key` flag during deployment\n\n## Project Structure\n\n### Generated Artifacts\n- `./intuned.json`: Project configuration file\n- `./api`: Folder containing API implementation files\n- `./auth-sessions`: Folder containing auth-session APIs if you use them\n- `./auth-sessions-instances`: Folder containing auth session instances\n\n## Types of auth sessions\n- `MANUAL`: Manual auth session, records the session using a recorder and stores it in the `auth-sessions-instances` folder\n- `API`: Auth session created via create API, stores the session in the `auth-sessions-instances` folder\n\n### Notes\n- You can use either `yarn` or `npm run` to execute commands\n- All commands must be run from the project root directory\n- Verify you're in the correct location by confirming the presence of package.json and intuned.json\n- Running commands from subdirectories may result in errors\n- You can manage your deployed projects through the Intuned platform\n- \u26A0\uFE0F WARNING: Changes to TS Config may break some Intuned functionalities\n";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.readme = void 0;
|
|
7
|
+
const readme = exports.readme = `# Intuned CLI
|
|
8
|
+
## Introduction
|
|
9
|
+
The Intuned CLI exposes a variety of commands to develop your Intuned projects locally
|
|
10
|
+
|
|
11
|
+
## Development Commands
|
|
12
|
+
|
|
13
|
+
For each command, add \`--help\` to see more details and options.
|
|
14
|
+
|
|
15
|
+
### Initialize a Project
|
|
16
|
+
\`npx -p @intuned/runtime intuned init\`
|
|
17
|
+
|
|
18
|
+
### Run an API
|
|
19
|
+
\`yarn intuned run api <api-name> <parameters>\`
|
|
20
|
+
or
|
|
21
|
+
\`npm run intuned run api <api-name> <parameters>\`
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Build a Project
|
|
25
|
+
\`yarn intuned build\`
|
|
26
|
+
|
|
27
|
+
### Deploy a Project
|
|
28
|
+
\`yarn intuned deploy [project-name]\`
|
|
29
|
+
or
|
|
30
|
+
\`npm run intuned deploy [project-name]\`
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Create an auth session
|
|
35
|
+
\`yarn intuned run authsession create <parameters>\`
|
|
36
|
+
or
|
|
37
|
+
\`npm run intuned run authsession create <parameters>\`
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Validate an auth session
|
|
42
|
+
\`yarn intuned run authsession validate <auth-session-name>\`
|
|
43
|
+
or
|
|
44
|
+
\`npm run intuned run authsession validate <auth-session-name>\`
|
|
45
|
+
|
|
46
|
+
## Configuration
|
|
47
|
+
|
|
48
|
+
### Environment Variables and Settings
|
|
49
|
+
- \`workspaceId\`: Your Intuned workspace ID ([How to get your workspaceId](https://docs.intunedhq.com/docs/guides/platform/how-to-get-a-workspace-id))
|
|
50
|
+
- Set in \`intuned.json\` file under the \`workspaceId\` property
|
|
51
|
+
- Or provide via CLI with \`--workspace-id\` flag during deployment
|
|
52
|
+
|
|
53
|
+
- \`projectName\`: The name of your Intuned project
|
|
54
|
+
- Set in \`intuned.json\` file under the \`projectName\` property
|
|
55
|
+
- Or override via command line when deploying with \`yarn intuned deploy my-project-name\` or \`npm run intuned deploy my-project-name\`
|
|
56
|
+
|
|
57
|
+
- \`INTUNED_API_KEY\`: Your Intuned API key
|
|
58
|
+
- Set as an environment variable: \`export INTUNED_API_KEY=your_api_key_here\`
|
|
59
|
+
- Or include in your .env file for development
|
|
60
|
+
- Or provide via CLI with \`--api-key\` flag during deployment
|
|
61
|
+
|
|
62
|
+
## Project Structure
|
|
63
|
+
|
|
64
|
+
### Generated Artifacts
|
|
65
|
+
- \`./intuned.json\`: Project configuration file
|
|
66
|
+
- \`./api\`: Folder containing API implementation files
|
|
67
|
+
- \`./auth-sessions\`: Folder containing auth-session APIs if you use them
|
|
68
|
+
- \`./auth-sessions-instances\`: Folder containing auth session instances
|
|
69
|
+
|
|
70
|
+
## Types of auth sessions
|
|
71
|
+
- \`MANUAL\`: Manual auth session, records the session using a recorder and stores it in the \`auth-sessions-instances\` folder
|
|
72
|
+
- \`API\`: Auth session created via create API, stores the session in the \`auth-sessions-instances\` folder
|
|
73
|
+
|
|
74
|
+
### Notes
|
|
75
|
+
- You can use either \`yarn\` or \`npm run\` to execute commands
|
|
76
|
+
- All commands must be run from the project root directory
|
|
77
|
+
- Verify you're in the correct location by confirming the presence of package.json and intuned.json
|
|
78
|
+
- Running commands from subdirectories may result in errors
|
|
79
|
+
- You can manage your deployed projects through the Intuned platform
|
|
80
|
+
- ⚠️ WARNING: Changes to TS Config may break some Intuned functionalities
|
|
81
|
+
`;
|
|
@@ -9,9 +9,8 @@ var fs = _interopRequireWildcard(require("fs-extra"));
|
|
|
9
9
|
var _runApi = require("../../../common/runApi");
|
|
10
10
|
var _tsNodeImport = require("../../common/tsNodeImport");
|
|
11
11
|
var _authSession = require("./authSession");
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var _terminal = require("../terminal");
|
|
12
|
+
var _helpers = require("../helpers");
|
|
13
|
+
var _terminal = require("../helpers/terminal");
|
|
15
14
|
var _constants = require("../../../common/constants");
|
|
16
15
|
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); }
|
|
17
16
|
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; }
|
|
@@ -58,6 +57,8 @@ async function executeRunApiCLI({
|
|
|
58
57
|
throw error;
|
|
59
58
|
}
|
|
60
59
|
}
|
|
60
|
+
}, {
|
|
61
|
+
authSessionId: authSession?.id
|
|
61
62
|
});
|
|
62
63
|
if (apiResult === undefined) {
|
|
63
64
|
throw new _helpers.CLIError(`^r^+Failed to run API ^:^+${apiName}^:: ^RExceeded maximum retries of ^+${retries}^:\n`, {
|
|
@@ -82,7 +83,7 @@ async function executeAttemptApiCLI({
|
|
|
82
83
|
if (authSessionId) {
|
|
83
84
|
({
|
|
84
85
|
authSessionInstance
|
|
85
|
-
} = await (0,
|
|
86
|
+
} = await (0, _helpers.retrieveAuthSessionInstance)(authSessionId));
|
|
86
87
|
}
|
|
87
88
|
return await (0, _helpers.withCLIContext)(async () => {
|
|
88
89
|
const apiResult = await attemptApi({
|
|
@@ -101,6 +102,8 @@ async function executeAttemptApiCLI({
|
|
|
101
102
|
apiResult,
|
|
102
103
|
outputFile
|
|
103
104
|
});
|
|
105
|
+
}, {
|
|
106
|
+
authSessionId
|
|
104
107
|
});
|
|
105
108
|
}
|
|
106
109
|
async function handleApiResult({
|
|
@@ -151,7 +154,7 @@ async function attemptApi({
|
|
|
151
154
|
headless,
|
|
152
155
|
timeout
|
|
153
156
|
}) {
|
|
154
|
-
return await (0, _helpers.withTimeout)(async
|
|
157
|
+
return await (0, _helpers.withTimeout)(async abortSignal => {
|
|
155
158
|
const runApiResult = await (0, _runApi.runApi)({
|
|
156
159
|
automationFunction: {
|
|
157
160
|
name: `api/${apiName}`,
|
|
@@ -163,12 +166,10 @@ async function attemptApi({
|
|
|
163
166
|
proxy: proxy ? (0, _helpers.parseUrlProxy)(proxy) : undefined
|
|
164
167
|
},
|
|
165
168
|
auth,
|
|
166
|
-
importFunction: _tsNodeImport.tsNodeImport
|
|
169
|
+
importFunction: _tsNodeImport.tsNodeImport,
|
|
170
|
+
abortSignal
|
|
167
171
|
});
|
|
168
172
|
if (runApiResult.isErr()) {
|
|
169
|
-
if (runApiResult.error instanceof _runApi.AutomationError) {
|
|
170
|
-
throw runApiResult.error;
|
|
171
|
-
}
|
|
172
173
|
throw runApiResult.error;
|
|
173
174
|
}
|
|
174
175
|
const {
|
|
@@ -9,13 +9,12 @@ exports.executeRunCreateAuthSessionCLI = executeRunCreateAuthSessionCLI;
|
|
|
9
9
|
exports.executeRunUpdateAuthSessionCLI = executeRunUpdateAuthSessionCLI;
|
|
10
10
|
exports.executeRunValidateAuthSessionCLI = executeRunValidateAuthSessionCLI;
|
|
11
11
|
exports.runCreate = runCreate;
|
|
12
|
-
var _utils = require("../../cli-auth-sessions/utils");
|
|
13
12
|
var _path = _interopRequireDefault(require("path"));
|
|
14
|
-
var _helpers = require("../
|
|
13
|
+
var _helpers = require("../helpers");
|
|
15
14
|
var _runApi = require("../../../common/runApi");
|
|
16
15
|
var _constants = require("../../../common/constants");
|
|
17
16
|
var _tsNodeImport = require("../../common/tsNodeImport");
|
|
18
|
-
var _terminal = require("../terminal");
|
|
17
|
+
var _terminal = require("../helpers/terminal");
|
|
19
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
19
|
async function executeRunValidateAuthSessionCLI({
|
|
21
20
|
id,
|
|
@@ -29,7 +28,7 @@ async function executeRunValidateAuthSessionCLI({
|
|
|
29
28
|
(0, _terminal.terminal)(`^+Validating auth session with id ^c${id}^:\n`);
|
|
30
29
|
const {
|
|
31
30
|
authSessionInstanceStoragePath
|
|
32
|
-
} = await (0,
|
|
31
|
+
} = await (0, _helpers.retrieveAuthSessionInstance)(id, true);
|
|
33
32
|
const authSessionPathToUse = authSessionInstanceStoragePath;
|
|
34
33
|
await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "check");
|
|
35
34
|
const checkResult = await runCheckWithRetries({
|
|
@@ -43,7 +42,7 @@ async function executeRunValidateAuthSessionCLI({
|
|
|
43
42
|
}
|
|
44
43
|
const {
|
|
45
44
|
metadata
|
|
46
|
-
} = await (0,
|
|
45
|
+
} = await (0, _helpers.retrieveAuthSessionInstance)(id);
|
|
47
46
|
if (metadata?.authSessionType === "MANUAL") {
|
|
48
47
|
throw new _helpers.CLIError("Auth session is recorder-based, please provide a new one or update it manually");
|
|
49
48
|
}
|
|
@@ -71,7 +70,9 @@ async function executeRunValidateAuthSessionCLI({
|
|
|
71
70
|
if (useExistingContext) {
|
|
72
71
|
return await validate();
|
|
73
72
|
} else {
|
|
74
|
-
return await (0, _helpers.withCLIContext)(validate
|
|
73
|
+
return await (0, _helpers.withCLIContext)(validate, {
|
|
74
|
+
authSessionId: id
|
|
75
|
+
});
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
async function executeRunCreateAuthSessionCLI({
|
|
@@ -118,9 +119,9 @@ async function executeRunUpdateAuthSessionCLI({
|
|
|
118
119
|
if (input === undefined) {
|
|
119
120
|
const {
|
|
120
121
|
metadata
|
|
121
|
-
} = await (0,
|
|
122
|
+
} = await (0, _helpers.retrieveAuthSessionInstance)(id);
|
|
122
123
|
if (metadata?.authSessionType === "MANUAL") {
|
|
123
|
-
throw new
|
|
124
|
+
throw new _helpers.CLIError("Auth session is recorder-based, it cannot be updated.");
|
|
124
125
|
}
|
|
125
126
|
input = metadata?.authSessionInput ?? {};
|
|
126
127
|
}
|
|
@@ -142,14 +143,16 @@ async function executeAttemptCreateAuthSessionCLI({
|
|
|
142
143
|
input,
|
|
143
144
|
...rest
|
|
144
145
|
}) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
146
|
+
return await (0, _helpers.withCLIContext)(async () => {
|
|
147
|
+
id = id ?? `auth-session-attempt-${Date.now()}`;
|
|
148
|
+
(0, _terminal.terminal)(`^+Executing create auth session attempt with id ^c${id}^:\n`);
|
|
149
|
+
await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "create");
|
|
150
|
+
return await runCreateWithRetries({
|
|
151
|
+
authSessionId: id,
|
|
152
|
+
authSessionInput: input,
|
|
153
|
+
retries: 1,
|
|
154
|
+
...rest
|
|
155
|
+
});
|
|
153
156
|
});
|
|
154
157
|
}
|
|
155
158
|
async function executeAttemptCheckAuthSessionCLI({
|
|
@@ -161,7 +164,7 @@ async function executeAttemptCheckAuthSessionCLI({
|
|
|
161
164
|
return await (0, _helpers.withCLIContext)(async () => {
|
|
162
165
|
const {
|
|
163
166
|
authSessionInstanceStoragePath
|
|
164
|
-
} = await (0,
|
|
167
|
+
} = await (0, _helpers.retrieveAuthSessionInstance)(id, true);
|
|
165
168
|
const authSessionPathToUse = authSessionInstanceStoragePath;
|
|
166
169
|
const checkResult = await runCheckWithRetries({
|
|
167
170
|
authSessionPath: authSessionPathToUse,
|
|
@@ -173,6 +176,8 @@ async function executeAttemptCheckAuthSessionCLI({
|
|
|
173
176
|
}
|
|
174
177
|
(0, _terminal.terminal)(`^+^gAuth session check passed^:\n`);
|
|
175
178
|
return authSessionPathToUse;
|
|
179
|
+
}, {
|
|
180
|
+
authSessionId: id
|
|
176
181
|
});
|
|
177
182
|
}
|
|
178
183
|
async function runCheck({
|
|
@@ -181,7 +186,7 @@ async function runCheck({
|
|
|
181
186
|
headless,
|
|
182
187
|
timeout
|
|
183
188
|
}) {
|
|
184
|
-
return await (0, _helpers.withTimeout)(async
|
|
189
|
+
return await (0, _helpers.withTimeout)(async abortSignal => {
|
|
185
190
|
const runApiResult = await (0, _runApi.runApi)({
|
|
186
191
|
automationFunction: {
|
|
187
192
|
name: `${_constants.AUTH_SESSIONS_FOLDER_NAME}/check`
|
|
@@ -198,7 +203,8 @@ async function runCheck({
|
|
|
198
203
|
},
|
|
199
204
|
runCheck: false
|
|
200
205
|
},
|
|
201
|
-
importFunction: _tsNodeImport.tsNodeImport
|
|
206
|
+
importFunction: _tsNodeImport.tsNodeImport,
|
|
207
|
+
abortSignal
|
|
202
208
|
});
|
|
203
209
|
if (runApiResult.isErr()) {
|
|
204
210
|
if (runApiResult.error instanceof _runApi.AutomationError) {
|
|
@@ -219,7 +225,7 @@ async function runCreate({
|
|
|
219
225
|
headless,
|
|
220
226
|
timeout
|
|
221
227
|
}) {
|
|
222
|
-
return await (0, _helpers.withTimeout)(async
|
|
228
|
+
return await (0, _helpers.withTimeout)(async abortSignal => {
|
|
223
229
|
const createApiName = `${_constants.AUTH_SESSIONS_FOLDER_NAME}/create`;
|
|
224
230
|
const result = await (0, _runApi.runApi)({
|
|
225
231
|
automationFunction: {
|
|
@@ -232,14 +238,11 @@ async function runCreate({
|
|
|
232
238
|
proxy: proxy ? (0, _helpers.parseUrlProxy)(proxy) : undefined
|
|
233
239
|
},
|
|
234
240
|
retrieveSession: true,
|
|
235
|
-
importFunction: _tsNodeImport.tsNodeImport
|
|
241
|
+
importFunction: _tsNodeImport.tsNodeImport,
|
|
242
|
+
abortSignal
|
|
236
243
|
});
|
|
237
244
|
if (result.isErr()) {
|
|
238
|
-
|
|
239
|
-
throw result.error.error;
|
|
240
|
-
}
|
|
241
|
-
console.error(result.error);
|
|
242
|
-
throw new Error("Error while running create");
|
|
245
|
+
throw result.error;
|
|
243
246
|
}
|
|
244
247
|
return result.value.session;
|
|
245
248
|
}, timeout);
|
|
@@ -299,5 +302,5 @@ async function runCreateWithRetries({
|
|
|
299
302
|
if (!newAuthSessionInstance) {
|
|
300
303
|
throw new _helpers.CLIError(`Failed to create auth session after ${retries} retries`);
|
|
301
304
|
}
|
|
302
|
-
return await (0,
|
|
305
|
+
return await (0, _helpers.storeAuthSessionInstance)(newAuthSessionInstance, authSessionId, authSessionInput);
|
|
303
306
|
}
|
|
@@ -8,7 +8,7 @@ var fs = _interopRequireWildcard(require("fs-extra"));
|
|
|
8
8
|
var path = _interopRequireWildcard(require("path"));
|
|
9
9
|
var _child_process = require("child_process");
|
|
10
10
|
var _util = require("util");
|
|
11
|
-
var _terminal = require("../terminal");
|
|
11
|
+
var _terminal = require("../helpers/terminal");
|
|
12
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
14
|
const execPromise = (0, _util.promisify)(_child_process.exec);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { AuthCredentials, FileSystemTree } from "
|
|
2
|
+
import type { AuthCredentials, FileSystemTree } from "../types";
|
|
3
3
|
export declare function convertProjectToCodeTree(projectPath: string): Promise<FileSystemTree>;
|
|
4
4
|
export declare function runDeployProject(projectName: string, auth: AuthCredentials): Promise<void>;
|
|
5
5
|
export declare const projectNameSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -12,14 +12,12 @@ var path = _interopRequireWildcard(require("path"));
|
|
|
12
12
|
var _minimatch = require("minimatch");
|
|
13
13
|
var _zod = require("zod");
|
|
14
14
|
var _projectExclusions = _interopRequireDefault(require("../../common/projectExclusions"));
|
|
15
|
-
var _constants = require("
|
|
16
|
-
var
|
|
17
|
-
var _utils2 = require("../../init/utils");
|
|
15
|
+
var _constants = require("../constants");
|
|
16
|
+
var _helpers = require("../helpers");
|
|
18
17
|
var _lodash = require("lodash");
|
|
19
18
|
var _uuid = require("uuid");
|
|
20
|
-
var _terminal = require("../terminal");
|
|
19
|
+
var _terminal = require("../helpers/terminal");
|
|
21
20
|
var _promises = require("timers/promises");
|
|
22
|
-
var _helpers = require("../commands/helpers");
|
|
23
21
|
var _ms = _interopRequireDefault(require("ms"));
|
|
24
22
|
var _build = require("./build");
|
|
25
23
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -123,7 +121,7 @@ async function runDeployProject(projectName, auth) {
|
|
|
123
121
|
workspaceId,
|
|
124
122
|
apiKey
|
|
125
123
|
} = auth;
|
|
126
|
-
const baseUrl = (0,
|
|
124
|
+
const baseUrl = (0, _helpers.getBaseUrl)();
|
|
127
125
|
const url = `${baseUrl}/api/v1/workspace/${workspaceId}/projects/create`;
|
|
128
126
|
const headers = {
|
|
129
127
|
"x-api-key": apiKey,
|
|
@@ -188,7 +186,7 @@ async function runDeployProject(projectName, auth) {
|
|
|
188
186
|
_terminal.terminal.eraseLine();
|
|
189
187
|
spinner.animate(false);
|
|
190
188
|
if (status === "completed") {
|
|
191
|
-
const url = (0,
|
|
189
|
+
const url = (0, _helpers.getBaseUrl)();
|
|
192
190
|
(0, _terminal.terminal)(`\n^g^+Project deployed successfully!^:\n`);
|
|
193
191
|
(0, _terminal.terminal)(`^+You can check your project on the platform:^s ^c^_${url}/projects/${projectId}/details^:\n`);
|
|
194
192
|
return;
|
|
@@ -309,7 +307,7 @@ const validateIntunedProject = async () => {
|
|
|
309
307
|
};
|
|
310
308
|
exports.validateIntunedProject = validateIntunedProject;
|
|
311
309
|
const checkIntunedProjectDeployStatus = async (workspaceId, projectName, apiKey) => {
|
|
312
|
-
const baseUrl = (0,
|
|
310
|
+
const baseUrl = (0, _helpers.getBaseUrl)();
|
|
313
311
|
const url = `${baseUrl}/api/v1/workspace/${workspaceId}/projects/create/${projectName}/result`;
|
|
314
312
|
const headers = {
|
|
315
313
|
"x-api-key": apiKey,
|
|
@@ -326,7 +324,7 @@ const checkIntunedProjectDeployStatus = async (workspaceId, projectName, apiKey)
|
|
|
326
324
|
};
|
|
327
325
|
}
|
|
328
326
|
if (!response.ok) {
|
|
329
|
-
throw new
|
|
327
|
+
throw new _helpers.CLIError(`Error querying deployment status ${response.status}: ${await response.text()}`);
|
|
330
328
|
}
|
|
331
329
|
const data = await response.json();
|
|
332
330
|
if (data.status) {
|
|
@@ -345,7 +343,7 @@ async function mapToIDEParams(tree) {
|
|
|
345
343
|
if (!tree) {
|
|
346
344
|
return;
|
|
347
345
|
}
|
|
348
|
-
if (!tree["parameters"] ||
|
|
346
|
+
if (!tree["parameters"] || "file" in tree["parameters"]) {
|
|
349
347
|
return;
|
|
350
348
|
}
|
|
351
349
|
const apiParametersMap = {};
|
|
@@ -355,7 +353,7 @@ async function mapToIDEParams(tree) {
|
|
|
355
353
|
};
|
|
356
354
|
for (const parameterKey of cliParameters) {
|
|
357
355
|
const parameter = tree["parameters"].directory[parameterKey];
|
|
358
|
-
if (
|
|
356
|
+
if ("directory" in parameter) {
|
|
359
357
|
continue;
|
|
360
358
|
}
|
|
361
359
|
if ((0, _lodash.isEmpty)(parameter.file.contents)) {
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.loadParameters = loadParameters;
|
|
7
7
|
var fs = _interopRequireWildcard(require("fs-extra"));
|
|
8
|
+
var _helpers = require("../helpers");
|
|
8
9
|
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); }
|
|
9
10
|
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; }
|
|
10
11
|
async function loadParameters(parameters) {
|
|
@@ -15,7 +16,7 @@ async function loadParameters(parameters) {
|
|
|
15
16
|
try {
|
|
16
17
|
inputData = JSON.parse(parameters);
|
|
17
18
|
} catch (err) {
|
|
18
|
-
throw new
|
|
19
|
+
throw new _helpers.CLIError("Parameters must be a valid JSON string or a path to a JSON file");
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
return inputData;
|
|
@@ -36,10 +37,10 @@ async function loadParametersFromFile(parametersFile) {
|
|
|
36
37
|
return inputData;
|
|
37
38
|
} catch (error) {
|
|
38
39
|
if (error.code === "ENOENT") {
|
|
39
|
-
throw new
|
|
40
|
+
throw new _helpers.CLIError(`Parameters file not found: ${parametersFile}`);
|
|
40
41
|
} else if (error instanceof SyntaxError) {
|
|
41
|
-
throw new
|
|
42
|
+
throw new _helpers.CLIError(`Invalid JSON in parameters file: ${error.message}`);
|
|
42
43
|
}
|
|
43
|
-
throw new
|
|
44
|
+
throw new _helpers.CLIError(`Error reading parameters file: ${error.message}`);
|
|
44
45
|
}
|
|
45
46
|
}
|