@intuned/runtime 1.3.16 → 1.3.18-interface.6

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 (295) 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 +536 -0
  72. package/dist/common/settingsSchema.d.ts +9 -6
  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 +163 -0
  92. package/dist/runtime/index.d.ts +163 -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 +80 -23
  98. package/.babelrc +0 -21
  99. package/.eslintignore +0 -10
  100. package/.eslintrc.js +0 -39
  101. package/InterfaceTemplate/index.playwright.ts +0 -6
  102. package/InterfaceTemplate/utils.ts +0 -61
  103. package/dist/commands/api/run.d.ts +0 -6
  104. package/dist/commands/api/run.js +0 -123
  105. package/dist/commands/auth-sessions/load.d.ts +0 -2
  106. package/dist/commands/auth-sessions/load.js +0 -35
  107. package/dist/commands/auth-sessions/run-check.d.ts +0 -2
  108. package/dist/commands/auth-sessions/run-check.js +0 -74
  109. package/dist/commands/auth-sessions/run-create.d.ts +0 -2
  110. package/dist/commands/auth-sessions/run-create.js +0 -78
  111. package/dist/commands/browser/save-state.d.ts +0 -2
  112. package/dist/commands/browser/save-state.js +0 -17
  113. package/dist/commands/browser/start-browser.d.ts +0 -2
  114. package/dist/commands/browser/start-browser.js +0 -14
  115. package/dist/commands/build.d.ts +0 -1
  116. package/dist/commands/build.js +0 -84
  117. package/dist/commands/common/browserUtils.d.ts +0 -14
  118. package/dist/commands/common/browserUtils.js +0 -58
  119. package/dist/commands/common/getFirstLineNumber.d.ts +0 -9
  120. package/dist/commands/common/getFirstLineNumber.js +0 -101
  121. package/dist/commands/common/getFirstLineNumber.test.js +0 -228
  122. package/dist/commands/common/projectExclusions.d.ts +0 -2
  123. package/dist/commands/common/projectExclusions.js +0 -8
  124. package/dist/commands/common/sendMessageToClient.d.ts +0 -1
  125. package/dist/commands/common/sendMessageToClient.js +0 -10
  126. package/dist/commands/common/tsNodeImport.d.ts +0 -2
  127. package/dist/commands/common/tsNodeImport.js +0 -34
  128. package/dist/commands/common/utils/fileUtils.d.ts +0 -6
  129. package/dist/commands/common/utils/fileUtils.js +0 -33
  130. package/dist/commands/common/utils/settings.d.ts +0 -2
  131. package/dist/commands/common/utils/settings.js +0 -31
  132. package/dist/commands/common/utils/template.d.ts +0 -2
  133. package/dist/commands/common/utils/template.js +0 -31
  134. package/dist/commands/common/utils/unixSocket.d.ts +0 -23
  135. package/dist/commands/common/utils/unixSocket.js +0 -87
  136. package/dist/commands/get-headless-user-agent.d.ts +0 -1
  137. package/dist/commands/get-headless-user-agent.js +0 -18
  138. package/dist/commands/intuned-cli/commands/attempt.command.d.ts +0 -1
  139. package/dist/commands/intuned-cli/commands/attempt.command.js +0 -8
  140. package/dist/commands/intuned-cli/commands/attempt_api.command.d.ts +0 -1
  141. package/dist/commands/intuned-cli/commands/attempt_api.command.js +0 -30
  142. package/dist/commands/intuned-cli/commands/attempt_authsession.command.d.ts +0 -1
  143. package/dist/commands/intuned-cli/commands/attempt_authsession.command.js +0 -8
  144. package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.d.ts +0 -1
  145. package/dist/commands/intuned-cli/commands/attempt_authsession_check.command.js +0 -19
  146. package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.d.ts +0 -1
  147. package/dist/commands/intuned-cli/commands/attempt_authsession_create.command.js +0 -24
  148. package/dist/commands/intuned-cli/commands/authsession.command.d.ts +0 -1
  149. package/dist/commands/intuned-cli/commands/authsession.command.js +0 -8
  150. package/dist/commands/intuned-cli/commands/authsession_record.command.d.ts +0 -1
  151. package/dist/commands/intuned-cli/commands/authsession_record.command.js +0 -32
  152. package/dist/commands/intuned-cli/commands/build.command.d.ts +0 -1
  153. package/dist/commands/intuned-cli/commands/build.command.js +0 -12
  154. package/dist/commands/intuned-cli/commands/command.d.ts +0 -2
  155. package/dist/commands/intuned-cli/commands/command.js +0 -9
  156. package/dist/commands/intuned-cli/commands/deploy.command.d.ts +0 -1
  157. package/dist/commands/intuned-cli/commands/deploy.command.js +0 -38
  158. package/dist/commands/intuned-cli/commands/index.d.ts +0 -18
  159. package/dist/commands/intuned-cli/commands/index.js +0 -203
  160. package/dist/commands/intuned-cli/commands/init.command.d.ts +0 -1
  161. package/dist/commands/intuned-cli/commands/init.command.js +0 -13
  162. package/dist/commands/intuned-cli/commands/run.command.d.ts +0 -1
  163. package/dist/commands/intuned-cli/commands/run.command.js +0 -8
  164. package/dist/commands/intuned-cli/commands/run_api.command.d.ts +0 -1
  165. package/dist/commands/intuned-cli/commands/run_api.command.js +0 -46
  166. package/dist/commands/intuned-cli/commands/run_authsession.command.d.ts +0 -31
  167. package/dist/commands/intuned-cli/commands/run_authsession.command.js +0 -17
  168. package/dist/commands/intuned-cli/commands/run_authsession_create.command.d.ts +0 -1
  169. package/dist/commands/intuned-cli/commands/run_authsession_create.command.js +0 -35
  170. package/dist/commands/intuned-cli/commands/run_authsession_update.command.d.ts +0 -1
  171. package/dist/commands/intuned-cli/commands/run_authsession_update.command.js +0 -35
  172. package/dist/commands/intuned-cli/commands/run_authsession_validate.command.d.ts +0 -1
  173. package/dist/commands/intuned-cli/commands/run_authsession_validate.command.js +0 -33
  174. package/dist/commands/intuned-cli/commands/save.command.d.ts +0 -13
  175. package/dist/commands/intuned-cli/commands/save.command.js +0 -42
  176. package/dist/commands/intuned-cli/commands/types.d.ts +0 -35
  177. package/dist/commands/intuned-cli/commands/types.js +0 -31
  178. package/dist/commands/intuned-cli/constants/index.d.ts +0 -17
  179. package/dist/commands/intuned-cli/constants/index.js +0 -25
  180. package/dist/commands/intuned-cli/controller/__test__/api.test.js +0 -397
  181. package/dist/commands/intuned-cli/controller/__test__/authSession.test.js +0 -1059
  182. package/dist/commands/intuned-cli/controller/api.d.ts +0 -42
  183. package/dist/commands/intuned-cli/controller/api.js +0 -191
  184. package/dist/commands/intuned-cli/controller/authSession.d.ts +0 -209
  185. package/dist/commands/intuned-cli/controller/authSession.js +0 -424
  186. package/dist/commands/intuned-cli/controller/build.d.ts +0 -1
  187. package/dist/commands/intuned-cli/controller/build.js +0 -36
  188. package/dist/commands/intuned-cli/controller/deploy.d.ts +0 -5
  189. package/dist/commands/intuned-cli/controller/deploy.js +0 -276
  190. package/dist/commands/intuned-cli/controller/index.d.ts +0 -1
  191. package/dist/commands/intuned-cli/controller/index.js +0 -46
  192. package/dist/commands/intuned-cli/controller/save.d.ts +0 -17
  193. package/dist/commands/intuned-cli/controller/save.js +0 -351
  194. package/dist/commands/intuned-cli/helpers/__test__/browser.test.js +0 -114
  195. package/dist/commands/intuned-cli/helpers/__test__/tracing.test.js +0 -40
  196. package/dist/commands/intuned-cli/helpers/api.d.ts +0 -3
  197. package/dist/commands/intuned-cli/helpers/api.js +0 -19
  198. package/dist/commands/intuned-cli/helpers/auth.d.ts +0 -46
  199. package/dist/commands/intuned-cli/helpers/auth.js +0 -144
  200. package/dist/commands/intuned-cli/helpers/backend.d.ts +0 -8
  201. package/dist/commands/intuned-cli/helpers/backend.js +0 -27
  202. package/dist/commands/intuned-cli/helpers/browser.d.ts +0 -15
  203. package/dist/commands/intuned-cli/helpers/browser.js +0 -64
  204. package/dist/commands/intuned-cli/helpers/context.d.ts +0 -3
  205. package/dist/commands/intuned-cli/helpers/context.js +0 -33
  206. package/dist/commands/intuned-cli/helpers/errors.d.ts +0 -16
  207. package/dist/commands/intuned-cli/helpers/errors.js +0 -44
  208. package/dist/commands/intuned-cli/helpers/index.d.ts +0 -12
  209. package/dist/commands/intuned-cli/helpers/index.js +0 -137
  210. package/dist/commands/intuned-cli/helpers/intunedJson.d.ts +0 -39
  211. package/dist/commands/intuned-cli/helpers/intunedJson.js +0 -20
  212. package/dist/commands/intuned-cli/helpers/proxy.d.ts +0 -5
  213. package/dist/commands/intuned-cli/helpers/proxy.js +0 -23
  214. package/dist/commands/intuned-cli/helpers/terminal.d.ts +0 -5
  215. package/dist/commands/intuned-cli/helpers/terminal.js +0 -13
  216. package/dist/commands/intuned-cli/helpers/timeout.d.ts +0 -1
  217. package/dist/commands/intuned-cli/helpers/timeout.js +0 -23
  218. package/dist/commands/intuned-cli/helpers/traces.d.ts +0 -2
  219. package/dist/commands/intuned-cli/helpers/traces.js +0 -32
  220. package/dist/commands/intuned-cli/helpers/validation.d.ts +0 -2
  221. package/dist/commands/intuned-cli/helpers/validation.js +0 -14
  222. package/dist/commands/intuned-cli/helpers/wrapper.d.ts +0 -2
  223. package/dist/commands/intuned-cli/helpers/wrapper.js +0 -66
  224. package/dist/commands/intuned-cli/index.d.ts +0 -1
  225. package/dist/commands/intuned-cli/index.js +0 -16
  226. package/dist/commands/intuned-cli/main.d.ts +0 -1
  227. package/dist/commands/intuned-cli/main.js +0 -23
  228. package/dist/commands/intuned-cli/types.d.ts +0 -41
  229. package/dist/commands/intuned-cli/types.js +0 -12
  230. package/dist/commands/ts-check.d.ts +0 -2
  231. package/dist/commands/ts-check.js +0 -56
  232. package/dist/common/Logger/Logger/index.d.ts +0 -12
  233. package/dist/common/Logger/Logger/index.js +0 -60
  234. package/dist/common/Logger/Logger/types.d.ts +0 -8
  235. package/dist/common/Logger/Logger/types.js +0 -5
  236. package/dist/common/Logger/index.d.ts +0 -12
  237. package/dist/common/Logger/index.js +0 -60
  238. package/dist/common/Logger/types.d.ts +0 -8
  239. package/dist/common/Logger/types.js +0 -5
  240. package/dist/common/backendFunctions/getAuthSessionParameters.d.ts +0 -1
  241. package/dist/common/backendFunctions/getAuthSessionParameters.js +0 -38
  242. package/dist/common/extension/extensionsHelpers.d.ts +0 -11
  243. package/dist/common/extension/extensionsHelpers.js +0 -147
  244. package/dist/common/extension/intunedExtensionServer.d.ts +0 -24
  245. package/dist/common/extension/intunedExtensionServer.js +0 -178
  246. package/dist/common/extension/types.d.ts +0 -212
  247. package/dist/common/extension/types.js +0 -51
  248. package/dist/common/formatZodError.d.ts +0 -2
  249. package/dist/common/intunedJson.d.ts +0 -229
  250. package/dist/common/intunedJson.js +0 -133
  251. package/dist/common/launchBrowser.d.ts +0 -31
  252. package/dist/common/launchBrowser.js +0 -207
  253. package/dist/common/playwrightContext.d.ts +0 -31
  254. package/dist/common/playwrightContext.js +0 -144
  255. package/dist/common/runApi/errors.d.ts +0 -72
  256. package/dist/common/runApi/errors.js +0 -169
  257. package/dist/common/runApi/importUsingImportFunction.d.ts +0 -9
  258. package/dist/common/runApi/importUsingImportFunction.js +0 -46
  259. package/dist/common/runApi/types.d.ts +0 -830
  260. package/dist/common/runApi/types.js +0 -73
  261. package/dist/common/setupContextHook.d.ts +0 -17
  262. package/dist/common/setupContextHook.js +0 -22
  263. package/dist/runtime/RunError.d.ts +0 -5
  264. package/dist/runtime/RunError.js +0 -19
  265. package/dist/runtime/attemptStore.d.ts +0 -2
  266. package/dist/runtime/attemptStore.js +0 -23
  267. package/dist/runtime/captcha.d.ts +0 -15
  268. package/dist/runtime/captcha.js +0 -191
  269. package/dist/runtime/captcha.test.js +0 -821
  270. package/dist/runtime/downloadDirectory.d.ts +0 -1
  271. package/dist/runtime/downloadDirectory.js +0 -19
  272. package/dist/runtime/enums.d.js +0 -5
  273. package/dist/runtime/enums.d.ts +0 -11
  274. package/dist/runtime/enums.js +0 -18
  275. package/dist/runtime/executionHelpers.test.js +0 -52
  276. package/dist/runtime/export.d.js +0 -5
  277. package/dist/runtime/export.d.ts +0 -284
  278. package/dist/runtime/extendPayload.d.ts +0 -2
  279. package/dist/runtime/extendPayload.js +0 -21
  280. package/dist/runtime/extendTimeout.d.ts +0 -1
  281. package/dist/runtime/extendTimeout.js +0 -23
  282. package/dist/runtime/getAiGatewayConfig.d.ts +0 -10
  283. package/dist/runtime/getAiGatewayConfig.js +0 -16
  284. package/dist/runtime/getAuthSessionParameters.d.ts +0 -1
  285. package/dist/runtime/getAuthSessionParameters.js +0 -20
  286. package/dist/runtime/persistentStore.d.ts +0 -2
  287. package/dist/runtime/persistentStore.js +0 -37
  288. package/dist/runtime/persistentStore.test.js +0 -101
  289. package/dist/runtime/runInfo.d.ts +0 -2
  290. package/dist/runtime/runInfo.js +0 -21
  291. package/template.tsconfig.json +0 -11
  292. package/tsconfig.eslint.json +0 -5
  293. package/tsconfig.json +0 -25
  294. package/typedoc.json +0 -49
  295. /package/dist/common/assets/{browser_scripts.js → assets/browser_scripts.js} +0 -0
