@intuned/runtime 1.3.17 → 1.3.18-interface.7

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 (300) hide show
  1. package/bin/intuned +0 -0
  2. package/bin/intuned-interface +7 -0
  3. package/dist/chunk-6ZRJOUQS.mjs +16 -0
  4. package/dist/chunk-6ZRJOUQS.mjs.map +1 -0
  5. package/dist/chunk-7YL2JUTE.mjs +146 -0
  6. package/dist/chunk-7YL2JUTE.mjs.map +1 -0
  7. package/dist/chunk-B3T6RXPC.mjs +794 -0
  8. package/dist/chunk-B3T6RXPC.mjs.map +1 -0
  9. package/dist/chunk-FGV5T6SI.mjs +27 -0
  10. package/dist/chunk-FGV5T6SI.mjs.map +1 -0
  11. package/dist/chunk-G4PO5RIV.mjs +85 -0
  12. package/dist/chunk-G4PO5RIV.mjs.map +1 -0
  13. package/dist/chunk-LZOMFHX3.mjs +38 -0
  14. package/dist/chunk-LZOMFHX3.mjs.map +1 -0
  15. package/dist/{common/formatZodError.js → chunk-NDMVGENG.mjs} +9 -9
  16. package/dist/chunk-NDMVGENG.mjs.map +1 -0
  17. package/dist/chunk-W4UX6G4X.mjs +17 -0
  18. package/dist/chunk-W4UX6G4X.mjs.map +1 -0
  19. package/dist/chunk-XC75QGFG.mjs +1106 -0
  20. package/dist/chunk-XC75QGFG.mjs.map +1 -0
  21. package/dist/chunk-XOAZ2MGA.mjs +59 -0
  22. package/dist/chunk-XOAZ2MGA.mjs.map +1 -0
  23. package/dist/commands/interface/run.d.mts +3 -0
  24. package/dist/commands/interface/run.d.ts +3 -1
  25. package/dist/commands/interface/run.js +2060 -178
  26. package/dist/commands/interface/run.js.map +1 -0
  27. package/dist/commands/interface/run.mjs +255 -0
  28. package/dist/commands/interface/run.mjs.map +1 -0
  29. package/dist/common/asyncLocalStorage/index.d.mts +17 -0
  30. package/dist/common/asyncLocalStorage/index.d.ts +9 -8
  31. package/dist/common/asyncLocalStorage/index.js +34 -9
  32. package/dist/common/asyncLocalStorage/index.js.map +1 -0
  33. package/dist/common/asyncLocalStorage/index.mjs +12 -0
  34. package/dist/common/asyncLocalStorage/index.mjs.map +1 -0
  35. package/dist/common/binStartupScript.d.mts +2 -0
  36. package/dist/common/binStartupScript.d.ts +2 -1
  37. package/dist/common/binStartupScript.js +127 -11
  38. package/dist/common/binStartupScript.js.map +1 -0
  39. package/dist/common/binStartupScript.mjs +135 -0
  40. package/dist/common/binStartupScript.mjs.map +1 -0
  41. package/dist/common/cleanEnvironmentVariables.d.mts +3 -0
  42. package/dist/common/cleanEnvironmentVariables.d.ts +3 -1
  43. package/dist/common/cleanEnvironmentVariables.js +30 -7
  44. package/dist/common/cleanEnvironmentVariables.js.map +1 -0
  45. package/dist/common/cleanEnvironmentVariables.mjs +8 -0
  46. package/dist/common/cleanEnvironmentVariables.mjs.map +1 -0
  47. package/dist/common/constants.d.mts +13 -0
  48. package/dist/common/constants.d.ts +13 -10
  49. package/dist/common/constants.js +58 -14
  50. package/dist/common/constants.js.map +1 -0
  51. package/dist/common/constants.mjs +28 -0
  52. package/dist/common/constants.mjs.map +1 -0
  53. package/dist/common/contextStorageStateHelpers.d.mts +24 -0
  54. package/dist/common/contextStorageStateHelpers.d.ts +8 -5
  55. package/dist/common/contextStorageStateHelpers.js +51 -23
  56. package/dist/common/contextStorageStateHelpers.js.map +1 -0
  57. package/dist/common/contextStorageStateHelpers.mjs +10 -0
  58. package/dist/common/contextStorageStateHelpers.mjs.map +1 -0
  59. package/dist/common/jwtTokenManager.d.mts +19 -0
  60. package/dist/common/jwtTokenManager.d.ts +6 -4
  61. package/dist/common/jwtTokenManager.js +112 -40
  62. package/dist/common/jwtTokenManager.js.map +1 -0
  63. package/dist/common/jwtTokenManager.mjs +11 -0
  64. package/dist/common/jwtTokenManager.mjs.map +1 -0
  65. package/dist/common/runApi/index.d.mts +11 -0
  66. package/dist/common/runApi/index.d.ts +10 -10
  67. package/dist/common/runApi/index.js +1776 -93
  68. package/dist/common/runApi/index.js.map +1 -0
  69. package/dist/common/runApi/index.mjs +18 -0
  70. package/dist/common/runApi/index.mjs.map +1 -0
  71. package/dist/common/settingsSchema.d.mts +540 -0
  72. package/dist/common/settingsSchema.d.ts +58 -51
  73. package/dist/common/settingsSchema.js +55 -20
  74. package/dist/common/settingsSchema.js.map +1 -0
  75. package/dist/common/settingsSchema.mjs +10 -0
  76. package/dist/common/settingsSchema.mjs.map +1 -0
  77. package/dist/common/telemetry.d.mts +6 -0
  78. package/dist/common/telemetry.d.ts +6 -3
  79. package/dist/common/telemetry.js +41 -9
  80. package/dist/common/telemetry.js.map +1 -0
  81. package/dist/common/telemetry.mjs +31 -0
  82. package/dist/common/telemetry.mjs.map +1 -0
  83. package/dist/export.d-BAUMB-lG.d.mts +140 -0
  84. package/dist/export.d-BAUMB-lG.d.ts +140 -0
  85. package/dist/index.d.mts +6 -0
  86. package/dist/index.d.ts +6 -5
  87. package/dist/index.js +783 -98
  88. package/dist/index.js.map +1 -0
  89. package/dist/index.mjs +47 -0
  90. package/dist/index.mjs.map +1 -0
  91. package/dist/runtime/index.d.mts +168 -0
  92. package/dist/runtime/index.d.ts +168 -10
  93. package/dist/runtime/index.js +779 -88
  94. package/dist/runtime/index.js.map +1 -0
  95. package/dist/runtime/index.mjs +42 -0
  96. package/dist/runtime/index.mjs.map +1 -0
  97. package/package.json +78 -23
  98. package/.babelrc +0 -21
  99. package/.eslintignore +0 -10
  100. package/.eslintrc.js +0 -39
  101. package/InterfaceTemplate/__utils.ts +0 -61
  102. package/InterfaceTemplate/index.playwright.ts +0 -6
  103. package/WebTemplate.zip +0 -0
  104. package/dist/commands/api/run.d.ts +0 -6
  105. package/dist/commands/api/run.js +0 -119
  106. package/dist/commands/auth-sessions/load.d.ts +0 -2
  107. package/dist/commands/auth-sessions/load.js +0 -35
  108. package/dist/commands/auth-sessions/run-check.d.ts +0 -2
  109. package/dist/commands/auth-sessions/run-check.js +0 -74
  110. package/dist/commands/auth-sessions/run-create.d.ts +0 -2
  111. package/dist/commands/auth-sessions/run-create.js +0 -78
  112. package/dist/commands/browser/save-state.d.ts +0 -2
  113. package/dist/commands/browser/save-state.js +0 -17
  114. package/dist/commands/browser/start-browser.d.ts +0 -2
  115. package/dist/commands/browser/start-browser.js +0 -14
  116. package/dist/commands/build.d.ts +0 -1
  117. package/dist/commands/build.js +0 -84
  118. package/dist/commands/common/browserUtils.d.ts +0 -14
  119. package/dist/commands/common/browserUtils.js +0 -58
  120. package/dist/commands/common/getFirstLineNumber.d.ts +0 -9
  121. package/dist/commands/common/getFirstLineNumber.js +0 -101
  122. package/dist/commands/common/getFirstLineNumber.test.js +0 -228
  123. package/dist/commands/common/projectExclusions.d.ts +0 -2
  124. package/dist/commands/common/projectExclusions.js +0 -8
  125. package/dist/commands/common/sendMessageToClient.d.ts +0 -1
  126. package/dist/commands/common/sendMessageToClient.js +0 -10
  127. package/dist/commands/common/tsNodeImport.d.ts +0 -2
  128. package/dist/commands/common/tsNodeImport.js +0 -43
  129. package/dist/commands/common/utils/fileUtils.d.ts +0 -6
  130. package/dist/commands/common/utils/fileUtils.js +0 -33
  131. package/dist/commands/common/utils/settings.d.ts +0 -2
  132. package/dist/commands/common/utils/settings.js +0 -31
  133. package/dist/commands/common/utils/template.d.ts +0 -2
  134. package/dist/commands/common/utils/template.js +0 -31
  135. package/dist/commands/common/utils/unixSocket.d.ts +0 -23
  136. package/dist/commands/common/utils/unixSocket.js +0 -87
  137. package/dist/commands/get-headless-user-agent.d.ts +0 -1
  138. package/dist/commands/get-headless-user-agent.js +0 -18
  139. package/dist/commands/intuned-cli/commands/attempt.command.d.ts +0 -1
  140. package/dist/commands/intuned-cli/commands/attempt.command.js +0 -8
  141. package/dist/commands/intuned-cli/commands/attempt_api.command.d.ts +0 -1
  142. package/dist/commands/intuned-cli/commands/attempt_api.command.js +0 -30
  143. package/dist/commands/intuned-cli/commands/attempt_authsession.command.d.ts +0 -1
  144. package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +0 -8
  145. package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.d.ts +0 -1
  146. package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +0 -19
  147. package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.d.ts +0 -1
  148. package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +0 -24
  149. package/dist/commands/intuned-cli/commands/authsession.command.d.ts +0 -1
  150. package/dist/commands/intuned-cli/commands/authsession.command.js +0 -8
  151. package/dist/commands/intuned-cli/commands/authsession_record.command.d.ts +0 -1
  152. package/dist/commands/intuned-cli/commands/authsession_record.command.js +0 -32
  153. package/dist/commands/intuned-cli/commands/authsession_scaffold.command.d.ts +0 -1
  154. package/dist/commands/intuned-cli/commands/authsession_scaffold.command.js +0 -16
  155. package/dist/commands/intuned-cli/commands/build.command.d.ts +0 -1
  156. package/dist/commands/intuned-cli/commands/build.command.js +0 -12
  157. package/dist/commands/intuned-cli/commands/command.d.ts +0 -2
  158. package/dist/commands/intuned-cli/commands/command.js +0 -9
  159. package/dist/commands/intuned-cli/commands/deploy.command.d.ts +0 -1
  160. package/dist/commands/intuned-cli/commands/deploy.command.js +0 -42
  161. package/dist/commands/intuned-cli/commands/index.d.ts +0 -18
  162. package/dist/commands/intuned-cli/commands/index.js +0 -203
  163. package/dist/commands/intuned-cli/commands/provision.command.d.ts +0 -13
  164. package/dist/commands/intuned-cli/commands/provision.command.js +0 -50
  165. package/dist/commands/intuned-cli/commands/run.command.d.ts +0 -1
  166. package/dist/commands/intuned-cli/commands/run.command.js +0 -8
  167. package/dist/commands/intuned-cli/commands/run_api.command.d.ts +0 -1
  168. package/dist/commands/intuned-cli/commands/run_api.command.js +0 -46
  169. package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +0 -31
  170. package/dist/commands/intuned-cli/commands/run_authsession.command.js +0 -17
  171. package/dist/commands/intuned-cli/commands/run_authsession_create.command.d.ts +0 -1
  172. package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +0 -35
  173. package/dist/commands/intuned-cli/commands/run_authsession_update.command.d.ts +0 -1
  174. package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +0 -35
  175. package/dist/commands/intuned-cli/commands/run_authsession_validate.command.d.ts +0 -1
  176. package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +0 -33
  177. package/dist/commands/intuned-cli/commands/types.d.ts +0 -35
  178. package/dist/commands/intuned-cli/commands/types.js +0 -31
  179. package/dist/commands/intuned-cli/constants/index.d.ts +0 -17
  180. package/dist/commands/intuned-cli/constants/index.js +0 -25
  181. package/dist/commands/intuned-cli/controller/__test__/api.test.js +0 -398
  182. package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +0 -1060
  183. package/dist/commands/intuned-cli/controller/api.d.ts +0 -42
  184. package/dist/commands/intuned-cli/controller/api.js +0 -194
  185. package/dist/commands/intuned-cli/controller/authSession.d.ts +0 -209
  186. package/dist/commands/intuned-cli/controller/authSession.js +0 -424
  187. package/dist/commands/intuned-cli/controller/build.d.ts +0 -1
  188. package/dist/commands/intuned-cli/controller/build.js +0 -36
  189. package/dist/commands/intuned-cli/controller/deploy.d.ts +0 -5
  190. package/dist/commands/intuned-cli/controller/deploy.js +0 -318
  191. package/dist/commands/intuned-cli/controller/index.d.ts +0 -1
  192. package/dist/commands/intuned-cli/controller/index.js +0 -46
  193. package/dist/commands/intuned-cli/controller/provision.d.ts +0 -21
  194. package/dist/commands/intuned-cli/controller/provision.js +0 -300
  195. package/dist/commands/intuned-cli/controller/scaffold.d.ts +0 -1
  196. package/dist/commands/intuned-cli/controller/scaffold.js +0 -77
  197. package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +0 -115
  198. package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +0 -41
  199. package/dist/commands/intuned-cli/helpers/api.d.ts +0 -3
  200. package/dist/commands/intuned-cli/helpers/api.js +0 -16
  201. package/dist/commands/intuned-cli/helpers/auth.d.ts +0 -46
  202. package/dist/commands/intuned-cli/helpers/auth.js +0 -147
  203. package/dist/commands/intuned-cli/helpers/backend.d.ts +0 -8
  204. package/dist/commands/intuned-cli/helpers/backend.js +0 -35
  205. package/dist/commands/intuned-cli/helpers/browser.d.ts +0 -15
  206. package/dist/commands/intuned-cli/helpers/browser.js +0 -64
  207. package/dist/commands/intuned-cli/helpers/context.d.ts +0 -3
  208. package/dist/commands/intuned-cli/helpers/context.js +0 -33
  209. package/dist/commands/intuned-cli/helpers/errors.d.ts +0 -16
  210. package/dist/commands/intuned-cli/helpers/errors.js +0 -44
  211. package/dist/commands/intuned-cli/helpers/index.d.ts +0 -12
  212. package/dist/commands/intuned-cli/helpers/index.js +0 -137
  213. package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +0 -39
  214. package/dist/commands/intuned-cli/helpers/intunedJson.js +0 -20
  215. package/dist/commands/intuned-cli/helpers/prompts.d.ts +0 -3
  216. package/dist/commands/intuned-cli/helpers/prompts.js +0 -71
  217. package/dist/commands/intuned-cli/helpers/proxy.d.ts +0 -5
  218. package/dist/commands/intuned-cli/helpers/proxy.js +0 -23
  219. package/dist/commands/intuned-cli/helpers/terminal.d.ts +0 -5
  220. package/dist/commands/intuned-cli/helpers/terminal.js +0 -13
  221. package/dist/commands/intuned-cli/helpers/timeout.d.ts +0 -1
  222. package/dist/commands/intuned-cli/helpers/timeout.js +0 -23
  223. package/dist/commands/intuned-cli/helpers/traces.d.ts +0 -2
  224. package/dist/commands/intuned-cli/helpers/traces.js +0 -32
  225. package/dist/commands/intuned-cli/helpers/validation.d.ts +0 -2
  226. package/dist/commands/intuned-cli/helpers/validation.js +0 -14
  227. package/dist/commands/intuned-cli/helpers/wrapper.d.ts +0 -2
  228. package/dist/commands/intuned-cli/helpers/wrapper.js +0 -76
  229. package/dist/commands/intuned-cli/index.d.ts +0 -1
  230. package/dist/commands/intuned-cli/index.js +0 -16
  231. package/dist/commands/intuned-cli/main.d.ts +0 -1
  232. package/dist/commands/intuned-cli/main.js +0 -36
  233. package/dist/commands/intuned-cli/types.d.ts +0 -70
  234. package/dist/commands/intuned-cli/types.js +0 -22
  235. package/dist/commands/ts-check.d.ts +0 -2
  236. package/dist/commands/ts-check.js +0 -56
  237. package/dist/common/Logger/Logger/index.d.ts +0 -12
  238. package/dist/common/Logger/Logger/index.js +0 -60
  239. package/dist/common/Logger/Logger/types.d.ts +0 -8
  240. package/dist/common/Logger/Logger/types.js +0 -5
  241. package/dist/common/Logger/index.d.ts +0 -12
  242. package/dist/common/Logger/index.js +0 -60
  243. package/dist/common/Logger/types.d.ts +0 -8
  244. package/dist/common/Logger/types.js +0 -5
  245. package/dist/common/backendFunctions/getAuthSessionParameters.d.ts +0 -1
  246. package/dist/common/backendFunctions/getAuthSessionParameters.js +0 -38
  247. package/dist/common/extension/extensionsHelpers.d.ts +0 -11
  248. package/dist/common/extension/extensionsHelpers.js +0 -147
  249. package/dist/common/extension/intunedExtensionServer.d.ts +0 -24
  250. package/dist/common/extension/intunedExtensionServer.js +0 -178
  251. package/dist/common/extension/types.d.ts +0 -212
  252. package/dist/common/extension/types.js +0 -51
  253. package/dist/common/formatZodError.d.ts +0 -2
  254. package/dist/common/intunedJson.d.ts +0 -229
  255. package/dist/common/intunedJson.js +0 -133
  256. package/dist/common/launchBrowser.d.ts +0 -33
  257. package/dist/common/launchBrowser.js +0 -235
  258. package/dist/common/playwrightContext.d.ts +0 -31
  259. package/dist/common/playwrightContext.js +0 -150
  260. package/dist/common/runApi/errors.d.ts +0 -72
  261. package/dist/common/runApi/errors.js +0 -169
  262. package/dist/common/runApi/importUsingImportFunction.d.ts +0 -9
  263. package/dist/common/runApi/importUsingImportFunction.js +0 -46
  264. package/dist/common/runApi/types.d.ts +0 -830
  265. package/dist/common/runApi/types.js +0 -73
  266. package/dist/common/setupContextHook.d.ts +0 -17
  267. package/dist/common/setupContextHook.js +0 -22
  268. package/dist/runtime/RunError.d.ts +0 -5
  269. package/dist/runtime/RunError.js +0 -19
  270. package/dist/runtime/attemptStore.d.ts +0 -2
  271. package/dist/runtime/attemptStore.js +0 -23
  272. package/dist/runtime/captcha.d.ts +0 -15
  273. package/dist/runtime/captcha.js +0 -191
  274. package/dist/runtime/captcha.test.js +0 -821
  275. package/dist/runtime/downloadDirectory.d.ts +0 -1
  276. package/dist/runtime/downloadDirectory.js +0 -19
  277. package/dist/runtime/enums.d.js +0 -5
  278. package/dist/runtime/enums.d.ts +0 -11
  279. package/dist/runtime/enums.js +0 -18
  280. package/dist/runtime/executionHelpers.test.js +0 -52
  281. package/dist/runtime/export.d.js +0 -5
  282. package/dist/runtime/export.d.ts +0 -284
  283. package/dist/runtime/extendPayload.d.ts +0 -2
  284. package/dist/runtime/extendPayload.js +0 -21
  285. package/dist/runtime/extendTimeout.d.ts +0 -1
  286. package/dist/runtime/extendTimeout.js +0 -23
  287. package/dist/runtime/getAiGatewayConfig.d.ts +0 -10
  288. package/dist/runtime/getAiGatewayConfig.js +0 -16
  289. package/dist/runtime/getAuthSessionParameters.d.ts +0 -1
  290. package/dist/runtime/getAuthSessionParameters.js +0 -20
  291. package/dist/runtime/persistentStore.d.ts +0 -2
  292. package/dist/runtime/persistentStore.js +0 -37
  293. package/dist/runtime/persistentStore.test.js +0 -101
  294. package/dist/runtime/runInfo.d.ts +0 -2
  295. package/dist/runtime/runInfo.js +0 -21
  296. package/template.tsconfig.json +0 -11
  297. package/tsconfig.eslint.json +0 -5
  298. package/tsconfig.json +0 -25
  299. package/typedoc.json +0 -49
  300. /package/dist/common/assets/{browser_scripts.js → assets/browser_scripts.js} +0 -0
