@speedkit/cli 4.36.1 → 4.37.0

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 (310) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +12 -5
  3. package/dist/base/sk-command.d.ts +41 -0
  4. package/dist/base/sk-command.js +56 -0
  5. package/dist/commands/auto-prewarm.d.ts +6 -4
  6. package/dist/commands/auto-prewarm.js +13 -66
  7. package/dist/commands/autocomplete/fish.d.ts +2 -2
  8. package/dist/commands/autocomplete/fish.js +3 -2
  9. package/dist/commands/browser/clean.d.ts +2 -2
  10. package/dist/commands/browser/clean.js +6 -6
  11. package/dist/commands/browser/list.d.ts +2 -2
  12. package/dist/commands/browser/list.js +6 -7
  13. package/dist/commands/browser/update.d.ts +2 -2
  14. package/dist/commands/browser/update.js +9 -11
  15. package/dist/commands/bulk-deploy.d.ts +4 -2
  16. package/dist/commands/bulk-deploy.js +7 -37
  17. package/dist/commands/config/edit.d.ts +2 -2
  18. package/dist/commands/config/edit.js +2 -2
  19. package/dist/commands/config/setup.d.ts +5 -2
  20. package/dist/commands/config/setup.js +9 -19
  21. package/dist/commands/deploy.d.ts +12 -3
  22. package/dist/commands/deploy.js +14 -20
  23. package/dist/commands/diff-url-parameters.d.ts +3 -2
  24. package/dist/commands/diff-url-parameters.js +19 -16
  25. package/dist/commands/extension/add.d.ts +2 -2
  26. package/dist/commands/extension/add.js +6 -6
  27. package/dist/commands/extension/devtools.d.ts +2 -2
  28. package/dist/commands/extension/devtools.js +6 -7
  29. package/dist/commands/extension/list.d.ts +2 -2
  30. package/dist/commands/extension/list.js +5 -6
  31. package/dist/commands/extension/remove.d.ts +2 -2
  32. package/dist/commands/extension/remove.js +6 -6
  33. package/dist/commands/extension/update.d.ts +2 -2
  34. package/dist/commands/extension/update.js +5 -6
  35. package/dist/commands/find-pops.d.ts +2 -2
  36. package/dist/commands/find-pops.js +10 -11
  37. package/dist/commands/generate-customer-config.d.ts +5 -2
  38. package/dist/commands/generate-customer-config.js +9 -27
  39. package/dist/commands/generate-pop-config.d.ts +2 -2
  40. package/dist/commands/generate-pop-config.js +19 -15
  41. package/dist/commands/login.d.ts +2 -2
  42. package/dist/commands/login.js +6 -9
  43. package/dist/commands/onboarding.d.ts +19 -3
  44. package/dist/commands/onboarding.js +15 -11
  45. package/dist/commands/origin-request.d.ts +4 -2
  46. package/dist/commands/origin-request.js +10 -42
  47. package/dist/commands/prewarm.d.ts +4 -2
  48. package/dist/commands/prewarm.js +12 -56
  49. package/dist/commands/pull.d.ts +4 -2
  50. package/dist/commands/pull.js +9 -14
  51. package/dist/commands/query/parameter.d.ts +4 -2
  52. package/dist/commands/query/parameter.js +12 -19
  53. package/dist/commands/query/prewarm.d.ts +4 -2
  54. package/dist/commands/query/prewarm.js +16 -23
  55. package/dist/commands/revalidate.d.ts +4 -2
  56. package/dist/commands/revalidate.js +13 -56
  57. package/dist/commands/wpt-launcher.d.ts +2 -2
  58. package/dist/commands/wpt-launcher.js +16 -17
  59. package/dist/hooks/init/first-run.js +9 -10
  60. package/dist/models/context.d.ts +24 -0
  61. package/dist/models/context.js +31 -0
  62. package/dist/services/athena/athena-flags.d.ts +18 -0
  63. package/dist/services/athena/athena-flags.js +29 -0
  64. package/dist/services/athena/athena-service-build-context.d.ts +25 -0
  65. package/dist/services/athena/athena-service-build-context.js +4 -0
  66. package/dist/services/athena/athena-service-factory.d.ts +3 -16
  67. package/dist/services/athena/athena-service-factory.js +11 -27
  68. package/dist/services/athena/baqend-athena-service.d.ts +3 -14
  69. package/dist/services/athena/baqend-athena-service.js +8 -16
  70. package/dist/services/athena/index.d.ts +1 -0
  71. package/dist/services/athena/index.js +1 -0
  72. package/dist/services/athena/spec/baqend-athena-service.spec.js +2 -2
  73. package/dist/services/browser-fetch/browser-origin-fetch.d.ts +2 -2
  74. package/dist/services/browser-fetch/browser-origin-fetch.js +1 -1
  75. package/dist/services/browser-fetch/browser-origin-fetcher.d.ts +3 -3
  76. package/dist/services/browser-fetch/browser-origin-fetcher.js +5 -5
  77. package/dist/services/browser-fetch/spec/browser-origin-fetch.spec.js +10 -10
  78. package/dist/services/cli/cli-environment-factory.d.ts +25 -0
  79. package/dist/services/cli/cli-environment-factory.js +30 -0
  80. package/dist/services/cli/cli-environment.d.ts +73 -0
  81. package/dist/services/cli/cli-environment.js +216 -0
  82. package/dist/services/cli/cli-service-build-context.d.ts +10 -0
  83. package/dist/services/cli/cli-service-build-context.js +4 -0
  84. package/dist/services/cli/cli-service-factory.d.ts +7 -7
  85. package/dist/services/cli/cli-service-factory.js +7 -7
  86. package/dist/services/cli/cli-service-model.d.ts +0 -4
  87. package/dist/services/cli/cli-service-model.js +0 -6
  88. package/dist/services/cli/cli-service.d.ts +16 -2
  89. package/dist/services/cli/cli-service.js +17 -18
  90. package/dist/services/cli/cli-settings.d.ts +37 -0
  91. package/dist/services/cli/cli-settings.js +23 -0
  92. package/dist/services/cli/command-build-context.d.ts +23 -0
  93. package/dist/services/cli/index.d.ts +5 -1
  94. package/dist/services/cli/index.js +5 -1
  95. package/dist/services/cli/spec/cli-environment-detection.spec.js +52 -0
  96. package/dist/services/cli/spec/cli-environment.spec.js +125 -0
  97. package/dist/services/cli/spec/cli-service.spec.js +9 -19
  98. package/dist/services/config-api/client.d.ts +3 -3
  99. package/dist/services/config-api/client.js +4 -4
  100. package/dist/services/config-api/config-api-factory.js +3 -3
  101. package/dist/services/config-api/entity-manager-provider.d.ts +11 -0
  102. package/dist/services/config-api/{entity-manager-factory.js → entity-manager-provider.js} +7 -1
  103. package/dist/services/customer-config/customer-config-service-build-context.d.ts +33 -0
  104. package/dist/services/customer-config/customer-config-service-build-context.js +36 -0
  105. package/dist/services/customer-config/customer-config-service-factory.d.ts +3 -4
  106. package/dist/services/customer-config/customer-config-service-factory.js +5 -8
  107. package/dist/services/customer-config/customer-config-service.d.ts +2 -2
  108. package/dist/services/customer-config/index.d.ts +1 -1
  109. package/dist/services/customer-config/index.js +1 -1
  110. package/dist/services/customer-config/site-analyzer/index.d.ts +1 -0
  111. package/dist/services/customer-config/site-analyzer/index.js +1 -0
  112. package/dist/services/customer-config/site-analyzer/site-analyzer-service-build-context.d.ts +6 -0
  113. package/dist/services/customer-config/site-analyzer/site-analyzer-service-build-context.js +4 -0
  114. package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.d.ts +3 -3
  115. package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.js +4 -5
  116. package/dist/services/deploy/bulk/bulk-deploy-model.d.ts +0 -25
  117. package/dist/services/deploy/bulk/bulk-deploy-model.js +1 -27
  118. package/dist/services/deploy/bulk/bulk-deploy-service-build-context.d.ts +51 -0
  119. package/dist/services/deploy/bulk/bulk-deploy-service-build-context.js +50 -0
  120. package/dist/services/deploy/bulk/bulk-deploy-service-factory.d.ts +2 -4
  121. package/dist/services/deploy/bulk/bulk-deploy-service-factory.js +2 -5
  122. package/dist/services/deploy/bulk/bulk-deploy-service.d.ts +3 -2
  123. package/dist/services/deploy/bulk/config-deploy-factory.d.ts +3 -3
  124. package/dist/services/deploy/bulk/config-deploy-factory.js +16 -8
  125. package/dist/services/deploy/bulk/index.d.ts +1 -0
  126. package/dist/services/deploy/bulk/index.js +1 -0
  127. package/dist/services/deploy/checks/activation/customer-approval-check.d.ts +3 -1
  128. package/dist/services/deploy/checks/activation/customer-approval-check.js +4 -2
  129. package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.d.ts +3 -1
  130. package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.js +4 -2
  131. package/dist/services/deploy/checks/pre-deploy/split-change-check.d.ts +3 -1
  132. package/dist/services/deploy/checks/pre-deploy/split-change-check.js +4 -2
  133. package/dist/services/deploy/deploy-service-build-context.d.ts +63 -0
  134. package/dist/services/deploy/deploy-service-build-context.js +64 -0
  135. package/dist/services/deploy/deploy-service-factory.d.ts +5 -8
  136. package/dist/services/deploy/deploy-service-factory.js +28 -19
  137. package/dist/services/deploy/mr/base-config-reader.d.ts +6 -4
  138. package/dist/services/deploy/mr/base-config-reader.js +6 -8
  139. package/dist/services/deploy/mr/index.d.ts +1 -0
  140. package/dist/services/deploy/mr/index.js +1 -0
  141. package/dist/services/deploy/mr/merge-request-deploy-model.d.ts +0 -35
  142. package/dist/services/deploy/mr/merge-request-deploy-model.js +0 -34
  143. package/dist/services/deploy/mr/merge-request-deploy-service-build-context.d.ts +32 -0
  144. package/dist/services/deploy/mr/merge-request-deploy-service-build-context.js +20 -0
  145. package/dist/services/deploy/mr/merge-request-deploy-service-factory.d.ts +2 -4
  146. package/dist/services/deploy/mr/merge-request-deploy-service-factory.js +31 -10
  147. package/dist/services/deploy/mr/merge-request-deploy-service.d.ts +3 -2
  148. package/dist/services/deploy/spec/bulk/bulk-deploy-service.spec.js +14 -3
  149. package/dist/services/deploy/spec/checks/activation/customer-approval-check.spec.js +7 -5
  150. package/dist/services/deploy/spec/checks/pre-deploy/split-change-check.spec.js +2 -1
  151. package/dist/services/diff/diff-service-build-context.d.ts +14 -0
  152. package/dist/services/diff/diff-service-build-context.js +4 -0
  153. package/dist/services/diff/diff-service-factory.d.ts +4 -5
  154. package/dist/services/diff/diff-service-factory.js +4 -7
  155. package/dist/services/diff/index.d.ts +1 -1
  156. package/dist/services/diff/index.js +1 -1
  157. package/dist/services/document-handler-runtime/{context/document-handler-runtime-context.d.ts → document-handler-runtime-model.d.ts} +0 -5
  158. package/dist/services/document-handler-runtime/document-handler-runtime-service-build-context.d.ts +11 -0
  159. package/dist/services/document-handler-runtime/document-handler-runtime-service-build-context.js +4 -0
  160. package/dist/services/document-handler-runtime/document-handler-server.js +2 -2
  161. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +3 -6
  162. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +14 -14
  163. package/dist/services/document-handler-runtime/server/request.js +1 -1
  164. package/dist/services/document-handler-runtime/templates/database-mock.d.ts +1 -1
  165. package/dist/services/document-handler-runtime/templates/database-mock.js +1 -1
  166. package/dist/services/integration-api/customer-config-flags.d.ts +16 -0
  167. package/dist/services/integration-api/customer-config-flags.js +30 -0
  168. package/dist/services/integration-api/handler/install-resource-handler.d.ts +8 -0
  169. package/dist/services/integration-api/handler/install-resource-handler.js +10 -1
  170. package/dist/services/integration-api/index.d.ts +1 -0
  171. package/dist/services/integration-api/index.js +1 -0
  172. package/dist/services/integration-api/integration-api-factory.d.ts +4 -6
  173. package/dist/services/integration-api/integration-api-factory.js +11 -11
  174. package/dist/services/integration-api/integration-api-model.d.ts +0 -9
  175. package/dist/services/integration-api/integration-api-model.js +0 -16
  176. package/dist/services/integration-api/integration-api-service-build-context.d.ts +19 -0
  177. package/dist/services/integration-api/integration-api-service-build-context.js +4 -0
  178. package/dist/services/integration-api/spec/config-plugin.spec.js +1 -1
  179. package/dist/services/integration-api/spec/integration-api-service.spec.js +7 -3
  180. package/dist/services/integration-api/spec/speed-kit-config-file.spec.js +9 -2
  181. package/dist/services/integration-api/struct/config-plugin.d.ts +1 -1
  182. package/dist/services/integration-api/struct/config-plugin.js +12 -7
  183. package/dist/services/integration-api/struct/speed-kit-config-file.d.ts +18 -2
  184. package/dist/services/integration-api/struct/speed-kit-config-file.js +22 -12
  185. package/dist/services/integration-api/struct/speed-kit-config.d.ts +1 -1
  186. package/dist/services/onboarding/browse/browse-service.d.ts +18 -0
  187. package/dist/services/onboarding/browse/browse-service.js +61 -0
  188. package/dist/services/onboarding/browse/browse-url.d.ts +10 -0
  189. package/dist/services/onboarding/browse/browse-url.js +19 -0
  190. package/dist/services/onboarding/browser/config/browser-config.d.ts +3 -3
  191. package/dist/services/onboarding/browser/config/browser-config.js +5 -5
  192. package/dist/services/onboarding/browser/executable/executable-validator.d.ts +3 -3
  193. package/dist/services/onboarding/browser/executable/executable-validator.js +20 -16
  194. package/dist/services/onboarding/browser/extension/extension-downloader.d.ts +3 -3
  195. package/dist/services/onboarding/browser/extension/extension-downloader.js +8 -6
  196. package/dist/services/onboarding/browser/extension/extension-validator.d.ts +3 -3
  197. package/dist/services/onboarding/browser/extension/extension-validator.js +4 -4
  198. package/dist/services/onboarding/browser/launch-browser.d.ts +9 -0
  199. package/dist/services/onboarding/browser/launch-browser.js +20 -0
  200. package/dist/services/onboarding/error/browse-domain-error.d.ts +6 -0
  201. package/dist/services/onboarding/error/browse-domain-error.js +11 -0
  202. package/dist/services/onboarding/error/missing-customer-path-error.d.ts +6 -0
  203. package/dist/services/onboarding/error/missing-customer-path-error.js +11 -0
  204. package/dist/services/onboarding/file-events/file-watcher.js +1 -0
  205. package/dist/services/onboarding/index.d.ts +1 -1
  206. package/dist/services/onboarding/index.js +1 -1
  207. package/dist/services/onboarding/onboarding-model.d.ts +8 -24
  208. package/dist/services/onboarding/onboarding-model.js +19 -87
  209. package/dist/services/onboarding/onboarding-service-build-context.d.ts +61 -0
  210. package/dist/services/onboarding/onboarding-service-build-context.js +79 -0
  211. package/dist/services/onboarding/onboarding-service-factory.d.ts +31 -6
  212. package/dist/services/onboarding/onboarding-service-factory.js +120 -48
  213. package/dist/services/onboarding/onboarding-service.d.ts +2 -0
  214. package/dist/services/onboarding/onboarding-service.js +5 -16
  215. package/dist/services/onboarding/spec/browse/browse-url.spec.d.ts +1 -0
  216. package/dist/services/onboarding/spec/browse/browse-url.spec.js +28 -0
  217. package/dist/services/onboarding/spec/onboarding-model.spec.js +11 -6
  218. package/dist/services/onboarding/spec/onboarding-service-factory.spec.d.ts +1 -0
  219. package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +155 -0
  220. package/dist/services/origin-request/index.d.ts +1 -1
  221. package/dist/services/origin-request/index.js +1 -1
  222. package/dist/services/origin-request/origin-request-service-build-context.d.ts +52 -0
  223. package/dist/services/origin-request/origin-request-service-build-context.js +54 -0
  224. package/dist/services/origin-request/origin-request-service-factory.d.ts +2 -5
  225. package/dist/services/origin-request/origin-request-service-factory.js +12 -12
  226. package/dist/services/origin-request/origin-request-service.d.ts +2 -2
  227. package/dist/services/pop-config/index.d.ts +1 -0
  228. package/dist/services/pop-config/index.js +1 -0
  229. package/dist/services/pop-config/pop-config-factory.d.ts +4 -1
  230. package/dist/services/pop-config/pop-config-factory.js +10 -3
  231. package/dist/services/pop-config/pop-config-service-build-context.d.ts +10 -0
  232. package/dist/services/pop-config/pop-config-service-build-context.js +4 -0
  233. package/dist/services/prewarm/auto-pre-warm-factory.d.ts +3 -31
  234. package/dist/services/prewarm/auto-pre-warm-factory.js +6 -11
  235. package/dist/services/prewarm/auto-pre-warm-service-build-context.d.ts +84 -0
  236. package/dist/services/prewarm/auto-pre-warm-service-build-context.js +68 -0
  237. package/dist/services/prewarm/index.d.ts +2 -0
  238. package/dist/services/prewarm/index.js +2 -0
  239. package/dist/services/prewarm/pre-warm-factory.d.ts +4 -5
  240. package/dist/services/prewarm/pre-warm-factory.js +6 -8
  241. package/dist/services/prewarm/pre-warm-model.d.ts +0 -10
  242. package/dist/services/prewarm/pre-warm-model.js +0 -18
  243. package/dist/services/prewarm/pre-warm-service-build-context.d.ts +47 -0
  244. package/dist/services/prewarm/pre-warm-service-build-context.js +64 -0
  245. package/dist/services/pull/index.d.ts +1 -0
  246. package/dist/services/pull/index.js +1 -0
  247. package/dist/services/pull/pull-service-build-context.d.ts +28 -0
  248. package/dist/services/pull/pull-service-build-context.js +17 -0
  249. package/dist/services/pull/pull-service-factory.d.ts +3 -5
  250. package/dist/services/pull/pull-service-factory.js +13 -14
  251. package/dist/services/pull/pull-service-model.d.ts +0 -5
  252. package/dist/services/pull/pull-service-model.js +0 -9
  253. package/dist/services/query-builder/query-builder-factory.d.ts +9 -7
  254. package/dist/services/query-builder/query-builder-factory.js +26 -15
  255. package/dist/{models/cli-parameters.d.ts → services/query-builder/query-builder-flags.d.ts} +1 -120
  256. package/dist/services/query-builder/query-builder-flags.js +150 -0
  257. package/dist/services/query-builder/query-builder-model.d.ts +1 -14
  258. package/dist/services/query-builder/query-builder-service-build-context.d.ts +113 -0
  259. package/dist/services/query-builder/query-builder-service-build-context.js +68 -0
  260. package/dist/services/query-builder/query-builder-service.d.ts +3 -3
  261. package/dist/services/query-builder/spec/query-builder-flags.spec.d.ts +1 -0
  262. package/dist/{models/spec/cli-parameters.spec.js → services/query-builder/spec/query-builder-flags.spec.js} +1 -1
  263. package/dist/services/revalidate/index.d.ts +1 -0
  264. package/dist/services/revalidate/index.js +1 -0
  265. package/dist/services/revalidate/revalidate-factory.d.ts +3 -5
  266. package/dist/services/revalidate/revalidate-factory.js +2 -6
  267. package/dist/services/revalidate/revalidate-model.d.ts +0 -9
  268. package/dist/services/revalidate/revalidate-model.js +0 -8
  269. package/dist/services/revalidate/revalidate-service-build-context.d.ts +38 -0
  270. package/dist/services/revalidate/revalidate-service-build-context.js +59 -0
  271. package/dist/services/setup/browser/browser-setup-service.d.ts +3 -4
  272. package/dist/services/setup/browser/browser-setup-service.js +16 -18
  273. package/dist/services/setup/difftool/difftool-setup-service.d.ts +3 -4
  274. package/dist/services/setup/difftool/difftool-setup-service.js +5 -7
  275. package/dist/services/setup/extension/extension-setup-service.d.ts +3 -4
  276. package/dist/services/setup/extension/extension-setup-service.js +8 -10
  277. package/dist/services/setup/index.d.ts +1 -1
  278. package/dist/services/setup/index.js +1 -1
  279. package/dist/services/setup/setup-service-build-context.d.ts +27 -0
  280. package/dist/services/setup/setup-service-build-context.js +26 -0
  281. package/dist/services/setup/setup-service-factory.d.ts +2 -6
  282. package/dist/services/setup/setup-service-factory.js +10 -18
  283. package/dist/services/setup/setup-service.d.ts +4 -5
  284. package/dist/services/setup/setup-service.js +6 -7
  285. package/oclif.manifest.json +155 -147
  286. package/package.json +4 -2
  287. package/dist/models/cli-parameters.js +0 -297
  288. package/dist/services/cli/cli-config.d.ts +0 -59
  289. package/dist/services/cli/cli-config.js +0 -180
  290. package/dist/services/cli/environment.d.ts +0 -15
  291. package/dist/services/cli/environment.js +0 -40
  292. package/dist/services/cli/spec/cli-config.spec.js +0 -117
  293. package/dist/services/cli/spec/environment.spec.js +0 -28
  294. package/dist/services/config-api/entity-manager-factory.d.ts +0 -5
  295. package/dist/services/customer-config/customer-config-service-context.d.ts +0 -13
  296. package/dist/services/customer-config/customer-config-service-context.js +0 -21
  297. package/dist/services/deploy/context/deploy-context.d.ts +0 -32
  298. package/dist/services/deploy/context/deploy-context.js +0 -72
  299. package/dist/services/diff/diff-model.d.ts +0 -9
  300. package/dist/services/diff/diff-model.js +0 -12
  301. package/dist/services/origin-request/origin-request-context.d.ts +0 -13
  302. package/dist/services/origin-request/origin-request-context.js +0 -23
  303. package/dist/services/query-builder/query-command.d.ts +0 -28
  304. package/dist/services/query-builder/query-command.js +0 -37
  305. package/dist/services/setup/setup-context.d.ts +0 -14
  306. package/dist/services/setup/setup-context.js +0 -15
  307. /package/dist/{models/spec/cli-parameters.spec.d.ts → services/cli/command-build-context.js} +0 -0
  308. /package/dist/services/cli/spec/{cli-config.spec.d.ts → cli-environment-detection.spec.d.ts} +0 -0
  309. /package/dist/services/cli/spec/{environment.spec.d.ts → cli-environment.spec.d.ts} +0 -0
  310. /package/dist/services/document-handler-runtime/{context/document-handler-runtime-context.js → document-handler-runtime-model.js} +0 -0
