@intuned/runtime-dev 1.3.17-source.0 → 1.3.17

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 (88) hide show
  1. package/.babelrc +6 -0
  2. package/InterfaceTemplate/{utils.ts → __utils.ts} +3 -1
  3. package/InterfaceTemplate/index.playwright.ts +1 -1
  4. package/bin/intuned +0 -0
  5. package/bin/intuned-interface +7 -0
  6. package/dist/commands/api/run.js +3 -3
  7. package/dist/commands/auth-sessions/run-check.js +3 -3
  8. package/dist/commands/auth-sessions/run-create.js +3 -3
  9. package/dist/commands/build.js +1 -3
  10. package/dist/commands/common/browserUtils.d.ts +3 -3
  11. package/dist/commands/common/browserUtils.js +3 -4
  12. package/dist/commands/common/getFirstLineNumber.test.js +1 -2
  13. package/dist/commands/common/tsNodeImport.d.ts +1 -1
  14. package/dist/commands/common/tsNodeImport.js +1 -2
  15. package/dist/commands/common/utils/fileUtils.js +1 -2
  16. package/dist/commands/common/utils/{unixSocket.d.ts → interfaceClient.d.ts} +10 -2
  17. package/dist/commands/common/utils/{unixSocket.js → interfaceClient.js} +16 -5
  18. package/dist/commands/common/utils/template.js +1 -2
  19. package/dist/commands/interface/run.js +23 -49
  20. package/dist/commands/intuned-cli/commands/deploy.command.js +2 -2
  21. package/dist/commands/intuned-cli/commands/provision.command.d.ts +2 -2
  22. package/dist/commands/intuned-cli/commands/provision.command.js +1 -1
  23. package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +5 -1
  24. package/dist/commands/intuned-cli/commands/types.d.ts +5 -1
  25. package/dist/commands/intuned-cli/commands/types.js +5 -3
  26. package/dist/commands/intuned-cli/controller/__test__/api.test.js +6 -5
  27. package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +6 -5
  28. package/dist/commands/intuned-cli/controller/api.d.ts +2 -2
  29. package/dist/commands/intuned-cli/controller/api.js +3 -3
  30. package/dist/commands/intuned-cli/controller/authSession.d.ts +13 -13
  31. package/dist/commands/intuned-cli/controller/authSession.js +3 -2
  32. package/dist/commands/intuned-cli/controller/build.js +1 -2
  33. package/dist/commands/intuned-cli/controller/deploy.js +1 -2
  34. package/dist/commands/intuned-cli/controller/index.js +1 -2
  35. package/dist/commands/intuned-cli/controller/provision.js +1 -2
  36. package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +39 -2
  37. package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +3 -3
  38. package/dist/commands/intuned-cli/helpers/auth.d.ts +4 -4
  39. package/dist/commands/intuned-cli/helpers/auth.js +2 -2
  40. package/dist/commands/intuned-cli/helpers/browser.d.ts +3 -4
  41. package/dist/commands/intuned-cli/helpers/browser.js +31 -2
  42. package/dist/commands/intuned-cli/helpers/errors.d.ts +1 -1
  43. package/dist/commands/intuned-cli/helpers/errors.js +2 -2
  44. package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +6 -5
  45. package/dist/commands/intuned-cli/helpers/timeout.js +2 -2
  46. package/dist/commands/intuned-cli/helpers/traces.d.ts +1 -1
  47. package/dist/commands/intuned-cli/helpers/wrapper.js +2 -2
  48. package/dist/commands/intuned-cli/main.js +1 -2
  49. package/dist/commands/intuned-cli/types.d.ts +8 -8
  50. package/dist/commands/ts-check.js +1 -2
  51. package/dist/common/binStartupScript.js +16 -7
  52. package/dist/common/browserTabs.d.ts +72 -0
  53. package/dist/common/browserTabs.js +74 -0
  54. package/dist/common/constants.d.ts +1 -0
  55. package/dist/common/constants.js +2 -1
  56. package/dist/common/contextStorageStateHelpers.d.ts +4 -3
  57. package/dist/common/contextStorageStateHelpers.js +4 -1
  58. package/dist/common/extension/extensionsHelpers.d.ts +1 -1
  59. package/dist/common/extension/types.d.ts +14 -7
  60. package/dist/common/formatZodError.d.ts +1 -1
  61. package/dist/common/intunedJson.d.ts +29 -14
  62. package/dist/common/intunedJson.js +24 -3
  63. package/dist/common/jwtTokenManager.js +10 -6
  64. package/dist/common/launchBrowser.d.ts +1 -0
  65. package/dist/common/launchBrowser.js +32 -5
  66. package/dist/common/playwrightContext.d.ts +3 -5
  67. package/dist/common/playwrightContext.js +9 -11
  68. package/dist/common/runApi/importUsingImportFunction.d.ts +1 -3
  69. package/dist/common/runApi/importUsingImportFunction.js +7 -7
  70. package/dist/common/runApi/index.d.ts +3 -6
  71. package/dist/common/runApi/index.js +25 -51
  72. package/dist/common/settingsSchema.d.ts +49 -45
  73. package/dist/common/settingsSchema.js +1 -2
  74. package/dist/common/setupContextHook.d.ts +1 -2
  75. package/dist/common/setupContextHook.js +2 -2
  76. package/dist/common/telemetry.js +1 -2
  77. package/dist/index.d.ts +0 -1
  78. package/dist/index.js +0 -7
  79. package/dist/runtime/downloadDirectory.js +2 -2
  80. package/dist/vendor/runtime-interface.d.ts +1 -0
  81. package/dist/vendor/runtime-interface.js +491 -0
  82. package/package.json +17 -10
  83. package/tsup.config.ts +12 -0
  84. package/WebTemplate.zip +0 -0
  85. package/dist/common/runApi/errors.d.ts +0 -72
  86. package/dist/common/runApi/errors.js +0 -169
  87. package/dist/common/runApi/types.d.ts +0 -830
  88. package/dist/common/runApi/types.js +0 -73
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.3.17-source.0",
3
+ "version": "1.3.17",
4
4
  "description": "Intuned runtime",
