@encore.dev/sdk 2.0.0-beta.7 → 2.0.0-beta.9

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 (424) hide show
  1. package/README.md +109 -0
  2. package/app_meta.test.ts +25 -5
  3. package/app_meta.ts +51 -12
  4. package/config/config.test.ts +18 -15
  5. package/config/config.ts +89 -31
  6. package/config/mod.ts +4 -3
  7. package/config/secrets.ts +79 -53
  8. package/config/value.ts +13 -17
  9. package/cron/mod.test.ts +52 -0
  10. package/cron/mod.ts +41 -2
  11. package/dist/app_meta.d.ts +44 -12
  12. package/dist/app_meta.d.ts.map +1 -0
  13. package/dist/app_meta.js +2 -0
  14. package/dist/app_meta.js.map +1 -1
  15. package/dist/config/config.d.ts +58 -28
  16. package/dist/config/config.d.ts.map +1 -0
  17. package/dist/config/config.js +46 -18
  18. package/dist/config/config.js.map +1 -1
  19. package/dist/config/mod.d.ts +5 -4
  20. package/dist/config/mod.d.ts.map +1 -0
  21. package/dist/config/mod.js +2 -2
  22. package/dist/config/mod.js.map +1 -1
  23. package/dist/config/secrets.d.ts +71 -39
  24. package/dist/config/secrets.d.ts.map +1 -0
  25. package/dist/config/secrets.js +31 -38
  26. package/dist/config/secrets.js.map +1 -1
  27. package/dist/config/value.d.ts +8 -5
  28. package/dist/config/value.d.ts.map +1 -0
  29. package/dist/config/value.js +10 -7
  30. package/dist/config/value.js.map +1 -1
  31. package/dist/cron/mod.d.ts +36 -1
  32. package/dist/cron/mod.d.ts.map +1 -0
  33. package/dist/cron/mod.js +31 -1
  34. package/dist/cron/mod.js.map +1 -1
  35. package/dist/frontends/mod.d.ts +39 -0
  36. package/dist/frontends/mod.d.ts.map +1 -0
  37. package/dist/frontends/mod.js +47 -0
  38. package/dist/frontends/mod.js.map +1 -0
  39. package/dist/gateway/errors.d.ts +101 -0
  40. package/dist/gateway/errors.d.ts.map +1 -0
  41. package/dist/gateway/errors.js +146 -0
  42. package/dist/gateway/errors.js.map +1 -0
  43. package/dist/gateway/match.d.ts +127 -0
  44. package/dist/gateway/match.d.ts.map +1 -0
  45. package/dist/gateway/match.js +206 -0
  46. package/dist/gateway/match.js.map +1 -0
  47. package/dist/gateway/middleware.d.ts +108 -0
  48. package/dist/gateway/middleware.d.ts.map +1 -0
  49. package/dist/gateway/middleware.js +9 -0
  50. package/dist/gateway/middleware.js.map +1 -0
  51. package/dist/gateway/mod.d.ts +130 -0
  52. package/dist/gateway/mod.d.ts.map +1 -0
  53. package/dist/gateway/mod.js +188 -0
  54. package/dist/gateway/mod.js.map +1 -0
  55. package/dist/gateway/request.d.ts +304 -0
  56. package/dist/gateway/request.d.ts.map +1 -0
  57. package/dist/gateway/request.js +403 -0
  58. package/dist/gateway/request.js.map +1 -0
  59. package/dist/gateway/serve.d.ts +114 -0
  60. package/dist/gateway/serve.d.ts.map +1 -0
  61. package/dist/gateway/serve.js +510 -0
  62. package/dist/gateway/serve.js.map +1 -0
  63. package/dist/gateways/mod.d.ts +42 -0
  64. package/dist/gateways/mod.d.ts.map +1 -0
  65. package/dist/gateways/mod.js +55 -0
  66. package/dist/gateways/mod.js.map +1 -0
  67. package/dist/internal/clients/call.d.ts +147 -0
  68. package/dist/internal/clients/call.d.ts.map +1 -0
  69. package/dist/internal/clients/call.js +274 -0
  70. package/dist/internal/clients/call.js.map +1 -0
  71. package/dist/internal/clients/grpc.d.ts +90 -0
  72. package/dist/internal/clients/grpc.d.ts.map +1 -0
  73. package/dist/internal/clients/grpc.js +355 -0
  74. package/dist/internal/clients/grpc.js.map +1 -0
  75. package/dist/internal/clients/mod.d.ts +81 -0
  76. package/dist/internal/clients/mod.d.ts.map +1 -0
  77. package/dist/internal/clients/mod.js +237 -0
  78. package/dist/internal/clients/mod.js.map +1 -0
  79. package/dist/internal/fetch.d.ts +58 -0
  80. package/dist/internal/fetch.d.ts.map +1 -0
  81. package/dist/internal/fetch.js +251 -0
  82. package/dist/internal/fetch.js.map +1 -0
  83. package/dist/internal/otel/backend.d.ts +2 -0
  84. package/dist/internal/otel/backend.d.ts.map +1 -0
  85. package/dist/internal/otel/context.d.ts +1 -0
  86. package/dist/internal/otel/context.d.ts.map +1 -0
  87. package/dist/internal/otel/context_manager.d.ts +1 -0
  88. package/dist/internal/otel/context_manager.d.ts.map +1 -0
  89. package/dist/internal/otel/encode.d.ts +2 -0
  90. package/dist/internal/otel/encode.d.ts.map +1 -0
  91. package/dist/internal/otel/http.d.ts +11 -0
  92. package/dist/internal/otel/http.d.ts.map +1 -0
  93. package/dist/internal/otel/http.js +64 -0
  94. package/dist/internal/otel/http.js.map +1 -0
  95. package/dist/internal/otel/index.d.ts +2 -2
  96. package/dist/internal/otel/index.d.ts.map +1 -0
  97. package/dist/internal/otel/index.js +1 -2
  98. package/dist/internal/otel/index.js.map +1 -1
  99. package/dist/internal/otel/meter.d.ts +1 -0
  100. package/dist/internal/otel/meter.d.ts.map +1 -0
  101. package/dist/internal/otel/propagator.d.ts +1 -0
  102. package/dist/internal/otel/propagator.d.ts.map +1 -0
  103. package/dist/internal/otel/provider.d.ts +4 -0
  104. package/dist/internal/otel/provider.d.ts.map +1 -0
  105. package/dist/internal/otel/provider.js +3 -0
  106. package/dist/internal/otel/provider.js.map +1 -1
  107. package/dist/internal/otel/span.d.ts +15 -1
  108. package/dist/internal/otel/span.d.ts.map +1 -0
  109. package/dist/internal/otel/span.js +30 -2
  110. package/dist/internal/otel/span.js.map +1 -1
  111. package/dist/internal/otel/tracer.d.ts +1 -0
  112. package/dist/internal/otel/tracer.d.ts.map +1 -0
  113. package/dist/internal/otel/tracer.js +11 -5
  114. package/dist/internal/otel/tracer.js.map +1 -1
  115. package/dist/internal/reqfields.d.ts +170 -0
  116. package/dist/internal/reqfields.d.ts.map +1 -0
  117. package/dist/internal/reqfields.js +349 -0
  118. package/dist/internal/reqfields.js.map +1 -0
  119. package/dist/internal/runtime/meter.d.ts +1 -0
  120. package/dist/internal/runtime/meter.d.ts.map +1 -0
  121. package/dist/internal/runtime/mod.d.ts +6 -0
  122. package/dist/internal/runtime/mod.d.ts.map +1 -0
  123. package/dist/internal/runtime/mod.js +32 -2
  124. package/dist/internal/runtime/mod.js.map +1 -1
  125. package/dist/internal/runtime/napi/napi.cjs +192 -16
  126. package/dist/internal/runtime/napi/napi.d.cts +573 -33
  127. package/dist/internal/runtime/shutdown.d.ts +5 -0
  128. package/dist/internal/runtime/shutdown.d.ts.map +1 -0
  129. package/dist/internal/runtime/shutdown.js +9 -1
  130. package/dist/internal/runtime/shutdown.js.map +1 -1
  131. package/dist/internal/testing/carry.d.ts +49 -0
  132. package/dist/internal/testing/carry.d.ts.map +1 -0
  133. package/dist/internal/testing/carry.js +77 -0
  134. package/dist/internal/testing/carry.js.map +1 -0
  135. package/dist/internal/testing/runner.d.ts +2 -0
  136. package/dist/internal/testing/runner.d.ts.map +1 -0
  137. package/dist/internal/testing/runner.js +10 -0
  138. package/dist/internal/testing/runner.js.map +1 -0
  139. package/dist/internal/testing/scope.d.ts +109 -0
  140. package/dist/internal/testing/scope.d.ts.map +1 -0
  141. package/dist/internal/testing/scope.js +335 -0
  142. package/dist/internal/testing/scope.js.map +1 -0
  143. package/dist/internal/testing/steps.d.ts +55 -0
  144. package/dist/internal/testing/steps.d.ts.map +1 -0
  145. package/dist/internal/testing/steps.js +295 -0
  146. package/dist/internal/testing/steps.js.map +1 -0
  147. package/dist/internal/testing/telemetry.d.ts +305 -0
  148. package/dist/internal/testing/telemetry.d.ts.map +1 -0
  149. package/dist/internal/testing/telemetry.js +188 -0
  150. package/dist/internal/testing/telemetry.js.map +1 -0
  151. package/dist/internal/utils/constraints.d.ts +1 -0
  152. package/dist/internal/utils/constraints.d.ts.map +1 -0
  153. package/dist/log/index.d.ts +1 -0
  154. package/dist/log/index.d.ts.map +1 -0
  155. package/dist/log/logger.d.ts +2 -0
  156. package/dist/log/logger.d.ts.map +1 -0
  157. package/dist/log/runtime.d.ts +2 -0
  158. package/dist/log/runtime.d.ts.map +1 -0
  159. package/dist/log/stderr.d.ts +1 -0
  160. package/dist/log/stderr.d.ts.map +1 -0
  161. package/dist/metrics/mod.d.ts +45 -118
  162. package/dist/metrics/mod.d.ts.map +1 -0
  163. package/dist/metrics/mod.js +44 -179
  164. package/dist/metrics/mod.js.map +1 -1
  165. package/dist/mod.d.ts +2 -3
  166. package/dist/mod.d.ts.map +1 -0
  167. package/dist/mod.js +0 -1
  168. package/dist/mod.js.map +1 -1
  169. package/dist/otel.d.ts +1 -0
  170. package/dist/otel.d.ts.map +1 -0
  171. package/dist/pubsub/encoding.d.ts +5 -0
  172. package/dist/pubsub/encoding.d.ts.map +1 -0
  173. package/dist/pubsub/encoding.js +10 -2
  174. package/dist/pubsub/encoding.js.map +1 -1
  175. package/dist/pubsub/mod.d.ts +5 -4
  176. package/dist/pubsub/mod.d.ts.map +1 -0
  177. package/dist/pubsub/mod.js +2 -2
  178. package/dist/pubsub/mod.js.map +1 -1
  179. package/dist/pubsub/refs.d.ts +8 -0
  180. package/dist/pubsub/refs.d.ts.map +1 -0
  181. package/dist/pubsub/refs.js.map +1 -1
  182. package/dist/pubsub/subscription.d.ts +110 -15
  183. package/dist/pubsub/subscription.d.ts.map +1 -0
  184. package/dist/pubsub/subscription.js +98 -16
  185. package/dist/pubsub/subscription.js.map +1 -1
  186. package/dist/pubsub/topic.d.ts +101 -31
  187. package/dist/pubsub/topic.d.ts.map +1 -0
  188. package/dist/pubsub/topic.js +168 -51
  189. package/dist/pubsub/topic.js.map +1 -1
  190. package/dist/reqctx/mod.d.ts +174 -0
  191. package/dist/reqctx/mod.d.ts.map +1 -0
  192. package/dist/reqctx/mod.js +144 -0
  193. package/dist/reqctx/mod.js.map +1 -0
  194. package/dist/services/index.d.ts +147 -5
  195. package/dist/services/index.d.ts.map +1 -0
  196. package/dist/services/index.js +157 -9
  197. package/dist/services/index.js.map +1 -1
  198. package/dist/shutdown/mod.d.ts +1 -0
  199. package/dist/shutdown/mod.d.ts.map +1 -0
  200. package/dist/storage/objects/bucket.d.ts +313 -7
  201. package/dist/storage/objects/bucket.d.ts.map +1 -0
  202. package/dist/storage/objects/bucket.js +306 -15
  203. package/dist/storage/objects/bucket.js.map +1 -1
  204. package/dist/storage/objects/error.d.ts +10 -0
  205. package/dist/storage/objects/error.d.ts.map +1 -0
  206. package/dist/storage/objects/error.js +25 -1
  207. package/dist/storage/objects/error.js.map +1 -1
  208. package/dist/storage/objects/mod.d.ts +4 -3
  209. package/dist/storage/objects/mod.d.ts.map +1 -0
  210. package/dist/storage/objects/mod.js +1 -1
  211. package/dist/storage/objects/mod.js.map +1 -1
  212. package/dist/storage/objects/refs.d.ts +20 -4
  213. package/dist/storage/objects/refs.d.ts.map +1 -0
  214. package/dist/storage/objects/refs.js +6 -0
  215. package/dist/storage/objects/refs.js.map +1 -1
  216. package/dist/storage/postgres/database.d.ts +85 -25
  217. package/dist/storage/postgres/database.d.ts.map +1 -0
  218. package/dist/storage/postgres/database.js +129 -37
  219. package/dist/storage/postgres/database.js.map +1 -1
  220. package/dist/storage/postgres/errors.d.ts +120 -0
  221. package/dist/storage/postgres/errors.d.ts.map +1 -0
  222. package/dist/storage/postgres/errors.js +162 -0
  223. package/dist/storage/postgres/errors.js.map +1 -0
  224. package/dist/storage/postgres/interval.d.ts +44 -0
  225. package/dist/storage/postgres/interval.d.ts.map +1 -0
  226. package/dist/storage/postgres/interval.js +153 -0
  227. package/dist/storage/postgres/interval.js.map +1 -0
  228. package/dist/storage/postgres/mod.d.ts +4 -1
  229. package/dist/storage/postgres/mod.d.ts.map +1 -0
  230. package/dist/storage/postgres/mod.js +2 -0
  231. package/dist/storage/postgres/mod.js.map +1 -1
  232. package/dist/storage/redis/bitfield.d.ts +67 -0
  233. package/dist/storage/redis/bitfield.d.ts.map +1 -0
  234. package/dist/storage/redis/bitfield.js +114 -0
  235. package/dist/storage/redis/bitfield.js.map +1 -0
  236. package/dist/storage/redis/command.d.ts +45 -0
  237. package/dist/storage/redis/command.d.ts.map +1 -0
  238. package/dist/storage/redis/command.js +78 -0
  239. package/dist/storage/redis/command.js.map +1 -0
  240. package/dist/storage/redis/commands.d.ts +223 -139
  241. package/dist/storage/redis/commands.d.ts.map +1 -0
  242. package/dist/storage/redis/commands.js +128 -6
  243. package/dist/storage/redis/commands.js.map +1 -1
  244. package/dist/storage/redis/database.d.ts +56 -22
  245. package/dist/storage/redis/database.d.ts.map +1 -0
  246. package/dist/storage/redis/database.js +62 -0
  247. package/dist/storage/redis/database.js.map +1 -1
  248. package/dist/storage/redis/mod.d.ts +31 -4
  249. package/dist/storage/redis/mod.d.ts.map +1 -0
  250. package/dist/storage/redis/mod.js +26 -1
  251. package/dist/storage/redis/mod.js.map +1 -1
  252. package/dist/storage/redis/native.d.ts +8 -0
  253. package/dist/storage/redis/native.d.ts.map +1 -0
  254. package/dist/storage/redis/native.js +10 -0
  255. package/dist/storage/redis/native.js.map +1 -1
  256. package/dist/storage/redis/options.d.ts +1 -0
  257. package/dist/storage/redis/options.d.ts.map +1 -0
  258. package/dist/storage/redis/pubsub.d.ts +2 -0
  259. package/dist/storage/redis/pubsub.d.ts.map +1 -0
  260. package/dist/storage/redis/reply.d.ts +34 -0
  261. package/dist/storage/redis/reply.d.ts.map +1 -0
  262. package/dist/storage/redis/reply.js +40 -1
  263. package/dist/storage/redis/reply.js.map +1 -1
  264. package/dist/storage/redis/scan.d.ts +1 -0
  265. package/dist/storage/redis/scan.d.ts.map +1 -0
  266. package/dist/storage/redis/script.d.ts +1 -0
  267. package/dist/storage/redis/script.d.ts.map +1 -0
  268. package/dist/storage/redis/target.d.ts +5 -3
  269. package/dist/storage/redis/target.d.ts.map +1 -0
  270. package/dist/storage/redis/target.js +39 -28
  271. package/dist/storage/redis/target.js.map +1 -1
  272. package/dist/storage/redis/wire.d.ts +7 -10
  273. package/dist/storage/redis/wire.d.ts.map +1 -0
  274. package/dist/storage/redis/wire.js +8 -32
  275. package/dist/storage/redis/wire.js.map +1 -1
  276. package/dist/testing/bun.d.ts +8 -0
  277. package/dist/testing/bun.d.ts.map +1 -0
  278. package/dist/testing/bun.js +13 -0
  279. package/dist/testing/bun.js.map +1 -0
  280. package/dist/testing/jest.d.ts +8 -0
  281. package/dist/testing/jest.d.ts.map +1 -0
  282. package/dist/testing/jest.js +11 -0
  283. package/dist/testing/jest.js.map +1 -0
  284. package/dist/testing/mod.d.ts +183 -0
  285. package/dist/testing/mod.d.ts.map +1 -0
  286. package/dist/testing/mod.js +271 -0
  287. package/dist/testing/mod.js.map +1 -0
  288. package/dist/testing/node.d.ts +9 -0
  289. package/dist/testing/node.d.ts.map +1 -0
  290. package/dist/testing/node.js +12 -0
  291. package/dist/testing/node.js.map +1 -0
  292. package/dist/testing/playwright.d.ts +93 -0
  293. package/dist/testing/playwright.d.ts.map +1 -0
  294. package/dist/testing/playwright.js +164 -0
  295. package/dist/testing/playwright.js.map +1 -0
  296. package/dist/testing/puppeteer.d.ts +36 -0
  297. package/dist/testing/puppeteer.d.ts.map +1 -0
  298. package/dist/testing/puppeteer.js +70 -0
  299. package/dist/testing/puppeteer.js.map +1 -0
  300. package/dist/testing/system.d.ts +181 -0
  301. package/dist/testing/system.d.ts.map +1 -0
  302. package/dist/testing/system.js +255 -0
  303. package/dist/testing/system.js.map +1 -0
  304. package/dist/testing/vitest.d.ts +8 -0
  305. package/dist/testing/vitest.d.ts.map +1 -0
  306. package/dist/testing/vitest.js +13 -0
  307. package/dist/testing/vitest.js.map +1 -0
  308. package/dist/tracing/http.d.ts +11 -0
  309. package/dist/tracing/http.d.ts.map +1 -0
  310. package/dist/tracing/http.js +34 -0
  311. package/dist/tracing/http.js.map +1 -0
  312. package/dist/tracing/mod.d.ts +20 -0
  313. package/dist/tracing/mod.d.ts.map +1 -0
  314. package/dist/tracing/mod.js +47 -0
  315. package/dist/tracing/mod.js.map +1 -0
  316. package/dist/tracing/node.d.ts +10 -0
  317. package/dist/tracing/node.d.ts.map +1 -0
  318. package/dist/tracing/node.js +142 -0
  319. package/dist/tracing/node.js.map +1 -0
  320. package/dist/tsconfig.build.tsbuildinfo +1 -1
  321. package/dist/types/mod.d.ts +1 -0
  322. package/dist/types/mod.d.ts.map +1 -0
  323. package/frontends/mod.test.ts +51 -0
  324. package/frontends/mod.ts +50 -0
  325. package/gateway/errors.ts +172 -0
  326. package/gateway/gateway.e2e.test.ts +297 -0
  327. package/gateway/gateway.test.ts +891 -0
  328. package/gateway/match.ts +239 -0
  329. package/gateway/middleware.ts +134 -0
  330. package/gateway/mod.ts +211 -0
  331. package/gateway/request.ts +578 -0
  332. package/gateway/serve.ts +738 -0
  333. package/gateways/mod.ts +60 -0
  334. package/internal/clients/call.ts +389 -0
  335. package/internal/clients/grpc.test.ts +368 -0
  336. package/internal/clients/grpc.ts +485 -0
  337. package/internal/clients/mod.test.ts +464 -0
  338. package/internal/clients/mod.ts +337 -0
  339. package/internal/fetch.ts +287 -0
  340. package/internal/otel/http.ts +91 -0
  341. package/internal/otel/index.ts +1 -7
  342. package/internal/otel/provider.ts +3 -0
  343. package/internal/otel/span.ts +31 -2
  344. package/internal/otel/tracer.test.ts +43 -15
  345. package/internal/otel/tracer.ts +12 -5
  346. package/internal/reqfields.ts +423 -0
  347. package/internal/runtime/mod.ts +41 -2
  348. package/internal/runtime/napi/napi.cjs +192 -16
  349. package/internal/runtime/napi/napi.d.cts +573 -33
  350. package/internal/runtime/shutdown.ts +11 -1
  351. package/internal/testing/carry.test.ts +242 -0
  352. package/internal/testing/carry.ts +101 -0
  353. package/internal/testing/runner.ts +10 -0
  354. package/internal/testing/scope.ts +372 -0
  355. package/internal/testing/steps.test.ts +152 -0
  356. package/internal/testing/steps.ts +342 -0
  357. package/internal/testing/telemetry.test.ts +210 -0
  358. package/internal/testing/telemetry.ts +466 -0
  359. package/metrics/mod.test.ts +13 -16
  360. package/metrics/mod.ts +57 -226
  361. package/mod.ts +1 -8
  362. package/otel.test.ts +13 -6
  363. package/package.json +92 -15
  364. package/pubsub/encoding.ts +11 -1
  365. package/pubsub/mod.ts +16 -4
  366. package/pubsub/pubsub.test.ts +233 -14
  367. package/pubsub/refs.ts +16 -0
  368. package/pubsub/subscription.ts +200 -21
  369. package/pubsub/topic.test.ts +26 -0
  370. package/pubsub/topic.ts +255 -36
  371. package/reqctx/mod.ts +267 -0
  372. package/reqctx/reqctx.test.ts +216 -0
  373. package/scripts/postprocess-docs.test.ts +58 -0
  374. package/services/index.test.ts +341 -1
  375. package/services/index.ts +185 -9
  376. package/storage/objects/bucket.test.ts +573 -0
  377. package/storage/objects/bucket.ts +650 -20
  378. package/storage/objects/error.ts +28 -1
  379. package/storage/objects/mod.ts +15 -0
  380. package/storage/objects/refs.ts +51 -3
  381. package/storage/postgres/database.integration.test.ts +275 -0
  382. package/storage/postgres/database.test.ts +193 -6
  383. package/storage/postgres/database.ts +206 -55
  384. package/storage/postgres/errors.ts +186 -0
  385. package/storage/postgres/interval.test.ts +72 -0
  386. package/storage/postgres/interval.ts +170 -0
  387. package/storage/postgres/mod.ts +4 -0
  388. package/storage/redis/bitfield.ts +162 -0
  389. package/storage/redis/command.ts +84 -0
  390. package/storage/redis/commands.ts +271 -21
  391. package/storage/redis/database.ts +77 -23
  392. package/storage/redis/mod.ts +38 -2
  393. package/storage/redis/native.ts +11 -0
  394. package/storage/redis/redis.test.ts +170 -10
  395. package/storage/redis/reply.ts +76 -1
  396. package/storage/redis/runtime.test.ts +15 -0
  397. package/storage/redis/target.ts +47 -44
  398. package/storage/redis/wire.ts +8 -32
  399. package/testing/bun.ts +13 -0
  400. package/testing/jest.ts +11 -0
  401. package/testing/mod.ts +393 -0
  402. package/testing/node.ts +12 -0
  403. package/testing/playwright.ts +247 -0
  404. package/testing/puppeteer.ts +101 -0
  405. package/testing/system.test.ts +108 -0
  406. package/testing/system.ts +373 -0
  407. package/testing/vitest.ts +13 -0
  408. package/tracing/http.ts +49 -0
  409. package/tracing/mod.ts +83 -0
  410. package/tracing/native.test.ts +267 -0
  411. package/tracing/node.ts +176 -0
  412. package/tracing/tracing.test.ts +953 -0
  413. package/dist/internal/otel/request_context.d.ts +0 -11
  414. package/dist/internal/otel/request_context.js +0 -20
  415. package/dist/internal/otel/request_context.js.map +0 -1
  416. package/dist/internal/reqtrack/mod.d.ts +0 -6
  417. package/dist/internal/reqtrack/mod.js +0 -28
  418. package/dist/internal/reqtrack/mod.js.map +0 -1
  419. package/dist/req_meta.d.ts +0 -47
  420. package/dist/req_meta.js +0 -26
  421. package/dist/req_meta.js.map +0 -1
  422. package/internal/otel/request_context.ts +0 -32
  423. package/internal/reqtrack/mod.ts +0 -39
  424. package/req_meta.ts +0 -75
