@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,216 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStrippedParams = exports.getParameterReplaceFilter = exports.getParameterFilter = exports.getBlacklistedFilter = exports.getWhitelistedFilter = void 0;
4
+ /**
5
+ * Returns the string between a left bound and a right bound.
6
+ *
7
+ * @param input - The input string to get the inner string from.
8
+ * @param leftBound - The left bound of the string to be cut.
9
+ * @param rightBound - The right bound of the string to be cut.
10
+ */
11
+ function getStringBetween(input, leftBound, rightBound) {
12
+ return input.slice(input.indexOf(leftBound) + 1, input.lastIndexOf(rightBound));
13
+ }
14
+ /**
15
+ * Returns the comparison filter (like, regexp_like) as a SQL query string.
16
+ *
17
+ * @param property - The property to be compared
18
+ * @param sqlField -The SQL field to compare with.
19
+ * @param shouldEqual - True if the property should equal the sql value, false otherwise.
20
+ * @param type - Whether type of property is a pathname or url.
21
+ */
22
+ function getFilterForProperty(property, sqlField, shouldEqual, type) {
23
+ if (typeof property === 'string') {
24
+ if (type === 'pathname') {
25
+ return `url_extract_path(${sqlField}) ${shouldEqual ? '' : 'not '}like '${property}%'`;
26
+ }
27
+ return `${sqlField} ${shouldEqual ? '' : 'not '}like 'https://${property}%'`;
28
+ }
29
+ const ignoreCase = isRegExpIgnoringCase(property);
30
+ const sqlRegExp = getStringBetween(String(property), '/', '/');
31
+ if (type === 'pathname') {
32
+ return `${shouldEqual ? '' : 'not '}regexp_like(url_extract_path(${sqlField}), '${ignoreCase ? '(?i)' : ''}${sqlRegExp}')`;
33
+ }
34
+ return `${shouldEqual ? '' : 'not '}regexp_like(${sqlField}, '${ignoreCase ? '(?i)' : ''}${sqlRegExp}')`;
35
+ }
36
+ /**
37
+ * Returns all properties of a speed kit rule with the given keys.
38
+ *
39
+ * @param speedKitRuleValues - The speed kit rule value to get the properties from (e.g. the whitelist).
40
+ * @param key - The key to get the properties with (e.g. 'pathname').
41
+ */
42
+ function getRuleProp(speedKitRuleValues, key) {
43
+ const properties = [];
44
+ if (!speedKitRuleValues) {
45
+ return properties;
46
+ }
47
+ for (const ruleValue of speedKitRuleValues) {
48
+ Object.keys(ruleValue)
49
+ .filter(ruleKey => key === ruleKey)
50
+ .forEach(ruleKey => properties.push(...ruleValue[ruleKey]));
51
+ }
52
+ return properties;
53
+ }
54
+ /**
55
+ * Returns the whitelisted filter as a sql query string.
56
+ *
57
+ * @param parsedConfig - The speed kit config parsed as an object.
58
+ */
59
+ function getWhitelistedFilter(parsedConfig) {
60
+ const { whitelist, enabledSites } = parsedConfig;
61
+ // TODO: use origins instead here
62
+ const whitelistedFilter = `(\n ${(whitelist[0].host || whitelist[0].url).map(hostname => getFilterForProperty(hostname, 'url', true, 'url')).join('\n or ')}\n )`;
63
+ const enabledFilter = getRuleProp(enabledSites, 'pathname')
64
+ .map(pathname => getFilterForProperty(pathname, 'url', true, 'pathname')).join('\nor ');
65
+ if (!enabledFilter) {
66
+ return `${whitelistedFilter}`;
67
+ }
68
+ return `(${whitelistedFilter}) and (${enabledFilter})`;
69
+ }
70
+ exports.getWhitelistedFilter = getWhitelistedFilter;
71
+ /**
72
+ * Returns the blacklisted filter as a SQL query string.
73
+ *
74
+ * @param parsedConfig - The speed kit config parsed as an object.
75
+ */
76
+ function getBlacklistedFilter(parsedConfig) {
77
+ const { blacklist, disabledSites } = parsedConfig;
78
+ const blacklistedPathnamesFilter = getRuleProp(blacklist, 'pathname')
79
+ .map(pathname => getFilterForProperty(pathname, 'url', false, 'pathname')).join('\n and ');
80
+ const blacklistedUrlsFilter = getRuleProp(blacklist, 'url')
81
+ .map(url => getFilterForProperty(url, 'url', false, 'url')).join('\n and ');
82
+ const disabledFilter = getRuleProp(disabledSites, 'pathname')
83
+ .map(pathname => getFilterForProperty(pathname, 'url', false, 'pathname')).join('\n and ');
84
+ let blacklistedFilter = '';
85
+ if (blacklistedPathnamesFilter) {
86
+ blacklistedFilter += blacklistedPathnamesFilter;
87
+ }
88
+ if (blacklistedUrlsFilter) {
89
+ blacklistedFilter += `\n and ${blacklistedUrlsFilter}`;
90
+ }
91
+ if (disabledFilter) {
92
+ blacklistedFilter += `\n and ${disabledFilter}`;
93
+ }
94
+ return blacklistedFilter;
95
+ }
96
+ exports.getBlacklistedFilter = getBlacklistedFilter;
97
+ /**
98
+ * Returns the parameter filter as a SQL query string.
99
+ *
100
+ * @param params - The stripped parameters that are named within the speed kit config.
101
+ * @param skConfigVersion - The Speed Kit config ruleset version.
102
+ */
103
+ function getParameterFilter(params, skConfigVersion = 1) {
104
+ return params.map(param => {
105
+ // Prefix comparison for strings
106
+ if (typeof param === 'string') {
107
+ if (skConfigVersion === 1) {
108
+ return `not regexp_like(key, '^${param}')`;
109
+ }
110
+ else {
111
+ return `key <> '${param}'`;
112
+ }
113
+ }
114
+ // Regexp like for complex regular expressions
115
+ const ignoreCase = isRegExpIgnoringCase(param);
116
+ return `not regexp_like(key, '${ignoreCase ? '(?i)' : ''}${getStringBetween(String(param), '/', '/')}')`;
117
+ }).join('\nand ');
118
+ }
119
+ exports.getParameterFilter = getParameterFilter;
120
+ /**
121
+ * Returns the parameter replace (regexp_replace) as a SQL query string.
122
+ *
123
+ * @param params - The stripped parameters that are named within the speed kit config.
124
+ * @param skConfigVersion - The Speed Kit config ruleset version.
125
+ */
126
+ function getParameterReplaceFilter(params, skConfigVersion = 1) {
127
+ const prefixParams = [];
128
+ const suffixParams = [];
129
+ const fullMatchParams = [];
130
+ const prefixIgnoreCaseParams = [];
131
+ const suffixIgnoreCaseParams = [];
132
+ const fullMatchIgnoreCaseParams = [];
133
+ params.forEach(param => {
134
+ // String params or regex params with start marker but no end marker
135
+ if (typeof param === 'string') {
136
+ if (skConfigVersion === 1) {
137
+ return prefixParams.push(param);
138
+ }
139
+ else {
140
+ return fullMatchParams.push(param);
141
+ }
142
+ }
143
+ const ignoreCase = isRegExpIgnoringCase(param);
144
+ // Regex params with start marker but no end marker
145
+ if (/\/\^[^$]+$/.test(String(param))) {
146
+ return (ignoreCase ? prefixIgnoreCaseParams : prefixParams).push(getStringBetween(String(param), '^', '/'));
147
+ }
148
+ // Regex params with end marker but no start marker
149
+ if (/\/[^^$]+\$/.test(String(param))) {
150
+ return (ignoreCase ? suffixIgnoreCaseParams : suffixParams).push(getStringBetween(String(param), '/', '$'));
151
+ }
152
+ // Regex params with start marker and end marker
153
+ if (/\/\^[^$]+\$\//.test(String(param))) {
154
+ return (ignoreCase ? fullMatchIgnoreCaseParams : fullMatchParams).push(getStringBetween(String(param), '^', '$'));
155
+ }
156
+ // Regex params with no start marker and no end marker are being considered full matches
157
+ (ignoreCase ? fullMatchIgnoreCaseParams : fullMatchParams).push(getStringBetween(String(param), '/', '/'));
158
+ });
159
+ let regExpQuery = "regexp_replace(url, '#.*' )";
160
+ const regExps = [
161
+ getParamPrefixRegExp(prefixParams, false),
162
+ getParamPrefixRegExp(prefixIgnoreCaseParams, true),
163
+ getParamSuffixRegExp(suffixParams, false),
164
+ getParamSuffixRegExp(suffixIgnoreCaseParams, true),
165
+ getParamFullMatchRegExp(fullMatchParams, false),
166
+ getParamFullMatchRegExp(fullMatchIgnoreCaseParams, true),
167
+ ];
168
+ // Nest all regexes inside each other:
169
+ regExps.forEach(regExp => {
170
+ if (regExp) {
171
+ regExpQuery = `regexp_replace(${regExpQuery}, '${regExp}', '')`;
172
+ }
173
+ });
174
+ return regExpQuery;
175
+ }
176
+ exports.getParameterReplaceFilter = getParameterReplaceFilter;
177
+ function isRegExpIgnoringCase(regExp) {
178
+ return /\/i$/.test(String(regExp));
179
+ }
180
+ function getParamPrefixRegExp(params, ignoreCase) {
181
+ return params.length > 0 ? `${ignoreCase ? '(?i)' : ''}[?&](${params.join('|')})[^&]*` : null;
182
+ }
183
+ function getParamSuffixRegExp(params, ignoreCase) {
184
+ return params.length > 0 ? `${ignoreCase ? '(?i)' : ''}[?&][^&]*(${params.join('|')})(=[^&]*)?(?=&|$)` : null;
185
+ }
186
+ function getParamFullMatchRegExp(params, ignoreCase) {
187
+ return params.length > 0 ? `${ignoreCase ? '(?i)' : ''}[?&](${params.join('|')})(=[^&]*)?(?=&|$)` : null;
188
+ }
189
+ /**
190
+ * Returns the stripped parameters that are named within the speed kit config.
191
+ *
192
+ * @param parsedConfig - The speed kit config parsed as an object.
193
+ */
194
+ function getStrippedParams(parsedConfig) {
195
+ const paramArray = parsedConfig.stripQueryParams;
196
+ if (!paramArray) {
197
+ return [];
198
+ }
199
+ const isSimpleArray = paramArray.every((param) => typeof param === 'string' || param instanceof RegExp);
200
+ if (isSimpleArray) {
201
+ return paramArray;
202
+ }
203
+ const params = [];
204
+ for (const entry of paramArray) {
205
+ if (!entry.params) {
206
+ continue;
207
+ }
208
+ if (!Array.isArray(entry.params)) {
209
+ params.push(entry.params);
210
+ continue;
211
+ }
212
+ params.push(...entry.params);
213
+ }
214
+ return params;
215
+ }
216
+ exports.getStrippedParams = getStrippedParams;
@@ -0,0 +1,22 @@
1
+ import { Config } from "@oclif/core/lib/config";
2
+ export type UserCliConfig = {
3
+ chromePath: string;
4
+ chromeUserProfilePath: string;
5
+ slackToken: string;
6
+ speedKitBrowserExtensionPath: string;
7
+ testApp: string;
8
+ ideaDirectory: string;
9
+ diffExec: string;
10
+ diffExecTemplate: string;
11
+ };
12
+ export declare class CliConfig {
13
+ private config;
14
+ private userCliConfig;
15
+ constructor(config: Config);
16
+ load(): UserCliConfig;
17
+ private loadConfigFromEnvironment;
18
+ private getConfigFilePath;
19
+ private loadConfigFromConfigFile;
20
+ private createEmptyConfigFile;
21
+ private createEmptyUserConfig;
22
+ }
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CliConfig = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const dotenv = tslib_1.__importStar(require("dotenv"));
6
+ const fs_1 = tslib_1.__importDefault(require("fs"));
7
+ const path_1 = tslib_1.__importDefault(require("path"));
8
+ dotenv.config();
9
+ const envMapping = {
10
+ chromePath: "CHROME_PATH",
11
+ chromeUserProfilePath: "CHROME_USER_PROFILE_PATH",
12
+ slackToken: "SLACK_TOKEN",
13
+ speedKitBrowserExtensionPath: "SPEED_KIT_EXTENSION_PATH",
14
+ testApp: "TEST_APP",
15
+ ideaDirectory: "IDEA_INITIAL_DIRECTORY",
16
+ diffExec: "DIFF_EXEC",
17
+ diffExecTemplate: "DIFF_EXEC_TEMPLATE",
18
+ };
19
+ const CONFIG_FILE_NAME = "config.json";
20
+ class CliConfig {
21
+ config;
22
+ userCliConfig = {
23
+ chromePath: "",
24
+ chromeUserProfilePath: "",
25
+ slackToken: "",
26
+ speedKitBrowserExtensionPath: "",
27
+ testApp: "",
28
+ ideaDirectory: "",
29
+ diffExec: "",
30
+ diffExecTemplate: "$exec $file1 $file2",
31
+ };
32
+ constructor(config) {
33
+ this.config = config;
34
+ }
35
+ load() {
36
+ this.loadConfigFromEnvironment();
37
+ this.loadConfigFromConfigFile();
38
+ return this.userCliConfig;
39
+ }
40
+ loadConfigFromEnvironment() {
41
+ for (const key in this.userCliConfig) {
42
+ const envVar = envMapping[key];
43
+ if (envVar in process.env && process.env[envVar].length > 0) {
44
+ this.userCliConfig[key] = process.env[envVar];
45
+ }
46
+ }
47
+ }
48
+ getConfigFilePath() {
49
+ return path_1.default.resolve(this.config.configDir, CONFIG_FILE_NAME);
50
+ }
51
+ loadConfigFromConfigFile() {
52
+ if (!fs_1.default.existsSync(this.getConfigFilePath())) {
53
+ this.createEmptyConfigFile();
54
+ return;
55
+ }
56
+ const configFileContent = fs_1.default.readFileSync(this.getConfigFilePath(), 'utf8');
57
+ try {
58
+ const configJson = JSON.parse(configFileContent);
59
+ for (const key in configJson) {
60
+ if (configJson[key].length > 0) {
61
+ this.userCliConfig[key] = configJson[key];
62
+ }
63
+ }
64
+ return;
65
+ }
66
+ catch (error) {
67
+ }
68
+ }
69
+ createEmptyConfigFile() {
70
+ fs_1.default.mkdirSync(path_1.default.resolve(this.config.configDir), { recursive: true });
71
+ fs_1.default.writeFileSync(this.getConfigFilePath(), JSON.stringify(this.createEmptyUserConfig(), null, `\t`));
72
+ }
73
+ createEmptyUserConfig() {
74
+ return {
75
+ chromePath: "",
76
+ chromeUserProfilePath: "",
77
+ slackToken: "",
78
+ speedKitBrowserExtensionPath: "",
79
+ testApp: "",
80
+ ideaDirectory: "",
81
+ diffExec: "",
82
+ };
83
+ }
84
+ }
85
+ exports.CliConfig = CliConfig;
@@ -0,0 +1,8 @@
1
+ export declare function createTemporalDir(): Promise<string | null>;
2
+ export declare function createEmptyFile(): Promise<string>;
3
+ export declare function trimFileExtension(str: string): string;
4
+ export declare function readLocalFile(basePath: string, fileName: string): Promise<string | null>;
5
+ /**
6
+ * Returns the local path to the sk-onboarding project.
7
+ */
8
+ export declare function getLocalPath(path: string): string;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLocalPath = exports.readLocalFile = exports.trimFileExtension = exports.createEmptyFile = exports.createTemporalDir = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const fs = tslib_1.__importStar(require("fs-extra"));
6
+ const path = tslib_1.__importStar(require("path"));
7
+ const path_1 = tslib_1.__importDefault(require("path"));
8
+ const os = tslib_1.__importStar(require("os"));
9
+ const core_1 = require("@oclif/core");
10
+ const CustomerConfig_1 = require("./CustomerConfig");
11
+ const logging_helper_1 = require("./logging-helper");
12
+ async function createTemporalDir() {
13
+ try {
14
+ return fs.mkdtemp(path.join(os.tmpdir(), 'speed-kit-cli-'));
15
+ }
16
+ catch (error) {
17
+ console.error('Error creating temp folder', error);
18
+ return null;
19
+ }
20
+ }
21
+ exports.createTemporalDir = createTemporalDir;
22
+ async function createEmptyFile() {
23
+ const tempDir = await createTemporalDir();
24
+ const filePath = path.join(tempDir, '/empty_FilePath.js');
25
+ const writeFilePromise = new Promise((resolve, reject) => {
26
+ fs.writeFile(filePath, 'No file was found', err => {
27
+ if (err) {
28
+ return reject(err);
29
+ }
30
+ resolve(null);
31
+ });
32
+ });
33
+ await writeFilePromise;
34
+ return path.resolve(filePath);
35
+ }
36
+ exports.createEmptyFile = createEmptyFile;
37
+ function trimFileExtension(str) {
38
+ return str.replace('.js', '').replace('.es6', '');
39
+ }
40
+ exports.trimFileExtension = trimFileExtension;
41
+ async function readLocalFile(basePath, fileName) {
42
+ try {
43
+ const file = await CustomerConfig_1.ConfigFile.loadFile(basePath, fileName);
44
+ return await file.readContent();
45
+ }
46
+ catch (error) {
47
+ return null;
48
+ }
49
+ }
50
+ exports.readLocalFile = readLocalFile;
51
+ /**
52
+ * Returns the local path to the sk-onboarding project.
53
+ */
54
+ function getLocalPath(path) {
55
+ const fullCustomerPath = path_1.default.resolve(path, '');
56
+ // Check if path is a valid path or not
57
+ if (!fs.existsSync(fullCustomerPath)) {
58
+ (0, logging_helper_1.logError)(`The given path: ${fullCustomerPath} is not a valid path`);
59
+ core_1.ux.exit(1);
60
+ }
61
+ return fullCustomerPath;
62
+ }
63
+ exports.getLocalPath = getLocalPath;
@@ -0,0 +1,11 @@
1
+ import { ConfigFile } from "./CustomerConfig";
2
+ interface SpeedKitConfig {
3
+ ruleSetConfig?: {
4
+ version?: string;
5
+ };
6
+ [key: string]: any;
7
+ }
8
+ export declare function parseSpeedKitConfig(config: string): SpeedKitConfig;
9
+ export declare function getParsedConfig(configFile: ConfigFile): Promise<SpeedKitConfig>;
10
+ export declare function getSpeedKitConfigVersion(config: SpeedKitConfig): number;
11
+ export {};
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSpeedKitConfigVersion = exports.getParsedConfig = exports.parseSpeedKitConfig = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const vm = tslib_1.__importStar(require("vm"));
6
+ function parseSpeedKitConfig(config) {
7
+ // Replace all properties that use function calls or that are related to other objects like window
8
+ const window = {};
9
+ window.top = window;
10
+ const storage = {
11
+ length: 0,
12
+ clear: () => undefined,
13
+ getItem: () => undefined,
14
+ key: () => null,
15
+ removeItem: () => undefined,
16
+ setItem: () => undefined,
17
+ };
18
+ const node = {
19
+ querySelector: () => node,
20
+ querySelectorAll: () => [],
21
+ classList: { contains: () => false }
22
+ };
23
+ const context = {
24
+ window,
25
+ APP: '',
26
+ document: Object.assign(Object.create(node), {
27
+ cookie: '',
28
+ documentElement: Object.create(node),
29
+ head: Object.create(node),
30
+ body: Object.create(node),
31
+ }),
32
+ speedKit: window.speedKit,
33
+ navigator: { userAgent: 'test-agent' },
34
+ location: new URL('https://www.example.com'),
35
+ localStorage: storage,
36
+ sessionStorage: storage,
37
+ };
38
+ vm.runInNewContext(config, context);
39
+ return window.speedKit;
40
+ }
41
+ exports.parseSpeedKitConfig = parseSpeedKitConfig;
42
+ async function getParsedConfig(configFile) {
43
+ const configString = configFile ? await configFile.readContent() : undefined;
44
+ if (!configString) {
45
+ throw new Error('Speed Kit config could not be found in directory');
46
+ }
47
+ let parsedConfig;
48
+ try {
49
+ parsedConfig = parseSpeedKitConfig(configString);
50
+ }
51
+ catch (e) {
52
+ throw new Error(`Speed Kit config string could not be parsed.\n${e.stack}`);
53
+ }
54
+ if (!parsedConfig) {
55
+ throw new Error('Speed Kit config was not correctly exposed on the global speedKit variable.');
56
+ }
57
+ return parsedConfig;
58
+ }
59
+ exports.getParsedConfig = getParsedConfig;
60
+ function getSpeedKitConfigVersion(config) {
61
+ return Number(config.ruleSetConfig?.version) || 1;
62
+ }
63
+ exports.getSpeedKitConfigVersion = getSpeedKitConfigVersion;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Gets chrome-path of .env file in skonboarding project.
3
+ * If path is not set or falsy, uses default chrome-path.
4
+ *
5
+ * @param customerPath - Path to customer in skonboarding-project.
6
+ */
7
+ export declare function getChromePath(customerPath: string): Promise<string>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getChromePath = void 0;
4
+ const CustomerConfig_1 = require("./CustomerConfig");
5
+ const isFile_1 = require("./isFile");
6
+ const CHROME_PATHS = {
7
+ "darwin": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
8
+ "win32": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
9
+ "linux": "/usr/bin/google-chrome",
10
+ };
11
+ const ENV_CHROME_REGEX = new RegExp(/^\s*CHROME_PATH=(.*)$/um);
12
+ /**
13
+ * Gets chrome-path of .env file in skonboarding project.
14
+ * If path is not set or falsy, uses default chrome-path.
15
+ *
16
+ * @param customerPath - Path to customer in skonboarding-project.
17
+ */
18
+ async function getChromePath(customerPath) {
19
+ const envFile = await CustomerConfig_1.ConfigFile.loadFile(customerPath, '../../.env');
20
+ if (!envFile) {
21
+ return CHROME_PATHS[process.platform];
22
+ }
23
+ const envContent = await envFile.readContent();
24
+ const chromePath = ENV_CHROME_REGEX.test(envContent) ? envContent.match(ENV_CHROME_REGEX)[1] : '';
25
+ return await (0, isFile_1.isFile)(chromePath) ? chromePath : CHROME_PATHS[process.platform];
26
+ }
27
+ exports.getChromePath = getChromePath;
@@ -0,0 +1 @@
1
+ export declare function isDirectory(dir: string): Promise<boolean>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isDirectory = void 0;
4
+ const promises_1 = require("fs/promises");
5
+ async function isDirectory(dir) {
6
+ try {
7
+ const stats = await (0, promises_1.stat)(dir);
8
+ return stats.isDirectory();
9
+ }
10
+ catch (e) {
11
+ if (e.code === 'ENOENT') {
12
+ return false;
13
+ }
14
+ throw e;
15
+ }
16
+ }
17
+ exports.isDirectory = isDirectory;
@@ -0,0 +1 @@
1
+ export declare function isExecutable(filename: string): Promise<boolean>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isExecutable = void 0;
4
+ const promises_1 = require("fs/promises");
5
+ const fs_1 = require("fs");
6
+ async function isExecutable(filename) {
7
+ try {
8
+ await (0, promises_1.access)(filename, fs_1.constants.X_OK);
9
+ return true;
10
+ }
11
+ catch {
12
+ return false;
13
+ }
14
+ }
15
+ exports.isExecutable = isExecutable;
@@ -0,0 +1 @@
1
+ export declare function isFile(filename: string): Promise<boolean>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isFile = void 0;
4
+ const promises_1 = require("fs/promises");
5
+ async function isFile(filename) {
6
+ try {
7
+ const stats = await (0, promises_1.stat)(filename);
8
+ return stats.isFile();
9
+ }
10
+ catch (e) {
11
+ if (e.code === 'ENOENT') {
12
+ return false;
13
+ }
14
+ throw e;
15
+ }
16
+ }
17
+ exports.isFile = isFile;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Logs the given message 'green' in the console.
3
+ */
4
+ export declare function logInfo(message: string, ...optionalParams: any[]): void;
5
+ /**
6
+ * Logs the given message 'red' in the console.
7
+ */
8
+ export declare function logError(message: string, ...optionalParams: any[]): void;
9
+ /**
10
+ * Logs the given message 'yellow' in the console.
11
+ */
12
+ export declare function logWarning(message: string, ...optionalParams: any[]): void;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logWarning = exports.logError = exports.logInfo = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
+ // TODO: use CliService instead
7
+ /**
8
+ * Logs the given message 'green' in the console.
9
+ */
10
+ function logInfo(message, ...optionalParams) {
11
+ console.log(chalk_1.default.green(message), ...optionalParams);
12
+ }
13
+ exports.logInfo = logInfo;
14
+ /**
15
+ * Logs the given message 'red' in the console.
16
+ */
17
+ function logError(message, ...optionalParams) {
18
+ console.log(chalk_1.default.red(message), ...optionalParams);
19
+ }
20
+ exports.logError = logError;
21
+ /**
22
+ * Logs the given message 'yellow' in the console.
23
+ */
24
+ function logWarning(message, ...optionalParams) {
25
+ console.log(chalk_1.default.yellow(message), ...optionalParams);
26
+ }
27
+ exports.logWarning = logWarning;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Sorts all urls params manually.
3
+ *
4
+ * @param searchParams - Params to sort.
5
+ */
6
+ export declare function sortParams(searchParams: URLSearchParams): void;
7
+ /**
8
+ * Converts parameters back to origin form.
9
+ *
10
+ * When adding parameters to the original URL the encoding of the parameters can change.
11
+ * This is because adding parameters to an URL object triggers a decode before adding
12
+ * and an encode after adding. Therefore the encoding of parameters can differ from the origin
13
+ * (e.g. if a whitespace is encoded like '%20' in the original URL, adding a parameter by calling
14
+ * searchParams.append() encodes the whitespace to '+').
15
+ *
16
+ * The root cause for this is because the encoding when appending search params to an URL object
17
+ * is different than the encoding of encodeURIComponent().
18
+ *
19
+ * @param url - The original Url.
20
+ * @param manipulatedUrl - The computed URL.
21
+ */
22
+ export declare function convertNotEncodedParameters(url: URL, manipulatedUrl: URL): void;
23
+ /**
24
+ * Removes the "=" char of query parameters that do not have a value.
25
+ *
26
+ * Hint: This is needed because calling the append or delete method of {@link URL}
27
+ * adds a "=" to all parameter without value. This results in different resource URLs.
28
+ *
29
+ * @param url - The original URL.
30
+ * @param manipulatedUrl - The manipulated URL to remove the "=" from.
31
+ */
32
+ export declare function transformNoValueParams(url: URL, manipulatedUrl: URL): void;
33
+ /**
34
+ * Normalizes a given URL.
35
+ *
36
+ * @param urlString - The URL to be normalized.
37
+ * @param sortParameters - Activates alphabetical sorting of the URL parameters.
38
+ * @returns The normalized URL.
39
+ */
40
+ export declare function normalize(urlString: string, sortParameters: boolean): string;