@@ -1,77 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.scaffoldAuthSessionFiles = scaffoldAuthSessionFiles;
7
- var _zod = require("zod");
8
- var _helpers = require("../helpers");
9
- var _types = require("../types");
10
- var _tsNodeImport = require("../../common/tsNodeImport");
11
- var _constants = require("../../../common/constants");
12
- var _fsExtra = require("fs-extra");
13
- var _path = _interopRequireDefault(require("path"));
14
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- const authSessionTemplateResponseSchema = _zod.z.object({
16
- "auth-sessions": _types.fileSystemTreeSchema
17
- });
18
- async function scaffoldAuthSessionFiles() {
19
- const [createResult, checkResult] = await Promise.all([(0, _tsNodeImport.tsNodeImport)(`${_constants.AUTH_SESSIONS_FOLDER_NAME}/create`), (0, _tsNodeImport.tsNodeImport)(`${_constants.AUTH_SESSIONS_FOLDER_NAME}/check`)]);
20
- const createExists = createResult.isOk() || createResult.error.type !== "not_found";
21
- const checkExists = checkResult.isOk() || checkResult.error.type !== "not_found";
22
- if (createExists && checkExists) {
23
- (0, _helpers.terminal)("^g^+AuthSession files already exist^:\n");
24
- return;
25
- }
26
- (0, _helpers.terminal)("^g^+Scaffolding...^:\n");
27
- const authSessionTemplateUrl = new URL("/api/v1/templates/authsession", (0, _helpers.getBaseUrl)());
28
- authSessionTemplateUrl.searchParams.append("language", "typescript");
29
- const response = await fetch(authSessionTemplateUrl.toString(), {
30
- method: "GET"
31
- });
32
- const text = await response.text();
33
- if (!response.ok) {
34
- throw new Error(`Failed to fetch AuthSession template
35
- Got ${response.status} ${response.statusText}
36
- ${text}`);
37
- }
38
- let json;
39
- try {
40
- json = JSON.parse(text);
41
- } catch (e) {
42
- throw new Error(`Failed to parse AuthSession template response as JSON
43
- ${text}`);
44
- }
45
- const parseResult = authSessionTemplateResponseSchema.safeParse(json);
46
- if (!parseResult.success) {
47
- throw new Error(`AuthSession template response has invalid shape: ${JSON.stringify(parseResult.error.errors, null, 2)}`);
48
- }
49
- const authSessionsContent = parseResult.data["auth-sessions"];
50
- const cwd = process.cwd();
51
- const exists = {
52
- create: createExists,
53
- check: checkExists
54
- };
55
- await (0, _fsExtra.ensureDir)(_path.default.join(cwd, _constants.AUTH_SESSIONS_FOLDER_NAME));
56
- for (const api in exists) {
57
- if (exists[api]) {
58
- continue;
59
- }
60
- const [name, node] = Object.entries(authSessionsContent).find(entry => "file" in entry[1] && entry[0].replace(/\.[^/.]+$/, "") === api) ?? [undefined, undefined];
61
- if (!name || !node) {
62
- continue;
63
- }
64
- const {
65
- file: {
66
- contents
67
- }
68
- } = node;
69
- if (typeof contents !== "string") {
70
- continue;
71
- }
72
- await (0, _fsExtra.writeFile)(_path.default.join(cwd, _constants.AUTH_SESSIONS_FOLDER_NAME, name), contents, {
73
- encoding: "utf-8"
74
- });
75
- (0, _helpers.terminal)(`^g^+Written ^_${_path.default.join(_constants.AUTH_SESSIONS_FOLDER_NAME, name)}^:\n`);
76
- }
77
- }
@@ -1,115 +0,0 @@
1
- "use strict";
2
-
3
- var _vitest = require("vitest");
4
- var _browser = require("../browser");
5
- var _launchBrowser = require("../../../../common/launchBrowser");
6
- function getTerminal() {
7
- return new Proxy(() => ({}), {
8
- get: () => getTerminal(),
9
- apply: () => ({})
10
- });
11
- }
12
- _vitest.vi.mock("fs-extra", () => ({
13
- ensureDir: _vitest.vi.fn(),
14
- exists: _vitest.vi.fn().mockResolvedValue(true)
15
- }));
16
- _vitest.vi.mock("portfinder", () => ({
17
- getPort: _vitest.vi.fn().mockResolvedValue(1234)
18
- }));
19
- _vitest.vi.mock("../../../../common/launchBrowser", () => ({
20
- launchChromium: _vitest.vi.fn().mockImplementation(async () => ({
21
- context: {
22
- close: _vitest.vi.fn().mockResolvedValue(undefined)
23
- },
24
- page: {}
25
- }))
26
- }));
27
- _vitest.vi.mock("../../helpers/terminal", () => ({
28
- terminal: getTerminal()
29
- }));
30
- _vitest.vi.mock("../../helpers/proxy", () => {
31
- return {
32
- parseUrlProxy: _vitest.vi.fn(v => v)
33
- };
34
- });
35
- _vitest.vi.mock("../../helpers", async importOriginal => {
36
- const original = await importOriginal();
37
- return {
38
- ...original,
39
- terminal: getTerminal()
40
- };
41
- });
42
- (0, _vitest.describe)("Browser CLI options", () => {
43
- (0, _vitest.it)("returns cdp options if cdpUrl is set", async () => {
44
- const options = await (0, _browser.getCLIRunOptions)({
45
- keepBrowserOpen: true,
46
- headless: true,
47
- cdpUrl: "cdp_url"
48
- });
49
- (0, _vitest.expect)(options).toEqual(_vitest.expect.objectContaining({
50
- environment: "cdp",
51
- cdpAddress: "cdp_url"
52
- }));
53
- });
54
- (0, _vitest.it)("returns standalone options if keepBrowserOpen is not set", async () => {
55
- const options = await (0, _browser.getCLIRunOptions)({
56
- keepBrowserOpen: false,
57
- headless: false
58
- });
59
- (0, _vitest.expect)(options).toEqual(_vitest.expect.objectContaining({
60
- environment: "standalone",
61
- headless: false
62
- }));
63
- });
64
- (0, _vitest.describe)("when keepBrowserOpen is set", () => {
65
- beforeEach(async () => {
66
- _vitest.vi.clearAllMocks();
67
- await (0, _browser.closeCliBrowser)();
68
- });
69
- (0, _vitest.it)("launches a browser with correct parameters and returns cdp options", async () => {
70
- const options = await (0, _browser.getCLIRunOptions)({
71
- keepBrowserOpen: true,
72
- headless: false,
73
- proxy: "proxy"
74
- });
75
- (0, _vitest.expect)(_launchBrowser.launchChromium).toHaveBeenCalledWith({
76
- headless: false,
77
- cdpPort: 1234,
78
- proxy: "proxy"
79
- });
80
- (0, _vitest.expect)(options).toEqual(_vitest.expect.objectContaining({
81
- environment: "cdp",
82
- cdpAddress: "http://localhost:1234"
83
- }));
84
- });
85
- (0, _vitest.it)("keeps context open until new context", async () => {
86
- await (0, _browser.getCLIRunOptions)({
87
- keepBrowserOpen: true,
88
- headless: false,
89
- proxy: "proxy"
90
- });
91
- const firstContext = (0, _browser._getContextForTest)();
92
- (0, _vitest.expect)(firstContext).not.toBeNull();
93
- (0, _vitest.expect)(_launchBrowser.launchChromium).toHaveBeenCalledTimes(1);
94
- await (0, _browser.getCLIRunOptions)({
95
- keepBrowserOpen: true,
96
- headless: false,
97
- proxy: "proxy"
98
- });
99
- const secondContext = (0, _browser._getContextForTest)();
100
- (0, _vitest.expect)(secondContext).not.toBeNull();
101
- (0, _vitest.expect)(firstContext).not.toBe(secondContext);
102
- (0, _vitest.expect)(_launchBrowser.launchChromium).toHaveBeenCalledTimes(2);
103
- });
104
- (0, _vitest.it)("keeps context open until explicitly closed", async () => {
105
- await (0, _browser.getCLIRunOptions)({
106
- keepBrowserOpen: true,
107
- headless: false,
108
- proxy: "proxy"
109
- });
110
- (0, _vitest.expect)((0, _browser._getContextForTest)()).not.toBeNull();
111
- await (0, _browser.closeCliBrowser)();
112
- (0, _vitest.expect)((0, _browser._getContextForTest)()).toBeNull();
113
- });
114
- });
115
- });
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- var _vitest = require("vitest");
4
- var _ = require("..");
5
- function getTerminal() {
6
- return new Proxy(() => ({}), {
7
- get: () => getTerminal(),
8
- apply: () => ({})
9
- });
10
- }
11
- _vitest.vi.mock("fs-extra", () => ({
12
- ensureDir: _vitest.vi.fn(),
13
- exists: _vitest.vi.fn().mockResolvedValue(true)
14
- }));
15
- _vitest.vi.mock("../../helpers/terminal", () => ({
16
- terminal: getTerminal()
17
- }));
18
- _vitest.vi.mock("../../helpers", async importOriginal => {
19
- const original = await importOriginal();
20
- return {
21
- ...original,
22
- terminal: getTerminal()
23
- };
24
- });
25
- (0, _vitest.describe)("Tracing wrapper", () => {
26
- (0, _vitest.it)("calls wrapped function with disabled tracing when id is undefined", async () => {
27
- const fn = _vitest.vi.fn();
28
- await (0, _.withCLITrace)(fn, undefined);
29
- (0, _vitest.expect)(fn).toHaveBeenCalledWith({
30
- enabled: false
31
- });
32
- });
33
- (0, _vitest.it)("calls wrapped function with enabled tracing when id is defined", async () => {
34
- const fn = _vitest.vi.fn();
35
- await (0, _.withCLITrace)(fn, "trace-id");
36
- (0, _vitest.expect)(fn).toHaveBeenCalledWith({
37
- enabled: true,
38
- filePath: _vitest.expect.stringContaining("trace-id")
39
- });
40
- });
41
- });
@@ -1,3 +0,0 @@
1
- import { API_FOLDER_NAME, AUTH_SESSIONS_FOLDER_NAME } from "../../../common/constants";
2
- export declare function assertApiFileExists(dirname: typeof AUTH_SESSIONS_FOLDER_NAME, api: "create" | "check"): Promise<void>;
3
- export declare function assertApiFileExists(dirname: typeof API_FOLDER_NAME, api: string): Promise<void>;
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.assertApiFileExists = assertApiFileExists;
7
- var _errors = require("./errors");
8
- var _tsNodeImport = require("../../common/tsNodeImport");
9
- async function assertApiFileExists(dirname, api) {
10
- const result = await (0, _tsNodeImport.tsNodeImport)(`${dirname}/${api}`);
11
- if (result.isErr() && result.error.type === "not_found") {
12
- throw new _errors.CLIAssertionError(`^+^r API^ ^+${dirname}/${api}^ ^r^+does not exist. Make sure to use an existing API name.^:`, {
13
- autoColor: false
14
- });
15
- }
16
- }
@@ -1,46 +0,0 @@
1
- import type { AuthSessionMetadata } from "../types";
2
- import { RunApiStorageState as StorageState } from "../../../common/runApi";
3
- export declare function isAuthEnabled(): Promise<boolean>;
4
- export declare function assertAuthEnabled(): Promise<void>;
5
- export declare function assertAuthConsistent(authSession: string | undefined): Promise<void>;
6
- export declare function loadAuthSessionInstance(authSessionId: string): Promise<{
7
- storageState: {
8
- cookies: {
9
- path: string;
10
- value: string;
11
- domain: string;
12
- name: string;
13
- expires: number;
14
- httpOnly: boolean;
15
- secure: boolean;
16
- sameSite: "Strict" | "Lax" | "None";
17
- }[];
18
- origins: {
19
- origin: string;
20
- localStorage: {
21
- value: string;
22
- name: string;
23
- }[];
24
- }[];
25
- sessionStorage?: {
26
- origin: string;
27
- sessionStorage: {
28
- value: string;
29
- name: string;
30
- }[];
31
- }[] | undefined;
32
- };
33
- metadata: AuthSessionMetadata;
34
- }>;
35
- export declare function storeAuthSessionInstance({ state, id, input, proxy, metadata, }: {
36
- state: StorageState;
37
- id: string;
38
- input?: Record<string, any>;
39
- proxy?: string;
40
- metadata?: AuthSessionMetadata;
41
- }): Promise<string>;
42
- export declare function registerGetAuthSessionParameters(authSessionId?: string): void;
43
- export declare function getAuthSessionRecorderParameters(): Promise<{
44
- startUrl: string;
45
- finishUrl: string;
46
- }>;
@@ -1,147 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.assertAuthConsistent = assertAuthConsistent;
7
- exports.assertAuthEnabled = assertAuthEnabled;
8
- exports.getAuthSessionRecorderParameters = getAuthSessionRecorderParameters;
9
- exports.isAuthEnabled = isAuthEnabled;
10
- exports.loadAuthSessionInstance = loadAuthSessionInstance;
11
- exports.registerGetAuthSessionParameters = registerGetAuthSessionParameters;
12
- exports.storeAuthSessionInstance = storeAuthSessionInstance;
13
- var _constants = require("../../../common/constants");
14
- var _path = _interopRequireDefault(require("path"));
15
- var _fsExtra = require("fs-extra");
16
- var _intunedJson = require("./intunedJson");
17
- var _errors = require("./errors");
18
- var _runApi = require("../../../common/runApi");
19
- var _formatZodError = require("../../../common/formatZodError");
20
- var _asyncLocalStorage = require("../../../common/asyncLocalStorage");
21
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
- async function isAuthEnabled() {
23
- const intunedJson = await (0, _intunedJson.loadIntunedJson)();
24
- return Boolean(intunedJson?.authSessions?.enabled);
25
- }
26
- async function assertAuthEnabled() {
27
- if (!(await isAuthEnabled())) {
28
- throw new _errors.CLIAssertionError(await getAuthNotEnabledErrorMessage());
29
- }
30
- }
31
- async function assertAuthConsistent(authSession) {
32
- const _isAuthEnabled = await isAuthEnabled();
33
- if (_isAuthEnabled && !authSession) {
34
- throw new _errors.CLIAssertionError("AuthSession is enabled, but no AuthSession is provided. Please provide an AuthSession using '--auth-session <id>' option.");
35
- }
36
- if (!_isAuthEnabled && authSession) {
37
- throw new _errors.CLIAssertionError(await getAuthNotEnabledErrorMessage());
38
- }
39
- }
40
- async function loadAuthSessionInstance(authSessionId) {
41
- try {
42
- const authSessionInstancePath = _path.default.join(process.cwd(), _constants.AUTH_SESSIONS_INSTANCES_FOLDER_NAME, authSessionId);
43
- const authSessionInstanceStoragePath = _path.default.join(authSessionInstancePath, `auth-session.json`);
44
- const authSessionInstanceMetadataPath = _path.default.join(authSessionInstancePath, `metadata.json`);
45
- if (!(await (0, _fsExtra.exists)(authSessionInstanceStoragePath))) {
46
- throw new _errors.CLIError(`AuthSession instance with ID ${authSessionId} not found. Make sure the ID is correct.`);
47
- }
48
- const authSessionInstanceJson = await (0, _fsExtra.readJSON)(authSessionInstanceStoragePath);
49
- const authSessionInstanceParseResult = _runApi.runApiStorageStateSchema.safeParse(authSessionInstanceJson);
50
- if (!authSessionInstanceParseResult.success) {
51
- throw new _errors.CLIError(`AuthSession instance with ID ${authSessionId} is not valid: ${(0, _formatZodError.formatZodError)(authSessionInstanceParseResult.error)}`);
52
- }
53
- const metadata = await (0, _fsExtra.readJSON)(authSessionInstanceMetadataPath);
54
- return {
55
- storageState: authSessionInstanceParseResult.data,
56
- metadata
57
- };
58
- } catch (error) {
59
- throw new _errors.CLIError(`Error loading AuthSession instance: ${error.message}`);
60
- }
61
- }
62
- async function storeAuthSessionInstance({
63
- state,
64
- id,
65
- input,
66
- proxy,
67
- metadata
68
- }) {
69
- try {
70
- const authSessionsDirectoryPath = _path.default.join(process.cwd(), _constants.AUTH_SESSIONS_INSTANCES_FOLDER_NAME);
71
- await (0, _fsExtra.ensureDir)(authSessionsDirectoryPath);
72
- const authSessionInstancePath = _path.default.join(authSessionsDirectoryPath, id);
73
- await (0, _fsExtra.ensureDir)(authSessionInstancePath);
74
- const authSessionInstanceStoragePath = _path.default.join(authSessionInstancePath, `auth-session.json`);
75
- await (0, _fsExtra.writeJSON)(authSessionInstanceStoragePath, state, {
76
- spaces: 2
77
- });
78
- const projectAuthConfig = (await (0, _intunedJson.loadIntunedJson)()).authSessions;
79
- if (!projectAuthConfig.enabled) {
80
- throw new _errors.CLIError(`AuthSessions are not enabled in ${await (0, _intunedJson.getIntunedSettingsFileName)()}. Make sure they are enabled.`);
81
- }
82
- const authSessionInstanceMetadataPath = _path.default.join(authSessionInstancePath, `metadata.json`);
83
- const authSessionMetadata = {
84
- createdAt: metadata?.createdAt ?? new Date().toISOString(),
85
- updatedAt: new Date().toISOString(),
86
- ...(projectAuthConfig.type === "API" && {
87
- authSessionInput: input || metadata?.authSessionInput || {}
88
- }),
89
- authSessionId: id,
90
- authSessionType: projectAuthConfig.type ?? metadata?.authSessionType ?? "API",
91
- ...(projectAuthConfig.type === "MANUAL" && {
92
- recorderStartUrl: projectAuthConfig.startUrl,
93
- recorderEndUrl: projectAuthConfig.finishUrl
94
- }),
95
- authSessionInput: input || metadata?.authSessionInput || {},
96
- authSessionProxy: proxy || metadata?.authSessionProxy
97
- };
98
- await (0, _fsExtra.writeJSON)(authSessionInstanceMetadataPath, authSessionMetadata, {
99
- spaces: 2
100
- });
101
- return authSessionInstancePath;
102
- } catch (error) {
103
- throw new _errors.CLIError(`Error storing AuthSession instance: ${error.message}`);
104
- }
105
- }
106
- function registerGetAuthSessionParameters(authSessionId) {
107
- async function getAuthSessionParameters() {
108
- if (!authSessionId) {
109
- throw new Error("getAuthSessionParameters cannot be called without using an AuthSession");
110
- }
111
- const {
112
- metadata
113
- } = await loadAuthSessionInstance(authSessionId);
114
- if (metadata?.authSessionType === "MANUAL") {
115
- throw new Error("AuthSession is recorder-based, it does not have parameters.");
116
- }
117
- return metadata?.authSessionInput ?? {};
118
- }
119
- (0, _asyncLocalStorage.getExecutionContext)().getAuthSessionParameters = getAuthSessionParameters;
120
- }
121
- async function getAuthSessionRecorderParameters() {
122
- const intunedJson = await (0, _intunedJson.loadIntunedJson)();
123
- if (!intunedJson.authSessions.enabled) {
124
- throw new _errors.CLIError(`AuthSessions are not enabled in ${await (0, _intunedJson.getIntunedSettingsFileName)()}. Make sure they are enabled.`);
125
- }
126
- if (intunedJson.authSessions.type !== "MANUAL") {
127
- throw new _errors.CLIError(`AuthSession type is not recorder-based in ${await (0, _intunedJson.getIntunedSettingsFileName)()}.
128
- Make sure the AuthSession type is set to 'MANUAL'
129
- For more details, check out https://docs.intunedhq.com/docs/05-references/intuned-json#configuration-properties.`);
130
- }
131
- const {
132
- startUrl,
133
- finishUrl
134
- } = intunedJson.authSessions;
135
- if (startUrl === undefined || finishUrl === undefined) {
136
- throw new _errors.CLIError(`AuthSession type is recorder-based but start_url or finish_url is not set in ${await (0, _intunedJson.getIntunedSettingsFileName)()}.
137
- Please set both values to use recorder-based AuthSessions.
138
- For more details, check out https://docs.intunedhq.com/docs/05-references/intuned-json#configuration-properties`);
139
- }
140
- return {
141
- startUrl,
142
- finishUrl
143
- };
144
- }
145
- async function getAuthNotEnabledErrorMessage() {
146
- return "AuthSessions are not enabled.\n" + `Enable AuthSessions in ${await (0, _intunedJson.getIntunedSettingsFileName)()} to use this feature.\n` + "See https://docs.intunedhq.com/docs/02-features/auth-sessions#1-enable-authsessions-for-your-project for more information.";
147
- }
@@ -1,8 +0,0 @@
1
- export declare function getAuthCredentials(options: {
2
- workspaceId?: string;
3
- apiKey?: string;
4
- }): Promise<{
5
- workspaceId: string;
6
- apiKey: string;
7
- }>;
8
- export declare function getBaseUrl(): string;
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getAuthCredentials = getAuthCredentials;
7
- exports.getBaseUrl = getBaseUrl;
8
- var _constants = require("../../../common/constants");
9
- var _errors = require("./errors");
10
- var _intunedJson = require("./intunedJson");
11
- var _prompts = require("./prompts");
12
- async function getAuthCredentials(options) {
13
- const settings = await (0, _intunedJson.loadIntunedJson)();
14
- let workspaceId = options.workspaceId || settings.workspaceId || process.env[_constants.WORKSPACE_ID_ENV_VAR_KEY];
15
- let apiKey = options.apiKey || process.env[_constants.API_KEY_ENV_VAR_KEY];
16
- if (!workspaceId) {
17
- workspaceId = await (0, _prompts.promptForWorkspaceId)();
18
- }
19
- if (!workspaceId) {
20
- throw new _errors.CLIError(`Workspace ID is required. Please provide it via command line options or ${await (0, _intunedJson.getIntunedSettingsFileName)()}.\n` + `Expected format: UUID (e.g., 123e4567-e89b-12d3-a456-426614174000)\n` + `Find your workspace ID at: https://app.intuned.io/settings/api-keys`);
21
- }
22
- if (!apiKey) {
23
- apiKey = await (0, _prompts.promptForApiKey)();
24
- }
25
- if (!apiKey) {
26
- throw new _errors.CLIError(`API key is required. Please provide it via command line options or ${_constants.API_KEY_ENV_VAR_KEY} environment variable.\n` + `Get your API key at: https://app.intuned.io/settings/api-keys`);
27
- }
28
- return {
29
- workspaceId,
30
- apiKey
31
- };
32
- }
33
- function getBaseUrl() {
34
- return new URL(process.env[_constants.API_BASE_URL_ENV_VAR_KEY] || process.env.INTUNED_API_DOMAIN || `https://app.intuned.io`).origin;
35
- }
@@ -1,15 +0,0 @@
1
- import type { BrowserContext } from "playwright";
2
- import type { runApiParametersSchema } from "../../../common/runApi";
3
- import { z } from "zod";
4
- declare let context: BrowserContext | null;
5
- export declare function _getContextForTest(): typeof context;
6
- type RunApiRunOptions = z.infer<typeof runApiParametersSchema>["runOptions"];
7
- export declare function getCLIRunOptions({ headless, proxy, keepBrowserOpen, cdpUrl, }: {
8
- headless: boolean;
9
- proxy?: string;
10
- keepBrowserOpen: boolean;
11
- cdpUrl?: string;
12
- }): Promise<RunApiRunOptions>;
13
- export declare function isCliBrowserLaunched(): boolean;
14
- export declare function closeCliBrowser(): Promise<void>;
15
- export {};
@@ -1,64 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports._getContextForTest = _getContextForTest;
7
- exports.closeCliBrowser = closeCliBrowser;
8
- exports.getCLIRunOptions = getCLIRunOptions;
9
- exports.isCliBrowserLaunched = isCliBrowserLaunched;
10
- var _launchBrowser = require("../../../common/launchBrowser");
11
- var _portfinder = require("portfinder");
12
- var _proxy = require("./proxy");
13
- let context = null;
14
- function _getContextForTest() {
15
- if (process.env.NODE_ENV !== "test") {
16
- throw new Error("_getContextForTest should only be used in tests");
17
- }
18
- return context;
19
- }
20
- async function getCLIRunOptions({
21
- headless,
22
- proxy,
23
- keepBrowserOpen,
24
- cdpUrl
25
- }) {
26
- if (context) {
27
- await closeCliBrowser();
28
- }
29
- if (cdpUrl) {
30
- return {
31
- environment: "cdp",
32
- cdpAddress: cdpUrl
33
- };
34
- }
35
- if (!keepBrowserOpen) {
36
- return {
37
- environment: "standalone",
38
- headless,
39
- proxy: proxy ? (0, _proxy.parseUrlProxy)(proxy) : undefined
40
- };
41
- }
42
- const port = await (0, _portfinder.getPort)({});
43
- ({
44
- context
45
- } = await (0, _launchBrowser.launchChromium)({
46
- headless,
47
- proxy: proxy ? (0, _proxy.parseUrlProxy)(proxy) : undefined,
48
- cdpPort: port
49
- }));
50
- return {
51
- environment: "cdp",
52
- cdpAddress: `http://localhost:${port}`
53
- };
54
- }
55
- function isCliBrowserLaunched() {
56
- return context !== null;
57
- }
58
- async function closeCliBrowser() {
59
- if (!context) return;
60
- try {
61
- await context.close();
62
- context = null;
63
- } catch (e) {}
64
- }
@@ -1,3 +0,0 @@
1
- export declare function withCLIContext<R>(fn: () => Promise<R>, options?: {
2
- authSessionId?: string;
3
- }): Promise<R>;
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.withCLIContext = withCLIContext;
7
- var _nanoid = require("nanoid");
8
- var _asyncLocalStorage = require("../../../common/asyncLocalStorage");
9
- var _enums = require("../../../runtime/enums");
10
- var _auth = require("./auth");
11
- async function withCLIContext(fn, options) {
12
- const runId = (0, _nanoid.nanoid)();
13
- async function getAuthSessionParameters() {
14
- const id = options?.authSessionId;
15
- if (!id) {
16
- throw new Error("getAuthSessionParameters cannot be called without using an AuthSession");
17
- }
18
- const {
19
- metadata
20
- } = await (0, _auth.loadAuthSessionInstance)(id);
21
- if (metadata?.authSessionType === "MANUAL") {
22
- throw new Error("AuthSession is recorder-based, it does not have parameters.");
23
- }
24
- return metadata?.authSessionInput ?? {};
25
- }
26
- return await (0, _asyncLocalStorage.runWithContext)({
27
- runEnvironment: _enums.RunEnvironment.IDE,
28
- runId,
29
- extendedPayloads: [],
30
- timeoutInfo: {},
31
- getAuthSessionParameters
32
- }, fn);
33
- }
@@ -1,16 +0,0 @@
1
- import { RunAutomationError } from "../../../common/runApi/errors";
2
- export declare class CLIError extends Error {
3
- autoColor: boolean;
4
- constructor(message: string, options?: {
5
- autoColor?: boolean;
6
- });
7
- }
8
- export declare class AbortedCLIError extends CLIError {
9
- constructor();
10
- }
11
- export declare class CLIAssertionError extends CLIError {
12
- constructor(message: string, options?: {
13
- autoColor?: boolean;
14
- });
15
- }
16
- export declare function logAutomationError(error: RunAutomationError): void;
@@ -1,44 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.CLIError = exports.CLIAssertionError = exports.AbortedCLIError = void 0;
7
- exports.logAutomationError = logAutomationError;
8
- var _errors = require("../../../common/runApi/errors");
9
- var _terminal = require("./terminal");
10
- class CLIError extends Error {
11
- constructor(message, options) {
12
- super(message);
13
- this.name = "CLIError";
14
- this.autoColor = options?.autoColor ?? true;
15
- }
16
- }
17
- exports.CLIError = CLIError;
18
- class AbortedCLIError extends CLIError {
19
- constructor() {
20
- super("Aborted");
21
- this.name = "AbortedCLIError";
22
- }
23
- }
24
- exports.AbortedCLIError = AbortedCLIError;
25
- class CLIAssertionError extends CLIError {
26
- constructor(message, options) {
27
- super(message, options);
28
- this.name = "CLIAssertionError";
29
- }
30
- }
31
- exports.CLIAssertionError = CLIAssertionError;
32
- function logAutomationError(error) {
33
- (0, _terminal.terminal)(`^r^+An error occurred while running the API:^:\n`);
34
- if (error instanceof _errors.AutomationError) {
35
- if (error.error.stack) {
36
- const stackLines = error.error.stack.split("\n").filter(line => !line.includes("@intuned/runtime") && !line.includes("node:"));
37
- (0, _terminal.terminal)(`^r${stackLines.join("\n")}^:\n`);
38
- } else {
39
- (0, _terminal.terminal)(`^r${error.error.message}^:\n`);
40
- }
41
- } else {
42
- (0, _terminal.terminal)(`^r${error.message}^:\n`);
43
- }
44
- }