@@ -1,424 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports._runCreateWithRetries = exports._runCreate = exports._runCheckWithRetries = exports._runCheck = void 0;
7
- exports.executeAttemptCheckAuthSessionCLI = executeAttemptCheckAuthSessionCLI;
8
- exports.executeAttemptCreateAuthSessionCLI = executeAttemptCreateAuthSessionCLI;
9
- exports.executeRecordAuthSessionCLI = executeRecordAuthSessionCLI;
10
- exports.executeRunCreateAuthSessionCLI = executeRunCreateAuthSessionCLI;
11
- exports.executeRunUpdateAuthSessionCLI = executeRunUpdateAuthSessionCLI;
12
- exports.executeRunValidateAuthSessionCLI = executeRunValidateAuthSessionCLI;
13
- var _helpers = require("../helpers");
14
- var _runApi = require("../../../common/runApi");
15
- var _constants = require("../../../common/constants");
16
- var _tsNodeImport = require("../../common/tsNodeImport");
17
- var _terminal = require("../helpers/terminal");
18
- var _browser = require("../helpers/browser");
19
- var _launchBrowser = require("../../../common/launchBrowser");
20
- var _promises = require("timers/promises");
21
- var _contextStorageStateHelpers = require("../../../common/contextStorageStateHelpers");
22
- async function executeRunValidateAuthSessionCLI({
23
- id,
24
- autoRecreate,
25
- checkRetries,
26
- createRetries,
27
- ...rest
28
- }) {
29
- (0, _terminal.terminal)(`^+Validating auth session with id ^c${id}^:\n`);
30
- const {
31
- storageState
32
- } = await (0, _helpers.loadAuthSessionInstance)(id);
33
- await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "check");
34
- (0, _helpers.registerGetAuthSessionParameters)(id);
35
- const checkResult = await runCheckWithRetries({
36
- auth: storageState,
37
- retries: checkRetries,
38
- ...rest
39
- });
40
- if (!checkResult) {
41
- if (!autoRecreate) {
42
- throw new _helpers.CLIError("Auto recreate is disabled, please provide a new auth session or update it manually");
43
- }
44
- const {
45
- metadata
46
- } = await (0, _helpers.loadAuthSessionInstance)(id);
47
- if (metadata?.authSessionType === "MANUAL") {
48
- throw new _helpers.CLIError("Auth session is recorder-based, please provide a new one or update it manually");
49
- }
50
- (0, _terminal.terminal)("^+Auto recreate is enabled - trying to re-create it^:\n");
51
- await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "create");
52
- const authSessionInput = metadata?.authSessionInput ?? {};
53
- const storageState = await runCreateWithRetries({
54
- authSessionId: id,
55
- authSessionInput,
56
- retries: createRetries,
57
- metadata,
58
- ...rest
59
- });
60
- const checkResult = await runCheckWithRetries({
61
- auth: storageState,
62
- retries: checkRetries,
63
- ...rest
64
- });
65
- if (!checkResult) {
66
- throw new _helpers.CLIError("Failed to re-create auth session");
67
- }
68
- }
69
- (0, _terminal.terminal)(`^+^gAuth session validated successfully^:\n`);
70
- return storageState;
71
- }
72
- async function executeRunCreateAuthSessionCLI({
73
- id,
74
- input,
75
- checkRetries,
76
- createRetries,
77
- log = true,
78
- ...rest
79
- }) {
80
- id = id ?? generateAuthSessionId();
81
- (0, _terminal.terminal)(`^+Creating auth session with id ^c${id}^:\n`);
82
- await Promise.all([await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "create"), await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "check")]);
83
- const createdStorageState = await runCreateWithRetries({
84
- authSessionId: id,
85
- authSessionInput: input,
86
- retries: createRetries,
87
- ...rest
88
- });
89
- const auth = createdStorageState;
90
- const checkResult = await runCheckWithRetries({
91
- auth,
92
- retries: checkRetries,
93
- ...rest
94
- });
95
- if (!checkResult) {
96
- throw new _helpers.CLIError("Failed to create auth session");
97
- }
98
- if (log) {
99
- (0, _terminal.terminal)(`^+^gAuth session created successfully^:\n`);
100
- }
101
- return auth;
102
- }
103
- async function executeRunUpdateAuthSessionCLI({
104
- id,
105
- input,
106
- checkRetries,
107
- createRetries,
108
- ...rest
109
- }) {
110
- (0, _terminal.terminal)(`^+Updating auth session with id ^c${id}^:\n`);
111
- let metadata = undefined;
112
- if (input === undefined) {
113
- ({
114
- metadata
115
- } = await (0, _helpers.loadAuthSessionInstance)(id));
116
- if (metadata?.authSessionType === "MANUAL") {
117
- throw new _helpers.CLIError("Auth session is recorder-based, it cannot be updated.");
118
- }
119
- input = metadata?.authSessionInput ?? {};
120
- }
121
- await Promise.all([await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "create"), await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "check")]);
122
- const authSession = await executeRunCreateAuthSessionCLI({
123
- id,
124
- input,
125
- checkRetries,
126
- createRetries,
127
- log: false,
128
- metadata,
129
- ...rest
130
- });
131
- (0, _terminal.terminal)(`^+^gAuth session updated successfully^:\n`);
132
- return authSession;
133
- }
134
- async function executeAttemptCreateAuthSessionCLI({
135
- id,
136
- input,
137
- ...rest
138
- }) {
139
- id = id ?? generateAuthSessionId(true);
140
- (0, _terminal.terminal)(`^+Executing create auth session attempt with id ^c${id}^:\n`);
141
- await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "create");
142
- return await runCreateWithRetries({
143
- authSessionId: id,
144
- authSessionInput: input,
145
- ...rest
146
- });
147
- }
148
- async function executeAttemptCheckAuthSessionCLI({
149
- id,
150
- ...rest
151
- }) {
152
- (0, _terminal.terminal)(`^+Executing check auth session attempt with id ^c${id}^:\n`);
153
- await (0, _helpers.assertApiFileExists)(_constants.AUTH_SESSIONS_FOLDER_NAME, "check");
154
- (0, _helpers.registerGetAuthSessionParameters)(id);
155
- const {
156
- storageState
157
- } = await (0, _helpers.loadAuthSessionInstance)(id);
158
- const checkResult = await runCheckWithRetries({
159
- auth: storageState,
160
- ...rest
161
- });
162
- if (!checkResult) {
163
- throw new _helpers.CLIError("Check failed");
164
- }
165
- (0, _terminal.terminal)(`^+^gAuth session check passed^:\n`);
166
- return storageState;
167
- }
168
- async function runCheck({
169
- auth,
170
- proxy,
171
- headless,
172
- timeout,
173
- traceId,
174
- keepBrowserOpen,
175
- cdpUrl
176
- }) {
177
- return await (0, _helpers.withTimeout)(async abortSignal => (0, _helpers.withCLITrace)(async tracing => {
178
- const runApiResult = await (0, _runApi.runApi)({
179
- automationFunction: {
180
- name: `${_constants.AUTH_SESSIONS_FOLDER_NAME}/check`
181
- },
182
- runOptions: await (0, _browser.getCLIRunOptions)({
183
- headless,
184
- proxy,
185
- keepBrowserOpen,
186
- cdpUrl
187
- }),
188
- auth: {
189
- session: {
190
- type: "state",
191
- state: auth
192
- }
193
- },
194
- tracing,
195
- importFunction: _tsNodeImport.tsNodeImport,
196
- abortSignal
197
- });
198
- if (runApiResult.isErr()) {
199
- throw runApiResult.error;
200
- }
201
- const result = runApiResult.value.result;
202
- if (!result) {
203
- return false;
204
- }
205
- return result;
206
- }, traceId), timeout);
207
- }
208
- const _runCheck = exports._runCheck = runCheck;
209
- async function runCreate({
210
- authSessionInput,
211
- proxy,
212
- headless,
213
- timeout,
214
- traceId,
215
- keepBrowserOpen,
216
- cdpUrl
217
- }) {
218
- return await (0, _helpers.withTimeout)(async abortSignal => (0, _helpers.withCLITrace)(async tracing => {
219
- const result = await (0, _runApi.runApi)({
220
- automationFunction: {
221
- name: `${_constants.AUTH_SESSIONS_FOLDER_NAME}/create`,
222
- params: authSessionInput
223
- },
224
- runOptions: await (0, _browser.getCLIRunOptions)({
225
- headless,
226
- proxy,
227
- keepBrowserOpen,
228
- cdpUrl
229
- }),
230
- retrieveSession: true,
231
- tracing,
232
- importFunction: _tsNodeImport.tsNodeImport,
233
- abortSignal
234
- });
235
- if (result.isErr()) {
236
- throw result.error;
237
- }
238
- return result.value.session;
239
- }, traceId), timeout);
240
- }
241
- const _runCreate = exports._runCreate = runCreate;
242
- async function runCheckWithRetries({
243
- auth,
244
- retries,
245
- ...rest
246
- }) {
247
- for (let i = 0; i < (retries ?? 1); i++) {
248
- (0, _terminal.terminal)(`\n^+Running ^cauth session check${i === 0 ? "" : ` ^/(Attempt ${i + 1})`}^:...\n`);
249
- try {
250
- let traceId = undefined;
251
- if (rest.trace) {
252
- traceId = "authsession-check-attempt";
253
- if (retries) {
254
- traceId += `-${i + 1}`;
255
- }
256
- }
257
- const checkResult = await runCheck({
258
- auth,
259
- traceId,
260
- ...rest
261
- });
262
- if (checkResult) {
263
- (0, _terminal.terminal)(`^+^gAuth session check passed^:\n`);
264
- return true;
265
- }
266
- } catch (error) {
267
- if (error instanceof _runApi.RunAutomationError) {
268
- (0, _helpers.logAutomationError)(error);
269
- } else {
270
- throw error;
271
- }
272
- }
273
- (0, _terminal.terminal)(`^+^yAuth session check failed^:\n`);
274
- }
275
- (0, _terminal.terminal)(`^+^rAuth session check failed after ${retries} attempts^:\n`);
276
- return false;
277
- }
278
- const _runCheckWithRetries = exports._runCheckWithRetries = runCheckWithRetries;
279
- async function runCreateWithRetries({
280
- authSessionId,
281
- authSessionInput,
282
- retries,
283
- trace,
284
- metadata,
285
- ...rest
286
- }) {
287
- let newAuthSessionInstance = null;
288
- for (let i = 0; i < (retries ?? 1); i++) {
289
- (0, _terminal.terminal)(`\n^+Running ^cauth session create${i === 0 ? "" : ` ^/(Attempt ${i + 1})`}^:...\n`);
290
- try {
291
- let traceId = undefined;
292
- if (trace) {
293
- traceId = "authsession-create-attempt";
294
- if (retries) {
295
- traceId += `-${i + 1}`;
296
- }
297
- }
298
- newAuthSessionInstance = await runCreate({
299
- authSessionInput,
300
- traceId,
301
- ...rest
302
- });
303
- (0, _terminal.terminal)(`^+^gAuth session create succeeded^:\n`);
304
- break;
305
- } catch (error) {
306
- if (error instanceof _runApi.RunAutomationError) {
307
- (0, _helpers.logAutomationError)(error);
308
- } else {
309
- throw error;
310
- }
311
- (0, _terminal.terminal)(`^+^yAuth session create failed^:\n`);
312
- }
313
- }
314
- if (!newAuthSessionInstance) {
315
- throw new _helpers.CLIError(`Failed to create auth session after ${retries} retries`);
316
- }
317
- await (0, _helpers.storeAuthSessionInstance)({
318
- state: newAuthSessionInstance,
319
- id: authSessionId,
320
- input: authSessionInput,
321
- proxy: rest.proxy,
322
- metadata
323
- });
324
- return newAuthSessionInstance;
325
- }
326
- const _runCreateWithRetries = exports._runCreateWithRetries = runCreateWithRetries;
327
- async function executeRecordAuthSessionCLI({
328
- id,
329
- checkRetries,
330
- timeout,
331
- headless,
332
- proxy,
333
- trace = false,
334
- keepBrowserOpen,
335
- startUrl,
336
- finishUrl
337
- }) {
338
- id = id ?? generateAuthSessionId();
339
- (0, _terminal.terminal)(`^+Recording auth session with id ^c${id}^:\n`);
340
- let authSession;
341
- try {
342
- authSession = await recordAuthSession({
343
- startUrl,
344
- finishUrl,
345
- timeout,
346
- proxy: proxy ? (0, _helpers.parseUrlProxy)(proxy) : undefined
347
- });
348
- } catch (error) {
349
- if (error instanceof _helpers.CLIError) {
350
- throw new _helpers.CLIError(`Failed to record auth session: ${error.message}`);
351
- }
352
- throw error;
353
- }
354
- await (0, _helpers.storeAuthSessionInstance)({
355
- state: authSession,
356
- id,
357
- proxy,
358
- metadata: {
359
- createdAt: new Date().toISOString(),
360
- updatedAt: new Date().toISOString(),
361
- authSessionId: id,
362
- authSessionType: "MANUAL",
363
- recorderStartUrl: startUrl,
364
- recorderEndUrl: finishUrl
365
- }
366
- });
367
- await executeRunValidateAuthSessionCLI({
368
- id,
369
- headless,
370
- timeout,
371
- proxy,
372
- autoRecreate: false,
373
- checkRetries,
374
- createRetries: 0,
375
- trace,
376
- keepBrowserOpen
377
- });
378
- (0, _terminal.terminal)(`^+^gAuth session ^c${id}^ ^+^grecorded successfully^:\n`);
379
- }
380
- async function recordAuthSession({
381
- startUrl,
382
- finishUrl,
383
- timeout,
384
- proxy
385
- }) {
386
- const {
387
- context,
388
- page
389
- } = await (0, _launchBrowser.launchChromium)({
390
- headless: false,
391
- proxy,
392
- appModeInitialUrl: startUrl
393
- });
394
- try {
395
- if (!page.url().startsWith(startUrl)) {
396
- await page.goto(startUrl);
397
- }
398
- (0, _terminal.terminal)(`^+Navigated to^ ^_${startUrl}^:\n`);
399
- (0, _terminal.terminal)(`^+Waiting for^ ^_${finishUrl}^:...\n`);
400
- const timeoutTimestamp = Date.now() + timeout;
401
- while (true) {
402
- if (Date.now() > timeoutTimestamp) {
403
- throw new _helpers.CLIError("Timeout waiting for finish URL");
404
- }
405
- if (context.pages().length === 0) {
406
- throw new _helpers.CLIError("Browser was closed before reaching the finish URL");
407
- }
408
- if (context.pages()[0].url().startsWith(finishUrl)) {
409
- break;
410
- }
411
- await (0, _promises.setTimeout)(1000);
412
- }
413
- (0, _terminal.terminal)(`^+Finish URL reached, capturing auth session...^:\n`);
414
- await page.waitForLoadState("load");
415
- const authSession = await (0, _contextStorageStateHelpers.getStorageState)(context);
416
- return authSession;
417
- } finally {
418
- await context.close();
419
- }
420
- }
421
- function generateAuthSessionId(isAttempt = false) {
422
- if (isAttempt) return `auth-session-attempt-${Date.now()}`;
423
- return `auth-session-${Date.now()}`;
424
- }
@@ -1 +0,0 @@
1
- export declare const runBuild: () => Promise<boolean>;
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.runBuild = void 0;
7
- var fs = _interopRequireWildcard(require("fs-extra"));
8
- var path = _interopRequireWildcard(require("path"));
9
- var _child_process = require("child_process");
10
- var _util = require("util");
11
- var _terminal = require("../helpers/terminal");
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
- const execPromise = (0, _util.promisify)(_child_process.exec);
15
- const runBuild = async () => {
16
- const distPath = path.join(process.cwd(), "dist");
17
- if (await fs.exists(distPath)) {
18
- await fs.remove(distPath);
19
- }
20
- const buildCommand = "tsc";
21
- try {
22
- await execPromise(buildCommand);
23
- (0, _terminal.terminal)(`^g^+✨ Build completed successfully!^:\n`);
24
- return true;
25
- } catch (error) {
26
- (0, _terminal.terminal)(`^r^+An error occurred during the build process:^:\n`);
27
- if ("stdout" in error) {
28
- (0, _terminal.terminal)(`${error.stdout}\n`);
29
- } else {
30
- (0, _terminal.terminal)(`^${error.message}^:\n`);
31
- }
32
- (0, _terminal.terminal)(`^r^+Build failed^:\n`);
33
- return false;
34
- }
35
- };
36
- exports.runBuild = runBuild;
@@ -1,5 +0,0 @@
1
- import { z } from "zod";
2
- import type { AuthCredentials } from "../types";
3
- export declare const START_RUN_INPUT_QUERY_PARAM_KEY = "startRunInput";
4
- export declare function runDeployProject(projectName: string, auth: AuthCredentials): Promise<void>;
5
- export declare const projectNameSchema: z.ZodEffects<z.ZodString, string, string>;