@speedkit/cli 2.4.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 (385) hide show
  1. package/README.md +775 -0
  2. package/bin/dev +18 -0
  3. package/bin/dev.cmd +3 -0
  4. package/bin/run +4 -0
  5. package/bin/run.cmd +3 -0
  6. package/dist/commands/airports_iata.json +1 -0
  7. package/dist/commands/build-parameter-query.d.ts +15 -0
  8. package/dist/commands/build-parameter-query.js +95 -0
  9. package/dist/commands/build-prewarm-query.d.ts +15 -0
  10. package/dist/commands/build-prewarm-query.js +69 -0
  11. package/dist/commands/deploy.d.ts +17 -0
  12. package/dist/commands/deploy.js +39 -0
  13. package/dist/commands/document-handler.d.ts +16 -0
  14. package/dist/commands/document-handler.js +36 -0
  15. package/dist/commands/find-pops.d.ts +17 -0
  16. package/dist/commands/find-pops.js +84 -0
  17. package/dist/commands/generate-customer-config.d.ts +10 -0
  18. package/dist/commands/generate-customer-config.js +29 -0
  19. package/dist/commands/generate-pop-config.d.ts +27 -0
  20. package/dist/commands/generate-pop-config.js +231 -0
  21. package/dist/commands/login.d.ts +10 -0
  22. package/dist/commands/login.js +35 -0
  23. package/dist/commands/onboarding.d.ts +16 -0
  24. package/dist/commands/onboarding.js +25 -0
  25. package/dist/commands/param-diff.d.ts +16 -0
  26. package/dist/commands/param-diff.js +111 -0
  27. package/dist/commands/pop-prewarm.d.ts +17 -0
  28. package/dist/commands/pop-prewarm.js +80 -0
  29. package/dist/commands/prewarm.d.ts +40 -0
  30. package/dist/commands/prewarm.js +127 -0
  31. package/dist/commands/pull.d.ts +14 -0
  32. package/dist/commands/pull.js +24 -0
  33. package/dist/commands/wpt-launcher.d.ts +21 -0
  34. package/dist/commands/wpt-launcher.js +79 -0
  35. package/dist/helpers/CustomerConfig.d.ts +51 -0
  36. package/dist/helpers/CustomerConfig.js +150 -0
  37. package/dist/helpers/build-query-helper.d.ts +32 -0
  38. package/dist/helpers/build-query-helper.js +216 -0
  39. package/dist/helpers/cli-config.d.ts +22 -0
  40. package/dist/helpers/cli-config.js +85 -0
  41. package/dist/helpers/file-helper.d.ts +8 -0
  42. package/dist/helpers/file-helper.js +63 -0
  43. package/dist/helpers/get-parsed-config.d.ts +11 -0
  44. package/dist/helpers/get-parsed-config.js +63 -0
  45. package/dist/helpers/getChromePath.d.ts +7 -0
  46. package/dist/helpers/getChromePath.js +27 -0
  47. package/dist/helpers/isDirectory.d.ts +1 -0
  48. package/dist/helpers/isDirectory.js +17 -0
  49. package/dist/helpers/isExecutable.d.ts +1 -0
  50. package/dist/helpers/isExecutable.js +15 -0
  51. package/dist/helpers/isFile.d.ts +1 -0
  52. package/dist/helpers/isFile.js +17 -0
  53. package/dist/helpers/logging-helper.d.ts +12 -0
  54. package/dist/helpers/logging-helper.js +27 -0
  55. package/dist/helpers/normalize.d.ts +40 -0
  56. package/dist/helpers/normalize.js +112 -0
  57. package/dist/helpers/race.d.ts +1 -0
  58. package/dist/helpers/race.js +16 -0
  59. package/dist/helpers/safe.d.ts +10 -0
  60. package/dist/helpers/safe.js +34 -0
  61. package/dist/helpers/scrape.d.ts +1 -0
  62. package/dist/helpers/scrape.js +11 -0
  63. package/dist/helpers/speedKitRuleToRegExp.d.ts +1 -0
  64. package/dist/helpers/speedKitRuleToRegExp.js +10 -0
  65. package/dist/helpers/watchFiles.d.ts +1 -0
  66. package/dist/helpers/watchFiles.js +20 -0
  67. package/dist/models/cli-parameters.d.ts +73 -0
  68. package/dist/models/cli-parameters.js +82 -0
  69. package/dist/models/files.d.ts +20 -0
  70. package/dist/models/files.js +23 -0
  71. package/dist/models/install.d.ts +24 -0
  72. package/dist/models/install.js +2 -0
  73. package/dist/services/athena-service.d.ts +30 -0
  74. package/dist/services/athena-service.js +139 -0
  75. package/dist/services/bundler/bundle-service-factory.d.ts +4 -0
  76. package/dist/services/bundler/bundle-service-factory.js +10 -0
  77. package/dist/services/bundler/bundle-service.d.ts +25 -0
  78. package/dist/services/bundler/bundle-service.js +84 -0
  79. package/dist/services/bundler/index.d.ts +2 -0
  80. package/dist/services/bundler/index.js +5 -0
  81. package/dist/services/cli/cli-service-factory.d.ts +5 -0
  82. package/dist/services/cli/cli-service-factory.js +14 -0
  83. package/dist/services/cli/cli-service-model.d.ts +27 -0
  84. package/dist/services/cli/cli-service-model.js +9 -0
  85. package/dist/services/cli/cli-service.d.ts +37 -0
  86. package/dist/services/cli/cli-service.js +123 -0
  87. package/dist/services/cli/error/cli-type-error.d.ts +3 -0
  88. package/dist/services/cli/error/cli-type-error.js +7 -0
  89. package/dist/services/cli/hooks.d.ts +11 -0
  90. package/dist/services/cli/hooks.js +33 -0
  91. package/dist/services/cli/index.d.ts +3 -0
  92. package/dist/services/cli/index.js +6 -0
  93. package/dist/services/config-api/client.d.ts +16 -0
  94. package/dist/services/config-api/client.js +54 -0
  95. package/dist/services/config-api/config-api-service.d.ts +16 -0
  96. package/dist/services/config-api/config-api-service.js +56 -0
  97. package/dist/services/config-api/context/config-api-context.d.ts +5 -0
  98. package/dist/services/config-api/context/config-api-context.js +9 -0
  99. package/dist/services/config-api/error/json-response-error.d.ts +2 -0
  100. package/dist/services/config-api/error/json-response-error.js +5 -0
  101. package/dist/services/config-api/error/login-error.d.ts +5 -0
  102. package/dist/services/config-api/error/login-error.js +12 -0
  103. package/dist/services/config-api/factory/config-api-service-factory.d.ts +10 -0
  104. package/dist/services/config-api/factory/config-api-service-factory.js +38 -0
  105. package/dist/services/config-api/factory/entity-manager-factory.d.ts +5 -0
  106. package/dist/services/config-api/factory/entity-manager-factory.js +21 -0
  107. package/dist/services/config-api/interface/config-api-context-interface.d.ts +4 -0
  108. package/dist/services/config-api/interface/config-api-context-interface.js +2 -0
  109. package/dist/services/config-api/interface/request-extension-interface.d.ts +5 -0
  110. package/dist/services/config-api/interface/request-extension-interface.js +2 -0
  111. package/dist/services/config-api-service.d.ts +18 -0
  112. package/dist/services/config-api-service.js +96 -0
  113. package/dist/services/context/app-context.d.ts +1 -0
  114. package/dist/services/context/app-context.js +2 -0
  115. package/dist/services/context/error/context-runtime-error.d.ts +3 -0
  116. package/dist/services/context/error/context-runtime-error.js +7 -0
  117. package/dist/services/context/interface/context-interface.d.ts +2 -0
  118. package/dist/services/context/interface/context-interface.js +2 -0
  119. package/dist/services/customer-config/customer-config-service-context.d.ts +5 -0
  120. package/dist/services/customer-config/customer-config-service-context.js +15 -0
  121. package/dist/services/customer-config/customer-config-service-factory.d.ts +8 -0
  122. package/dist/services/customer-config/customer-config-service-factory.js +24 -0
  123. package/dist/services/customer-config/customer-config-service-model.d.ts +39 -0
  124. package/dist/services/customer-config/customer-config-service-model.js +23 -0
  125. package/dist/services/customer-config/customer-config-service.d.ts +27 -0
  126. package/dist/services/customer-config/customer-config-service.js +263 -0
  127. package/dist/services/customer-config/index.d.ts +4 -0
  128. package/dist/services/customer-config/index.js +7 -0
  129. package/dist/services/customer-config/templates/config_SpeedKit.js.hbs +351 -0
  130. package/dist/services/customer-config/templates/config_customer.js.hbs +75 -0
  131. package/dist/services/customer-config/templates/config_documentHandler.js.hbs +162 -0
  132. package/dist/services/customer-config/templates/config_dynamicBlocks.es6.hbs +263 -0
  133. package/dist/services/customer-config/templates/config_dynamicStyles.css.hbs +116 -0
  134. package/dist/services/customer-config/templates/config_loadHandler.js.hbs +394 -0
  135. package/dist/services/customer-config/templates/deploymentDetection.es6.hbs +262 -0
  136. package/dist/services/customer-config/templates/downtimeDetection.js.hbs +110 -0
  137. package/dist/services/deploy/builder/install-resource-builder.d.ts +14 -0
  138. package/dist/services/deploy/builder/install-resource-builder.js +48 -0
  139. package/dist/services/deploy/checks/post-deploy/revalidated-module-check.d.ts +11 -0
  140. package/dist/services/deploy/checks/post-deploy/revalidated-module-check.js +30 -0
  141. package/dist/services/deploy/checks/post-deploy/save-files-check.d.ts +9 -0
  142. package/dist/services/deploy/checks/post-deploy/save-files-check.js +25 -0
  143. package/dist/services/deploy/context/deploy-context.d.ts +12 -0
  144. package/dist/services/deploy/context/deploy-context.js +26 -0
  145. package/dist/services/deploy/deploy-service-factory.d.ts +15 -0
  146. package/dist/services/deploy/deploy-service-factory.js +68 -0
  147. package/dist/services/deploy/deploy-service.d.ts +17 -0
  148. package/dist/services/deploy/deploy-service.js +63 -0
  149. package/dist/services/deploy/error/create-find-temp-directory-error.d.ts +4 -0
  150. package/dist/services/deploy/error/create-find-temp-directory-error.js +10 -0
  151. package/dist/services/deploy/error/deploy-app-error.d.ts +2 -0
  152. package/dist/services/deploy/error/deploy-app-error.js +5 -0
  153. package/dist/services/deploy/error/no-active-installation-error.d.ts +4 -0
  154. package/dist/services/deploy/error/no-active-installation-error.js +10 -0
  155. package/dist/services/deploy/handler/customer-config-handler.d.ts +21 -0
  156. package/dist/services/deploy/handler/customer-config-handler.js +85 -0
  157. package/dist/services/deploy/handler/install-resource-handler.d.ts +25 -0
  158. package/dist/services/deploy/handler/install-resource-handler.js +104 -0
  159. package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.d.ts +13 -0
  160. package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.js +51 -0
  161. package/dist/services/deploy/handler/module-handler.d.ts +14 -0
  162. package/dist/services/deploy/handler/module-handler.js +81 -0
  163. package/dist/services/deploy/handler/module-modifier/deployment-detection-modifier.d.ts +9 -0
  164. package/dist/services/deploy/handler/module-modifier/deployment-detection-modifier.js +24 -0
  165. package/dist/services/deploy/handler/server-config-handler.d.ts +12 -0
  166. package/dist/services/deploy/handler/server-config-handler.js +63 -0
  167. package/dist/services/deploy/interface/deploy-handler-interface.d.ts +6 -0
  168. package/dist/services/deploy/interface/deploy-handler-interface.js +2 -0
  169. package/dist/services/deploy/interface/install-configs.d.ts +11 -0
  170. package/dist/services/deploy/interface/install-configs.js +2 -0
  171. package/dist/services/deploy/interface/install-resource-processor-interface.d.ts +5 -0
  172. package/dist/services/deploy/interface/install-resource-processor-interface.js +2 -0
  173. package/dist/services/deploy/interface/install.d.ts +14 -0
  174. package/dist/services/deploy/interface/install.js +2 -0
  175. package/dist/services/deploy/interface/post-deploy-check-interface.d.ts +3 -0
  176. package/dist/services/deploy/interface/post-deploy-check-interface.js +2 -0
  177. package/dist/services/deploy/interface/runtime-modifier.d.ts +6 -0
  178. package/dist/services/deploy/interface/runtime-modifier.js +2 -0
  179. package/dist/services/deploy/interface/validate-origins-response.d.ts +4 -0
  180. package/dist/services/deploy/interface/validate-origins-response.js +2 -0
  181. package/dist/services/diff/diff-model.d.ts +5 -0
  182. package/dist/services/diff/diff-model.js +12 -0
  183. package/dist/services/diff/diff-service-factory.d.ts +7 -0
  184. package/dist/services/diff/diff-service-factory.js +20 -0
  185. package/dist/services/diff/diff-service.d.ts +34 -0
  186. package/dist/services/diff/diff-service.js +134 -0
  187. package/dist/services/diff/index.d.ts +3 -0
  188. package/dist/services/diff/index.js +6 -0
  189. package/dist/services/diff-service.d.ts +24 -0
  190. package/dist/services/diff-service.js +112 -0
  191. package/dist/services/document-handler-runtime/context/document-handler-runtime-context.d.ts +23 -0
  192. package/dist/services/document-handler-runtime/context/document-handler-runtime-context.js +41 -0
  193. package/dist/services/document-handler-runtime/document-handler-runtime-service.d.ts +32 -0
  194. package/dist/services/document-handler-runtime/document-handler-runtime-service.js +220 -0
  195. package/dist/services/document-handler-runtime/document-handler-server.d.ts +42 -0
  196. package/dist/services/document-handler-runtime/document-handler-server.js +225 -0
  197. package/dist/services/document-handler-runtime/error/handler/required-file-not-found-handler.d.ts +6 -0
  198. package/dist/services/document-handler-runtime/error/handler/required-file-not-found-handler.js +14 -0
  199. package/dist/services/document-handler-runtime/error/required-file-not-found-error.d.ts +3 -0
  200. package/dist/services/document-handler-runtime/error/required-file-not-found-error.js +7 -0
  201. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +24 -0
  202. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +106 -0
  203. package/dist/services/document-handler-runtime/interface/document-handler-runtime-config-interface.d.ts +3 -0
  204. package/dist/services/document-handler-runtime/interface/document-handler-runtime-config-interface.js +6 -0
  205. package/dist/services/document-handler-runtime/interface/template-context-interface.d.ts +3 -0
  206. package/dist/services/document-handler-runtime/interface/template-context-interface.js +2 -0
  207. package/dist/services/document-handler-runtime/interface/template-interface.d.ts +6 -0
  208. package/dist/services/document-handler-runtime/interface/template-interface.js +2 -0
  209. package/dist/services/document-handler-runtime/interface/template-param-interface.d.ts +4 -0
  210. package/dist/services/document-handler-runtime/interface/template-param-interface.js +2 -0
  211. package/dist/services/document-handler-runtime/templates/abstract-template.d.ts +9 -0
  212. package/dist/services/document-handler-runtime/templates/abstract-template.js +18 -0
  213. package/dist/services/document-handler-runtime/templates/database-mock.d.ts +6 -0
  214. package/dist/services/document-handler-runtime/templates/database-mock.js +111 -0
  215. package/dist/services/document-handler-runtime/templates/execute-document-handler.d.ts +6 -0
  216. package/dist/services/document-handler-runtime/templates/execute-document-handler.js +76 -0
  217. package/dist/services/document-handler-runtime/templates/orestes-mock.d.ts +9 -0
  218. package/dist/services/document-handler-runtime/templates/orestes-mock.js +168 -0
  219. package/dist/services/document-handler-runtime/templates/package-json.d.ts +8 -0
  220. package/dist/services/document-handler-runtime/templates/package-json.js +21 -0
  221. package/dist/services/document-handler-runtime/templates/test.d.ts +6 -0
  222. package/dist/services/document-handler-runtime/templates/test.js +63 -0
  223. package/dist/services/error-handling/abstract/abstract-async-error-handling-factory.d.ts +6 -0
  224. package/dist/services/error-handling/abstract/abstract-async-error-handling-factory.js +19 -0
  225. package/dist/services/error-handling/abstract/abstract-async-error-handling-service.d.ts +6 -0
  226. package/dist/services/error-handling/abstract/abstract-async-error-handling-service.js +18 -0
  227. package/dist/services/error-handling/abstract/abstract-error-handling-factory.d.ts +6 -0
  228. package/dist/services/error-handling/abstract/abstract-error-handling-factory.js +19 -0
  229. package/dist/services/error-handling/abstract/abstract-error-handling-service.d.ts +6 -0
  230. package/dist/services/error-handling/abstract/abstract-error-handling-service.js +19 -0
  231. package/dist/services/error-handling/error/application-error.d.ts +5 -0
  232. package/dist/services/error-handling/error/application-error.js +11 -0
  233. package/dist/services/error-handling/error/handler/default-error-handler.d.ts +5 -0
  234. package/dist/services/error-handling/error/handler/default-error-handler.js +13 -0
  235. package/dist/services/error-handling/error-handling-service.d.ts +7 -0
  236. package/dist/services/error-handling/error-handling-service.js +27 -0
  237. package/dist/services/error-handling/factory/error-handling-factory.d.ts +8 -0
  238. package/dist/services/error-handling/factory/error-handling-factory.js +21 -0
  239. package/dist/services/error-handling/interface/error-context-interface.d.ts +6 -0
  240. package/dist/services/error-handling/interface/error-context-interface.js +2 -0
  241. package/dist/services/error-handling/interface/error-handler-interface.d.ts +5 -0
  242. package/dist/services/error-handling/interface/error-handler-interface.js +2 -0
  243. package/dist/services/error-handling/interface/error-handling-factory-interface.d.ts +8 -0
  244. package/dist/services/error-handling/interface/error-handling-factory-interface.js +2 -0
  245. package/dist/services/error-handling/interface/error-handling-service-interface.d.ts +8 -0
  246. package/dist/services/error-handling/interface/error-handling-service-interface.js +2 -0
  247. package/dist/services/integration-api/context/integration-api-context.d.ts +9 -0
  248. package/dist/services/integration-api/context/integration-api-context.js +20 -0
  249. package/dist/services/integration-api/error/customer-config-error.d.ts +2 -0
  250. package/dist/services/integration-api/error/customer-config-error.js +5 -0
  251. package/dist/services/integration-api/error/customer-config-legacy-error.d.ts +3 -0
  252. package/dist/services/integration-api/error/customer-config-legacy-error.js +7 -0
  253. package/dist/services/integration-api/error/handler/customer-config-handler.d.ts +5 -0
  254. package/dist/services/integration-api/error/handler/customer-config-handler.js +19 -0
  255. package/dist/services/integration-api/error/handler/customer-config-legacy-handler.d.ts +6 -0
  256. package/dist/services/integration-api/error/handler/customer-config-legacy-handler.js +24 -0
  257. package/dist/services/integration-api/error/handler/origin-handler.d.ts +6 -0
  258. package/dist/services/integration-api/error/handler/origin-handler.js +22 -0
  259. package/dist/services/integration-api/error/load-customer-error.d.ts +4 -0
  260. package/dist/services/integration-api/error/load-customer-error.js +10 -0
  261. package/dist/services/integration-api/error/mandatory-file-missing-error.d.ts +3 -0
  262. package/dist/services/integration-api/error/mandatory-file-missing-error.js +8 -0
  263. package/dist/services/integration-api/error/origin-error.d.ts +3 -0
  264. package/dist/services/integration-api/error/origin-error.js +7 -0
  265. package/dist/services/integration-api/external/external-file-reader.d.ts +4 -0
  266. package/dist/services/integration-api/external/external-file-reader.js +17 -0
  267. package/dist/services/integration-api/factory/integration-api-service-factory.d.ts +13 -0
  268. package/dist/services/integration-api/factory/integration-api-service-factory.js +55 -0
  269. package/dist/services/integration-api/file-list.d.ts +18 -0
  270. package/dist/services/integration-api/file-list.js +79 -0
  271. package/dist/services/integration-api/file-reader.d.ts +15 -0
  272. package/dist/services/integration-api/file-reader.js +97 -0
  273. package/dist/services/integration-api/file-writer.d.ts +9 -0
  274. package/dist/services/integration-api/file-writer.js +27 -0
  275. package/dist/services/integration-api/handler/customer-config-handler.d.ts +16 -0
  276. package/dist/services/integration-api/handler/customer-config-handler.js +55 -0
  277. package/dist/services/integration-api/handler/file-handler.d.ts +9 -0
  278. package/dist/services/integration-api/handler/file-handler.js +20 -0
  279. package/dist/services/integration-api/handler/install-resource-handler.d.ts +33 -0
  280. package/dist/services/integration-api/handler/install-resource-handler.js +67 -0
  281. package/dist/services/integration-api/handler/module-handler.d.ts +12 -0
  282. package/dist/services/integration-api/handler/module-handler.js +20 -0
  283. package/dist/services/integration-api/handler/server-config-handler.d.ts +8 -0
  284. package/dist/services/integration-api/handler/server-config-handler.js +21 -0
  285. package/dist/services/integration-api/integration-api-model.d.ts +89 -0
  286. package/dist/services/integration-api/integration-api-model.js +2 -0
  287. package/dist/services/integration-api/integration-api-service.d.ts +21 -0
  288. package/dist/services/integration-api/integration-api-service.js +76 -0
  289. package/dist/services/integration-api/struct/customer-config-file.d.ts +10 -0
  290. package/dist/services/integration-api/struct/customer-config-file.js +32 -0
  291. package/dist/services/integration-api/struct/customer-config.d.ts +22 -0
  292. package/dist/services/integration-api/struct/customer-config.js +67 -0
  293. package/dist/services/integration-api/struct/file.d.ts +19 -0
  294. package/dist/services/integration-api/struct/file.js +61 -0
  295. package/dist/services/integration-api/struct/install-resource-file.d.ts +6 -0
  296. package/dist/services/integration-api/struct/install-resource-file.js +12 -0
  297. package/dist/services/integration-api/struct/module-file.d.ts +5 -0
  298. package/dist/services/integration-api/struct/module-file.js +10 -0
  299. package/dist/services/integration-api/struct/ro-file.d.ts +13 -0
  300. package/dist/services/integration-api/struct/ro-file.js +26 -0
  301. package/dist/services/integration-api/struct/server-config-file.d.ts +9 -0
  302. package/dist/services/integration-api/struct/server-config-file.js +22 -0
  303. package/dist/services/integration-api/struct/virtual-file.d.ts +14 -0
  304. package/dist/services/integration-api/struct/virtual-file.js +28 -0
  305. package/dist/services/integration-api/validator/customer-config-validator.d.ts +5 -0
  306. package/dist/services/integration-api/validator/customer-config-validator.js +23 -0
  307. package/dist/services/integration-api/validator/mandatory-files-validator.d.ts +7 -0
  308. package/dist/services/integration-api/validator/mandatory-files-validator.js +39 -0
  309. package/dist/services/integration-api/virtual/external-recipe.d.ts +9 -0
  310. package/dist/services/integration-api/virtual/external-recipe.js +19 -0
  311. package/dist/services/integration-api/virtual/virtual-file-handler.d.ts +7 -0
  312. package/dist/services/integration-api/virtual/virtual-file-handler.js +38 -0
  313. package/dist/services/onboarding/browser/abort-response.d.ts +5 -0
  314. package/dist/services/onboarding/browser/abort-response.js +10 -0
  315. package/dist/services/onboarding/browser/baqend-response.d.ts +12 -0
  316. package/dist/services/onboarding/browser/baqend-response.js +52 -0
  317. package/dist/services/onboarding/browser/origin-response.d.ts +8 -0
  318. package/dist/services/onboarding/browser/origin-response.js +20 -0
  319. package/dist/services/onboarding/config-renderer/install-file-recipe.d.ts +7 -0
  320. package/dist/services/onboarding/config-renderer/install-file-recipe.js +13 -0
  321. package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +22 -0
  322. package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +78 -0
  323. package/dist/services/onboarding/dashboard/athena-service.d.ts +11 -0
  324. package/dist/services/onboarding/dashboard/athena-service.js +70 -0
  325. package/dist/services/onboarding/dashboard/frontend-dist/assets/index-87b53ed4.css +1 -0
  326. package/dist/services/onboarding/dashboard/frontend-dist/assets/main-274b5625.js +9 -0
  327. package/dist/services/onboarding/dashboard/frontend-dist/index.html +18 -0
  328. package/dist/services/onboarding/dashboard/index.d.ts +16 -0
  329. package/dist/services/onboarding/dashboard/index.js +78 -0
  330. package/dist/services/onboarding/dashboard/param-query-builder.d.ts +9 -0
  331. package/dist/services/onboarding/dashboard/param-query-builder.js +67 -0
  332. package/dist/services/onboarding/dashboard/request-diff-service.d.ts +11 -0
  333. package/dist/services/onboarding/dashboard/request-diff-service.js +59 -0
  334. package/dist/services/onboarding/error/vm-error.d.ts +2 -0
  335. package/dist/services/onboarding/error/vm-error.js +6 -0
  336. package/dist/services/onboarding/fetch-event-handler.d.ts +19 -0
  337. package/dist/services/onboarding/fetch-event-handler.js +155 -0
  338. package/dist/services/onboarding/fetch-events/customer-domain-document-response.d.ts +24 -0
  339. package/dist/services/onboarding/fetch-events/customer-domain-document-response.js +118 -0
  340. package/dist/services/onboarding/fetch-events/customer-service-worker-js.d.ts +14 -0
  341. package/dist/services/onboarding/fetch-events/customer-service-worker-js.js +30 -0
  342. package/dist/services/onboarding/fetch-events/dashboard-request.d.ts +15 -0
  343. package/dist/services/onboarding/fetch-events/dashboard-request.js +29 -0
  344. package/dist/services/onboarding/fetch-events/speed-kit-asset-request.d.ts +26 -0
  345. package/dist/services/onboarding/fetch-events/speed-kit-asset-request.js +138 -0
  346. package/dist/services/onboarding/fetch-events/speed-kit-install-html.d.ts +15 -0
  347. package/dist/services/onboarding/fetch-events/speed-kit-install-html.js +49 -0
  348. package/dist/services/onboarding/fetch-events/speed-kit-install-js.d.ts +22 -0
  349. package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +62 -0
  350. package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +21 -0
  351. package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +43 -0
  352. package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +17 -0
  353. package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +27 -0
  354. package/dist/services/onboarding/file-events/fileWatcher.d.ts +28 -0
  355. package/dist/services/onboarding/file-events/fileWatcher.js +133 -0
  356. package/dist/services/onboarding/index.d.ts +3 -0
  357. package/dist/services/onboarding/index.js +8 -0
  358. package/dist/services/onboarding/onboarding-model.d.ts +30 -0
  359. package/dist/services/onboarding/onboarding-model.js +53 -0
  360. package/dist/services/onboarding/onboarding-service-factory.d.ts +16 -0
  361. package/dist/services/onboarding/onboarding-service-factory.js +163 -0
  362. package/dist/services/onboarding/onboarding-service.d.ts +31 -0
  363. package/dist/services/onboarding/onboarding-service.js +130 -0
  364. package/dist/services/onboarding/request-cache/cache.d.ts +15 -0
  365. package/dist/services/onboarding/request-cache/cache.js +32 -0
  366. package/dist/services/onboarding/templates/install-speed-kit-html-template.d.ts +4 -0
  367. package/dist/services/onboarding/templates/install-speed-kit-html-template.js +264 -0
  368. package/dist/services/onboarding/templates/install-speed-kit-js-template.d.ts +4 -0
  369. package/dist/services/onboarding/templates/install-speed-kit-js-template.js +41 -0
  370. package/dist/services/onboarding/todo-collector.d.ts +18 -0
  371. package/dist/services/onboarding/todo-collector.js +48 -0
  372. package/dist/services/prewarm-service.d.ts +5 -0
  373. package/dist/services/prewarm-service.js +57 -0
  374. package/dist/services/pull/index.d.ts +3 -0
  375. package/dist/services/pull/index.js +6 -0
  376. package/dist/services/pull/pull-service-factory.d.ts +12 -0
  377. package/dist/services/pull/pull-service-factory.js +44 -0
  378. package/dist/services/pull/pull-service-model.d.ts +43 -0
  379. package/dist/services/pull/pull-service-model.js +27 -0
  380. package/dist/services/pull/pull-service.d.ts +18 -0
  381. package/dist/services/pull/pull-service.js +106 -0
  382. package/dist/templates/pops.js +97 -0
  383. package/dist/templates/speedKit.Revalidated.js +86 -0
  384. package/oclif.manifest.json +700 -0
  385. package/package.json +128 -0
