@intuned/runtime 1.3.17 → 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 (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 +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 +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,318 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.projectNameSchema = exports.START_RUN_INPUT_QUERY_PARAM_KEY = void 0;
7
- exports.runDeployProject = runDeployProject;
8
- var _zod = require("zod");
9
- var _constants = require("../constants");
10
- var _helpers = require("../helpers");
11
- var _terminal = require("../helpers/terminal");
12
- var _promises = require("timers/promises");
13
- var _ms = _interopRequireDefault(require("ms"));
14
- var _provision = require("./provision");
15
- var _constants2 = require("../../../common/constants");
16
- var _path = _interopRequireDefault(require("path"));
17
- var fs = _interopRequireWildcard(require("fs-extra"));
18
- var _prompts = _interopRequireDefault(require("prompts"));
19
- var _terminalLink = _interopRequireDefault(require("terminal-link"));
20
- var _pressAnyKey = _interopRequireDefault(require("press-any-key"));
21
- 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); }
22
- 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; }
23
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
24
- const START_RUN_INPUT_QUERY_PARAM_KEY = exports.START_RUN_INPUT_QUERY_PARAM_KEY = "startRunInput";
25
- async function runDeployProject(projectName, auth) {
26
- let enableFirstRunExperience = false;
27
- let firstRunExperienceInput = undefined;
28
- const settings = await (0, _helpers.loadIntunedJson)();
29
- const provisionResult = await (0, _provision.runProvisionProject)(projectName, auth, true);
30
- if (provisionResult) {
31
- enableFirstRunExperience = provisionResult?.enableFirstRunExperience ?? false;
32
- if (enableFirstRunExperience) {
33
- firstRunExperienceInput = await promptFirstRunExperience(settings);
34
- }
35
- const {
36
- projectId,
37
- dotenvContent,
38
- environmentVariablesKeys
39
- } = provisionResult;
40
- if (dotenvContent) {
41
- const dotenvKeys = Object.keys(dotenvContent);
42
- const missingKeys = dotenvKeys.filter(key => dotenvContent[key] && !environmentVariablesKeys.includes(key));
43
- if (missingKeys.length > 0) {
44
- (0, _terminal.terminal)(`^yWarning: The following environment variables are defined in your .env file but are not defined on Intuned platform^:\n`);
45
- for (const key of missingKeys) {
46
- (0, _terminal.terminal)(`^y • ${key}^:\n`);
47
- }
48
- (0, _terminal.terminal)(`^yPlease add them to your project or workspace on Intuned platform to ensure proper functionality.^:\n`);
49
- const projectEnvVarsUrl = `${(0, _helpers.getBaseUrl)()}/projects/${projectId}/env-vars`;
50
- const workspaceEnvVarsUrl = `${(0, _helpers.getBaseUrl)()}/settings/env-vars`;
51
- if (_terminalLink.default.isSupported) {
52
- const projectEnvVarsTerminalLink = (0, _terminalLink.default)(`[ Project Env Vars ]`, projectEnvVarsUrl).replaceAll("%", "%%");
53
- const workspaceEnvVarsTerminalLink = (0, _terminalLink.default)(`[ Workspace Env Vars ]`, workspaceEnvVarsUrl).replaceAll("%", "%%");
54
- (0, _terminal.terminal)(`^Y${projectEnvVarsTerminalLink} ${workspaceEnvVarsTerminalLink}^:\n`);
55
- } else {
56
- (0, _terminal.terminal)(`^yProject Env Vars: ^_${projectEnvVarsUrl}^:\n`);
57
- (0, _terminal.terminal)(`^yWorkspace Env Vars: ^_${workspaceEnvVarsUrl}^:\n`);
58
- }
59
- try {
60
- (0, _terminal.terminal)("Press any key to continue...");
61
- await (0, _pressAnyKey.default)("", {
62
- ctrlC: "reject",
63
- hideMessage: true
64
- });
65
- (0, _terminal.terminal)("\n");
66
- } catch {
67
- throw new _helpers.AbortedCLIError();
68
- }
69
- }
70
- }
71
- }
72
- const {
73
- workspaceId,
74
- apiKey
75
- } = auth;
76
- const baseUrl = (0, _helpers.getBaseUrl)();
77
- const url = `${baseUrl}/api/v1/workspace/${workspaceId}/projects/${projectName}/deploy`;
78
- const headers = {
79
- [_constants2.API_KEY_HEADER_NAME]: apiKey,
80
- "Content-Type": "application/json"
81
- };
82
- const response = await fetch(url, {
83
- headers,
84
- method: "POST",
85
- body: JSON.stringify({
86
- firstRunExperienceInput
87
- })
88
- });
89
- if (!response.ok) {
90
- if (response.status === 401) {
91
- throw new _helpers.CLIError(`Invalid API key. The provided API key is not authorized to access this workspace.\n` + `Please verify your API key at: https://app.intuned.io/settings/api-keys`);
92
- }
93
- throw new _helpers.CLIError(`^r^+Invalid response from server\n^:^R${response.status} ${await response.text()}^:\n^r^+Deployment failed. Report this issue to the Intuned team.^:\n`, {
94
- autoColor: false
95
- });
96
- }
97
- (0, _terminal.terminal)("\n");
98
- const startTime = Date.now();
99
- const timeElapsedText = () => ((Date.now() - startTime) / (0, _ms.default)("1 second")).toFixed(1);
100
- function* getSpinnerGenerator() {
101
- while (true) {
102
- yield* "⠙⠹⠸⠼⠴⠦⠧⠇";
103
- }
104
- }
105
- const spinnerGen = getSpinnerGenerator();
106
- let updateSpinnerInterval = null;
107
- if (_terminal.terminalStdout.isTTY) {
108
- updateSpinnerInterval = setInterval(() => {
109
- _terminal.terminal.previousLine(1);
110
- _terminal.terminal.column(0);
111
- _terminal.terminal.eraseLineAfter();
112
- (0, _terminal.terminal)(`${spinnerGen.next().value} ^cDeploying ^:^K(${timeElapsedText()}s)^ \n`);
113
- }, 50);
114
- (0, _terminal.terminal)("\n");
115
- } else {
116
- (0, _terminal.terminal)(`^cDeploying ^:\n`);
117
- }
118
- try {
119
- while (true) {
120
- await (0, _promises.setTimeout)(_constants.PROJECT_DEPLOY_CHECK_PERIOD);
121
- if (!_terminal.terminalStdout.isTTY) {
122
- (0, _terminal.terminal)(`^cDeploying ^:^K(${timeElapsedText()}s)^ \n`);
123
- }
124
- const {
125
- status,
126
- message,
127
- projectId,
128
- ...rest
129
- } = await checkIntunedProjectDeployStatus(workspaceId, projectName, apiKey);
130
- if (status === "pending") {
131
- const elapsedTime = Date.now() - startTime;
132
- if (elapsedTime > _constants.PROJECT_DEPLOY_TIMEOUT) {
133
- throw new _helpers.CLIError(`Deployment failed - timed out after ${Math.floor(_constants.PROJECT_DEPLOY_TIMEOUT / (0, _ms.default)("1 minute"))} minutes`);
134
- }
135
- continue;
136
- }
137
- _terminal.terminal.previousLine(1);
138
- _terminal.terminal.eraseLine();
139
- if (updateSpinnerInterval) {
140
- clearTimeout(updateSpinnerInterval);
141
- }
142
- if (status === "completed") {
143
- const url = (0, _helpers.getBaseUrl)();
144
- (0, _terminal.terminal)(`\n^g^+Project deployed successfully!^:\n\n`);
145
- const projectUrl = `${url}/projects/${projectId}`;
146
- const runsUrl = `${projectUrl}/runs`;
147
- const jobsUrl = `${projectUrl}/jobs`;
148
- const runsPlaygroundUrl = `${runsUrl}?${buildRunsPlaygroundQueryParams({
149
- enableFirstRunExperience,
150
- settings,
151
- testAuthSessionId: rest.testAuthSessionId
152
- })}`;
153
- const defaultJobTriggerUrl = rest.defaultJobId ? `${jobsUrl}/${rest.defaultJobId}?action=trigger` : undefined;
154
- const actions = [{
155
- label: "View Project",
156
- url: runsUrl
157
- }, ...(settings.apiAccess.enabled ? [{
158
- label: "Run Playground",
159
- url: runsPlaygroundUrl
160
- }] : []), {
161
- label: "Manage Jobs",
162
- url: jobsUrl
163
- }, ...(defaultJobTriggerUrl !== undefined ? [{
164
- label: "Trigger Default Job",
165
- url: defaultJobTriggerUrl
166
- }] : [])];
167
- if (_terminalLink.default.isSupported) {
168
- for (const action of actions) {
169
- const link = (0, _terminalLink.default)(`[ ${action.label} ]`, action.url);
170
- (0, _terminal.terminal)(`^+${link.replaceAll("%", "%%")}^ `);
171
- }
172
- (0, _terminal.terminal)("\n");
173
- } else {
174
- for (const action of actions) {
175
- (0, _terminal.terminal)(`^+${action.label}:^ ^c^_${action.url}^:\n`);
176
- }
177
- }
178
- return;
179
- }
180
- let errorMessage = `^r^+An error occurred while deploying project:^:\n^R${message}^:\n`;
181
- if (rest.reason) {
182
- errorMessage += `^r^+Reason:^:\n^R${rest.reason}^:\n`;
183
- } else {
184
- errorMessage += `^r^+Unknown error occurred, please report this issue to the Intuned team.^:\n`;
185
- }
186
- errorMessage += `^r^+Deployment failed^:\n`;
187
- throw new _helpers.CLIError(errorMessage, {
188
- autoColor: false
189
- });
190
- }
191
- } catch (e) {
192
- if (updateSpinnerInterval) {
193
- clearTimeout(updateSpinnerInterval);
194
- }
195
- throw e;
196
- }
197
- }
198
- const projectNameSchema = exports.projectNameSchema = _zod.z.string().min(1, "Project Name is required").max(200, "Name must be 200 characters or less").regex(/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/, "Name can only contain lowercase letters, numbers, hyphens, and underscores in between").refine(value => !_zod.z.string().uuid().safeParse(value).success, {
199
- message: "Name cannot be a UUID"
200
- });
201
- const checkIntunedProjectDeployStatus = async (workspaceId, projectName, apiKey) => {
202
- const baseUrl = (0, _helpers.getBaseUrl)();
203
- const url = `${baseUrl}/api/v1/workspace/${workspaceId}/projects/${projectName}/deploy/result`;
204
- const headers = {
205
- [_constants2.API_KEY_HEADER_NAME]: apiKey,
206
- "Content-Type": "application/json"
207
- };
208
- const response = await fetch(url, {
209
- headers,
210
- method: "GET"
211
- });
212
- if (response.status === 404) {
213
- return {
214
- status: "not_found",
215
- message: "Project not found"
216
- };
217
- }
218
- if (!response.ok) {
219
- throw new _helpers.CLIError(`Error querying deployment status ${response.status}: ${await response.text()}`);
220
- }
221
- const data = await response.json();
222
- if (data.status) {
223
- return data;
224
- }
225
- return {
226
- status: "failed",
227
- message: `Deployment failed, please try again: ${data.message}`
228
- };
229
- };
230
- async function promptFirstRunExperience(settings) {
231
- let testAuthSessionInput = undefined;
232
- const shouldPromptForTestAuthSession = settings.authSessions.enabled && settings.authSessions.type === "API";
233
- const defaultJobInput = settings.metadata?.defaultJobInput;
234
- const shouldPromptForDefaultJob = defaultJobInput !== undefined;
235
- if (shouldPromptForTestAuthSession) {
236
- testAuthSessionInput = await promptFirstRunExperienceTestAuthSessionParameters({
237
- shouldPromptForDefaultJob
238
- });
239
- if (!testAuthSessionInput) {
240
- return {};
241
- }
242
- }
243
- return {
244
- testAuthSessionInput,
245
- defaultJobInput: shouldPromptForDefaultJob ? await promptFirstRunExperienceDefaultJobParameters({
246
- defaultJobInput
247
- }) : undefined
248
- };
249
- }
250
- async function promptFirstRunExperienceTestAuthSessionParameters({
251
- shouldPromptForDefaultJob
252
- }) {
253
- const authSessionInstancesDirectory = _path.default.join(process.cwd(), _constants2.AUTH_SESSIONS_INSTANCES_FOLDER_NAME);
254
- if (!(await fs.exists(authSessionInstancesDirectory))) {
255
- return;
256
- }
257
- const authSessionId = (await fs.readdir(authSessionInstancesDirectory)).shift();
258
- if (!authSessionId) {
259
- return;
260
- }
261
- const {
262
- metadata
263
- } = await (0, _helpers.loadAuthSessionInstance)(authSessionId);
264
- if (!metadata.authSessionId) {
265
- return;
266
- }
267
- const message = shouldPromptForDefaultJob ? `^:^+Create a test AuthSession using^ ^c${authSessionId}^:^+ parameters?^ ^/(required for creating default job)^:` : `^:^+Create a test AuthSession using^ ^c${authSessionId}^:^+ parameters?^:`;
268
- const {
269
- value
270
- } = await (0, _prompts.default)({
271
- type: "confirm",
272
- name: "value",
273
- message: _terminal.terminal.str(message).toString(),
274
- initial: true
275
- });
276
- if (value === undefined) {
277
- throw new _helpers.AbortedCLIError();
278
- }
279
- if (value) {
280
- return metadata.authSessionInput;
281
- }
282
- }
283
- async function promptFirstRunExperienceDefaultJobParameters({
284
- defaultJobInput
285
- }) {
286
- const {
287
- value
288
- } = await (0, _prompts.default)({
289
- type: "confirm",
290
- name: "value",
291
- message: _terminal.terminal.str(`^:^+Create a default job with sample parameters?^:`).toString(),
292
- initial: true
293
- });
294
- if (value === undefined) {
295
- throw new _helpers.AbortedCLIError();
296
- }
297
- if (value) {
298
- return defaultJobInput;
299
- }
300
- }
301
- function buildRunsPlaygroundQueryParams({
302
- enableFirstRunExperience,
303
- settings,
304
- testAuthSessionId
305
- }) {
306
- const params = new URLSearchParams();
307
- if (!enableFirstRunExperience) return params.toString();
308
- params.set(START_RUN_INPUT_QUERY_PARAM_KEY, JSON.stringify({}));
309
- const input = settings.metadata?.defaultRunPlaygroundInput;
310
- if (!input) return params.toString();
311
- if (testAuthSessionId) {
312
- input.authSessionId = testAuthSessionId;
313
- }
314
- params.set(START_RUN_INPUT_QUERY_PARAM_KEY, JSON.stringify({
315
- ...input
316
- }));
317
- return params.toString();
318
- }
@@ -1 +0,0 @@
1
- export declare function loadParameters(parameters: string): Promise<object | null>;
@@ -1,46 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.loadParameters = loadParameters;
7
- var fs = _interopRequireWildcard(require("fs-extra"));
8
- var _helpers = require("../helpers");
9
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
- async function loadParameters(parameters) {
12
- let inputData;
13
- if (await fs.exists(parameters)) {
14
- inputData = await loadParametersFromFile(parameters);
15
- } else {
16
- try {
17
- inputData = JSON.parse(parameters);
18
- } catch (err) {
19
- throw new _helpers.CLIError("Invalid parameters - must be a valid JSON string or a path to a JSON file");
20
- }
21
- }
22
- return inputData;
23
- }
24
- async function loadParametersFromFile(parametersFile) {
25
- if (!parametersFile) {
26
- return {};
27
- }
28
- try {
29
- const filePath = parametersFile;
30
- await fs.access(filePath);
31
- let inputData = null;
32
- if (parametersFile) {
33
- inputData = await fs.readJSON(filePath);
34
- } else {
35
- inputData = {};
36
- }
37
- return inputData;
38
- } catch (error) {
39
- if (error.code === "ENOENT") {
40
- throw new _helpers.CLIError(`Parameters file not found: ${parametersFile}`);
41
- } else if (error instanceof SyntaxError) {
42
- throw new _helpers.CLIError(`Invalid JSON in parameters file: ${error.message}`);
43
- }
44
- throw new _helpers.CLIError(`Error reading parameters file: ${error.message}`);
45
- }
46
- }
@@ -1,21 +0,0 @@
1
- import { z } from "zod";
2
- import type { AuthCredentials } from "../types";
3
- export declare function runProvisionProject(projectName: string, auth: AuthCredentials, silent?: boolean): Promise<{
4
- projectId: string;
5
- enableFirstRunExperience: boolean | undefined;
6
- environmentVariablesKeys: string[];
7
- dotenvContent: {
8
- [x: string]: string;
9
- };
10
- } | undefined>;
11
- export declare const projectNameSchema: z.ZodEffects<z.ZodString, string, string>;
12
- export declare const validateProjectName: (projectName: string) => {
13
- isValid: true;
14
- } | {
15
- isValid: false;
16
- errorMessage: string;
17
- };
18
- export declare const validateIntunedProject: () => Promise<{
19
- isValid: boolean;
20
- errorMessage?: string;
21
- }>;
@@ -1,300 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.projectNameSchema = void 0;
7
- exports.runProvisionProject = runProvisionProject;
8
- exports.validateProjectName = exports.validateIntunedProject = void 0;
9
- var fs = _interopRequireWildcard(require("fs-extra"));
10
- var path = _interopRequireWildcard(require("path"));
11
- var _zod = require("zod");
12
- var _projectExclusions = _interopRequireDefault(require("../../common/projectExclusions"));
13
- var _constants = require("../constants");
14
- var _helpers = require("../helpers");
15
- var _terminal = require("../helpers/terminal");
16
- var _build = require("./build");
17
- var dotenv = _interopRequireWildcard(require("dotenv"));
18
- var _constants2 = require("../../../common/constants");
19
- var _ignore = _interopRequireDefault(require("ignore"));
20
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
- 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); }
22
- 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; }
23
- const provisionProjectApiResponseSchema = _zod.z.string().transform((val, ctx) => {
24
- try {
25
- return JSON.parse(val);
26
- } catch (e) {
27
- ctx.addIssue({
28
- code: _zod.z.ZodIssueCode.custom,
29
- message: "Response is not valid JSON"
30
- });
31
- return _zod.z.NEVER;
32
- }
33
- }).pipe(_zod.z.object({
34
- id: _zod.z.string().uuid(),
35
- enableFirstRunExperience: _zod.z.boolean().optional(),
36
- environmentVariablesKeys: _zod.z.array(_zod.z.string()).default([]).catch(() => [])
37
- }));
38
- async function runProvisionProject(projectName, auth, silent = false) {
39
- const {
40
- workspaceId,
41
- apiKey
42
- } = auth;
43
- const baseUrl = (0, _helpers.getBaseUrl)();
44
- const url = `${baseUrl}/api/v1/workspace/${workspaceId}/projects/${projectName}`;
45
- const headers = {
46
- [_constants2.API_KEY_HEADER_NAME]: apiKey,
47
- "Content-Type": "application/json"
48
- };
49
- const projectPath = process.cwd();
50
- const codeTree = await convertProjectToCodeTree(projectPath);
51
- const intunedSettingsFile = await (0, _helpers.getIntunedSettingsFile)();
52
- codeTree["Intuned.json"] = {
53
- file: {
54
- contents: JSON.stringify(intunedSettingsFile.parse(await fs.readFile(intunedSettingsFile.path, "utf-8")))
55
- }
56
- };
57
- codeTree["tsconfig.json"] = {
58
- file: {
59
- contents: JSON.stringify(_constants.tsConfigCli, null, 2)
60
- }
61
- };
62
- const upsertProjectPayload = {
63
- codeTree,
64
- platformType: "CLI",
65
- language: "typescript"
66
- };
67
- const response = await fetch(url, {
68
- headers,
69
- method: "PUT",
70
- body: JSON.stringify(upsertProjectPayload)
71
- });
72
- if (!response.ok) {
73
- if (response.status === 401) {
74
- throw new _helpers.CLIError(`Invalid API key. The provided API key is not authorized to access this workspace.\n` + `Please verify your API key at: https://app.intuned.io/settings/api-keys`);
75
- }
76
- throw new _helpers.CLIError(`^r^+Project provisioning failed:^:\n` + `^RServer returned status ${response.status}^:\n` + `^RResponse: ${await response.text()}^:\n\n` + `^yCommon causes:^:\n` + ` • Invalid workspace ID or project name\n` + ` • Insufficient permissions\n` + ` • Network connectivity issues\n` + ` • Project structure validation errors\n`, {
77
- autoColor: false
78
- });
79
- }
80
- if (!silent) {
81
- (0, _terminal.terminal)("^g^+Project provisioned successfully!^:\n");
82
- }
83
- const body = await response.text();
84
- const parseResult = provisionProjectApiResponseSchema.safeParse(body);
85
- if (!parseResult.success) {
86
- (0, _terminal.terminal)(`^yWarning: Could not parse provision project response:^:\n`);
87
- (0, _terminal.terminal)(body + "\n");
88
- return;
89
- }
90
- const {
91
- id: projectId,
92
- enableFirstRunExperience,
93
- environmentVariablesKeys
94
- } = parseResult.data;
95
- const dotEnvPath = path.join(projectPath, ".env");
96
- if (!(await fs.exists(dotEnvPath))) {
97
- await fs.writeFile(dotEnvPath, `${_constants2.PROJECT_ID_ENV_VAR_KEY}=${projectId}
98
- ${_constants2.WORKSPACE_ID_ENV_VAR_KEY}=${workspaceId}
99
- ${_constants2.API_KEY_ENV_VAR_KEY}=${apiKey}`);
100
- (0, _terminal.terminal)(`^g^+Created .env file with project credentials.^:\n`);
101
- return {
102
- projectId,
103
- enableFirstRunExperience,
104
- environmentVariablesKeys,
105
- dotenvContent: {}
106
- };
107
- }
108
- const envContent = await fs.readFile(dotEnvPath, "utf-8");
109
- const dotenvContent = dotenv.parse(envContent);
110
- let contentToAppend = "";
111
- const projectCredentialsEnvVars = {
112
- [_constants2.PROJECT_ID_ENV_VAR_KEY]: projectId,
113
- [_constants2.WORKSPACE_ID_ENV_VAR_KEY]: workspaceId,
114
- [_constants2.API_KEY_ENV_VAR_KEY]: apiKey
115
- };
116
- for (const key in projectCredentialsEnvVars) {
117
- if (dotenvContent[key] === projectCredentialsEnvVars[key]) {
118
- continue;
119
- }
120
- if (dotenvContent[key]) {
121
- (0, _terminal.terminal)(`^yWarning: Existing ${key} in .env has invalid value. Appending correct value.^:\n`);
122
- }
123
- contentToAppend += `${key}=${projectCredentialsEnvVars[key]}\n`;
124
- }
125
- if (contentToAppend) {
126
- await fs.appendFile(dotEnvPath, contentToAppend + "\n");
127
- (0, _terminal.terminal)(`^g^+Updated .env file with project credentials.^:\n`);
128
- }
129
- const dotenvContentToReturn = {
130
- ...dotenvContent
131
- };
132
- for (const key of [_constants2.PROJECT_ID_ENV_VAR_KEY, _constants2.WORKSPACE_ID_ENV_VAR_KEY, _constants2.API_KEY_ENV_VAR_KEY]) {
133
- if (key in dotenvContentToReturn) {
134
- delete dotenvContentToReturn[key];
135
- }
136
- }
137
- return {
138
- projectId,
139
- enableFirstRunExperience,
140
- environmentVariablesKeys,
141
- dotenvContent: dotenvContentToReturn
142
- };
143
- }
144
- const projectNameSchema = exports.projectNameSchema = _zod.z.string().min(1, "Name is required").max(200, "Must be 200 characters or less").regex(/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/, "Can only contain lowercase letters, numbers, hyphens, and underscores in between").refine(value => !_zod.z.string().uuid().safeParse(value).success, {
145
- message: "Cannot be a UUID"
146
- });
147
- const validateProjectName = projectName => {
148
- const validation = projectNameSchema.safeParse(projectName);
149
- if (!validation.success) {
150
- return {
151
- isValid: false,
152
- errorMessage: validation.error.errors[0].message
153
- };
154
- }
155
- return {
156
- isValid: true
157
- };
158
- };
159
- exports.validateProjectName = validateProjectName;
160
- const validateIntunedProject = async () => {
161
- const currentDirectoryToProvision = process.cwd();
162
- const intunedSettingsFile = await (0, _helpers.getIntunedSettingsFile)();
163
- const validationSteps = [{
164
- name: "build",
165
- check: async () => {
166
- try {
167
- const buildResult = await (0, _build.runBuild)();
168
- if (!buildResult) {
169
- return {
170
- isValid: false,
171
- errorMessage: "Build failed"
172
- };
173
- }
174
- return {
175
- isValid: true
176
- };
177
- } catch (error) {
178
- return {
179
- isValid: false,
180
- errorMessage: "Build failed"
181
- };
182
- }
183
- }
184
- }, {
185
- name: intunedSettingsFile.name,
186
- check: async () => {
187
- try {
188
- const intunedJsonPath = path.join(currentDirectoryToProvision, intunedSettingsFile.name);
189
- await fs.exists(intunedJsonPath);
190
- return {
191
- isValid: true
192
- };
193
- } catch (error) {
194
- return {
195
- isValid: false,
196
- errorMessage: `${intunedSettingsFile.name} file not found`
197
- };
198
- }
199
- }
200
- }, {
201
- name: "api folder",
202
- check: async () => {
203
- try {
204
- const apiFolderPath = path.join(currentDirectoryToProvision, "api");
205
- await fs.access(apiFolderPath);
206
- return {
207
- isValid: true
208
- };
209
- } catch (error) {
210
- return {
211
- isValid: false,
212
- errorMessage: "API folder not found"
213
- };
214
- }
215
- }
216
- }];
217
- for (const step of validationSteps) {
218
- const result = await step.check();
219
- if (!result.isValid) {
220
- return result;
221
- }
222
- }
223
- return {
224
- isValid: true
225
- };
226
- };
227
- exports.validateIntunedProject = validateIntunedProject;
228
- async function convertProjectToCodeTree(projectPath) {
229
- const ig = (0, _ignore.default)();
230
- const gitIgnorePath = await findGitIgnoreFile(projectPath);
231
- if (gitIgnorePath) {
232
- const gitIgnoreContent = await fs.readFile(gitIgnorePath, "utf-8");
233
- ig.add(gitIgnoreContent);
234
- }
235
- ig.add(_projectExclusions.default);
236
- async function traverse(dirPath) {
237
- const tree = {};
238
- const fileNames = [];
239
- const entries = await fs.readdir(dirPath, {
240
- withFileTypes: true
241
- });
242
- for (const entry of entries) {
243
- const entryPath = path.join(dirPath, entry.name);
244
- if (ig.ignores(path.relative(projectPath, entryPath))) {
245
- continue;
246
- }
247
- if (entry.isFile()) {
248
- try {
249
- const content = await fs.readFile(entryPath, "utf-8");
250
- tree[entry.name] = {
251
- file: {
252
- contents: content
253
- }
254
- };
255
- fileNames.push(path.relative(projectPath, entryPath));
256
- } catch (error) {
257
- (0, _terminal.terminal)(`^yWarning: Could not read file ${entryPath}^:\n`);
258
- }
259
- } else if (entry.isDirectory()) {
260
- const {
261
- tree: subTree,
262
- fileNames: subFileNames
263
- } = await traverse(entryPath);
264
- fileNames.push(...subFileNames);
265
- if (Object.keys(subTree).length > 0) {
266
- tree[entry.name] = {
267
- directory: subTree
268
- };
269
- }
270
- }
271
- }
272
- return {
273
- tree,
274
- fileNames
275
- };
276
- }
277
- const {
278
- tree,
279
- fileNames
280
- } = await traverse(projectPath);
281
- const filesToProvisionText = " " + fileNames.join("\n ");
282
- (0, _terminal.terminal)("^CFiles to be provisioned:^:\n");
283
- (0, _terminal.terminal)(filesToProvisionText + "\n");
284
- return tree;
285
- }
286
- async function findGitIgnoreFile(projectPath) {
287
- let currentDirectory = projectPath;
288
- while (true) {
289
- const gitIgnorePath = path.join(currentDirectory, ".gitignore");
290
- if (await fs.exists(gitIgnorePath)) {
291
- return gitIgnorePath;
292
- }
293
- const parentDirectory = path.dirname(currentDirectory);
294
- if (parentDirectory === currentDirectory) {
295
- break;
296
- }
297
- currentDirectory = parentDirectory;
298
- }
299
- return null;
300
- }
@@ -1 +0,0 @@
1
- export declare function scaffoldAuthSessionFiles(): Promise<void>;