@speedkit/cli 3.43.2 → 4.1.0

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 (413) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +6 -6
  3. package/bin/dev +2 -15
  4. package/bin/run +2 -2
  5. package/dist/commands/build-parameter-query.d.ts +3 -3
  6. package/dist/commands/build-parameter-query.js +12 -15
  7. package/dist/commands/build-prewarm-query.d.ts +4 -4
  8. package/dist/commands/build-prewarm-query.js +13 -16
  9. package/dist/commands/config/edit.js +7 -11
  10. package/dist/commands/deploy.d.ts +3 -5
  11. package/dist/commands/deploy.js +12 -16
  12. package/dist/commands/diff-url-parameters.d.ts +3 -3
  13. package/dist/commands/diff-url-parameters.js +27 -30
  14. package/dist/commands/document-handler.d.ts +4 -4
  15. package/dist/commands/document-handler.js +13 -17
  16. package/dist/commands/find-pops.d.ts +2 -2
  17. package/dist/commands/find-pops.js +22 -24
  18. package/dist/commands/generate-customer-config.d.ts +2 -2
  19. package/dist/commands/generate-customer-config.js +13 -16
  20. package/dist/commands/generate-pop-config.d.ts +7 -7
  21. package/dist/commands/generate-pop-config.js +32 -41
  22. package/dist/commands/login.d.ts +1 -1
  23. package/dist/commands/login.js +13 -17
  24. package/dist/commands/onboarding.d.ts +3 -5
  25. package/dist/commands/onboarding.js +10 -13
  26. package/dist/commands/prewarm.d.ts +9 -9
  27. package/dist/commands/prewarm.js +25 -28
  28. package/dist/commands/pull.d.ts +3 -3
  29. package/dist/commands/pull.js +11 -14
  30. package/dist/commands/wpt-launcher.d.ts +7 -7
  31. package/dist/commands/wpt-launcher.js +21 -26
  32. package/dist/helpers/array-helper.js +1 -4
  33. package/dist/helpers/build-query-helper.js +5 -12
  34. package/dist/helpers/cli-config.d.ts +3 -3
  35. package/dist/helpers/cli-config.js +11 -16
  36. package/dist/helpers/customer-config.d.ts +4 -8
  37. package/dist/helpers/customer-config.js +18 -23
  38. package/dist/helpers/evaluate-speed-kit-config.d.ts +1 -1
  39. package/dist/helpers/evaluate-speed-kit-config.js +42 -26
  40. package/dist/helpers/file-helper.js +8 -13
  41. package/dist/helpers/get-parsed-config.d.ts +1 -1
  42. package/dist/helpers/get-parsed-config.js +6 -10
  43. package/dist/helpers/html-format-helper.js +3 -6
  44. package/dist/helpers/is-directory.js +3 -6
  45. package/dist/helpers/is-file.js +3 -6
  46. package/dist/helpers/logging-helper.js +7 -13
  47. package/dist/helpers/normalize.js +10 -17
  48. package/dist/helpers/race.d.ts +1 -1
  49. package/dist/helpers/race.js +3 -9
  50. package/dist/helpers/safe.js +1 -4
  51. package/dist/helpers/scrape.d.ts +1 -1
  52. package/dist/helpers/scrape.js +3 -7
  53. package/dist/helpers/site-analyzer.js +5 -9
  54. package/dist/helpers/speed-kit-rule-to-reg-exp.js +1 -4
  55. package/dist/models/cli-parameters.d.ts +4 -4
  56. package/dist/models/cli-parameters.js +13 -16
  57. package/dist/models/files.js +1 -4
  58. package/dist/models/install.js +1 -2
  59. package/dist/models/os.js +1 -4
  60. package/dist/services/athena/athena-service-factory.d.ts +1 -1
  61. package/dist/services/athena/athena-service-factory.js +15 -19
  62. package/dist/services/athena/athena-service-model.js +2 -5
  63. package/dist/services/athena/athena-service.d.ts +1 -1
  64. package/dist/services/athena/athena-service.js +18 -23
  65. package/dist/services/athena/error/athena-query-error.d.ts +1 -1
  66. package/dist/services/athena/error/athena-query-error.js +2 -7
  67. package/dist/services/athena/error/fetch-credentials-error.d.ts +1 -1
  68. package/dist/services/athena/error/fetch-credentials-error.js +2 -7
  69. package/dist/services/athena/index.d.ts +4 -4
  70. package/dist/services/athena/index.js +4 -7
  71. package/dist/services/bundler/bundle-service-factory.d.ts +3 -1
  72. package/dist/services/bundler/bundle-service-factory.js +7 -7
  73. package/dist/services/bundler/bundle-service.d.ts +9 -12
  74. package/dist/services/bundler/bundle-service.js +42 -32
  75. package/dist/services/bundler/error/bundle-fetch-error.d.ts +1 -1
  76. package/dist/services/bundler/error/bundle-fetch-error.js +2 -7
  77. package/dist/services/bundler/error/bundle-resolve-error.d.ts +1 -1
  78. package/dist/services/bundler/error/bundle-resolve-error.js +2 -7
  79. package/dist/services/bundler/index.d.ts +2 -2
  80. package/dist/services/bundler/index.js +2 -5
  81. package/dist/services/cli/cli-service-factory.d.ts +2 -2
  82. package/dist/services/cli/cli-service-factory.js +6 -10
  83. package/dist/services/cli/cli-service-model.d.ts +21 -6
  84. package/dist/services/cli/cli-service-model.js +3 -7
  85. package/dist/services/cli/cli-service.d.ts +10 -8
  86. package/dist/services/cli/cli-service.js +64 -61
  87. package/dist/services/cli/error/cli-type-error.js +1 -4
  88. package/dist/services/cli/index.d.ts +3 -3
  89. package/dist/services/cli/index.js +3 -6
  90. package/dist/services/config-api/client.d.ts +2 -2
  91. package/dist/services/config-api/client.js +29 -34
  92. package/dist/services/config-api/config-api-factory.d.ts +2 -2
  93. package/dist/services/config-api/config-api-factory.js +15 -20
  94. package/dist/services/config-api/config-api-model.d.ts +2 -2
  95. package/dist/services/config-api/config-api-model.js +1 -5
  96. package/dist/services/config-api/config-api-service.d.ts +2 -2
  97. package/dist/services/config-api/config-api-service.js +1 -5
  98. package/dist/services/config-api/entity-manager-factory.js +3 -7
  99. package/dist/services/config-api/error/json-response-error.d.ts +1 -1
  100. package/dist/services/config-api/error/json-response-error.js +2 -7
  101. package/dist/services/config-api/error/login-error.d.ts +1 -1
  102. package/dist/services/config-api/error/login-error.js +2 -7
  103. package/dist/services/config-api/error/orestes-api-error.d.ts +1 -1
  104. package/dist/services/config-api/error/orestes-api-error.js +2 -7
  105. package/dist/services/config-api/index.d.ts +3 -3
  106. package/dist/services/config-api/index.js +3 -6
  107. package/dist/services/config-api-service.d.ts +1 -1
  108. package/dist/services/config-api-service.js +6 -11
  109. package/dist/services/customer-config/customer-config-service-context.js +3 -7
  110. package/dist/services/customer-config/customer-config-service-factory.d.ts +1 -1
  111. package/dist/services/customer-config/customer-config-service-factory.js +6 -10
  112. package/dist/services/customer-config/customer-config-service-model.js +6 -9
  113. package/dist/services/customer-config/customer-config-service.d.ts +3 -3
  114. package/dist/services/customer-config/customer-config-service.js +55 -55
  115. package/dist/services/customer-config/index.d.ts +4 -4
  116. package/dist/services/customer-config/index.js +4 -7
  117. package/dist/services/customer-config/templates/config_documentHandler.js.hbs +88 -1
  118. package/dist/services/deploy/builder/install-resource-builder.d.ts +2 -2
  119. package/dist/services/deploy/builder/install-resource-builder.js +3 -7
  120. package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.d.ts +4 -4
  121. package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.js +19 -24
  122. package/dist/services/deploy/checks/post-deploy/revalidated-module-check.d.ts +3 -3
  123. package/dist/services/deploy/checks/post-deploy/revalidated-module-check.js +10 -14
  124. package/dist/services/deploy/checks/post-deploy/save-files-check.d.ts +3 -3
  125. package/dist/services/deploy/checks/post-deploy/save-files-check.js +8 -12
  126. package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.d.ts +3 -3
  127. package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.js +14 -20
  128. package/dist/services/deploy/checks/pre-deploy/split-change-check.d.ts +3 -3
  129. package/dist/services/deploy/checks/pre-deploy/split-change-check.js +19 -20
  130. package/dist/services/deploy/context/deploy-context.d.ts +2 -2
  131. package/dist/services/deploy/context/deploy-context.js +10 -14
  132. package/dist/services/deploy/deploy-service-factory.d.ts +3 -3
  133. package/dist/services/deploy/deploy-service-factory.js +36 -40
  134. package/dist/services/deploy/deploy-service-model.d.ts +10 -10
  135. package/dist/services/deploy/deploy-service-model.js +1 -2
  136. package/dist/services/deploy/deploy-service.d.ts +4 -4
  137. package/dist/services/deploy/deploy-service.js +10 -15
  138. package/dist/services/deploy/error/check-module-file-error.d.ts +1 -1
  139. package/dist/services/deploy/error/check-module-file-error.js +2 -7
  140. package/dist/services/deploy/error/deploy-install-resource-error.d.ts +1 -1
  141. package/dist/services/deploy/error/deploy-install-resource-error.js +2 -7
  142. package/dist/services/deploy/error/deploy-module-file-error.d.ts +1 -1
  143. package/dist/services/deploy/error/deploy-module-file-error.js +2 -7
  144. package/dist/services/deploy/error/deploy-server-config-error.d.ts +1 -1
  145. package/dist/services/deploy/error/deploy-server-config-error.js +2 -7
  146. package/dist/services/deploy/error/evaluate-sk-config-error.d.ts +1 -1
  147. package/dist/services/deploy/error/evaluate-sk-config-error.js +2 -7
  148. package/dist/services/deploy/error/file-handler-error.d.ts +1 -1
  149. package/dist/services/deploy/error/file-handler-error.js +2 -7
  150. package/dist/services/deploy/error/post-deploy-deployment-detection-error.d.ts +1 -1
  151. package/dist/services/deploy/error/post-deploy-deployment-detection-error.js +2 -7
  152. package/dist/services/deploy/error/safe-file-error.d.ts +1 -1
  153. package/dist/services/deploy/error/safe-file-error.js +2 -7
  154. package/dist/services/deploy/handler/customer-config-handler.d.ts +6 -6
  155. package/dist/services/deploy/handler/customer-config-handler.js +6 -10
  156. package/dist/services/deploy/handler/install-resource-handler.d.ts +7 -7
  157. package/dist/services/deploy/handler/install-resource-handler.js +22 -27
  158. package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.d.ts +4 -4
  159. package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.js +1 -4
  160. package/dist/services/deploy/handler/module-handler.d.ts +6 -6
  161. package/dist/services/deploy/handler/module-handler.js +12 -18
  162. package/dist/services/deploy/handler/server-config-handler.d.ts +5 -5
  163. package/dist/services/deploy/handler/server-config-handler.js +10 -14
  164. package/dist/services/deploy/interface/deploy-handler-interface.d.ts +1 -1
  165. package/dist/services/deploy/interface/deploy-handler-interface.js +1 -2
  166. package/dist/services/deploy/interface/install-configs.js +1 -2
  167. package/dist/services/deploy/interface/install-resource-processor-interface.d.ts +1 -1
  168. package/dist/services/deploy/interface/install-resource-processor-interface.js +1 -2
  169. package/dist/services/deploy/interface/install.d.ts +1 -1
  170. package/dist/services/deploy/interface/install.js +1 -2
  171. package/dist/services/deploy/interface/runtime-modifier.d.ts +1 -1
  172. package/dist/services/deploy/interface/runtime-modifier.js +1 -2
  173. package/dist/services/deploy/interface/validate-origins-response.js +1 -2
  174. package/dist/services/diff/diff-model.js +1 -5
  175. package/dist/services/diff/diff-service-factory.d.ts +1 -1
  176. package/dist/services/diff/diff-service-factory.js +6 -10
  177. package/dist/services/diff/diff-service.d.ts +1 -1
  178. package/dist/services/diff/diff-service.js +19 -24
  179. package/dist/services/diff/index.d.ts +3 -3
  180. package/dist/services/diff/index.js +3 -6
  181. package/dist/services/diff-service.d.ts +1 -1
  182. package/dist/services/diff-service.js +16 -21
  183. package/dist/services/document-handler-runtime/context/document-handler-runtime-context.js +30 -34
  184. package/dist/services/document-handler-runtime/document-handler-runtime-service.d.ts +3 -3
  185. package/dist/services/document-handler-runtime/document-handler-runtime-service.js +38 -42
  186. package/dist/services/document-handler-runtime/document-handler-server.d.ts +7 -11
  187. package/dist/services/document-handler-runtime/document-handler-server.js +77 -59
  188. package/dist/services/document-handler-runtime/error/required-file-not-found-error.js +1 -4
  189. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +5 -5
  190. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +42 -46
  191. package/dist/services/document-handler-runtime/interface/document-handler-runtime-config-interface.js +1 -4
  192. package/dist/services/document-handler-runtime/interface/template-context-interface.d.ts +2 -3
  193. package/dist/services/document-handler-runtime/interface/template-context-interface.js +1 -2
  194. package/dist/services/document-handler-runtime/interface/template-interface.d.ts +2 -2
  195. package/dist/services/document-handler-runtime/interface/template-interface.js +1 -2
  196. package/dist/services/document-handler-runtime/interface/template-parameter-interface.js +1 -2
  197. package/dist/services/document-handler-runtime/server/document-handler-response.d.ts +1 -3
  198. package/dist/services/document-handler-runtime/server/document-handler-response.js +1 -5
  199. package/dist/services/document-handler-runtime/server/request.d.ts +4 -10
  200. package/dist/services/document-handler-runtime/server/request.js +1 -5
  201. package/dist/services/document-handler-runtime/templates/abstract-template.d.ts +3 -3
  202. package/dist/services/document-handler-runtime/templates/abstract-template.js +3 -7
  203. package/dist/services/document-handler-runtime/templates/database-mock.d.ts +2 -2
  204. package/dist/services/document-handler-runtime/templates/database-mock.js +2 -6
  205. package/dist/services/document-handler-runtime/templates/execute-document-handler.d.ts +2 -2
  206. package/dist/services/document-handler-runtime/templates/execute-document-handler.js +2 -6
  207. package/dist/services/document-handler-runtime/templates/orestes-mock.d.ts +2 -2
  208. package/dist/services/document-handler-runtime/templates/orestes-mock.js +2 -6
  209. package/dist/services/document-handler-runtime/templates/package-json.d.ts +3 -5
  210. package/dist/services/document-handler-runtime/templates/package-json.js +2 -6
  211. package/dist/services/document-handler-runtime/templates/test.d.ts +2 -2
  212. package/dist/services/document-handler-runtime/templates/test.js +2 -6
  213. package/dist/services/error-handling/error/application-error.d.ts +1 -1
  214. package/dist/services/error-handling/error/application-error.js +1 -5
  215. package/dist/services/error-handling/error/config-file-error.d.ts +1 -1
  216. package/dist/services/error-handling/error/config-file-error.js +2 -7
  217. package/dist/services/error-handling/error/connection-error.d.ts +1 -1
  218. package/dist/services/error-handling/error/connection-error.js +2 -7
  219. package/dist/services/integration-api/error/customer-config-error.d.ts +1 -1
  220. package/dist/services/integration-api/error/customer-config-error.js +2 -5
  221. package/dist/services/integration-api/error/customer-config-legacy-error.d.ts +1 -1
  222. package/dist/services/integration-api/error/customer-config-legacy-error.js +2 -6
  223. package/dist/services/integration-api/error/invalid-config-format-error.d.ts +1 -1
  224. package/dist/services/integration-api/error/invalid-config-format-error.js +4 -7
  225. package/dist/services/integration-api/error/mandatory-file-missing-error.d.ts +1 -1
  226. package/dist/services/integration-api/error/mandatory-file-missing-error.js +2 -6
  227. package/dist/services/integration-api/error/origin-error.d.ts +1 -1
  228. package/dist/services/integration-api/error/origin-error.js +2 -5
  229. package/dist/services/integration-api/error/read-files-error.d.ts +1 -1
  230. package/dist/services/integration-api/error/read-files-error.js +2 -7
  231. package/dist/services/integration-api/external/external-file-reader.d.ts +1 -1
  232. package/dist/services/integration-api/external/external-file-reader.js +9 -14
  233. package/dist/services/integration-api/file-list.d.ts +1 -1
  234. package/dist/services/integration-api/file-list.js +8 -11
  235. package/dist/services/integration-api/file-reader.js +11 -15
  236. package/dist/services/integration-api/file-writer.js +4 -8
  237. package/dist/services/integration-api/handler/customer-config-handler.d.ts +5 -5
  238. package/dist/services/integration-api/handler/customer-config-handler.js +17 -21
  239. package/dist/services/integration-api/handler/file-handler.d.ts +2 -2
  240. package/dist/services/integration-api/handler/file-handler.js +1 -4
  241. package/dist/services/integration-api/handler/install-resource-handler.d.ts +2 -2
  242. package/dist/services/integration-api/handler/install-resource-handler.js +6 -10
  243. package/dist/services/integration-api/handler/module-handler.d.ts +2 -2
  244. package/dist/services/integration-api/handler/module-handler.js +4 -8
  245. package/dist/services/integration-api/handler/server-config-handler.d.ts +2 -2
  246. package/dist/services/integration-api/handler/server-config-handler.js +4 -8
  247. package/dist/services/integration-api/index.d.ts +3 -3
  248. package/dist/services/integration-api/index.js +3 -6
  249. package/dist/services/integration-api/integration-api-factory.d.ts +3 -3
  250. package/dist/services/integration-api/integration-api-factory.js +23 -28
  251. package/dist/services/integration-api/integration-api-model.d.ts +17 -19
  252. package/dist/services/integration-api/integration-api-model.js +16 -21
  253. package/dist/services/integration-api/integration-api-service.d.ts +5 -5
  254. package/dist/services/integration-api/integration-api-service.js +6 -12
  255. package/dist/services/integration-api/spec/customer-config-validator.spec.js +29 -32
  256. package/dist/services/integration-api/spec/file-list.spec.js +107 -110
  257. package/dist/services/integration-api/spec/file-reader.spec.js +27 -30
  258. package/dist/services/integration-api/spec/file-writer.spec.js +34 -37
  259. package/dist/services/integration-api/spec/integration-api-service.spec.js +42 -45
  260. package/dist/services/integration-api/spec/mandatory-files-validator.spec.js +48 -51
  261. package/dist/services/integration-api/struct/customer-config-file.d.ts +1 -1
  262. package/dist/services/integration-api/struct/customer-config-file.js +10 -15
  263. package/dist/services/integration-api/struct/customer-config.d.ts +4 -8
  264. package/dist/services/integration-api/struct/customer-config.js +5 -10
  265. package/dist/services/integration-api/struct/file.d.ts +1 -1
  266. package/dist/services/integration-api/struct/file.js +9 -13
  267. package/dist/services/integration-api/struct/install-resource-file.d.ts +2 -2
  268. package/dist/services/integration-api/struct/install-resource-file.js +4 -8
  269. package/dist/services/integration-api/struct/module-file.d.ts +2 -2
  270. package/dist/services/integration-api/struct/module-file.js +4 -8
  271. package/dist/services/integration-api/struct/ro-file.d.ts +1 -1
  272. package/dist/services/integration-api/struct/ro-file.js +1 -5
  273. package/dist/services/integration-api/struct/server-config-file.d.ts +2 -2
  274. package/dist/services/integration-api/struct/server-config-file.js +4 -8
  275. package/dist/services/integration-api/struct/virtual-file.d.ts +1 -1
  276. package/dist/services/integration-api/struct/virtual-file.js +3 -7
  277. package/dist/services/integration-api/validator/customer-config-validator.d.ts +1 -1
  278. package/dist/services/integration-api/validator/customer-config-validator.js +8 -12
  279. package/dist/services/integration-api/validator/mandatory-files-validator.d.ts +2 -2
  280. package/dist/services/integration-api/validator/mandatory-files-validator.js +4 -8
  281. package/dist/services/integration-api/virtual/external-recipe.d.ts +2 -2
  282. package/dist/services/integration-api/virtual/external-recipe.js +1 -5
  283. package/dist/services/integration-api/virtual/static-recipe.d.ts +1 -1
  284. package/dist/services/integration-api/virtual/static-recipe.js +1 -5
  285. package/dist/services/integration-api/virtual/virtual-file-handler.d.ts +2 -2
  286. package/dist/services/integration-api/virtual/virtual-file-handler.js +8 -13
  287. package/dist/services/onboarding/browser/abort-response.js +1 -5
  288. package/dist/services/onboarding/browser/baqend-response.d.ts +1 -1
  289. package/dist/services/onboarding/browser/baqend-response.js +1 -5
  290. package/dist/services/onboarding/browser/config/browser-config.d.ts +1 -1
  291. package/dist/services/onboarding/browser/config/browser-config.js +15 -20
  292. package/dist/services/onboarding/browser/executable/executable-validator.d.ts +2 -2
  293. package/dist/services/onboarding/browser/executable/executable-validator.js +12 -17
  294. package/dist/services/onboarding/browser/extension/devtools-extension-api.d.ts +1 -1
  295. package/dist/services/onboarding/browser/extension/devtools-extension-api.js +1 -5
  296. package/dist/services/onboarding/browser/extension/extension-downloader.d.ts +2 -2
  297. package/dist/services/onboarding/browser/extension/extension-downloader.js +24 -30
  298. package/dist/services/onboarding/browser/extension/extension-validator.d.ts +3 -3
  299. package/dist/services/onboarding/browser/extension/extension-validator.js +18 -23
  300. package/dist/services/onboarding/browser/origin-response.d.ts +1 -1
  301. package/dist/services/onboarding/browser/origin-response.js +1 -5
  302. package/dist/services/onboarding/config-renderer/install-file-recipe.d.ts +2 -2
  303. package/dist/services/onboarding/config-renderer/install-file-recipe.js +1 -5
  304. package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +3 -3
  305. package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +8 -11
  306. package/dist/services/onboarding/dashboard/diff-against-current-page.d.ts +4 -4
  307. package/dist/services/onboarding/dashboard/diff-against-current-page.js +9 -14
  308. package/dist/services/onboarding/dashboard/index.d.ts +7 -7
  309. package/dist/services/onboarding/dashboard/index.js +8 -13
  310. package/dist/services/onboarding/dashboard/parameter-query-builder.d.ts +1 -1
  311. package/dist/services/onboarding/dashboard/parameter-query-builder.js +9 -13
  312. package/dist/services/onboarding/dashboard/request-diff-service.d.ts +3 -3
  313. package/dist/services/onboarding/dashboard/request-diff-service.js +14 -19
  314. package/dist/services/onboarding/error/browser-extension-error.d.ts +1 -1
  315. package/dist/services/onboarding/error/browser-extension-error.js +1 -5
  316. package/dist/services/onboarding/error/document-handler-transform-error.js +1 -5
  317. package/dist/services/onboarding/error/unsupported-encoding-error.d.ts +1 -1
  318. package/dist/services/onboarding/error/unsupported-encoding-error.js +2 -7
  319. package/dist/services/onboarding/error/validate-extension-error.d.ts +1 -1
  320. package/dist/services/onboarding/error/validate-extension-error.js +2 -7
  321. package/dist/services/onboarding/error/vm-empty-response-error.d.ts +1 -1
  322. package/dist/services/onboarding/error/vm-empty-response-error.js +2 -7
  323. package/dist/services/onboarding/error/vm-error.d.ts +1 -1
  324. package/dist/services/onboarding/error/vm-error.js +2 -7
  325. package/dist/services/onboarding/fetch-event-handler.d.ts +4 -4
  326. package/dist/services/onboarding/fetch-event-handler.js +19 -25
  327. package/dist/services/onboarding/fetch-events/customer-domain-document-response.d.ts +4 -4
  328. package/dist/services/onboarding/fetch-events/customer-domain-document-response.js +15 -20
  329. package/dist/services/onboarding/fetch-events/customer-service-worker-js.d.ts +3 -3
  330. package/dist/services/onboarding/fetch-events/customer-service-worker-js.js +4 -8
  331. package/dist/services/onboarding/fetch-events/dashboard-request.d.ts +3 -3
  332. package/dist/services/onboarding/fetch-events/dashboard-request.js +1 -5
  333. package/dist/services/onboarding/fetch-events/speed-kit-asset-request.d.ts +5 -5
  334. package/dist/services/onboarding/fetch-events/speed-kit-asset-request.js +1 -5
  335. package/dist/services/onboarding/fetch-events/speed-kit-install-html.d.ts +4 -4
  336. package/dist/services/onboarding/fetch-events/speed-kit-install-html.js +3 -7
  337. package/dist/services/onboarding/fetch-events/speed-kit-install-js.d.ts +5 -5
  338. package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +7 -11
  339. package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +6 -6
  340. package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +4 -8
  341. package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +3 -3
  342. package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +3 -7
  343. package/dist/services/onboarding/file-events/file-watcher.d.ts +5 -5
  344. package/dist/services/onboarding/file-events/file-watcher.js +24 -28
  345. package/dist/services/onboarding/index.d.ts +3 -3
  346. package/dist/services/onboarding/index.js +3 -8
  347. package/dist/services/onboarding/onboarding-model.d.ts +21 -23
  348. package/dist/services/onboarding/onboarding-model.js +22 -27
  349. package/dist/services/onboarding/onboarding-service-factory.d.ts +3 -3
  350. package/dist/services/onboarding/onboarding-service-factory.js +102 -108
  351. package/dist/services/onboarding/onboarding-service.d.ts +6 -6
  352. package/dist/services/onboarding/onboarding-service.js +12 -18
  353. package/dist/services/onboarding/request-cache/cache.d.ts +3 -3
  354. package/dist/services/onboarding/request-cache/cache.js +1 -5
  355. package/dist/services/onboarding/server-config/index.d.ts +3 -3
  356. package/dist/services/onboarding/server-config/index.js +6 -11
  357. package/dist/services/onboarding/templates/install-speed-kit-html-template.d.ts +1 -1
  358. package/dist/services/onboarding/templates/install-speed-kit-html-template.js +2 -7
  359. package/dist/services/onboarding/templates/install-speed-kit-js-template.d.ts +1 -1
  360. package/dist/services/onboarding/templates/install-speed-kit-js-template.js +2 -7
  361. package/dist/services/onboarding/todo-collector.d.ts +3 -3
  362. package/dist/services/onboarding/todo-collector.js +3 -7
  363. package/dist/services/onboarding/virtual-orestes-app/crawler.d.ts +2 -2
  364. package/dist/services/onboarding/virtual-orestes-app/crawler.js +12 -16
  365. package/dist/services/onboarding/virtual-orestes-app/index.d.ts +7 -7
  366. package/dist/services/onboarding/virtual-orestes-app/index.js +25 -32
  367. package/dist/services/pop-config/index.d.ts +3 -3
  368. package/dist/services/pop-config/index.js +3 -6
  369. package/dist/services/pop-config/pop-config-factory.d.ts +1 -1
  370. package/dist/services/pop-config/pop-config-factory.js +5 -9
  371. package/dist/services/pop-config/pop-config-model.d.ts +2 -2
  372. package/dist/services/pop-config/pop-config-model.js +1 -2
  373. package/dist/services/pop-config/pop-config-service.d.ts +2 -2
  374. package/dist/services/pop-config/pop-config-service.js +1 -5
  375. package/dist/services/prewarm/assets/asset-api-client.d.ts +2 -2
  376. package/dist/services/prewarm/assets/asset-api-client.js +18 -23
  377. package/dist/services/prewarm/assets/asset-item.d.ts +1 -1
  378. package/dist/services/prewarm/assets/asset-item.js +6 -10
  379. package/dist/services/prewarm/assets/asset-list.d.ts +2 -2
  380. package/dist/services/prewarm/assets/asset-list.js +6 -10
  381. package/dist/services/prewarm/csv-reader.js +6 -11
  382. package/dist/services/prewarm/error/invalid-origin-error.d.ts +1 -1
  383. package/dist/services/prewarm/error/invalid-origin-error.js +2 -7
  384. package/dist/services/prewarm/error/read-csv-error.d.ts +1 -1
  385. package/dist/services/prewarm/error/read-csv-error.js +2 -7
  386. package/dist/services/prewarm/index.d.ts +3 -3
  387. package/dist/services/prewarm/index.js +3 -6
  388. package/dist/services/prewarm/pre-warm-factory.d.ts +1 -1
  389. package/dist/services/prewarm/pre-warm-factory.js +13 -17
  390. package/dist/services/prewarm/pre-warm-model.js +16 -20
  391. package/dist/services/prewarm/pre-warm-service.d.ts +3 -3
  392. package/dist/services/prewarm/pre-warm-service.js +18 -22
  393. package/dist/services/pull/index.d.ts +3 -3
  394. package/dist/services/pull/index.js +3 -6
  395. package/dist/services/pull/pull-service-factory.d.ts +2 -2
  396. package/dist/services/pull/pull-service-factory.js +12 -16
  397. package/dist/services/pull/pull-service-model.js +4 -9
  398. package/dist/services/pull/pull-service.d.ts +3 -3
  399. package/dist/services/pull/pull-service.js +14 -19
  400. package/dist/services/query-builder/error/parse-config-speed-kit-error.d.ts +1 -1
  401. package/dist/services/query-builder/error/parse-config-speed-kit-error.js +2 -6
  402. package/dist/services/query-builder/query/parameter.js +1 -5
  403. package/dist/services/query-builder/query/prewarm.js +1 -5
  404. package/dist/services/query-builder/query-builder-factory.d.ts +3 -3
  405. package/dist/services/query-builder/query-builder-factory.js +16 -20
  406. package/dist/services/query-builder/query-builder-model.d.ts +6 -6
  407. package/dist/services/query-builder/query-builder-model.js +2 -5
  408. package/dist/services/query-builder/query-builder-service.d.ts +2 -2
  409. package/dist/services/query-builder/query-builder-service.js +24 -30
  410. package/oclif.manifest.json +15 -15
  411. package/package.json +63 -54
  412. package/dist/dummy.spec.d.ts +0 -1
  413. package/dist/dummy.spec.js +0 -18
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Crawler = void 0;
4
- const onboarding_model_1 = require("../onboarding-model");
5
- const safe_1 = require("../../../helpers/safe");
6
- const cli_1 = require("../../cli");
7
- class Crawler {
1
+ import { USER_AGENT } from "../onboarding-model.js";
2
+ import { safe } from "../../../helpers/safe.js";
3
+ import { randomUUID } from "node:crypto";
4
+ export class Crawler {
8
5
  cli;
9
6
  agentConfig;
10
7
  speedKitServerConfig;
@@ -24,25 +21,25 @@ class Crawler {
24
21
  }),
25
22
  agent: this.agentConfig,
26
23
  };
