@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,5 +1,7 @@
1
1
  import { FILE_TYPE, } from "../../integration-api/index.js";
2
2
  import chalk from "chalk";
3
+ import { DeployQuestion } from "../policy/index.js";
4
+ import { DeployAbortedError } from "../error/deploy-aborted-error.js";
3
5
  export default class CustomerConfigHandler {
4
6
  customer;
5
7
  configApi;
@@ -7,13 +9,15 @@ export default class CustomerConfigHandler {
7
9
  diffService;
8
10
  cli;
9
11
  builder;
10
- constructor(customer, configApi, configName, diffService, cli, builder) {
12
+ policy;
13
+ constructor(customer, configApi, configName, diffService, cli, builder, policy) {
11
14
  this.customer = customer;
12
15
  this.configApi = configApi;
13
16
  this.configName = configName;
14
17
  this.diffService = diffService;
15
18
  this.cli = cli;
16
19
  this.builder = builder;
20
+ this.policy = policy;
17
21
  }
18
22
  canHandle(type) {
19
23
  return type === FILE_TYPE.CUSTOMER_FILE;
@@ -42,7 +46,8 @@ export default class CustomerConfigHandler {
42
46
  const { updatedFile } = await this.diffService.diffContent(file.name, JSON.stringify(installResource.origins, null, 4), JSON.stringify(config.origins, null, 4));
43
47
  const origins = JSON.parse(updatedFile);
44
48
  file.updateOrigins(origins);
45
- if (!(await this.cli.confirm("Update origins?", true))) {
49
+ const updateOrigins = await this.policy.confirm(DeployQuestion.UpdateOrigins, "Update origins?", true);
50
+ if (!updateOrigins) {
46
51
  file.skipFile();
47
52
  return;
48
53
  }
@@ -66,11 +71,10 @@ export default class CustomerConfigHandler {
66
71
  this.cli.spacer();
67
72
  this.cli.writeWarning(`No ${chalk.underline("active")} remote config named ${chalk.bold(configName)} found in app ${chalk.bold(appName)}`);
68
73
  this.cli.spacer();
69
- if (await this.cli.confirm("Continue creating a new config?")) {
70
- this.cli.write(`New configuration named ${chalk.bold(configName)} will be created in app ${chalk.bold(appName)}`, true);
71
- }
72
- else {
73
- this.cli.exit();
74
+ const createConfig = await this.policy.confirm(DeployQuestion.CreateConfig, "Continue creating a new config?");
75
+ if (!createConfig) {
76
+ throw new DeployAbortedError(`no active configuration named ${configName} exists in app ${appName}`);
74
77
  }
78
+ this.cli.write(`New configuration named ${chalk.bold(configName)} will be created in app ${chalk.bold(appName)}`, true);
75
79
  }
76
80
  }
@@ -1,11 +1,12 @@
1
1
  import DeployHandlerInterface from "../interface/deploy-handler-interface.js";
2
2
  import { DiffService } from "../../diff/index.js";
3
- import { CliService } from "../../cli/index.js";
3
+ import { CliServiceInterface } from "../../cli/index.js";
4
4
  import InstallResourceBuilder from "../builder/install-resource-builder.js";
5
5
  import DeletedFileCheck from "./install-resource-modifier/deleted-file-check.js";
6
6
  import { CustomerConfig, FILE_TYPE, InstallResourceInterface } from "../../integration-api/index.js";
7
7
  import { ConfigApiService } from "../../config-api/index.js";
8
8
  import { CustomerApprovalCheck } from "../checks/activation/customer-approval-check.js";
9
+ import { DeployPolicyInterface } from "../policy/index.js";
9
10
  export default class InstallResourceHandler implements DeployHandlerInterface {
10
11
  private readonly customer;
11
12
  private readonly configApi;
@@ -15,7 +16,8 @@ export default class InstallResourceHandler implements DeployHandlerInterface {
15
16
  private builder;
16
17
  private deletedFilesChecker;
17
18
  private customerApprovalCheck;
18
- constructor(customer: CustomerConfig, configApi: ConfigApiService, configName: string, diffService: DiffService, cli: CliService, builder: InstallResourceBuilder, deletedFilesChecker: DeletedFileCheck, customerApprovalCheck: CustomerApprovalCheck);
19
+ private policy;
20
+ constructor(customer: CustomerConfig, configApi: ConfigApiService, configName: string, diffService: DiffService, cli: CliServiceInterface, builder: InstallResourceBuilder, deletedFilesChecker: DeletedFileCheck, customerApprovalCheck: CustomerApprovalCheck, policy: DeployPolicyInterface);
19
21
  canHandle(type: FILE_TYPE): boolean;
20
22
  handle(files: InstallResourceInterface[]): Promise<void>;
21
23
  upload(files: InstallResourceInterface[]): Promise<void>;
@@ -1,6 +1,8 @@
1
1
  import { FILE_TYPE, } from "../../integration-api/index.js";
2
2
  import { safe } from "../../../helpers/safe.js";
3
3
  import { buildTestingInstallationLinks } from "./testing-installation-links.js";
4
+ import { DeployQuestion } from "../policy/index.js";
5
+ import { DeployAbortedError } from "../error/deploy-aborted-error.js";
4
6
  export default class InstallResourceHandler {
5
7
  customer;
6
8
  configApi;
@@ -10,7 +12,8 @@ export default class InstallResourceHandler {
10
12
  builder;
11
13
  deletedFilesChecker;
12
14
  customerApprovalCheck;
13
- constructor(customer, configApi, configName, diffService, cli, builder, deletedFilesChecker, customerApprovalCheck) {
15
+ policy;
16
+ constructor(customer, configApi, configName, diffService, cli, builder, deletedFilesChecker, customerApprovalCheck, policy) {
14
17
  this.customer = customer;
15
18
  this.configApi = configApi;
16
19
  this.diffService = diffService;
@@ -19,6 +22,7 @@ export default class InstallResourceHandler {
19
22
  this.builder = builder;
20
23
  this.deletedFilesChecker = deletedFilesChecker;
21
24
  this.customerApprovalCheck = customerApprovalCheck;
25
+ this.policy = policy;
22
26
  }
23
27
  canHandle(type) {
24
28
  return type === FILE_TYPE.INSTALL_FILE;
@@ -47,8 +51,8 @@ export default class InstallResourceHandler {
47
51
  this.cli.write("");
48
52
  this.cli.write("Summary");
49
53
  this.cli.writeBuffer();
50
- if (!(await this.cli.confirm("InstallResource will be created now. Proceed?"))) {
51
- this.cli.exit();
54
+ if (!(await this.policy.confirm(DeployQuestion.UploadInstallResource, "InstallResource will be created now. Proceed?"))) {
55
+ throw new DeployAbortedError("the new installation was not confirmed");
52
56
  }
53
57
  const install = await this.getInstallResource();
54
58
  await this.deletedFilesChecker.checkForDeletedLocalFiles(install);
@@ -62,7 +66,8 @@ export default class InstallResourceHandler {
62
66
  // Without the customer's approval the installation may only go live as a
63
67
  // testing installation, so the regular activation is not even offered.
64
68
  const approved = await this.customerApprovalCheck.isActivationApproved(install);
65
- if (approved && (await this.cli.confirm("Activate new installation?"))) {
69
+ if (approved &&
70
+ (await this.policy.confirm(DeployQuestion.Activate, "Activate new installation?"))) {
66
71
  await this.activate(install);
67
72
  return;
68
73
  }
@@ -81,7 +86,7 @@ export default class InstallResourceHandler {
81
86
  const question = wasActivationOffered
82
87
  ? "Activate as testing installation instead?"
83
88
  : "Activate as testing installation?";
84
- if (!(await this.cli.confirm(question))) {
89
+ if (!(await this.policy.confirm(DeployQuestion.ActivateAsTesting, question))) {
85
90
  return;
86
91
  }
87
92
  this.cli.startAction("DEPLOY:ACTIVATE:INSTALL_RESOURCE_TEST", "activate testing installResource");
@@ -122,7 +127,7 @@ export default class InstallResourceHandler {
122
127
  await this.confirm(file);
123
128
  }
124
129
  async confirm(file, isNew = false) {
125
- const confirm = await this.cli.confirm(`${isNew ? "Create" : "Update"} ${file.name}?`);
130
+ const confirm = await this.policy.confirm(DeployQuestion.UpdateFile, `${isNew ? "Create" : "Update"} ${file.name}?`);
126
131
  if (confirm) {
127
132
  if (isNew) {
128
133
  this.cli.write(`consider new ${file.name}`, true);
@@ -146,7 +151,7 @@ export default class InstallResourceHandler {
146
151
  this.cli.successAction("DEPLOY:CREATE:INSTALL_RESOURCE");
147
152
  const remoteClone = result.data;
148
153
  install = this.builder.updateFromRemote(remoteClone);
149
- install.description = await this.cli.prompt("Describe new configuration:", {
154
+ install.description = await this.policy.text(DeployQuestion.Description, "Describe new configuration:", {
150
155
  defaultAnswer: install.description ?? this.configName,
151
156
  validator: (input) => (input.trim() ? "" : "Please enter something"),
152
157
  });
@@ -1,12 +1,14 @@
1
1
  import Install from "../../interface/install.js";
2
- import { CliService } from "../../../cli/index.js";
2
+ import { CliServiceInterface } from "../../../cli/index.js";
3
3
  import InstallResourceBuilder from "../../builder/install-resource-builder.js";
4
4
  import { InstallResourceInterface } from "../../../integration-api/integration-api-model.js";
5
+ import { DeployPolicyInterface } from "../../policy/index.js";
5
6
  export default class DeletedFileCheck {
7
+ private policy;
6
8
  private cli;
7
9
  private readonly hasFileSelection;
8
10
  private keysToDelete;
9
- constructor(cli: CliService, hasFileSelection?: boolean);
11
+ constructor(cli: CliServiceInterface, policy: DeployPolicyInterface, hasFileSelection?: boolean);
10
12
  hasDeletedFiles(builder: InstallResourceBuilder, files: InstallResourceInterface[]): Promise<void>;
11
13
  checkForDeletedLocalFiles(installResource: Install): Promise<void>;
12
14
  private getFileByRemoteKey;
@@ -1,3 +1,4 @@
1
+ import { DeployQuestion } from "../../policy/index.js";
1
2
  const INSTALL_RESOURCE_FILE_KEYS = [
2
3
  "custom",
3
4
  "sw",
@@ -9,10 +10,12 @@ const INSTALL_RESOURCE_FILE_KEYS = [
9
10
  "customStyle",
10
11
  ];
11
12
  export default class DeletedFileCheck {
13
+ policy;
12
14
  cli;
13
15
  hasFileSelection;
14
16
  keysToDelete = [];
15
- constructor(cli, hasFileSelection = false) {
17
+ constructor(cli, policy, hasFileSelection = false) {
18
+ this.policy = policy;
16
19
  this.cli = cli;
17
20
  this.hasFileSelection = hasFileSelection;
18
21
  }
@@ -24,7 +27,7 @@ export default class DeletedFileCheck {
24
27
  for (const key of INSTALL_RESOURCE_FILE_KEYS) {
25
28
  const file = this.getFileByRemoteKey(key, files);
26
29
  if (!file && installResource[key]?.length > 0) {
27
- const deleteResource = await this.cli.confirm(`Do you want to delete ${key} on installResource?`);
30
+ const deleteResource = await this.policy.confirm(DeployQuestion.DeleteInstallResourceKey, `Do you want to delete ${key} on installResource?`);
28
31
  if (deleteResource) {
29
32
  this.keysToDelete.push(key);
30
33
  builder.changed = true;
@@ -1,15 +1,17 @@
1
1
  import DeployHandlerInterface from "../interface/deploy-handler-interface.js";
2
2
  import { FILE_TYPE, ModuleFile } from "../../integration-api/index.js";
3
3
  import { DiffService } from "../../diff/index.js";
4
- import { CliService } from "../../cli/index.js";
4
+ import { CliServiceInterface } from "../../cli/index.js";
5
5
  import RuntimeModifier from "../interface/runtime-modifier.js";
6
6
  import { ConfigApiService } from "../../config-api/index.js";
7
+ import { DeployPolicyInterface } from "../policy/index.js";
7
8
  export default class ModuleHandler implements DeployHandlerInterface {
8
9
  private readonly configApi;
9
10
  private diffService;
10
11
  private cli;
11
12
  private modifiers;
12
- constructor(configApi: ConfigApiService, diffService: DiffService, cli: CliService, modifiers: RuntimeModifier[]);
13
+ private policy;
14
+ constructor(configApi: ConfigApiService, diffService: DiffService, cli: CliServiceInterface, modifiers: RuntimeModifier[], policy: DeployPolicyInterface);
13
15
  canHandle(type: FILE_TYPE): boolean;
14
16
  handle(files: ModuleFile[]): Promise<void>;
15
17
  upload(files: ModuleFile[]): Promise<void>;
@@ -1,16 +1,19 @@
1
1
  import { FILE_TYPE } from "../../integration-api/index.js";
2
2
  import { safe } from "../../../helpers/safe.js";
3
3
  import { DeployModuleFileError } from "../error/deploy-module-file-error.js";
4
+ import { DeployQuestion } from "../policy/index.js";
4
5
  export default class ModuleHandler {
5
6
  configApi;
6
7
  diffService;
7
8
  cli;
8
9
  modifiers;
9
- constructor(configApi, diffService, cli, modifiers) {
10
+ policy;
11
+ constructor(configApi, diffService, cli, modifiers, policy) {
10
12
  this.configApi = configApi;
11
13
  this.diffService = diffService;
12
14
  this.cli = cli;
13
15
  this.modifiers = modifiers;
16
+ this.policy = policy;
14
17
  }
15
18
  canHandle(type) {
16
19
  return type === FILE_TYPE.MODULE_FILE;
@@ -48,8 +51,8 @@ export default class ModuleHandler {
48
51
  this.cli.write("");
49
52
  this.cli.write("Summary");
50
53
  this.cli.writeBuffer();
51
- if (await this.cli.confirm(`${filesToUpload.length} Module(s) will be uploaded now. Proceed?`)) {
52
- for (const file_ of files) {
54
+ if (await this.policy.confirm(DeployQuestion.UploadModules, `${filesToUpload.length} Module(s) will be uploaded now. Proceed?`)) {
55
+ for (const file_ of filesToUpload) {
53
56
  const file = file_;
54
57
  this.cli.startAction("DEPLOY:UPDATE:MODULE", `update module ${file.name}`);
55
58
  const result = await safe(this.configApi.setModule(file.getContent(), file.name));
@@ -67,7 +70,7 @@ export default class ModuleHandler {
67
70
  }
68
71
  }
69
72
  async confirm(file, isNew = false) {
70
- const confirm = await this.cli.confirm(`${isNew ? "Create" : "Update"} ${file.name}?`);
73
+ const confirm = await this.policy.confirm(DeployQuestion.UpdateFile, `${isNew ? "Create" : "Update"} ${file.name}?`);
71
74
  if (confirm) {
72
75
  if (isNew) {
73
76
  this.cli.write(`consider new ${file.name}`, true);
@@ -1,13 +1,15 @@
1
1
  import DeployHandlerInterface from "../interface/deploy-handler-interface.js";
2
2
  import { DiffService } from "../../diff/index.js";
3
- import { CliService } from "../../cli/index.js";
3
+ import { CliServiceInterface } from "../../cli/index.js";
4
4
  import { FILE_TYPE, ServerConfigFile } from "../../integration-api/index.js";
5
5
  import { ConfigApiService } from "../../config-api/index.js";
6
+ import { DeployPolicyInterface } from "../policy/index.js";
6
7
  export default class ServerConfigHandler implements DeployHandlerInterface {
7
8
  private configApi;
8
9
  private diffService;
9
10
  private cli;
10
- constructor(configApi: ConfigApiService, diffService: DiffService, cli: CliService);
11
+ private policy;
12
+ constructor(configApi: ConfigApiService, diffService: DiffService, cli: CliServiceInterface, policy: DeployPolicyInterface);
11
13
  canHandle(type: FILE_TYPE): boolean;
12
14
  handle(files: ServerConfigFile[]): Promise<void>;
13
15
  upload(files: ServerConfigFile[]): Promise<void>;
@@ -1,14 +1,17 @@
1
1
  import { FILE_TYPE } from "../../integration-api/index.js";
2
2
  import { safe } from "../../../helpers/safe.js";
3
3
  import { DeployServerConfigError } from "../error/deploy-server-config-error.js";
4
+ import { DeployQuestion } from "../policy/index.js";
4
5
  export default class ServerConfigHandler {
5
6
  configApi;
6
7
  diffService;
7
8
  cli;
8
- constructor(configApi, diffService, cli) {
9
+ policy;
10
+ constructor(configApi, diffService, cli, policy) {
9
11
  this.configApi = configApi;
10
12
  this.diffService = diffService;
11
13
  this.cli = cli;
14
+ this.policy = policy;
12
15
  }
13
16
  canHandle(type) {
14
17
  return type === FILE_TYPE.SERVER_FILE;
@@ -41,7 +44,7 @@ export default class ServerConfigHandler {
41
44
  this.cli.write("");
42
45
  this.cli.write("Summary");
43
46
  this.cli.writeBuffer();
44
- if (!(await this.cli.confirm(`ServerConfig will be uploaded now. Proceed?`))) {
47
+ if (!(await this.policy.confirm(DeployQuestion.UploadServerConfig, `ServerConfig will be uploaded now. Proceed?`))) {
45
48
  return;
46
49
  }
47
50
  this.cli.startAction("DEPLOY:UPDATE:RUNTIME_CONFIG", "upload serverconfig");
@@ -55,7 +58,7 @@ export default class ServerConfigHandler {
55
58
  this.cli.successAction("DEPLOY:UPDATE:RUNTIME_CONFIG");
56
59
  }
57
60
  async confirm(file, isNew = false) {
58
- const confirm = await this.cli.confirm(`Deploy ${file.name}?`, true);
61
+ const confirm = await this.policy.confirm(DeployQuestion.UpdateFile, `Deploy ${file.name}?`, true);
59
62
  if (confirm) {
60
63
  if (isNew) {
61
64
  this.cli.writeSuccess(`${file.name} is new`, true);
@@ -0,0 +1,25 @@
1
+ import { UserCliConfig } from "../../cli/index.js";
2
+ import { GitRepository } from "../../git/index.js";
3
+ import { FileListInterface } from "../../integration-api/index.js";
4
+ /**
5
+ * Reads a customer configuration as it was before a merge request.
6
+ *
7
+ * The files of the commit are written to a temporary directory and read back
8
+ * through the integration API, so the result is built exactly like the
9
+ * configuration on disk, including the files of the environment.
10
+ */
11
+ export declare class BaseConfigReader {
12
+ private readonly repository;
13
+ private readonly cliConfig;
14
+ constructor(repository: GitRepository, cliConfig: UserCliConfig);
15
+ /**
16
+ * The configuration at the commit, or null while the commit has none.
17
+ *
18
+ * @param customerPath the customer directory in the working tree
19
+ * @param configName the environment to read
20
+ * @param sha the commit to read the files from
21
+ */
22
+ read(customerPath: string, configName: string, sha: string): Promise<FileListInterface | null>;
23
+ /** Writes the files of the commit to a temporary copy of the directory. */
24
+ private write;
25
+ }
@@ -0,0 +1,55 @@
1
+ import { mkdirSync, mkdtempSync, writeFileSync } from "node:fs";
2
+ import { tmpdir } from "node:os";
3
+ import path from "node:path";
4
+ import ApplicationError from "../../error-handling/error/application-error.js";
5
+ import { IntegrationApiContext, IntegrationApiFactory, } from "../../integration-api/index.js";
6
+ /**
7
+ * Reads a customer configuration as it was before a merge request.
8
+ *
9
+ * The files of the commit are written to a temporary directory and read back
10
+ * through the integration API, so the result is built exactly like the
11
+ * configuration on disk, including the files of the environment.
12
+ */
13
+ export class BaseConfigReader {
14
+ repository;
15
+ cliConfig;
16
+ constructor(repository, cliConfig) {
17
+ this.repository = repository;
18
+ this.cliConfig = cliConfig;
19
+ }
20
+ /**
21
+ * The configuration at the commit, or null while the commit has none.
22
+ *
23
+ * @param customerPath the customer directory in the working tree
24
+ * @param configName the environment to read
25
+ * @param sha the commit to read the files from
26
+ */
27
+ async read(customerPath, configName, sha) {
28
+ const directory = this.repository.relative(customerPath);
29
+ const paths = this.repository.pathsAt(sha, directory);
30
+ if (paths.length === 0) {
31
+ return null;
32
+ }
33
+ const target = await this.write(paths, directory, sha);
34
+ return new IntegrationApiFactory(new IntegrationApiContext(target, configName, []), this.cliConfig)
35
+ .buildService()
36
+ .run();
37
+ }
38
+ /** Writes the files of the commit to a temporary copy of the directory. */
39
+ async write(paths, directory, sha) {
40
+ let temporalDirectory;
41
+ try {
42
+ temporalDirectory = mkdtempSync(path.join(tmpdir(), "speed-kit-cli-"));
43
+ }
44
+ catch (error) {
45
+ throw new ApplicationError(`Unable to create a temporary directory for the configuration to compare with: ${error}`);
46
+ }
47
+ const target = path.join(temporalDirectory, path.basename(directory));
48
+ for (const filePath of paths) {
49
+ const file = path.join(target, path.relative(directory, filePath));
50
+ mkdirSync(path.dirname(file), { recursive: true });
51
+ writeFileSync(file, this.repository.contentAt(sha, filePath));
52
+ }
53
+ return target;
54
+ }
55
+ }
@@ -0,0 +1,6 @@
1
+ export * from "./base-config-reader.js";
2
+ export * from "./live-state-check.js";
3
+ export * from "./merge-request-deploy-model.js";
4
+ export * from "./merge-request-description.js";
5
+ export * from "./merge-request-deploy-service.js";
6
+ export * from "./merge-request-deploy-service-factory.js";
@@ -0,0 +1,6 @@
1
+ export * from "./base-config-reader.js";
2
+ export * from "./live-state-check.js";
3
+ export * from "./merge-request-deploy-model.js";
4
+ export * from "./merge-request-description.js";
5
+ export * from "./merge-request-deploy-service.js";
6
+ export * from "./merge-request-deploy-service-factory.js";
@@ -0,0 +1,38 @@
1
+ import { DiffService } from "../../diff/index.js";
2
+ import { FileListInterface } from "../../integration-api/index.js";
3
+ import Install from "../interface/install.js";
4
+ /** How the live installation relates to the merge request. */
5
+ export declare enum LiveState {
6
+ /** Live is the state before the merge request, so the deploy is reviewed. */
7
+ Reviewed = "reviewed",
8
+ /** Live already carries the merge request. Nothing is left to deploy. */
9
+ AlreadyDeployed = "alreadyDeployed",
10
+ /** Live carries changes that never reached git. */
11
+ Drifted = "drifted",
12
+ /** The app has no active installation of this configuration. */
13
+ Missing = "missing"
14
+ }
15
+ export interface LiveStateResult {
16
+ state: LiveState;
17
+ /** The files that live and the state before the merge request disagree on. */
18
+ driftedFiles: string[];
19
+ }
20
+ /**
21
+ * Compares the live installation with the state before the merge request.
22
+ *
23
+ * A deploy overwrites every file it finds different, so a change that only
24
+ * lives in the app would be reverted without anybody noticing. The comparison
25
+ * covers every file the deploy uploads, not only the files of the merge
26
+ * request, and only an equal result makes the deploy safe.
27
+ */
28
+ export declare class LiveStateCheck {
29
+ private readonly diff;
30
+ constructor(diff: DiffService);
31
+ compare(base: FileListInterface, local: FileListInterface, install: Install | null): LiveStateResult;
32
+ /** Whether the merge request changes anything this deploy would upload. */
33
+ isUnchanged(base: FileListInterface, local: FileListInterface): boolean;
34
+ /** The names of everything the two states disagree on. */
35
+ private differences;
36
+ private stateOfFiles;
37
+ private stateOfInstall;
38
+ }
@@ -0,0 +1,81 @@
1
+ import { InstallResourceToFileMapping } from "../../pull/index.js";
2
+ /** How the live installation relates to the merge request. */
3
+ export var LiveState;
4
+ (function (LiveState) {
5
+ /** Live is the state before the merge request, so the deploy is reviewed. */
6
+ LiveState["Reviewed"] = "reviewed";
7
+ /** Live already carries the merge request. Nothing is left to deploy. */
8
+ LiveState["AlreadyDeployed"] = "alreadyDeployed";
9
+ /** Live carries changes that never reached git. */
10
+ LiveState["Drifted"] = "drifted";
11
+ /** The app has no active installation of this configuration. */
12
+ LiveState["Missing"] = "missing";
13
+ })(LiveState || (LiveState = {}));
14
+ /** The origins are one file of the comparison, under the name of their file. */
15
+ const ORIGINS = "config_customer(origins)";
16
+ /**
17
+ * Compares the live installation with the state before the merge request.
18
+ *
19
+ * A deploy overwrites every file it finds different, so a change that only
20
+ * lives in the app would be reverted without anybody noticing. The comparison
21
+ * covers every file the deploy uploads, not only the files of the merge
22
+ * request, and only an equal result makes the deploy safe.
23
+ */
24
+ export class LiveStateCheck {
25
+ diff;
26
+ constructor(diff) {
27
+ this.diff = diff;
28
+ }
29
+ compare(base, local, install) {
30
+ if (!install) {
31
+ return { state: LiveState.Missing, driftedFiles: [] };
32
+ }
33
+ const live = this.stateOfInstall(install);
34
+ const driftedFiles = this.differences(this.stateOfFiles(base), live);
35
+ if (driftedFiles.length === 0) {
36
+ return { state: LiveState.Reviewed, driftedFiles };
37
+ }
38
+ if (this.differences(this.stateOfFiles(local), live).length === 0) {
39
+ return { state: LiveState.AlreadyDeployed, driftedFiles: [] };
40
+ }
41
+ return { state: LiveState.Drifted, driftedFiles };
42
+ }
43
+ /** Whether the merge request changes anything this deploy would upload. */
44
+ isUnchanged(base, local) {
45
+ return (this.differences(this.stateOfFiles(base), this.stateOfFiles(local))
46
+ .length === 0);
47
+ }
48
+ /** The names of everything the two states disagree on. */
49
+ differences(left, right) {
50
+ const differences = [];
51
+ for (const key of Object.keys(InstallResourceToFileMapping)) {
52
+ if (!this.diff.isContentEqual(left.contents[key], right.contents[key])) {
53
+ differences.push(InstallResourceToFileMapping[key].fileName);
54
+ }
55
+ }
56
+ if (JSON.stringify([...left.origins].sort()) !==
57
+ JSON.stringify([...right.origins].sort())) {
58
+ differences.push(ORIGINS);
59
+ }
60
+ return differences;
61
+ }
62
+ stateOfFiles(files) {
63
+ const contents = {};
64
+ for (const file of files.getInstallResources()) {
65
+ if (!file.shouldSkipFile()) {
66
+ contents[file.remoteKey] = file.getContent();
67
+ }
68
+ }
69
+ return {
70
+ contents,
71
+ origins: files.getCustomerConfig()?.config?.origins ?? [],
72
+ };
73
+ }
74
+ stateOfInstall(install) {
75
+ const contents = {};
76
+ for (const key of Object.keys(InstallResourceToFileMapping)) {
77
+ contents[key] = install[key] ?? "";
78
+ }
79
+ return { contents, origins: install.origins ?? [] };
80
+ }
81
+ }
@@ -0,0 +1,59 @@
1
+ import { ApprovalAnswer } from "../policy/auto-deploy-policy.js";
2
+ /** What `sk deploy --mr` is asked to deploy. */
3
+ export declare class MergeRequestDeployContext {
4
+ readonly customerPath: string;
5
+ readonly configName: string;
6
+ /** The number of the merged merge request. */
7
+ readonly iid: number;
8
+ readonly approval: ApprovalAnswer;
9
+ /** The description of the installations. It is asked while it is left out. */
10
+ readonly description?: string;
11
+ readonly dryRun: boolean;
12
+ /** Leave out the checks that run after the upload, as a bulk run does. */
13
+ readonly skipPostDeployChecks: boolean;
14
+ /**
15
+ * Whether a person watches this deploy.
16
+ *
17
+ * They get the diff of every file the merge request changed, in the diff
18
+ * tool they use for every other deploy, and they confirm the upload.
19
+ */
20
+ readonly interactive: boolean;
21
+ constructor(customerPath: string, configName: string,
22
+ /** The number of the merged merge request. */
23
+ iid: number, approval: ApprovalAnswer,
24
+ /** The description of the installations. It is asked while it is left out. */
25
+ description?: string, dryRun?: boolean,
26
+ /** Leave out the checks that run after the upload, as a bulk run does. */
27
+ skipPostDeployChecks?: boolean,
28
+ /**
29
+ * Whether a person watches this deploy.
30
+ *
31
+ * They get the diff of every file the merge request changed, in the diff
32
+ * tool they use for every other deploy, and they confirm the upload.
33
+ */
34
+ interactive?: boolean);
35
+ }
36
+ /** What a deploy of one configuration ended with, or would end with. */
37
+ export declare enum DeployOutcome {
38
+ /** A plan only: the live installation is the state before the merge request. */
39
+ Deployable = "deployable",
40
+ /** The merge request changes nothing this configuration deploys. */
41
+ Unchanged = "unchanged",
42
+ /** The configuration was deployed. */
43
+ Applied = "applied",
44
+ /** The configuration was left to a developer. */
45
+ Skipped = "skipped",
46
+ /** The live installation already carried the merge request. */
47
+ AlreadyDeployed = "alreadyDeployed",
48
+ /** The deploy of the configuration failed. */
49
+ Failed = "failed"
50
+ }
51
+ export interface MergeRequestDeployResult {
52
+ customerPath: string;
53
+ configName: string;
54
+ outcome: DeployOutcome;
55
+ /** Why the configuration was not deployed. */
56
+ reason?: string;
57
+ /** The files of the merge request that this deploy never uploads. */
58
+ notDeployed?: string[];
59
+ }
@@ -0,0 +1,50 @@
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
+ /** What a deploy of one configuration ended with, or would end with. */
36
+ export var DeployOutcome;
37
+ (function (DeployOutcome) {
38
+ /** A plan only: the live installation is the state before the merge request. */
39
+ DeployOutcome["Deployable"] = "deployable";
40
+ /** The merge request changes nothing this configuration deploys. */
41
+ DeployOutcome["Unchanged"] = "unchanged";
42
+ /** The configuration was deployed. */
43
+ DeployOutcome["Applied"] = "applied";
44
+ /** The configuration was left to a developer. */
45
+ DeployOutcome["Skipped"] = "skipped";
46
+ /** The live installation already carried the merge request. */
47
+ DeployOutcome["AlreadyDeployed"] = "alreadyDeployed";
48
+ /** The deploy of the configuration failed. */
49
+ DeployOutcome["Failed"] = "failed";
50
+ })(DeployOutcome || (DeployOutcome = {}));