@@ -0,0 +1,237 @@
1
+ /**
2
+ * What the service clients Encore generates call through: a service, looked
3
+ * up on the first call that needs it, and its HTTP calls. For the generated
4
+ * code: it may change with the generator. Code calling the clients takes
5
+ * their errors and options from `@encore.dev/sdk/services`.
6
+ *
7
+ * Nothing here loads the runtime until a call needs a service's base URL, so
8
+ * a generated client given a `baseUrl` runs without Encore, as against a
9
+ * mock server in a plain test.
10
+ *
11
+ * @hidden
12
+ * @module
13
+ */
14
+ import { CallError, callHeaders, deadline, errorBody, errorText, failure, fetchFor, httpStatus, isErrCode, } from './call.js';
15
+ export { CallError, } from './call.js';
16
+ /**
17
+ * A service the generated clients call, looked up on the first call that
18
+ * needs its base URL. For the generated code: it may change with the
19
+ * generator.
20
+ *
21
+ * @hidden
22
+ */
23
+ export class Service {
24
+ name;
25
+ /** The base URL, once looked up. */
26
+ base;
27
+ constructor(name) {
28
+ this.name = name;
29
+ }
30
+ /**
31
+ * The base URL calls made with `client` go to, without a trailing slash:
32
+ * its `baseUrl`, else the one Encore gives the service.
33
+ */
34
+ async baseUrl(client) {
35
+ if (client.baseUrl !== undefined)
36
+ return client.baseUrl.replace(/\/+$/, '');
37
+ // A failed lookup is tried again by the next call.
38
+ this.base ??= lookup(this.name).catch((err) => {
39
+ this.base = undefined;
40
+ throw err;
41
+ });
42
+ return this.base;
43
+ }
44
+ /** Sends `call`, and decodes its answer from JSON. */
45
+ async json(client, options, call) {
46
+ return this.send(client, options, call, async (res) => {
47
+ const text = await res.text();
48
+ // An empty answer is JSON's `null`.
49
+ if (text === '')
50
+ return null;
51
+ try {
52
+ return JSON.parse(text);
53
+ }
54
+ catch (err) {
55
+ throw failure('internal', `decoding the answer: ${errorText(err)}`, err);
56
+ }
57
+ });
58
+ }
59
+ /** Sends `call`, and reads its answer's body. */
60
+ async bytes(client, options, call) {
61
+ return this.send(client, options, call, async (res) => new Uint8Array(await res.arrayBuffer()));
62
+ }
63
+ /** Sends `call`, and drops its answer. */
64
+ async empty(client, options, call) {
65
+ await this.send(client, options, call, async (res) => {
66
+ await res.body?.cancel();
67
+ });
68
+ }
69
+ /**
70
+ * Sends GraphQL `document` with `variables` to the service's `path`, and
71
+ * returns the answer's `field` of its data. A variable left `undefined` is
72
+ * left out, which a `null` is not. A `required` field missing or null fails
73
+ * the call with `internal`.
74
+ */
75
+ async graphql(client, options, path, document, variables, field, required = false) {
76
+ const call = {
77
+ method: 'POST',
78
+ path,
79
+ json: { query: document, variables },
80
+ };
81
+ return this.exchange(client, options, call, async (res) => {
82
+ const text = await res.text();
83
+ let envelope;
84
+ try {
85
+ const parsed = JSON.parse(text);
86
+ if (typeof parsed === 'object' && parsed !== null) {
87
+ envelope = parsed;
88
+ }
89
+ }
90
+ catch {
91
+ envelope = undefined;
92
+ }
93
+ const errors = envelope?.errors;
94
+ if (errors !== undefined &&
95
+ errors !== null &&
96
+ !(Array.isArray(errors) && errors.length === 0)) {
97
+ throw graphqlError(errors, res.status);
98
+ }
99
+ if (!res.ok)
100
+ throw errorBody(res, text);
101
+ const data = envelope?.data;
102
+ if (data === undefined || data === null) {
103
+ throw failure('unknown', 'graphql: the answer has neither data nor errors');
104
+ }
105
+ const value = data[field] ?? null;
106
+ if (value === null && required) {
107
+ throw failure('internal', `graphql: the answer's ${field} is missing or null`);
108
+ }
109
+ return value;
110
+ });
111
+ }
112
+ /** Sends `call`, failing on an error answer, and reads the answer with
113
+ * `read`. */
114
+ async send(client, options, call, read) {
115
+ return this.exchange(client, options, call, async (res) => {
116
+ if (!res.ok)
117
+ throw errorBody(res, await res.text());
118
+ return read(res);
119
+ });
120
+ }
121
+ /** Sends `call` and reads its answer with `read`, under the call's
122
+ * timeout and signal, which cover the answer's body too. */
123
+ async exchange(client, options, call, read) {
124
+ const limit = deadline(client, options);
125
+ try {
126
+ let url = (await this.baseUrl(client)) + call.path;
127
+ const query = new URLSearchParams();
128
+ for (const [name, value] of call.query ?? []) {
129
+ for (const v of Array.isArray(value) ? value : [value]) {
130
+ if (v !== undefined && v !== null)
131
+ query.append(name, paramText(v));
132
+ }
133
+ }
134
+ const qs = query.toString();
135
+ if (qs !== '')
136
+ url += `?${qs}`;
137
+ const params = [];
138
+ for (const [name, value] of call.headers ?? []) {
139
+ if (value !== undefined && value !== null) {
140
+ params.push([name, paramText(value)]);
141
+ }
142
+ }
143
+ const headers = callHeaders(client, options, params);
144
+ let body;
145
+ if (call.json !== undefined) {
146
+ headers.set('Content-Type', 'application/json');
147
+ try {
148
+ body = JSON.stringify(call.json);
149
+ }
150
+ catch (err) {
151
+ // A cycle, or a BigInt, which JSON has no form for.
152
+ throw failure('invalid_argument', `encoding the body: ${errorText(err)}`, err);
153
+ }
154
+ }
155
+ else if (call.body !== undefined) {
156
+ if (call.contentType !== undefined) {
157
+ headers.set('Content-Type', call.contentType);
158
+ }
159
+ // TS ≥5.7's Uint8Array<ArrayBufferLike> is no BodyInit, though fetch
160
+ // takes one.
161
+ body = call.body;
162
+ }
163
+ let res;
164
+ try {
165
+ res = await fetchFor(client)(url, {
166
+ method: call.method,
167
+ headers,
168
+ body,
169
+ signal: limit.signal,
170
+ });
171
+ }
172
+ catch (err) {
173
+ throw limit.error(err, `${call.method} ${shownUrl(url)}`, 'unavailable');
174
+ }
175
+ try {
176
+ return await read(res);
177
+ }
178
+ catch (err) {
179
+ if (err instanceof CallError)
180
+ throw err;
181
+ throw limit.error(err, 'reading the answer', 'unavailable');
182
+ }
183
+ }
184
+ finally {
185
+ limit.done();
186
+ }
187
+ }
188
+ }
189
+ /**
190
+ * The service named `name`, looked up on the first call that needs it. For
191
+ * the generated code: it may change with the generator.
192
+ *
193
+ * @hidden
194
+ */
195
+ export function service(name) {
196
+ return new Service(name);
197
+ }
198
+ /** The base URL Encore gives `name`: the services module, and with it the
199
+ * runtime, is loaded only now, so a client given a `baseUrl` runs without
200
+ * Encore. */
201
+ async function lookup(name) {
202
+ try {
203
+ const services = await import('../../services/index.js');
204
+ return services.baseUrl(name);
205
+ }
206
+ catch (err) {
207
+ throw failure('unavailable', `encore: no base URL is known for service ${JSON.stringify(name)}: ${errorText(err)}`, err);
208
+ }
209
+ }
210
+ /** `url` as an error shows it: without its query, fragment or credentials,
211
+ * which may hold secrets, as an error that escapes a handler is logged. */
212
+ function shownUrl(url) {
213
+ return url
214
+ .replace(/[?#].*$/s, '')
215
+ .replace(/^([a-z][a-z0-9+.-]*:\/\/)[^/@]*@/i, '$1');
216
+ }
217
+ /** A parameter's text: a structured one as JSON. */
218
+ function paramText(value) {
219
+ return typeof value === 'object' ? JSON.stringify(value) : String(value);
220
+ }
221
+ /** The error a GraphQL answer with `errors` in it is. */
222
+ function graphqlError(errors, status) {
223
+ const list = (Array.isArray(errors) ? errors : [errors]).map(e => typeof e === 'object' && e !== null && !Array.isArray(e)
224
+ ? e
225
+ : { message: JSON.stringify(e) });
226
+ const first = list[0]?.extensions?.['code'];
227
+ const lower = typeof first === 'string' ? first.toLowerCase() : undefined;
228
+ const code = isErrCode(lower) ? lower : 'unknown';
229
+ const message = list
230
+ .map(e => (typeof e.message === 'string' ? e.message : ''))
231
+ .join('; ');
232
+ return new CallError(code, message, {
233
+ status: status >= 400 ? status : httpStatus(code),
234
+ graphqlErrors: list,
235
+ });
236
+ }
237
+ //# sourceMappingURL=mod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.js","sourceRoot":"","sources":["../../../internal/clients/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,SAAS,E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3
+ * the trace and Request Context: apart from the module looking services up,
4
+ * so what sends calls loads without the runtime, as a generated client
5
+ * pointed at a mock server does.
6
+ *
7
+ * @module
8
+ */
9
+ /**
10
+ * The global `fetch`, carrying the trace and Request Context of the active
11
+ * context to the app's services.
12
+ *
13
+ * A request for one of the app's services gets the active context's Request
14
+ * Context fields, in place of any its headers carried, and the active span's
15
+ * W3C `traceparent` and `tracestate`, unless it carries a `traceparent`
16
+ * already, as an instrumented client's does: Encore records the call's span
17
+ * where it reaches the service. A request to anything else goes without any
18
+ * Request Context headers, even those copied from a request the service
19
+ * received.
20
+ *
21
+ * A request is for the app's services when its URL is at the origin of a
22
+ * base URL `baseUrl`, `serviceUrl` or `client` of `@encore.dev/sdk/services`
23
+ * returned in this process, as every service URL is made from one.
24
+ *
25
+ * In a system test (`system` of `@encore.dev/sdk/testing`) a request also
26
+ * carries the test it is made for: the test's id, as a Request Context
27
+ * field, and the test's span where the context has none.
28
+ *
29
+ * A request made in a context with a trace or Request Context follows its
30
+ * redirects here, rather than in the global `fetch`, so that each is sent
31
+ * what its own URL is due: a redirect away from the app's services carries
32
+ * no Request Context, and one to them carries the context's. It follows them
33
+ * by fetch's own rules for each status, and its response's `url` and
34
+ * `redirected` say where it ended. A `Request`'s body is streamed, not read
35
+ * first, so a 307 or 308 that would send it again fails, as fetch's does for
36
+ * a streamed body.
37
+ *
38
+ * @example
39
+ * import {fetch} from "@encore.dev/sdk/services";
40
+ * const res = await fetch(`${baseUrl("orders")}/orders/1`);
41
+ */
42
+ export declare const fetch: typeof globalThis.fetch;
43
+ /**
44
+ * `base`, sending the trace and Request Context of the active context to the
45
+ * app's services as {@link fetch} does: for a `fetch` of the app's own, as an
46
+ * instrumented or retrying one. Without `base`, the global `fetch`, looked up
47
+ * at each call.
48
+ *
49
+ * @example
50
+ * import {wrapFetch} from "@encore.dev/sdk/services";
51
+ * const tracedFetch = wrapFetch(instrumentedFetch);
52
+ */
53
+ export declare function wrapFetch(base?: typeof globalThis.fetch): typeof globalThis.fetch;
54
+ /** Records `base`, a service's base URL looked up in this process, as one
55
+ * of the app's services': a request for its origin is sent the trace and
56
+ * Request Context. */
57
+ export declare function recordOrigin(base: string): void;
58
+ //# sourceMappingURL=fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../internal/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,KAAK,EAAE,OAAO,UAAU,CAAC,KAAmB,CAAC;AAE1D;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CACvB,IAAI,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,GAC7B,OAAO,UAAU,CAAC,KAAK,CAuBzB;AA4BD;;sBAEsB;AACtB,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAG/C"}
@@ -0,0 +1,251 @@
1
+ /**
2
+ * The `fetch` of `@encore.dev/sdk/services`, which sends the app's services
3
+ * the trace and Request Context: apart from the module looking services up,
4
+ * so what sends calls loads without the runtime, as a generated client
5
+ * pointed at a mock server does.
6
+ *
7
+ * @module
8
+ */
9
+ import { isSpanContextValid, trace } from '@opentelemetry/api';
10
+ import { activeContext } from './otel/context.js';
11
+ import { W3CPropagator } from './otel/propagator.js';
12
+ import * as reqfields from './reqfields.js';
13
+ import { outgoingContext, outgoingContextIfKnown } from './testing/carry.js';
14
+ /**
15
+ * The global `fetch`, carrying the trace and Request Context of the active
16
+ * context to the app's services.
17
+ *
18
+ * A request for one of the app's services gets the active context's Request
19
+ * Context fields, in place of any its headers carried, and the active span's
20
+ * W3C `traceparent` and `tracestate`, unless it carries a `traceparent`
21
+ * already, as an instrumented client's does: Encore records the call's span
22
+ * where it reaches the service. A request to anything else goes without any
23
+ * Request Context headers, even those copied from a request the service
24
+ * received.
25
+ *
26
+ * A request is for the app's services when its URL is at the origin of a
27
+ * base URL `baseUrl`, `serviceUrl` or `client` of `@encore.dev/sdk/services`
28
+ * returned in this process, as every service URL is made from one.
29
+ *
30
+ * In a system test (`system` of `@encore.dev/sdk/testing`) a request also
31
+ * carries the test it is made for: the test's id, as a Request Context
32
+ * field, and the test's span where the context has none.
33
+ *
34
+ * A request made in a context with a trace or Request Context follows its
35
+ * redirects here, rather than in the global `fetch`, so that each is sent
36
+ * what its own URL is due: a redirect away from the app's services carries
37
+ * no Request Context, and one to them carries the context's. It follows them
38
+ * by fetch's own rules for each status, and its response's `url` and
39
+ * `redirected` say where it ended. A `Request`'s body is streamed, not read
40
+ * first, so a 307 or 308 that would send it again fails, as fetch's does for
41
+ * a streamed body.
42
+ *
43
+ * @example
44
+ * import {fetch} from "@encore.dev/sdk/services";
45
+ * const res = await fetch(`${baseUrl("orders")}/orders/1`);
46
+ */
47
+ export const fetch = wrapFetch();
48
+ /**
49
+ * `base`, sending the trace and Request Context of the active context to the
50
+ * app's services as {@link fetch} does: for a `fetch` of the app's own, as an
51
+ * instrumented or retrying one. Without `base`, the global `fetch`, looked up
52
+ * at each call.
53
+ *
54
+ * @example
55
+ * import {wrapFetch} from "@encore.dev/sdk/services";
56
+ * const tracedFetch = wrapFetch(instrumentedFetch);
57
+ */
58
+ export function wrapFetch(base) {
59
+ const send = base ?? ((input, init) => globalThis.fetch(input, init));
60
+ return withMembersOfGlobalFetch(async (input, init) => {
61
+ const request = input instanceof Request ? input : undefined;
62
+ const url = request?.url ?? String(input);
63
+ const headers = new Headers(init?.headers ?? request?.headers);
64
+ // In a system test, the context with the test added: its calls carry
65
+ // the test's id, and continue its span where they have none. A call
66
+ // to a service whose test cannot be told is refused; one to anything
67
+ // else carries no test anyway.
68
+ const ctx = origins.has(originOf(url) ?? '')
69
+ ? outgoingContext(activeContext())
70
+ : outgoingContextIfKnown(activeContext());
71
+ prepare(url, headers, ctx);
72
+ const redirect = init?.redirect ?? request?.redirect ?? 'follow';
73
+ if (!hasContext(ctx) || redirect !== 'follow') {
74
+ return send(input, { ...init, headers });
75
+ }
76
+ return followRedirects(send, url, initOf(request, init), headers, ctx);
77
+ }, base ?? globalThis.fetch);
78
+ }
79
+ /** `fn` with the members `base` has besides its call, as Bun's global
80
+ * `preconnect`, so it is a `typeof fetch` wherever the global is. */
81
+ function withMembersOfGlobalFetch(fn, base) {
82
+ const global = base;
83
+ const out = fn;
84
+ for (const key of Object.getOwnPropertyNames(global)) {
85
+ if (!(key in out))
86
+ out[key] = global[key];
87
+ }
88
+ return fn;
89
+ }
90
+ /** The origins of the base URLs looked up in this process: where the app's
91
+ * services are reached. Every service URL is the egress endpoint's, or
92
+ * locally the run proxy's, plus the service's path; nothing else is served
93
+ * at either. */
94
+ const origins = new Set();
95
+ /** Records `base`, a service's base URL looked up in this process, as one
96
+ * of the app's services': a request for its origin is sent the trace and
97
+ * Request Context. */
98
+ export function recordOrigin(base) {
99
+ const origin = originOf(base);
100
+ if (origin !== undefined)
101
+ origins.add(origin);
102
+ }
103
+ const DEFAULT_PORTS = { 'http:': '80', 'https:': '443' };
104
+ /** `url`'s scheme, host and port, with the scheme's default port when it
105
+ * has none; `undefined` when it is not a URL. */
106
+ function originOf(url) {
107
+ let u;
108
+ try {
109
+ u = new URL(url);
110
+ }
111
+ catch {
112
+ return undefined;
113
+ }
114
+ if (u.hostname === '')
115
+ return undefined;
116
+ const port = u.port || DEFAULT_PORTS[u.protocol] || '';
117
+ return `${u.protocol}//${u.hostname}:${port}`;
118
+ }
119
+ const w3c = new W3CPropagator();
120
+ const setter = { set: (h, k, v) => h.set(k, v) };
121
+ /**
122
+ * Sets the trace and Request Context of `ctx` on a request to `url`: drops
123
+ * the Request Context headers it carried, then, when it is for one of the
124
+ * app's services, sets the context's fields and, unless it carries one, its
125
+ * `traceparent`.
126
+ */
127
+ function prepare(url, headers, ctx) {
128
+ if (!origins.has(originOf(url) ?? '')) {
129
+ const stale = [];
130
+ headers.forEach((_, name) => {
131
+ if (name.toLowerCase().startsWith(reqfields.HEADER_PREFIX))
132
+ stale.push(name);
133
+ });
134
+ for (const name of stale)
135
+ headers.delete(name);
136
+ return;
137
+ }
138
+ reqfields.toHeaders(headers, ctx);
139
+ const span = trace.getSpanContext(ctx);
140
+ if (!headers.has('traceparent') && span && isSpanContextValid(span)) {
141
+ // A tracestate the request carried belongs to another trace's
142
+ // traceparent: the span's own, with Encore's mark, replaces it.
143
+ headers.delete('tracestate');
144
+ w3c.inject(ctx, headers, setter);
145
+ }
146
+ }
147
+ /** Whether `ctx` holds a trace or Request Context to send. */
148
+ function hasContext(ctx) {
149
+ const span = trace.getSpanContext(ctx);
150
+ return ((span !== undefined && isSpanContextValid(span)) ||
151
+ Object.keys(reqfields.current(ctx)).length > 0);
152
+ }
153
+ /** The statuses a redirect is answered with. */
154
+ const REDIRECTS = new Set([301, 302, 303, 307, 308]);
155
+ /** As many redirects as fetch follows. */
156
+ const MAX_REDIRECTS = 20;
157
+ /** The headers that describe a body, dropped with it. */
158
+ const BODY_HEADERS = [
159
+ 'content-encoding',
160
+ 'content-language',
161
+ 'content-location',
162
+ 'content-type',
163
+ 'content-length',
164
+ ];
165
+ /** The headers a redirect to another origin drops, as fetch does. */
166
+ const CREDENTIAL_HEADERS = ['authorization', 'cookie', 'proxy-authorization'];
167
+ /** `init` with what `request`, if any, says and `init` does not. Its body
168
+ * is streamed, not read first: a redirect that would send it again fails, as
169
+ * fetch's does for a streamed body. */
170
+ function initOf(request, init) {
171
+ if (request === undefined)
172
+ return { ...init };
173
+ const out = {
174
+ method: request.method,
175
+ signal: request.signal,
176
+ credentials: request.credentials,
177
+ keepalive: request.keepalive,
178
+ body: init?.body === undefined ? request.body : undefined,
179
+ };
180
+ // The fetch policies a Request has where the runtime has them: Node's and
181
+ // Bun's types disagree on which.
182
+ const policies = request;
183
+ for (const key of POLICIES) {
184
+ if (policies[key] !== undefined)
185
+ out[key] = policies[key];
186
+ }
187
+ // An option set to `undefined` is not given, as fetch takes it.
188
+ for (const [key, value] of Object.entries(init ?? {})) {
189
+ if (value !== undefined)
190
+ out[key] = value;
191
+ }
192
+ return out;
193
+ }
194
+ /** The fetch policies of a Request a redirect followed here keeps. */
195
+ const POLICIES = ['cache', 'integrity', 'mode', 'referrer', 'referrerPolicy'];
196
+ /** `res`, the answer to the last of a request's redirects, at `url`, saying
197
+ * so as fetch's own would. */
198
+ function redirected(res, url) {
199
+ return Object.defineProperties(res, {
200
+ url: { value: url, enumerable: true },
201
+ redirected: { value: true, enumerable: true },
202
+ });
203
+ }
204
+ /**
205
+ * Sends a request and follows the redirects it is answered with, as fetch's
206
+ * `redirect: "follow"` does, preparing the headers of each for its own URL
207
+ * in `ctx`, the context the call was made in.
208
+ */
209
+ async function followRedirects(send, url, init, headers, ctx) {
210
+ let method = (init.method ?? 'GET').toUpperCase();
211
+ let body = init.body ?? null;
212
+ for (let redirects = 0;; redirects++) {
213
+ const res = await send(url, {
214
+ ...init,
215
+ method,
216
+ body,
217
+ headers,
218
+ redirect: 'manual',
219
+ // Node sends a streamed body only half-duplex, and says so.
220
+ ...(body instanceof ReadableStream ? { duplex: 'half' } : {}),
221
+ });
222
+ const location = res.headers.get('location');
223
+ if (!REDIRECTS.has(res.status) || location === null) {
224
+ return redirects === 0 ? res : redirected(res, url);
225
+ }
226
+ if (redirects === MAX_REDIRECTS) {
227
+ await res.body?.cancel();
228
+ throw new TypeError(`fetch failed: more than ${MAX_REDIRECTS} redirects`);
229
+ }
230
+ const next = new URL(location, url).href;
231
+ if (((res.status === 301 || res.status === 302) && method === 'POST') ||
232
+ (res.status === 303 && method !== 'GET' && method !== 'HEAD')) {
233
+ method = 'GET';
234
+ body = null;
235
+ for (const name of BODY_HEADERS)
236
+ headers.delete(name);
237
+ }
238
+ else if (body instanceof ReadableStream) {
239
+ await res.body?.cancel();
240
+ throw new TypeError('fetch failed: a redirect cannot send a streamed body again');
241
+ }
242
+ if (originOf(next) !== originOf(url)) {
243
+ for (const name of CREDENTIAL_HEADERS)
244
+ headers.delete(name);
245
+ }
246
+ await res.body?.cancel();
247
+ url = next;
248
+ prepare(url, headers, ctx);
249
+ }
250
+ }
251
+ //# sourceMappingURL=fetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../internal/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAC,kBAAkB,EAAE,KAAK,EAAe,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,EAAC,eAAe,EAAE,sBAAsB,EAAC,MAAM,iBAAiB,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,MAAM,KAAK,GAA4B,SAAS,EAAE,CAAC;AAE1D;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CACvB,IAA8B;IAE9B,MAAM,IAAI,GAAS,IAAI,IAAI,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAC5E,OAAO,wBAAwB,CAC7B,KAAK,EAAE,KAA6B,EAAE,IAAkB,EAAE,EAAE;QAC1D,MAAM,OAAO,GAAG,KAAK,YAAY,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QAC7D,MAAM,GAAG,GAAG,OAAO,EAAE,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1C,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,IAAI,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/D,qEAAqE;QACrE,oEAAoE;QACpE,qEAAqE;QACrE,+BAA+B;QAC/B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,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GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC;QACzC,IACE,CAAC,CAAC,GAAG,CAAC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,IAAI,MAAM,KAAK,MAAM,CAAC;YACjE,CAAC,GAAG,CAAC,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,MAAM,CAAC,EAC7D,CAAC;YACD,MAAM,GAAG,KAAK,CAAC;YACf,IAAI,GAAG,IAAI,CAAC;YACZ,KAAK,MAAM,IAAI,IAAI,YAAY;gBAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACxD,CAAC;aAAM,IAAI,IAAI,YAAY,cAAc,EAAE,CAAC;YAC1C,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;YACzB,MAAM,IAAI,SAAS,CACjB,4DAA4D,CAC7D,CAAC;QACJ,CAAC;QACD,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACrC,KAAK,MAAM,IAAI,IAAI,kBAAkB;gBAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC9D,CAAC;QACD,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;QACzB,GAAG,GAAG,IAAI,CAAC;QACX,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  /** The runtime's span calls (the napi `Pipeline` class). */
3
4
  export interface Backend {
4
5
  /** `parent`: 25-byte context. `packed`: start scope, attributes, and
@@ -48,3 +49,4 @@ export interface MeterBackend {
48
49
  /** Adds this thread's collector, called once per collection. */
49
50
  addCollector(collect: (reply: CollectReply) => void): void;
50
51
  }
52
+ //# sourceMappingURL=backend.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QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;yEACqE;IACrE,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CAC9D;AAED,gEAAgE;AAChE,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,IAAI,EAAE,iBAAiB,GAAG,gBAAgB,CAAC;IACtD,gEAAgE;IAChE,YAAY,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI,CAAC;CAC5D"}
@@ -8,3 +8,4 @@ export declare function activeContext(): Context;
8
8
  /** Runs `fn` with `ctx` active, in Encore's context manager too when it is
9
9
  * not the global. */
10
10
  export declare function withContext<T>(ctx: Context, fn: () => T): T;
11
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../internal/otel/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,OAAO,EACb,MAAM,oBAAoB,CAAC;AAoB5B;2EAC2E;AAC3E,wBAAgB,qBAAqB,IAAI,OAAO,CAK/C;AAED;4CAC4C;AAC5C,wBAAgB,aAAa,IAAI,OAAO,CAGvC;AAED;qBACqB;AACrB,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAI3D"}
@@ -20,3 +20,4 @@ export declare class ContextManager implements ApiContextManager {
20
20
  enable(): this;
21
21
  disable(): this;
22
22
  }
23
+ //# sourceMappingURL=context_manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context_manager.d.ts","sourceRoot":"","sources":["../../../internal/otel/context_manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,cAAc,IAAI,iBAAiB,EACzC,MAAM,oBAAoB,CAAC;AAgB5B;gBACgB;AAChB,qBAAa,cAAe,YAAW,iBAAiB;IACtD,OAAO,CAAC,GAAG,CAAoC;IAC/C,yCAAyC;IACzC,OAAO,CAAC,OAAO,CAAyC;IACxD;8CAC0C;IAC1C,OAAO,CAAC,MAAM,CAAS;IAEvB,MAAM,IAAI,OAAO;IAIjB,IAAI,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,EAC/D,GAAG,EAAE,OAAO,EACZ,EAAE,EAAE,CAAC,EACL,OAAO,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAC9B,GAAG,IAAI,EAAE,CAAC,GACT,UAAU,CAAC,CAAC,CAAC;IAKhB;2EACuE;IACvE,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC;IAiBnC,OAAO,CAAC,WAAW;IAsBnB,OAAO,CAAC,QAAQ;IAuBhB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,cAAc;IAYtB,MAAM,IAAI,IAAI;IAId,OAAO,IAAI,IAAI;CAIhB"}
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import type { Attributes, Link, SpanContext, TimeInput } from '@opentelemetry/api';
3
4
  export declare const VERSION = 1;
4
5
  export declare const HEADER_LEN = 120;
@@ -110,3 +111,4 @@ export declare function isTimeInput(t: unknown): t is TimeInput;
110
111
  * the OTel SDK. */
111
112
  export declare function timeToUnixNanos(t: TimeInput): bigint;
112
113
  export {};
114
+ //# sourceMappingURL=encode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../internal/otel/encode.ts"],"names":[],"mappings":";;AAGA,OAAO,KAAK,EACV,UAAU,EAEV,IAAI,EACJ,WAAW,EACX,SAAS,EACV,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MA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O,CAAC,SAAS;IAejB,MAAM,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM;IAwB/B;oEACgE;IAChE,OAAO,CAAC,IAAI;CAgGb;AAED,gDAAgD;AAChD,wBAAgB,QAAQ,CAAC,EAAE,EAAE,WAAW,GAAG,MAAM,CAMhD;AAYD,yEAAyE;AACzE,wBAAgB,WAAW,CACzB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,UAAU,GAAG,SAAS,EAC7B,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,SAAS,GACjC,MAAM,CAIR;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED,0CAA0C;AAC1C,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC;IAC/B,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;CACxB;AAED,yCAAyC;AACzC,wBAAgB,SAAS,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAKrD;AAKD,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAWD,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,SAAS,CAEtD;AAOD;;mBAEmB;AACnB,wBAAgB,eAAe,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAKpD"}
@@ -0,0 +1,11 @@
1
+ /// <reference types="node" />
2
+ import { type Span, type TextMapGetter } from '@opentelemetry/api';
3
+ import { type HeaderSource } from '../../reqctx/mod.js';
4
+ export declare function startHTTPSpan<Headers extends HeaderSource>(headers: Headers, getter: TextMapGetter<Headers>, requestMethod: string, url: URL): {
5
+ span: Span;
6
+ context: import("@opentelemetry/api").Context;
7
+ };
8
+ export declare function recordHTTPStatus(span: Span, status: number): void;
9
+ export declare function recordHTTPError(span: Span, error: unknown): void;
10
+ export declare function recordHTTPConnectionClosed(span: Span): void;
11
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../internal/otel/http.ts"],"names":[],"mappings":";AAAA,OAAO,EAML,KAAK,IAAI,EACT,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAU,KAAK,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAgB5D,wBAAgB,aAAa,CAAC,OAAO,SAAS,YAAY,EACxD,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,EAC9B,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,GAAG;;;EAiCT;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAMjE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAYhE;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAG3D"}