27
- this.cli.startAction(`[documentHandler:fetch]: ${originUrl}`);
28
- const fetchResponse = await (0, safe_1.safe)(fetch(originUrl, requestInit));
24
+ const uuid = randomUUID();
25
+ this.cli.startAction(`DOCUMENTHANDLER:FETCH:${uuid}`, `[documentHandler:fetch]: ${originUrl}`);
26
+ const fetchResponse = await safe(fetch(originUrl, requestInit));
29
27
  if (fetchResponse.success === true) {
30
- this.cli.endAction(cli_1.CliActionStatus.COMPLETED);
28
+ this.cli.successAction(`DOCUMENTHANDLER:FETCH:${uuid}`);
31
29
  return fetchResponse.data;
32
30
  }
33
- this.cli.endAction(cli_1.CliActionStatus.FAILED);
34
- this.cli.writeError(`error while fetching Asset: ${originUrl}`);
31
+ this.cli.failAction(`DOCUMENTHANDLER:FETCH:${uuid}`, `error while fetching Asset: ${originUrl}`);
35
32
  this.cli.writeError(fetchResponse.error);
36
33
  this.cli.writeError(JSON.stringify(fetchResponse.errorObj));
37
34
  }
38
35
  setDefaultUserAgent(variation) {
39
36
  if (/^mobile$/is.test(variation)) {
40
- return onboarding_model_1.USER_AGENT.MOBILE;
37
+ return USER_AGENT.MOBILE;
41
38
  }
42
39
  if (/^tablet$/is.test(variation)) {
43
- return onboarding_model_1.USER_AGENT.TABLET;
40
+ return USER_AGENT.TABLET;
44
41
  }
45
- return onboarding_model_1.USER_AGENT.DESKTOP;
42
+ return USER_AGENT.DESKTOP;
46
43
  }
