@speedkit/cli 4.35.1 → 4.36.1

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 (349) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +43 -34
  3. package/dist/commands/auto-prewarm.js +1 -1
  4. package/dist/commands/browser/clean.js +1 -2
  5. package/dist/commands/browser/list.js +1 -2
  6. package/dist/commands/browser/update.js +1 -2
  7. package/dist/commands/bulk-deploy.d.ts +19 -0
  8. package/dist/commands/bulk-deploy.js +52 -0
  9. package/dist/commands/config/setup.js +4 -3
  10. package/dist/commands/deploy.d.ts +2 -0
  11. package/dist/commands/deploy.js +34 -3
  12. package/dist/commands/diff-url-parameters.d.ts +2 -2
  13. package/dist/commands/diff-url-parameters.js +12 -5
  14. package/dist/commands/extension/add.js +1 -1
  15. package/dist/commands/extension/devtools.js +1 -1
  16. package/dist/commands/extension/list.js +1 -1
  17. package/dist/commands/extension/remove.js +1 -1
  18. package/dist/commands/extension/update.js +1 -1
  19. package/dist/commands/find-pops.js +3 -2
  20. package/dist/commands/generate-pop-config.js +9 -13
  21. package/dist/commands/onboarding.js +1 -1
  22. package/dist/commands/origin-request.js +1 -1
  23. package/dist/commands/pull.js +1 -1
  24. package/dist/commands/revalidate.js +4 -3
  25. package/dist/commands/wpt-launcher.js +3 -2
  26. package/dist/helpers/{chrome-flags.spec.js → spec/chrome-flags.spec.js} +1 -1
  27. package/dist/helpers/{origin-proxy.spec.js → spec/origin-proxy.spec.js} +1 -1
  28. package/dist/hooks/init/first-run.js +3 -3
  29. package/dist/hooks/{init → spec/init}/dns-result-order.spec.js +1 -1
  30. package/dist/hooks/{init → spec/init}/http1-global-dispatcher.spec.js +1 -1
  31. package/dist/models/cli-parameters.d.ts +0 -2
  32. package/dist/models/cli-parameters.js +0 -2
  33. package/dist/models/{cli-parameters.spec.js → spec/cli-parameters.spec.js} +1 -1
  34. package/dist/services/athena/athena-service-factory.d.ts +3 -1
  35. package/dist/services/athena/athena-service-factory.js +4 -2
  36. package/dist/services/athena/{athena-service.spec.js → spec/athena-service.spec.js} +1 -1
  37. package/dist/services/athena/{baqend-athena-service.spec.js → spec/baqend-athena-service.spec.js} +2 -2
  38. package/dist/services/browser-fetch/browser-origin-fetch.d.ts +1 -1
  39. package/dist/services/browser-fetch/browser-origin-fetcher.d.ts +1 -1
  40. package/dist/services/browser-fetch/{browser-origin-fetch.spec.js → spec/browser-origin-fetch.spec.js} +2 -2
  41. package/dist/services/browser-fetch/{browser-origin-fetcher.spec.js → spec/browser-origin-fetcher.spec.js} +1 -1
  42. package/dist/services/browser-fetch/{browser-response.spec.js → spec/browser-response.spec.js} +1 -1
  43. package/dist/services/browser-fetch/{device-emulation.spec.js → spec/device-emulation.spec.js} +2 -2
  44. package/dist/services/bundler/{bundle-service.spec.js → spec/bundle-service.spec.js} +1 -1
  45. package/dist/{helpers → services/cli}/cli-config.js +1 -1
  46. package/dist/services/cli/cli-service-factory.d.ts +10 -2
  47. package/dist/services/cli/cli-service-factory.js +11 -9
  48. package/dist/services/cli/cli-service-model.d.ts +10 -2
  49. package/dist/services/cli/cli-service.d.ts +37 -0
  50. package/dist/services/cli/cli-service.js +90 -3
  51. package/dist/{helpers/clipboard.d.ts → services/cli/clipboard/clipboard-service.d.ts} +3 -1
  52. package/dist/{helpers/clipboard.js → services/cli/clipboard/clipboard-service.js} +6 -1
  53. package/dist/services/cli/clipboard/index.d.ts +1 -0
  54. package/dist/services/cli/clipboard/index.js +1 -0
  55. package/dist/services/cli/index.d.ts +1 -0
  56. package/dist/services/cli/index.js +1 -0
  57. package/dist/{helpers → services/cli/spec}/cli-config.spec.js +1 -1
  58. package/dist/services/cli/{cli-service.spec.js → spec/cli-service.spec.js} +42 -1
  59. package/dist/{helpers → services/cli/spec}/environment.spec.js +1 -1
  60. package/dist/services/customer-config/customer-config-service-factory.d.ts +3 -1
  61. package/dist/services/customer-config/customer-config-service-factory.js +7 -3
  62. package/dist/services/customer-config/customer-config-service.d.ts +4 -2
  63. package/dist/services/customer-config/customer-config-service.js +4 -3
  64. package/dist/services/customer-config/site-analyzer/index.d.ts +3 -0
  65. package/dist/services/customer-config/site-analyzer/index.js +3 -0
  66. package/dist/{helpers/site-analyzer.d.ts → services/customer-config/site-analyzer/site-analyzer-model.d.ts} +0 -1
  67. package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.d.ts +7 -0
  68. package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.js +11 -0
  69. package/dist/services/customer-config/site-analyzer/site-analyzer-service.d.ts +16 -0
  70. package/dist/{helpers/site-analyzer.js → services/customer-config/site-analyzer/site-analyzer-service.js} +20 -5
  71. package/dist/services/deploy/bulk/bulk-deploy-model.d.ts +46 -0
  72. package/dist/services/deploy/bulk/bulk-deploy-model.js +27 -0
  73. package/dist/services/deploy/bulk/bulk-deploy-service-factory.d.ts +11 -0
  74. package/dist/services/deploy/bulk/bulk-deploy-service-factory.js +24 -0
  75. package/dist/services/deploy/bulk/bulk-deploy-service.d.ts +47 -0
  76. package/dist/services/deploy/bulk/bulk-deploy-service.js +201 -0
  77. package/dist/services/deploy/bulk/config-deploy-factory.d.ts +13 -0
  78. package/dist/services/deploy/bulk/config-deploy-factory.js +20 -0
  79. package/dist/services/deploy/bulk/index.d.ts +5 -0
  80. package/dist/services/deploy/bulk/index.js +5 -0
  81. package/dist/services/deploy/bulk/touched-configs.d.ts +12 -0
  82. package/dist/services/deploy/bulk/touched-configs.js +54 -0
  83. package/dist/services/deploy/checks/activation/customer-approval-check.d.ts +3 -1
  84. package/dist/services/deploy/checks/activation/customer-approval-check.js +5 -2
  85. package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.d.ts +4 -2
  86. package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.js +6 -3
  87. package/dist/services/deploy/checks/post-deploy/refresh-deployment-job-check.d.ts +2 -2
  88. package/dist/services/deploy/checks/post-deploy/revalidated-module-check.d.ts +2 -2
  89. package/dist/services/deploy/checks/post-deploy/save-files-check.d.ts +4 -2
  90. package/dist/services/deploy/checks/post-deploy/save-files-check.js +5 -2
  91. package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.d.ts +3 -1
  92. package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.js +9 -5
  93. package/dist/services/deploy/checks/pre-deploy/split-change-check.d.ts +3 -1
  94. package/dist/services/deploy/checks/pre-deploy/split-change-check.js +8 -5
  95. package/dist/services/deploy/context/deploy-context.d.ts +21 -1
  96. package/dist/services/deploy/context/deploy-context.js +30 -1
  97. package/dist/services/deploy/deploy-service-factory.d.ts +15 -2
  98. package/dist/services/deploy/deploy-service-factory.js +43 -20
  99. package/dist/services/deploy/deploy-service.d.ts +2 -2
  100. package/dist/services/deploy/error/deploy-aborted-error.d.ts +12 -0
  101. package/dist/services/deploy/error/deploy-aborted-error.js +16 -0
  102. package/dist/services/deploy/handler/customer-config-handler.d.ts +4 -2
  103. package/dist/services/deploy/handler/customer-config-handler.js +11 -7
  104. package/dist/services/deploy/handler/install-resource-handler.d.ts +4 -2
  105. package/dist/services/deploy/handler/install-resource-handler.js +12 -7
  106. package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.d.ts +4 -2
  107. package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.js +5 -2
  108. package/dist/services/deploy/handler/module-handler.d.ts +4 -2
  109. package/dist/services/deploy/handler/module-handler.js +7 -4
  110. package/dist/services/deploy/handler/server-config-handler.d.ts +4 -2
  111. package/dist/services/deploy/handler/server-config-handler.js +6 -3
  112. package/dist/services/deploy/mr/base-config-reader.d.ts +25 -0
  113. package/dist/services/deploy/mr/base-config-reader.js +55 -0
  114. package/dist/services/deploy/mr/index.d.ts +6 -0
  115. package/dist/services/deploy/mr/index.js +6 -0
  116. package/dist/services/deploy/mr/live-state-check.d.ts +38 -0
  117. package/dist/services/deploy/mr/live-state-check.js +81 -0
  118. package/dist/services/deploy/mr/merge-request-deploy-model.d.ts +59 -0
  119. package/dist/services/deploy/mr/merge-request-deploy-model.js +50 -0
  120. package/dist/services/deploy/mr/merge-request-deploy-service-factory.d.ts +20 -0
  121. package/dist/services/deploy/mr/merge-request-deploy-service-factory.js +46 -0
  122. package/dist/services/deploy/mr/merge-request-deploy-service.d.ts +61 -0
  123. package/dist/services/deploy/mr/merge-request-deploy-service.js +189 -0
  124. package/dist/services/deploy/mr/merge-request-description.d.ts +16 -0
  125. package/dist/services/deploy/mr/merge-request-description.js +27 -0
  126. package/dist/services/deploy/policy/auto-deploy-policy.d.ts +43 -0
  127. package/dist/services/deploy/policy/auto-deploy-policy.js +77 -0
  128. package/dist/services/deploy/policy/deploy-policy-model.d.ts +61 -0
  129. package/dist/services/deploy/policy/deploy-policy-model.js +41 -0
  130. package/dist/services/deploy/policy/index.d.ts +2 -0
  131. package/dist/services/deploy/policy/index.js +2 -0
  132. package/dist/services/deploy/policy/interactive-deploy-policy.d.ts +15 -0
  133. package/dist/services/deploy/policy/interactive-deploy-policy.js +16 -0
  134. package/dist/services/deploy/spec/bulk/bulk-deploy-service.spec.js +146 -0
  135. package/dist/services/deploy/spec/bulk/touched-configs.spec.js +77 -0
  136. package/dist/services/deploy/{checks → spec/checks}/activation/customer-approval-check.spec.js +20 -17
  137. package/dist/services/deploy/{checks → spec/checks}/post-deploy/refresh-deployment-job-check.spec.js +2 -2
  138. package/dist/services/deploy/spec/checks/pre-deploy/split-change-check.spec.js +55 -0
  139. package/dist/services/deploy/spec/handler/module-handler.spec.js +49 -0
  140. package/dist/services/deploy/{handler → spec/handler}/testing-installation-links.spec.js +1 -1
  141. package/dist/services/deploy/spec/mr/live-state-check.spec.js +74 -0
  142. package/dist/services/deploy/spec/mr/merge-request-description.spec.js +55 -0
  143. package/dist/services/deploy/spec/policy/auto-deploy-policy.spec.js +83 -0
  144. package/dist/services/diff/diff-model.d.ts +5 -1
  145. package/dist/services/diff/diff-model.js +5 -1
  146. package/dist/services/diff/diff-service-factory.d.ts +3 -1
  147. package/dist/services/diff/diff-service-factory.js +5 -3
  148. package/dist/services/diff/diff-service.d.ts +11 -2
  149. package/dist/services/diff/diff-service.js +32 -7
  150. package/dist/services/diff/index.d.ts +1 -0
  151. package/dist/services/diff/index.js +1 -0
  152. package/dist/services/document-handler-runtime/context/document-handler-runtime-context.d.ts +2 -14
  153. package/dist/services/document-handler-runtime/context/document-handler-runtime-context.js +0 -52
  154. package/dist/services/document-handler-runtime/document-handler-server.d.ts +2 -2
  155. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +3 -11
  156. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +6 -72
  157. package/dist/services/document-handler-runtime/{document-handler-abort.spec.js → spec/document-handler-abort.spec.js} +2 -2
  158. package/dist/services/git/git-repository-model.d.ts +13 -0
  159. package/dist/services/git/git-repository.d.ts +35 -0
  160. package/dist/services/git/git-repository.js +120 -0
  161. package/dist/services/git/index.d.ts +2 -0
  162. package/dist/services/git/index.js +2 -0
  163. package/dist/services/git/spec/git-repository.spec.js +87 -0
  164. package/dist/services/integration-api/handler/customer-config-handler.d.ts +2 -2
  165. package/dist/services/integration-api/integration-api-factory.d.ts +3 -2
  166. package/dist/services/integration-api/integration-api-factory.js +5 -3
  167. package/dist/services/integration-api/spec/speed-kit-config-file.spec.js +1 -1
  168. package/dist/services/integration-api/struct/customer-config-file.js +1 -1
  169. package/dist/services/integration-api/virtual/virtual-file-handler.d.ts +2 -2
  170. package/dist/services/onboarding/browser/config/browser-config.d.ts +1 -1
  171. package/dist/services/onboarding/browser/executable/executable-validator.d.ts +1 -2
  172. package/dist/services/onboarding/browser/extension/extension-downloader.d.ts +1 -2
  173. package/dist/services/onboarding/browser/extension/extension-validator.d.ts +1 -2
  174. package/dist/services/onboarding/dashboard/diff-against-current-page.d.ts +2 -2
  175. package/dist/services/onboarding/dashboard/diff-against-current-page.js +1 -1
  176. package/dist/services/onboarding/dashboard/request-diff-service.d.ts +3 -1
  177. package/dist/services/onboarding/dashboard/request-diff-service.js +5 -3
  178. package/dist/services/onboarding/fetch-event-handler.d.ts +2 -2
  179. package/dist/services/onboarding/fetch-events/speed-kit-install-js.d.ts +3 -1
  180. package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +5 -3
  181. package/dist/services/onboarding/file-events/file-watcher.d.ts +2 -2
  182. package/dist/services/onboarding/file-events/file-watcher.js +2 -2
  183. package/dist/services/onboarding/onboarding-model.d.ts +1 -1
  184. package/dist/services/onboarding/onboarding-service-factory.d.ts +3 -2
  185. package/dist/services/onboarding/onboarding-service-factory.js +17 -17
  186. package/dist/services/onboarding/onboarding-service.d.ts +2 -2
  187. package/dist/services/onboarding/request-cache/cache.d.ts +2 -2
  188. package/dist/services/onboarding/server-config/index.d.ts +2 -2
  189. package/dist/services/onboarding/{browser → spec/browser}/executable/headed-user-agent.spec.js +1 -1
  190. package/dist/services/onboarding/{empty-service-worker.spec.js → spec/empty-service-worker.spec.js} +1 -1
  191. package/dist/services/onboarding/{onboarding-model.spec.js → spec/onboarding-model.spec.js} +2 -2
  192. package/dist/services/onboarding/{virtual-orestes-app → spec/virtual-orestes-app}/crawler.spec.js +1 -1
  193. package/dist/services/onboarding/{virtual-orestes-app → spec/virtual-orestes-app}/origin-error-cause.spec.js +1 -1
  194. package/dist/services/onboarding/virtual-orestes-app/crawler.d.ts +2 -2
  195. package/dist/services/onboarding/virtual-orestes-app/index.d.ts +2 -2
  196. package/dist/services/origin-request/asset-variations.js +1 -1
  197. package/dist/services/origin-request/origin-request-service-factory.d.ts +3 -2
  198. package/dist/services/origin-request/origin-request-service-factory.js +8 -6
  199. package/dist/services/origin-request/origin-request-service.d.ts +2 -2
  200. package/dist/services/origin-request/{asset-variations.spec.js → spec/asset-variations.spec.js} +1 -1
  201. package/dist/services/prewarm/assets/asset-api-client.d.ts +3 -1
  202. package/dist/services/prewarm/assets/asset-api-client.js +5 -3
  203. package/dist/services/prewarm/auto-pre-warm-factory.d.ts +3 -2
  204. package/dist/services/prewarm/auto-pre-warm-factory.js +8 -5
  205. package/dist/{helpers → services/prewarm}/normalize.d.ts +0 -6
  206. package/dist/{helpers → services/prewarm}/normalize.js +0 -8
  207. package/dist/services/prewarm/pre-warm-factory.d.ts +3 -1
  208. package/dist/services/prewarm/pre-warm-factory.js +7 -4
  209. package/dist/services/prewarm/{csv-reader.spec.js → spec/csv-reader.spec.js} +1 -1
  210. package/dist/services/prewarm/{prewarm-targets.spec.js → spec/prewarm-targets.spec.js} +1 -1
  211. package/dist/services/pull/pull-service-factory.d.ts +3 -2
  212. package/dist/services/pull/pull-service-factory.js +8 -6
  213. package/dist/services/query-builder/query-builder-factory.d.ts +3 -2
  214. package/dist/services/query-builder/query-builder-factory.js +9 -7
  215. package/dist/services/query-builder/query-builder-service.js +4 -5
  216. package/dist/services/query-builder/query-command.js +1 -1
  217. package/dist/services/query-builder/{queries/spec → spec/queries}/golden.spec.js +3 -3
  218. package/dist/services/query-builder/{queries/spec → spec/queries}/pops-query.spec.js +2 -2
  219. package/dist/services/query-builder/{queries/spec → spec/queries}/queries.spec.js +3 -3
  220. package/dist/services/query-builder/{queries/spec → spec/queries}/reported-bugs.spec.js +2 -2
  221. package/dist/services/query-builder/{query-builder-service.spec.js → spec/query-builder-service.spec.js} +4 -4
  222. package/dist/services/query-builder/{rules/spec → spec/rules}/pattern-language.spec.js +1 -1
  223. package/dist/services/query-builder/{rules/spec → spec/rules}/rule-parser.spec.js +1 -1
  224. package/dist/services/query-builder/{rules/spec → spec/rules}/rule-reducer.spec.js +2 -2
  225. package/dist/services/query-builder/{rules/spec → spec/rules}/rule-relevance.spec.js +2 -2
  226. package/dist/services/query-builder/{rules/spec → spec/rules}/rule-to-sql.spec.js +2 -2
  227. package/dist/services/query-builder/{rules/spec → spec/rules}/runtime-semantics.spec.js +1 -1
  228. package/dist/services/query-builder/spec/rules/strip-parameters.spec.d.ts +1 -0
  229. package/dist/services/query-builder/{rules/spec → spec/rules}/strip-parameters.spec.js +3 -3
  230. package/dist/services/query-builder/spec/sql/expression.spec.d.ts +1 -0
  231. package/dist/services/query-builder/{sql/spec → spec/sql}/expression.spec.js +2 -2
  232. package/dist/services/query-builder/spec/sql/format.spec.d.ts +1 -0
  233. package/dist/services/query-builder/{sql/spec → spec/sql}/format.spec.js +2 -2
  234. package/dist/services/query-builder/spec/sql/predicate.spec.d.ts +1 -0
  235. package/dist/services/query-builder/{sql/spec → spec/sql}/predicate.spec.js +1 -1
  236. package/dist/services/query-builder/spec/sql/regex.spec.d.ts +1 -0
  237. package/dist/services/query-builder/{sql/spec → spec/sql}/regex.spec.js +1 -1
  238. package/dist/services/revalidate/revalidate-factory.d.ts +3 -1
  239. package/dist/services/revalidate/revalidate-factory.js +6 -3
  240. package/dist/services/revalidate/revalidate-service.d.ts +2 -2
  241. package/dist/services/revalidate/spec/revalidate-service.spec.d.ts +1 -0
  242. package/dist/services/revalidate/{revalidate-service.spec.js → spec/revalidate-service.spec.js} +1 -1
  243. package/dist/services/setup/browser/browser-setup-service.d.ts +1 -2
  244. package/dist/services/setup/difftool/difftool-setup-service.d.ts +1 -2
  245. package/dist/services/setup/extension/extension-installer.d.ts +1 -1
  246. package/dist/services/setup/extension/extension-setup-service.d.ts +1 -2
  247. package/dist/services/setup/setup-service-factory.d.ts +3 -1
  248. package/dist/services/setup/setup-service-factory.js +5 -4
  249. package/dist/services/setup/setup-service.d.ts +1 -2
  250. package/dist/services/setup/spec/extension/crx.spec.d.ts +1 -0
  251. package/dist/services/setup/{extension → spec/extension}/crx.spec.js +1 -1
  252. package/dist/services/setup/spec/extension/webstore.spec.d.ts +1 -0
  253. package/dist/services/setup/{extension → spec/extension}/webstore.spec.js +1 -1
  254. package/dist/services/setup/spec/os/tool-registry.spec.d.ts +1 -0
  255. package/dist/services/setup/{os → spec/os}/tool-registry.spec.js +1 -1
  256. package/oclif.manifest.json +139 -84
  257. package/package.json +3 -2
  258. package/dist/commands/document-handler.d.ts +0 -16
  259. package/dist/commands/document-handler.js +0 -32
  260. package/dist/helpers/customer-config.d.ts +0 -45
  261. package/dist/helpers/customer-config.js +0 -136
  262. package/dist/helpers/file-helper.d.ts +0 -8
  263. package/dist/helpers/file-helper.js +0 -28
  264. package/dist/helpers/is-directory.d.ts +0 -5
  265. package/dist/helpers/is-directory.js +0 -19
  266. package/dist/helpers/is-file.d.ts +0 -5
  267. package/dist/helpers/is-file.js +0 -19
  268. package/dist/helpers/logging-helper.d.ts +0 -15
  269. package/dist/helpers/logging-helper.js +0 -23
  270. package/dist/helpers/scrape.d.ts +0 -1
  271. package/dist/helpers/scrape.js +0 -8
  272. package/dist/helpers/speed-kit-rule-to-reg-exp.d.ts +0 -1
  273. package/dist/helpers/speed-kit-rule-to-reg-exp.js +0 -6
  274. package/dist/models/install.d.ts +0 -24
  275. package/dist/services/config-api-service.d.ts +0 -21
  276. package/dist/services/config-api-service.js +0 -107
  277. package/dist/services/diff-service.d.ts +0 -27
  278. package/dist/services/diff-service.js +0 -116
  279. package/dist/services/document-handler-runtime/document-handler-runtime-service.d.ts +0 -31
  280. package/dist/services/document-handler-runtime/document-handler-runtime-service.js +0 -222
  281. package/dist/services/document-handler-runtime/interface/document-handler-runtime-config-interface.d.ts +0 -3
  282. package/dist/services/document-handler-runtime/interface/document-handler-runtime-config-interface.js +0 -3
  283. package/dist/services/document-handler-runtime/templates/execute-document-handler.d.ts +0 -6
  284. package/dist/services/document-handler-runtime/templates/execute-document-handler.js +0 -74
  285. package/dist/services/document-handler-runtime/templates/orestes-mock.d.ts +0 -9
  286. package/dist/services/document-handler-runtime/templates/orestes-mock.js +0 -166
  287. package/dist/services/document-handler-runtime/templates/package-json.d.ts +0 -6
  288. package/dist/services/document-handler-runtime/templates/package-json.js +0 -17
  289. package/dist/services/document-handler-runtime/templates/test.d.ts +0 -6
  290. package/dist/services/document-handler-runtime/templates/test.js +0 -64
  291. /package/dist/helpers/{chrome-flags.spec.d.ts → spec/chrome-flags.spec.d.ts} +0 -0
  292. /package/dist/helpers/{origin-proxy.spec.d.ts → spec/origin-proxy.spec.d.ts} +0 -0
  293. /package/dist/hooks/{init → spec/init}/dns-result-order.spec.d.ts +0 -0
  294. /package/dist/hooks/{init → spec/init}/http1-global-dispatcher.spec.d.ts +0 -0
  295. /package/dist/models/{cli-parameters.spec.d.ts → spec/cli-parameters.spec.d.ts} +0 -0
  296. /package/dist/services/athena/{athena-service.spec.d.ts → spec/athena-service.spec.d.ts} +0 -0
  297. /package/dist/services/athena/{baqend-athena-service.spec.d.ts → spec/baqend-athena-service.spec.d.ts} +0 -0
  298. /package/dist/services/browser-fetch/{browser-origin-fetch.spec.d.ts → spec/browser-origin-fetch.spec.d.ts} +0 -0
  299. /package/dist/services/browser-fetch/{browser-origin-fetcher.spec.d.ts → spec/browser-origin-fetcher.spec.d.ts} +0 -0
  300. /package/dist/services/browser-fetch/{browser-response.spec.d.ts → spec/browser-response.spec.d.ts} +0 -0
  301. /package/dist/services/browser-fetch/{device-emulation.spec.d.ts → spec/device-emulation.spec.d.ts} +0 -0
  302. /package/dist/services/bundler/{bundle-service.spec.d.ts → spec/bundle-service.spec.d.ts} +0 -0
  303. /package/dist/{helpers → services/cli}/cli-config.d.ts +0 -0
  304. /package/dist/{helpers → services/cli}/environment.d.ts +0 -0
  305. /package/dist/{helpers → services/cli}/environment.js +0 -0
  306. /package/dist/{helpers → services/cli/spec}/cli-config.spec.d.ts +0 -0
  307. /package/dist/services/cli/{cli-service.spec.d.ts → spec/cli-service.spec.d.ts} +0 -0
  308. /package/dist/{helpers → services/cli/spec}/environment.spec.d.ts +0 -0
  309. /package/dist/{models/install.js → services/customer-config/site-analyzer/site-analyzer-model.js} +0 -0
  310. /package/dist/services/deploy/{checks/activation/customer-approval-check.spec.d.ts → spec/bulk/bulk-deploy-service.spec.d.ts} +0 -0
  311. /package/dist/services/deploy/{checks/post-deploy/refresh-deployment-job-check.spec.d.ts → spec/bulk/touched-configs.spec.d.ts} +0 -0
  312. /package/dist/services/deploy/{handler/testing-installation-links.spec.d.ts → spec/checks/activation/customer-approval-check.spec.d.ts} +0 -0
  313. /package/dist/services/{document-handler-runtime/document-handler-abort.spec.d.ts → deploy/spec/checks/post-deploy/refresh-deployment-job-check.spec.d.ts} +0 -0
  314. /package/dist/services/{onboarding/browser/executable/headed-user-agent.spec.d.ts → deploy/spec/checks/pre-deploy/split-change-check.spec.d.ts} +0 -0
  315. /package/dist/services/{onboarding/empty-service-worker.spec.d.ts → deploy/spec/handler/module-handler.spec.d.ts} +0 -0
  316. /package/dist/services/{onboarding/onboarding-model.spec.d.ts → deploy/spec/handler/testing-installation-links.spec.d.ts} +0 -0
  317. /package/dist/services/{onboarding/virtual-orestes-app/crawler.spec.d.ts → deploy/spec/mr/live-state-check.spec.d.ts} +0 -0
  318. /package/dist/services/{onboarding/virtual-orestes-app/origin-error-cause.spec.d.ts → deploy/spec/mr/merge-request-description.spec.d.ts} +0 -0
  319. /package/dist/services/{origin-request/asset-variations.spec.d.ts → deploy/spec/policy/auto-deploy-policy.spec.d.ts} +0 -0
  320. /package/dist/{helpers/html-format-helper.d.ts → services/diff/html-format.d.ts} +0 -0
  321. /package/dist/{helpers/html-format-helper.js → services/diff/html-format.js} +0 -0
  322. /package/dist/services/{prewarm/csv-reader.spec.d.ts → document-handler-runtime/spec/document-handler-abort.spec.d.ts} +0 -0
  323. /package/dist/services/{prewarm/prewarm-targets.spec.d.ts → git/git-repository-model.js} +0 -0
  324. /package/dist/services/{query-builder/queries/spec/golden.spec.d.ts → git/spec/git-repository.spec.d.ts} +0 -0
  325. /package/dist/{helpers → services/integration-api}/array-helper.d.ts +0 -0
  326. /package/dist/{helpers → services/integration-api}/array-helper.js +0 -0
  327. /package/dist/services/{query-builder/queries/spec/pops-query.spec.d.ts → onboarding/spec/browser/executable/headed-user-agent.spec.d.ts} +0 -0
  328. /package/dist/services/{query-builder/queries/spec/queries.spec.d.ts → onboarding/spec/empty-service-worker.spec.d.ts} +0 -0
  329. /package/dist/services/{query-builder/queries/spec/reported-bugs.spec.d.ts → onboarding/spec/onboarding-model.spec.d.ts} +0 -0
  330. /package/dist/services/{query-builder/query-builder-service.spec.d.ts → onboarding/spec/virtual-orestes-app/crawler.spec.d.ts} +0 -0
  331. /package/dist/services/{query-builder/rules/spec/pattern-language.spec.d.ts → onboarding/spec/virtual-orestes-app/origin-error-cause.spec.d.ts} +0 -0
  332. /package/dist/{helpers → services/origin-request}/java-regex.d.ts +0 -0
  333. /package/dist/{helpers → services/origin-request}/java-regex.js +0 -0
  334. /package/dist/services/{query-builder/rules/spec/rule-parser.spec.d.ts → origin-request/spec/asset-variations.spec.d.ts} +0 -0
  335. /package/dist/services/{query-builder/rules/spec/rule-reducer.spec.d.ts → prewarm/spec/csv-reader.spec.d.ts} +0 -0
  336. /package/dist/services/{query-builder/rules/spec/rule-relevance.spec.d.ts → prewarm/spec/prewarm-targets.spec.d.ts} +0 -0
  337. /package/dist/services/query-builder/{queries/spec → spec/queries}/golden-configs.d.ts +0 -0
  338. /package/dist/services/query-builder/{queries/spec → spec/queries}/golden-configs.js +0 -0
  339. /package/dist/services/query-builder/{rules/spec/rule-to-sql.spec.d.ts → spec/queries/golden.spec.d.ts} +0 -0
  340. /package/dist/services/query-builder/{rules/spec/runtime-semantics.spec.d.ts → spec/queries/pops-query.spec.d.ts} +0 -0
  341. /package/dist/services/query-builder/{rules/spec/strip-parameters.spec.d.ts → spec/queries/queries.spec.d.ts} +0 -0
  342. /package/dist/services/query-builder/{sql/spec/expression.spec.d.ts → spec/queries/reported-bugs.spec.d.ts} +0 -0
  343. /package/dist/services/query-builder/{sql/spec/format.spec.d.ts → spec/query-builder-service.spec.d.ts} +0 -0
  344. /package/dist/services/query-builder/{sql/spec/predicate.spec.d.ts → spec/rules/pattern-language.spec.d.ts} +0 -0
  345. /package/dist/services/query-builder/{sql/spec/regex.spec.d.ts → spec/rules/rule-parser.spec.d.ts} +0 -0
  346. /package/dist/services/{revalidate/revalidate-service.spec.d.ts → query-builder/spec/rules/rule-reducer.spec.d.ts} +0 -0
  347. /package/dist/services/{setup/extension/crx.spec.d.ts → query-builder/spec/rules/rule-relevance.spec.d.ts} +0 -0
  348. /package/dist/services/{setup/extension/webstore.spec.d.ts → query-builder/spec/rules/rule-to-sql.spec.d.ts} +0 -0
  349. /package/dist/services/{setup/os/tool-registry.spec.d.ts → query-builder/spec/rules/runtime-semantics.spec.d.ts} +0 -0