5
+ "packageManager": "yarn@4.12.0",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
5
8
  "exports": {
6
9
  ".": "./dist/index.js",
7
10
  "./dist/runtime": "./dist/runtime/index.js",
@@ -14,10 +17,11 @@
14
17
  "./dist/common/cleanEnvironmentVariables": "./dist/common/cleanEnvironmentVariables.js",
15
18
  "./dist/common/constants": "./dist/common/constants.js",
16
19
  "./dist/commands/interface/run": "./dist/commands/interface/run.js",
20
+ "./interface": "./dist/commands/interface/index.js",
17
21
  "./dist/commands/intuned-run/intuned-run": "./dist/commands/intuned-run/intuned-run.js",
18
- "./dist/common/binStartupScript": "./dist/common/binStartupScript.js"
22
+ "./dist/common/binStartupScript": "./dist/common/binStartupScript.js",
23
+ "./dist/commands/common/utils/interfaceClient": "./dist/commands/common/utils/interfaceClient.js"
19
24
  },
20
- "types": "./dist/index.d.ts",
21
25
  "author": "Intuned Team",
22
26
  "license": "Elastic-2.0",
23
27
  "scripts": {
@@ -31,7 +35,7 @@
31
35
  "intuned-ts-check": "yarn prepublishOnly && vite-node ./src/commands/ts-check.ts",
32
36
  "intuned": "vite-node ./src/commands/intuned-cli/main.ts",
33
37
  "intuned-get-headless-user-agent": "vite-node ./src/commands/get-headless-user-agent.ts",
34
- "build": "rm -rf dist && tsc -p tsconfig.json && yarn copy-dts && babel src --out-dir dist --extensions '.ts' && cp -r ./src/common/assets dist/common/assets",
38
+ "build": "rm -rf dist && tsc -p tsconfig.json && yarn copy-dts && babel src --out-dir dist --extensions '.ts' && tsup && cp -r ./src/common/assets dist/common/assets",
35
39
  "test": "vitest run",
36
40
  "test:watch": "vitest",
37
41
  "e2e": "yarn playwright test --config ./playwright.config.ts",
@@ -43,16 +47,17 @@
43
47
  "copy-dts": "copyfiles -u 1 \"src/**/*.d.ts\" dist"
44
48
  },
