@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,15 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class BuildParameterQuery extends Command {
3
+ static description: string;
4
+ static args: {
5
+ customerPath: import("@oclif/core/lib/interfaces").Arg<string, {
6
+ exists?: boolean;
7
+ }>;
8
+ };
9
+ static flags: {
10
+ configName: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ };
12
+ static examples: string[];
13
+ run(): Promise<void>;
14
+ buildParameterQuery(app: string, parameterFilter: string, whitelistedFilter: string, blacklistedFilter: string, parameterReplaceFilter: string): string;
15
+ }
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const core_1 = require("@oclif/core");
5
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
+ const clipboardy_cjs_1 = tslib_1.__importDefault(require("clipboardy-cjs"));
7
+ const cli_parameters_1 = require("../models/cli-parameters");
8
+ const build_query_helper_1 = require("../helpers/build-query-helper");
9
+ const get_parsed_config_1 = require("../helpers/get-parsed-config");
10
+ const CustomerConfig_1 = require("../helpers/CustomerConfig");
11
+ const logging_helper_1 = require("../helpers/logging-helper");
12
+ class BuildParameterQuery extends core_1.Command {
13
+ static description = 'Build a parameter query that can be executed in Athena';
14
+ static args = cli_parameters_1.CLI_CUSTOMER_CONFIG;
15
+ static flags = {
16
+ ...cli_parameters_1.CLI_CONFIG_NAME
17
+ };
18
+ static examples = [
19
+ `$ sk build-parameter-query <${cli_parameters_1.CLIParameters.CustomerPath}> -${cli_parameters_1.CLIParametersChar.ConfigName} <${cli_parameters_1.CLIParameters.ConfigName}>`,
20
+ `$ sk build-parameter-query ${cli_parameters_1.CLIParametersExample.CustomerPath} -${cli_parameters_1.CLIParametersChar.ConfigName} ${cli_parameters_1.CLIParametersExample.ConfigName}`,
21
+ ];
22
+ async run() {
23
+ const { args: { customerPath }, flags: { configName } } = await this.parse(BuildParameterQuery);
24
+ core_1.ux.action.start('Building parameter query');
25
+ try {
26
+ const { app, config } = await CustomerConfig_1.CustomerConfig.loadCustomer(customerPath, configName);
27
+ const parsedConfig = await (0, get_parsed_config_1.getParsedConfig)(config);
28
+ const params = (0, build_query_helper_1.getStrippedParams)(parsedConfig);
29
+ const skConfigVersion = (0, get_parsed_config_1.getSpeedKitConfigVersion)(parsedConfig);
30
+ const parameterFilter = (0, build_query_helper_1.getParameterFilter)(params, skConfigVersion);
31
+ const parameterReplaceFilter = (0, build_query_helper_1.getParameterReplaceFilter)(params, skConfigVersion);
32
+ const whitelistedFilter = (0, build_query_helper_1.getWhitelistedFilter)(parsedConfig);
33
+ const blacklistedFilter = (0, build_query_helper_1.getBlacklistedFilter)(parsedConfig);
34
+ const result = this.buildParameterQuery(app || parsedConfig.appName, parameterFilter, whitelistedFilter, blacklistedFilter, parameterReplaceFilter);
35
+ if (!this.config.windows) {
36
+ clipboardy_cjs_1.default.writeSync(result);
37
+ }
38
+ console.log(chalk_1.default.dim.italic(result));
39
+ console.log('');
40
+ core_1.ux.action.stop();
41
+ console.log('');
42
+ if (!this.config.windows) {
43
+ (0, logging_helper_1.logInfo)('Result has been copied to the clipboard 📋');
44
+ }
45
+ }
46
+ catch (e) {
47
+ console.log('');
48
+ (0, logging_helper_1.logError)(e.stack);
49
+ }
50
+ console.log('');
51
+ }
52
+ buildParameterQuery(app, parameterFilter, whitelistedFilter, blacklistedFilter, parameterReplaceFilter) {
53
+ const nowMinusOneMonth = new Date(new Date().setMonth(new Date().getMonth() - 1, new Date().getDate()));
54
+ const monthString = `${nowMinusOneMonth.getMonth() + 1 < 10 ? '0' : ''}${nowMinusOneMonth.getMonth() + 1}`;
55
+ const dateString = `${nowMinusOneMonth.getDate() < 10 ? '0' : ''}${nowMinusOneMonth.getDate()}`;
56
+ const date = `${nowMinusOneMonth.getFullYear()}-${monthString}-${dateString}`;
57
+ return `
58
+ with urlWithParams as (
59
+ select
60
+ url,
61
+ createdat,
62
+ split(url, '?')[1] as urlWithoutParams,
63
+ filter (
64
+ transform(
65
+ split(split(url, '?')[2], '&'),
66
+ (pair) -> split(pair, '=')[1]
67
+ ),
68
+ (key) -> ${parameterFilter}
69
+ ) as paramKeys
70
+ from live.rum.pi
71
+ where app = '${app}'
72
+ and date >= '${date}'
73
+ and cardinality(split(url, '?')) > 1
74
+ and (${whitelistedFilter})
75
+ and ${blacklistedFilter}
76
+ ), prepared as (
77
+ select count(*) as PIs,
78
+ count(distinct url) as urls,
79
+ count(distinct ${parameterReplaceFilter}) as cachedUrls,
80
+ count(distinct urlWithoutParams) as uniqueWithoutParam,
81
+ paramKeys,
82
+ element_at(array_distinct(max_by(url, MD5(to_utf8(to_iso8601(createdat))), 500)), 1) as example1,
83
+ element_at(array_distinct(max_by(url, MD5(to_utf8(to_iso8601(createdat))), 500)), 2) as example2,
84
+ element_at(array_distinct(max_by(url, MD5(to_utf8(to_iso8601(createdat))), 500)), 3) as example3
85
+ from urlWithParams
86
+ group by paramKeys
87
+ )
88
+
89
+ select paramKeys, cachedUrls - uniqueWithoutParam as potentialGain, cachedUrls, PIs, example1, example2, example3
90
+ from prepared
91
+ where cardinality(paramKeys) > 0
92
+ order by potentialGain desc, cachedUrls desc, PIs desc`;
93
+ }
94
+ }
95
+ exports.default = BuildParameterQuery;
@@ -0,0 +1,15 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class BuildPrewarmQuery extends Command {
3
+ static description: string;
4
+ static args: {
5
+ customerPath: import("@oclif/core/lib/interfaces").Arg<string, {
6
+ exists?: boolean;
7
+ }>;
8
+ };
9
+ static flags: {
10
+ configName: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ };
12
+ static examples: string[];
13
+ run(): Promise<void>;
14
+ buildPrewarmQuery(app: string, whitelistedFilter: string, blacklistedFilter: string, parameterReplaceFilter: string): string;
15
+ }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const core_1 = require("@oclif/core");
5
+ const core_2 = require("@oclif/core");
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const clipboardy_cjs_1 = tslib_1.__importDefault(require("clipboardy-cjs"));
8
+ const cli_parameters_1 = require("../models/cli-parameters");
9
+ const build_query_helper_1 = require("../helpers/build-query-helper");
10
+ const get_parsed_config_1 = require("../helpers/get-parsed-config");
11
+ const logging_helper_1 = require("../helpers/logging-helper");
12
+ const CustomerConfig_1 = require("../helpers/CustomerConfig");
13
+ class BuildPrewarmQuery extends core_1.Command {
14
+ static description = 'Build a prewarm query that can be executed in Athena';
15
+ static args = cli_parameters_1.CLI_CUSTOMER_CONFIG;
16
+ static flags = {
17
+ ...cli_parameters_1.CLI_CONFIG_NAME
18
+ };
19
+ static examples = [
20
+ `$ sk build-prewarm-query <${cli_parameters_1.CLIParameters.CustomerPath}> -${cli_parameters_1.CLIParametersChar.ConfigName} <${cli_parameters_1.CLIParameters.ConfigName}>`,
21
+ `$ sk build-prewarm-query ${cli_parameters_1.CLIParametersExample.CustomerPath} -${cli_parameters_1.CLIParametersChar.ConfigName} ${cli_parameters_1.CLIParametersExample.ConfigName}`,
22
+ ];
23
+ async run() {
24
+ const { args: { customerPath }, flags: { configName } } = await this.parse(BuildPrewarmQuery);
25
+ core_2.ux.action.start('Building pre-warm query');
26
+ try {
27
+ const { app, config } = await CustomerConfig_1.CustomerConfig.loadCustomer(customerPath, configName);
28
+ const parsedConfig = await (0, get_parsed_config_1.getParsedConfig)(config);
29
+ const params = (0, build_query_helper_1.getStrippedParams)(parsedConfig);
30
+ const parameterReplaceFilter = (0, build_query_helper_1.getParameterReplaceFilter)(params, (0, get_parsed_config_1.getSpeedKitConfigVersion)(parsedConfig));
31
+ const whitelistedFilter = (0, build_query_helper_1.getWhitelistedFilter)(parsedConfig);
32
+ const blacklistedFilter = (0, build_query_helper_1.getBlacklistedFilter)(parsedConfig);
33
+ const result = this.buildPrewarmQuery(app || parsedConfig.appName, whitelistedFilter, blacklistedFilter, parameterReplaceFilter);
34
+ if (!this.config.windows) {
35
+ clipboardy_cjs_1.default.writeSync(result);
36
+ }
37
+ console.log(chalk_1.default.dim.italic(result));
38
+ console.log('');
39
+ core_2.ux.action.stop();
40
+ console.log('');
41
+ if (!this.config.windows) {
42
+ (0, logging_helper_1.logInfo)('Result has been copied to the clipboard 📋');
43
+ }
44
+ }
45
+ catch (e) {
46
+ console.log('');
47
+ (0, logging_helper_1.logError)(e.stack);
48
+ }
49
+ console.log('');
50
+ }
51
+ buildPrewarmQuery(app, whitelistedFilter, blacklistedFilter, parameterReplaceFilter) {
52
+ const now = new Date();
53
+ now.setDate(now.getDate() - 10);
54
+ const date = now.toISOString().split('T')[0];
55
+ return `
56
+ select url
57
+ from (
58
+ select regexp_replace(regexp_replace(${parameterReplaceFilter}, '(^[^&?]*)&','$1?'), '\\?$','') as url,
59
+ uadevice
60
+ from live.rum.pi
61
+ where app = '${app}'
62
+ and date >= '${date}'
63
+ and ${whitelistedFilter}
64
+ and ${blacklistedFilter})
65
+ group by url
66
+ order by count(*) desc`;
67
+ }
68
+ }
69
+ exports.default = BuildPrewarmQuery;
@@ -0,0 +1,17 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class Deploy extends Command {
3
+ static description: string;
4
+ static args: {
5
+ customerPath: import("@oclif/core/lib/interfaces").Arg<string, {
6
+ exists?: boolean;
7
+ }>;
8
+ };
9
+ static flags: {
10
+ slackToken: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ artifacts: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
12
+ dryRun: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
+ configName: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
14
+ };
15
+ static examples: string[];
16
+ run(): Promise<void>;
17
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ /* eslint-disable valid-jsdoc, no-await-in-loop */
5
+ const core_1 = require("@oclif/core");
6
+ const cli_parameters_1 = require("../models/cli-parameters");
7
+ const deploy_context_1 = tslib_1.__importDefault(require("../services/deploy/context/deploy-context"));
8
+ const deploy_service_factory_1 = tslib_1.__importDefault(require("../services/deploy/deploy-service-factory"));
9
+ const cli_config_1 = require("../helpers/cli-config");
10
+ class Deploy extends core_1.Command {
11
+ static description = 'Deploys the specified customer config while comparing to the live version before';
12
+ static args = cli_parameters_1.CLI_CUSTOMER_CONFIG;
13
+ static flags = {
14
+ ...cli_parameters_1.CLI_CONFIG_NAME,
15
+ [cli_parameters_1.CLIParameters.SlackToken]: core_1.Flags.string({
16
+ description: 'Slack hook found on 1Pass',
17
+ char: cli_parameters_1.CLIParametersChar.SlackToken
18
+ }),
19
+ [cli_parameters_1.CLIParameters.Artifacts]: core_1.Flags.string({
20
+ description: 'Whitelist of files to deploy',
21
+ char: cli_parameters_1.CLIParametersChar.Artifacts
22
+ }),
23
+ [cli_parameters_1.CLIParameters.DryRun]: core_1.Flags.boolean({
24
+ description: 'Do not deploy changes',
25
+ char: cli_parameters_1.CLIParametersChar.DryRun,
26
+ }),
27
+ };
28
+ static examples = [
29
+ `$ sk deploy <${cli_parameters_1.CLIParameters.CustomerPath}> -${cli_parameters_1.CLIParametersChar.ConfigName} <${cli_parameters_1.CLIParameters.ConfigName}> -${cli_parameters_1.CLIParametersChar.SlackToken} <${cli_parameters_1.CLIParameters.SlackToken}> -${cli_parameters_1.CLIParametersChar.Artifacts} <${cli_parameters_1.CLIParameters.Artifacts}> -${cli_parameters_1.CLIParametersChar.DryRun} <${cli_parameters_1.CLIParameters.DryRun}>`,
30
+ `$ sk deploy ${cli_parameters_1.CLIParametersExample.CustomerPath} -${cli_parameters_1.CLIParametersChar.ConfigName} ${cli_parameters_1.CLIParametersExample.ConfigName} -${cli_parameters_1.CLIParametersChar.SlackToken} ${cli_parameters_1.CLIParametersExample.SlackToken} -${cli_parameters_1.CLIParametersChar.Artifacts} ${cli_parameters_1.CLIParametersExample.Artifacts} -${cli_parameters_1.CLIParametersChar.DryRun}`,
31
+ ];
32
+ async run() {
33
+ const { args: { customerPath }, flags: { configName, slackToken, artifacts, dryRun } } = await this.parse(Deploy);
34
+ const deployContext = new deploy_context_1.default(customerPath, configName, slackToken, artifacts, dryRun);
35
+ const deployService = await new deploy_service_factory_1.default(deployContext, new cli_config_1.CliConfig(this.config).load()).buildService();
36
+ await deployService.run();
37
+ }
38
+ }
39
+ exports.default = Deploy;
@@ -0,0 +1,16 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class DocumentHandler extends Command {
3
+ static description: string;
4
+ static args: {
5
+ customerPath: import("@oclif/core/lib/interfaces").Arg<string, {
6
+ exists?: boolean;
7
+ }>;
8
+ };
9
+ static flags: {
10
+ CreateTests: import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ configName: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
12
+ };
13
+ static examples: string[];
14
+ run(): Promise<void>;
15
+ finally(error: any): Promise<void>;
16
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const core_1 = require("@oclif/core");
5
+ const cli_parameters_1 = require("../models/cli-parameters");
6
+ const document_handler_runtime_service_factory_1 = tslib_1.__importDefault(require("../services/document-handler-runtime/factory/document-handler-runtime-service-factory"));
7
+ const document_handler_runtime_context_1 = tslib_1.__importDefault(require("../services/document-handler-runtime/context/document-handler-runtime-context"));
8
+ const cli_config_1 = require("../helpers/cli-config");
9
+ class DocumentHandler extends core_1.Command {
10
+ static description = 'Creates testable documentHandler in folder {CUSTOMER_PATH}/test/src/';
11
+ static args = cli_parameters_1.CLI_CUSTOMER_CONFIG;
12
+ static flags = {
13
+ ...cli_parameters_1.CLI_CONFIG_NAME,
14
+ [cli_parameters_1.CLIParameters.CreateTests]: core_1.Flags.string({
15
+ char: cli_parameters_1.CLIParametersChar.CreateTests,
16
+ multiple: true,
17
+ required: false,
18
+ description: 'name of the test to create'
19
+ }),
20
+ };
21
+ static examples = [
22
+ `$ sk documentHandler <${cli_parameters_1.CLIParameters.CustomerPath}> -${cli_parameters_1.CLIParametersChar.ConfigName} <${cli_parameters_1.CLIParameters.ConfigName}>`,
23
+ `$ sk deploy ${cli_parameters_1.CLIParametersExample.CustomerPath} -${cli_parameters_1.CLIParametersChar.ConfigName} ${cli_parameters_1.CLIParametersExample.ConfigName}`,
24
+ ];
25
+ async run() {
26
+ const { args: { customerPath }, flags: { configName, CreateTests } } = await this.parse(DocumentHandler);
27
+ const runtime = await (new document_handler_runtime_service_factory_1.default(new document_handler_runtime_context_1.default(customerPath, configName, CreateTests), new cli_config_1.CliConfig(this.config).load())).buildService();
28
+ await runtime.run();
29
+ }
30
+ async finally(error) {
31
+ if (error) {
32
+ console.log(error);
33
+ }
34
+ }
35
+ }
36
+ exports.default = DocumentHandler;
@@ -0,0 +1,17 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class FindPops extends Command {
3
+ static description: string;
4
+ static args: {
5
+ app: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static flags: {
8
+ ips: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
9
+ };
10
+ static examples: string[];
11
+ private pops;
12
+ run(): Promise<void>;
13
+ getPop(ip: string, app: string, token: string): Promise<{
14
+ pop: string;
15
+ ip: string;
16
+ } | null>;
17
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const core_1 = require("@oclif/core");
5
+ const logging_helper_1 = require("../helpers/logging-helper");
6
+ const airports = tslib_1.__importStar(require("./airports_iata.json"));
7
+ const fs = require('fs');
8
+ const fetch = require('node-fetch');
9
+ const cli_1 = require("baqend/cli");
10
+ const https = tslib_1.__importStar(require("https"));
11
+ const cli_parameters_1 = require("../models/cli-parameters");
12
+ const agent = new https.Agent({
13
+ rejectUnauthorized: false,
14
+ keepAlive: true,
15
+ });
16
+ class FindPops extends core_1.Command {
17
+ static description = 'Get IPs for all fastly PoPs';
18
+ static args = {
19
+ [cli_parameters_1.CLIParameters.AppName]: core_1.Args.string({
20
+ name: cli_parameters_1.CLIParameters.AppName,
21
+ required: true,
22
+ description: 'The customers appName',
23
+ hidden: false, // hide this arg from help
24
+ }),
25
+ };
26
+ static flags = {
27
+ [cli_parameters_1.CLIParameters.Ips]: core_1.Flags.string({ default: '151.101.x.194', char: cli_parameters_1.CLIParametersChar.Ips }),
28
+ };
29
+ static examples = [
30
+ `$ sk find-pops <${cli_parameters_1.CLIParameters.AppName}> -${cli_parameters_1.CLIParametersChar.Ips} <${cli_parameters_1.CLIParameters.Ips}>`,
31
+ `$ sk find-pops appName -${cli_parameters_1.CLIParametersChar.Ips} ips`,
32
+ ];
33
+ pops = {};
34
+ async run() {
35
+ const { args: { app }, flags: { ips } } = await this.parse(FindPops);
36
+ const db = await cli_1.account.login({ app });
37
+ const ranges = ips.split(',');
38
+ const fetches = [];
39
+ for (const range of ranges) {
40
+ for (let i = 0; i < 255; i++) {
41
+ fetches.push(this.getPop(range.replace('x', String(i)), app, db.token));
42
+ }
43
+ }
44
+ const results = await Promise.all(fetches);
45
+ results.forEach(r => {
46
+ if (r) {
47
+ const airport = airports[r.pop];
48
+ let id = r.pop;
49
+ if (airport) {
50
+ id = `${r.pop} (${airport.city}, ${airport.state}, ${airport.country})`;
51
+ }
52
+ this.pops[id] = this.pops[id] || [];
53
+ this.pops[id].push(r.ip);
54
+ }
55
+ });
56
+ fs.writeFileSync('pops.json', JSON.stringify(this.pops));
57
+ (0, logging_helper_1.logInfo)('List of POPs was successfully created in pops.json');
58
+ }
59
+ async getPop(ip, app, token) {
60
+ try {
61
+ const resp = await fetch(`https://${ip}/`, {
62
+ agent,
63
+ method: 'HEAD',
64
+ headers: {
65
+ Host: `${app}.app.baqend.com`,
66
+ authorization: `BAT ${token}`,
67
+ },
68
+ timeout: 10000,
69
+ });
70
+ const servedBy = resp.headers.get('x-served-by');
71
+ if (resp.status !== 200 || !servedBy) {
72
+ return null;
73
+ }
74
+ return {
75
+ ip,
76
+ pop: servedBy.split('-')[2],
77
+ };
78
+ }
79
+ catch (error) {
80
+ return null;
81
+ }
82
+ }
83
+ }
84
+ exports.default = FindPops;
@@ -0,0 +1,10 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class GenerateCustomerConfig extends Command {
3
+ static description: string;
4
+ static flags: {
5
+ app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
6
+ customersDir: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
7
+ };
8
+ static examples: string[];
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const cli_parameters_1 = require("../models/cli-parameters");
5
+ const customer_config_1 = require("../services/customer-config");
6
+ class GenerateCustomerConfig extends core_1.Command {
7
+ static description = 'Generates a customer config guided by a wizard 🧙‍';
8
+ static flags = {
9
+ [cli_parameters_1.CLIParameters.AppName]: core_1.Flags.string({
10
+ description: `The SK app name which is also being used the config output directory name (kebab-case)`,
11
+ char: cli_parameters_1.CLIParametersChar.AppName,
12
+ }),
13
+ [cli_parameters_1.CLIParameters.CustomersDir]: core_1.Flags.string({
14
+ description: `Name of the sk-onboarding directory where all customer configs are being stored (default: "${cli_parameters_1.CLIParametersExample.CustomersDir}")`,
15
+ char: cli_parameters_1.CLIParametersChar.CustomersDir
16
+ }),
17
+ };
18
+ static examples = [
19
+ `$ sk generate-customer-config -${cli_parameters_1.CLIParametersChar.AppName} <${cli_parameters_1.CLIParameters.AppName}> -${cli_parameters_1.CLIParametersChar.CustomersDir} <${cli_parameters_1.CLIParameters.CustomersDir}>`,
20
+ `$ sk generate-customer-config -${cli_parameters_1.CLIParametersChar.AppName} ${cli_parameters_1.CLIParametersExample.AppName} -${cli_parameters_1.CLIParametersChar.CustomersDir} ${cli_parameters_1.CLIParametersExample.CustomersDir}`,
21
+ ];
22
+ async run() {
23
+ const { flags: { app, customersDir } } = await this.parse(GenerateCustomerConfig);
24
+ const context = new customer_config_1.CustomerConfigServiceContext(app, customersDir);
25
+ const customerConfigService = await new customer_config_1.CustomerConfigServiceFactory(context).buildService();
26
+ await customerConfigService.generateConfig();
27
+ }
28
+ }
29
+ exports.default = GenerateCustomerConfig;
@@ -0,0 +1,27 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class GeneratePopConfig extends Command {
3
+ static args: {
4
+ app: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ coverage: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ deploy: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
+ 'pop-limit': import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
12
+ 'traffic-share': import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
13
+ 'use-rum': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
14
+ };
15
+ createPopPrewarmingCode(popConfig: string): Promise<string>;
16
+ deployPrewarmingConfig(app: string, config: string, deploy: boolean | undefined): Promise<void>;
17
+ run(): Promise<void>;
18
+ private byHitsDesc;
19
+ private computeCoverageAndShare;
20
+ private generateOriginStats;
21
+ private generatePopConfig;
22
+ private generatePopListByPops;
23
+ private generatePopListByShields;
24
+ private generatePrewarmingConfig;
25
+ private getShieldInfo;
26
+ private printStats;
27
+ }