@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,47 @@
1
+ /**
2
+ * Where the app's frontends are reached.
3
+ *
4
+ * {@link url} is a frontend's URL in the environment the code runs in, as to
5
+ * send a user there or to build a link to one of its pages:
6
+ *
7
+ * ```ts
8
+ * import * as frontends from '@encore.dev/sdk/frontends';
9
+ *
10
+ * const reset = `${frontends.url('web')}/reset?token=${token}`;
11
+ * ```
12
+ *
13
+ * Looking a frontend's URL up links the calling service to it. Encore reads
14
+ * the link from the code, as it reads which services a service depends on: so
15
+ * the name must be a string literal, written as the frontend declares it, the
16
+ * function must be called directly rather than passed around, and the call
17
+ * must be in a service.
18
+ *
19
+ * @module
20
+ */
21
+ import { appMeta } from '../app_meta.js';
22
+ /**
23
+ * The URL `frontend` is reached at in this environment, without a trailing
24
+ * slash: a path goes after it, `` `${url("web")}/reset` ``. It is the first of
25
+ * the frontend's origins, as {@link appMeta} lists them.
26
+ *
27
+ * The name is the one the frontend is declared with, in its
28
+ * `encore.frontend.json` or as the service hosting it: `web_app` does not find
29
+ * `web-app`.
30
+ *
31
+ * Throws if the runtime knows no URL for `frontend`: the app has no frontend of
32
+ * that name, which Encore's parser reports, or the environment gives it no
33
+ * origins.
34
+ *
35
+ * @example
36
+ * import {url} from "@encore.dev/sdk/frontends";
37
+ * const home = url("web");
38
+ */
39
+ export function url(frontend) {
40
+ const found = appMeta().frontends[frontend]?.origins[0]?.replace(/\/+$/, '');
41
+ if (!found) {
42
+ throw new Error(`encore: no URL is known for frontend ${JSON.stringify(frontend)}: the app has no ` +
43
+ 'frontend of that name, or the environment gives it no origins');
44
+ }
45
+ return found;
46
+ }
47
+ //# sourceMappingURL=mod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.js","sourceRoot":"","sources":["../../frontends/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AAEpC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,GAAG,CAAC,QAAgB;IAClC,MAAM,KAAK,GAAG,OAAO,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC7E,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,wCAAwC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,mBAAmB;YACjF,+DAA+D,CAClE,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * The code of an Encore error, which a {@link reject}ion answers with: what
3
+ * went wrong, as Encore's clients read it, and the HTTP status the answer
4
+ * has. They are the codes a service's errors answer with.
5
+ */
6
+ export declare enum ErrCode {
7
+ /** 499. */
8
+ Canceled = "canceled",
9
+ /** 500. */
10
+ Unknown = "unknown",
11
+ /** 400. */
12
+ InvalidArgument = "invalid_argument",
13
+ /** 504. */
14
+ DeadlineExceeded = "deadline_exceeded",
15
+ /** 404. */
16
+ NotFound = "not_found",
17
+ /** 409. */
18
+ AlreadyExists = "already_exists",
19
+ /** 403. */
20
+ PermissionDenied = "permission_denied",
21
+ /** 429. */
22
+ ResourceExhausted = "resource_exhausted",
23
+ /** 400. */
24
+ FailedPrecondition = "failed_precondition",
25
+ /** 409. */
26
+ Aborted = "aborted",
27
+ /** 400. */
28
+ OutOfRange = "out_of_range",
29
+ /** 501. */
30
+ Unimplemented = "unimplemented",
31
+ /** 500. */
32
+ Internal = "internal",
33
+ /** 503. */
34
+ Unavailable = "unavailable",
35
+ /** 500. */
36
+ DataLoss = "data_loss",
37
+ /** 401. */
38
+ Unauthenticated = "unauthenticated"
39
+ }
40
+ /** The HTTP status an answer with `code` has: 401 for
41
+ * {@link ErrCode.Unauthenticated}, 404 for {@link ErrCode.NotFound}, and so
42
+ * on. */
43
+ export declare function httpStatus(code: ErrCode): number;
44
+ /** Response headers: a record, or pairs for a header sent more than once. */
45
+ export type Headers = Record<string, string> | ReadonlyArray<[string, string]>;
46
+ /**
47
+ * A Middleware's answer to a request it does not let through: `onRequest`
48
+ * returns or throws one, and the gateway writes it to the client, with the
49
+ * gateway's CORS headers, rather than forwarding the request.
50
+ *
51
+ * {@link reject} answers as a service answers with an Encore error, which
52
+ * Encore's clients read as one; {@link respond} answers with any response,
53
+ * such as a redirect.
54
+ */
55
+ export declare class Rejection extends Error {
56
+ name: string;
57
+ /** The HTTP status the request is answered with. */
58
+ readonly status: number;
59
+ /** The Encore error code, for a {@link reject}; undefined for a
60
+ * {@link respond}. */
61
+ readonly code: ErrCode | undefined;
62
+ /** What went wrong, for a {@link reject}; empty for a {@link respond}. */
63
+ readonly errorMessage: string;
64
+ /** The response's headers, as name and value pairs. */
65
+ readonly headers: Array<[string, string]>;
66
+ /** The response's body, for a {@link respond}. */
67
+ readonly body: Uint8Array | undefined;
68
+ /** @internal Made by {@link reject} and {@link respond}. */
69
+ constructor(status: number, code: ErrCode | undefined, message: string, headers: Array<[string, string]>, body: Uint8Array | undefined);
70
+ /** Adds a header to the response, as `Retry-After` to a 429, and returns
71
+ * the rejection. */
72
+ withHeader(name: string, value: string): this;
73
+ }
74
+ /**
75
+ * Answers a request with an Encore error with `code` and `message`, and the
76
+ * HTTP status of the code: 401 for {@link ErrCode.Unauthenticated}, 403 for
77
+ * {@link ErrCode.PermissionDenied}, 429 for
78
+ * {@link ErrCode.ResourceExhausted}, and so on.
79
+ *
80
+ * ```typescript
81
+ * return gateway.reject(ErrCode.Unauthenticated, "missing token");
82
+ * ```
83
+ */
84
+ export declare function reject(code: ErrCode, message: string): Rejection;
85
+ /**
86
+ * Answers a request with `status`, `headers` and `body` as they are, as a
87
+ * redirect to sign in:
88
+ *
89
+ * ```typescript
90
+ * return gateway.respond(302, { location: "/login" });
91
+ * ```
92
+ */
93
+ export declare function respond(status: number, headers?: Headers, body?: Uint8Array | string): Rejection;
94
+ /**
95
+ * The gateway cannot be served: a Middleware is invalid, the process is not
96
+ * a gateway program Encore runs, or the gateway is already served.
97
+ */
98
+ export declare class GatewayError extends Error {
99
+ name: string;
100
+ }
101
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../gateway/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,OAAO;IACjB,WAAW;IACX,QAAQ,aAAa;IACrB,WAAW;IACX,OAAO,YAAY;IACnB,WAAW;IACX,eAAe,qBAAqB;IACpC,WAAW;IACX,gBAAgB,sBAAsB;IACtC,WAAW;IACX,QAAQ,cAAc;IACtB,WAAW;IACX,aAAa,mBAAmB;IAChC,WAAW;IACX,gBAAgB,sBAAsB;IACtC,WAAW;IACX,iBAAiB,uBAAuB;IACxC,WAAW;IACX,kBAAkB,wBAAwB;IAC1C,WAAW;IACX,OAAO,YAAY;IACnB,WAAW;IACX,UAAU,iBAAiB;IAC3B,WAAW;IACX,aAAa,kBAAkB;IAC/B,WAAW;IACX,QAAQ,aAAa;IACrB,WAAW;IACX,WAAW,gBAAgB;IAC3B,WAAW;IACX,QAAQ,cAAc;IACtB,WAAW;IACX,eAAe,oBAAoB;CACpC;AAqBD;;SAES;AACT,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAEhD;AAED,6EAA6E;AAC7E,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,aAAa,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE/E;;;;;;;;GAQG;AACH,qBAAa,SAAU,SAAQ,KAAK;IACzB,IAAI,SAAe;IAE5B,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;0BACsB;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC,0EAA0E;IAC1E,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,uDAAuD;IACvD,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1C,kDAAkD;IAClD,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;IAEtC,4DAA4D;gBAE1D,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,GAAG,SAAS,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAChC,IAAI,EAAE,UAAU,GAAG,SAAS;IAa9B;wBACoB;IACpB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAI9C;AAED;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAKhE;AAMD;;;;;;;GAOG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,OAAY,EACrB,IAAI,GAAE,UAAU,GAAG,MAAyB,GAC3C,SAAS,CAUX;AAED;;;GAGG;AACH,qBAAa,YAAa,SAAQ,KAAK;IAC5B,IAAI,SAAkB;CAChC"}
@@ -0,0 +1,146 @@
1
+ /**
2
+ * The code of an Encore error, which a {@link reject}ion answers with: what
3
+ * went wrong, as Encore's clients read it, and the HTTP status the answer
4
+ * has. They are the codes a service's errors answer with.
5
+ */
6
+ export var ErrCode;
7
+ (function (ErrCode) {
8
+ /** 499. */
9
+ ErrCode["Canceled"] = "canceled";
10
+ /** 500. */
11
+ ErrCode["Unknown"] = "unknown";
12
+ /** 400. */
13
+ ErrCode["InvalidArgument"] = "invalid_argument";
14
+ /** 504. */
15
+ ErrCode["DeadlineExceeded"] = "deadline_exceeded";
16
+ /** 404. */
17
+ ErrCode["NotFound"] = "not_found";
18
+ /** 409. */
19
+ ErrCode["AlreadyExists"] = "already_exists";
20
+ /** 403. */
21
+ ErrCode["PermissionDenied"] = "permission_denied";
22
+ /** 429. */
23
+ ErrCode["ResourceExhausted"] = "resource_exhausted";
24
+ /** 400. */
25
+ ErrCode["FailedPrecondition"] = "failed_precondition";
26
+ /** 409. */
27
+ ErrCode["Aborted"] = "aborted";
28
+ /** 400. */
29
+ ErrCode["OutOfRange"] = "out_of_range";
30
+ /** 501. */
31
+ ErrCode["Unimplemented"] = "unimplemented";
32
+ /** 500. */
33
+ ErrCode["Internal"] = "internal";
34
+ /** 503. */
35
+ ErrCode["Unavailable"] = "unavailable";
36
+ /** 500. */
37
+ ErrCode["DataLoss"] = "data_loss";
38
+ /** 401. */
39
+ ErrCode["Unauthenticated"] = "unauthenticated";
40
+ })(ErrCode || (ErrCode = {}));
41
+ const STATUS = {
42
+ [ErrCode.Canceled]: 499,
43
+ [ErrCode.Unknown]: 500,
44
+ [ErrCode.InvalidArgument]: 400,
45
+ [ErrCode.DeadlineExceeded]: 504,
46
+ [ErrCode.NotFound]: 404,
47
+ [ErrCode.AlreadyExists]: 409,
48
+ [ErrCode.PermissionDenied]: 403,
49
+ [ErrCode.ResourceExhausted]: 429,
50
+ [ErrCode.FailedPrecondition]: 400,
51
+ [ErrCode.Aborted]: 409,
52
+ [ErrCode.OutOfRange]: 400,
53
+ [ErrCode.Unimplemented]: 501,
54
+ [ErrCode.Internal]: 500,
55
+ [ErrCode.Unavailable]: 503,
56
+ [ErrCode.DataLoss]: 500,
57
+ [ErrCode.Unauthenticated]: 401,
58
+ };
59
+ /** The HTTP status an answer with `code` has: 401 for
60
+ * {@link ErrCode.Unauthenticated}, 404 for {@link ErrCode.NotFound}, and so
61
+ * on. */
62
+ export function httpStatus(code) {
63
+ return STATUS[code];
64
+ }
65
+ /**
66
+ * A Middleware's answer to a request it does not let through: `onRequest`
67
+ * returns or throws one, and the gateway writes it to the client, with the
68
+ * gateway's CORS headers, rather than forwarding the request.
69
+ *
70
+ * {@link reject} answers as a service answers with an Encore error, which
71
+ * Encore's clients read as one; {@link respond} answers with any response,
72
+ * such as a redirect.
73
+ */
74
+ export class Rejection extends Error {
75
+ name = 'Rejection';
76
+ /** The HTTP status the request is answered with. */
77
+ status;
78
+ /** The Encore error code, for a {@link reject}; undefined for a
79
+ * {@link respond}. */
80
+ code;
81
+ /** What went wrong, for a {@link reject}; empty for a {@link respond}. */
82
+ errorMessage;
83
+ /** The response's headers, as name and value pairs. */
84
+ headers;
85
+ /** The response's body, for a {@link respond}. */
86
+ body;
87
+ /** @internal Made by {@link reject} and {@link respond}. */
88
+ constructor(status, code, message, headers, body) {
89
+ super(`rejected with ${status}` +
90
+ (code !== undefined ? ` ${code}: ${message}` : ''));
91
+ this.status = status;
92
+ this.code = code;
93
+ this.errorMessage = message;
94
+ this.headers = headers;
95
+ this.body = body;
96
+ }
97
+ /** Adds a header to the response, as `Retry-After` to a 429, and returns
98
+ * the rejection. */
99
+ withHeader(name, value) {
100
+ this.headers.push([name, value]);
101
+ return this;
102
+ }
103
+ }
104
+ /**
105
+ * Answers a request with an Encore error with `code` and `message`, and the
106
+ * HTTP status of the code: 401 for {@link ErrCode.Unauthenticated}, 403 for
107
+ * {@link ErrCode.PermissionDenied}, 429 for
108
+ * {@link ErrCode.ResourceExhausted}, and so on.
109
+ *
110
+ * ```typescript
111
+ * return gateway.reject(ErrCode.Unauthenticated, "missing token");
112
+ * ```
113
+ */
114
+ export function reject(code, message) {
115
+ if (!(code in REVERSE)) {
116
+ throw new TypeError(`${String(code)} is not an ErrCode`);
117
+ }
118
+ return new Rejection(STATUS[code], code, message, [], undefined);
119
+ }
120
+ const REVERSE = Object.fromEntries(Object.values(ErrCode).map(c => [c, true]));
121
+ /**
122
+ * Answers a request with `status`, `headers` and `body` as they are, as a
123
+ * redirect to sign in:
124
+ *
125
+ * ```typescript
126
+ * return gateway.respond(302, { location: "/login" });
127
+ * ```
128
+ */
129
+ export function respond(status, headers = [], body = new Uint8Array()) {
130
+ if (!Number.isInteger(status) || status < 100 || status > 599) {
131
+ throw new RangeError(`status ${status} is not an HTTP status`);
132
+ }
133
+ const pairs = Array.isArray(headers)
134
+ ? headers.map(([n, v]) => [n, v])
135
+ : Object.entries(headers);
136
+ const bytes = typeof body === 'string' ? new TextEncoder().encode(body) : body;
137
+ return new Rejection(status, undefined, '', pairs, bytes);
138
+ }
139
+ /**
140
+ * The gateway cannot be served: a Middleware is invalid, the process is not
141
+ * a gateway program Encore runs, or the gateway is already served.
142
+ */
143
+ export class GatewayError extends Error {
144
+ name = 'GatewayError';
145
+ }
146
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../gateway/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAN,IAAY,OAiCX;AAjCD,WAAY,OAAO;IACjB,WAAW;IACX,gCAAqB,CAAA;IACrB,WAAW;IACX,8BAAmB,CAAA;IACnB,WAAW;IACX,+CAAoC,CAAA;IACpC,WAAW;IACX,iDAAsC,CAAA;IACtC,WAAW;IACX,iCAAsB,CAAA;IACtB,WAAW;IACX,2CAAgC,CAAA;IAChC,WAAW;IACX,iDAAsC,CAAA;IACtC,WAAW;IACX,mDAAwC,CAAA;IACxC,WAAW;IACX,qDAA0C,CAAA;IAC1C,WAAW;IACX,8BAAmB,CAAA;IACnB,WAAW;IACX,sCAA2B,CAAA;IAC3B,WAAW;IACX,0CAA+B,CAAA;IAC/B,WAAW;IACX,gCAAq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I,CAAC,CAAC,CAC3C,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CACrB,MAAc,EACd,UAAmB,EAAE,EACrB,OAA4B,IAAI,UAAU,EAAE;IAE5C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,GAAG,IAAI,MAAM,GAAG,GAAG,EAAE,CAAC;QAC9D,MAAM,IAAI,UAAU,CAAC,UAAU,MAAM,wBAAwB,CAAC,CAAC;IACjE,CAAC;IACD,MAAM,KAAK,GAA4B,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAC3D,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACjC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAiC,CAAC,CAAC;IACtD,MAAM,KAAK,GACT,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACnE,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IAC5B,IAAI,GAAG,cAAc,CAAC;CAChC"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Which requests a Middleware is called for.
3
+ *
4
+ * A {@link Matcher} is checked by Encore before a request reaches
5
+ * JavaScript: a request no Middleware matches costs the program nothing.
6
+ * Matching sees the request as the client sent it, so the header edits of an
7
+ * earlier Middleware do not change which later ones are called, and a
8
+ * Middleware need not read what it matches on.
9
+ *
10
+ * Matchers combine with `.and()`, `.or()` and `.not()`, or {@link allOf},
11
+ * {@link anyOf} and {@link not}:
12
+ *
13
+ * ```typescript
14
+ * import { match } from "@encore.dev/sdk/gateway";
15
+ *
16
+ * const admin = match.pathPrefix("/admin").and(match.method("OPTIONS").not());
17
+ * const bearer = match.header("authorization", match.prefix("Bearer "));
18
+ * const either = match.service("billing", "orders").or(match.route("GET", "/users/{id}"));
19
+ * ```
20
+ *
21
+ * @module
22
+ */
23
+ /** A matcher or condition as the gateway core's JSON spells it. */
24
+ type Expr = Record<string, unknown>;
25
+ /**
26
+ * A condition on a request: on its service, route, method, path, headers,
27
+ * query parameters or cookies. Made by this module's functions.
28
+ */
29
+ export declare class Matcher {
30
+ /** @internal */
31
+ readonly expr: Expr;
32
+ /** @internal */
33
+ constructor(expr: Expr);
34
+ /** Matches the requests both match. */
35
+ and(other: Matcher): Matcher;
36
+ /** Matches the requests either matches. */
37
+ or(other: Matcher): Matcher;
38
+ /** Matches the requests this does not. */
39
+ not(): Matcher;
40
+ /** The matcher as the gateway core's JSON spells it. */
41
+ toJSON(): Expr;
42
+ }
43
+ /**
44
+ * What a header, query parameter or cookie must be, for {@link header},
45
+ * {@link query} and {@link cookie}. One sent more than once satisfies a
46
+ * condition, other than {@link absent}, when any of its values does. Made by
47
+ * this module's functions.
48
+ */
49
+ export declare class Cond {
50
+ /** @internal */
51
+ readonly expr: Expr;
52
+ /** @internal */
53
+ constructor(expr: Expr);
54
+ /** The condition as the gateway core's JSON spells it. */
55
+ toJSON(): Expr;
56
+ }
57
+ /** Matches the requests every one of `ms` matches: every request when there
58
+ * are none. */
59
+ export declare function allOf(...ms: Matcher[]): Matcher;
60
+ /** Matches the requests any of `ms` matches: none when there are none. */
61
+ export declare function anyOf(...ms: Matcher[]): Matcher;
62
+ /** Matches the requests `m` does not, as `m.not()`. */
63
+ export declare function not(m: Matcher): Matcher;
64
+ /** Matches the requests the gateway routes to any of `services`. */
65
+ export declare function service(...services: string[]): Matcher;
66
+ /**
67
+ * Matches the requests routed by the gateway's route with `template`, such
68
+ * as `/users/{id}`, answering `method`, or any method when it is undefined.
69
+ * The names of the template's parameters do not matter, as they do not to
70
+ * the router: `/users/{userId}` names the same route.
71
+ */
72
+ export declare function route(method: string | undefined, template: string): Matcher;
73
+ /** Matches the requests with any of `methods`, such as `"POST"`. */
74
+ export declare function method(...methods: string[]): Matcher;
75
+ /**
76
+ * Matches the requests for exactly `path`, as the client sent it, not
77
+ * percent-decoded. A trailing slash does not matter, as it does not to the
78
+ * router.
79
+ */
80
+ export declare function path(path: string): Matcher;
81
+ /**
82
+ * Matches the requests whose path starts with `prefix`, by whole segments:
83
+ * `/admin` matches `/admin` and `/admin/users`, not `/administrators`.
84
+ */
85
+ export declare function pathPrefix(prefix: string): Matcher;
86
+ /**
87
+ * Matches the requests whose path the glob matches: a `*` segment matches
88
+ * any one segment, and a `**` segment any number of them, none included.
89
+ * `/users/*` matches `/users/1`, and `/users/**` matches `/users` and
90
+ * `/users/1/posts/2`.
91
+ */
92
+ export declare function pathGlob(glob: string): Matcher;
93
+ /**
94
+ * Matches the requests whose header `name` satisfies `cond`, or is sent,
95
+ * without one. Header names are case-insensitive; values are compared as
96
+ * sent.
97
+ */
98
+ export declare function header(name: string, cond?: Cond): Matcher;
99
+ /**
100
+ * Matches the requests whose query parameter `name` satisfies `cond`, or is
101
+ * sent, without one. Names are case-sensitive; values are percent-decoded
102
+ * before they are compared.
103
+ */
104
+ export declare function query(name: string, cond?: Cond): Matcher;
105
+ /**
106
+ * Matches the requests whose cookie `name` satisfies `cond`, or is sent,
107
+ * without one. Names are case-sensitive; values are compared as sent.
108
+ */
109
+ export declare function cookie(name: string, cond?: Cond): Matcher;
110
+ /** Holds when the field is sent. */
111
+ export declare function present(): Cond;
112
+ /** Holds when the field is not sent. */
113
+ export declare function absent(): Cond;
114
+ /** Holds when the field's value is `value`. */
115
+ export declare function equals(value: string): Cond;
116
+ /** Holds when the field's value starts with `prefix`, as `"Bearer "`. */
117
+ export declare function prefix(prefix: string): Cond;
118
+ /** Holds when the field's value is one of `values`. */
119
+ export declare function oneOf(...values: string[]): Cond;
120
+ /**
121
+ * Holds when the regular expression matches the field's whole value. In RE2
122
+ * syntax, not JavaScript's: Encore checks it before a request reaches
123
+ * JavaScript. An invalid one makes `serve` fail.
124
+ */
125
+ export declare function regex(pattern: string): Cond;
126
+ export {};
127
+ //# sourceMappingURL=match.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../gateway/match.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,mEAAmE;AACnE,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpC;;;GAGG;AACH,qBAAa,OAAO;IAClB,gBAAgB;IAChB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAEpB,gBAAgB;gBACJ,IAAI,EAAE,IAAI;IAItB,uCAAuC;IACvC,GAAG,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAI5B,2CAA2C;IAC3C,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAI3B,0CAA0C;IAC1C,GAAG,IAAI,OAAO;IAId,wDAAwD;IACxD,MAAM,IAAI,IAAI;CAGf;AAED;;;;;GAKG;AACH,qBAAa,IAAI;IACf,gBAAgB;IAChB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAEpB,gBAAgB;gBACJ,IAAI,EAAE,IAAI;IAItB,0DAA0D;IAC1D,MAAM,IAAI,IAAI;CAGf;AA4BD;eACe;AACf,wBAAgB,KAAK,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,GAAG,OAAO,CAE/C;AAED,0EAA0E;AAC1E,wBAAgB,KAAK,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,GAAG,OAAO,CAE/C;AAED,uDAAuD;AACvD,wBAAgB,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAEvC;AAED,oEAAoE;AACpE,wBAAgB,OAAO,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,O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which requests a Middleware is called for.
3
+ *
4
+ * A {@link Matcher} is checked by Encore before a request reaches
5
+ * JavaScript: a request no Middleware matches costs the program nothing.
6
+ * Matching sees the request as the client sent it, so the header edits of an
7
+ * earlier Middleware do not change which later ones are called, and a
8
+ * Middleware need not read what it matches on.
9
+ *
10
+ * Matchers combine with `.and()`, `.or()` and `.not()`, or {@link allOf},
11
+ * {@link anyOf} and {@link not}:
12
+ *
13
+ * ```typescript
14
+ * import { match } from "@encore.dev/sdk/gateway";
15
+ *
16
+ * const admin = match.pathPrefix("/admin").and(match.method("OPTIONS").not());
17
+ * const bearer = match.header("authorization", match.prefix("Bearer "));
18
+ * const either = match.service("billing", "orders").or(match.route("GET", "/users/{id}"));
19
+ * ```
20
+ *
21
+ * @module
22
+ */
23
+ /**
24
+ * A condition on a request: on its service, route, method, path, headers,
25
+ * query parameters or cookies. Made by this module's functions.
26
+ */
27
+ export class Matcher {
28
+ /** @internal */
29
+ expr;
30
+ /** @internal */
31
+ constructor(expr) {
32
+ this.expr = expr;
33
+ }
34
+ /** Matches the requests both match. */
35
+ and(other) {
36
+ return allOf(this, other);
37
+ }
38
+ /** Matches the requests either matches. */
39
+ or(other) {
40
+ return anyOf(this, other);
41
+ }
42
+ /** Matches the requests this does not. */
43
+ not() {
44
+ return not(this);
45
+ }
46
+ /** The matcher as the gateway core's JSON spells it. */
47
+ toJSON() {
48
+ return this.expr;
49
+ }
50
+ }
51
+ /**
52
+ * What a header, query parameter or cookie must be, for {@link header},
53
+ * {@link query} and {@link cookie}. One sent more than once satisfies a
54
+ * condition, other than {@link absent}, when any of its values does. Made by
55
+ * this module's functions.
56
+ */
57
+ export class Cond {
58
+ /** @internal */
59
+ expr;
60
+ /** @internal */
61
+ constructor(expr) {
62
+ this.expr = expr;
63
+ }
64
+ /** The condition as the gateway core's JSON spells it. */
65
+ toJSON() {
66
+ return this.expr;
67
+ }
68
+ }
69
+ function matchers(what, ms) {
70
+ return ms.map(m => {
71
+ if (!(m instanceof Matcher)) {
72
+ throw new TypeError(`match.${what} takes Matchers, not ${describe(m)}`);
73
+ }
74
+ return m.expr;
75
+ });
76
+ }
77
+ function strings(what, values) {
78
+ for (const v of values) {
79
+ if (typeof v !== 'string') {
80
+ throw new TypeError(`match.${what} takes strings, not ${describe(v)}`);
81
+ }
82
+ }
83
+ return [...values];
84
+ }
85
+ function describe(v) {
86
+ return v === null
87
+ ? 'null'
88
+ : typeof v === 'object'
89
+ ? v.constructor.name
90
+ : typeof v;
91
+ }
92
+ /** Matches the requests every one of `ms` matches: every request when there
93
+ * are none. */
94
+ export function allOf(...ms) {
95
+ return new Matcher({ all: matchers('allOf', ms) });
96
+ }
97
+ /** Matches the requests any of `ms` matches: none when there are none. */
98
+ export function anyOf(...ms) {
99
+ return new Matcher({ anyOf: matchers('anyOf', ms) });
100
+ }
101
+ /** Matches the requests `m` does not, as `m.not()`. */
102
+ export function not(m) {
103
+ return new Matcher({ not: matchers('not', [m])[0] });
104
+ }
105
+ /** Matches the requests the gateway routes to any of `services`. */
106
+ export function service(...services) {
107
+ return new Matcher({ service: strings('service', services) });
108
+ }
109
+ /**
110
+ * Matches the requests routed by the gateway's route with `template`, such
111
+ * as `/users/{id}`, answering `method`, or any method when it is undefined.
112
+ * The names of the template's parameters do not matter, as they do not to
113
+ * the router: `/users/{userId}` names the same route.
114
+ */
115
+ export function route(method, template) {
116
+ return new Matcher({
117
+ route: method === undefined ? { template } : { method, template },
118
+ });
119
+ }
120
+ /** Matches the requests with any of `methods`, such as `"POST"`. */
121
+ export function method(...methods) {
122
+ return new Matcher({ method: strings('method', methods) });
123
+ }
124
+ /**
125
+ * Matches the requests for exactly `path`, as the client sent it, not
126
+ * percent-decoded. A trailing slash does not matter, as it does not to the
127
+ * router.
128
+ */
129
+ export function path(path) {
130
+ return new Matcher({ path: { exact: path } });
131
+ }
132
+ /**
133
+ * Matches the requests whose path starts with `prefix`, by whole segments:
134
+ * `/admin` matches `/admin` and `/admin/users`, not `/administrators`.
135
+ */
136
+ export function pathPrefix(prefix) {
137
+ return new Matcher({ path: { prefix } });
138
+ }
139
+ /**
140
+ * Matches the requests whose path the glob matches: a `*` segment matches
141
+ * any one segment, and a `**` segment any number of them, none included.
142
+ * `/users/*` matches `/users/1`, and `/users/**` matches `/users` and
143
+ * `/users/1/posts/2`.
144
+ */
145
+ export function pathGlob(glob) {
146
+ return new Matcher({ path: { glob } });
147
+ }
148
+ function field(kind, name, cond) {
149
+ const c = cond ?? present();
150
+ if (!(c instanceof Cond)) {
151
+ throw new TypeError(`match.${kind} takes a Cond, not ${describe(c)}`);
152
+ }
153
+ return new Matcher({ [kind]: { name, cond: c.expr } });
154
+ }
155
+ /**
156
+ * Matches the requests whose header `name` satisfies `cond`, or is sent,
157
+ * without one. Header names are case-insensitive; values are compared as
158
+ * sent.
159
+ */
160
+ export function header(name, cond) {
161
+ return field('header', name, cond);
162
+ }
163
+ /**
164
+ * Matches the requests whose query parameter `name` satisfies `cond`, or is
165
+ * sent, without one. Names are case-sensitive; values are percent-decoded
166
+ * before they are compared.
167
+ */
168
+ export function query(name, cond) {
169
+ return field('query', name, cond);
170
+ }
171
+ /**
172
+ * Matches the requests whose cookie `name` satisfies `cond`, or is sent,
173
+ * without one. Names are case-sensitive; values are compared as sent.
174
+ */
175
+ export function cookie(name, cond) {
176
+ return field('cookie', name, cond);
177
+ }
178
+ /** Holds when the field is sent. */
179
+ export function present() {
180
+ return new Cond({ present: true });
181
+ }
182
+ /** Holds when the field is not sent. */
183
+ export function absent() {
184
+ return new Cond({ absent: true });
185
+ }
186
+ /** Holds when the field's value is `value`. */
187
+ export function equals(value) {
188
+ return new Cond({ equals: value });
189
+ }
190
+ /** Holds when the field's value starts with `prefix`, as `"Bearer "`. */
191
+ export function prefix(prefix) {
192
+ return new Cond({ prefix });
193
+ }
194
+ /** Holds when the field's value is one of `values`. */
195
+ export function oneOf(...values) {
196
+ return new Cond({ oneOf: strings('oneOf', values) });
197
+ }
198
+ /**
199
+ * Holds when the regular expression matches the field's whole value. In RE2
200
+ * syntax, not JavaScript's: Encore checks it before a request reaches
201
+ * JavaScript. An invalid one makes `serve` fail.
202
+ */
203
+ export function regex(pattern) {
204
+ return new Cond({ regex: pattern });
205
+ }
206
+ //# sourceMappingURL=match.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"match.js","sourceRoot":"","sources":["../../gateway/match.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAKH;;;GAGG;AACH,MAAM,OAAO,OAAO;IAClB,gBAAgB;IACP,IAAI,CAAO;IAEpB,gBAAgB;IAChB,YAAY,IAAU;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,uCAAuC;IACvC,GAAG,CAAC,KAAc;QAChB,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,2CAA2C;IAC3C,EAAE,CAAC,KAAc;QACf,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,0CAA0C;IAC1C,GAAG;QACD,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IAED,wDAAwD;IACxD,MAAM;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,IAAI;IACf,gBAAgB;IACP,IAAI,CAAO;IAEpB,gBAAgB;IAChB,YAAY,IAAU;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,0DAA0D;IAC1D,MAAM;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF;AAED,SAAS,QAAQ,CAAC,IAAY,EAAE,EAAsB;IACpD,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QAChB,IAAI,CAAC,CAAC,CAAC,YAAY,OAAO,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,SAAS,CAAC,SAAS,IA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