@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,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalize = exports.transformNoValueParams = exports.convertNotEncodedParameters = exports.sortParams = void 0;
4
+ const { URL } = require('url');
5
+ /**
6
+ * Sorts all urls params manually.
7
+ *
8
+ * @param searchParams - Params to sort.
9
+ */
10
+ function sortParams(searchParams) {
11
+ const entries = [...searchParams.entries()].sort((a, b) => {
12
+ if (a[0] === b[0]) {
13
+ return a[1] < b[1] ? -1 : 1;
14
+ }
15
+ return a[0] < b[0] ? -1 : 1;
16
+ });
17
+ // Clear search params before appending sorted params
18
+ entries.forEach(key => searchParams.delete(key[0]));
19
+ // Append sorted params without overwriting keys
20
+ entries.forEach(key => searchParams.append(key[0], key[1]));
21
+ }
22
+ exports.sortParams = sortParams;
23
+ /**
24
+ * Encodes the parameter key as URL object would encode query params.
25
+ *
26
+ * @param parameterKey - The key to encode.
27
+ * @param parameterValue - The value to encode.
28
+ * @return The encoded parameter key and value without ?.
29
+ */
30
+ function encodeUrlComponent(parameterKey, parameterValue) {
31
+ const url = new URL('https://www.baqend.com/');
32
+ url.searchParams.append(parameterKey, parameterValue);
33
+ return url.search.replace(/\?/, '');
34
+ }
35
+ /**
36
+ * Converts parameters back to origin form.
37
+ *
38
+ * When adding parameters to the original URL the encoding of the parameters can change.
39
+ * This is because adding parameters to an URL object triggers a decode before adding
40
+ * and an encode after adding. Therefore the encoding of parameters can differ from the origin
41
+ * (e.g. if a whitespace is encoded like '%20' in the original URL, adding a parameter by calling
42
+ * searchParams.append() encodes the whitespace to '+').
43
+ *
44
+ * The root cause for this is because the encoding when appending search params to an URL object
45
+ * is different than the encoding of encodeURIComponent().
46
+ *
47
+ * @param url - The original Url.
48
+ * @param manipulatedUrl - The computed URL.
49
+ */
50
+ function convertNotEncodedParameters(url, manipulatedUrl) {
51
+ if (manipulatedUrl.search.length === 0) {
52
+ return;
53
+ }
54
+ const originalParamsMap = new Map();
55
+ const originalParams = url.search.substring(1).split('&');
56
+ let index = 0;
57
+ url.searchParams.forEach((value, param) => {
58
+ const paramWithValue = originalParams[index];
59
+ if (paramWithValue) {
60
+ originalParamsMap.set(encodeUrlComponent(param, value), paramWithValue);
61
+ }
62
+ index += 1;
63
+ });
64
+ const search = [...manipulatedUrl.searchParams].map((entry) => {
65
+ const [key, value] = entry;
66
+ const originalParamWithValue = originalParamsMap.get(encodeUrlComponent(key, value));
67
+ if (originalParamWithValue) {
68
+ return `${originalParamWithValue}`;
69
+ }
70
+ return `${key}=${value}`;
71
+ });
72
+ manipulatedUrl.search = `?${search.join('&')}`;
73
+ }
74
+ exports.convertNotEncodedParameters = convertNotEncodedParameters;
75
+ /**
76
+ * Removes the "=" char of query parameters that do not have a value.
77
+ *
78
+ * Hint: This is needed because calling the append or delete method of {@link URL}
79
+ * adds a "=" to all parameter without value. This results in different resource URLs.
80
+ *
81
+ * @param url - The original URL.
82
+ * @param manipulatedUrl - The manipulated URL to remove the "=" from.
83
+ */
84
+ function transformNoValueParams(url, manipulatedUrl) {
85
+ const paramsWithoutValue = url.search.split(/[?&]/).filter(e => e && !e.includes('='));
86
+ for (const param of paramsWithoutValue) {
87
+ manipulatedUrl.search = manipulatedUrl.search.replace(`${param}=`, param);
88
+ }
89
+ }
90
+ exports.transformNoValueParams = transformNoValueParams;
91
+ /**
92
+ * Normalizes a given URL.
93
+ *
94
+ * @param urlString - The URL to be normalized.
95
+ * @param sortParameters - Activates alphabetical sorting of the URL parameters.
96
+ * @returns The normalized URL.
97
+ */
98
+ function normalize(urlString, sortParameters) {
99
+ const url = new URL(urlString);
100
+ // Remove the hash part of the URL if exists
101
+ if (url.hash) {
102
+ url.hash = '';
103
+ }
104
+ if (!sortParameters) {
105
+ // Sort search params to normalize encoding and order of params
106
+ sortParams(url.searchParams);
107
+ }
108
+ convertNotEncodedParameters(new URL(urlString), url);
109
+ transformNoValueParams(new URL(urlString), url);
110
+ return url.toString();
111
+ }
112
+ exports.normalize = normalize;
@@ -0,0 +1 @@
1
+ export declare function race<T>(promise: Promise<T>): Promise<T>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.race = void 0;
4
+ const safe_1 = require("./safe");
5
+ const DEFAULT_TIMEOUT = 5000;
6
+ async function race(promise) {
7
+ const timeOut = new Promise((resolve, reject) => {
8
+ setTimeout(() => { reject('timeout'); }, DEFAULT_TIMEOUT);
9
+ });
10
+ const result = await (0, safe_1.safe)(Promise.race([promise, timeOut]));
11
+ if (result.success === true) {
12
+ return result.data;
13
+ }
14
+ throw new Error(result.error);
15
+ }
16
+ exports.race = race;
@@ -0,0 +1,10 @@
1
+ export type Safe<T> = {
2
+ success: true;
3
+ data: T;
4
+ } | {
5
+ success: false;
6
+ error: string;
7
+ errorObj?: Error;
8
+ };
9
+ export declare function safe<T>(promise: Promise<T>): Promise<Safe<T>>;
10
+ export declare function safe<T>(func: () => T): Safe<T>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.safe = void 0;
4
+ function safe(promiseOrFunc) {
5
+ if (promiseOrFunc instanceof Promise) {
6
+ return safeAsync(promiseOrFunc);
7
+ }
8
+ return safeSync(promiseOrFunc);
9
+ }
10
+ exports.safe = safe;
11
+ async function safeAsync(promise) {
12
+ try {
13
+ const data = await promise;
14
+ return { data, success: true };
15
+ }
16
+ catch (e) {
17
+ if (e instanceof Error) {
18
+ return { success: false, error: e.message, errorObj: e };
19
+ }
20
+ return { success: false, error: "Something went wrong" };
21
+ }
22
+ }
23
+ function safeSync(func) {
24
+ try {
25
+ const data = func();
26
+ return { data, success: true };
27
+ }
28
+ catch (e) {
29
+ if (e instanceof Error) {
30
+ return { success: false, error: e.message, errorObj: e };
31
+ }
32
+ return { success: false, error: "Something went wrong" };
33
+ }
34
+ }
@@ -0,0 +1 @@
1
+ export default function scrape(url: string): Promise<any>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fetch = require('node-fetch');
4
+ async function scrape(url) {
5
+ const response = await fetch(url);
6
+ if (response.status !== 200) {
7
+ return null;
8
+ }
9
+ return response.text();
10
+ }
11
+ exports.default = scrape;
@@ -0,0 +1 @@
1
+ export declare function speedKitRuleToRegExp(url: string): RegExp;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.speedKitRuleToRegExp = void 0;
4
+ function escapeRegExp(str) {
5
+ return str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
6
+ }
7
+ function speedKitRuleToRegExp(url) {
8
+ return new RegExp(`^${escapeRegExp(url).replace(/\\\*/g, '.*')}$`);
9
+ }
10
+ exports.speedKitRuleToRegExp = speedKitRuleToRegExp;
@@ -0,0 +1 @@
1
+ export declare function watchFiles(filenames: (string | undefined)[], listener: () => Promise<void>): void;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.watchFiles = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
+ const fs_1 = tslib_1.__importDefault(require("fs"));
7
+ function watchFiles(filenames, listener) {
8
+ for (const filename of filenames) {
9
+ if (!filename) {
10
+ // asset comes not from the local filesystem
11
+ continue;
12
+ }
13
+ fs_1.default.watchFile(filename, async () => {
14
+ console.info((0, chalk_1.default) `Updated {bold ${filename}}`);
15
+ await listener();
16
+ });
17
+ console.info((0, chalk_1.default) `Listening for changes on {bold ${filename}}`);
18
+ }
19
+ }
20
+ exports.watchFiles = watchFiles;
@@ -0,0 +1,73 @@
1
+ export declare enum CLIParameters {
2
+ AppName = "app",
3
+ Artifacts = "artifacts",
4
+ ConfigName = "configName",
5
+ ContentTypes = "contentTypes",
6
+ Cookies = "cookies",
7
+ CreateTests = "CreateTests",
8
+ CustomerPath = "customerPath",
9
+ CustomersDir = "customersDir",
10
+ Delay = "delay",
11
+ DryRun = "dryRun",
12
+ Group = "group",
13
+ HideDiff = "hideDiff",
14
+ Ips = "ips",
15
+ KeepParameterSorting = "keepParameterSorting",
16
+ Mobile = "mobile",
17
+ PageUrl = "pageUrl",
18
+ Path = "path",
19
+ SlackToken = "slackToken",
20
+ TestId = "testId",
21
+ Urls = "urls",
22
+ Variation = "variation",
23
+ VariationPath = "variationPath"
24
+ }
25
+ export declare enum CLIParametersChar {
26
+ AppName = "a",
27
+ Artifacts = "a",
28
+ ConfigName = "c",
29
+ ContentTypes = "c",
30
+ Cookies = "c",
31
+ CreateTests = "t",
32
+ CustomerPath = "p",
33
+ CustomersDir = "d",
34
+ Delay = "d",
35
+ DryRun = "d",
36
+ Group = "g",
37
+ HideDiff = "h",
38
+ Ips = "i",
39
+ KeepParameterSorting = "k",
40
+ Mobile = "m",
41
+ SlackToken = "t",
42
+ Path = "p",
43
+ Variation = "v",
44
+ VariationPath = "p"
45
+ }
46
+ export declare enum CLIParametersExample {
47
+ AppName = "decathlon",
48
+ Artifacts = "dynamic,SpeedKit",
49
+ ConfigName = "production",
50
+ ContentTypes = "image,style",
51
+ Cookies = "consentCookies",
52
+ CustomerPath = "customer/decathlon.de",
53
+ CustomersDir = "customers",
54
+ Delay = "1200",
55
+ Group = "B",
56
+ Ips = "151.101.120.194",
57
+ Mobile = "Y",
58
+ PageUrl = "https://www.decathlon.de/",
59
+ Path = "C:\\Users\\testUser\\file.csv",
60
+ SlackToken = "someSlackToken",
61
+ TestId = "listing-50vs50",
62
+ Urls = "url1,url2,url3",
63
+ Variation = "MOBILE",
64
+ VariationPath = "C:\\Users\\testUser\\variations.csv"
65
+ }
66
+ export declare const CLI_CONFIG_NAME: {
67
+ configName: import("@oclif/core/lib/interfaces/parser").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
68
+ };
69
+ export declare const CLI_CUSTOMER_CONFIG: {
70
+ customerPath: import("@oclif/core/lib/interfaces/parser").Arg<string, {
71
+ exists?: boolean;
72
+ }>;
73
+ };
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CLI_CUSTOMER_CONFIG = exports.CLI_CONFIG_NAME = exports.CLIParametersExample = exports.CLIParametersChar = exports.CLIParameters = void 0;
4
+ const core_1 = require("@oclif/core");
5
+ var CLIParameters;
6
+ (function (CLIParameters) {
7
+ CLIParameters["AppName"] = "app";
8
+ CLIParameters["Artifacts"] = "artifacts";
9
+ CLIParameters["ConfigName"] = "configName";
10
+ CLIParameters["ContentTypes"] = "contentTypes";
11
+ CLIParameters["Cookies"] = "cookies";
12
+ CLIParameters["CreateTests"] = "CreateTests";
13
+ CLIParameters["CustomerPath"] = "customerPath";
14
+ CLIParameters["CustomersDir"] = "customersDir";
15
+ CLIParameters["Delay"] = "delay";
16
+ CLIParameters["DryRun"] = "dryRun";
17
+ CLIParameters["Group"] = "group";
18
+ CLIParameters["HideDiff"] = "hideDiff";
19
+ CLIParameters["Ips"] = "ips";
20
+ CLIParameters["KeepParameterSorting"] = "keepParameterSorting";
21
+ CLIParameters["Mobile"] = "mobile";
22
+ CLIParameters["PageUrl"] = "pageUrl";
23
+ CLIParameters["Path"] = "path";
24
+ CLIParameters["SlackToken"] = "slackToken";
25
+ CLIParameters["TestId"] = "testId";
26
+ CLIParameters["Urls"] = "urls";
27
+ CLIParameters["Variation"] = "variation";
28
+ CLIParameters["VariationPath"] = "variationPath";
29
+ })(CLIParameters || (exports.CLIParameters = CLIParameters = {}));
30
+ var CLIParametersChar;
31
+ (function (CLIParametersChar) {
32
+ CLIParametersChar["AppName"] = "a";
33
+ CLIParametersChar["Artifacts"] = "a";
34
+ CLIParametersChar["ConfigName"] = "c";
35
+ CLIParametersChar["ContentTypes"] = "c";
36
+ CLIParametersChar["Cookies"] = "c";
37
+ CLIParametersChar["CreateTests"] = "t";
38
+ CLIParametersChar["CustomerPath"] = "p";
39
+ CLIParametersChar["CustomersDir"] = "d";
40
+ CLIParametersChar["Delay"] = "d";
41
+ CLIParametersChar["DryRun"] = "d";
42
+ CLIParametersChar["Group"] = "g";
43
+ CLIParametersChar["HideDiff"] = "h";
44
+ CLIParametersChar["Ips"] = "i";
45
+ CLIParametersChar["KeepParameterSorting"] = "k";
46
+ CLIParametersChar["Mobile"] = "m";
47
+ CLIParametersChar["SlackToken"] = "t";
48
+ CLIParametersChar["Path"] = "p";
49
+ CLIParametersChar["Variation"] = "v";
50
+ CLIParametersChar["VariationPath"] = "p";
51
+ })(CLIParametersChar || (exports.CLIParametersChar = CLIParametersChar = {}));
52
+ var CLIParametersExample;
53
+ (function (CLIParametersExample) {
54
+ CLIParametersExample["AppName"] = "decathlon";
55
+ CLIParametersExample["Artifacts"] = "dynamic,SpeedKit";
56
+ CLIParametersExample["ConfigName"] = "production";
57
+ CLIParametersExample["ContentTypes"] = "image,style";
58
+ CLIParametersExample["Cookies"] = "consentCookies";
59
+ CLIParametersExample["CustomerPath"] = "customer/decathlon.de";
60
+ CLIParametersExample["CustomersDir"] = "customers";
61
+ CLIParametersExample["Delay"] = "1200";
62
+ CLIParametersExample["Group"] = "B";
63
+ CLIParametersExample["Ips"] = "151.101.120.194";
64
+ CLIParametersExample["Mobile"] = "Y";
65
+ CLIParametersExample["PageUrl"] = "https://www.decathlon.de/";
66
+ CLIParametersExample["Path"] = "C:\\Users\\testUser\\file.csv";
67
+ CLIParametersExample["SlackToken"] = "someSlackToken";
68
+ CLIParametersExample["TestId"] = "listing-50vs50";
69
+ CLIParametersExample["Urls"] = "url1,url2,url3";
70
+ CLIParametersExample["Variation"] = "MOBILE";
71
+ CLIParametersExample["VariationPath"] = "C:\\Users\\testUser\\variations.csv";
72
+ })(CLIParametersExample || (exports.CLIParametersExample = CLIParametersExample = {}));
73
+ exports.CLI_CONFIG_NAME = {
74
+ [CLIParameters.ConfigName]: core_1.Flags.string({ char: CLIParametersChar.ConfigName, default: 'production', description: 'The costumer config name' }),
75
+ };
76
+ exports.CLI_CUSTOMER_CONFIG = {
77
+ [CLIParameters.CustomerPath]: core_1.Args.directory({
78
+ name: CLIParameters.CustomerPath,
79
+ required: true,
80
+ description: 'The customer config path', // help description
81
+ }),
82
+ };
@@ -0,0 +1,20 @@
1
+ export declare const INTEGRATION_FILES: {
2
+ CONFIG: {
3
+ CUSTOMER: string;
4
+ SPEED_KIT: string;
5
+ DOCUMENT_HANDLER: string;
6
+ DYNAMIC_BLOCKS: string;
7
+ LOAD_HANDLER: string;
8
+ DYNAMIC_STYLES: string;
9
+ };
10
+ CUSTOM: {
11
+ LOADER: string;
12
+ SW: string;
13
+ DOCUMENT_HANDLER: string;
14
+ DYNAMIC_FETCHER: string;
15
+ };
16
+ BUILD: {
17
+ INSTALL: string;
18
+ DOCUMENT_HANDLER: string;
19
+ };
20
+ };
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.INTEGRATION_FILES = void 0;
4
+ exports.INTEGRATION_FILES = {
5
+ CONFIG: {
6
+ CUSTOMER: 'config_customer',
7
+ SPEED_KIT: 'config_SpeedKit',
8
+ DOCUMENT_HANDLER: 'config_documentHandler',
9
+ DYNAMIC_BLOCKS: 'config_dynamicBlocks',
10
+ LOAD_HANDLER: 'config_loadHandler',
11
+ DYNAMIC_STYLES: 'config_dynamicStyles'
12
+ },
13
+ CUSTOM: {
14
+ LOADER: 'custom_loader',
15
+ SW: 'custom_sw',
16
+ DOCUMENT_HANDLER: 'custom_documentHandler',
17
+ DYNAMIC_FETCHER: 'custom_dynamicFetcher',
18
+ },
19
+ BUILD: {
20
+ INSTALL: 'bundle_install',
21
+ DOCUMENT_HANDLER: 'bundle_documentHandler',
22
+ }
23
+ };
@@ -0,0 +1,24 @@
1
+ export interface InstallConfigs<T> {
2
+ config: T;
3
+ custom: T;
4
+ sw: T;
5
+ loader: T;
6
+ dynamicFetcher: T;
7
+ dynamicFetcherConfig: T;
8
+ documentHandler: T;
9
+ documentHandlerConfig: T;
10
+ customStyle: T;
11
+ }
12
+ export default interface Install extends Partial<InstallConfigs<string>> {
13
+ id?: string;
14
+ version?: number;
15
+ acl?: string;
16
+ createdAt?: Date;
17
+ updatedAt?: Date;
18
+ status?: string;
19
+ swVersion?: string;
20
+ domain: string;
21
+ configVersion?: number;
22
+ description?: string;
23
+ origins?: string[];
24
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,30 @@
1
+ export type UsedPopsPerOrigin = {
2
+ hits: number;
3
+ origin: string;
4
+ pop: string;
5
+ region: string;
6
+ };
7
+ export declare class AthenaService {
8
+ private client;
9
+ getUsedPopsPerOrigin(app: string, useRum: any): Promise<UsedPopsPerOrigin[]>;
10
+ private castValueToType;
11
+ /**
12
+ * Fetch the query result of the given query id, if the result is still available
13
+ * @param queryId - The query of which the results should be fetched
14
+ * @return The query result as an array of objects. The object keys are the selected column names and the object
15
+ * values the column values
16
+ */
17
+ private fetchResult;
18
+ /**
19
+ * Runs the given SQL query against Athena and returns the query id when the query has successfully been executed.
20
+ * @param sql - The query to execute
21
+ * @param parameters - the parameters ? which should be passed to the query. In the order they are occurring in the query
22
+ * @param useCacheTTLMinutes - enable query caching to the given amount of minutes, if the same query is
23
+ * issued within the cached time causes that the results from the previous execution will be returned without any
24
+ * additional costs
25
+ * @return The query id which can be used to fetch the query results
26
+ */
27
+ private runQuery;
28
+ private sleep;
29
+ private waitOnResponse;
30
+ }
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AthenaService = void 0;
4
+ const client_athena_1 = require("@aws-sdk/client-athena");
5
+ class AthenaService {
6
+ client = new client_athena_1.AthenaClient({ region: 'eu-central-1' });
7
+ async getUsedPopsPerOrigin(app, useRum) {
8
+ const query = `
9
+ with data as (
10
+ select
11
+ *,
12
+ coalesce('https://' || url_extract_host(assetUrl) || regexp_extract(url_extract_path(assetUrl), '(?i)/([a-z]{2}([-/_][a-z]{2})*/)', 0), 'Unknown') as originWithPrefix
13
+ from fastly.logs
14
+ where date between ? and ?
15
+ and app = ?
16
+ and ${useRum ? 'ispibeacon' : 'isassetrequest and isnavigaterequest'}
17
+ and client.bot is null
18
+ and origin not in('Unknown', '')
19
+ )
20
+
21
+ select
22
+ region,
23
+ pop,
24
+ coalesce(originWithPrefix, origin) as origin,
25
+ count() as hits
26
+ from data
27
+ group by grouping sets (
28
+ (region, pop, origin),
29
+ (region, pop, origin, originWithPrefix)
30
+ )
31
+ having originWithPrefix is null or originWithPrefix <> 'Unknown'`;
32
+ const endDate = new Date();
33
+ const startDate = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate() - 7);
34
+ const start = startDate.toISOString().slice(0, 10);
35
+ const end = endDate.toISOString().slice(0, 10);
36
+ const queryId = await this.runQuery(query, [start, end, app], 12 * 60);
37
+ return await this.fetchResult(queryId);
38
+ }
39
+ castValueToType(value, type) {
40
+ if (value === null)
41
+ return null;
42
+ switch (type) {
43
+ case 'bigint': {
44
+ return Number(value);
45
+ }
46
+ default: {
47
+ return value;
48
+ }
49
+ }
50
+ }
51
+ /**
52
+ * Fetch the query result of the given query id, if the result is still available
53
+ * @param queryId - The query of which the results should be fetched
54
+ * @return The query result as an array of objects. The object keys are the selected column names and the object
55
+ * values the column values
56
+ */
57
+ async fetchResult(queryId) {
58
+ const rows = [];
59
+ let NextToken;
60
+ let first = true;
61
+ do {
62
+ // Max Results can be set but if its not set,
63
+ // it will choose the maximum page size.
64
+ const command = new client_athena_1.GetQueryResultsCommand({ NextToken, QueryExecutionId: queryId });
65
+ const result = await this.client.send(command);
66
+ const columns = result.ResultSet.ResultSetMetadata.ColumnInfo.map(info => info.Name);
67
+ const types = result.ResultSet.ResultSetMetadata.ColumnInfo.map(info => info.Type);
68
+ for (const rowRaw of result.ResultSet.Rows) {
69
+ if (first) {
70
+ first = false;
71
+ continue; // the first row contains the column names
72
+ }
73
+ const row = {};
74
+ for (let i = 0; i < rowRaw.Data.length; i++) {
75
+ row[columns[i]] = this.castValueToType(rowRaw.Data[i].VarCharValue, types[i]);
76
+ }
77
+ rows.push(row);
78
+ }
79
+ NextToken = result.NextToken;
80
+ } while (NextToken);
81
+ return rows;
82
+ }
83
+ /**
84
+ * Runs the given SQL query against Athena and returns the query id when the query has successfully been executed.
85
+ * @param sql - The query to execute
86
+ * @param parameters - the parameters ? which should be passed to the query. In the order they are occurring in the query
87
+ * @param useCacheTTLMinutes - enable query caching to the given amount of minutes, if the same query is
88
+ * issued within the cached time causes that the results from the previous execution will be returned without any
89
+ * additional costs
90
+ * @return The query id which can be used to fetch the query results
91
+ */
92
+ async runQuery(sql, parameters, useCacheTTLMinutes = 60) {
93
+ const ExecutionParameters = parameters.map(value => typeof value === 'string' ? `'${value}'` : String(value));
94
+ const command = new client_athena_1.StartQueryExecutionCommand({
95
+ ExecutionParameters,
96
+ QueryExecutionContext: {
97
+ Catalog: 'live',
98
+ },
99
+ QueryString: sql,
100
+ ResultReuseConfiguration: {
101
+ ResultReuseByAgeConfiguration: {
102
+ Enabled: true,
103
+ MaxAgeInMinutes: useCacheTTLMinutes,
104
+ },
105
+ },
106
+ });
107
+ const response = await this.client.send(command);
108
+ await this.waitOnResponse(response.QueryExecutionId);
109
+ return response.QueryExecutionId;
110
+ }
111
+ async sleep(sleep) {
112
+ return new Promise(resolve => {
113
+ setTimeout(resolve, sleep);
114
+ });
115
+ }
116
+ async waitOnResponse(QueryExecutionId) {
117
+ for (;;) {
118
+ const command = new client_athena_1.GetQueryExecutionCommand({ QueryExecutionId });
119
+ const result = await this.client.send(command);
120
+ const status = result.QueryExecution.Status;
121
+ switch (status.State) {
122
+ case client_athena_1.QueryExecutionState.FAILED: {
123
+ throw new Error('The Amazon Athena query failed to run with error message: ' + status.StateChangeReason);
124
+ }
125
+ case client_athena_1.QueryExecutionState.CANCELLED: {
126
+ throw new Error('The Amazon Athena query was cancelled.');
127
+ }
128
+ case client_athena_1.QueryExecutionState.SUCCEEDED: {
129
+ return;
130
+ }
131
+ default: {
132
+ await this.sleep(1000);
133
+ break;
134
+ }
135
+ }
136
+ }
137
+ }
138
+ }
139
+ exports.AthenaService = AthenaService;
@@ -0,0 +1,4 @@
1
+ import { BundleService } from './bundle-service';
2
+ export declare class BundleServiceFactory {
3
+ buildService(): BundleService;
4
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BundleServiceFactory = void 0;
4
+ const bundle_service_1 = require("./bundle-service");
5
+ class BundleServiceFactory {
6
+ buildService() {
7
+ return new bundle_service_1.BundleService();
8
+ }
9
+ }
10
+ exports.BundleServiceFactory = BundleServiceFactory;