@intuned/runtime-dev 1.2.0-cli.4 → 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.
Files changed (83) hide show
  1. package/dist/commands/intuned-cli/commands/attempt_api.command.js +1 -1
  2. package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +1 -1
  3. package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +1 -1
  4. package/dist/commands/intuned-cli/commands/build.command.js +1 -1
  5. package/dist/commands/intuned-cli/commands/deploy.command.js +3 -4
  6. package/dist/commands/intuned-cli/commands/init.command.js +1 -1
  7. package/dist/commands/intuned-cli/commands/run_api.command.js +1 -1
  8. package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +1 -1
  9. package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +1 -1
  10. package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +1 -1
  11. package/dist/commands/intuned-cli/constants/index.d.ts +36 -0
  12. package/dist/commands/intuned-cli/constants/index.js +63 -0
  13. package/dist/commands/intuned-cli/constants/readme.d.ts +1 -0
  14. package/dist/commands/intuned-cli/constants/readme.js +81 -0
  15. package/dist/commands/intuned-cli/controller/api.js +7 -7
  16. package/dist/commands/intuned-cli/controller/authSession.js +24 -23
  17. package/dist/commands/intuned-cli/controller/build.js +1 -1
  18. package/dist/commands/intuned-cli/controller/deploy.d.ts +1 -1
  19. package/dist/commands/intuned-cli/controller/deploy.js +9 -11
  20. package/dist/commands/intuned-cli/controller/index.js +5 -4
  21. package/dist/commands/intuned-cli/controller/init.d.ts +1 -1
  22. package/dist/commands/intuned-cli/controller/init.js +12 -15
  23. package/dist/commands/intuned-cli/helpers/api.d.ts +3 -0
  24. package/dist/commands/intuned-cli/helpers/api.js +19 -0
  25. package/dist/commands/intuned-cli/helpers/auth.d.ts +17 -0
  26. package/dist/commands/intuned-cli/helpers/auth.js +105 -0
  27. package/dist/commands/intuned-cli/helpers/backend.d.ts +8 -0
  28. package/dist/commands/intuned-cli/helpers/backend.js +26 -0
  29. package/dist/commands/intuned-cli/helpers/context.d.ts +3 -0
  30. package/dist/commands/intuned-cli/helpers/context.js +33 -0
  31. package/dist/commands/intuned-cli/helpers/errors.d.ts +14 -0
  32. package/dist/commands/intuned-cli/helpers/errors.js +55 -0
  33. package/dist/commands/intuned-cli/helpers/index.d.ts +10 -0
  34. package/dist/commands/intuned-cli/helpers/index.js +115 -0
  35. package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +1 -0
  36. package/dist/commands/intuned-cli/helpers/intunedJson.js +19 -0
  37. package/dist/commands/intuned-cli/helpers/proxy.d.ts +5 -0
  38. package/dist/commands/intuned-cli/helpers/proxy.js +23 -0
  39. package/dist/commands/intuned-cli/helpers/timeout.d.ts +1 -0
  40. package/dist/commands/intuned-cli/helpers/timeout.js +23 -0
  41. package/dist/commands/intuned-cli/helpers/validation.d.ts +2 -0
  42. package/dist/commands/intuned-cli/helpers/validation.js +12 -0
  43. package/dist/commands/intuned-cli/types.d.ts +42 -0
  44. package/dist/commands/intuned-cli/types.js +13 -0
  45. package/dist/common/cli/cliReadme.d.ts +0 -1
  46. package/dist/common/cli/cliReadme.js +1 -83
  47. package/dist/common/cli/constants.d.ts +0 -35
  48. package/dist/common/cli/constants.js +1 -43
  49. package/dist/common/cli/types.d.ts +0 -74
  50. package/dist/common/cli/types.js +1 -13
  51. package/dist/common/cli/utils.d.ts +0 -9
  52. package/dist/common/cli/utils.js +1 -39
  53. package/package.json +1 -7
  54. package/bin/check-auth-session +0 -3
  55. package/bin/cli-build +0 -3
  56. package/bin/create-auth-session +0 -3
  57. package/bin/deploy +0 -3
  58. package/bin/init +0 -3
  59. package/bin/run-api +0 -3
  60. package/dist/commands/cli-auth-sessions/check.d.ts +0 -2
  61. package/dist/commands/cli-auth-sessions/check.js +0 -40
  62. package/dist/commands/cli-auth-sessions/create.d.ts +0 -2
  63. package/dist/commands/cli-auth-sessions/create.js +0 -53
  64. package/dist/commands/cli-auth-sessions/utils.d.ts +0 -28
  65. package/dist/commands/cli-auth-sessions/utils.js +0 -284
  66. package/dist/commands/cli-build/cli-build.d.ts +0 -2
  67. package/dist/commands/cli-build/cli-build.js +0 -20
  68. package/dist/commands/deploy/deploy.d.ts +0 -2
  69. package/dist/commands/deploy/deploy.js +0 -47
  70. package/dist/commands/deploy/utils.d.ts +0 -16
  71. package/dist/commands/deploy/utils.js +0 -407
  72. package/dist/commands/init/init.d.ts +0 -2
  73. package/dist/commands/init/init.js +0 -22
  74. package/dist/commands/init/utils.d.ts +0 -11
  75. package/dist/commands/init/utils.js +0 -175
  76. package/dist/commands/intuned-cli/commands/helpers.d.ts +0 -28
  77. package/dist/commands/intuned-cli/commands/helpers.js +0 -138
  78. package/dist/commands/run-api-cli/run-api.d.ts +0 -2
  79. package/dist/commands/run-api-cli/run-api.js +0 -57
  80. package/dist/commands/run-api-cli/utils.d.ts +0 -9
  81. package/dist/commands/run-api-cli/utils.js +0 -144
  82. /package/dist/commands/intuned-cli/{terminal.d.ts → helpers/terminal.d.ts} +0 -0
  83. /package/dist/commands/intuned-cli/{terminal.js → helpers/terminal.js} +0 -0