@@ -1,37 +1,3 @@
1
- /** What `sk deploy --mr` is asked to deploy. */
2
- export class MergeRequestDeployContext {
3
- customerPath;
4
- configName;
5
- iid;
6
- approval;
7
- description;
8
- dryRun;
9
- skipPostDeployChecks;
10
- interactive;
11
- constructor(customerPath, configName,
12
- /** The number of the merged merge request. */
13
- iid, approval,
14
- /** The description of the installations. It is asked while it is left out. */
15
- description, dryRun = false,
16
- /** Leave out the checks that run after the upload, as a bulk run does. */
17
- skipPostDeployChecks = false,
18
- /**
19
- * Whether a person watches this deploy.
20
- *
21
- * They get the diff of every file the merge request changed, in the diff
22
- * tool they use for every other deploy, and they confirm the upload.
23
- */
24
- interactive = false) {
25
- this.customerPath = customerPath;
26
- this.configName = configName;
27
- this.iid = iid;
28
- this.approval = approval;
29
- this.description = description;
30
- this.dryRun = dryRun;
31
- this.skipPostDeployChecks = skipPostDeployChecks;
32
- this.interactive = interactive;
33
- }
34
- }
35
1
  /** What a deploy of one configuration ended with, or would end with. */
36
2
  export var DeployOutcome;
