@intuned/runtime-dev 1.0.6-cli.8.3.4 → 1.0.6-dev-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.
Files changed (39) hide show
  1. package/bin/intuned-run +3 -0
  2. package/dist/commands/deploy/deploy.js +10 -23
  3. package/dist/commands/deploy/utils.d.ts +2 -11
  4. package/dist/commands/deploy/utils.js +58 -211
  5. package/dist/commands/init/init.js +4 -3
  6. package/dist/{common/cli → commands/init}/types.js +1 -1
  7. package/dist/commands/init/utils.d.ts +3 -3
  8. package/dist/commands/init/utils.js +24 -57
  9. package/dist/commands/intuned-run/intuned-run.d.ts +4 -0
  10. package/dist/commands/intuned-run/intuned-run.js +84 -0
  11. package/dist/commands/intuned-run/utils.d.ts +1 -0
  12. package/dist/{common/cli → commands/intuned-run}/utils.js +21 -18
  13. package/dist/common/asyncLocalStorage/index.d.ts +1 -1
  14. package/dist/common/asyncLocalStorage/index.js +2 -2
  15. package/my-intuned-project/Intuned.json +15 -0
  16. package/my-intuned-project/api/book-details.ts +46 -0
  17. package/my-intuned-project/api/books-all.ts +68 -0
  18. package/my-intuned-project/package.json +36 -0
  19. package/my-intuned-project/params/bookInput.json +3 -0
  20. package/my-intuned-project/yarn.lock +4539 -0
  21. package/package.json +5 -11
  22. package/bin/cli-build +0 -3
  23. package/bin/run-api +0 -3
  24. package/dist/commands/cli-build/cli-build.d.ts +0 -2
  25. package/dist/commands/cli-build/cli-build.js +0 -20
  26. package/dist/commands/common/projectExclusions.d.ts +0 -2
  27. package/dist/commands/common/projectExclusions.js +0 -8
  28. package/dist/commands/run-api-cli/run-api.d.ts +0 -2
  29. package/dist/commands/run-api-cli/run-api.js +0 -48
  30. package/dist/commands/run-api-cli/utils.d.ts +0 -7
  31. package/dist/commands/run-api-cli/utils.js +0 -94
  32. package/dist/common/cli/cliReadme.d.ts +0 -1
  33. package/dist/common/cli/cliReadme.js +0 -65
  34. package/dist/common/cli/constants.d.ts +0 -24
  35. package/dist/common/cli/constants.js +0 -30
  36. package/dist/common/cli/utils.d.ts +0 -5
  37. /package/bin/{deploy → intuned-deploy} +0 -0
  38. /package/bin/{init → intuned-init} +0 -0
  39. /package/dist/{common/cli → commands/init}/types.d.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.0.6-cli.8.3.4",
3
+ "version": "1.0.6-dev-1",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
@@ -13,8 +13,7 @@
13
13
  "./dist/common/asyncLocalStorage": "./dist/common/asyncLocalStorage/index.js",
14
14
  "./dist/common/cleanEnvironmentVariables": "./dist/common/cleanEnvironmentVariables.js",
15
15
  "./dist/common/constants": "./dist/common/constants.js",
16
- "./dist/commands/interface/run": "./dist/commands/interface/run.js",
17
- "./dist/commands/intuned-run/intuned-run": "./dist/commands/intuned-run/intuned-run.js"
16
+ "./dist/commands/interface/run": "./dist/commands/interface/run.js"
18
17
  },
19
18
  "types": "./dist/index.d.ts",
20
19
  "author": "Intuned Team",
@@ -50,10 +49,9 @@
50
49
  "intuned-browser-start": "./bin/intuned-browser-start",
51
50
  "intuned-browser-save-state": "./bin/intuned-browser-save-state",
52
51
  "intuned-ts-check": "./bin/intuned-ts-check",