45
49
  "bin": {
50
+ "intuned": "bin/intuned",
46
51
  "intuned-api-run": "bin/intuned-api-run",
52
+ "intuned-auth-session-check": "bin/intuned-auth-session-check",
47
53
  "intuned-auth-session-create": "bin/intuned-auth-session-create",
48
54
  "intuned-auth-session-load": "bin/intuned-auth-session-load",
49
- "intuned-auth-session-check": "bin/intuned-auth-session-check",
50
- "intuned-build": "bin/intuned-build",
51
- "intuned-browser-start": "bin/intuned-browser-start",
52
55
  "intuned-browser-save-state": "bin/intuned-browser-save-state",
53
- "intuned-ts-check": "bin/intuned-ts-check",
56
+ "intuned-browser-start": "bin/intuned-browser-start",
57
+ "intuned-build": "bin/intuned-build",
54
58
  "intuned-get-headless-user-agent": "bin/intuned-get-headless-user-agent",
55
- "intuned": "bin/intuned"
59
+ "intuned-interface": "bin/intuned-interface",
60
+ "intuned-ts-check": "bin/intuned-ts-check"
56
61
  },
57
62
  "dependencies": {
58
63
  "@babel/plugin-syntax-dynamic-import": "7.8.3",
@@ -80,7 +85,6 @@
80
85
  "milliparsec": "2.3.0",
81
86
  "nanoid": "3",
82
87
  "neverthrow": "6.1.0",
83
- "playwright-extra": "4.3.6",
84
88
  "portfinder": "^1.0.37",
85
89
  "press-any-key": "^1.1.0",
86
90
  "prettier": "2.8.0",
@@ -106,6 +110,7 @@
106
110
  "@babel/plugin-transform-export-namespace-from": "^7.24.1",
107
111
  "@babel/preset-env": "^7.23.7",
108
112
  "@babel/preset-typescript": "^7.23.3",
113
+ "@intuned/runtime-interface": "0.0.1",
109
114
  "@jest/globals": "^29.6.2",
110
115
  "@ngneat/falso": "^7.2.0",
111
116
  "@types/jest": "^29.5.3",
@@ -119,6 +124,7 @@
119
124
  "@typescript-eslint/parser": "^7.5.0",
120
125
  "@vitest/ui": "^1.1.3",
121
126
  "babel-plugin-macros": "^3.1.0",
127
+ "babel-plugin-module-resolver": "^5.0.2",
122
128
  "babel-preset-minify": "^0.5.2",
123
129
  "copyfiles": "^2.4.1",
124
130
  "dts-bundle-generator": "^8.0.1",
@@ -128,6 +134,7 @@
128
134
  "eslint-plugin-prettier": "^4.2.1",
129
135
  "msw": "^2.1.2",
130
136
  "playwright": "^1.55.0",
137
+ "tsup": "^8.3.5",
131
138
  "typedoc": "^0.25.13",
132
139
  "typedoc-plugin-frontmatter": "^1.0.0",
133
140
  "typedoc-plugin-markdown": "^4.0.2",
package/tsup.config.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { defineConfig } from "tsup";
2
+
3
+ // bundle workspace dependencies
4
+ export default defineConfig({
5
+ entry: ["src/vendor/runtime-interface.ts"],
6
+ format: ["cjs"],
7
+ dts: true,
8
+ outDir: "dist/vendor",
9
+ clean: false, // Don't clean - babel handles dist cleanup
10
+ sourcemap: false,
11
+ target: "node20",
12
+ });
package/WebTemplate.zip DELETED
Binary file
@@ -1,72 +0,0 @@
1
- import { RunErrorOptions } from "../../runtime/export";
2
- export declare const apiNotFoundErrorCode = "APINotFoundError";
3
- export declare const invalidApiErrorCode = "InvalidAPIError";
4
- export declare const invalidCheckErrorCode = "InvalidCheckError";
5
- export declare const abortedErrorCode = "AbortedError";
6
- export declare const authRequiredErrorCode = "AuthRequiredError";
7
- export declare const authCheckNotFoundErrorCode = "AuthCheckNotFoundError";
8
- export declare const authCheckFailedErrorCode = "AuthCheckFailedError";
9
- export declare const maxLevelsExceededErrorCode = "MaxLevelsExceededError";
10
- export declare const automationError = "AutomationError";
11
- export declare const internalInvalidInputErrorCode = "InternalInvalidInputError";
12
- export declare const resultTooBigErrorCode = "ResultTooBigError";
13
- export declare const runAutomationErrorCodes: readonly ["APINotFoundError", "InvalidAPIError", "InvalidCheckError", "AbortedError", "AuthRequiredError", "AuthCheckNotFoundError", "AuthCheckFailedError", "MaxLevelsExceededError", "AutomationError", "InternalInvalidInputError", "ResultTooBigError"];
14
- export type RunAutomationErrorCode = typeof runAutomationErrorCodes[number];
15
- export declare abstract class RunAutomationError<T = any> {
16
- code: RunAutomationErrorCode;
17
- statusCode: number;
18
- wrapped: boolean;
19
- message: string;
20
- cause?: RunAutomationError;
21
- details?: T;
22
- get json(): {
23
- code: "APINotFoundError" | "InvalidAPIError" | "InvalidCheckError" | "AbortedError" | "AuthRequiredError" | "AuthCheckNotFoundError" | "AuthCheckFailedError" | "MaxLevelsExceededError" | "AutomationError" | "InternalInvalidInputError" | "ResultTooBigError";
24
- details: T | undefined;
25
- cause: any;
26
- };
27
- }
28
- export declare class ApiNotFoundError extends RunAutomationError {
29
- constructor(apiName: string);
30
- }
31
- export declare class InvalidApiError extends RunAutomationError {
32
- constructor(message: string);
33
- }
34
- export declare class InvalidCheckError extends RunAutomationError {
35
- constructor(message: string, cause?: RunAutomationError);
36
- }
37
- export declare class AbortedError extends RunAutomationError {
38
- constructor();
39
- }
40
- export declare class AuthRequiredError extends RunAutomationError {
41
- constructor();
42
- }
43
- export declare class AuthCheckNotFoundError extends RunAutomationError {
44
- constructor();
45
- }
46
- export declare class AuthCheckFailedError extends RunAutomationError {
47
- constructor();
48
- }
49
- export declare class MaxLevelsExceededError extends RunAutomationError<{
50
- levels: number;
51
- }> {
52
- constructor(levels: number);
53
- }
54
- export declare class AutomationError extends RunAutomationError<{
55
- name?: string;
56
- message?: string;
57
- statusCode?: number;
58
- errorCode?: string;
59
- options?: RunErrorOptions;
60
- }> {
61
- error: any;
62
- constructor(error: any);
63
- }
64
- export declare class InternalInvalidInputError extends RunAutomationError {
65
- constructor(message: string, details?: any);
66
- }
67
- export declare class ResultTooBigError extends RunAutomationError<{
68
- sizeInBytes: number;
69
- maxSizeInBytes: number;
70
- }> {
71
- constructor(sizeInBytes: number, maxSizeInBytes: number);
72
- }
@@ -1,169 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.runAutomationErrorCodes = exports.resultTooBigErrorCode = exports.maxLevelsExceededErrorCode = exports.invalidCheckErrorCode = exports.invalidApiErrorCode = exports.internalInvalidInputErrorCode = exports.automationError = exports.authRequiredErrorCode = exports.authCheckNotFoundErrorCode = exports.authCheckFailedErrorCode = exports.apiNotFoundErrorCode = exports.abortedErrorCode = exports.RunAutomationError = exports.ResultTooBigError = exports.MaxLevelsExceededError = exports.InvalidCheckError = exports.InvalidApiError = exports.InternalInvalidInputError = exports.AutomationError = exports.AuthRequiredError = exports.AuthCheckNotFoundError = exports.AuthCheckFailedError = exports.ApiNotFoundError = exports.AbortedError = void 0;
7
- var _runtime = require("../../runtime");
8
- var playwright = _interopRequireWildcard(require("playwright-core"));
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); }
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; }
11
- const apiNotFoundErrorCode = exports.apiNotFoundErrorCode = "APINotFoundError";
12
- const invalidApiErrorCode = exports.invalidApiErrorCode = "InvalidAPIError";
13
- const invalidCheckErrorCode = exports.invalidCheckErrorCode = "InvalidCheckError";
14
- const abortedErrorCode = exports.abortedErrorCode = "AbortedError";
15
- const authRequiredErrorCode = exports.authRequiredErrorCode = "AuthRequiredError";
16
- const authCheckNotFoundErrorCode = exports.authCheckNotFoundErrorCode = "AuthCheckNotFoundError";
17
- const authCheckFailedErrorCode = exports.authCheckFailedErrorCode = "AuthCheckFailedError";
18
- const maxLevelsExceededErrorCode = exports.maxLevelsExceededErrorCode = "MaxLevelsExceededError";
19
- const automationError = exports.automationError = "AutomationError";
20
- const internalInvalidInputErrorCode = exports.internalInvalidInputErrorCode = "InternalInvalidInputError";
21
- const resultTooBigErrorCode = exports.resultTooBigErrorCode = "ResultTooBigError";
22
- const runAutomationErrorCodes = exports.runAutomationErrorCodes = [apiNotFoundErrorCode, invalidApiErrorCode, invalidCheckErrorCode, abortedErrorCode, authRequiredErrorCode, authCheckNotFoundErrorCode, authCheckFailedErrorCode, maxLevelsExceededErrorCode, automationError, internalInvalidInputErrorCode, resultTooBigErrorCode];
23
- class RunAutomationError {
24
- wrapped = false;
25
- get json() {
26
- return {
27
- code: this.code,
28
- details: this.details,
29
- cause: this.cause?.json
30
- };
31
- }
32
- }
33
- exports.RunAutomationError = RunAutomationError;
34
- class ApiNotFoundError extends RunAutomationError {
35
- constructor(apiName) {
36
- super();
37
- this.code = apiNotFoundErrorCode;
38
- this.statusCode = 404;
39
- this.message = `API ${apiName} not found`;
40
- }
41
- }
42
- exports.ApiNotFoundError = ApiNotFoundError;
43
- class InvalidApiError extends RunAutomationError {
44
- constructor(message) {
45
- super();
46
- this.code = invalidApiErrorCode;
47
- this.statusCode = 400;
48
- this.message = `API is invalid: ${message}`;
49
- }
50
- }
51
- exports.InvalidApiError = InvalidApiError;
52
- class InvalidCheckError extends RunAutomationError {
53
- constructor(message, cause) {
54
- super();
55
- this.code = invalidCheckErrorCode;
56
- this.statusCode = 400;
57
- this.message = message;
58
- this.cause = cause;
59
- }
60
- }
61
- exports.InvalidCheckError = InvalidCheckError;
62
- class AbortedError extends RunAutomationError {
63
- constructor() {
64
- super();
65
- this.code = abortedErrorCode;
66
- this.statusCode = 200;
67
- this.message = "Operation was aborted";
68
- }
69
- }
70
- exports.AbortedError = AbortedError;
71
- class AuthRequiredError extends RunAutomationError {
72
- constructor() {
73
- super();
74
- this.code = authRequiredErrorCode;
75
- this.statusCode = 401;
76
- this.message = "Authentication is required";
77
- this.wrapped = true;
78
- }
79
- }
80
- exports.AuthRequiredError = AuthRequiredError;
81
- class AuthCheckNotFoundError extends RunAutomationError {
82
- constructor() {
83
- super();
84
- this.code = authCheckNotFoundErrorCode;
85
- this.statusCode = 404;
86
- this.message = "Auth check not found";
87
- }
88
- }
89
- exports.AuthCheckNotFoundError = AuthCheckNotFoundError;
90
- class AuthCheckFailedError extends RunAutomationError {
91
- constructor() {
92
- super();
93
- this.code = authCheckFailedErrorCode;
94
- this.statusCode = 401;
95
- this.message = "AuthSession check failed";
96
- this.wrapped = true;
97
- }
98
- }
99
- exports.AuthCheckFailedError = AuthCheckFailedError;
100
- class MaxLevelsExceededError extends RunAutomationError {
101
- constructor(levels) {
102
- super();
103
- this.code = maxLevelsExceededErrorCode;
104
- this.statusCode = 400;
105
- this.message = `Max levels exceeded. Only ${levels} levels are supported`;
106
- this.details = {
107
- levels
108
- };
109
- }
110
- }
111
- exports.MaxLevelsExceededError = MaxLevelsExceededError;
112
- class AutomationError extends RunAutomationError {
113
- constructor(error) {
114
- super();
115
- this.error = error;
116
- this.code = automationError;
117
- if (error instanceof playwright.errors.TimeoutError) {
118
- this.statusCode = 500;
119
- this.message = `[${error.name}] ${error.message}`;
120
- this.details = {
121
- name: error.name,
122
- message: error.message
123
- };
124
- return;
125
- }
126
- if (error instanceof _runtime.RunError) {
127
- this.wrapped = true;
128
- this.statusCode = error.options.status_code ?? 500;
129
- this.message = `[${error.options.error_code ?? error.name}] ${error.message}`;
130
- this.details = {
131
- name: error.name,
132
- statusCode: error.options.status_code,
133
- errorCode: error.options.error_code,
134
- message: error.message,
135
- options: error.options
136
- };
137
- }
138
- this.statusCode = 500;
139
- this.message = `[${error?.name ?? error}] ${error?.message}`;
140
- this.details = {
141
- name: error?.name,
142
- message: error?.message
143
- };
144
- }
145
- }
146
- exports.AutomationError = AutomationError;
147
- class InternalInvalidInputError extends RunAutomationError {
148
- constructor(message, details) {
149
- super();
150
- this.code = internalInvalidInputErrorCode;
151
- this.statusCode = 500;
152
- this.message = message;
153
- this.details = details;
154
- }
155
- }
156
- exports.InternalInvalidInputError = InternalInvalidInputError;
157
- class ResultTooBigError extends RunAutomationError {
158
- constructor(sizeInBytes, maxSizeInBytes) {
159
- super();
160
- this.code = resultTooBigErrorCode;
161
- this.statusCode = 413;
162
- this.message = `Automation result is too big. Size: ${Math.round(sizeInBytes / 1024 / 1024 * 100) / 100}MB, Max allowed: ${Math.round(maxSizeInBytes / 1024 / 1024 * 100) / 100}MB`;
163
- this.details = {
164
- sizeInBytes,
165
- maxSizeInBytes
166
- };
167
- }
168
- }
169
- exports.ResultTooBigError = ResultTooBigError;