@@ -1,9 +1,12 @@
1
1
  import { CliServiceFactory } from "../cli/index.js";
2
2
  import { CustomerConfigService, } from "./index.js";
3
+ import { SiteAnalyzerServiceFactory } from "./site-analyzer/index.js";
3
4
  export class CustomerConfigServiceFactory {
5
+ cli;
4
6
  context;
5
7
  service;
6
- constructor(context) {
8
+ constructor(context, cli) {
9
+ this.cli = cli;
7
10
  this.context = context;
8
11
  }
9
12
  async buildService() {
@@ -14,7 +17,8 @@ export class CustomerConfigServiceFactory {
14
17
  }
15
18
  async build() {
16
19
  const context = this.context;
17
- const cliService = new CliServiceFactory().getService();
18
- this.service = new CustomerConfigService(context, cliService);
20
+ const cliService = this.cli ?? new CliServiceFactory().getService();
21
+ const siteAnalyzer = new SiteAnalyzerServiceFactory(cliService).getService();
22
+ this.service = new CustomerConfigService(context, cliService, siteAnalyzer);
19
23
  }
20
24
  }
@@ -1,8 +1,10 @@
1
- import { CliService } from "../cli/index.js";
1
+ import { CliServiceInterface } from "../cli/index.js";
2
+ import { SiteAnalyzerService } from "./site-analyzer/index.js";
2
3
  import { CustomerConfigServiceContext } from "./customer-config-service-context.js";
3
4
  import { CustomerConfigSettings } from "./customer-config-service-model.js";
4
5
  export declare class CustomerConfigService {
5
6
  private context;
7
+ private siteAnalyzer;
6
8
  private cli;
7
9
  private _appName;
8
10
  private _outputDirPath;
@@ -12,7 +14,7 @@ export declare class CustomerConfigService {
12
14
  private get outputDirPath();
13
15
  /** Set from the "Downtime Detection" feature answer in the wizard. */
14
16
  private includeDowntimeDetection;
15
- constructor(context: CustomerConfigServiceContext, cli: CliService);
17
+ constructor(context: CustomerConfigServiceContext, cli: CliServiceInterface, siteAnalyzer: SiteAnalyzerService);
16
18
  private getOutputDirPath;
17
19
  private getOutputFileName;
18
20
  private getPathWithChangedDir;
@@ -1,10 +1,10 @@
1
1
  import * as fs from "node:fs";
2
2
  import * as path from "node:path";
3
- import { analyzeSite, } from "../../helpers/site-analyzer.js";
4
3
  import { DirectoryOverwriteOption, EnvironmentType, ShopSystem, TEMPLATE_VARIABLES, } from "./customer-config-service-model.js";
5
4
  import { findUnknownVariables, resolveTemplateSource, } from "./template-source.js";
6
5
  export class CustomerConfigService {
7
6
  context;
7
+ siteAnalyzer;
8
8
  cli;
9
9
  _appName;
10
10
  _outputDirPath;
@@ -23,8 +23,9 @@ export class CustomerConfigService {
23
23
  }
24
24
  /** Set from the "Downtime Detection" feature answer in the wizard. */
25
25
  includeDowntimeDetection = false;
26
- constructor(context, cli) {
26
+ constructor(context, cli, siteAnalyzer) {
27
27
  this.context = context;
28
+ this.siteAnalyzer = siteAnalyzer;
28
29
  const { appName } = this.context;
29
30
  this.appName = appName;
30
31
  this.cli = cli;
@@ -193,7 +194,7 @@ export class CustomerConfigService {
193
194
  const shouldAnalyze = await this.cli.confirm("[Analysis] Analyze production site to auto-detect settings?", true);
194
195
  if (shouldAnalyze) {
195
196
  this.cli.startAction("ANALYSE:CUSTOMER:CONFIG", `Analyzing https://${productionHost}`);
196
- siteAnalysis = await analyzeSite(productionHost, (message) => this.cli.comment(message));
197
+ siteAnalysis = await this.siteAnalyzer.analyze(productionHost);
197
198
  if (siteAnalysis) {
198
199
  this.cli.successAction("ANALYSE:CUSTOMER:CONFIG");
199
200
  }
@@ -0,0 +1,3 @@
1
+ export * from "./site-analyzer-model.js";
2
+ export * from "./site-analyzer-service.js";
3
+ export * from "./site-analyzer-service-factory.js";
@@ -0,0 +1,3 @@
1
+ export * from "./site-analyzer-model.js";
2
+ export * from "./site-analyzer-service.js";
3
+ export * from "./site-analyzer-service-factory.js";
@@ -10,4 +10,3 @@ export interface SiteAnalysisResult {
10
10
  shopSystem: DetectedShopSystem;
11
11
  hasInstallJs: boolean;
12
12
  }
13
- export declare function analyzeSite(host: string, log?: (message: string) => void): Promise<SiteAnalysisResult | null>;
@@ -0,0 +1,7 @@
1
+ import { CliServiceInterface } from "../../cli/index.js";
2
+ import { SiteAnalyzerService } from "./site-analyzer-service.js";
3
+ export declare class SiteAnalyzerServiceFactory {
4
+ private cli?;
5
+ constructor(cli?: CliServiceInterface);
6
+ getService(): SiteAnalyzerService;
7
+ }
@@ -0,0 +1,11 @@
1
+ import { CliServiceFactory } from "../../cli/index.js";
2
+ import { SiteAnalyzerService } from "./site-analyzer-service.js";
3
+ export class SiteAnalyzerServiceFactory {
4
+ cli;
5
+ constructor(cli) {
6
+ this.cli = cli;
7
+ }
8
+ getService() {
9
+ return new SiteAnalyzerService(this.cli ?? new CliServiceFactory().getService());
10
+ }
11
+ }
@@ -0,0 +1,16 @@
1
+ import { CliServiceInterface } from "../../cli/index.js";
2
+ import { SiteAnalysisResult } from "./site-analyzer-model.js";
3
+ /**
4
+ * Reads a customer's live site and infers the config settings the wizard should
5
+ * default to — shop system, tracking, service worker, soft navigations.
6
+ *
7
+ * Every probe is best-effort: a site that cannot be reached, or answers with
8
+ * something unparseable, yields null and the wizard falls back to its defaults.
9
+ * That is a normal outcome, not an error, which is why `analyze` reports
10
+ * progress through the CLI rather than throwing.
11
+ */
12
+ export declare class SiteAnalyzerService {
13
+ private cli;
14
+ constructor(cli: CliServiceInterface);
15
+ analyze(host: string): Promise<SiteAnalysisResult | null>;
16
+ }
@@ -1,5 +1,5 @@
1
- import { safe } from "./safe.js";
2
- import { originFetch } from "./origin-proxy.js";
1
+ import { safe } from "../../../helpers/safe.js";
2
+ import { originFetch } from "../../../helpers/origin-proxy.js";
3
3
  const EMPTY_FLAGS = {
4
4
  useGATracking: false,
5
5
  withGoogleOptimize: false,
@@ -137,7 +137,22 @@ async function fetchAndAnalyze(host, log) {
137
137
  clearTimeout(timeout);
138
138
  }
139
139
  }
140
- export async function analyzeSite(host, log = console.log) {
141
- const result = await safe(fetchAndAnalyze(host, log));
142
- return result.success ? result.data : null;
140
+ /**
141
+ * Reads a customer's live site and infers the config settings the wizard should
142
+ * default to — shop system, tracking, service worker, soft navigations.
143
+ *
144
+ * Every probe is best-effort: a site that cannot be reached, or answers with
145
+ * something unparseable, yields null and the wizard falls back to its defaults.
146
+ * That is a normal outcome, not an error, which is why `analyze` reports
147
+ * progress through the CLI rather than throwing.
148
+ */
149
+ export class SiteAnalyzerService {
150
+ cli;
151
+ constructor(cli) {
152
+ this.cli = cli;
153
+ }
154
+ async analyze(host) {
155
+ const result = await safe(fetchAndAnalyze(host, (message) => this.cli.comment(message)));
156
+ return result.success ? result.data : null;
157
+ }
143
158
  }
@@ -0,0 +1,46 @@
1
+ import { ApprovalAnswer } from "../policy/auto-deploy-policy.js";
2
+ import { MergeRequestDeployService } from "../mr/index.js";
3
+ /** What `sk bulk-deploy` is asked to deploy. */
4
+ export declare class BulkDeployContext {
5
+ /** Any path inside the repository that holds the customer configurations. */
6
+ readonly repositoryPath: string;
7
+ /** The number of the merged merge request. */
8
+ readonly iid: number;
9
+ /** The answer for the customers that approve every rollout themselves. */
10
+ readonly approval?: ApprovalAnswer;
11
+ /** The description of the installations. */
12
+ readonly description?: string;
13
+ readonly dryRun: boolean;
14
+ /** Run without the confirmation, for a pipeline that has no keyboard. */
15
+ readonly assumeYes: boolean;
16
+ constructor(
17
+ /** Any path inside the repository that holds the customer configurations. */
18
+ repositoryPath: string,
19
+ /** The number of the merged merge request. */
20
+ iid: number,
21
+ /** The answer for the customers that approve every rollout themselves. */
22
+ approval?: ApprovalAnswer,
23
+ /** The description of the installations. */
24
+ description?: string, dryRun?: boolean,
25
+ /** Run without the confirmation, for a pipeline that has no keyboard. */
26
+ assumeYes?: boolean);
27
+ }
28
+ /** One customer configuration that a merge request touches. */
29
+ export interface TouchedConfig {
30
+ /** The customer directory, as git spells it. */
31
+ directory: string;
32
+ /** The customer directory in the working tree. */
33
+ customerPath: string;
34
+ configName: string;
35
+ /** Whether the customer approves every rollout themselves. */
36
+ needsApproval: boolean;
37
+ }
38
+ /** The answers that every configuration of the run is deployed with. */
39
+ export interface BulkAnswers {
40
+ description: string;
41
+ approval: ApprovalAnswer;
42
+ }
43
+ /** Builds the deploy of one configuration. */
44
+ export interface ConfigDeployFactoryInterface {
45
+ build(config: TouchedConfig, answers: BulkAnswers): Promise<MergeRequestDeployService>;
46
+ }
@@ -0,0 +1,27 @@
1
+ /** What `sk bulk-deploy` is asked to deploy. */
2
+ export class BulkDeployContext {
3
+ repositoryPath;
4
+ iid;
5
+ approval;
6
+ description;
7
+ dryRun;
8
+ assumeYes;
9
+ constructor(
10
+ /** Any path inside the repository that holds the customer configurations. */
11
+ repositoryPath,
12
+ /** The number of the merged merge request. */
13
+ iid,
14
+ /** The answer for the customers that approve every rollout themselves. */
15
+ approval,
16
+ /** The description of the installations. */
17
+ description, dryRun = false,
18
+ /** Run without the confirmation, for a pipeline that has no keyboard. */
19
+ assumeYes = false) {
20
+ this.repositoryPath = repositoryPath;
21
+ this.iid = iid;
22
+ this.approval = approval;
23
+ this.description = description;
24
+ this.dryRun = dryRun;
25
+ this.assumeYes = assumeYes;
26
+ }
27
+ }
@@ -0,0 +1,11 @@
1
+ import { UserCliConfig } from "../../cli/index.js";
2
+ import { BulkDeployContext } from "./bulk-deploy-model.js";
3
+ import { BulkDeployService } from "./bulk-deploy-service.js";
4
+ export declare class BulkDeployServiceFactory {
5
+ private readonly context;
6
+ private readonly cliConfig;
7
+ private service?;
8
+ constructor(context: BulkDeployContext, cliConfig: UserCliConfig);
9
+ getService(): BulkDeployService;
10
+ private build;
11
+ }
@@ -0,0 +1,24 @@
1
+ import { CliServiceFactory } from "../../cli/index.js";
2
+ import { GitRepository } from "../../git/index.js";
3
+ import { BulkDeployService } from "./bulk-deploy-service.js";
4
+ import { ConfigDeployFactory } from "./config-deploy-factory.js";
5
+ export class BulkDeployServiceFactory {
6
+ context;
7
+ cliConfig;
8
+ service = undefined;
9
+ constructor(context, cliConfig) {
10
+ this.context = context;
11
+ this.cliConfig = cliConfig;
12
+ }
13
+ getService() {
14
+ if (!(this.service instanceof BulkDeployService)) {
15
+ this.build();
16
+ }
17
+ return this.service;
18
+ }
19
+ build() {
20
+ const repository = GitRepository.at(this.context.repositoryPath);
21
+ const request = repository.mergeRequest(this.context.iid);
22
+ this.service = new BulkDeployService(this.context, repository, request, new ConfigDeployFactory(this.cliConfig, repository, request, this.context.dryRun), new CliServiceFactory().getService());
23
+ }
24
+ }
@@ -0,0 +1,47 @@
1
+ import { CliServiceInterface } from "../../cli/index.js";
2
+ import { GitRepository, MergedRequest } from "../../git/index.js";
3
+ import { MergeRequestDeployResult } from "../mr/index.js";
4
+ import { BulkDeployContext, ConfigDeployFactoryInterface } from "./bulk-deploy-model.js";
5
+ /**
6
+ * Deploys every customer configuration of a merged merge request.
7
+ *
8
+ * The run asks its questions once, then plans every configuration without
9
+ * writing anything, and applies only what the plan found deployable. The
10
+ * summary names every configuration it left out, so a developer can take those
11
+ * over by hand.
12
+ */
13
+ export declare class BulkDeployService {
14
+ private readonly context;
15
+ private readonly repository;
16
+ private readonly request;
17
+ private readonly deployFactory;
18
+ private readonly cli;
19
+ constructor(context: BulkDeployContext, repository: GitRepository, request: MergedRequest, deployFactory: ConfigDeployFactoryInterface, cli: CliServiceInterface);
20
+ run(): Promise<MergeRequestDeployResult[]>;
21
+ /**
22
+ * The production config of every customer the merge request changes.
23
+ *
24
+ * A merge request deploys production alone. Staging and every other
25
+ * environment stay in the hand of a developer.
26
+ */
27
+ private productionConfigs;
28
+ /** The questions of the whole run, asked before the first configuration. */
29
+ private ask;
30
+ /**
31
+ * What happens with the customers that approve every rollout themselves.
32
+ *
33
+ * The answer is asked only while such a customer is part of the run, and it
34
+ * changes nothing for every other customer.
35
+ */
36
+ private resolveApproval;
37
+ /** Plans every configuration, without writing anything. */
38
+ private planAll;
39
+ private planOne;
40
+ /** Deploys every configuration the plan found deployable. */
41
+ private applyAll;
42
+ private isConfirmed;
43
+ /** The summary of the run, and everything a developer has to take over. */
44
+ private summarize;
45
+ private writeTable;
46
+ private failed;
47
+ }
@@ -0,0 +1,201 @@
1
+ import { ApprovalAnswer } from "../policy/auto-deploy-policy.js";
2
+ import { DeployOutcome, resolveDescription, } from "../mr/index.js";
3
+ import { productionConfigOf, touchedCustomers } from "./touched-configs.js";
4
+ /**
5
+ * Deploys every customer configuration of a merged merge request.
6
+ *
7
+ * The run asks its questions once, then plans every configuration without
8
+ * writing anything, and applies only what the plan found deployable. The
9
+ * summary names every configuration it left out, so a developer can take those
10
+ * over by hand.
11
+ */
12
+ export class BulkDeployService {
13
+ context;
14
+ repository;
15
+ request;
16
+ deployFactory;
17
+ cli;
18
+ constructor(context, repository, request, deployFactory, cli) {
19
+ this.context = context;
20
+ this.repository = repository;
21
+ this.request = request;
22
+ this.deployFactory = deployFactory;
23
+ this.cli = cli;
24
+ }
25
+ async run() {
26
+ const configs = this.productionConfigs();
27
+ this.cli.spacer();
28
+ this.cli.write(`!${this.request.iid} ${this.request.title}`);
29
+ if (configs.length === 0) {
30
+ this.cli.writeWarning(`!${this.request.iid} changes no customer configuration`);
31
+ return [];
32
+ }
33
+ this.cli.write(`${configs.length} customer(s)`);
34
+ const answers = await this.ask(configs);
35
+ const planned = await this.planAll(configs, answers);
36
+ this.writeTable("Plan", planned);
37
+ const deployable = planned.filter((entry) => entry.result.outcome === DeployOutcome.Deployable);
38
+ if (deployable.length > 0 && (await this.isConfirmed(deployable.length))) {
39
+ await this.applyAll(deployable);
40
+ }
41
+ else if (deployable.length > 0) {
42
+ for (const entry of deployable) {
43
+ entry.result = {
44
+ ...entry.result,
45
+ outcome: DeployOutcome.Skipped,
46
+ reason: "the run was not confirmed",
47
+ };
48
+ }
49
+ }
50
+ return this.summarize(planned);
51
+ }
52
+ /**
53
+ * The production config of every customer the merge request changes.
54
+ *
55
+ * A merge request deploys production alone. Staging and every other
56
+ * environment stay in the hand of a developer.
57
+ */
58
+ productionConfigs() {
59
+ const configs = [];
60
+ const without = [];
61
+ for (const directory of touchedCustomers(this.repository, this.repository.changedPaths(this.request))) {
62
+ const config = productionConfigOf(this.repository.root, directory);
63
+ if (config) {
64
+ configs.push(config);
65
+ }
66
+ else {
67
+ without.push(directory);
68
+ }
69
+ }
70
+ if (without.length > 0) {
71
+ this.cli.writeWarning(`No production config, so left out: ${without.join(", ")}`);
72
+ }
73
+ return configs;
74
+ }
75
+ /** The questions of the whole run, asked before the first configuration. */
76
+ async ask(configs) {
77
+ return {
78
+ description: await resolveDescription(this.cli, this.request, this.context.description),
79
+ approval: await this.resolveApproval(configs),
80
+ };
81
+ }
82
+ /**
83
+ * What happens with the customers that approve every rollout themselves.
84
+ *
85
+ * The answer is asked only while such a customer is part of the run, and it
86
+ * changes nothing for every other customer.
87
+ */
88
+ async resolveApproval(configs) {
89
+ if (this.context.approval) {
90
+ return this.context.approval;
91
+ }
92
+ const approving = configs.filter((config) => config.needsApproval);
93
+ if (approving.length === 0) {
94
+ return ApprovalAnswer.Approved;
95
+ }
96
+ this.cli.spacer();
97
+ this.cli.writeWarning("These customers approve every rollout themselves:");
98
+ this.cli.code([...new Set(approving.map((c) => c.directory))].join(", "));
99
+ const answer = await this.cli.select("What happens with them?", [
100
+ { name: "leave them to a developer", value: ApprovalAnswer.Skip },
101
+ {
102
+ name: "activate as a testing installation",
103
+ value: ApprovalAnswer.Testing,
104
+ },
105
+ {
106
+ name: "the customers approved this change, activate it",
107
+ value: ApprovalAnswer.Approved,
108
+ },
109
+ ], ApprovalAnswer.Skip);
110
+ return answer;
111
+ }
112
+ /** Plans every configuration, without writing anything. */
113
+ async planAll(configs, answers) {
114
+ const planned = [];
115
+ for (const config of configs) {
116
+ const name = `${config.directory} [${config.configName}]`;
117
+ this.cli.startAction(`BULK:PLAN:${name}`, `plan ${name}`);
118
+ const entry = await this.planOne(config, answers);
119
+ this.cli.successAction(`BULK:PLAN:${name}`, `${name}: ${entry.result.outcome}`);
120
+ planned.push(entry);
121
+ }
122
+ return planned;
123
+ }
124
+ async planOne(config, answers) {
125
+ try {
126
+ const service = await this.deployFactory.build(config, answers);
127
+ return { config, service, result: await service.plan() };
128
+ }
129
+ catch (error) {
130
+ // A configuration that cannot even be read, or an app that refuses the
131
+ // login, is one result of the run, never its end.
132
+ return { config, result: this.failed(config, error) };
133
+ }
134
+ }
135
+ /** Deploys every configuration the plan found deployable. */
136
+ async applyAll(deployable) {
137
+ for (const entry of deployable) {
138
+ const name = `${entry.config.directory} [${entry.config.configName}]`;
139
+ this.cli.spacer();
140
+ this.cli.write(`${name}`);
141
+ try {
142
+ // The deploy plans again, because live can change between the plan
143
+ // and the deploy.
144
+ entry.result = await entry.service.run();
145
+ }
146
+ catch (error) {
147
+ entry.result = this.failed(entry.config, error);
148
+ }
149
+ }
150
+ }
151
+ async isConfirmed(count) {
152
+ if (this.context.assumeYes) {
153
+ return true;
154
+ }
155
+ const what = this.context.dryRun ? "Dry run" : "Deploy";
156
+ return this.cli.confirm(`${what} ${count} configuration(s) of !${this.request.iid}?`, false);
157
+ }
158
+ /** The summary of the run, and everything a developer has to take over. */
159
+ summarize(planned) {
160
+ const results = planned.map((entry) => entry.result);
161
+ const applied = results.filter((result) => result.outcome === DeployOutcome.Applied);
162
+ // Without a deploy the plan above already is the summary.
163
+ if (applied.length > 0) {
164
+ this.writeTable("Summary", planned.filter((entry) => entry.result.outcome !== DeployOutcome.Applied));
165
+ }
166
+ const byHand = results.flatMap((result) => result.notDeployed ?? []);
167
+ if (byHand.length > 0) {
168
+ this.cli.writeWarning("Deploy these files by hand:");
169
+ this.cli.code([...new Set(byHand)].join(", "));
170
+ }
171
+ this.cli.spacer();
172
+ this.cli.write(`${applied.length} of ${results.length} configuration(s) deployed`);
173
+ return results;
174
+ }
175
+ writeTable(title, planned) {
176
+ if (planned.length === 0) {
177
+ return;
178
+ }
179
+ this.cli.spacer();
180
+ this.cli.write(title);
181
+ // Every configuration of a merge request run is production, so the name
182
+ // of the config is no column of its own.
183
+ const rows = planned.map((entry) => ({
184
+ customer: entry.config.directory.split("/").pop(),
185
+ outcome: entry.result.outcome,
186
+ reason: entry.result.reason ?? "",
187
+ }));
188
+ const hasReason = rows.some((row) => row.reason.length > 0);
189
+ this.cli.table(rows, hasReason
190
+ ? { customer: {}, outcome: {}, reason: {} }
191
+ : { customer: {}, outcome: {} });
192
+ }
193
+ failed(config, error) {
194
+ return {
195
+ customerPath: config.customerPath,
196
+ configName: config.configName,
197
+ outcome: DeployOutcome.Failed,
198
+ reason: error.message,
199
+ };
200
+ }
201
+ }
@@ -0,0 +1,13 @@
1
+ import { UserCliConfig } from "../../cli/index.js";
2
+ import { GitRepository, MergedRequest } from "../../git/index.js";
3
+ import { MergeRequestDeployService } from "../mr/index.js";
4
+ import { BulkAnswers, ConfigDeployFactoryInterface, TouchedConfig } from "./bulk-deploy-model.js";
5
+ /** Builds the deploy of one configuration of the bulk run. */
6
+ export declare class ConfigDeployFactory implements ConfigDeployFactoryInterface {
7
+ private readonly cliConfig;
8
+ private readonly repository;
9
+ private readonly request;
10
+ private readonly dryRun;
11
+ constructor(cliConfig: UserCliConfig, repository: GitRepository, request: MergedRequest, dryRun: boolean);
12
+ build(config: TouchedConfig, answers: BulkAnswers): Promise<MergeRequestDeployService>;
13
+ }
@@ -0,0 +1,20 @@
1
+ import { MergeRequestDeployContext, MergeRequestDeployServiceFactory, } from "../mr/index.js";
2
+ /** Builds the deploy of one configuration of the bulk run. */
3
+ export class ConfigDeployFactory {
4
+ cliConfig;
5
+ repository;
6
+ request;
7
+ dryRun;
8
+ constructor(cliConfig, repository, request, dryRun) {
9
+ this.cliConfig = cliConfig;
10
+ this.repository = repository;
11
+ this.request = request;
12
+ this.dryRun = dryRun;
13
+ }
14
+ async build(config, answers) {
15
+ return new MergeRequestDeployServiceFactory(new MergeRequestDeployContext(config.customerPath, config.configName, this.request.iid, answers.approval, answers.description, this.dryRun,
16
+ // A run over many customers pays for every check once per customer,
17
+ // so the checks after the upload are left to sk deploy.
18
+ true), this.cliConfig, this.repository, this.request).buildService();
19
+ }
20
+ }
@@ -0,0 +1,5 @@
1
+ export * from "./bulk-deploy-model.js";
2
+ export * from "./touched-configs.js";
3
+ export * from "./bulk-deploy-service.js";
4
+ export * from "./config-deploy-factory.js";
5
+ export * from "./bulk-deploy-service-factory.js";
@@ -0,0 +1,5 @@
1
+ export * from "./bulk-deploy-model.js";
2
+ export * from "./touched-configs.js";
3
+ export * from "./bulk-deploy-service.js";
4
+ export * from "./config-deploy-factory.js";
5
+ export * from "./bulk-deploy-service-factory.js";
@@ -0,0 +1,12 @@
1
+ import { GitRepository } from "../../git/index.js";
2
+ import { TouchedConfig } from "./bulk-deploy-model.js";
3
+ /**
4
+ * The customer directories that the changed paths belong to.
5
+ *
6
+ * A path belongs to the closest directory above it that holds a
7
+ * config_customer.json, so a change outside the customers, such as one in the
8
+ * rules or the tools, belongs to none.
9
+ */
10
+ export declare function touchedCustomers(repository: GitRepository, changedPaths: string[]): string[];
11
+ /** The production configuration of the customer, while it declares one. */
12
+ export declare function productionConfigOf(root: string, directory: string): TouchedConfig | null;
@@ -0,0 +1,54 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ /** The file that makes a directory a customer configuration. */
4
+ const CUSTOMER_CONFIG = "config_customer.json";
5
+ /**
6
+ * The only environment a merge request deploys.
7
+ *
8
+ * Staging and every other environment stay in the hand of a developer.
9
+ */
10
+ const PRODUCTION = "production";
11
+ /**
12
+ * The customer directories that the changed paths belong to.
13
+ *
14
+ * A path belongs to the closest directory above it that holds a
15
+ * config_customer.json, so a change outside the customers, such as one in the
16
+ * rules or the tools, belongs to none.
17
+ */
18
+ export function touchedCustomers(repository, changedPaths) {
19
+ const directories = new Set();
20
+ for (const changedPath of changedPaths) {
21
+ const directory = customerDirectoryOf(repository.root, changedPath);
22
+ if (directory) {
23
+ directories.add(directory);
24
+ }
25
+ }
26
+ return [...directories].sort();
27
+ }
28
+ /** The production configuration of the customer, while it declares one. */
29
+ export function productionConfigOf(root, directory) {
30
+ const customerPath = path.join(root, directory);
31
+ const configs = JSON.parse(readFileSync(path.join(customerPath, CUSTOMER_CONFIG), "utf8"));
32
+ const production = configs[PRODUCTION];
33
+ if (!production || typeof production !== "object") {
34
+ return null;
35
+ }
36
+ return {
37
+ directory,
38
+ customerPath,
39
+ configName: PRODUCTION,
40
+ needsApproval: Boolean(production.needsCustomerApproval),
41
+ };
42
+ }
43
+ /** The customer directory the path belongs to, as git spells it. */
44
+ function customerDirectoryOf(root, changedPath) {
45
+ const segments = changedPath.split("/").slice(0, -1);
46
+ while (segments.length > 0) {
47
+ const directory = segments.join("/");
48
+ if (existsSync(path.join(root, directory, CUSTOMER_CONFIG))) {
49
+ return directory;
50
+ }
51
+ segments.pop();
52
+ }
53
+ return null;
54
+ }