47
44
  prepareOriginRequest(originUrl, variationParameter, init) {
48
45
  if (!this.speedKitServerConfig) {
@@ -85,4 +82,3 @@ class Crawler {
85
82
  return;
86
83
  }
87
84
  }
88
- exports.Crawler = Crawler;
@@ -1,10 +1,10 @@
1
- import Protocol from "devtools-protocol";
2
- import { AbortResponse } from "../browser/abort-response";
3
- import { DocumentHandlerServer } from "../../document-handler-runtime/document-handler-server";
4
- import { Cache } from "../request-cache/cache";
5
- import { CliService } from "../../cli";
6
- import { Crawler } from "./crawler";
7
- import { CustomerConfig } from "../../integration-api";
1
+ import { Protocol } from "devtools-protocol";
2
+ import { AbortResponse } from "../browser/abort-response.js";
3
+ import { DocumentHandlerServer } from "../../document-handler-runtime/document-handler-server.js";
4
+ import { Cache } from "../request-cache/cache.js";
5
+ import { CliService } from "../../cli/index.js";
6
+ import { Crawler } from "./crawler.js";
7
+ import { CustomerConfig } from "../../integration-api/index.js";
8
8
  export declare class VirtualOrestesApp {
9
9
  private customerConfig;
10
10
  private crawler;
@@ -1,17 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VirtualOrestesApp = void 0;
4
- const tslib_1 = require("tslib");
5
- const baqend_response_1 = require("../browser/baqend-response");
6
- const safe_1 = require("../../../helpers/safe");
7
- const onboarding_model_1 = require("../onboarding-model");
8
- const iconv_lite_1 = tslib_1.__importDefault(require("iconv-lite"));
9
- const unsupported_encoding_error_1 = require("../error/unsupported-encoding-error");
1
+ import { BaqendResponse } from "../browser/baqend-response.js";
2
+ import { safe } from "../../../helpers/safe.js";
3
+ import { META_CONTENT_TYPE_REGEX, SpeedKitInstallRegex, } from "../onboarding-model.js";
4
+ import iconv from "iconv-lite";
5
+ import { UnsupportedEncodingError } from "../error/unsupported-encoding-error.js";
10
6
  // for none encodable chars use a space, so the broken char is invisible.
11
7
  // We are using the same trick in our node.js server
12
- iconv_lite_1.default.defaultCharSingleByte = " ";
13
- iconv_lite_1.default.defaultCharUnicode = " ";
14
- class VirtualOrestesApp {
8
+ iconv.defaultCharSingleByte = " ";
9
+ iconv.defaultCharUnicode = " ";
10
+ export class VirtualOrestesApp {
15
11
  customerConfig;
16
12
  crawler;
17
13
  documentHandler;
@@ -31,7 +27,7 @@ class VirtualOrestesApp {
31
27
  ? UrlObject.searchParams.get("bqvariation").trim()
32
28
  : "default";
33
29
  const cachedResponse = this.getCachedResponse(event.request.url);
34
- if (cachedResponse instanceof baqend_response_1.BaqendResponse) {
30
+ if (cachedResponse instanceof BaqendResponse) {
35
31
  return cachedResponse;
36
32
  }
37
33
  const response = await this.crawler.fetchRemote(originUrl, variation);
@@ -54,11 +50,11 @@ class VirtualOrestesApp {
54
50
  const { responseContent, textEncoding } = await this.getResponseText(response);
55
51
  if (!this.isHtmlContentHeader(response?.headers) ||
56
52
  !this.isValidHtmlContent(responseContent)) {
57
- const customResponse = new baqend_response_1.BaqendResponse(responseContent, `text/html; charset=${textEncoding}`, customHeaders);
53
+ const customResponse = new BaqendResponse(responseContent, `text/html; charset=${textEncoding}`, customHeaders);
58
54
  this.cache.addEntry(event.request.url, customResponse);
59
55
  return customResponse;
60
56
  }
61
- const customResponse = await (0, safe_1.safe)(this.documentHandler.transform(`text/html;charset=${textEncoding}`, responseContent, variation, originUrl, this.convertResponseHeadersToOrestesFormat(response)));
57
+ const customResponse = await safe(this.documentHandler.transform(`text/html;charset=${textEncoding}`, responseContent, variation, originUrl, this.convertResponseHeadersToOrestesFormat(response)));
62
58
  if (customResponse.success === false) {
63
59
  return this.returnErrorResponse(customResponse, customHeaders);
64
60
  }
@@ -73,7 +69,6 @@ class VirtualOrestesApp {
73
69
  });
74
70
  }
75
71
  const originHeaders = [];
76
- // eslint-disable-next-line unicorn/no-array-for-each
77
72
  response?.headers.forEach((value, key) => {
78
73
  originHeaders.push({ name: `x-origin-${key}`, value: value });
79
74
  });
@@ -81,9 +76,9 @@ class VirtualOrestesApp {
81
76
  name: "x-sk-detected-encoding",
82
77
  value: textEncoding,
83
78
  });
84
- const baqendResponse = new baqend_response_1.BaqendResponse(Buffer.isBuffer(skResponse.body)
79
+ const baqendResponse = new BaqendResponse(Buffer.isBuffer(skResponse.body)
85
80
  ? skResponse.body
86
- : iconv_lite_1.default.encode(skResponse.body, textEncoding), skResponse.headers["content-type"] ?? `text/html;charset=${textEncoding}`, [...customHeaders, ...originHeaders]);
81
+ : iconv.encode(skResponse.body, textEncoding), skResponse.headers["content-type"] ?? `text/html;charset=${textEncoding}`, [...customHeaders, ...originHeaders]);
87
82
  this.cache.addEntry(event.request.url, baqendResponse);
88
83
  return baqendResponse;
89
84
  }
@@ -94,19 +89,19 @@ class VirtualOrestesApp {
94
89
  const encodingFromHeader = (contentType && charsetRegex.test(contentType)
95
90
  ? charsetRegex.exec(contentType)[1]
96
91
  : null) ?? "utf-8";
97
- if (!iconv_lite_1.default.encodingExists(encodingFromHeader)) {
98
- throw new unsupported_encoding_error_1.UnsupportedEncodingError(`encoding is not supported by cli: "${encodingFromHeader}"`);
92
+ if (!iconv.encodingExists(encodingFromHeader)) {
93
+ throw new UnsupportedEncodingError(`encoding is not supported by cli: "${encodingFromHeader}"`);
99
94
  }
100
- let encodedBody = iconv_lite_1.default.decode(buffer, encodingFromHeader);
101
- const metaSelector = onboarding_model_1.META_CONTENT_TYPE_REGEX;
95
+ let encodedBody = iconv.decode(buffer, encodingFromHeader);
96
+ const metaSelector = META_CONTENT_TYPE_REGEX;
102
97
  const encodingFromBodyMeta = metaSelector.test(encodedBody)
103
98
  ? metaSelector.exec(encodedBody)[1]
104
99
  : null;
105
100
  if (encodingFromBodyMeta && encodingFromBodyMeta !== encodingFromHeader) {
106
- if (!iconv_lite_1.default.encodingExists(encodingFromBodyMeta)) {
107
- throw new unsupported_encoding_error_1.UnsupportedEncodingError(`encoding is not supported by cli: "${encodingFromBodyMeta}"`);
101
+ if (!iconv.encodingExists(encodingFromBodyMeta)) {
102
+ throw new UnsupportedEncodingError(`encoding is not supported by cli: "${encodingFromBodyMeta}"`);
108
103
  }
109
- encodedBody = iconv_lite_1.default.decode(buffer, encodingFromBodyMeta);
104
+ encodedBody = iconv.decode(buffer, encodingFromBodyMeta);
110
105
  }
111
106
  return {
112
107
  responseContent: encodedBody,
@@ -119,11 +114,10 @@ class VirtualOrestesApp {
119
114
  this.cli.comment(customResponse.errorObj.stack);
120
115
  this.cli.writeWarning("Suggestion: check files: config_documentHandler.es6 | custom_documentHandler.js");
121
116
  customHeaders.push({ name: "x-error", value: message });
122
- return new baqend_response_1.BaqendResponse(message, null, customHeaders, 500);
117
+ return new BaqendResponse(message, null, customHeaders, 500);
123
118
  }
124
119
  convertResponseHeadersToOrestesFormat(response) {
125
120
  const convertedResponseHeaders = {};
126
- // eslint-disable-next-line unicorn/no-array-for-each
127
121
  response?.headers?.forEach((value, key) => {
128
122
  convertedResponseHeaders[key] = value;
129
123
  });
@@ -134,7 +128,7 @@ class VirtualOrestesApp {
134
128
  name: "location",
135
129
  value: response?.headers.get("location") || "",
136
130
  });
137
- const redirectResponse = new baqend_response_1.BaqendResponse("", null, customHeaders, response.status);
131
+ const redirectResponse = new BaqendResponse("", null, customHeaders, response.status);
138
132
  this.cache.addEntry(event.request.url, redirectResponse);
139
133
  return redirectResponse;
140
134
  }
@@ -150,7 +144,7 @@ class VirtualOrestesApp {
150
144
  return header.name === "server-timing";
151
145
  });
152
146
  serverTimingHeader.value += ",error;desc=202";
153
- const redirectResponse = new baqend_response_1.BaqendResponse("", null, customHeaders, 400);
147
+ const redirectResponse = new BaqendResponse("", null, customHeaders, 400);
154
148
  this.cache.addEntry(event.request.url, redirectResponse);
155
149
  return redirectResponse;
156
150
  }
@@ -170,7 +164,7 @@ class VirtualOrestesApp {
170
164
  }
171
165
  getCachedResponse(requestUrl) {
172
166
  const response = this.cache.getEntry(requestUrl);
173
- if (!(response instanceof baqend_response_1.BaqendResponse)) {
167
+ if (!(response instanceof BaqendResponse)) {
174
168
  return;
175
169
  }
176
170
  response.setHeader("x-cache", "POP, HIT");
@@ -218,10 +212,9 @@ class VirtualOrestesApp {
218
212
  return text.includes("<html");
219
213
  }
220
214
  rewriteInstallResource(text) {
221
- text = text.replace(onboarding_model_1.SpeedKitInstallRegex, "");
215
+ text = text.replace(SpeedKitInstallRegex, "");
222
216
  return text.replace(/<\s*head\b[^>]*>/, (head) => {
223
217
  return `${head}\n<script src="${this.customerConfig.installPath}" ${this.customerConfig.installParams}></script>`;
224
218
  });
225
219
  }
226
220
  }
227
- exports.VirtualOrestesApp = VirtualOrestesApp;
@@ -1,3 +1,3 @@
1
- export * from "./pop-config-service";
2
- export * from "./pop-config-factory";
3
- export * from "./pop-config-model";
1
+ export * from "./pop-config-service.js";
2
+ export * from "./pop-config-factory.js";
3
+ export * from "./pop-config-model.js";
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./pop-config-service"), exports);
5
- tslib_1.__exportStar(require("./pop-config-factory"), exports);
6
- tslib_1.__exportStar(require("./pop-config-model"), exports);
1
+ export * from "./pop-config-service.js";
2
+ export * from "./pop-config-factory.js";
3
+ export * from "./pop-config-model.js";
@@ -1,4 +1,4 @@
1
- import { PopConfigService } from "./pop-config-service";
1
+ import { PopConfigService } from "./pop-config-service.js";
2
2
  export declare class PopConfigFactory {
3
3
  getService(): Promise<PopConfigService>;
4
4
  }
@@ -1,12 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PopConfigFactory = void 0;
4
- const pop_config_service_1 = require("./pop-config-service");
5
- const athena_1 = require("../athena");
6
- class PopConfigFactory {
1
+ import { PopConfigService } from "./pop-config-service.js";
2
+ import { AthenaServiceFactory } from "../athena/index.js";
3
+ export class PopConfigFactory {
7
4
  async getService() {
8
- const athenaService = await new athena_1.AthenaServiceFactory().getService();
9
- return new pop_config_service_1.PopConfigService(athenaService);
5
+ const athenaService = await new AthenaServiceFactory().getService();
6
+ return new PopConfigService(athenaService);
10
7
  }
11
8
  }
12
- exports.PopConfigFactory = PopConfigFactory;
@@ -1,6 +1,6 @@
1
- export type UsedPopsPerOrigin = {
1
+ export interface UsedPopsPerOrigin {
2
2
  hits: number;
3
3
  origin: string;
4
4
  pop: string;
5
5
  region: string;
6
- };
6
+ }
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,5 +1,5 @@
1
- import { UsedPopsPerOrigin } from "./";
2
- import { AthenaService } from "../athena";
1
+ import { UsedPopsPerOrigin } from "./index.js";
2
+ import { AthenaService } from "../athena/index.js";
3
3
  export declare class PopConfigService {
4
4
  private athenaService;
5
5
  constructor(athenaService: AthenaService);
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PopConfigService = void 0;
4
- class PopConfigService {
1
+ export class PopConfigService {
5
2
  athenaService;
6
3
  constructor(athenaService) {
7
4
  this.athenaService = athenaService;
@@ -36,4 +33,3 @@ class PopConfigService {
36
33
  return await this.athenaService.getResult(query, [start, end, app], 12 * 60);
37
34
  }
38
35
  }
39
- exports.PopConfigService = PopConfigService;
@@ -1,8 +1,8 @@
1
- export type SimpleResponse = {
1
+ export interface SimpleResponse {
2
2
  headers: Headers;
3
3
  status: number;
4
4
  ok: boolean;
5
- };
5
+ }
6
6
  export declare class AssetApiClient {
7
7
  private authenticationToken;
8
8
  private app;
@@ -1,19 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AssetApiClient = void 0;
4
- const tslib_1 = require("tslib");
5
- const node_url_1 = require("node:url");
6
- const node_http2_1 = tslib_1.__importDefault(require("node:http2"));
7
- const __1 = require("../");
8
- const normalize_1 = require("../../../helpers/normalize");
9
- const invalid_origin_error_1 = require("../error/invalid-origin-error");
10
- class AssetApiClient {
1
+ import { URL } from "node:url";
2
+ import http2 from "node:http2";
3
+ import { MAX_REQUESTS_PER_SECOND, DEFAULT_REQUESTS_PER_SECOND, RATE_LIMIT_MULTIPLICATOR, DEFAULT_VARIATIONS, TIMING_HEADER_KEY, } from "../index.js";
4
+ import { normalize } from "../../../helpers/normalize.js";
5
+ import { InvalidOriginError } from "../error/invalid-origin-error.js";
6
+ export class AssetApiClient {
11
7
  authenticationToken;
12
8
  app;
13
9
  sortParameters;
14
10
  sessions = new Map();
15
- rateLimit = __1.DEFAULT_REQUESTS_PER_SECOND;
16
- lowestRateLimit = __1.DEFAULT_REQUESTS_PER_SECOND;
11
+ rateLimit = DEFAULT_REQUESTS_PER_SECOND;
12
+ lowestRateLimit = DEFAULT_REQUESTS_PER_SECOND;
17
13
  isRetry = false;
18
14
  lastRequestTime = Date.now();
19
15
  constructor(authenticationToken, app, sortParameters) {
@@ -24,14 +20,14 @@ class AssetApiClient {
24
20
  async fetchURL(url, variation, verbose) {
25
21
  await this.sleepByRate();
26
22
  this.isValidUrl(url);
27
- const assetUrl = new node_url_1.URL((0, normalize_1.normalize)(url, this.sortParameters));
23
+ const assetUrl = new URL(normalize(url, this.sortParameters));
28
24
  this.setVariationParameter(variation, assetUrl);
29
25
  assetUrl.searchParams.set("bqpass", "1");
30
26
  const origin = `https://${this.app}.app.baqend.com`;
31
27
  const start = Date.now();
32
28
  const result = await this.makeHttp2Request(origin, `/v1/asset/${assetUrl.toString()}`, assetUrl.origin);
33
29
  if (verbose) {
34
- console.log(`fetch ${url} - ${variation} took ${Date.now() - start}ms, cdnTime: ${result.headers.get("x-timer") || "-"}, status: ${result.status}, cache: ${result.headers.get("x-cache")}, timings: ${result.headers.get(__1.TIMING_HEADER_KEY)}`);
30
+ console.log(`fetch ${url} - ${variation} took ${Date.now() - start}ms, cdnTime: ${result.headers.get("x-timer") || "-"}, status: ${result.status}, cache: ${result.headers.get("x-cache")}, timings: ${result.headers.get(TIMING_HEADER_KEY)}`);
35
31
  }
36
32
  return result;
37
33
  }
@@ -47,7 +43,7 @@ class AssetApiClient {
47
43
  }
48
44
  let session = sessions?.shift();
49
45
  if (!session || session.destroyed || session.closed) {
50
- session = node_http2_1.default.connect(origin, {
46
+ session = http2.connect(origin, {
51
47
  rejectUnauthorized: false,
52
48
  });
53
49
  session.on("error", (error) => {
@@ -55,8 +51,8 @@ class AssetApiClient {
55
51
  });
56
52
  }
57
53
  const request = session.request({
58
- [node_http2_1.default.constants.HTTP2_HEADER_METHOD]: "HEAD",
59
- [node_http2_1.default.constants.HTTP2_HEADER_PATH]: path,
54
+ [http2.constants.HTTP2_HEADER_METHOD]: "HEAD",
55
+ [http2.constants.HTTP2_HEADER_PATH]: path,
60
56
  authorization: `BAT ${this.authenticationToken}`,
61
57
  origin: assetOrigin,
62
58
  "accept-encoding": "gzip, deflate, br, dcb",
@@ -96,19 +92,19 @@ class AssetApiClient {
96
92
  return this.rateLimit;
97
93
  }
98
94
  reduceMaxRequestsPerSecond() {
99
- this.setRateLimit(this.rateLimit * __1.RATE_LIMIT_MULTIPLICATOR);
95
+ this.setRateLimit(this.rateLimit * RATE_LIMIT_MULTIPLICATOR);
100
96
  if (this.rateLimit < this.lowestRateLimit) {
101
97
  this.lowestRateLimit = this.rateLimit;
102
98
  }
103
99
  }
104
100
  increaseMaxRequestsPerSecond() {
105
- if (this.rateLimit + 1 <= __1.MAX_REQUESTS_PER_SECOND && !this.isRetry) {
101
+ if (this.rateLimit + 1 <= MAX_REQUESTS_PER_SECOND && !this.isRetry) {
106
102
  this.setRateLimit(this.rateLimit + 1);
107
103
  }
108
104
  }
109
105
  isValidUrl(url) {
110
- if (!node_url_1.URL.canParse(url)) {
111
- throw new invalid_origin_error_1.InvalidOriginError(`Invalid url`);
106
+ if (!URL.canParse(url)) {
107
+ throw new InvalidOriginError(`Invalid url`);
112
108
  }
113
109
  }
114
110
  setRateLimit(limit) {
@@ -135,7 +131,7 @@ class AssetApiClient {
135
131
  return;
136
132
  }
137
133
  // on tv|tablet|mobile set variation as lowerCase
138
- if (__1.DEFAULT_VARIATIONS.includes(variation.toLowerCase())) {
134
+ if (DEFAULT_VARIATIONS.includes(variation.toLowerCase())) {
139
135
  assetUrl.searchParams.set("bqvariation", variation.toLowerCase());
140
136
  return;
141
137
  }
@@ -151,4 +147,3 @@ class AssetApiClient {
151
147
  await new Promise((resolve) => setTimeout(resolve, sleepTime));
152
148
  }
153
149
  }
154
- exports.AssetApiClient = AssetApiClient;
@@ -1,4 +1,4 @@
1
- import { AssetItemInterface, ItemStatus } from "../";
1
+ import { AssetItemInterface, ItemStatus } from "../index.js";
2
2
  export declare class AssetItem implements AssetItemInterface {
3
3
  readonly url: string;
4
4
  readonly variation: string;
@@ -1,24 +1,21 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AssetItem = void 0;
4
- const __1 = require("../");
5
- class AssetItem {
1
+ import { ItemStatus } from "../index.js";
2
+ export class AssetItem {
6
3
  url;
7
4
  variation;
8
5
  error = null;
9
- status = __1.ItemStatus.NEW;
6
+ status = ItemStatus.NEW;
10
7
  constructor(url, variation) {
11
8
  this.url = url;
12
9
  this.variation = variation;
13
10
  }
14
11
  done() {
15
- this.status = __1.ItemStatus.DONE;
12
+ this.status = ItemStatus.DONE;
16
13
  }
17
14
  failed() {
18
- this.status = __1.ItemStatus.ERROR;
15
+ this.status = ItemStatus.ERROR;
19
16
  }
20
17
  retry() {
21
- this.status = __1.ItemStatus.RETRY;
18
+ this.status = ItemStatus.RETRY;
22
19
  }
23
20
  setError(error) {
24
21
  this.error = error;
@@ -27,4 +24,3 @@ class AssetItem {
27
24
  return `${this.url} - ${this.variation} -> ${this.status}: ${this.error?.message ?? ""}`;
28
25
  }
29
26
  }
30
- exports.AssetItem = AssetItem;
@@ -1,5 +1,5 @@
1
- import { AssetItemInterface, ItemStatus } from "../";
2
- import { AssetItem } from "./asset-item";
1
+ import { AssetItemInterface, ItemStatus } from "../index.js";
2
+ import { AssetItem } from "./asset-item.js";
3
3
  export declare class AssetList implements Iterable<AssetItem> {
4
4
  private elements;
5
5
  [Symbol.iterator](): Iterator<AssetItem>;
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AssetList = void 0;
4
- const __1 = require("../");
5
- class AssetList {
1
+ import { ItemStatus } from "../index.js";
2
+ export class AssetList {
6
3
  elements = [];
7
4
  [Symbol.iterator]() {
8
5
  return this.elements[Symbol.iterator]();
@@ -14,19 +11,18 @@ class AssetList {
14
11
  return this.elements.filter((element) => element.status === status);
15
12
  }
16
13
  getErrorCount() {
17
- return this.getByStatus(__1.ItemStatus.ERROR).length;
14
+ return this.getByStatus(ItemStatus.ERROR).length;
18
15
  }
19
16
  getErrors() {
20
- return this.getByStatus(__1.ItemStatus.ERROR).map((element) => element.error);
17
+ return this.getByStatus(ItemStatus.ERROR).map((element) => element.error);
21
18
  }
22
19
  getLength() {
23
20
  return this.elements.length;
24
21
  }
25
22
  getRetryCount() {
26
- return this.getByStatus(__1.ItemStatus.RETRY).length;
23
+ return this.getByStatus(ItemStatus.RETRY).length;
27
24
  }
28
25
  getSuccessCount() {
29
- return this.getByStatus(__1.ItemStatus.DONE).length;
26
+ return this.getByStatus(ItemStatus.DONE).length;
30
27
  }
31
28
  }
32
- exports.AssetList = AssetList;
@@ -1,20 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CsvReader = void 0;
4
- const tslib_1 = require("tslib");
5
- const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
6
- const node_path_1 = tslib_1.__importDefault(require("node:path"));
7
- const read_csv_error_1 = require("./error/read-csv-error");
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { ReadCsvError } from "./error/read-csv-error.js";
8
4
  const ENCODING = "utf8";
9
5
  const LINE_BREAK = /\r?\n/;
10
- class CsvReader {
6
+ export class CsvReader {
11
7
  readPath(filePath) {
12
8
  try {
13
9
  const entries = this.getEntries(filePath);
14
10
  return this.cleanUpEntries(entries);
15
11
  }
16
12
  catch (error) {
17
- throw new read_csv_error_1.ReadCsvError(error.message);
13
+ throw new ReadCsvError(error.message);
18
14
  }
19
15
  }
20
16
  cleanUpEntries(entries) {
@@ -25,8 +21,7 @@ class CsvReader {
25
21
  .filter(Boolean);
26
22
  }
27
23
  getEntries(filePath) {
28
- const fileContent = node_fs_1.default.readFileSync(node_path_1.default.resolve(filePath), ENCODING);
24
+ const fileContent = fs.readFileSync(path.resolve(filePath), ENCODING);
29
25
  return fileContent.split(LINE_BREAK);
30
26
  }
31
27
  }
32
- exports.CsvReader = CsvReader;
@@ -1,3 +1,3 @@
1
- import CustomerConfigError from "../../integration-api/error/customer-config-error";
1
+ import CustomerConfigError from "../../integration-api/error/customer-config-error.js";
2
2
  export declare class InvalidOriginError extends CustomerConfigError {
3
3
  }
@@ -1,8 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InvalidOriginError = void 0;
4
- const tslib_1 = require("tslib");
5
- const customer_config_error_1 = tslib_1.__importDefault(require("../../integration-api/error/customer-config-error"));
6
- class InvalidOriginError extends customer_config_error_1.default {
1
+ import CustomerConfigError from "../../integration-api/error/customer-config-error.js";
2
+ export class InvalidOriginError extends CustomerConfigError {
7
3
  }
8
- exports.InvalidOriginError = InvalidOriginError;
@@ -1,4 +1,4 @@
1
- import ApplicationError from "../../error-handling/error/application-error";
1
+ import ApplicationError from "../../error-handling/error/application-error.js";
2
2
  export declare class ReadCsvError extends ApplicationError {
3
3
  readonly message: string;
4
4
  readonly code = "SK_CLI_CSV_READ";
@@ -1,9 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ReadCsvError = void 0;
4
- const tslib_1 = require("tslib");
5
- const application_error_1 = tslib_1.__importDefault(require("../../error-handling/error/application-error"));
6
- class ReadCsvError extends application_error_1.default {
1
+ import ApplicationError from "../../error-handling/error/application-error.js";
2
+ export class ReadCsvError extends ApplicationError {
7
3
  message;
8
4
  code = "SK_CLI_CSV_READ";
9
5
  suggestions = ["check arguments for correct filePath"];
@@ -12,4 +8,3 @@ class ReadCsvError extends application_error_1.default {
12
8
  this.message = message;
13
9
  }
14
10
  }
15
- exports.ReadCsvError = ReadCsvError;
@@ -1,3 +1,3 @@
1
- export * from "./pre-warm-service";
2
- export * from "./pre-warm-factory";
3
- export * from "./pre-warm-model";
1
+ export * from "./pre-warm-service.js";
2
+ export * from "./pre-warm-factory.js";
3
+ export * from "./pre-warm-model.js";
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./pre-warm-service"), exports);
5
- tslib_1.__exportStar(require("./pre-warm-factory"), exports);
6
- tslib_1.__exportStar(require("./pre-warm-model"), exports);
1
+ export * from "./pre-warm-service.js";
2
+ export * from "./pre-warm-factory.js";
3
+ export * from "./pre-warm-model.js";
@@ -1,4 +1,4 @@
1
- import { PreWarmContext, PreWarmService } from "./";
1
+ import { PreWarmContext, PreWarmService } from "./index.js";
2
2
  export declare class PreWarmFactory {
3
3
  private context;
4
4
  constructor(context: PreWarmContext);