@intuned/runtime 1.0.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 (110) hide show
  1. package/.babelrc +21 -0
  2. package/.eslintignore +10 -0
  3. package/.eslintrc.js +39 -0
  4. package/CHANGELOG.md +7 -0
  5. package/InterfaceTemplate/index.playwright.ts +5 -0
  6. package/InterfaceTemplate/utils.ts +39 -0
  7. package/bin/intuned-api-run +2 -0
  8. package/bin/intuned-auth-session-check +2 -0
  9. package/bin/intuned-auth-session-create +2 -0
  10. package/bin/intuned-auth-session-load +2 -0
  11. package/bin/intuned-auth-session-refresh +2 -0
  12. package/bin/intuned-browser-save-state +2 -0
  13. package/bin/intuned-browser-start +2 -0
  14. package/bin/intuned-build +2 -0
  15. package/bin/intuned-ts-check +2 -0
  16. package/dist/commands/api/run.d.ts +6 -0
  17. package/dist/commands/api/run.js +115 -0
  18. package/dist/commands/auth-sessions/load.d.ts +2 -0
  19. package/dist/commands/auth-sessions/load.js +32 -0
  20. package/dist/commands/auth-sessions/run-check.d.ts +2 -0
  21. package/dist/commands/auth-sessions/run-check.js +62 -0
  22. package/dist/commands/auth-sessions/run-create.d.ts +2 -0
  23. package/dist/commands/auth-sessions/run-create.js +101 -0
  24. package/dist/commands/browser/save-state.d.ts +2 -0
  25. package/dist/commands/browser/save-state.js +17 -0
  26. package/dist/commands/browser/start-browser.d.ts +2 -0
  27. package/dist/commands/browser/start-browser.js +14 -0
  28. package/dist/commands/build.d.ts +1 -0
  29. package/dist/commands/build.js +84 -0
  30. package/dist/commands/common/browserUtils.d.ts +14 -0
  31. package/dist/commands/common/browserUtils.js +58 -0
  32. package/dist/commands/common/getFirstLineNumber.d.ts +9 -0
  33. package/dist/commands/common/getFirstLineNumber.js +103 -0
  34. package/dist/commands/common/getFirstLineNumber.test.js +228 -0
  35. package/dist/commands/common/sendMessageToClient.d.ts +1 -0
  36. package/dist/commands/common/sendMessageToClient.js +10 -0
  37. package/dist/commands/common/tsNodeImport.d.ts +1 -0
  38. package/dist/commands/common/tsNodeImport.js +20 -0
  39. package/dist/commands/common/utils/fileUtils.d.ts +6 -0
  40. package/dist/commands/common/utils/fileUtils.js +33 -0
  41. package/dist/commands/common/utils/settings.d.ts +2 -0
  42. package/dist/commands/common/utils/settings.js +28 -0
  43. package/dist/commands/common/utils/template.d.ts +2 -0
  44. package/dist/commands/common/utils/template.js +31 -0
  45. package/dist/commands/common/utils/unixSocket.d.ts +9 -0
  46. package/dist/commands/common/utils/unixSocket.js +44 -0
  47. package/dist/commands/interface/run.d.ts +1 -0
  48. package/dist/commands/interface/run.js +214 -0
  49. package/dist/commands/ts-check.d.ts +2 -0
  50. package/dist/commands/ts-check.js +56 -0
  51. package/dist/common/Logger/Logger/index.d.ts +12 -0
  52. package/dist/common/Logger/Logger/index.js +60 -0
  53. package/dist/common/Logger/Logger/types.d.ts +8 -0
  54. package/dist/common/Logger/Logger/types.js +5 -0
  55. package/dist/common/Logger/index.d.ts +12 -0
  56. package/dist/common/Logger/index.js +60 -0
  57. package/dist/common/Logger/types.d.ts +8 -0
  58. package/dist/common/Logger/types.js +5 -0
  59. package/dist/common/assets/browser_scripts.js +2214 -0
  60. package/dist/common/asyncLocalStorage/index.d.ts +16 -0
  61. package/dist/common/asyncLocalStorage/index.js +17 -0
  62. package/dist/common/cleanEnvironmentVariables.d.ts +1 -0
  63. package/dist/common/cleanEnvironmentVariables.js +16 -0
  64. package/dist/common/constants.d.ts +1 -0
  65. package/dist/common/constants.js +7 -0
  66. package/dist/common/contextStorageStateHelpers.d.ts +21 -0
  67. package/dist/common/contextStorageStateHelpers.js +81 -0
  68. package/dist/common/formatZodError.d.ts +2 -0
  69. package/dist/common/formatZodError.js +18 -0
  70. package/dist/common/getPlaywrightConstructs.d.ts +30 -0
  71. package/dist/common/getPlaywrightConstructs.js +196 -0
  72. package/dist/common/jwtTokenManager.d.ts +16 -0
  73. package/dist/common/jwtTokenManager.js +81 -0
  74. package/dist/common/runApi/errors.d.ts +65 -0
  75. package/dist/common/runApi/errors.js +156 -0
  76. package/dist/common/runApi/index.d.ts +12 -0
  77. package/dist/common/runApi/index.js +265 -0
  78. package/dist/common/runApi/types.d.ts +702 -0
  79. package/dist/common/runApi/types.js +74 -0
  80. package/dist/common/settingsSchema.d.ts +19 -0
  81. package/dist/common/settingsSchema.js +17 -0
  82. package/dist/common/telemetry.d.ts +3 -0
  83. package/dist/common/telemetry.js +32 -0
  84. package/dist/index.d.ts +4 -0
  85. package/dist/index.js +69 -0
  86. package/dist/runtime/RunError.d.ts +5 -0
  87. package/dist/runtime/RunError.js +19 -0
  88. package/dist/runtime/downloadDirectory.d.ts +1 -0
  89. package/dist/runtime/downloadDirectory.js +19 -0
  90. package/dist/runtime/enums.d.js +5 -0
  91. package/dist/runtime/enums.d.ts +11 -0
  92. package/dist/runtime/enums.js +18 -0
  93. package/dist/runtime/executionHelpers.test.js +53 -0
  94. package/dist/runtime/export.d.js +5 -0
  95. package/dist/runtime/export.d.ts +202 -0
  96. package/dist/runtime/extendPayload.d.ts +2 -0
  97. package/dist/runtime/extendPayload.js +21 -0
  98. package/dist/runtime/extendTimeout.d.ts +1 -0
  99. package/dist/runtime/extendTimeout.js +30 -0
  100. package/dist/runtime/index.d.ts +7 -0
  101. package/dist/runtime/index.js +53 -0
  102. package/dist/runtime/requestMoreInfo.d.ts +18 -0
  103. package/dist/runtime/requestMoreInfo.js +25 -0
  104. package/dist/runtime/runInfo.d.ts +2 -0
  105. package/dist/runtime/runInfo.js +21 -0
  106. package/package.json +136 -0
  107. package/template.tsconfig.json +14 -0
  108. package/tsconfig.eslint.json +5 -0
  109. package/tsconfig.json +24 -0
  110. package/typedoc.json +49 -0
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "RunError", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _RunError.RunError;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "extendPayload", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _extendPayload.extendPayload;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "extendTimeout", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _extendTimeout.extendTimeout;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "getDownloadDirectoryPath", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _downloadDirectory.getDownloadDirectoryPath;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "requestMultipleChoice", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _requestMoreInfo.requestMultipleChoice;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "requestOTP", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _requestMoreInfo.requestOTP;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "runInfo", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _runInfo.runInfo;
46
+ }
47
+ });
48
+ var _extendPayload = require("./extendPayload");
49
+ var _extendTimeout = require("./extendTimeout");
50
+ var _runInfo = require("./runInfo");
51
+ var _RunError = require("./RunError");
52
+ var _requestMoreInfo = require("./requestMoreInfo");
53
+ var _downloadDirectory = require("./downloadDirectory");
@@ -0,0 +1,18 @@
1
+ interface RequestMoreInfoReturnTypeBase {
2
+ [REQUEST_MORE_INFO_KEY]: true;
3
+ action: "request_more_info";
4
+ }
5
+ interface RequestMultipleChoiceReturnType extends RequestMoreInfoReturnTypeBase {
6
+ messageToUser: string;
7
+ choices: string[];
8
+ requestType: "multiple_choice";
9
+ }
10
+ interface RequestOtpReturnType extends RequestMoreInfoReturnTypeBase {
11
+ messageToUser: string;
12
+ requestType: "otp";
13
+ }
14
+ declare const REQUEST_MORE_INFO_KEY: unique symbol;
15
+ export declare function requestOTP(messageToUser: string): RequestOtpReturnType;
16
+ export declare function requestMultipleChoice(messageToUser: string, choices: string[]): RequestMultipleChoiceReturnType;
17
+ export type RequestMoreInfoDetails = RequestMultipleChoiceReturnType | RequestOtpReturnType;
18
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.requestMultipleChoice = requestMultipleChoice;
7
+ exports.requestOTP = requestOTP;
8
+ const REQUEST_MORE_INFO_KEY = Symbol("REQUEST_MORE_INFO");
9
+ function requestOTP(messageToUser) {
10
+ return {
11
+ [REQUEST_MORE_INFO_KEY]: true,
12
+ action: "request_more_info",
13
+ messageToUser,
14
+ requestType: "otp"
15
+ };
16
+ }
17
+ function requestMultipleChoice(messageToUser, choices) {
18
+ return {
19
+ [REQUEST_MORE_INFO_KEY]: true,
20
+ action: "request_more_info",
21
+ messageToUser,
22
+ requestType: "multiple_choice",
23
+ choices
24
+ };
25
+ }
@@ -0,0 +1,2 @@
1
+ import { RunInfo } from "./export";
2
+ export declare function runInfo(): RunInfo;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.runInfo = runInfo;
7
+ var _asyncLocalStorage = require("../common/asyncLocalStorage");
8
+ var _enums = require("./enums");
9
+ function runInfo() {
10
+ const context = (0, _asyncLocalStorage.getExecutionContext)();
11
+ if (!context) {
12
+ return {
13
+ runEnvironment: _enums.RunEnvironment.IDE
14
+ };
15
+ }
16
+ const {
17
+ extendedPayloads: _extendedPayloads,
18
+ ...rest
19
+ } = context;
20
+ return rest;
21
+ }
package/package.json ADDED
@@ -0,0 +1,136 @@
1
+ {
2
+ "name": "@intuned/runtime",
3
+ "version": "1.0.5",
4
+ "description": "Intuned runtime",
5
+ "exports": {
6
+ ".": "./dist/index.js",
7
+ "./dist/runtime": "./dist/runtime/index.js",
8
+ "./dist/common/runApi": "./dist/common/runApi/index.js",
9
+ "./dist/common/settingsSchema": "./dist/common/settingsSchema.js",
10
+ "./dist/common/contextStorageStateHelpers": "./dist/common/contextStorageStateHelpers.js",
11
+ "./dist/common/telemetry": "./dist/common/telemetry.js",
12
+ "./dist/common/jwtTokenManager": "./dist/common/jwtTokenManager.js",
13
+ "./dist/common/asyncLocalStorage": "./dist/common/asyncLocalStorage/index.js",
14
+ "./dist/common/cleanEnvironmentVariables": "./dist/common/cleanEnvironmentVariables.js",
15
+ "./dist/common/constants": "./dist/common/constants.js",
16
+ "./dist/commands/interface/run": "./dist/commands/interface/run.js"
17
+ },
18
+ "types": "./dist/index.d.ts",
19
+ "author": "Intuned Team",
20
+ "license": "MIT",
21
+ "scripts": {
22
+ "intuned-api-run": "vite-node ./src/commands/api/run.ts",
23
+ "intuned-browser-save-state": "vite-node ./src/commands/browser/save-state.ts",
24
+ "intuned-browser-start": "vite-node ./src/commands/browser/start-browser.ts",
25
+ "intuned-build": "yarn prepublishOnly && vite-node ./src/commands/build.ts",
26
+ "intuned-auth-session-check": "vite-node ./src/commands/auth/run-check.ts",
27
+ "intuned-auth-session-create": "vite-node ./src/commands/auth/run-create.ts",
28
+ "intuned-auth-session-refresh": "vite-node ./src/commands/auth/run-refresh.ts",
29
+ "intuned-auth-session-load": "vite-node ./src/commands/auth/load.ts",
30
+ "intuned-ts-check": "yarn prepublishOnly && vite-node ./src/commands/ts-check.ts",
31
+ "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",
32
+ "test": "vitest run",
33
+ "test:watch": "vitest",
34
+ "e2e": "yarn playwright test --config ./playwright.config.ts",
35
+ "clean-declarations": "find ./types-package -name \"*.d.ts\" -type f -delete",
36
+ "lint": "eslint .",
37
+ "fix": "eslint . --fix",
38
+ "generate-docs": "./scripts/generate-docs.sh",
39
+ "build-browser-scripts": "rollup -c ./src/common/browserScripts/rollup.config.mjs",
40
+ "copy-dts": "copyfiles -u 1 \"src/**/*.d.ts\" dist"
41
+ },
42
+ "bin": {
43
+ "intuned-api-run": "./bin/intuned-api-run",
44
+ "intuned-auth-session-create": "./bin/intuned-auth-session-create",
45
+ "intuned-auth-session-refresh": "./bin/intuned-auth-session-refresh",
46
+ "intuned-auth-session-load": "./bin/intuned-auth-session-load",
47
+ "intuned-auth-session-check": "./bin/intuned-auth-session-check",
48
+ "intuned-build": "./bin/intuned-build",
49
+ "intuned-browser-start": "./bin/intuned-browser-start",
50
+ "intuned-browser-save-state": "./bin/intuned-browser-save-state",
51
+ "intuned-ts-check": "./bin/intuned-ts-check"
52
+ },
53
+ "dependencies": {
54
+ "@babel/plugin-syntax-dynamic-import": "^7.8.3",
55
+ "@rollup/plugin-commonjs": "^25.0.2",
56
+ "@rollup/plugin-dynamic-import-vars": "^2.0.4",
57
+ "@rollup/plugin-json": "^6.0.0",
58
+ "@rollup/plugin-node-resolve": "^15.1.0",
59
+ "@rollup/plugin-typescript": "^11.1.2",
60
+ "@tinyhttp/app": "^2.1.0",
61
+ "@types/async-retry": "^1.4.8",
62
+ "@types/fs-extra": "^11.0.1",
63
+ "@types/lodash": "^4.14.200",
64
+ "@types/node": "^20.4.1",
65
+ "applicationinsights": "^2.9.2",
66
+ "async-retry": "^1.3.3",
67
+ "babel-plugin-dynamic-import-node": "^2.3.3",
68
+ "chalk": "^4.1.2",
69
+ "commander": "^11.0.0",
70
+ "cross-fetch": "^4.0.0",
71
+ "dotenv": "^16.3.1",
72
+ "express": "4.20.0",
73
+ "fastify": "^4.19.2",
74
+ "file-type": "16.5.4",
75
+ "fs-extra": "^11.3.0",
76
+ "https-proxy-agent": "^7.0.5",
77
+ "image-size": "^1.1.1",
78
+ "jsonwebtoken": "^9.0.2",
79
+ "lodash": "^4.17.21",
80
+ "milliparsec": "^2.3.0",
81
+ "ms": "^2.1.3",
82
+ "nanoid": "3",
83
+ "neverthrow": "^6.1.0",
84
+ "playwright": "1.44.1",
85
+ "playwright-extra": "^4.3.6",
86
+ "prettier": "^2.8.0",
87
+ "promptly": "^3.2.0",
88
+ "read-chunk": "^3.2.0",
89
+ "rollup": "^3.26.2",
90
+ "source-map": "^0.7.4",
91
+ "stack-utils": "^2.0.6",
92
+ "ts-morph": "^21.0.1",
93
+ "ts-node": "^10.9.1",
94
+ "tslib": "^2.6.0",
95
+ "typescript": "^5.1.6",
96
+ "wait-on": "^7.2.0",
97
+ "zod": "^3.21.4",
98
+ "zod-validation-error": "^3.0.3"
99
+ },
100
+ "devDependencies": {
101
+ "@babel/cli": "^7.23.4",
102
+ "@babel/core": "^7.23.7",
103
+ "@babel/plugin-transform-export-namespace-from": "^7.24.1",
104
+ "@babel/preset-env": "^7.23.7",
105
+ "@babel/preset-typescript": "^7.23.3",
106
+ "@jest/globals": "^29.6.2",
107
+ "@ngneat/falso": "^7.2.0",
108
+ "@types/jest": "^29.5.3",
109
+ "@types/jsdom": "^21.1.1",
110
+ "@types/promptly": "^3.0.4",
111
+ "@types/wait-on": "^5.3.4",
112
+ "@typescript-eslint/eslint-plugin": "^5.47.1",
113
+ "@typescript-eslint/parser": "^7.5.0",
114
+ "@vitest/ui": "^1.1.3",
115
+ "babel-plugin-macros": "^3.1.0",
116
+ "babel-preset-minify": "^0.5.2",
117
+ "copyfiles": "^2.4.1",
118
+ "dts-bundle-generator": "^8.0.1",
119
+ "eslint": "7.32.0",
120
+ "eslint-config-prettier": "^8.3.0",
121
+ "eslint-plugin-deprecation": "^1.3.3",
122
+ "eslint-plugin-prettier": "^4.2.1",
123
+ "msw": "^2.1.2",
124
+ "typedoc": "^0.25.13",
125
+ "typedoc-plugin-frontmatter": "^1.0.0",
126
+ "typedoc-plugin-markdown": "^4.0.2",
127
+ "typedoc-plugin-remove-references": "^0.0.6",
128
+ "vite": "^5.4.12",
129
+ "vite-node": "^1.1.3",
130
+ "vite-plugin-babel-macros": "^1.0.6",
131
+ "vitest": "^1.1.3"
132
+ },
133
+ "peerDependencies": {
134
+ "@intuned/runtime": "*"
135
+ }
136
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "ESNext",
4
+ "target": "ES2021",
5
+ "lib": [
6
+ "dom",
7
+ "es2021"
8
+ ],
9
+ "resolveJsonModule": true,
10
+ "esModuleInterop": true,
11
+ "moduleResolution": "node",
12
+ "skipLibCheck": true
13
+ }
14
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "include": ["**/*.ts", "**/*.d.ts"],
4
+ "exclude": ["node_modules"]
5
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2021",
4
+ "module": "esnext",
5
+ "esModuleInterop": true,
6
+ "moduleResolution": "bundler",
7
+ "resolveJsonModule": true,
8
+ "outDir": "./dist",
9
+ "strict": false,
10
+ "strictNullChecks": true,
11
+ "rootDir": "./src",
12
+ "sourceMap": false,
13
+ "declaration": true,
14
+ "emitDeclarationOnly": false,
15
+ "skipLibCheck": true
16
+ },
17
+ "include": [
18
+ "src/**/*.ts",
19
+ "src/**/*.d.ts",
20
+ "types-package/noEmpty.ts",
21
+ "src/assets/**/*"
22
+ ],
23
+ "exclude": ["node_modules", "**/*.test.ts", "**/__tests__/*"]
24
+ }
package/typedoc.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ // base config
3
+ "out": "docs/content",
4
+ "tsconfig": "./types-package/tsconfig.json",
5
+ "entryPoints": ["./types-package/ai-extractors/index.d.ts"],
6
+
7
+ // specific inclusions and exclusions
8
+ // "excludeProtected": true,
9
+ // "excludeNotDocumented": true,
10
+
11
+ "exclude": [
12
+ "./src.ts/_admin/**/*",
13
+ "./src.ts/_tests/**/*",
14
+ "./src.ts/testcases/**/*"
15
+ ],
16
+
17
+ // plugins
18
+ "plugin": [
19
+ // "./plugins/reorderSections.mjs",
20
+ "typedoc-plugin-remove-references", // remove additional references that clutter documentation
21
+ "typedoc-plugin-markdown", // generate markdown files
22
+ "typedoc-plugin-frontmatter", // add frontmatter to markdown files, prereq for the below custom plugin
23
+ "./docs/plugins/typedoc-plugin-mintlify-frontmatter.mjs", // formats frontmatter to match mintlify
24
+ "./docs/plugins/typedoc-plugin-navigation-output.mjs" // formats navigation to match mintlify
25
+ ],
26
+
27
+ // formatting + mintlify compatibility
28
+ "fileExtension": ".mdx", // use mdx files for mintlfiy compatibility
29
+ "entryFileName": "index.mdx", // rename entry from "README.md" to "index.mdx"
30
+ "hidePageHeader": true, // hide page header, conflicts with mintlify
31
+ "hidePageTitle": true, // hide page title, conflicts with mintlify
32
+ "hideBreadcrumbs": true, // hide breadcrumbs, conflicts with mintlify
33
+ "useCodeBlocks": true, // makes API definitions more readable
34
+
35
+ "expandObjects": false,
36
+ // "parametersFormat": "table", // readability
37
+ // "propertiesFormat": "table", // readability
38
+ "navigation": {
39
+ "includeCategories": true,
40
+ "includeGroups": false
41
+ },
42
+ "disableSources": true,
43
+ "hideParameterTypesInTitle": false,
44
+ // "membersWithOwnFile": ["Class", "Enum", "Interface", "Function"],
45
+ // "hideParameterTypesInTitle": true,
46
+ "readme": "none",
47
+ "githubPages": false,
48
+ "excludeExternals": true
49
+ }