53
- "init": "./bin/init",
54
- "run-api": "./bin/run-api",
55
- "deploy": "./bin/deploy",
56
- "cli-build": "./bin/cli-build"
52
+ "intuned-init": "./bin/intuned-init",
53
+ "intuned-run": "./bin/intuned-run",
54
+ "intuned-deploy": "./bin/intuned-deploy"
57
55
  },
58
56
  "dependencies": {
59
57
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
@@ -70,7 +68,6 @@
70
68
  "applicationinsights": "^2.9.2",
71
69
  "async-retry": "^1.3.3",
72
70
  "babel-plugin-dynamic-import-node": "^2.3.3",
73
- "boxen": "8.0.1",
74
71
  "chalk": "^4.1.2",
75
72
  "commander": "^11.0.0",
76
73
  "cross-fetch": "^4.0.0",
@@ -81,11 +78,9 @@
81
78
  "fs-extra": "^11.3.0",
82
79
  "https-proxy-agent": "^7.0.5",
83
80
  "image-size": "^1.1.1",
84
- "inquirer": "12.6.0",
85
81
  "jsonwebtoken": "^9.0.2",
86
82
  "lodash": "^4.17.21",
87
83
  "milliparsec": "^2.3.0",
88
- "minimatch": "10.0.1",
89
84
  "ms": "^2.1.3",
90
85
  "nanoid": "3",
91
86
  "neverthrow": "^6.1.0",
@@ -142,4 +137,3 @@
142
137
  "@intuned/runtime": "*"
143
138
  }
144
139
  }