@@ -0,0 +1,110 @@
1
+ const fetch = require('node-fetch');
2
+ const { SLACK_WEB_HOOK_URL, APP_API_TOKEN } = require('./parameters');
3
+
4
+ /**
5
+ * Run this as a CRON job every 5 minutes.
6
+ *
7
+ * NOTE: Do not forget to change page specific parts for your customer!
8
+ * NOTE: Do not forget to create the parameters module with slack URL and admin API token
9
+ */
10
+ async function call(db, data, req) {
11
+ const landingPage = 'https://{{production.host}}/';
12
+ const maintenancePageRegex = /maintenance\.{{appName}}/g;
13
+
14
+ const landingPageDown = await isLandingPageDown(landingPage, maintenancePageRegex);
15
+
16
+ if (!landingPageDown) {
17
+ return { status: 'success' };
18
+ }
19
+
20
+ loginAdmin(db);
21
+
22
+ const deactivated = await deactiveSpeedKit(db);
23
+ if (deactivated) {
24
+ notifyBaqend(landingPage);
25
+ }
26
+
27
+ return { status: 'downtime' };
28
+ }
29
+
30
+ /**
31
+ * Logs in an admin.
32
+ *
33
+ * @param db The database to perform the login with
34
+ */
35
+ async function loginAdmin(db) {
36
+ await db.loginWithToken(APP_API_TOKEN);
37
+ }
38
+
39
+ function notifyBaqend(landingPage) {
40
+ const body = JSON.stringify({
41
+ "username": 'Downtime Detection',
42
+ "text": `Speed Kit was deactivated due to downtime of ${landingPage}`,
43
+ });
44
+ return fetch(SLACK_WEB_HOOK_URL, { method: 'POST', body })
45
+ }
46
+
47
+ /**
48
+ * Deactivates Speed Kit via the config.
49
+ */
50
+ async function deactiveSpeedKit(db) {
51
+ const config = (await db.send(new db.message.GetOrestesConfig())).entity;
52
+
53
+ if (!config.speedKit.enabled) {
54
+ // Speed Kit already deactivated
55
+ return false;
56
+ }
57
+
58
+ // Deactivate Speed Kit
59
+ config.speedKit.enabled = false;
60
+ const configUpdate = new db.message.UpdateOrestesConfig(config).ifMatch(config.revision.version);
61
+ await db.send(configUpdate);
62
+ return true;
63
+ }
64
+
65
+ /**
66
+ * Returns whether the landing page is not reachable.
67
+ *
68
+ * @param landingPage The page to test.
69
+ * @param maintenancePageRegex The page to identify redirects to maintenance page.
70
+ * @param retry The number of already failed tries to load the page.
71
+ * @returns `true` if the landing page is not reachable, `false` otherwise.
72
+ */
73
+ async function isLandingPageDown(landingPage, maintenancePageRegex, retry = 0) {
74
+ const res = await fetch(landingPage);
75
+
76
+ // Valid response
77
+ if (res.status < 300) {
78
+ return false;
79
+ }
80
+
81
+ // Redirect
82
+ if (res.status < 400) {
83
+ return isMaintenanceRedirect(res, maintenancePageRegex);
84
+ }
85
+
86
+ // Error
87
+ if (retry > 3) {
88
+ return true;
89
+ }
90
+
91
+ // Retry after error
92
+ await sleep(10000);
93
+ return isLandingPageDown(retry + 1);
94
+ }
95
+
96
+ /**
97
+ * Returns whether the response redirects to the maintenance page.
98
+ *
99
+ * @param maintenancePageRegex The page to identify redirects to maintenance page.
100
+ */
101
+ async function isMaintenanceRedirect(res, maintenancePageRegex) {
102
+ const location = res.headers.get('Location') || '';
103
+ return maintenancePageRegex.test(location);
104
+ }
105
+
106
+ async function sleep(milliseconds) {
107
+ return new Promise(res => setTimeout(res, milliseconds));
108
+ }
109
+
110
+ exports.call = call;
@@ -0,0 +1,14 @@
1
+ import Install from "../interface/install";
2
+ import ConfigApi from "../../config-api/config-api-service";
3
+ export default class InstallResourceBuilder {
4
+ changed: boolean;
5
+ resource: Install;
6
+ configApi: ConfigApi;
7
+ constructor(configApi: ConfigApi);
8
+ init(configName: string): Promise<Install>;
9
+ merge(installParams: Install): void;
10
+ updateFromRemote(remoteParams: Install): Install;
11
+ hasChanges(): boolean;
12
+ getInstallResource(): Install;
13
+ private deepMerge;
14
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const deepmerge_1 = tslib_1.__importDefault(require("deepmerge"));
5
+ class InstallResourceBuilder {
6
+ changed = false;
7
+ resource;
8
+ configApi;
9
+ constructor(configApi) {
10
+ this.configApi = configApi;
11
+ }
12
+ async init(configName) {
13
+ if (this.resource !== undefined) {
14
+ return this.resource;
15
+ }
16
+ this.resource = await this.configApi.getActiveInstall(configName) || {
17
+ domain: configName,
18
+ origins: [],
19
+ configVersion: 1
20
+ };
21
+ return this.resource;
22
+ }
23
+ merge(installParams) {
24
+ this.changed = true;
25
+ this.resource = this.deepMerge(this.resource, installParams);
26
+ }
27
+ updateFromRemote(remoteParams) {
28
+ this.changed = true;
29
+ this.resource = this.deepMerge(remoteParams, this.resource);
30
+ this.resource.id = remoteParams.id;
31
+ this.resource.version = remoteParams.version;
32
+ this.resource.configVersion = remoteParams.configVersion;
33
+ this.resource.status = 'inactive';
34
+ return this.resource;
35
+ }
36
+ hasChanges() {
37
+ return this.changed;
38
+ }
39
+ getInstallResource() {
40
+ return this.resource;
41
+ }
42
+ deepMerge(object1, object2) {
43
+ return (0, deepmerge_1.default)(object1, object2, {
44
+ arrayMerge: (destinationArray, sourceArray, options) => sourceArray
45
+ });
46
+ }
47
+ }
48
+ exports.default = InstallResourceBuilder;
@@ -0,0 +1,11 @@
1
+ import { CliService } from "../../../cli";
2
+ import ConfigApiService from "../../../config-api/config-api-service";
3
+ import PostDeployCheckInterface from "../../interface/post-deploy-check-interface";
4
+ export default class RevalidatedModuleCheck implements PostDeployCheckInterface {
5
+ private readonly configApi;
6
+ private cli;
7
+ private readonly app;
8
+ constructor(configApi: ConfigApiService, cli: CliService, app: string);
9
+ check(): Promise<void>;
10
+ private showMessage;
11
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const REVALIDATED_MODULE_NAME = 'speedKit.Revalidated';
4
+ class RevalidatedModuleCheck {
5
+ configApi;
6
+ cli;
7
+ app;
8
+ constructor(configApi, cli, app) {
9
+ this.configApi = configApi;
10
+ this.cli = cli;
11
+ this.app = app;
12
+ }
13
+ async check() {
14
+ try {
15
+ const module = await this.configApi.getModule(REVALIDATED_MODULE_NAME);
16
+ if (!module) {
17
+ this.showMessage();
18
+ }
19
+ }
20
+ catch (error) {
21
+ this.showMessage();
22
+ }
23
+ }
24
+ showMessage() {
25
+ this.cli.writeError(`it seems ${REVALIDATED_MODULE_NAME} does not exists in the app ${this.app}`);
26
+ this.cli.write('please execute:');
27
+ this.cli.code(`sk generate-pop-config ${this.app}`);
28
+ }
29
+ }
30
+ exports.default = RevalidatedModuleCheck;
@@ -0,0 +1,9 @@
1
+ import { CliService } from "../../../cli";
2
+ import PostDeployCheckInterface from "../../interface/post-deploy-check-interface";
3
+ import { FileListInterface } from "../../../integration-api/integration-api-model";
4
+ export default class SaveFilesCheck implements PostDeployCheckInterface {
5
+ private fileList;
6
+ private readonly cli;
7
+ constructor(fileList: FileListInterface, cli: CliService);
8
+ check(): Promise<void>;
9
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class SaveFilesCheck {
4
+ fileList;
5
+ cli;
6
+ constructor(fileList, cli) {
7
+ this.fileList = fileList;
8
+ this.cli = cli;
9
+ }
10
+ async check() {
11
+ const fileList = this.fileList.files.filter((file) => {
12
+ return file.isUpdated();
13
+ });
14
+ if (fileList.length < 1) {
15
+ return;
16
+ }
17
+ if (await this.cli.confirm(`Changes to localFiles will be saved now. Proceed?`)) {
18
+ fileList.forEach(((file) => {
19
+ file.updateIfChanged();
20
+ this.cli.writeSuccess(`${file.name} saved`);
21
+ }));
22
+ }
23
+ }
24
+ }
25
+ exports.default = SaveFilesCheck;
@@ -0,0 +1,12 @@
1
+ export default class DeployContext {
2
+ readonly customerPath: string;
3
+ readonly configName: string;
4
+ readonly slackToken?: string;
5
+ readonly artifacts?: string[];
6
+ readonly dryRun?: boolean;
7
+ runTime: {
8
+ app: string;
9
+ };
10
+ constructor(customerPath: string, configName?: string, slackToken?: string, artifacts?: string, dryRun?: boolean);
11
+ hasArtifacts(): boolean;
12
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const dotenv = tslib_1.__importStar(require("dotenv"));
5
+ dotenv.config();
6
+ const DEFAULT_CONFIG_NAME = 'production';
7
+ const ARTIFACTS_SEPARATOR = ',';
8
+ class DeployContext {
9
+ customerPath;
10
+ configName;
11
+ slackToken;
12
+ artifacts;
13
+ dryRun = false;
14
+ runTime = { app: undefined };
15
+ constructor(customerPath, configName = DEFAULT_CONFIG_NAME, slackToken, artifacts, dryRun) {
16
+ this.customerPath = customerPath;
17
+ this.configName = configName;
18
+ this.slackToken = slackToken || process.env.SLACK_TOKEN || undefined;
19
+ this.artifacts = artifacts ? artifacts.split(ARTIFACTS_SEPARATOR) : [];
20
+ this.dryRun = dryRun;
21
+ }
22
+ hasArtifacts() {
23
+ return this.artifacts?.length > 0;
24
+ }
25
+ }
26
+ exports.default = DeployContext;
@@ -0,0 +1,15 @@
1
+ import DeployService from "./deploy-service";
2
+ import DeployContext from "./context/deploy-context";
3
+ import AbstractAsyncErrorHandlingFactory from "../error-handling/abstract/abstract-async-error-handling-factory";
4
+ import { UserCliConfig } from "../../helpers/cli-config";
5
+ export default class DeployServiceFactory extends AbstractAsyncErrorHandlingFactory {
6
+ private context;
7
+ private cliConfig;
8
+ private service?;
9
+ constructor(context: DeployContext, cliConfig: UserCliConfig);
10
+ _buildService(): Promise<DeployService>;
11
+ private build;
12
+ private getConfigApi;
13
+ private getIntegrationFiles;
14
+ private getPostDeployChecks;
15
+ }
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const deploy_service_1 = tslib_1.__importDefault(require("./deploy-service"));
5
+ const integration_api_context_1 = tslib_1.__importDefault(require("../integration-api/context/integration-api-context"));
6
+ const integration_api_service_factory_1 = tslib_1.__importDefault(require("../integration-api/factory/integration-api-service-factory"));
7
+ const config_api_service_factory_1 = tslib_1.__importDefault(require("../config-api/factory/config-api-service-factory"));
8
+ const config_api_context_1 = tslib_1.__importDefault(require("../config-api/context/config-api-context"));
9
+ const install_resource_handler_1 = tslib_1.__importDefault(require("./handler/install-resource-handler"));
10
+ const customer_config_handler_1 = tslib_1.__importDefault(require("./handler/customer-config-handler"));
11
+ const diff_1 = require("../diff");
12
+ const cli_1 = require("../cli");
13
+ const install_resource_builder_1 = tslib_1.__importDefault(require("./builder/install-resource-builder"));
14
+ const module_handler_1 = tslib_1.__importDefault(require("./handler/module-handler"));
15
+ const server_config_handler_1 = tslib_1.__importDefault(require("./handler/server-config-handler"));
16
+ const deployment_detection_modifier_1 = tslib_1.__importDefault(require("./handler/module-modifier/deployment-detection-modifier"));
17
+ const abstract_async_error_handling_factory_1 = tslib_1.__importDefault(require("../error-handling/abstract/abstract-async-error-handling-factory"));
18
+ const save_files_check_1 = tslib_1.__importDefault(require("./checks/post-deploy/save-files-check"));
19
+ const revalidated_module_check_1 = tslib_1.__importDefault(require("./checks/post-deploy/revalidated-module-check"));
20
+ const deleted_file_check_1 = tslib_1.__importDefault(require("./handler/install-resource-modifier/deleted-file-check"));
21
+ class DeployServiceFactory extends abstract_async_error_handling_factory_1.default {
22
+ context;
23
+ cliConfig;
24
+ service = undefined;
25
+ constructor(context, cliConfig) {
26
+ super();
27
+ this.context = context;
28
+ this.cliConfig = cliConfig;
29
+ }
30
+ async _buildService() {
31
+ if (!(this.service instanceof deploy_service_1.default)) {
32
+ await this.build();
33
+ }
34
+ return this.service;
35
+ }
36
+ async build() {
37
+ const files = await this.getIntegrationFiles();
38
+ const customer = files.getCustomerConfig().config;
39
+ const configName = customer.name || this.context.configName;
40
+ const configApi = this.getConfigApi(customer.app);
41
+ const diffService = new diff_1.DiffServiceFactory(new diff_1.DiffContext(this.cliConfig.diffExec, this.cliConfig.diffExecTemplate)).getService();
42
+ const cliService = new cli_1.CliServiceFactory().getService();
43
+ const installResourceBuilder = new install_resource_builder_1.default(configApi);
44
+ const deletedFilesChecker = new deleted_file_check_1.default(cliService, this.context.hasArtifacts());
45
+ this.service = new deploy_service_1.default(files, [
46
+ new customer_config_handler_1.default(customer, configApi, configName, diffService, cliService, installResourceBuilder),
47
+ new install_resource_handler_1.default(customer, configApi, configName, diffService, cliService, installResourceBuilder, deletedFilesChecker),
48
+ new module_handler_1.default(configApi, diffService, cliService, [new deployment_detection_modifier_1.default(this.context.slackToken)]),
49
+ new server_config_handler_1.default(configApi, diffService, cliService)
50
+ ], cliService, this.getPostDeployChecks(files, cliService, configApi, customer.app), this.context.dryRun);
51
+ }
52
+ getConfigApi(app) {
53
+ const configApiContext = new config_api_context_1.default(app);
54
+ return new config_api_service_factory_1.default(configApiContext).getService();
55
+ }
56
+ async getIntegrationFiles() {
57
+ const integrationApiContext = new integration_api_context_1.default(this.context.customerPath, this.context.configName, this.context.artifacts);
58
+ const integrationApi = new integration_api_service_factory_1.default(integrationApiContext, this.cliConfig).buildService();
59
+ return await integrationApi.run();
60
+ }
61
+ getPostDeployChecks(files, cliService, configApi, app) {
62
+ return [
63
+ new save_files_check_1.default(files, cliService),
64
+ new revalidated_module_check_1.default(configApi, cliService, app),
65
+ ];
66
+ }
67
+ }
68
+ exports.default = DeployServiceFactory;
@@ -0,0 +1,17 @@
1
+ import DeployHandlerInterface from "./interface/deploy-handler-interface";
2
+ import { CliService } from "../cli";
3
+ import PostDeployCheckInterface from "./interface/post-deploy-check-interface";
4
+ import AbstractAsyncErrorHandlingService from "../error-handling/abstract/abstract-async-error-handling-service";
5
+ import { FileListInterface } from "../integration-api/integration-api-model";
6
+ export default class DeployService extends AbstractAsyncErrorHandlingService {
7
+ private readonly fileList;
8
+ private readonly deployHandler;
9
+ private readonly cli;
10
+ private readonly dryRun;
11
+ private readonly postDeployChecks;
12
+ constructor(fileList: FileListInterface, deployHandler: DeployHandlerInterface[], cli: CliService, postDeployChecks: PostDeployCheckInterface[], dryRun: boolean);
13
+ _run(): Promise<void>;
14
+ private handleType;
15
+ private uploadType;
16
+ private runPostDeployChecks;
17
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const abstract_async_error_handling_service_1 = tslib_1.__importDefault(require("../error-handling/abstract/abstract-async-error-handling-service"));
5
+ class DeployService extends abstract_async_error_handling_service_1.default {
6
+ fileList;
7
+ deployHandler;
8
+ cli;
9
+ dryRun = false;
10
+ postDeployChecks;
11
+ constructor(fileList, deployHandler, cli, postDeployChecks, dryRun) {
12
+ super();
13
+ this.fileList = fileList;
14
+ this.deployHandler = deployHandler;
15
+ this.cli = cli;
16
+ this.postDeployChecks = postDeployChecks;
17
+ this.dryRun = dryRun;
18
+ }
19
+ async _run() {
20
+ const types = this.fileList.getTypes();
21
+ this.cli.spacer();
22
+ this.cli.write(`App: "${this.fileList.getCustomerConfig().config.app}", Install: "${this.fileList.getCustomerConfig().config.name}"`);
23
+ this.cli.write('Preparing deployment...');
24
+ this.cli.spacer();
25
+ for (let iterator = 0; iterator < types.length; iterator++) {
26
+ let type = types[iterator];
27
+ await this.handleType(type);
28
+ }
29
+ if (this.dryRun) {
30
+ this.cli.comment('dryRunFlag -d is set, skip upload');
31
+ }
32
+ else {
33
+ for (let iterator = 0; iterator < types.length; iterator++) {
34
+ let type = types[iterator];
35
+ await this.uploadType(type);
36
+ }
37
+ }
38
+ await this.runPostDeployChecks();
39
+ }
40
+ async handleType(type) {
41
+ for (let iterator = 0; iterator < this.deployHandler.length; iterator++) {
42
+ let handler = this.deployHandler[iterator];
43
+ if (handler.canHandle(type)) {
44
+ await handler.handle(this.fileList.getByType(type));
45
+ }
46
+ }
47
+ }
48
+ async uploadType(type) {
49
+ for (let iterator = 0; iterator < this.deployHandler.length; iterator++) {
50
+ let handler = this.deployHandler[iterator];
51
+ if (handler.canHandle(type)) {
52
+ await handler.upload(this.fileList.getByType(type));
53
+ }
54
+ }
55
+ }
56
+ async runPostDeployChecks() {
57
+ for (let iterator = 0; iterator < this.postDeployChecks.length; iterator++) {
58
+ let check = this.postDeployChecks[iterator];
59
+ await check.check();
60
+ }
61
+ }
62
+ }
63
+ exports.default = DeployService;
@@ -0,0 +1,4 @@
1
+ import DeployAppError from "./deploy-app-error";
2
+ export default class CreateFindTempDirectoryError extends DeployAppError {
3
+ constructor();
4
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const deploy_app_error_1 = tslib_1.__importDefault(require("./deploy-app-error"));
5
+ class CreateFindTempDirectoryError extends deploy_app_error_1.default {
6
+ constructor() {
7
+ super(`No temporary Directory found and unable to create a new temporary Directory`);
8
+ }
9
+ }
10
+ exports.default = CreateFindTempDirectoryError;
@@ -0,0 +1,2 @@
1
+ export default class DeployAppError extends Error {
2
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class DeployAppError extends Error {
4
+ }
5
+ exports.default = DeployAppError;
@@ -0,0 +1,4 @@
1
+ import DeployAppError from "./deploy-app-error";
2
+ export default class NoActiveInstallationError extends DeployAppError {
3
+ constructor(configName: any);
4
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const deploy_app_error_1 = tslib_1.__importDefault(require("./deploy-app-error"));
5
+ class NoActiveInstallationError extends deploy_app_error_1.default {
6
+ constructor(configName) {
7
+ super(`No active installation for the config ${configName} was found. A new one will be created.`);
8
+ }
9
+ }
10
+ exports.default = NoActiveInstallationError;
@@ -0,0 +1,21 @@
1
+ import DeployHandlerInterface from "../interface/deploy-handler-interface";
2
+ import CustomerConfigFile from "../../integration-api/struct/customer-config-file";
3
+ import CustomerConfig from "../../integration-api/struct/customer-config";
4
+ import ConfigApi from "../../config-api/config-api-service";
5
+ import { DiffService } from "../../diff";
6
+ import { CliService } from "../../cli";
7
+ import InstallResourceBuilder from "../builder/install-resource-builder";
8
+ export default class CustomerConfigHandler implements DeployHandlerInterface {
9
+ private readonly customer;
10
+ private readonly configApi;
11
+ private readonly configName;
12
+ private diffService;
13
+ private cli;
14
+ private builder;
15
+ constructor(customer: CustomerConfig, configApi: ConfigApi, configName: string, diffService: DiffService, cli: CliService, builder: InstallResourceBuilder);
16
+ canHandle(type: any): boolean;
17
+ handle(files: CustomerConfigFile[]): Promise<any>;
18
+ upload(files: CustomerConfigFile[]): Promise<any>;
19
+ private handleMissingRemoteInstallResource;
20
+ private prepareOriginDiff;
21
+ }
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const customer_config_file_1 = tslib_1.__importDefault(require("../../integration-api/struct/customer-config-file"));
5
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
+ class CustomerConfigHandler {
7
+ customer;
8
+ configApi;
9
+ configName;
10
+ diffService;
11
+ cli;
12
+ builder;
13
+ constructor(customer, configApi, configName, diffService, cli, builder) {
14
+ this.customer = customer;
15
+ this.configApi = configApi;
16
+ this.configName = configName;
17
+ this.diffService = diffService;
18
+ this.cli = cli;
19
+ this.builder = builder;
20
+ }
21
+ canHandle(type) {
22
+ return type === customer_config_file_1.default;
23
+ }
24
+ async handle(files) {
25
+ const installResource = await this.configApi.getActiveInstall(this.configName);
26
+ const file = files[0];
27
+ const config = file.config;
28
+ if (!installResource) {
29
+ await this.handleMissingRemoteInstallResource(config);
30
+ this.cli.write('with origins:', true);
31
+ this.cli.code(JSON.stringify(config.origins), true);
32
+ return;
33
+ }
34
+ if (!installResource.origins || installResource.origins.length < 1) {
35
+ this.cli.write('with origins:', true);
36
+ this.cli.code(JSON.stringify(config.origins), true);
37
+ return;
38
+ }
39
+ const isEqual = this.diffService.isContentEqual(JSON.stringify(config.origins.sort()), JSON.stringify(installResource.origins.sort(), null, `\t`));
40
+ if (isEqual) {
41
+ this.cli.writeWarning('skipped origins (identical with remote)');
42
+ file.skipFile();
43
+ return;
44
+ }
45
+ // todo: only diff origins update local file if tmp file was changed
46
+ // todo: add changedThrowable, let the handler catch and decide what to do with it
47
+ const { changedFile, diff } = await this.diffService.diffContent(file.name, file.getContent(), this.prepareOriginDiff(installResource));
48
+ file.setContent(changedFile);
49
+ if (!(await this.cli.confirm('Update origins?', true))) {
50
+ file.skipFile();
51
+ return;
52
+ }
53
+ this.cli.write('will update origins to:', true);
54
+ this.cli.code(JSON.stringify(config.origins), true);
55
+ return;
56
+ }
57
+ async upload(files) {
58
+ const file = files[0];
59
+ let installResource = await this.builder.init(this.configName);
60
+ if (file.shouldSkipFile()) { // if installResource already exists its possible to skip the origin update
61
+ return;
62
+ }
63
+ installResource.origins = file.config.origins;
64
+ this.builder.merge(installResource);
65
+ }
66
+ async handleMissingRemoteInstallResource(config) {
67
+ const configName = config?.name || this.configName;
68
+ const { app: appName } = this.customer;
69
+ this.cli.spacer();
70
+ this.cli.writeWarning(`No ${chalk_1.default.underline('active')} remote config named ${chalk_1.default.bold(configName)} found in app ${chalk_1.default.bold(appName)}`);
71
+ this.cli.spacer();
72
+ if (await this.cli.confirm('Continue creating a new config?')) {
73
+ this.cli.write(`New configuration named ${chalk_1.default.bold(configName)} will be created in app ${chalk_1.default.bold(appName)}`, true);
74
+ }
75
+ else {
76
+ this.cli.exit();
77
+ }
78
+ }
79
+ prepareOriginDiff(installResource) {
80
+ let remoteConfig = {};
81
+ remoteConfig[this.configName] = { origins: installResource.origins };
82
+ return JSON.stringify(remoteConfig, null, 4);
83
+ }
84
+ }
85
+ exports.default = CustomerConfigHandler;
@@ -0,0 +1,25 @@
1
+ import DeployHandlerInterface from "../interface/deploy-handler-interface";
2
+ import CustomerConfig from "../../integration-api/struct/customer-config";
3
+ import ConfigApi from "../../config-api/config-api-service";
4
+ import { DiffService } from "../../diff";
5
+ import { CliService } from "../../cli";
6
+ import InstallResourceBuilder from "../builder/install-resource-builder";
7
+ import DeletedFileCheck from "./install-resource-modifier/deleted-file-check";
8
+ import { InstallResourceInterface } from "../../integration-api/integration-api-model";
9
+ export default class InstallResourceHandler implements DeployHandlerInterface {
10
+ private readonly customer;
11
+ private readonly configApi;
12
+ private readonly configName;
13
+ private diffService;
14
+ private cli;
15
+ private builder;
16
+ private deletedFilesChecker;
17
+ constructor(customer: CustomerConfig, configApi: ConfigApi, configName: string, diffService: DiffService, cli: CliService, builder: InstallResourceBuilder, deletedFilesChecker: DeletedFileCheck);
18
+ canHandle(type: any): boolean;
19
+ handle(files: InstallResourceInterface[]): Promise<void>;
20
+ upload(files: InstallResourceInterface[]): Promise<any>;
21
+ private processFile;
22
+ private confirm;
23
+ private getInstallResource;
24
+ private prepareRemoteInstallResource;
25
+ }