@@ -1,83 +1 @@
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 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 init\`
17
-
18
- ### Run an API
19
- \`yarn intuned run <api-name>\`
20
- or
21
- \`npm run intuned run <api-name>\`
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 authsession create <parameters>\`
36
- or
37
- \`npm intuned authsession create <parameters>\`
38
-
39
-
40
-
41
- ### Validate an auth session
42
- \`yarn intuned authsession validate <auth-session-name>\`
43
- or
44
- \`npm intuned 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 deploy my-project-name\` or \`npm run 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 APIs
68
- - \`./parameters\`: Folder for API parameters injection
69
- - \`./output\`: Folder containing generated output files
70
- - \`./auth-sessions-instances\`: Folder containing auth session instances
71
-
72
- ## Types of auth sessions
73
- - \`MANUAL\`: Manual auth session, records the session using a recorder and stores it in the \`auth-sessions-instances\` folder
74
- - \`API\`: Auth session created via create API, stores the session in the \`auth-sessions-instances\` folder
75
-
76
- ### Notes
77
- - You can use either \`yarn\` or \`npm run\` to execute commands
78
- - All commands must be run from the project root directory
79
- - Verify you're in the correct location by confirming the presence of package.json and intuned.json
80
- - Running commands from subdirectories may result in errors
81
- - You can manage your deployed projects through the Intuned platform
82
- - WARNING: ⚠️ Changes to TS Config may break some Intuned functionalities
83
- `;
1
+ "use strict";
@@ -1,35 +0,0 @@
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
- };
@@ -1,43 +1 @@
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.PROJECT_DEPLOY_CHECK_PERIOD = exports.CURRENT_PLAYWRIGHT_VERSION = void 0;
7
- var _ms = _interopRequireDefault(require("ms"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- const CURRENT_PLAYWRIGHT_VERSION = exports.CURRENT_PLAYWRIGHT_VERSION = "1.44.1";
10
- const ProjectDeploymentStatus = exports.ProjectDeploymentStatus = ["completed", "failed", "pending", "not_found"];
11
- const PROJECT_DEPLOY_TIMEOUT = exports.PROJECT_DEPLOY_TIMEOUT = (0, _ms.default)("10 minutes");
12
- const PROJECT_DEPLOY_CHECK_PERIOD = exports.PROJECT_DEPLOY_CHECK_PERIOD = (0, _ms.default)("5 seconds");
13
- const userCLIScripts = exports.userCLIScripts = {
14
- "dev:local": "intuned-api-run sample playwright -j '{}'",
15
- dev: "intuned-api-run",
16
- build: "intuned-build",
17
- "types-check": "intuned-ts-check",
18
- "pre-publish": "intuned-ts-check && intuned-build",
19
- start: "node ./output/bundle_v2.js",
20
- "run-api": "run-api",
21
- "cli-build": "cli-build",
22
- deploy: "deploy",
23
- "cli-create-auth-session": "create-auth-session",
24
- "cli-check-auth-session": "check-auth-session",
25
- "browser-save-state": "intuned-browser-save-state",
26
- "auth-session-check": "intuned-auth-session-check",
27
- "auth-session-create": "intuned-auth-session-create",
28
- "auth-session-refresh": "intuned-auth-session-refresh",
29
- "auth-session-load": "intuned-auth-session-load"
30
- };
31
- const tsConfigCli = exports.tsConfigCli = {
32
- compilerOptions: {
33
- moduleResolution: "NodeNext",
34
- module: "NodeNext",
35
- target: "ES2021",
36
- outDir: "./dist",
37
- sourceMap: false,
38
- declaration: true,
39
- esModuleInterop: true
40
- },
41
- include: ["**/*.ts"],
42
- exclude: ["node_modules", "dist"]
43
- };
1
+ "use strict";
@@ -1,74 +0,0 @@
1
- export declare const templateIds: readonly ["default", "empty", "linkedin-recorder", "api-auth-sessions", "nested-scheduling", "ai-extractors", "npm-auth-sessions"];
2
- export type TemplateId = typeof templateIds[number];
3
- /**
4
- * A simple, tree-like structure to describe the contents of a folder to be mounted.
5
- *
6
- * @example
7
- * ```
8
- * const tree = {
9
- * myproject: {
10
- * directory: {
11
- * 'foo.js': {
12
- * file: {
13
- * contents: 'const x = 1;',
14
- * },
15
- * },
16
- * .envrc: {
17
- * file: {
18
- * contents: 'ENVIRONMENT=staging'
19
- * }
20
- * },
21
- * },
22
- * },
23
- * emptyFolder: {
24
- * directory: {}
25
- * },
26
- * };
27
- * ```
28
- */
29
- export interface FileSystemTree {
30
- [name: string]: DirectoryNode | FileNode;
31
- }
32
- /**
33
- * Represents a directory, see {@link FileSystemTree}.
34
- */
35
- export interface DirectoryNode {
36
- directory: FileSystemTree;
37
- }
38
- /**
39
- * Represents a file, see {@link FileSystemTree}.
40
- */
41
- export interface FileNode {
42
- file: {
43
- /**
44
- * The contents of the file, either as a UTF-8 string or as raw binary.
45
- */
46
- contents: string | Uint8Array;
47
- };
48
- }
49
- export interface AuthCredentials {
50
- workspaceId: string;
51
- apiKey: string;
52
- }
53
- export declare enum ApiAuthSessionBehavior {
54
- PERFORM_CHECK_AND_REFRESH = "PERFORM_CHECK_AND_REFRESH",
55
- SKIP_CHECK_AND_REFRESH = "SKIP_CHECK_AND_REFRESH"
56
- }
57
- export declare const CHECK_FAILED_ERROR_MESSAGE = "Auth session check failed";
58
- export type AuthSessionType = "API" | "MANUAL";
59
- export type AuthSessionMetadata = {
60
- createdAt: string;
61
- updatedAt: string;
62
- authSessionId: string;
63
- authSessionType: AuthSessionType;
64
- authSessionInput?: Record<string, any>;
65
- recorderStartUrl?: string;
66
- recorderEndUrl?: string;
67
- };
68
- export interface SessionStorageState {
69
- origin: string;
70
- sessionStorage: {
71
- name: string;
72
- value: string;
73
- }[];
74
- }
@@ -1,13 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.templateIds = exports.CHECK_FAILED_ERROR_MESSAGE = exports.ApiAuthSessionBehavior = void 0;
7
- const templateIds = exports.templateIds = ["default", "empty", "linkedin-recorder", "api-auth-sessions", "nested-scheduling", "ai-extractors", "npm-auth-sessions"];
8
- let ApiAuthSessionBehavior = exports.ApiAuthSessionBehavior = function (ApiAuthSessionBehavior) {
9
- ApiAuthSessionBehavior["PERFORM_CHECK_AND_REFRESH"] = "PERFORM_CHECK_AND_REFRESH";
10
- ApiAuthSessionBehavior["SKIP_CHECK_AND_REFRESH"] = "SKIP_CHECK_AND_REFRESH";
11
- return ApiAuthSessionBehavior;
12
- }({});
13
- const CHECK_FAILED_ERROR_MESSAGE = exports.CHECK_FAILED_ERROR_MESSAGE = "Auth session check failed";
1
+ "use strict";
@@ -1,9 +0,0 @@
1
- export declare function getAuthCredentials(options: {
2
- workspaceId?: string;
3
- apiKey?: string;
4
- }): Promise<{
5
- workspaceId: any;
6
- apiKey: string;
7
- }>;
8
- export declare function getBaseUrl(): string;
9
- export declare function getSettingIntunedJSON(key: string): Promise<any>;
@@ -1,39 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getAuthCredentials = getAuthCredentials;
7
- exports.getBaseUrl = getBaseUrl;
8
- exports.getSettingIntunedJSON = getSettingIntunedJSON;
9
- var _path = _interopRequireDefault(require("path"));
10
- var fs = _interopRequireWildcard(require("fs-extra"));
11
- var _helpers = require("../../commands/intuned-cli/commands/helpers");
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
- 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
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- async function getAuthCredentials(options) {
16
- const workspaceId = options.workspaceId || (await getSettingIntunedJSON("workspaceId"));
17
- const apiKey = options.apiKey || process.env.INTUNED_API_KEY;
18
- if (!workspaceId) {
19
- throw new _helpers.CLIError("Workspace ID is required. Please provide it via command line options or Intuned.json");
20
- }
21
- if (!apiKey) {
22
- throw new _helpers.CLIError("API key is required. Please provide it via command line options or INTUNED_API_KEY environment variable.");
23
- }
24
- return {
25
- workspaceId,
26
- apiKey
27
- };
28
- }
29
- function getBaseUrl() {
30
- return process.env.INTUNED_API_DOMAIN || `https://app.intuned.io`;
31
- }
32
- async function getSettingIntunedJSON(key) {
33
- const intunedJsonPath = _path.default.join(process.cwd(), "Intuned.json");
34
- const intunedJson = await fs.readJSON(intunedJsonPath);
35
- if (intunedJson && intunedJson[key]) {
36
- return intunedJson[key];
37
- }
38
- return null;
39
- }
1
+ "use strict";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.2.0-cli.4",
3
+ "version": "1.2.0-cli.5",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
@@ -51,12 +51,6 @@
51
51
  "intuned-browser-start": "./bin/intuned-browser-start",
52
52
  "intuned-browser-save-state": "./bin/intuned-browser-save-state",
53
53
  "intuned-ts-check": "./bin/intuned-ts-check",
54
- "init": "./bin/init",
55
- "run-api": "./bin/run-api",
56
- "deploy": "./bin/deploy",
57
- "cli-build": "./bin/cli-build",
58
- "create-auth-session": "./bin/create-auth-session",
59
- "check-auth-session": "./bin/check-auth-session",
60
54
  "intuned": "./bin/intuned"
61
55
  },
62
56
  "dependencies": {
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- require("../dist/commands/cli-auth-sessions/check.js");
package/bin/cli-build DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- require("../dist/commands/cli-build/cli-build.js");
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- require("../dist/commands/cli-auth-sessions/create.js");
package/bin/deploy DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- require("../dist/commands/deploy/deploy.js");
package/bin/init DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- require("../dist/commands/init/init.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,40 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
-
4
- var _commander = require("commander");
5
- var _dotenv = _interopRequireDefault(require("dotenv"));
6
- var _utils = require("./utils");
7
- var _chalk = _interopRequireDefault(require("chalk"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- _dotenv.default.config({
10
- path: `.env`
11
- });
12
- _commander.program.description("Check an auth session, if it is still valid or not").argument("<auth-session>", "Name/id of the auth session instance to use").action(async authSession => {
13
- try {
14
- if (!authSession) {
15
- throw new Error("Auth session instance is required, provide an ID/name for it");
16
- }
17
- const _isAuthEnabled = await (0, _utils.isAuthEnabled)();
18
- if (!_isAuthEnabled) {
19
- throw new Error("Auth session is not enabled, enable it in Intuned.json to be able to use it");
20
- }
21
- const checkApiExists = await (0, _utils.ensureAuthApi)("check");
22
- if (!checkApiExists) {
23
- throw new Error("Auth check API not implemented, please create it in the auth sessions specified directory");
24
- }
25
- const {
26
- authSessionInstanceStoragePath
27
- } = await (0, _utils.retrieveAuthSessionInstance)(authSession, true);
28
- const checkResult = await (0, _utils.runCheckApi)(authSessionInstanceStoragePath);
29
- if (checkResult) {
30
- console.log(_chalk.default.green("✓ Auth session checked successfully"));
31
- } else {
32
- console.log(_chalk.default.red("✗ Auth session is not valid, check failed"));
33
- }
34
- } catch (error) {
35
- console.error(_chalk.default.red(`Failed to check auth session: ${error.message}`));
36
- } finally {
37
- process.exit(0);
38
- }
39
- });
40
- _commander.program.parse(process.argv);
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,53 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
-
4
- var _commander = require("commander");
5
- var _dotenv = _interopRequireDefault(require("dotenv"));
6
- var _utils = require("./utils");
7
- var _chalk = _interopRequireDefault(require("chalk"));
8
- var _utils2 = require("../run-api-cli/utils");
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- _dotenv.default.config({
11
- path: `.env`
12
- });
13
- _commander.program.description("Create an auth session").argument("[auth-session-name]", "Name/id of the auth session instance to use (optional)").option("-i, --input <input>", "Auth session input parameters file").action(async (authSessionName, options) => {
14
- try {
15
- const _isAuthEnabled = await (0, _utils.isAuthEnabled)();
16
- if (!_isAuthEnabled) {
17
- throw new Error("Auth session is not enabled, enable it in Intuned.json to be able to use it");
18
- }
19
- const authType = await (0, _utils.getAuthType)();
20
- let authSessionInstancePath;
21
- if (authType === "MANUAL") {
22
- const recorderConfig = await (0, _utils.ensureRecorderURLs)();
23
- const {
24
- startUrl,
25
- endUrl
26
- } = recorderConfig;
27
- console.log(_chalk.default.blue("Starting auth session recorder..."));
28
- const session = await (0, _utils.recordAuthSession)(startUrl, endUrl);
29
- authSessionInstancePath = await (0, _utils.storeAuthSessionInstance)(session, authSessionName, {});
30
- } else {
31
- const createApiExists = await (0, _utils.ensureAuthApi)("create");
32
- if (!createApiExists) {
33
- throw new Error("Auth session create API not implemented, please create it in the auth sessions specified directory");
34
- }
35
- const authSessionInput = (await (0, _utils2.loadParameters)(options?.input)) ?? {};
36
- const session = await (0, _utils.runCreateApi)(authSessionInput);
37
- if (!session) {
38
- console.error(_chalk.default.red("Failed to create auth session."));
39
- process.exit(1);
40
- }
41
- authSessionInstancePath = await (0, _utils.storeAuthSessionInstance)(session, authSessionName, authSessionInput);
42
- }
43
- console.log(_chalk.default.green("✓ Auth session created successfully!"));
44
- if (authSessionInstancePath) {
45
- console.log(_chalk.default.underline.green.white(`🔒 Auth session instance and metadata stored at ${authSessionInstancePath}`));
46
- }
47
- } catch (error) {
48
- console.error(_chalk.default.red(`Failed to create auth session: ${error.message}`));
49
- } finally {
50
- process.exit(0);
51
- }
52
- });
53
- _commander.program.parse(process.argv);
@@ -1,28 +0,0 @@
1
- import { StorageState } from "../../common/contextStorageStateHelpers";
2
- import { AuthSessionMetadata, AuthSessionType } from "../../common/cli/types";
3
- import * as playwright from "playwright-core";
4
- export declare function isAuthEnabled(): Promise<boolean>;
5
- export declare function getAuthType(): Promise<AuthSessionType>;
6
- export declare function ensureRecorderURLs(): Promise<{
7
- startUrl: string;
8
- endUrl: string;
9
- }>;
10
- export declare function ensureAuthApi(operation: "create" | "check"): Promise<boolean>;
11
- export declare function runCreateApi(authSessionInput: Record<string, any>): Promise<StorageState>;
12
- export declare function runCheckApi(authSessionPath: string): Promise<boolean>;
13
- export declare function runCreateApiViaCLI(authSessionInput: Record<string, any>): Promise<StorageState>;
14
- export declare function runCheckApiViaCLI(authSessionPath: string): Promise<boolean>;
15
- export declare function storeAuthSessionInstance(authSessionInstance: StorageState, customName?: string, authSessionInput?: Record<string, any>): Promise<string>;
16
- export declare function retrieveAuthSessionInstance(authSessionId: string, pathsOnly?: boolean): Promise<{
17
- authSessionInstanceStoragePath: string;
18
- authSessionInstanceMetadataPath: string;
19
- authSessionInstance?: undefined;
20
- metadata?: undefined;
21
- } | {
22
- authSessionInstance: StorageState;
23
- metadata: AuthSessionMetadata;
24
- authSessionInstanceStoragePath?: undefined;
25
- authSessionInstanceMetadataPath?: undefined;
26
- }>;
27
- export declare function getStorageState(context: playwright.BrowserContext): Promise<StorageState>;
28
- export declare function recordAuthSession(startUrl: string, endUrl: string): Promise<StorageState>;