@speedkit/cli 4.51.0-run-control.5 → 4.51.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 (486) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +14 -1426
  3. package/dist/commands/diff.d.ts +1 -7
  4. package/dist/commands/diff.js +3 -9
  5. package/dist/commands/login.d.ts +0 -3
  6. package/dist/commands/login.js +3 -14
  7. package/dist/commands/onboarding.d.ts +0 -26
  8. package/dist/commands/onboarding.js +4 -221
  9. package/dist/commands/origin-request.d.ts +0 -4
  10. package/dist/commands/origin-request.js +0 -4
  11. package/dist/services/browser-fetch/device-emulation.d.ts +0 -11
  12. package/dist/services/browser-fetch/device-emulation.js +0 -14
  13. package/dist/services/bundler/bundle-service-factory.d.ts +3 -0
  14. package/dist/services/bundler/bundle-service-factory.js +5 -1
  15. package/dist/services/bundler/bundle-service.d.ts +10 -1
  16. package/dist/services/bundler/bundle-service.js +16 -1
  17. package/dist/services/bundler/error/packjockel-error.d.ts +3 -0
  18. package/dist/services/bundler/error/packjockel-error.js +3 -0
  19. package/dist/services/bundler/index.d.ts +1 -0
  20. package/dist/services/bundler/index.js +1 -0
  21. package/dist/services/bundler/packjockel-service.d.ts +112 -0
  22. package/dist/services/bundler/packjockel-service.js +202 -0
  23. package/dist/services/bundler/spec/packjockel-service.spec.js +186 -0
  24. package/dist/services/cli/cli-environment-factory.d.ts +0 -3
  25. package/dist/services/cli/cli-environment-factory.js +0 -1
  26. package/dist/services/cli/cli-service-build-context.d.ts +0 -3
  27. package/dist/services/cli/cli-service-factory.js +1 -1
  28. package/dist/services/cli/cli-service-model.d.ts +10 -29
  29. package/dist/services/cli/cli-service.d.ts +11 -60
  30. package/dist/services/cli/cli-service.js +32 -196
  31. package/dist/services/cli/index.d.ts +0 -2
  32. package/dist/services/cli/index.js +0 -2
  33. package/dist/services/cli/spec/cli-service.spec.js +50 -113
  34. package/dist/services/deploy/checks/activation/customer-approval-check.js +1 -1
  35. package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.js +2 -3
  36. package/dist/services/deploy/checks/pre-deploy/split-change-check.js +2 -3
  37. package/dist/services/deploy/handler/customer-config-handler.d.ts +9 -0
  38. package/dist/services/deploy/handler/customer-config-handler.js +41 -6
  39. package/dist/services/deploy/interface/install.d.ts +7 -1
  40. package/dist/services/deploy/mr/live-state-check.js +21 -2
  41. package/dist/services/deploy/policy/auto-deploy-policy.js +2 -0
  42. package/dist/services/deploy/policy/deploy-policy-model.d.ts +4 -0
  43. package/dist/services/deploy/policy/deploy-policy-model.js +4 -0
  44. package/dist/services/deploy/policy/testing-deploy-policy.js +2 -0
  45. package/dist/services/deploy/spec/handler/customer-config-handler.spec.js +98 -0
  46. package/dist/services/deploy/spec/mr/live-state-check.spec.js +45 -4
  47. package/dist/services/deploy/spec/policy/auto-deploy-policy.spec.js +2 -0
  48. package/dist/services/deploy/spec/policy/testing-deploy-policy.spec.js +3 -1
  49. package/dist/services/diff/diff-service-build-context.d.ts +0 -12
  50. package/dist/services/diff/diff-service-build-context.js +1 -45
  51. package/dist/services/diff/diff-service-factory.d.ts +0 -2
  52. package/dist/services/diff/diff-service-factory.js +25 -65
  53. package/dist/services/diff/diff-service.d.ts +0 -11
  54. package/dist/services/diff/diff-service.js +11 -37
  55. package/dist/services/diff/page-source.d.ts +0 -12
  56. package/dist/services/diff/page-source.js +11 -16
  57. package/dist/services/diff/sinks/tool-diff-sink.d.ts +2 -3
  58. package/dist/services/diff/sinks/tool-diff-sink.js +2 -3
  59. package/dist/services/diff/spec/diff-service-build-context.spec.js +0 -19
  60. package/dist/services/diff/spec/diff-service.spec.js +0 -95
  61. package/dist/services/document-handler-runtime/document-handler-browser-mock.d.ts +13 -0
  62. package/dist/services/document-handler-runtime/document-handler-browser-mock.js +69 -0
  63. package/dist/services/document-handler-runtime/document-handler-server.d.ts +27 -0
  64. package/dist/services/document-handler-runtime/document-handler-server.js +112 -19
  65. package/dist/services/document-handler-runtime/spec/document-handler-browser-mock.spec.js +34 -0
  66. package/dist/services/git/git-repository.d.ts +0 -2
  67. package/dist/services/git/git-repository.js +0 -6
  68. package/dist/services/integration-api/customer-config-flags.js +0 -1
  69. package/dist/services/integration-api/integration-api-model.d.ts +4 -1
  70. package/dist/services/integration-api/spec/customer-config-file.spec.js +56 -0
  71. package/dist/services/integration-api/spec/speed-kit-config-file.spec.js +68 -8
  72. package/dist/services/integration-api/struct/customer-config-file.d.ts +15 -0
  73. package/dist/services/integration-api/struct/customer-config-file.js +42 -0
  74. package/dist/services/integration-api/struct/customer-config.d.ts +55 -1
  75. package/dist/services/integration-api/struct/customer-config.js +70 -3
  76. package/dist/services/integration-api/struct/speed-kit-config-file.d.ts +11 -4
  77. package/dist/services/integration-api/struct/speed-kit-config-file.js +31 -10
  78. package/dist/services/onboarding/browse/browse-service.d.ts +1 -13
  79. package/dist/services/onboarding/browse/browse-service.js +7 -43
  80. package/dist/services/onboarding/browser/baqend-response.d.ts +1 -17
  81. package/dist/services/onboarding/browser/baqend-response.js +0 -23
  82. package/dist/services/onboarding/browser/emulate-device.d.ts +1 -12
  83. package/dist/services/onboarding/browser/emulate-device.js +13 -68
  84. package/dist/services/onboarding/browser/executable/executable-validator.js +2 -4
  85. package/dist/services/onboarding/browser/extension/extension-bridge.js +3 -5
  86. package/dist/services/onboarding/browser/extension/extension-downloader.js +8 -17
  87. package/dist/services/onboarding/browser/extension/extension-validator.js +4 -9
  88. package/dist/services/onboarding/browser/launch-browser.d.ts +1 -2
  89. package/dist/services/onboarding/browser/launch-browser.js +1 -6
  90. package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +2 -0
  91. package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +29 -8
  92. package/dist/services/onboarding/dashboard/diff-against-current-page.js +1 -3
  93. package/dist/services/onboarding/dashboard/index.js +2 -7
  94. package/dist/services/onboarding/fetch-event-handler.d.ts +5 -24
  95. package/dist/services/onboarding/fetch-event-handler.js +32 -103
  96. package/dist/services/onboarding/fetch-events/spec/speed-kit-install-js.spec.js +59 -0
  97. package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +7 -14
  98. package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +0 -14
  99. package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +0 -30
  100. package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +3 -14
  101. package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +10 -29
  102. package/dist/services/onboarding/file-events/file-watcher.d.ts +4 -43
  103. package/dist/services/onboarding/file-events/file-watcher.js +21 -119
  104. package/dist/services/onboarding/inject/inject-service.js +1 -1
  105. package/dist/services/onboarding/onboarding-model.d.ts +7 -40
  106. package/dist/services/onboarding/onboarding-model.js +9 -20
  107. package/dist/services/onboarding/onboarding-service-build-context.d.ts +0 -4
  108. package/dist/services/onboarding/onboarding-service-build-context.js +1 -7
  109. package/dist/services/onboarding/onboarding-service-factory.d.ts +1 -17
  110. package/dist/services/onboarding/onboarding-service-factory.js +35 -152
  111. package/dist/services/onboarding/onboarding-service.d.ts +1 -40
  112. package/dist/services/onboarding/onboarding-service.js +23 -139
  113. package/dist/services/onboarding/request-cache/cache.d.ts +5 -62
  114. package/dist/services/onboarding/request-cache/cache.js +17 -128
  115. package/dist/services/onboarding/spec/file-events/file-watcher.spec.js +67 -0
  116. package/dist/services/onboarding/spec/onboarding-model.spec.js +3 -39
  117. package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +1 -25
  118. package/dist/services/onboarding/templates/install-speed-kit-js-template.js +5 -0
  119. package/dist/services/onboarding/todo-collector.d.ts +2 -7
  120. package/dist/services/onboarding/todo-collector.js +12 -49
  121. package/dist/services/onboarding/virtual-orestes-app/index.d.ts +0 -38
  122. package/dist/services/onboarding/virtual-orestes-app/index.js +27 -113
  123. package/dist/services/origin-request/asset-variations.d.ts +0 -14
  124. package/dist/services/origin-request/asset-variations.js +4 -11
  125. package/dist/services/origin-request/origin-fetcher.d.ts +0 -7
  126. package/dist/services/origin-request/origin-fetcher.js +5 -43
  127. package/dist/services/origin-request/origin-request-service-build-context.d.ts +0 -17
  128. package/dist/services/origin-request/origin-request-service-build-context.js +0 -8
  129. package/dist/services/origin-request/origin-request-service-factory.d.ts +5 -0
  130. package/dist/services/origin-request/origin-request-service-factory.js +30 -2
  131. package/dist/services/origin-request/origin-request-service.d.ts +6 -121
  132. package/dist/services/origin-request/origin-request-service.js +49 -273
  133. package/dist/services/origin-request/runtime-config-source.d.ts +0 -6
  134. package/dist/services/origin-request/runtime-config-source.js +4 -15
  135. package/dist/services/origin-request/spec/asset-variations.spec.js +0 -20
  136. package/dist/services/origin-request/spec/origin-request-service.spec.js +6 -329
  137. package/dist/services/pull/pull-service.js +23 -5
  138. package/dist/services/query-builder/query-builder-factory.js +3 -3
  139. package/dist/services/setup/os/tool-registry.js +2 -2
  140. package/oclif.manifest.json +269 -3390
  141. package/package.json +3 -20
  142. package/dist/base/run-control-command.d.ts +0 -15
  143. package/dist/base/run-control-command.js +0 -20
  144. package/dist/build-info.json +0 -6
  145. package/dist/commands/onboarding/browser/click.d.ts +0 -75
  146. package/dist/commands/onboarding/browser/click.js +0 -19
  147. package/dist/commands/onboarding/browser/emulate.d.ts +0 -105
  148. package/dist/commands/onboarding/browser/emulate.js +0 -26
  149. package/dist/commands/onboarding/browser/navigate.d.ts +0 -75
  150. package/dist/commands/onboarding/browser/navigate.js +0 -19
  151. package/dist/commands/onboarding/browser/panel.d.ts +0 -63
  152. package/dist/commands/onboarding/browser/panel.js +0 -12
  153. package/dist/commands/onboarding/browser/reinstall-sw.d.ts +0 -63
  154. package/dist/commands/onboarding/browser/reinstall-sw.js +0 -14
  155. package/dist/commands/onboarding/browser/reset.d.ts +0 -71
  156. package/dist/commands/onboarding/browser/reset.js +0 -18
  157. package/dist/commands/onboarding/browser/screenshot.d.ts +0 -77
  158. package/dist/commands/onboarding/browser/screenshot.js +0 -19
  159. package/dist/commands/onboarding/browser/state.d.ts +0 -63
  160. package/dist/commands/onboarding/browser/state.js +0 -12
  161. package/dist/commands/onboarding/browser/tabs.d.ts +0 -58
  162. package/dist/commands/onboarding/browser/tabs.js +0 -16
  163. package/dist/commands/onboarding/cache/clear.d.ts +0 -58
  164. package/dist/commands/onboarding/cache/clear.js +0 -12
  165. package/dist/commands/onboarding/cache/errors.d.ts +0 -58
  166. package/dist/commands/onboarding/cache/errors.js +0 -12
  167. package/dist/commands/onboarding/cache/evict.d.ts +0 -62
  168. package/dist/commands/onboarding/cache/evict.js +0 -15
  169. package/dist/commands/onboarding/cache/get.d.ts +0 -85
  170. package/dist/commands/onboarding/cache/get.js +0 -17
  171. package/dist/commands/onboarding/cache/list.d.ts +0 -58
  172. package/dist/commands/onboarding/cache/list.js +0 -15
  173. package/dist/commands/onboarding/cache/prewarm.d.ts +0 -73
  174. package/dist/commands/onboarding/cache/prewarm.js +0 -20
  175. package/dist/commands/onboarding/cache/refresh.d.ts +0 -62
  176. package/dist/commands/onboarding/cache/refresh.js +0 -18
  177. package/dist/commands/onboarding/cdp.d.ts +0 -81
  178. package/dist/commands/onboarding/cdp.js +0 -18
  179. package/dist/commands/onboarding/debug/arm.d.ts +0 -83
  180. package/dist/commands/onboarding/debug/arm.js +0 -19
  181. package/dist/commands/onboarding/debug/await.d.ts +0 -71
  182. package/dist/commands/onboarding/debug/await.js +0 -18
  183. package/dist/commands/onboarding/debug/disarm.d.ts +0 -63
  184. package/dist/commands/onboarding/debug/disarm.js +0 -12
  185. package/dist/commands/onboarding/debug/eval.d.ts +0 -75
  186. package/dist/commands/onboarding/debug/eval.js +0 -16
  187. package/dist/commands/onboarding/debug/release.d.ts +0 -63
  188. package/dist/commands/onboarding/debug/release.js +0 -12
  189. package/dist/commands/onboarding/debug/resume.d.ts +0 -63
  190. package/dist/commands/onboarding/debug/resume.js +0 -12
  191. package/dist/commands/onboarding/debug/status.d.ts +0 -63
  192. package/dist/commands/onboarding/debug/status.js +0 -12
  193. package/dist/commands/onboarding/debug/step.d.ts +0 -67
  194. package/dist/commands/onboarding/debug/step.js +0 -15
  195. package/dist/commands/onboarding/files/list.d.ts +0 -58
  196. package/dist/commands/onboarding/files/list.js +0 -12
  197. package/dist/commands/onboarding/files/read.d.ts +0 -73
  198. package/dist/commands/onboarding/files/read.js +0 -16
  199. package/dist/commands/onboarding/files/rebuild.d.ts +0 -63
  200. package/dist/commands/onboarding/files/rebuild.js +0 -18
  201. package/dist/commands/onboarding/files/validate.d.ts +0 -58
  202. package/dist/commands/onboarding/files/validate.js +0 -12
  203. package/dist/commands/onboarding/fouc.d.ts +0 -77
  204. package/dist/commands/onboarding/fouc.js +0 -16
  205. package/dist/commands/onboarding/inject/add.d.ts +0 -89
  206. package/dist/commands/onboarding/inject/add.js +0 -17
  207. package/dist/commands/onboarding/inject/clear.d.ts +0 -63
  208. package/dist/commands/onboarding/inject/clear.js +0 -12
  209. package/dist/commands/onboarding/inject/list.d.ts +0 -63
  210. package/dist/commands/onboarding/inject/list.js +0 -12
  211. package/dist/commands/onboarding/inject/read.d.ts +0 -75
  212. package/dist/commands/onboarding/inject/read.js +0 -18
  213. package/dist/commands/onboarding/inject/recipes.d.ts +0 -63
  214. package/dist/commands/onboarding/inject/recipes.js +0 -12
  215. package/dist/commands/onboarding/inject/remove.d.ts +0 -67
  216. package/dist/commands/onboarding/inject/remove.js +0 -15
  217. package/dist/commands/onboarding/list.d.ts +0 -13
  218. package/dist/commands/onboarding/list.js +0 -12
  219. package/dist/commands/onboarding/logs.d.ts +0 -41
  220. package/dist/commands/onboarding/logs.js +0 -257
  221. package/dist/commands/onboarding/navwalk.d.ts +0 -95
  222. package/dist/commands/onboarding/navwalk.js +0 -19
  223. package/dist/commands/onboarding/response.d.ts +0 -67
  224. package/dist/commands/onboarding/response.js +0 -18
  225. package/dist/commands/onboarding/rum/beacons.d.ts +0 -75
  226. package/dist/commands/onboarding/rum/beacons.js +0 -16
  227. package/dist/commands/onboarding/rum/get.d.ts +0 -77
  228. package/dist/commands/onboarding/rum/get.js +0 -18
  229. package/dist/commands/onboarding/rum/key.d.ts +0 -67
  230. package/dist/commands/onboarding/rum/key.js +0 -13
  231. package/dist/commands/onboarding/rum/previous.d.ts +0 -63
  232. package/dist/commands/onboarding/rum/previous.js +0 -12
  233. package/dist/commands/onboarding/status.d.ts +0 -13
  234. package/dist/commands/onboarding/status.js +0 -17
  235. package/dist/commands/onboarding/stop.d.ts +0 -13
  236. package/dist/commands/onboarding/stop.js +0 -17
  237. package/dist/commands/onboarding/todo.d.ts +0 -58
  238. package/dist/commands/onboarding/todo.js +0 -12
  239. package/dist/commands/onboarding/viewport.d.ts +0 -101
  240. package/dist/commands/onboarding/viewport.js +0 -18
  241. package/dist/commands/onboarding/watch.d.ts +0 -93
  242. package/dist/commands/onboarding/watch.js +0 -16
  243. package/dist/commands/spec/onboarding.spec.js +0 -127
  244. package/dist/services/cli/build-info.d.ts +0 -33
  245. package/dist/services/cli/build-info.js +0 -63
  246. package/dist/services/cli/sink.d.ts +0 -47
  247. package/dist/services/cli/sink.js +0 -31
  248. package/dist/services/cli/spec/build-identity.spec.js +0 -85
  249. package/dist/services/cli/spec/build-info.spec.js +0 -10
  250. package/dist/services/cli/spec/cli-service-log.spec.js +0 -133
  251. package/dist/services/cli/spec/memory-cli.d.ts +0 -9
  252. package/dist/services/cli/spec/memory-cli.js +0 -9
  253. package/dist/services/diff/config-at-ref.d.ts +0 -20
  254. package/dist/services/diff/config-at-ref.js +0 -33
  255. package/dist/services/diff/run-runtime-config.d.ts +0 -33
  256. package/dist/services/diff/run-runtime-config.js +0 -74
  257. package/dist/services/diff/spec/config-at-ref.spec.js +0 -46
  258. package/dist/services/diff/spec/run-runtime-config.spec.js +0 -87
  259. package/dist/services/onboarding/browser/answer-dialogs.d.ts +0 -12
  260. package/dist/services/onboarding/browser/answer-dialogs.js +0 -25
  261. package/dist/services/onboarding/browser/console-log.d.ts +0 -9
  262. package/dist/services/onboarding/browser/console-log.js +0 -27
  263. package/dist/services/onboarding/browser/resume-restarted-workers.d.ts +0 -14
  264. package/dist/services/onboarding/browser/resume-restarted-workers.js +0 -26
  265. package/dist/services/onboarding/control/body-inspect.d.ts +0 -24
  266. package/dist/services/onboarding/control/body-inspect.js +0 -106
  267. package/dist/services/onboarding/control/browser-session.d.ts +0 -547
  268. package/dist/services/onboarding/control/browser-session.js +0 -1337
  269. package/dist/services/onboarding/control/config-validation.d.ts +0 -17
  270. package/dist/services/onboarding/control/config-validation.js +0 -46
  271. package/dist/services/onboarding/control/control-protocol.d.ts +0 -1430
  272. package/dist/services/onboarding/control/control-protocol.js +0 -58
  273. package/dist/services/onboarding/control/control-server.d.ts +0 -292
  274. package/dist/services/onboarding/control/control-server.js +0 -1629
  275. package/dist/services/onboarding/control/debug-session.d.ts +0 -219
  276. package/dist/services/onboarding/control/debug-session.js +0 -897
  277. package/dist/services/onboarding/control/fouc.d.ts +0 -23
  278. package/dist/services/onboarding/control/fouc.js +0 -151
  279. package/dist/services/onboarding/control/index.d.ts +0 -4
  280. package/dist/services/onboarding/control/index.js +0 -4
  281. package/dist/services/onboarding/control/navigate-wait.d.ts +0 -33
  282. package/dist/services/onboarding/control/navigate-wait.js +0 -56
  283. package/dist/services/onboarding/control/navwalk.d.ts +0 -65
  284. package/dist/services/onboarding/control/navwalk.js +0 -248
  285. package/dist/services/onboarding/control/preload-registry.d.ts +0 -150
  286. package/dist/services/onboarding/control/preload-registry.js +0 -829
  287. package/dist/services/onboarding/control/response-explainer.d.ts +0 -24
  288. package/dist/services/onboarding/control/response-explainer.js +0 -257
  289. package/dist/services/onboarding/control/rum.d.ts +0 -8
  290. package/dist/services/onboarding/control/rum.js +0 -220
  291. package/dist/services/onboarding/control/service-worker-tracker.d.ts +0 -68
  292. package/dist/services/onboarding/control/service-worker-tracker.js +0 -120
  293. package/dist/services/onboarding/control/viewport.d.ts +0 -45
  294. package/dist/services/onboarding/control/viewport.js +0 -344
  295. package/dist/services/onboarding/control/watch.d.ts +0 -26
  296. package/dist/services/onboarding/control/watch.js +0 -157
  297. package/dist/services/onboarding/request-cache/asset-key.d.ts +0 -61
  298. package/dist/services/onboarding/request-cache/asset-key.js +0 -115
  299. package/dist/services/onboarding/spec/browser/answer-dialogs.spec.d.ts +0 -1
  300. package/dist/services/onboarding/spec/browser/answer-dialogs.spec.js +0 -66
  301. package/dist/services/onboarding/spec/browser/console-log.spec.d.ts +0 -1
  302. package/dist/services/onboarding/spec/browser/console-log.spec.js +0 -42
  303. package/dist/services/onboarding/spec/browser/resume-restarted-workers.spec.d.ts +0 -1
  304. package/dist/services/onboarding/spec/browser/resume-restarted-workers.spec.js +0 -45
  305. package/dist/services/onboarding/spec/control/browser-session.spec.d.ts +0 -1
  306. package/dist/services/onboarding/spec/control/browser-session.spec.js +0 -753
  307. package/dist/services/onboarding/spec/control/control-server.spec.d.ts +0 -1
  308. package/dist/services/onboarding/spec/control/control-server.spec.js +0 -371
  309. package/dist/services/onboarding/spec/control/debug-session.spec.d.ts +0 -1
  310. package/dist/services/onboarding/spec/control/debug-session.spec.js +0 -751
  311. package/dist/services/onboarding/spec/control/fakes.d.ts +0 -31
  312. package/dist/services/onboarding/spec/control/fakes.js +0 -67
  313. package/dist/services/onboarding/spec/control/fouc.spec.d.ts +0 -1
  314. package/dist/services/onboarding/spec/control/fouc.spec.js +0 -167
  315. package/dist/services/onboarding/spec/control/navigate-wait.spec.d.ts +0 -1
  316. package/dist/services/onboarding/spec/control/navigate-wait.spec.js +0 -47
  317. package/dist/services/onboarding/spec/control/navwalk.spec.d.ts +0 -1
  318. package/dist/services/onboarding/spec/control/navwalk.spec.js +0 -222
  319. package/dist/services/onboarding/spec/control/preload-registry.spec.d.ts +0 -1
  320. package/dist/services/onboarding/spec/control/preload-registry.spec.js +0 -432
  321. package/dist/services/onboarding/spec/control/response-explainer.spec.d.ts +0 -1
  322. package/dist/services/onboarding/spec/control/response-explainer.spec.js +0 -324
  323. package/dist/services/onboarding/spec/control/rum.spec.d.ts +0 -1
  324. package/dist/services/onboarding/spec/control/rum.spec.js +0 -222
  325. package/dist/services/onboarding/spec/control/service-worker-tracker.spec.d.ts +0 -1
  326. package/dist/services/onboarding/spec/control/service-worker-tracker.spec.js +0 -193
  327. package/dist/services/onboarding/spec/control/viewport.spec.d.ts +0 -1
  328. package/dist/services/onboarding/spec/control/viewport.spec.js +0 -200
  329. package/dist/services/onboarding/spec/control/watch.spec.d.ts +0 -1
  330. package/dist/services/onboarding/spec/control/watch.spec.js +0 -187
  331. package/dist/services/onboarding/spec/fetch-event-handler.spec.d.ts +0 -1
  332. package/dist/services/onboarding/spec/fetch-event-handler.spec.js +0 -219
  333. package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.d.ts +0 -1
  334. package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.js +0 -41
  335. package/dist/services/onboarding/spec/request-cache/cache.spec.d.ts +0 -1
  336. package/dist/services/onboarding/spec/request-cache/cache.spec.js +0 -107
  337. package/dist/services/onboarding/spec/todo-collector.spec.d.ts +0 -1
  338. package/dist/services/onboarding/spec/todo-collector.spec.js +0 -136
  339. package/dist/services/onboarding/spec/virtual-orestes-app/virtual-orestes-app.spec.d.ts +0 -1
  340. package/dist/services/onboarding/spec/virtual-orestes-app/virtual-orestes-app.spec.js +0 -65
  341. package/dist/services/query-builder/rules/rule-match.d.ts +0 -35
  342. package/dist/services/query-builder/rules/rule-match.js +0 -70
  343. package/dist/services/query-builder/spec/rules/rule-match.spec.d.ts +0 -1
  344. package/dist/services/query-builder/spec/rules/rule-match.spec.js +0 -121
  345. package/dist/services/run-control/browser/run-browser-contexts.d.ts +0 -557
  346. package/dist/services/run-control/browser/run-browser-contexts.js +0 -91
  347. package/dist/services/run-control/browser/run-browser-service-factory.d.ts +0 -5
  348. package/dist/services/run-control/browser/run-browser-service-factory.js +0 -7
  349. package/dist/services/run-control/browser/run-browser-service.d.ts +0 -68
  350. package/dist/services/run-control/browser/run-browser-service.js +0 -206
  351. package/dist/services/run-control/cache/run-cache-contexts.d.ts +0 -349
  352. package/dist/services/run-control/cache/run-cache-contexts.js +0 -51
  353. package/dist/services/run-control/cache/run-cache-service-factory.d.ts +0 -6
  354. package/dist/services/run-control/cache/run-cache-service-factory.js +0 -12
  355. package/dist/services/run-control/cache/run-cache-service.d.ts +0 -35
  356. package/dist/services/run-control/cache/run-cache-service.js +0 -151
  357. package/dist/services/run-control/control-client.d.ts +0 -36
  358. package/dist/services/run-control/control-client.js +0 -147
  359. package/dist/services/run-control/debug/run-debug-contexts.d.ts +0 -416
  360. package/dist/services/run-control/debug/run-debug-contexts.js +0 -47
  361. package/dist/services/run-control/debug/run-debug-service-factory.d.ts +0 -5
  362. package/dist/services/run-control/debug/run-debug-service-factory.js +0 -7
  363. package/dist/services/run-control/debug/run-debug-service.d.ts +0 -39
  364. package/dist/services/run-control/debug/run-debug-service.js +0 -164
  365. package/dist/services/run-control/files/run-files-contexts.d.ts +0 -238
  366. package/dist/services/run-control/files/run-files-contexts.js +0 -26
  367. package/dist/services/run-control/files/run-files-service-factory.d.ts +0 -5
  368. package/dist/services/run-control/files/run-files-service-factory.js +0 -7
  369. package/dist/services/run-control/files/run-files-service.d.ts +0 -29
  370. package/dist/services/run-control/files/run-files-service.js +0 -120
  371. package/dist/services/run-control/index.d.ts +0 -32
  372. package/dist/services/run-control/index.js +0 -31
  373. package/dist/services/run-control/inject/run-inject-contexts.d.ts +0 -319
  374. package/dist/services/run-control/inject/run-inject-contexts.js +0 -38
  375. package/dist/services/run-control/inject/run-inject-service-factory.d.ts +0 -5
  376. package/dist/services/run-control/inject/run-inject-service-factory.js +0 -7
  377. package/dist/services/run-control/inject/run-inject-service.d.ts +0 -31
  378. package/dist/services/run-control/inject/run-inject-service.js +0 -227
  379. package/dist/services/run-control/live-run.d.ts +0 -37
  380. package/dist/services/run-control/live-run.js +0 -56
  381. package/dist/services/run-control/probe/run-probe-contexts.d.ts +0 -333
  382. package/dist/services/run-control/probe/run-probe-contexts.js +0 -73
  383. package/dist/services/run-control/probe/run-probe-service-factory.d.ts +0 -5
  384. package/dist/services/run-control/probe/run-probe-service-factory.js +0 -7
  385. package/dist/services/run-control/probe/run-probe-service.d.ts +0 -54
  386. package/dist/services/run-control/probe/run-probe-service.js +0 -194
  387. package/dist/services/run-control/rum/run-rum-contexts.d.ts +0 -216
  388. package/dist/services/run-control/rum/run-rum-contexts.js +0 -34
  389. package/dist/services/run-control/rum/run-rum-service-factory.d.ts +0 -5
  390. package/dist/services/run-control/rum/run-rum-service-factory.js +0 -7
  391. package/dist/services/run-control/rum/run-rum-service.d.ts +0 -36
  392. package/dist/services/run-control/rum/run-rum-service.js +0 -122
  393. package/dist/services/run-control/run-answer.d.ts +0 -28
  394. package/dist/services/run-control/run-answer.js +0 -58
  395. package/dist/services/run-control/run-control-context.d.ts +0 -102
  396. package/dist/services/run-control/run-control-context.js +0 -36
  397. package/dist/services/run-control/run-control-flags.d.ts +0 -12
  398. package/dist/services/run-control/run-control-flags.js +0 -22
  399. package/dist/services/run-control/run-control-model.d.ts +0 -9
  400. package/dist/services/run-control/run-control-model.js +0 -1
  401. package/dist/services/run-control/run-control-service-factory.d.ts +0 -14
  402. package/dist/services/run-control/run-control-service-factory.js +0 -26
  403. package/dist/services/run-control/session/run-session-contexts.d.ts +0 -25
  404. package/dist/services/run-control/session/run-session-contexts.js +0 -20
  405. package/dist/services/run-control/session/run-session-service-factory.d.ts +0 -8
  406. package/dist/services/run-control/session/run-session-service-factory.js +0 -18
  407. package/dist/services/run-control/session/run-session-service.d.ts +0 -32
  408. package/dist/services/run-control/session/run-session-service.js +0 -151
  409. package/dist/services/run-control/spec/browser/run-browser-service.spec.d.ts +0 -1
  410. package/dist/services/run-control/spec/browser/run-browser-service.spec.js +0 -328
  411. package/dist/services/run-control/spec/cache/run-cache-service.spec.d.ts +0 -1
  412. package/dist/services/run-control/spec/cache/run-cache-service.spec.js +0 -454
  413. package/dist/services/run-control/spec/debug/run-debug-service.spec.d.ts +0 -1
  414. package/dist/services/run-control/spec/debug/run-debug-service.spec.js +0 -113
  415. package/dist/services/run-control/spec/files/run-files-service.spec.d.ts +0 -1
  416. package/dist/services/run-control/spec/files/run-files-service.spec.js +0 -234
  417. package/dist/services/run-control/spec/inject/run-inject-service.spec.d.ts +0 -1
  418. package/dist/services/run-control/spec/inject/run-inject-service.spec.js +0 -251
  419. package/dist/services/run-control/spec/live-run-fixture.d.ts +0 -32
  420. package/dist/services/run-control/spec/live-run-fixture.js +0 -109
  421. package/dist/services/run-control/spec/probe/run-probe-service.spec.d.ts +0 -1
  422. package/dist/services/run-control/spec/probe/run-probe-service.spec.js +0 -108
  423. package/dist/services/run-control/spec/rum/run-rum-service.spec.d.ts +0 -1
  424. package/dist/services/run-control/spec/rum/run-rum-service.spec.js +0 -47
  425. package/dist/services/run-control/spec/run-answer.spec.d.ts +0 -1
  426. package/dist/services/run-control/spec/run-answer.spec.js +0 -57
  427. package/dist/services/run-control/spec/session/run-session-service.spec.d.ts +0 -1
  428. package/dist/services/run-control/spec/session/run-session-service.spec.js +0 -150
  429. package/dist/services/run-log/crash-mirror.d.ts +0 -31
  430. package/dist/services/run-log/crash-mirror.js +0 -69
  431. package/dist/services/run-log/index.d.ts +0 -11
  432. package/dist/services/run-log/index.js +0 -11
  433. package/dist/services/run-log/jsonl-appender.d.ts +0 -46
  434. package/dist/services/run-log/jsonl-appender.js +0 -91
  435. package/dist/services/run-log/log-event-model.d.ts +0 -104
  436. package/dist/services/run-log/log-event-model.js +0 -56
  437. package/dist/services/run-log/log-query-service-factory.d.ts +0 -11
  438. package/dist/services/run-log/log-query-service-factory.js +0 -14
  439. package/dist/services/run-log/log-query-service.d.ts +0 -59
  440. package/dist/services/run-log/log-query-service.js +0 -111
  441. package/dist/services/run-log/log-reader.d.ts +0 -84
  442. package/dist/services/run-log/log-reader.js +0 -180
  443. package/dist/services/run-log/log-summary.d.ts +0 -72
  444. package/dist/services/run-log/log-summary.js +0 -208
  445. package/dist/services/run-log/redaction.d.ts +0 -34
  446. package/dist/services/run-log/redaction.js +0 -124
  447. package/dist/services/run-log/request-log.d.ts +0 -82
  448. package/dist/services/run-log/request-log.js +0 -69
  449. package/dist/services/run-log/request-summary.d.ts +0 -76
  450. package/dist/services/run-log/request-summary.js +0 -0
  451. package/dist/services/run-log/run-log.d.ts +0 -61
  452. package/dist/services/run-log/run-log.js +0 -102
  453. package/dist/services/run-log/spec/log-query-service.spec.d.ts +0 -1
  454. package/dist/services/run-log/spec/log-query-service.spec.js +0 -197
  455. package/dist/services/run-log/spec/log-reader.spec.d.ts +0 -1
  456. package/dist/services/run-log/spec/log-reader.spec.js +0 -109
  457. package/dist/services/run-log/spec/log-summary.spec.d.ts +0 -1
  458. package/dist/services/run-log/spec/log-summary.spec.js +0 -153
  459. package/dist/services/run-log/spec/redaction.spec.d.ts +0 -1
  460. package/dist/services/run-log/spec/redaction.spec.js +0 -61
  461. package/dist/services/run-log/spec/request-log.spec.d.ts +0 -1
  462. package/dist/services/run-log/spec/request-log.spec.js +0 -101
  463. package/dist/services/run-log/spec/request-summary.spec.d.ts +0 -1
  464. package/dist/services/run-log/spec/request-summary.spec.js +0 -171
  465. package/dist/services/run-log/spec/run-log.spec.d.ts +0 -1
  466. package/dist/services/run-log/spec/run-log.spec.js +0 -122
  467. package/dist/services/run-registry/exit-classification.d.ts +0 -39
  468. package/dist/services/run-registry/exit-classification.js +0 -42
  469. package/dist/services/run-registry/index.d.ts +0 -3
  470. package/dist/services/run-registry/index.js +0 -3
  471. package/dist/services/run-registry/process-identity.d.ts +0 -28
  472. package/dist/services/run-registry/process-identity.js +0 -80
  473. package/dist/services/run-registry/run-registry-model.d.ts +0 -128
  474. package/dist/services/run-registry/run-registry-model.js +0 -16
  475. package/dist/services/run-registry/run-registry.d.ts +0 -155
  476. package/dist/services/run-registry/run-registry.js +0 -430
  477. package/dist/services/run-registry/spec/exit-classification.spec.d.ts +0 -1
  478. package/dist/services/run-registry/spec/exit-classification.spec.js +0 -82
  479. package/dist/services/run-registry/spec/run-registry.spec.d.ts +0 -1
  480. package/dist/services/run-registry/spec/run-registry.spec.js +0 -526
  481. /package/dist/{commands/spec/onboarding.spec.d.ts → services/bundler/spec/packjockel-service.spec.d.ts} +0 -0
  482. /package/dist/services/{cli/spec/build-identity.spec.d.ts → deploy/spec/handler/customer-config-handler.spec.d.ts} +0 -0
  483. /package/dist/services/{cli/spec/build-info.spec.d.ts → document-handler-runtime/spec/document-handler-browser-mock.spec.d.ts} +0 -0
  484. /package/dist/services/{cli/spec/cli-service-log.spec.d.ts → integration-api/spec/customer-config-file.spec.d.ts} +0 -0
  485. /package/dist/services/{diff/spec/config-at-ref.spec.d.ts → onboarding/fetch-events/spec/speed-kit-install-js.spec.d.ts} +0 -0
  486. /package/dist/services/{diff/spec/run-runtime-config.spec.d.ts → onboarding/spec/file-events/file-watcher.spec.d.ts} +0 -0