145
-
package/bin/cli-build DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- require("../dist/commands/cli-build/cli-build.js");
package/bin/run-api DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- require("../dist/commands/run-api-cli/run-api.js");
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,20 +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("../deploy/utils");
7
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
8
- _dotenv.default.config({
9
- path: `.env`
10
- });
11
- _commander.program.name("intuned-build-project").description("Build your current Intuned project").action(async () => {
12
- try {
13
- await (0, _utils.runBuild)();
14
- } catch (error) {
15
- process.exit(1);
16
- } finally {
17
- process.exit(0);
18
- }
19
- });
20
- _commander.program.parse(process.argv);
@@ -1,2 +0,0 @@
1
- declare const exclusions: string[];
2
- export default exclusions;
@@ -1,8 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- const exclusions = ["node_modules/**", ".git/**", "dist/**", "build/**", "coverage/**", ".next/**", ".cache/**", "out/**", "tmp/**", ".DS_Store", "npm-debug.log*", "yarn-debug.log*", "yarn-error.log*", ".env", ".env.*", "**/*.map", "**/*.tsbuildinfo", "tsconfig.json", "parameters/**", "output/**", "README.md"];
8
- var _default = exports.default = exclusions;
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,48 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
-
4
- var _commander = require("commander");
5
- var _chalk = _interopRequireDefault(require("chalk"));
6
- var _nanoid = require("nanoid");
7
- var _dotenv = _interopRequireDefault(require("dotenv"));
8
- var _utils = require("./utils");
9
- var _enums = require("../../runtime/enums");
10
- var _asyncLocalStorage = require("../../common/asyncLocalStorage");
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- _dotenv.default.config({
13
- path: `.env`
14
- });
15
- _commander.program.name("intuned-run").description("Run an Intuned API with parameters").argument("<api-name>", "Name of the API to run").option("-i, --parameters-file <file>", "JSON file containing API parameters").option("-s, --store-results", "Store the results of the running API in a dedicated folder").action(async (apiName, options) => {
16
- try {
17
- if (!apiName) {
18
- throw new Error("API name is required, please provide it");
19
- }
20
- const inputData = await (0, _utils.loadParameters)(options.parametersFile);
21
- const runId = (0, _nanoid.nanoid)();
22
- const {
23
- result,
24
- payloadToAppend
25
- } = await (0, _asyncLocalStorage.runWithContext)({
26
- runEnvironment: _enums.RunEnvironment.IDE,
27
- extendedPayloads: [],
28
- runId
29
- }, () => (0, _utils.runApiViaCLI)(apiName, inputData));
30
- if (!result) {
31
- console.log(_chalk.default.yellow("No result returned from the API"));
32
- return;
33
- }
34
- if (!options.storeResults) {
35
- console.log(_chalk.default.green(`✓ API executed successfully`));
36
- console.log(_chalk.default.green("Result:"));
37
- console.log(_chalk.default.white(JSON.stringify(result, null, 2)));
38
- return;
39
- }
40
- await (0, _utils.writeResultToFile)(runId, result, payloadToAppend);
41
- } catch (error) {
42
- console.error(_chalk.default.red(`\nError: ${error.message}`));
43
- process.exit(1);
44
- } finally {
45
- process.exit(0);
46
- }
47
- });
48
- _commander.program.parse(process.argv);
@@ -1,7 +0,0 @@
1
- import { Payload } from "../../runtime/export";
2
- export declare function loadParameters(parametersFile: string): Promise<object | null>;
3
- export declare function writeResultToFile(runId: string, result: any, payloadToAppend?: Payload[]): Promise<void>;
4
- export declare function runApiViaCLI(apiName: string, inputData: object | null | undefined): Promise<{
5
- result: any;
6
- payloadToAppend: Payload[] | undefined;
7
- }>;
@@ -1,94 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.loadParameters = loadParameters;
7
- exports.runApiViaCLI = runApiViaCLI;
8
- exports.writeResultToFile = writeResultToFile;
9
- var _path = _interopRequireDefault(require("path"));
10
- var fs = _interopRequireWildcard(require("fs-extra"));
11
- var _Logger = require("../../common/Logger");
12
- var _chalk = _interopRequireDefault(require("chalk"));
13
- var _runApi = require("../../common/runApi");
14
- var _tsNodeImport = require("../common/tsNodeImport");
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); }
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; }
17
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
- async function loadParameters(parametersFile) {
19
- if (!parametersFile) {
20
- return {};
21
- }
22
- try {
23
- const filePath = _path.default.join(process.cwd(), parametersFile);
24
- await fs.access(filePath);
25
- let inputData = null;
26
- if (parametersFile) {
27
- inputData = await fs.readJSON(filePath);
28
- } else {
29
- inputData = {};
30
- }
31
- return inputData;
32
- } catch (error) {
33
- if (error.code === "ENOENT") {
34
- throw new Error(`Parameters file not found: ${parametersFile}`);
35
- } else if (error instanceof SyntaxError) {
36
- throw new Error(`Invalid JSON in parameters file: ${error.message}`);
37
- }
38
- throw new Error(`Error reading parameters file: ${error.message}`);
39
- }
40
- }
41
- async function writeResultToFile(runId, result, payloadToAppend) {
42
- const outputDir = _path.default.join(process.cwd(), "output", runId);
43
- const resultsPath = _path.default.join(outputDir, "results.json");
44
- const extendedPayloadsPath = _path.default.join(outputDir, "extendedPayloads.json");
45
- await fs.ensureDir(outputDir);
46
- try {
47
- await fs.writeJSON(resultsPath, result, {
48
- spaces: 2
49
- });
50
- if (payloadToAppend && payloadToAppend.length > 0) {
51
- await fs.writeJSON(extendedPayloadsPath, payloadToAppend, {
52
- spaces: 2
53
- });
54
- _Logger.logger.info(_chalk.default.underline.green.white(`Payloads to append saved into (${extendedPayloadsPath})`));
55
- }
56
- console.log(_chalk.default.underline.green.white(`✓ API executed successfully. Results stored in ${outputDir}`));
57
- console.log(_chalk.default.blue(`Run ID: ${runId}`));
58
- } catch (error) {
59
- _Logger.logger.error(`Failed to write result to file: ${error.message}`);
60
- }
61
- }
62
- async function runApiViaCLI(apiName, inputData) {
63
- const runApiResult = await (0, _runApi.runApi)({
64
- automationFunction: {
65
- name: `api/${apiName}`,
66
- params: inputData
67
- },
68
- runOptions: {
69
- headless: false,
70
- environment: "standalone"
71
- },
72
- importFunction: _tsNodeImport.tsNodeImport
73
- });
74
- if (runApiResult.isErr()) {
75
- if (runApiResult.error instanceof _runApi.AutomationError) {
76
- throw runApiResult.error.error;
77
- }
78
- console.error(runApiResult.error);
79
- throw new Error("An error occurred while running the API");
80
- }
81
- const {
82
- result,
83
- extendedPayloads: payloadToAppend
84
- } = runApiResult.value;
85
- const hasPayloadToAppend = payloadToAppend && payloadToAppend.length > 0;
86
- if (hasPayloadToAppend) {
87
- _Logger.logger.info("payload to append:", payloadToAppend);
88
- _Logger.logger.info("This will only take an effect if this API run was part of a job.");
89
- }
90
- return {
91
- result,
92
- payloadToAppend
93
- };
94
- }
@@ -1 +0,0 @@
1
- export declare const cliReadme = "# Intuned CLI\n## Introduction\nThe Intuned CLI exposes a variaty of commands to develop your Intuned projects locally\n\n## Development Commands\n\n### Initialize a Project\n`npx -p @intuned/runtime init`\n\n### Run an API\n`yarn run-api <api-name>`\n\nOptions:\n- `-i, --parameters-file file-path`: JSON file containing API parameters\n- `-s, --store-results`: Store the results in `./output/[runId]/results.json` and `./output/[runId]/extendedPayloads.json`\n\n### Build a Project\n`yarn cli-build`\n\n### Deploy a Project\n`yarn deploy <project-name>`\n\n- `project-name`: Optional name that overrides the one in intuned.json\n- Options:\n - `--workspace-id`: Overrides the workspace ID in intuned.json\n - `--api-key`: Overrides the API key from environment variables\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 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- `./parameters`: Folder for API parameters injection\n- `./output`: Folder containing generated output files\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- WARNING: \u26A0\uFE0F Changes to TS Config may break some Intuned functionalities\n";
@@ -1,65 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.cliReadme = void 0;
7
- const cliReadme = exports.cliReadme = `# Intuned CLI
8
- ## Introduction
9
- The Intuned CLI exposes a variaty of commands to develop your Intuned projects locally
10
-
11
- ## Development Commands
12
-
13
- ### Initialize a Project
14
- \`npx -p @intuned/runtime init\`
15
-
16
- ### Run an API
17
- \`yarn run-api <api-name>\`
18
-
19
- Options:
20
- - \`-i, --parameters-file file-path\`: JSON file containing API parameters
21
- - \`-s, --store-results\`: Store the results in \`./output/[runId]/results.json\` and \`./output/[runId]/extendedPayloads.json\`
22
-
23
- ### Build a Project
24
- \`yarn cli-build\`
25
-
26
- ### Deploy a Project
27
- \`yarn deploy <project-name>\`
28
-
29
- - \`project-name\`: Optional name that overrides the one in intuned.json
30
- - Options:
31
- - \`--workspace-id\`: Overrides the workspace ID in intuned.json
32
- - \`--api-key\`: Overrides the API key from environment variables
33
-
34
- ## Configuration
35
-
36
- ### Environment Variables and Settings
37
- - \`workspaceId\`: Your Intuned workspace ID ([How to get your workspaceId](https://docs.intunedhq.com/docs/guides/platform/how-to-get-a-workspace-id))
38
- - Set in \`intuned.json\` file under the \`workspaceId\` property
39
- - Or provide via CLI with \`--workspace-id\` flag during deployment
40
-
41
- - \`projectName\`: The name of your Intuned project
42
- - Set in \`intuned.json\` file under the \`projectName\` property
43
- - Or override via command line when deploying with \`yarn deploy my-project-name\`
44
-
45
- - \`INTUNED_API_KEY\`: Your Intuned API key
46
- - Set as an environment variable: \`export INTUNED_API_KEY=your_api_key_here\`
47
- - Or include in your .env file for development
48
- - Or provide via CLI with \`--api-key\` flag during deployment
49
-
50
- ## Project Structure
51
-
52
- ### Generated Artifacts
53
- - \`./intuned.json\`: Project configuration file
54
- - \`./api\`: Folder containing API implementation files
55
- - \`./parameters\`: Folder for API parameters injection
56
- - \`./output\`: Folder containing generated output files
57
-
58
- ### Notes
59
- - You can use either \`yarn\` or \`npm run\` to execute commands
60
- - All commands must be run from the project root directory
61
- - Verify you're in the correct location by confirming the presence of package.json and intuned.json
62
- - Running commands from subdirectories may result in errors
63
- - You can manage your deployed projects through the Intuned platform
64
- - WARNING: ⚠️ Changes to TS Config may break some Intuned functionalities
65
- `;
@@ -1,24 +0,0 @@
1
- export declare const CURRENT_PLAYWRIGHT_VERSION = "1.44.1";
2
- export declare const ProjectDeploymentStatus: string[];
3
- export declare const PROJECT_DEPLOY_TIMEOUT = 600000;
4
- export declare const userCLIScripts: {
5
- build: string;
6
- "types-check": string;
7
- "pre-publish": string;
8
- start: string;
9
- "run-api": string;
10
- "cli-build": string;
11
- deploy: string;
12
- };
13
- export declare const tsConfigCli: {
14
- compilerOptions: {
15
- moduleResolution: string;
16
- target: string;
17
- outDir: string;
18
- sourceMap: boolean;
19
- declaration: boolean;
20
- esModuleInterop: boolean;
21
- };
22
- include: string[];
23
- exclude: string[];
24
- };
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.userCLIScripts = exports.tsConfigCli = exports.ProjectDeploymentStatus = exports.PROJECT_DEPLOY_TIMEOUT = exports.CURRENT_PLAYWRIGHT_VERSION = void 0;
7
- const CURRENT_PLAYWRIGHT_VERSION = exports.CURRENT_PLAYWRIGHT_VERSION = "1.44.1";
8
- const ProjectDeploymentStatus = exports.ProjectDeploymentStatus = ["completed", "failed", "pending", "not_found"];
9
- const PROJECT_DEPLOY_TIMEOUT = exports.PROJECT_DEPLOY_TIMEOUT = 600000;
10
- const userCLIScripts = exports.userCLIScripts = {
11
- build: "intuned-build",
12
- "types-check": "intuned-ts-check",
13
- "pre-publish": "intuned-ts-check && intuned-build",
14
- start: "node ./output/bundle_v2.js",
15
- "run-api": "intuned-run",
16
- "cli-build": "intuned-build-project",
17
- deploy: "intuned-deploy"
18
- };
19
- const tsConfigCli = exports.tsConfigCli = {
20
- compilerOptions: {
21
- moduleResolution: "node",
22
- target: "ES2021",
23
- outDir: "./dist",
24
- sourceMap: false,
25
- declaration: true,
26
- esModuleInterop: true
27
- },
28
- include: ["**/*.ts"],
29
- exclude: ["node_modules", "dist"]
30
- };
@@ -1,5 +0,0 @@
1
- export declare function getAuthCredentials(options: any): Promise<{
2
- workspaceId: any;
3
- apiKey: any;
4
- }>;
5
- export declare function getSettingIntunedJSON(key: string): Promise<any>;
File without changes
File without changes
File without changes