37
3
  (function (DeployOutcome) {
@@ -0,0 +1,32 @@
1
+ import { CliEnvironment, CommandContextValues } from "../../cli/index.js";
2
+ import { DeployCommandArgs, DeployCommandFlags } from "../deploy-service-build-context.js";
3
+ import { ApprovalAnswer } from "../policy/auto-deploy-policy.js";
4
+ /** What `sk deploy --mr` deploys, as the deploy reads it. */
5
+ export interface MergeRequestDeployOptions {
6
+ readonly customerPath: string;
7
+ readonly configName: string;
8
+ /** The number of the merged merge request. */
9
+ readonly iid: number;
10
+ readonly approval: ApprovalAnswer;
11
+ /** The description of the installations. It is asked while it is left out. */
12
+ readonly description?: string;
13
+ readonly dryRun?: boolean;
14
+ /** Leave out the checks that run after the upload, as a bulk run does. */
15
+ readonly skipPostDeployChecks?: boolean;
16
+ /**
17
+ * Whether a person watches this deploy.
18
+ *
19
+ * They get the diff of every file the merge request changed, in the diff
20
+ * tool they use for every other deploy, and they confirm the upload.
21
+ */
22
+ readonly interactive?: boolean;
23
+ }
24
+ export interface MergeRequestDeployServiceBuildContextValues extends CommandContextValues, MergeRequestDeployOptions {
25
+ }
26
+ declare const MergeRequestDeployServiceBuildContext_base: new (values: MergeRequestDeployServiceBuildContextValues) => Readonly<MergeRequestDeployServiceBuildContextValues>;
27
+ /** What `sk deploy --mr` is asked to deploy. */
28
+ export declare class MergeRequestDeployServiceBuildContext extends MergeRequestDeployServiceBuildContext_base {
29
+ /** The `--mr` deploy of `sk deploy`, from that command's args and flags. */
30
+ static create(parsedArgs: DeployCommandArgs, parsedFlags: DeployCommandFlags, environment: CliEnvironment): MergeRequestDeployServiceBuildContext;
31
+ }
32
+ export {};
@@ -0,0 +1,20 @@
1
+ import { Context } from "../../../models/context.js";
2
+ import { ApprovalAnswer } from "../policy/auto-deploy-policy.js";
3
+ /** What `sk deploy --mr` is asked to deploy. */
4
+ export class MergeRequestDeployServiceBuildContext extends Context() {
5
+ /** The `--mr` deploy of `sk deploy`, from that command's args and flags. */
6
+ static create(parsedArgs, parsedFlags, environment) {
7
+ return new MergeRequestDeployServiceBuildContext({
8
+ environment,
9
+ customerPath: parsedArgs.customerPath,
10
+ configName: parsedFlags.configName,
11
+ iid: parsedFlags.mr,
12
+ approval: (parsedFlags.approval ?? ApprovalAnswer.Skip),
13
+ description: parsedFlags.description,
14
+ dryRun: parsedFlags.dryRun,
15
+ skipPostDeployChecks: false,
16
+ // A person at the keyboard reviews the change in their diff tool.
17
+ interactive: Boolean(process.stdout.isTTY),
18
+ });
19
+ }
20
+ }
@@ -1,16 +1,14 @@
1
- import { UserCliConfig } from "../../cli/index.js";
2
1
  import { GitRepository, MergedRequest } from "../../git/index.js";
3
- import { MergeRequestDeployContext } from "./merge-request-deploy-model.js";
2
+ import { MergeRequestDeployServiceBuildContext } from "./merge-request-deploy-service-build-context.js";
4
3
  import { MergeRequestDeployService } from "./merge-request-deploy-service.js";
5
4
  export declare class MergeRequestDeployServiceFactory {
6
5
  private readonly context;
7
- private readonly cliConfig;
8
6
  /** The repository of the customer, while a caller resolved it already. */
9
7
  private readonly repository?;
10
8
  /** The merge request, while a caller looked it up already. */
11
9
  private readonly request?;
12
10
  private service?;
13
- constructor(context: MergeRequestDeployContext, cliConfig: UserCliConfig,
11
+ constructor(context: MergeRequestDeployServiceBuildContext,
14
12
  /** The repository of the customer, while a caller resolved it already. */
15
13
  repository?: GitRepository,
16
14
  /** The merge request, while a caller looked it up already. */
@@ -1,8 +1,9 @@
1
- import { CliServiceFactory } from "../../cli/index.js";
2
- import { DiffContext, DiffServiceFactory } from "../../diff/index.js";
1
+ import { BundleServiceFactory } from "../../bundler/index.js";
2
+ import { DiffServiceBuildContext, DiffServiceFactory, } from "../../diff/index.js";
3
3
  import { GitRepository } from "../../git/index.js";
4
+ import { IntegrationApiServiceBuildContext, IntegrationApiFactory, } from "../../integration-api/index.js";
4
5
  import { CustomerApprovalCheck } from "../checks/activation/customer-approval-check.js";
5
- import DeployContext from "../context/deploy-context.js";
6
+ import { DeployServiceBuildContext } from "../deploy-service-build-context.js";
6
7
  import DeployServiceFactory from "../deploy-service-factory.js";
7
8
  import { AutoDeployPolicy } from "../policy/auto-deploy-policy.js";
8
9
  import { BaseConfigReader } from "./base-config-reader.js";
@@ -11,17 +12,15 @@ import { MergeRequestDeployService } from "./merge-request-deploy-service.js";
11
12
  import { resolveDescription } from "./merge-request-description.js";
12
13
  export class MergeRequestDeployServiceFactory {
13
14
  context;
14
- cliConfig;
15
15
  repository;
16
16
  request;
17
17
  service = undefined;
18
- constructor(context, cliConfig,
18
+ constructor(context,
19
19
  /** The repository of the customer, while a caller resolved it already. */
20
20
  repository,
21
21
  /** The merge request, while a caller looked it up already. */
22
22
  request) {
23
23
  this.context = context;
24
- this.cliConfig = cliConfig;
25
24
  this.repository = repository;
26
25
  this.request = request;
27
26
  }
@@ -34,13 +33,35 @@ export class MergeRequestDeployServiceFactory {
34
33
  async build() {
35
34
  const repository = this.repository ?? GitRepository.at(this.context.customerPath);
36
35
  const request = this.request ?? repository.mergeRequest(this.context.iid);
37
- const cliService = new CliServiceFactory().getService();
36
+ const cliService = this.context.environment.cli;
38
37
  const policy = new AutoDeployPolicy(await resolveDescription(cliService, request, this.context.description), this.context.approval, this.context.interactive ? cliService : undefined);
39
- const deployFactory = new DeployServiceFactory(new DeployContext(this.context.customerPath, this.context.configName, undefined, this.context.dryRun, false, true, this.context.skipPostDeployChecks, this.context.interactive), this.cliConfig, policy);
38
+ const deployFactory = new DeployServiceFactory(new DeployServiceBuildContext({
39
+ environment: this.context.environment,
40
+ customerPath: this.context.customerPath,
41
+ configName: this.context.configName,
42
+ artifacts: [],
43
+ dryRun: this.context.dryRun ?? false,
44
+ useTestConfig: false,
45
+ installFilesOnly: true,
46
+ skipPostDeployChecks: this.context.skipPostDeployChecks,
47
+ opensDiffTool: this.context.interactive ?? false,
48
+ }), policy);
40
49
  const deployService = await deployFactory.buildService();
41
50
  // A deploy that runs without a person never opens a diff tool, so the
42
51
  // comparison only tells whether two contents are equal.
43
- const diffService = new DiffServiceFactory(new DiffContext(null, null, false)).getService();
44
- this.service = new MergeRequestDeployService(this.context, request, repository, new BaseConfigReader(repository, this.cliConfig), new LiveStateCheck(diffService), new CustomerApprovalCheck(cliService, deployFactory.files.getCustomerConfig().config, policy), deployFactory.configApi, deployFactory.files, deployFactory.configName, deployService);
52
+ const diffService = new DiffServiceFactory(new DiffServiceBuildContext({
53
+ environment: this.context.environment,
54
+ executablePath: null,
55
+ executableTemplate: null,
56
+ opensDiffTool: false,
57
+ })).getService();
58
+ this.service = new MergeRequestDeployService(this.context, request, repository, new BaseConfigReader(repository, (directory, configName) => new IntegrationApiFactory(new IntegrationApiServiceBuildContext({
59
+ environment: this.context.environment,
60
+ basePath: directory,
61
+ configName,
62
+ whitelist: [],
63
+ }))
64
+ .buildService()
65
+ .run()), new LiveStateCheck(diffService), new CustomerApprovalCheck(cliService, deployFactory.files.getCustomerConfig().config, policy, new BundleServiceFactory("./").buildService()), deployFactory.configApi, deployFactory.files, deployFactory.configName, deployService);
45
66
  }
46
67
  }
@@ -1,3 +1,4 @@
1
+ import { MergeRequestDeployOptions } from "./merge-request-deploy-service-build-context.js";
1
2
  import { ConfigApiService } from "../../config-api/index.js";
2
3
  import { GitRepository, MergedRequest } from "../../git/index.js";
3
4
  import { FileListInterface } from "../../integration-api/index.js";
@@ -5,7 +6,7 @@ import { CustomerApprovalCheck } from "../checks/activation/customer-approval-ch
5
6
  import DeployService from "../deploy-service.js";
6
7
  import { BaseConfigReader } from "./base-config-reader.js";
7
8
  import { LiveStateCheck } from "./live-state-check.js";
8
- import { MergeRequestDeployContext, MergeRequestDeployResult } from "./merge-request-deploy-model.js";
9
+ import { MergeRequestDeployResult } from "./merge-request-deploy-model.js";
9
10
  /**
10
11
  * Deploys one customer configuration of a merged merge request.
11
12
  *
@@ -25,7 +26,7 @@ export declare class MergeRequestDeployService {
25
26
  private readonly files;
26
27
  private readonly configName;
27
28
  private readonly deployService;
28
- constructor(context: MergeRequestDeployContext, request: MergedRequest, repository: GitRepository, baseReader: BaseConfigReader, liveStateCheck: LiveStateCheck, approvalCheck: CustomerApprovalCheck, configApi: ConfigApiService, files: FileListInterface, configName: string, deployService: DeployService);
29
+ constructor(context: MergeRequestDeployOptions, request: MergedRequest, repository: GitRepository, baseReader: BaseConfigReader, liveStateCheck: LiveStateCheck, approvalCheck: CustomerApprovalCheck, configApi: ConfigApiService, files: FileListInterface, configName: string, deployService: DeployService);
29
30
  /** Plans the deploy and runs it while the plan allows it. */
30
31
  run(): Promise<MergeRequestDeployResult>;
31
32
  /**
@@ -4,7 +4,6 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
4
4
  import os from "node:os";
5
5
  import path from "node:path";
6
6
  import { BulkDeployService } from "../../bulk/bulk-deploy-service.js";
7
- import { BulkDeployContext, } from "../../bulk/bulk-deploy-model.js";
8
7
  import { GitRepository } from "../../../git/index.js";
9
8
  import { DeployOutcome, } from "../../mr/index.js";
10
9
  import { ApprovalAnswer } from "../../policy/auto-deploy-policy.js";
@@ -80,7 +79,12 @@ function deployFactory(plans, deployed, failing = []) {
80
79
  function serviceOf(changedPaths, factory, cli, approval) {
81
80
  const repository = new GitRepository(root, () => "");
82
81
  repository.changedPaths = () => changedPaths;
83
- return new BulkDeployService(new BulkDeployContext(root, REQUEST.iid, approval, "a description"), repository, REQUEST, factory, cli);
82
+ return new BulkDeployService({
83
+ repositoryPath: root,
84
+ iid: REQUEST.iid,
85
+ approval,
86
+ description: "a description",
87
+ }, repository, REQUEST, factory, cli);
84
88
  }
85
89
  describe("BulkDeployService", () => {
86
90
  it("deploys every configuration the plan found deployable", async () => {
@@ -98,7 +102,14 @@ describe("BulkDeployService", () => {
98
102
  const { cli, questions } = cliAnswering(false);
99
103
  const repository = new GitRepository(root, () => "");
100
104
  repository.changedPaths = () => ["customers/gohaus/config_SpeedKit.js"];
101
- await new BulkDeployService(new BulkDeployContext(root, REQUEST.iid, ApprovalAnswer.Approved, "a description", false, true), repository, REQUEST, deployFactory({}, deployed), cli).run();
105
+ await new BulkDeployService({
106
+ repositoryPath: root,
107
+ iid: REQUEST.iid,
108
+ approval: ApprovalAnswer.Approved,
109
+ description: "a description",
110
+ dryRun: false,
111
+ assumeYes: true,
112
+ }, repository, REQUEST, deployFactory({}, deployed), cli).run();
102
113
  expect(deployed).to.deep.equal(["customers/gohaus[production]"]);
103
114
  expect(questions).to.deep.equal([]);
104
115
  });
@@ -1,6 +1,7 @@
1
1
  import { expect } from "chai";
2
2
  import { describe, it } from "mocha";
3
3
  import { CustomerApprovalCheck } from "../../../checks/activation/customer-approval-check.js";
4
+ import { BundleServiceFactory } from "../../../../bundler/index.js";
4
5
  import { CustomerConfig } from "../../../../integration-api/index.js";
5
6
  function customer(needsCustomerApproval) {
6
7
  return CustomerConfig.createFrom({
@@ -34,33 +35,34 @@ function cliAsking(answer) {
34
35
  };
35
36
  return { cli, policy, questions };
36
37
  }
38
+ const bundler = new BundleServiceFactory("./").buildService();
37
39
  describe("CustomerApprovalCheck", () => {
38
40
  it("approves without asking when the customer does not need to approve", async () => {
39
41
  const { cli, policy, questions } = cliAsking(false);
40
- const approved = await new CustomerApprovalCheck(cli, customer(false), policy).isActivationApproved(installWithSplit("1"));
42
+ const approved = await new CustomerApprovalCheck(cli, customer(false), policy, bundler).isActivationApproved(installWithSplit("1"));
41
43
  expect(approved).to.equal(true);
42
44
  expect(questions).to.deep.equal([]);
43
45
  });
44
46
  it("approves without asking while no origin serves traffic", async () => {
45
47
  const { cli, policy, questions } = cliAsking(false);
46
- const approved = await new CustomerApprovalCheck(cli, customer(true), policy).isActivationApproved(installWithSplit("0"));
48
+ const approved = await new CustomerApprovalCheck(cli, customer(true), policy, bundler).isActivationApproved(installWithSplit("0"));
47
49
  expect(approved).to.equal(true);
48
50
  expect(questions).to.deep.equal([]);
49
51
  });
50
52
  it("asks once a single origin has a split greater than 0", async () => {
51
53
  const { cli, policy, questions } = cliAsking(true);
52
- const approved = await new CustomerApprovalCheck(cli, customer(true), policy).isActivationApproved(installWithSplit('window.location.hostname === "www.example.com" ? 0.5 : 0'));
54
+ const approved = await new CustomerApprovalCheck(cli, customer(true), policy, bundler).isActivationApproved(installWithSplit('window.location.hostname === "www.example.com" ? 0.5 : 0'));
53
55
  expect(approved).to.equal(true);
54
56
  expect(questions).to.deep.equal(["Was this change approved by customer?"]);
55
57
  });
56
58
  it("withholds the approval when the question is answered with no", async () => {
57
59
  const { cli, policy } = cliAsking(false);
58
- const approved = await new CustomerApprovalCheck(cli, customer(true), policy).isActivationApproved(installWithSplit("0.1"));
60
+ const approved = await new CustomerApprovalCheck(cli, customer(true), policy, bundler).isActivationApproved(installWithSplit("0.1"));
59
61
  expect(approved).to.equal(false);
60
62
  });
61
63
  it("asks when the split cannot be evaluated", async () => {
62
64
  const { cli, policy, questions } = cliAsking(false);
63
- const approved = await new CustomerApprovalCheck(cli, customer(true), policy).isActivationApproved(installWithSplit("({}).missing.split"));
65
+ const approved = await new CustomerApprovalCheck(cli, customer(true), policy, bundler).isActivationApproved(installWithSplit("({}).missing.split"));
64
66
  expect(approved).to.equal(false);
65
67
  expect(questions).to.deep.equal(["Was this change approved by customer?"]);
66
68
  });
@@ -1,3 +1,4 @@
1
+ import { BundleServiceFactory } from "../../../../bundler/index.js";
1
2
  import { expect } from "chai";
2
3
  import { describe, it } from "mocha";
3
4
  import { Chalk } from "chalk";
@@ -39,7 +40,7 @@ function checkAnswering(answer) {
39
40
  confirm: async () => answer,
40
41
  text: async () => "",
41
42
  };
42
- return new SplitChangeCheck(cli, fileList, configApi, customer, "production", true, policy);
43
+ return new SplitChangeCheck(cli, fileList, configApi, customer, "production", true, policy, new BundleServiceFactory("./").buildService());
43
44
  }
44
45
  describe("SplitChangeCheck", () => {
45
46
  it("aborts the deploy when the split change is not confirmed", async () => {
@@ -0,0 +1,14 @@
1
+ import { CommandContextValues } from "../cli/index.js";
2
+ export interface DiffServiceBuildContextValues extends CommandContextValues {
3
+ /** The diff tool, `diffExec` in the settings; null when none is opened. */
4
+ readonly executablePath: string | null;
5
+ /** How the tool is called, `diffExecTemplate` in the settings. */
6
+ readonly executableTemplate: string | null;
7
+ /** A deploy that nobody drives never opens a diff tool. */
8
+ readonly opensDiffTool?: boolean;
9
+ }
10
+ declare const DiffServiceBuildContext_base: new (values: DiffServiceBuildContextValues) => Readonly<DiffServiceBuildContextValues>;
11
+ /** How two contents are compared, and whether a person looks at the result. */
12
+ export declare class DiffServiceBuildContext extends DiffServiceBuildContext_base {
13
+ }
14
+ export {};
@@ -0,0 +1,4 @@
1
+ import { Context } from "../../models/context.js";
2
+ /** How two contents are compared, and whether a person looks at the result. */
3
+ export class DiffServiceBuildContext extends Context() {
4
+ }
@@ -1,9 +1,8 @@
1
- import { CliServiceInterface } from "../cli/index.js";
2
- import { DiffContext, DiffService } from "./index.js";
1
+ import { DiffServiceBuildContext } from "./diff-service-build-context.js";
2
+ import { DiffService } from "./diff-service.js";
3
3
  export declare class DiffServiceFactory {
4
- private context;
5
- private cli?;
4
+ private readonly context;
6
5
  service?: DiffService;
7
- constructor(context: DiffContext, cli?: CliServiceInterface);
6
+ constructor(context: DiffServiceBuildContext);
8
7
  getService(): DiffService;
9
8
  }
@@ -1,17 +1,14 @@
1
- import { CliServiceFactory } from "../cli/index.js";
2
- import { DiffService } from "./index.js";
1
+ import { DiffService } from "./diff-service.js";
3
2
  export class DiffServiceFactory {
4
3
  context;
5
- cli;
6
4
  service = undefined;
7
- constructor(context, cli) {
5
+ constructor(context) {
8
6
  this.context = context;
9
- this.cli = cli;
10
7
  }
11
8
  getService() {
12
9
  if (!(this.service instanceof DiffService)) {
13
- const cliService = this.cli ?? new CliServiceFactory().getService();
14
- this.service = new DiffService(cliService, this.context.executablePath, this.context.executableTemplate, this.context.opensDiffTool);
10
+ const cliService = this.context.environment.cli;
11
+ this.service = new DiffService(cliService, this.context.executablePath, this.context.executableTemplate, this.context.opensDiffTool ?? true);
15
12
  }
16
13
  return this.service;
17
14
  }
@@ -1,4 +1,4 @@
1
1
  export * from "./diff-service.js";
2
2
  export * from "./html-format.js";
3
3
  export * from "./diff-service-factory.js";
4
- export * from "./diff-model.js";
4
+ export * from "./diff-service-build-context.js";
@@ -1,4 +1,4 @@
1
1
  export * from "./diff-service.js";
2
2
  export * from "./html-format.js";
3
3
  export * from "./diff-service-factory.js";
4
- export * from "./diff-model.js";
4
+ export * from "./diff-service-build-context.js";
@@ -5,8 +5,3 @@ export declare const LOCAL_DYNAMIC_FETCHER_CONFIG = "config_dynamicBlocks";
5
5
  export declare const LOCAL_STYLES = "config_dynamicStyles";
6
6
  export declare const LATEST_DYNAMIC_FETCHER_URL = "https://www.baqend.com/speed-kit/latest/dynamic-fetcher.js";
7
7
  export declare const LOCAL_TRIGGERED_BY = "STREAM:QA";
8
- export default interface DocumentHandlerRuntimeContext {
9
- readonly customerPath: string;
10
- readonly configName: string;
11
- readonly verboseLevel: boolean;
12
- }
@@ -0,0 +1,11 @@
1
+ import { CommandContextValues } from "../cli/index.js";
2
+ export interface DocumentHandlerRuntimeServiceBuildContextValues extends CommandContextValues {
3
+ readonly customerPath: string;
4
+ readonly configName: string;
5
+ readonly verboseLevel: boolean;
6
+ }
7
+ declare const DocumentHandlerRuntimeServiceBuildContext_base: new (values: DocumentHandlerRuntimeServiceBuildContextValues) => Readonly<DocumentHandlerRuntimeServiceBuildContextValues>;
8
+ /** Which customer's documentHandler runs locally, and how talkative it is. */
9
+ export declare class DocumentHandlerRuntimeServiceBuildContext extends DocumentHandlerRuntimeServiceBuildContext_base {
10
+ }
11
+ export {};
@@ -0,0 +1,4 @@
1
+ import { Context } from "../../models/context.js";
2
+ /** Which customer's documentHandler runs locally, and how talkative it is. */
3
+ export class DocumentHandlerRuntimeServiceBuildContext extends Context() {
4
+ }
@@ -1,4 +1,4 @@
1
- import { LATEST_DYNAMIC_FETCHER_URL, LOCAL_DOCUMENT_HANDLER, LOCAL_DOCUMENT_HANDLER_CONFIG, LOCAL_DYNAMIC_FETCHER, LOCAL_DYNAMIC_FETCHER_CONFIG, LOCAL_STYLES, } from "./context/document-handler-runtime-context.js";
1
+ import { LATEST_DYNAMIC_FETCHER_URL, LOCAL_DOCUMENT_HANDLER, LOCAL_DOCUMENT_HANDLER_CONFIG, LOCAL_DYNAMIC_FETCHER, LOCAL_DYNAMIC_FETCHER_CONFIG, LOCAL_STYLES, } from "./document-handler-runtime-model.js";
2
2
  import RequiredFileNotFoundError from "./error/required-file-not-found-error.js";
3
3
  import DatabaseMock from "./templates/database-mock.js";
4
4
  import * as vm from "node:vm";
@@ -166,7 +166,7 @@ export class DocumentHandlerServer {
166
166
  };
167
167
  if (!this.database) {
168
168
  const dataBaseMock = new DatabaseMock();
169
- const databaseCode = dataBaseMock.render(dataBaseMock.buildContext(this.customerConfig.origins[0], this.customerConfig.app));
169
+ const databaseCode = dataBaseMock.render(dataBaseMock.create(this.customerConfig.origins[0], this.customerConfig.app));
170
170
  const vmContext = { console: vmConsole, module: { exports: {} } };
171
171
  vm.runInNewContext(databaseCode, vmContext, { displayErrors: true });
172
172
  this.database = vmContext.module.exports;
@@ -1,13 +1,10 @@
1
1
  import { FileListInterface } from "../../integration-api/index.js";
2
- import DocumentHandlerRuntimeContext from "../context/document-handler-runtime-context.js";
3
- import { CliServiceInterface, UserCliConfig } from "../../cli/index.js";
2
+ import { DocumentHandlerRuntimeServiceBuildContext } from "../document-handler-runtime-service-build-context.js";
4
3
  import { DocumentHandlerServer } from "../document-handler-server.js";
5
4
  export default class DocumentHandlerRuntimeServiceFactory {
6
5
  private readonly context;
7
- private cliConfig;
8
- private files?;
9
- private cli?;
10
- constructor(context: DocumentHandlerRuntimeContext, cliConfig: UserCliConfig, files?: FileListInterface, cli?: CliServiceInterface);
6
+ private readonly files?;
7
+ constructor(context: DocumentHandlerRuntimeServiceBuildContext, files?: FileListInterface);
11
8
  buildDocumentHandlerServer(): Promise<DocumentHandlerServer>;
12
9
  private getCustomerConfig;
13
10
  /**
@@ -1,34 +1,34 @@
1
- import { IntegrationApiContext, IntegrationApiFactory, } from "../../integration-api/index.js";
2
- import { CliServiceFactory, } from "../../cli/index.js";
1
+ import { IntegrationApiServiceBuildContext, IntegrationApiFactory, } from "../../integration-api/index.js";
3
2
  import { DocumentHandlerServer } from "../document-handler-server.js";
4
3
  import { BundleServiceFactory } from "../../bundler/index.js";
5
- import { EntityManagerFactory } from "../../config-api/entity-manager-factory.js";
4
+ import { EntityManagerProvider } from "../../config-api/entity-manager-provider.js";
6
5
  import { safe } from "../../../helpers/safe.js";
7
6
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
8
7
  import { resolve } from "node:path";
9
8
  export default class DocumentHandlerRuntimeServiceFactory {
10
9
  context;
11
- cliConfig;
12
10
  files;
13
- cli;
14
- constructor(context, cliConfig, files, cli) {
11
+ constructor(context, files) {
15
12
  this.context = context;
16
- this.cliConfig = cliConfig;
17
13
  this.files = files;
18
- this.cli = cli;
19
14
  }
20
15
  async buildDocumentHandlerServer() {
21
- const integrationApiContext = new IntegrationApiContext(this.context.customerPath, this.context.configName, []);
16
+ const integrationApiContext = new IntegrationApiServiceBuildContext({
17
+ environment: this.context.environment,
18
+ basePath: this.context.customerPath,
19
+ configName: this.context.configName,
20
+ whitelist: [],
21
+ });
22
22
  const files = this.files ||
23
- (await new IntegrationApiFactory(integrationApiContext, this.cliConfig, this.cli)
23
+ (await new IntegrationApiFactory(integrationApiContext)
24
24
  .buildService()
25
25
  .run());
26
26
  const customerConfig = this.getCustomerConfig(files);
27
- const cliService = this.cli ?? new CliServiceFactory().getService();
27
+ const cliService = this.context.environment.cli;
28
28
  await this.installAdditionalDependencies(customerConfig, cliService);
29
29
  const bundler = new BundleServiceFactory(this.context.customerPath).buildService();
30
- const entityManagerResult = await safe(new EntityManagerFactory().getEntityManager(customerConfig.app));
31
- return new DocumentHandlerServer(customerConfig, files, bundler, cliService, this.cliConfig.nodeModulesPath, this.context.verboseLevel, entityManagerResult.success ? entityManagerResult.data : null);
30
+ const entityManagerResult = await safe(new EntityManagerProvider().getEntityManager(customerConfig.app));
31
+ return new DocumentHandlerServer(customerConfig, files, bundler, cliService, this.context.environment.nodeModulesPath, this.context.verboseLevel, entityManagerResult.success ? entityManagerResult.data : null);
32
32
  }
33
33
  getCustomerConfig(files) {
34
34
  const configFile = files.getByName("config_customer");
@@ -56,7 +56,7 @@ export default class DocumentHandlerRuntimeServiceFactory {
56
56
  }, undefined, 2)}\n`);
57
57
  }
58
58
  async installAdditionalDependencies(customerConfig, cli) {
59
- const workSpace = this.cliConfig.nodeModulesPath;
59
+ const workSpace = this.context.environment.nodeModulesPath;
60
60
  if (!customerConfig.dependencies ||
61
61
  Object.keys(customerConfig.dependencies).length === 0) {
62
62
  return;
@@ -1,4 +1,4 @@
1
- import { LOCAL_TRIGGERED_BY } from "../context/document-handler-runtime-context.js";
1
+ import { LOCAL_TRIGGERED_BY } from "../document-handler-runtime-model.js";
2
2
  export class Request {
3
3
  query;
4
4
  body;
@@ -1,6 +1,6 @@
1
1
  import AbstractTemplate from "./abstract-template.js";
2
2
  import TemplateContextInterface from "../interface/template-context-interface.js";
3
3
  export default class DatabaseMock extends AbstractTemplate {
4
- buildContext(domain: string, app: string): TemplateContextInterface;
4
+ create(domain: string, app: string): TemplateContextInterface;
5
5
  getTemplate(): string;
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import AbstractTemplate from "./abstract-template.js";
2
2
  export default class DatabaseMock extends AbstractTemplate {
3
- buildContext(domain, app) {
3
+ create(domain, app) {
4
4
  return { domain, app };
5
5
  }
6
6
  getTemplate() {
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The args and flags that name a customer config: its directory, which config
3
+ * block of it, and whether its test config is used. Shared by every build
4
+ * context of a command that works on one customer.
5
+ */
6
+ export declare const CLI_CUSTOMER_CONFIG: {
7
+ customerPath: import("@oclif/core/interfaces").Arg<string, {
8
+ exists?: boolean;
9
+ }>;
10
+ };
11
+ export declare const CLI_CONFIG_NAME: {
12
+ configName: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ };
14
+ export declare const CLI_CONFIG_IS_TEST: {
15
+ useTestConfig: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ };
@@ -0,0 +1,30 @@
1
+ import { Args, Flags } from "@oclif/core";
2
+ /**
3
+ * The args and flags that name a customer config: its directory, which config
4
+ * block of it, and whether its test config is used. Shared by every build
5
+ * context of a command that works on one customer.
6
+ */
7
+ export const CLI_CUSTOMER_CONFIG = {
8
+ customerPath: Args.directory({
9
+ name: "customerPath",
10
+ required: true,
11
+ description: "The customer config path",
12
+ }),
13
+ };
14
+ export const CLI_CONFIG_NAME = {
15
+ configName: Flags.string({
16
+ char: "c",
17
+ default: "production",
18
+ description: "The costumer config name",
19
+ required: false,
20
+ }),
21
+ };
22
+ // to enable testMode for deploy and onboarding command
23
+ // it will set the field app to the configured testApp
24
+ // and name to the original configured app
25
+ export const CLI_CONFIG_IS_TEST = {
26
+ useTestConfig: Flags.boolean({
27
+ char: "t",
28
+ description: "Override app with configured testApp",
29
+ }),
30
+ };
@@ -1,6 +1,14 @@
1
1
  import FileHandler from "./file-handler.js";
2
2
  import { InstallResourceInterface } from "../integration-api-model.js";
3
+ import type { BundleService } from "../../bundler/index.js";
4
+ import FileReader from "../file-reader.js";
3
5
  export default class InstallResourceHandler extends FileHandler {
6
+ private readonly bundler;
7
+ /**
8
+ * @param fileReader reads the files of the customer directory
9
+ * @param bundler what `config_SpeedKit.js` is bundled with before it is read
10
+ */
11
+ constructor(fileReader: FileReader, bundler: BundleService);
4
12
  allowedFiles: string[];
5
13
  readonly remoteKeyMapping: {
6
14
  config_SpeedKit: string;
@@ -3,6 +3,15 @@ import { InstallResourceFile, SpeedKitConfigFile, } from "../integration-api-mod
3
3
  import ApplicationError from "../../error-handling/error/application-error.js";
4
4
  import { INTEGRATION_FILES } from "../../../models/files.js";
5
5
  export default class InstallResourceHandler extends FileHandler {
6
+ bundler;
7
+ /**
8
+ * @param fileReader reads the files of the customer directory
9
+ * @param bundler what `config_SpeedKit.js` is bundled with before it is read
10
+ */
11
+ constructor(fileReader, bundler) {
12
+ super(fileReader);
13
+ this.bundler = bundler;
14
+ }
6
15
  allowedFiles = [
7
16
  "config_SpeedKit",
8
17
  "config_documentHandler",
@@ -35,7 +44,7 @@ export default class InstallResourceHandler extends FileHandler {
35
44
  // config_SpeedKit is more than a file to upload: it is the config itself,
36
45
  // and everything downstream reads it through its own struct.
37
46
  if (fileName === INTEGRATION_FILES.CONFIG.SPEED_KIT) {
38
- return new SpeedKitConfigFile(fileName, filePath, content, remoteKey);
47
+ return new SpeedKitConfigFile({ name: fileName, path: filePath, content, remoteKey }, this.bundler);
39
48
  }
40
49
  return new InstallResourceFile(fileName, filePath, content, remoteKey);
41
50
  }
@@ -1,3 +1,4 @@
1
1
  export * from "./integration-api-model.js";
2
+ export * from "./integration-api-service-build-context.js";
2
3
  export * from "./integration-api-factory.js";
3
4
  export * from "./integration-api-service.js";