@@ -11,8 +11,6 @@ declare const flags: {
11
11
  host: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
12
12
  body: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
13
13
  grep: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
14
- select: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
15
- maxMatches: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
16
14
  json: Interfaces.BooleanFlag<boolean>;
17
15
  variations: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
18
16
  raw: Interfaces.BooleanFlag<boolean>;
@@ -28,21 +26,8 @@ export interface OriginRequestOptions {
28
26
  readonly host?: string;
29
27
  readonly bodyFile?: string;
30
28
  readonly grep?: string;
31
- readonly select?: string;
32
- readonly maxMatches?: number;
33
29
  readonly json?: boolean;
34
30
  readonly variationsFile?: string;
35
- /**
36
- * The origin a relative {@link pageUrl} is resolved against, when the
37
- * caller knows one the config cannot supply.
38
- *
39
- * A customer with several origins and no `domain` has no base in its
40
- * config, and picking `origins[0]` would answer about the wrong site. But
41
- * a run *is* on one of them — the one `-d` or the startup prompt chose —
42
- * and that is the origin whoever is asking means. Passed in rather than
43
- * looked up, because this service has no idea a run exists.
44
- */
45
- readonly base?: string;
46
31
  }
47
32
  export interface OriginRequestServiceBuildContextValues extends CommandContextValues, OriginRequestOptions {
48
33
  }
@@ -60,8 +45,6 @@ export declare class OriginRequestServiceBuildContext extends OriginRequestServi
60
45
  host: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
61
46
  body: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
62
47
  grep: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
63
- select: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
64
- maxMatches: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
65
48
  json: Interfaces.BooleanFlag<boolean>;
66
49
  variations: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
67
50
  raw: Interfaces.BooleanFlag<boolean>;
@@ -34,12 +34,6 @@ const flags = {
34
34
  grep: Flags.string({
35
35
  description: "Print body lines matching this regex, case-insensitive",
36
36
  }),
37
- select: Flags.string({
38
- description: "Count and sample what this CSS selector matches in the body, e.g. 'script[src*=\"analytics\"]'",
39
- }),
40
- maxMatches: Flags.integer({
41
- description: "How many --select and --grep matches to show. Default 10",
42
- }),
43
37
  json: Flags.boolean({
44
38
  description: "Machine-readable output",
45
39
  }),
@@ -78,8 +72,6 @@ export class OriginRequestServiceBuildContext extends Context() {
78
72
  host: parsedFlags.host,
79
73
  bodyFile: parsedFlags.body,
80
74
  grep: parsedFlags.grep,
81
- select: parsedFlags.select,
82
- maxMatches: parsedFlags.maxMatches,
83
75
  json: parsedFlags.json,
84
76
  variationsFile: parsedFlags.variations,
85
77
  });
@@ -6,6 +6,11 @@ export declare class OriginRequestServiceFactory {
6
6
  constructor(context: OriginRequestServiceBuildContext);
7
7
  buildService(): Promise<OriginRequestService>;
8
8
  private build;
9
+ /**
10
+ * The runtime config: a local file when one is named, else the app's. Without a customer there is
11
+ * no app, and the request carries Speed Kit's device defaults only.
12
+ */
13
+ private loadRuntimeConfig;
9
14
  private getIntegrationFiles;
10
15
  private getConfigApi;
11
16
  }
@@ -2,6 +2,8 @@ import { ConfigApiContext, ConfigApiServiceFactory, } from "../config-api/index.
2
2
  import { IntegrationApiServiceBuildContext, IntegrationApiFactory, } from "../integration-api/index.js";
3
3
  import { applyOriginProxy } from "../../helpers/origin-proxy.js";
4
4
  import { OriginRequestService } from "./origin-request-service.js";
5
+ import { OriginFetcher } from "./origin-fetcher.js";
6
+ import { RuntimeConfigSource, } from "./runtime-config-source.js";
5
7
  export class OriginRequestServiceFactory {
6
8
  context;
7
9
  service = undefined;
@@ -16,13 +18,39 @@ export class OriginRequestServiceFactory {
16
18
  }
17
19
  async build() {
18
20
  const cli = this.context.environment.cli;
19
- // `sk origin-request --raw <url>` names no customer: no app, so no runtime config.
20
21
  const customer = this.context.customerPath
21
22
  ? (await this.getIntegrationFiles(this.context.customerPath)).getCustomerConfig().config
22
23
  : undefined;
23
24
  // `--json` owns stdout, so the proxy line stays out of a machine-readable run.
24
25
  applyOriginProxy(customer?.chromeFlags, this.context.json ? undefined : cli);
25
- this.service = new OriginRequestService(this.context, cli, customer ? this.getConfigApi(customer.app) : undefined, customer);
26
+ // An empty variation set still runs: device defaults resolve, originMap and authentications apply.
27
+ const config = await this.loadRuntimeConfig(customer?.app);
28
+ this.service = new OriginRequestService(this.context, cli, config
29
+ ? new OriginFetcher({
30
+ cli,
31
+ config,
32
+ host: this.context.host,
33
+ strict: true,
34
+ })
35
+ : undefined);
36
+ }
37
+ /**
38
+ * The runtime config: a local file when one is named, else the app's. Without a customer there is
39
+ * no app, and the request carries Speed Kit's device defaults only.
40
+ */
41
+ async loadRuntimeConfig(app) {
42
+ const cli = this.context.environment.cli;
43
+ if (!app && !this.context.variationsFile) {
44
+ if (!this.context.json) {
45
+ cli.writeWarning("no customer: the request carries Speed Kit's device defaults only, no variation of an app");
46
+ }
47
+ return { variations: {}, authentications: [], originMap: {} };
48
+ }
49
+ return new RuntimeConfigSource({
50
+ cli,
51
+ configApi: app ? this.getConfigApi(app) : undefined,
52
+ fileFlag: "--variations",
53
+ }).load(this.context.variationsFile);
26
54
  }
27
55
  async getIntegrationFiles(customerPath) {
28
56
  const integrationApiContext = new IntegrationApiServiceBuildContext({
@@ -1,70 +1,12 @@
1
1
  import { CliServiceInterface } from "../cli/index.js";
2
- import { ConfigApiService } from "../config-api/index.js";
3
- import { CustomerConfig } from "../integration-api/index.js";
4
2
  import { OriginRequestOptions } from "./origin-request-service-build-context.js";
3
+ import { OriginFetcher } from "./origin-fetcher.js";
5
4
  import { ResolvedRequest } from "./asset-variations.js";
6
5
  /**
7
6
  * The headers as reported. Origin basic auth and the origin map's headers are sent, but their
8
7
  * values are not printed: the runtime config stores credentials there, such as a bypass token.
9
8
  */
10
9
  export declare function printable(headers: Record<string, string>, { originMapHeaders }: ResolvedRequest): Record<string, string>;
11
- /** What the origin answered, and the request that was sent to get it. */
12
- export interface OriginRequestResult {
13
- outcome: "fetched";
14
- variation: string;
15
- /** Every variation the config defines, so a wrong guess is one call from right. */
16
- variations: string[];
17
- /** And the ones the server resolves regardless — a config often defines none. */
18
- deviceDefaults: string[];
19
- resolutionPath: "named" | "template";
20
- appliedKeys: string[];
21
- /** The `speedKit.originMap` entry the request was rewritten by, if any. */
22
- originMapKey?: string;
23
- requestUrl: string;
24
- requestHeaders: Record<string, string>;
25
- curl: string;
26
- status: number;
27
- statusText: string;
28
- responseHeaders: Record<string, string>;
29
- setCookie: string[];
30
- body: string;
31
- }
32
- /**
33
- * A reason no request was sent, as data rather than a printed line.
34
- *
35
- * Every one of these is a thing the caller can act on — log in, pass a file,
36
- * pick a variation that exists — so each carries what the next attempt needs.
37
- * Discriminated by a string: `strict` is off in this project, and a boolean
38
- * discriminant does not narrow under it.
39
- */
40
- export type OriginRequestFailure = {
41
- outcome: "config-unavailable";
42
- message: string;
43
- cause: string;
44
- } | {
45
- outcome: "unreadable-variations";
46
- message: string;
47
- file: string;
48
- } | {
49
- outcome: "unknown-variation";
50
- message: string;
51
- requested: string;
52
- /** What the config defines. `*` is the wildcard and a template key is a regex. */
53
- available: string[];
54
- deviceDefaults: string[];
55
- } | {
56
- outcome: "bad-url";
57
- message: string;
58
- url: string;
59
- base: string | null;
60
- };
61
- export type OriginRequestOutcome = OriginRequestResult | OriginRequestFailure;
62
- /** The variations a customer's deployed config defines. */
63
- export type VariationListOutcome = {
64
- outcome: "variations";
65
- variations: string[];
66
- deviceDefaults: string[];
67
- } | OriginRequestFailure;
68
10
  /**
69
11
  * Fetches a page from origin with exactly the headers Speed Kit's server would send for a cache
70
12
  * variation, then reports what the origin answered.
@@ -73,10 +15,6 @@ export type VariationListOutcome = {
73
15
  * — without waiting for a render or reading backend logs. The variations come from the app's
74
16
  * deployed runtime config, so the simulation follows production rather than a local file.
75
17
  *
76
- * {@link run} renders for a terminal; {@link execute} returns the same work as data. The split
77
- * keeps the failures typed: a failure a human reads as one line is an outcome a caller can branch
78
- * on, and the tests read it that way.
79
- *
80
18
  * Known deviations from the server, all deliberate:
81
19
  * - Revalidation headers (If-None-Match, If-Modified-Since) apply only when refreshing a cached
82
20
  * entry, so they are out of scope.
@@ -85,65 +23,12 @@ export type VariationListOutcome = {
85
23
  export declare class OriginRequestService {
86
24
  private readonly context;
87
25
  private readonly cli;
88
- /** Absent without a customer: there is no app to load a runtime config from. */
89
- private readonly configApi;
90
- private readonly customer?;
26
+ /** Absent when the runtime config could not be used; the reason is reported. */
27
+ private readonly fetcher;
91
28
  constructor(context: OriginRequestOptions, cli: CliServiceInterface,
92
- /** Absent without a customer: there is no app to load a runtime config from. */
93
- configApi: ConfigApiService | undefined, customer?: CustomerConfig);
94
- /** False when no request was sent, so the command can exit 2 like `sk diff`. */
29
+ /** Absent when the runtime config could not be used; the reason is reported. */
30
+ fetcher: OriginFetcher | undefined);
31
+ /** False when the request was not sent, because the runtime config could not be used. */
95
32
  run(): Promise<boolean>;
96
- /**
97
- * The request, as data.
98
- *
99
- * A failure comes back as an outcome rather than a thrown error, because
100
- * every one of them is an ordinary answer to "can this be simulated" — not
101
- * logged in, no variations configured, a variation that does not exist. Only
102
- * a genuinely unexpected error still throws.
103
- */
104
- execute(): Promise<OriginRequestOutcome>;
105
- /**
106
- * Which variations exist, without sending anything to the origin.
107
- *
108
- * The answer to "what do I pass as `variation`", which otherwise costs a
109
- * request that is known in advance to be refused.
110
- */
111
- listVariations(): Promise<VariationListOutcome>;
112
- /**
113
- * Resolves the requested page against the customer's own origin, so a path is enough.
114
- *
115
- * Normalised the way the control socket does, and for the same reason: `new URL(input, base)`
116
- * parses the base first and throws when it is not absolute — even when the input is — and
117
- * `domain` is a bare host in every `config_customer` that has one. Blaming the input for a base
118
- * that was wrong already cost one testing session.
119
- *
120
- * `domain` is optional, and plenty of configs carry only `origins` — so a single origin serves as
121
- * the base too. Several origins and no `domain` used to be refused outright: picking the first
122
- * would be a guess, and a page fetched from the wrong one of a customer's origins answers like a
123
- * real result.
124
- *
125
- * {@link OriginRequestOptions.base} is the way out of that, and it wins over both — a caller that
126
- * supplies one knows something the config does not. For a run that is the origin it is actually
127
- * driving, which is why `sk onboarding response` accepted `/sale` on a twelve-origin customer while this
128
- * refused it: the same question, two answers, for no reason the caller could see.
129
- */
130
- private absoluteUrl;
131
- /**
132
- * Reads `speedKit.variations` from the app's deployed runtime config, or from a local file when
133
- * `--variations` is given.
134
- */
135
- private loadVariations;
136
- /**
137
- * `--raw` without a customer: no app, so no runtime config. An empty set is the point here —
138
- * only Speed Kit's device defaults resolve, and no origin basic auth is sent — which is the
139
- * request `sk diff --raw` makes for a site that has no config yet.
140
- */
141
- private noApp;
142
- private fetchRuntimeConfig;
143
- private readVariationsFile;
144
33
  private report;
145
- /** `--select`, counted and sampled: "did the origin send it" in one number. */
146
- private selected;
147
- /** `--grep`, case-insensitive as its flag says, each line windowed. */
148
- private grepped;
149
34
  }
@@ -1,10 +1,6 @@
1
- import { readFile, writeFile } from "node:fs/promises";
2
- import { safe } from "../../helpers/safe.js";
1
+ import { writeFile } from "node:fs/promises";
3
2
  import { originFetch } from "../../helpers/origin-proxy.js";
4
- import { grepText, selectInHtml } from "../onboarding/control/body-inspect.js";
5
- import ApplicationError from "../error-handling/error/application-error.js";
6
- import { OriginFetcher } from "./origin-fetcher.js";
7
- import { DEFAULT_TYPE, DEVICE_DEFAULT_TYPES, toCurl, } from "./asset-variations.js";
3
+ import { DEFAULT_TYPE, toCurl } from "./asset-variations.js";
8
4
  /** Standard request headers that carry no credentials, so an origin map value stays visible. */
9
5
  const PLAIN_HEADERS = new Set([
10
6
  "accept",
@@ -42,10 +38,6 @@ export function printable(headers, { originMapHeaders = [] }) {
42
38
  * — without waiting for a render or reading backend logs. The variations come from the app's
43
39
  * deployed runtime config, so the simulation follows production rather than a local file.
44
40
  *
45
- * {@link run} renders for a terminal; {@link execute} returns the same work as data. The split
46
- * keeps the failures typed: a failure a human reads as one line is an outcome a caller can branch
47
- * on, and the tests read it that way.
48
- *
49
41
  * Known deviations from the server, all deliberate:
50
42
  * - Revalidation headers (If-None-Match, If-Modified-Since) apply only when refreshing a cached
51
43
  * entry, so they are out of scope.
@@ -54,288 +46,72 @@ export function printable(headers, { originMapHeaders = [] }) {
54
46
  export class OriginRequestService {
55
47
  context;
56
48
  cli;
57
- configApi;
58
- customer;
49
+ fetcher;
59
50
  constructor(context, cli,
60
- /** Absent without a customer: there is no app to load a runtime config from. */
61
- configApi, customer) {
51
+ /** Absent when the runtime config could not be used; the reason is reported. */
52
+ fetcher) {
62
53
  this.context = context;
63
54
  this.cli = cli;
64
- this.configApi = configApi;
65
- this.customer = customer;
55
+ this.fetcher = fetcher;
66
56
  }
67
- /** False when no request was sent, so the command can exit 2 like `sk diff`. */
57
+ /** False when the request was not sent, because the runtime config could not be used. */
68
58
  async run() {
69
- const result = await this.execute();
70
- if (result.outcome !== "fetched") {
71
- // `--variations` is this command's flag, so the hint is added here rather
72
- // than carried in the outcome, which names what happened and not what to
73
- // type.
74
- this.cli.writeError(result.outcome === "config-unavailable"
75
- ? `${result.message} Or pass --variations <file> to simulate against a config you already have.`
76
- : result.message);
59
+ // Without a runtime config every request would resolve to the bare defaults, so the report
60
+ // would describe a request the server never sends. Stop instead of simulating something wrong.
61
+ if (!this.fetcher)
77
62
  return false;
78
- }
79
- if (this.context.bodyFile)
80
- await writeFile(this.context.bodyFile, result.body);
81
- if (this.context.json) {
82
- // The payload channel, so `--json > file` gets the document and nothing
83
- // the CLI had to say about it.
84
- this.cli.pipe(`${JSON.stringify({
85
- variation: result.variation,
86
- resolutionPath: result.resolutionPath,
87
- appliedConfigs: result.appliedKeys,
88
- originMapKey: result.originMapKey ?? null,
89
- requestUrl: result.requestUrl,
90
- requestHeaders: result.requestHeaders,
91
- status: result.status,
92
- responseHeaders: result.responseHeaders,
93
- setCookie: result.setCookie,
94
- bodyLength: result.body.length,
95
- bodyFile: this.context.bodyFile,
96
- curl: result.curl,
97
- select: this.selected(result.body),
98
- grep: this.grepped(result.body),
99
- }, null, 2)}\n`);
100
- return true;
101
- }
102
- this.report(result);
103
- return true;
104
- }
105
- /**
106
- * The request, as data.
107
- *
108
- * A failure comes back as an outcome rather than a thrown error, because
109
- * every one of them is an ordinary answer to "can this be simulated" — not
110
- * logged in, no variations configured, a variation that does not exist. Only
111
- * a genuinely unexpected error still throws.
112
- */
113
- async execute() {
114
- const loaded = await this.loadVariations();
115
- // Without variations every request would resolve to the bare defaults, so the report would
116
- // describe a request the server never sends. Stop instead of simulating something wrong.
117
- if (loaded.outcome !== "loaded")
118
- return loaded;
119
- const variations = loaded.variations;
120
63
  const variation = this.context.variation ?? DEFAULT_TYPE;
121
- const pageUrl = this.absoluteUrl();
122
- if (typeof pageUrl !== "string")
123
- return pageUrl;
124
- const fetcher = new OriginFetcher({
125
- cli: this.cli,
126
- config: {
127
- variations,
128
- authentications: loaded.authentications,
129
- originMap: loaded.originMap,
130
- },
131
- host: this.context.host,
132
- strict: true,
133
- });
134
- let prepared;
135
- try {
136
- prepared = fetcher.prepare(pageUrl, this.context.variation);
137
- }
138
- catch (error) {
139
- // Strict, the fetcher throws only for a variation the config does not define.
140
- if (error instanceof ApplicationError) {
141
- return {
142
- outcome: "unknown-variation",
143
- message: error.message,
144
- requested: variation,
145
- available: Object.keys(variations),
146
- deviceDefaults: DEVICE_DEFAULT_TYPES,
147
- };
148
- }
149
- throw error;
150
- }
151
- const { url, init, resolved } = prepared;
64
+ const { url, init, resolved } = this.fetcher.prepare(this.context.pageUrl, this.context.variation);
152
65
  const headers = printable(init.headers, resolved);
153
66
  const response = await originFetch(url, { ...init, redirect: "manual" });
154
67
  const body = await response.text();
155
- return {
156
- outcome: "fetched",
157
- variation,
158
- variations: Object.keys(variations),
159
- deviceDefaults: DEVICE_DEFAULT_TYPES,
160
- resolutionPath: resolved.resolutionPath,
161
- appliedKeys: resolved.appliedKeys,
162
- originMapKey: resolved.originMapKey,
163
- requestUrl: url,
164
- requestHeaders: headers,
165
- curl: toCurl(url, headers),
166
- status: response.status,
167
- statusText: response.statusText,
168
- responseHeaders: Object.fromEntries(response.headers),
169
- setCookie: response.headers.getSetCookie?.() ?? [],
170
- body,
171
- };
172
- }
173
- /**
174
- * Which variations exist, without sending anything to the origin.
175
- *
176
- * The answer to "what do I pass as `variation`", which otherwise costs a
177
- * request that is known in advance to be refused.
178
- */
179
- async listVariations() {
180
- const loaded = await this.loadVariations();
181
- if (loaded.outcome !== "loaded")
182
- return loaded;
183
- return {
184
- outcome: "variations",
185
- variations: Object.keys(loaded.variations),
186
- deviceDefaults: DEVICE_DEFAULT_TYPES,
187
- };
188
- }
189
- /**
190
- * Resolves the requested page against the customer's own origin, so a path is enough.
191
- *
192
- * Normalised the way the control socket does, and for the same reason: `new URL(input, base)`
193
- * parses the base first and throws when it is not absolute — even when the input is — and
194
- * `domain` is a bare host in every `config_customer` that has one. Blaming the input for a base
195
- * that was wrong already cost one testing session.
196
- *
197
- * `domain` is optional, and plenty of configs carry only `origins` — so a single origin serves as
198
- * the base too. Several origins and no `domain` used to be refused outright: picking the first
199
- * would be a guess, and a page fetched from the wrong one of a customer's origins answers like a
200
- * real result.
201
- *
202
- * {@link OriginRequestOptions.base} is the way out of that, and it wins over both — a caller that
203
- * supplies one knows something the config does not. For a run that is the origin it is actually
204
- * driving, which is why `sk onboarding response` accepted `/sale` on a twelve-origin customer while this
205
- * refused it: the same question, two answers, for no reason the caller could see.
206
- */
207
- absoluteUrl() {
208
- const origins = this.customer?.origins ?? [];
209
- const named = this.context.base ||
210
- this.customer?.domain ||
211
- (origins.length === 1 && origins[0]);
212
- const base = named && !/^https?:\/\//.test(named) ? `https://${named}` : named;
213
- try {
214
- return new URL(this.context.pageUrl, base || undefined).toString();
215
- }
216
- catch {
217
- return {
218
- outcome: "bad-url",
219
- message: base
220
- ? `"${this.context.pageUrl}" is not a url, absolute or relative to ${base}`
221
- : origins.length > 1
222
- ? `"${this.context.pageUrl}" is not an absolute url, and this config names no domain and ${origins.length} origins — say which: ${origins.join(", ")}`
223
- : `"${this.context.pageUrl}" is not an absolute url, and no customer config was available to resolve it against`,
224
- url: this.context.pageUrl,
225
- base: base || null,
226
- };
227
- }
228
- }
229
- /**
230
- * Reads `speedKit.variations` from the app's deployed runtime config, or from a local file when
231
- * `--variations` is given.
232
- */
233
- async loadVariations() {
234
- if (!this.configApi && !this.context.variationsFile)
235
- return this.noApp();
236
- const raw = this.context.variationsFile
237
- ? await this.readVariationsFile(this.context.variationsFile)
238
- : await this.fetchRuntimeConfig();
239
- if (typeof raw !== "string")
240
- return raw;
241
- const parsed = JSON.parse(raw);
242
- // An empty variation set still runs: device defaults resolve, originMap and authentications apply.
243
- const variations = parsed.speedKit?.variations ?? parsed.variations ?? {};
244
- const authentications = (parsed.speedKit ?? parsed).authentications ?? [];
245
- const originMap = (parsed.speedKit ?? parsed).originMap ?? {};
246
- // Narration, so never under --json: stdout is the document there.
247
- if (!this.context.json && Object.keys(variations).length > 0) {
248
- this.cli.writeSuccess(`variations: ${Object.keys(variations).join(", ")}`);
249
- }
250
- return { outcome: "loaded", variations, authentications, originMap };
251
- }
252
- /**
253
- * `--raw` without a customer: no app, so no runtime config. An empty set is the point here —
254
- * only Speed Kit's device defaults resolve, and no origin basic auth is sent — which is the
255
- * request `sk diff --raw` makes for a site that has no config yet.
256
- */
257
- noApp() {
258
- if (!this.context.json) {
259
- this.cli.writeWarning("no customer: the request carries Speed Kit's device defaults only, no variation of an app");
260
- }
261
- return {
262
- outcome: "loaded",
263
- variations: {},
264
- authentications: [],
265
- originMap: {},
266
- };
267
- }
268
- async fetchRuntimeConfig() {
269
- this.cli.startAction("ORIGIN_REQUEST:FETCH:RUNTIME_CONFIG", "load variations from the app");
270
- const serverConfig = await safe(this.configApi.getServerConfig());
271
- if (serverConfig.success === false) {
272
- this.cli.failAction("ORIGIN_REQUEST:FETCH:RUNTIME_CONFIG");
273
- return {
274
- outcome: "config-unavailable",
275
- message: `unable to load the runtime config: ${serverConfig.error}. Run "sk login" and try again.`,
276
- cause: String(serverConfig.error),
277
- };
278
- }
279
- this.cli.successAction("ORIGIN_REQUEST:FETCH:RUNTIME_CONFIG");
280
- return serverConfig.data;
281
- }
282
- async readVariationsFile(file) {
283
- const content = await safe(readFile(file, "utf8"));
284
- if (content.success === false) {
285
- return {
286
- outcome: "unreadable-variations",
287
- message: `unable to read ${file}: ${content.error}`,
288
- file,
289
- };
68
+ const setCookies = response.headers.getSetCookie?.() ?? [];
69
+ if (this.context.bodyFile)
70
+ await writeFile(this.context.bodyFile, body);
71
+ if (this.context.json) {
72
+ this.cli.write(JSON.stringify({
73
+ variation,
74
+ resolutionPath: resolved.resolutionPath,
75
+ appliedConfigs: resolved.appliedKeys,
76
+ originMapKey: resolved.originMapKey ?? null,
77
+ requestUrl: url,
78
+ requestHeaders: headers,
79
+ status: response.status,
80
+ responseHeaders: Object.fromEntries(response.headers),
81
+ setCookie: setCookies,
82
+ bodyLength: body.length,
83
+ }, null, 2));
84
+ return true;
290
85
  }
291
- this.cli.writeSuccess(`variations from ${file}`);
292
- return content.data;
86
+ this.report(variation, resolved, headers, response, setCookies, body);
87
+ return true;
293
88
  }
294
- report(result) {
295
- this.cli.write(`variation ${result.variation}`);
296
- this.cli.write(`resolution ${result.resolutionPath} → applied: ${result.appliedKeys.join(" then ")}`);
297
- if (result.originMapKey)
298
- this.cli.write(`origin map ${result.originMapKey}`);
299
- this.cli.write(`request url ${result.requestUrl}`);
89
+ report(variation, resolved, headers, response, setCookies, body) {
90
+ this.cli.write(`variation ${variation}`);
91
+ this.cli.write(`resolution ${resolved.resolutionPath} → applied: ${resolved.appliedKeys.join(" then ")}`);
92
+ if (resolved.originMapKey)
93
+ this.cli.write(`origin map ${resolved.originMapKey}`);
94
+ this.cli.write(`request url ${resolved.url}`);
300
95
  this.cli.write("request headers");
301
- for (const [key, value] of Object.entries(result.requestHeaders))
96
+ for (const [key, value] of Object.entries(headers))
302
97
  this.cli.write(` ${key}: ${value}`);
303
- this.cli.write(`\nstatus ${result.status} ${result.statusText}`);
304
- const location = result.responseHeaders.location;
98
+ this.cli.write(`\nstatus ${response.status} ${response.statusText}`);
99
+ const location = response.headers.get("location");
305
100
  if (location)
306
101
  this.cli.write(`location ${location}`);
307
- if (result.setCookie.length) {
102
+ if (setCookies.length) {
308
103
  this.cli.write("set-cookie");
309
- for (const cookie of result.setCookie)
104
+ for (const cookie of setCookies)
310
105
  this.cli.write(` ${cookie}`);
311
106
  }
312
- this.cli.write(`body ${result.body.length} bytes${this.context.bodyFile ? ` → ${this.context.bodyFile}` : ""}`);
313
- this.cli.write(`\nequivalent curl:\n${result.curl}`);
314
- const selected = this.selected(result.body);
315
- if (selected) {
316
- this.cli.write(selected.error
317
- ? `\nselect "${selected.selector}" → rejected: ${selected.error}`
318
- : `\nselect "${selected.selector}" → ${selected.count} match(es)`);
319
- for (const match of selected.matches)
320
- this.cli.write(` ${match}`);
107
+ this.cli.write(`body ${body.length} bytes${this.context.bodyFile ? ` → ${this.context.bodyFile}` : ""}`);
108
+ this.cli.write(`\nequivalent curl:\n${toCurl(resolved.url, headers)}`);
109
+ if (this.context.grep) {
110
+ const pattern = new RegExp(this.context.grep, "i");
111
+ const hits = body.split("\n").filter((line) => pattern.test(line));
112
+ this.cli.write(`\ngrep "${this.context.grep}" → ${hits.length} line(s)`);
113
+ for (const line of hits.slice(0, 10))
114
+ this.cli.write(` ${line.trim().slice(0, 300)}`);
321
115
  }
322
- const grepped = this.grepped(result.body);
323
- if (grepped) {
324
- this.cli.write(`\ngrep "${grepped.pattern}" → ${grepped.count} line(s)`);
325
- for (const match of grepped.matches)
326
- this.cli.write(` ${match.line}: ${match.text}`);
327
- }
328
- }
329
- /** `--select`, counted and sampled: "did the origin send it" in one number. */
330
- selected(body) {
331
- return this.context.select
332
- ? selectInHtml(body, this.context.select, this.context.maxMatches)
333
- : undefined;
334
- }
335
- /** `--grep`, case-insensitive as its flag says, each line windowed. */
336
- grepped(body) {
337
- return this.context.grep
338
- ? grepText(body, this.context.grep, this.context.maxMatches, "i")
339
- : undefined;
340
116
  }
341
117
  }
@@ -15,12 +15,6 @@ export interface OriginRequestConfig {
15
15
  /** `speedKit.originMap`: per origin, a rewrite target and extra headers. */
16
16
  readonly originMap: OriginMap;
17
17
  }
18
- /**
19
- * What a session without the runtime config loses. Everything the runtime config alone carries
20
- * is gone, including any override of a device variation; those still resolve from their
21
- * built-in defaults only.
22
- */
23
- export declare const NO_RUNTIME_CONFIG_WARNING = "without the runtime config, origin fetches carry no basic auth, no custom variation and no configured override of default, mobile or tablet \u2014 those fall back to the built-in defaults.";
24
18
  /** What loading the runtime config reports through. */
25
19
  export type RuntimeConfigLog = Pick<CliServiceInterface, "writeError" | "writeSuccess" | "startAction" | "successAction" | "failAction">;
26
20
  export interface RuntimeConfigSourceDeps {