@beignet/core 0.0.2 → 0.0.4

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 (360) hide show
  1. package/CHANGELOG.md +173 -0
  2. package/README.md +821 -30
  3. package/dist/application/index.d.ts +28 -2
  4. package/dist/application/index.d.ts.map +1 -1
  5. package/dist/application/index.js +140 -12
  6. package/dist/application/index.js.map +1 -1
  7. package/dist/client/client.d.ts +2 -2
  8. package/dist/client/client.d.ts.map +1 -1
  9. package/dist/client/client.js +136 -48
  10. package/dist/client/client.js.map +1 -1
  11. package/dist/client/error-messages.d.ts +14 -0
  12. package/dist/client/error-messages.d.ts.map +1 -0
  13. package/dist/client/error-messages.js +23 -0
  14. package/dist/client/error-messages.js.map +1 -0
  15. package/dist/client/index.d.ts +8 -4
  16. package/dist/client/index.d.ts.map +1 -1
  17. package/dist/client/index.js +6 -2
  18. package/dist/client/index.js.map +1 -1
  19. package/dist/client/types.d.ts +35 -5
  20. package/dist/client/types.d.ts.map +1 -1
  21. package/dist/client-only.d.ts +8 -0
  22. package/dist/client-only.d.ts.map +1 -0
  23. package/dist/client-only.js +8 -0
  24. package/dist/client-only.js.map +1 -0
  25. package/dist/config/index.d.ts +5 -5
  26. package/dist/config/index.d.ts.map +1 -1
  27. package/dist/config/index.js +2 -2
  28. package/dist/config/index.js.map +1 -1
  29. package/dist/contracts/catalog-errors.d.ts +27 -0
  30. package/dist/contracts/catalog-errors.d.ts.map +1 -0
  31. package/dist/contracts/catalog-errors.js +69 -0
  32. package/dist/contracts/catalog-errors.js.map +1 -0
  33. package/dist/contracts/contract-builder.d.ts +15 -12
  34. package/dist/contracts/contract-builder.d.ts.map +1 -1
  35. package/dist/contracts/contract-builder.js +15 -41
  36. package/dist/contracts/contract-builder.js.map +1 -1
  37. package/dist/contracts/contract-group.d.ts +11 -8
  38. package/dist/contracts/contract-group.d.ts.map +1 -1
  39. package/dist/contracts/contract-group.js +13 -40
  40. package/dist/contracts/contract-group.js.map +1 -1
  41. package/dist/contracts/contract-like.d.ts +1 -1
  42. package/dist/contracts/contract-like.d.ts.map +1 -1
  43. package/dist/contracts/index.d.ts +13 -9
  44. package/dist/contracts/index.d.ts.map +1 -1
  45. package/dist/contracts/index.js +9 -5
  46. package/dist/contracts/index.js.map +1 -1
  47. package/dist/contracts/openapi-meta.d.ts +48 -0
  48. package/dist/contracts/openapi-meta.d.ts.map +1 -1
  49. package/dist/contracts/openapi-meta.js +3 -0
  50. package/dist/contracts/openapi-meta.js.map +1 -1
  51. package/dist/contracts/path-template.d.ts +1 -1
  52. package/dist/contracts/path-template.js +2 -2
  53. package/dist/contracts/path-template.js.map +1 -1
  54. package/dist/contracts/schema-shape.d.ts +37 -0
  55. package/dist/contracts/schema-shape.d.ts.map +1 -0
  56. package/dist/contracts/schema-shape.js +61 -0
  57. package/dist/contracts/schema-shape.js.map +1 -0
  58. package/dist/contracts/success-status.d.ts +32 -0
  59. package/dist/contracts/success-status.d.ts.map +1 -0
  60. package/dist/contracts/success-status.js +18 -0
  61. package/dist/contracts/success-status.js.map +1 -0
  62. package/dist/contracts/types.d.ts +25 -5
  63. package/dist/contracts/types.d.ts.map +1 -1
  64. package/dist/contracts/types.js.map +1 -1
  65. package/dist/contracts/utils.d.ts +1 -1
  66. package/dist/contracts/utils.d.ts.map +1 -1
  67. package/dist/contracts/utils.js +1 -1
  68. package/dist/contracts/utils.js.map +1 -1
  69. package/dist/domain/events.d.ts +1 -1
  70. package/dist/domain/events.d.ts.map +1 -1
  71. package/dist/domain/events.js +1 -1
  72. package/dist/domain/events.js.map +1 -1
  73. package/dist/domain/index.d.ts +3 -3
  74. package/dist/domain/index.d.ts.map +1 -1
  75. package/dist/domain/index.js +3 -3
  76. package/dist/domain/index.js.map +1 -1
  77. package/dist/errors/catalog.d.ts +9 -1
  78. package/dist/errors/catalog.d.ts.map +1 -1
  79. package/dist/errors/catalog.js +7 -1
  80. package/dist/errors/catalog.js.map +1 -1
  81. package/dist/errors/http.d.ts +10 -0
  82. package/dist/errors/http.d.ts.map +1 -1
  83. package/dist/errors/http.js +11 -1
  84. package/dist/errors/http.js.map +1 -1
  85. package/dist/errors/index.d.ts +4 -4
  86. package/dist/errors/index.d.ts.map +1 -1
  87. package/dist/errors/index.js +4 -4
  88. package/dist/errors/index.js.map +1 -1
  89. package/dist/errors/response.d.ts +4 -1
  90. package/dist/errors/response.d.ts.map +1 -1
  91. package/dist/errors/response.js.map +1 -1
  92. package/dist/events/index.d.ts +10 -12
  93. package/dist/events/index.d.ts.map +1 -1
  94. package/dist/events/index.js +10 -10
  95. package/dist/events/index.js.map +1 -1
  96. package/dist/idempotency/index.d.ts +5 -3
  97. package/dist/idempotency/index.d.ts.map +1 -1
  98. package/dist/idempotency/index.js.map +1 -1
  99. package/dist/jobs/index.d.ts +148 -16
  100. package/dist/jobs/index.d.ts.map +1 -1
  101. package/dist/jobs/index.js +174 -14
  102. package/dist/jobs/index.js.map +1 -1
  103. package/dist/notifications/index.d.ts +14 -16
  104. package/dist/notifications/index.d.ts.map +1 -1
  105. package/dist/notifications/index.js +14 -14
  106. package/dist/notifications/index.js.map +1 -1
  107. package/dist/openapi/index.d.ts +8 -3
  108. package/dist/openapi/index.d.ts.map +1 -1
  109. package/dist/openapi/index.js +41 -29
  110. package/dist/openapi/index.js.map +1 -1
  111. package/dist/openapi/schema-introspector.d.ts +37 -0
  112. package/dist/openapi/schema-introspector.d.ts.map +1 -1
  113. package/dist/openapi/schema-introspector.js +23 -17
  114. package/dist/openapi/schema-introspector.js.map +1 -1
  115. package/dist/outbox/index.d.ts +18 -4
  116. package/dist/outbox/index.d.ts.map +1 -1
  117. package/dist/outbox/index.js +104 -4
  118. package/dist/outbox/index.js.map +1 -1
  119. package/dist/ports/audit.d.ts +56 -10
  120. package/dist/ports/audit.d.ts.map +1 -1
  121. package/dist/ports/audit.js +71 -3
  122. package/dist/ports/audit.js.map +1 -1
  123. package/dist/ports/auth.d.ts +92 -0
  124. package/dist/ports/auth.d.ts.map +1 -1
  125. package/dist/ports/auth.js +92 -0
  126. package/dist/ports/auth.js.map +1 -1
  127. package/dist/ports/events.d.ts +2 -2
  128. package/dist/ports/events.d.ts.map +1 -1
  129. package/dist/ports/index.d.ts +62 -33
  130. package/dist/ports/index.d.ts.map +1 -1
  131. package/dist/ports/index.js +28 -34
  132. package/dist/ports/index.js.map +1 -1
  133. package/dist/ports/policy.d.ts +32 -3
  134. package/dist/ports/policy.d.ts.map +1 -1
  135. package/dist/ports/policy.js +13 -2
  136. package/dist/ports/policy.js.map +1 -1
  137. package/dist/ports/testing.d.ts +1030 -2
  138. package/dist/ports/testing.d.ts.map +1 -1
  139. package/dist/ports/testing.js +1031 -1
  140. package/dist/ports/testing.js.map +1 -1
  141. package/dist/ports/unbound.d.ts +21 -0
  142. package/dist/ports/unbound.d.ts.map +1 -0
  143. package/dist/ports/unbound.js +57 -0
  144. package/dist/ports/unbound.js.map +1 -0
  145. package/dist/ports/unit-of-work.d.ts +1 -1
  146. package/dist/ports/unit-of-work.d.ts.map +1 -1
  147. package/dist/ports/unit-of-work.js +1 -1
  148. package/dist/ports/unit-of-work.js.map +1 -1
  149. package/dist/providers/index.d.ts +3 -2
  150. package/dist/providers/index.d.ts.map +1 -1
  151. package/dist/providers/index.js +3 -2
  152. package/dist/providers/index.js.map +1 -1
  153. package/dist/providers/instrumentation.d.ts +46 -5
  154. package/dist/providers/instrumentation.d.ts.map +1 -1
  155. package/dist/providers/instrumentation.js +25 -6
  156. package/dist/providers/instrumentation.js.map +1 -1
  157. package/dist/providers/metadata.d.ts +39 -0
  158. package/dist/providers/metadata.d.ts.map +1 -0
  159. package/dist/providers/metadata.js +169 -0
  160. package/dist/providers/metadata.js.map +1 -0
  161. package/dist/providers/provider.d.ts +114 -9
  162. package/dist/providers/provider.d.ts.map +1 -1
  163. package/dist/providers/provider.js +3 -20
  164. package/dist/providers/provider.js.map +1 -1
  165. package/dist/schedules/index.d.ts +94 -13
  166. package/dist/schedules/index.d.ts.map +1 -1
  167. package/dist/schedules/index.js +66 -12
  168. package/dist/schedules/index.js.map +1 -1
  169. package/dist/server/audit-context.d.ts +29 -0
  170. package/dist/server/audit-context.d.ts.map +1 -0
  171. package/dist/server/audit-context.js +44 -0
  172. package/dist/server/audit-context.js.map +1 -0
  173. package/dist/server/context.d.ts +141 -0
  174. package/dist/server/context.d.ts.map +1 -0
  175. package/dist/server/context.js +39 -0
  176. package/dist/server/context.js.map +1 -0
  177. package/dist/server/contract-like.d.ts +1 -1
  178. package/dist/server/contract-like.d.ts.map +1 -1
  179. package/dist/server/contract-like.js +1 -1
  180. package/dist/server/contract-like.js.map +1 -1
  181. package/dist/server/health.d.ts +2 -2
  182. package/dist/server/health.d.ts.map +1 -1
  183. package/dist/server/hooks/auth.d.ts +89 -65
  184. package/dist/server/hooks/auth.d.ts.map +1 -1
  185. package/dist/server/hooks/auth.js +84 -55
  186. package/dist/server/hooks/auth.js.map +1 -1
  187. package/dist/server/hooks/cors.d.ts +1 -1
  188. package/dist/server/hooks/cors.d.ts.map +1 -1
  189. package/dist/server/hooks/errors.d.ts +2 -2
  190. package/dist/server/hooks/errors.d.ts.map +1 -1
  191. package/dist/server/hooks/errors.js +2 -2
  192. package/dist/server/hooks/errors.js.map +1 -1
  193. package/dist/server/hooks/idempotency.d.ts +78 -0
  194. package/dist/server/hooks/idempotency.d.ts.map +1 -0
  195. package/dist/server/hooks/idempotency.js +154 -0
  196. package/dist/server/hooks/idempotency.js.map +1 -0
  197. package/dist/server/hooks/index.d.ts +8 -7
  198. package/dist/server/hooks/index.d.ts.map +1 -1
  199. package/dist/server/hooks/index.js +6 -5
  200. package/dist/server/hooks/index.js.map +1 -1
  201. package/dist/server/hooks/logging.d.ts +2 -2
  202. package/dist/server/hooks/logging.d.ts.map +1 -1
  203. package/dist/server/hooks/logging.js +1 -1
  204. package/dist/server/hooks/logging.js.map +1 -1
  205. package/dist/server/hooks/rate-limit.d.ts +25 -7
  206. package/dist/server/hooks/rate-limit.d.ts.map +1 -1
  207. package/dist/server/hooks/rate-limit.js +47 -12
  208. package/dist/server/hooks/rate-limit.js.map +1 -1
  209. package/dist/server/hooks.d.ts +1 -1
  210. package/dist/server/hooks.d.ts.map +1 -1
  211. package/dist/server/hooks.js +1 -1
  212. package/dist/server/hooks.js.map +1 -1
  213. package/dist/server/http.d.ts +84 -6
  214. package/dist/server/http.d.ts.map +1 -1
  215. package/dist/server/index.d.ts +36 -12
  216. package/dist/server/index.d.ts.map +1 -1
  217. package/dist/server/index.js +24 -8
  218. package/dist/server/index.js.map +1 -1
  219. package/dist/server/instrumentation.d.ts +108 -0
  220. package/dist/server/instrumentation.d.ts.map +1 -0
  221. package/dist/server/instrumentation.js +297 -0
  222. package/dist/server/instrumentation.js.map +1 -0
  223. package/dist/server/openapi.d.ts +3 -3
  224. package/dist/server/openapi.d.ts.map +1 -1
  225. package/dist/server/openapi.js +1 -1
  226. package/dist/server/openapi.js.map +1 -1
  227. package/dist/server/providers/index.d.ts +3 -3
  228. package/dist/server/providers/index.d.ts.map +1 -1
  229. package/dist/server/providers/index.js +3 -3
  230. package/dist/server/providers/index.js.map +1 -1
  231. package/dist/server/providers/loadProviderConfig.d.ts +2 -2
  232. package/dist/server/providers/loadProviderConfig.d.ts.map +1 -1
  233. package/dist/server/providers/loadProviderConfig.js +2 -2
  234. package/dist/server/providers/loadProviderConfig.js.map +1 -1
  235. package/dist/server/request-context.d.ts +67 -0
  236. package/dist/server/request-context.d.ts.map +1 -0
  237. package/dist/server/request-context.js +79 -0
  238. package/dist/server/request-context.js.map +1 -0
  239. package/dist/server/server-context.d.ts +38 -0
  240. package/dist/server/server-context.d.ts.map +1 -0
  241. package/dist/server/server-context.js +38 -0
  242. package/dist/server/server-context.js.map +1 -0
  243. package/dist/server/server.d.ts +148 -35
  244. package/dist/server/server.d.ts.map +1 -1
  245. package/dist/server/server.js +482 -145
  246. package/dist/server/server.js.map +1 -1
  247. package/dist/server/types.d.ts +2 -2
  248. package/dist/server/types.d.ts.map +1 -1
  249. package/dist/server/types.js +2 -2
  250. package/dist/server/types.js.map +1 -1
  251. package/dist/server/use-case-route.d.ts +263 -0
  252. package/dist/server/use-case-route.d.ts.map +1 -0
  253. package/dist/server/use-case-route.js +77 -0
  254. package/dist/server/use-case-route.js.map +1 -0
  255. package/dist/server-only.d.ts +8 -0
  256. package/dist/server-only.d.ts.map +1 -0
  257. package/dist/server-only.js +8 -0
  258. package/dist/server-only.js.map +1 -0
  259. package/dist/tasks/index.d.ts +139 -0
  260. package/dist/tasks/index.d.ts.map +1 -0
  261. package/dist/tasks/index.js +98 -0
  262. package/dist/tasks/index.js.map +1 -0
  263. package/dist/testing/index.d.ts +611 -5
  264. package/dist/testing/index.d.ts.map +1 -1
  265. package/dist/testing/index.js +434 -4
  266. package/dist/testing/index.js.map +1 -1
  267. package/dist/tracing/index.d.ts +89 -0
  268. package/dist/tracing/index.d.ts.map +1 -0
  269. package/dist/tracing/index.js +101 -0
  270. package/dist/tracing/index.js.map +1 -0
  271. package/dist/uploads/client.d.ts +278 -0
  272. package/dist/uploads/client.d.ts.map +1 -0
  273. package/dist/uploads/client.js +428 -0
  274. package/dist/uploads/client.js.map +1 -0
  275. package/dist/uploads/index.d.ts +361 -0
  276. package/dist/uploads/index.d.ts.map +1 -0
  277. package/dist/uploads/index.js +543 -0
  278. package/dist/uploads/index.js.map +1 -0
  279. package/package.json +34 -3
  280. package/src/application/index.ts +193 -10
  281. package/src/client/client.ts +148 -150
  282. package/src/client/error-messages.ts +35 -0
  283. package/src/client/index.ts +12 -4
  284. package/src/client/types.ts +44 -5
  285. package/src/client-only.ts +7 -0
  286. package/src/config/index.ts +6 -6
  287. package/src/contracts/catalog-errors.ts +115 -0
  288. package/src/contracts/contract-builder.ts +39 -76
  289. package/src/contracts/contract-group.ts +33 -68
  290. package/src/contracts/contract-like.ts +1 -1
  291. package/src/contracts/index.ts +24 -11
  292. package/src/contracts/openapi-meta.ts +55 -0
  293. package/src/contracts/path-template.ts +2 -2
  294. package/src/contracts/schema-shape.ts +75 -0
  295. package/src/contracts/success-status.ts +68 -0
  296. package/src/contracts/types.ts +32 -5
  297. package/src/contracts/utils.ts +5 -2
  298. package/src/domain/events.ts +6 -2
  299. package/src/domain/index.ts +3 -3
  300. package/src/errors/catalog.ts +9 -1
  301. package/src/errors/http.ts +11 -1
  302. package/src/errors/index.ts +4 -4
  303. package/src/errors/response.ts +4 -1
  304. package/src/events/index.ts +12 -26
  305. package/src/idempotency/index.ts +5 -3
  306. package/src/jobs/index.ts +340 -29
  307. package/src/notifications/index.ts +17 -27
  308. package/src/openapi/index.ts +73 -38
  309. package/src/openapi/schema-introspector.ts +68 -17
  310. package/src/outbox/index.ts +151 -6
  311. package/src/ports/audit.ts +120 -11
  312. package/src/ports/auth.ts +132 -0
  313. package/src/ports/events.ts +2 -2
  314. package/src/ports/index.ts +104 -35
  315. package/src/ports/policy.ts +50 -3
  316. package/src/ports/testing.ts +2220 -33
  317. package/src/ports/unbound.ts +64 -0
  318. package/src/ports/unit-of-work.ts +6 -2
  319. package/src/providers/index.ts +16 -3
  320. package/src/providers/instrumentation.ts +93 -8
  321. package/src/providers/metadata.ts +234 -0
  322. package/src/providers/provider.ts +168 -9
  323. package/src/schedules/index.ts +173 -23
  324. package/src/server/audit-context.ts +45 -0
  325. package/src/server/context.ts +224 -0
  326. package/src/server/contract-like.ts +1 -1
  327. package/src/server/health.ts +2 -2
  328. package/src/server/hooks/auth.ts +175 -158
  329. package/src/server/hooks/cors.ts +1 -1
  330. package/src/server/hooks/errors.ts +7 -4
  331. package/src/server/hooks/idempotency.ts +263 -0
  332. package/src/server/hooks/index.ts +15 -12
  333. package/src/server/hooks/logging.ts +3 -3
  334. package/src/server/hooks/rate-limit.ts +85 -17
  335. package/src/server/hooks.ts +1 -1
  336. package/src/server/http.ts +112 -6
  337. package/src/server/index.ts +63 -12
  338. package/src/server/instrumentation.ts +470 -0
  339. package/src/server/openapi.ts +4 -4
  340. package/src/server/providers/index.ts +6 -3
  341. package/src/server/providers/loadProviderConfig.ts +4 -4
  342. package/src/server/request-context.ts +116 -0
  343. package/src/server/server-context.ts +44 -0
  344. package/src/server/server.ts +1045 -229
  345. package/src/server/types.ts +2 -2
  346. package/src/server/use-case-route.ts +430 -0
  347. package/src/server-only.ts +7 -0
  348. package/src/tasks/index.ts +275 -0
  349. package/src/testing/index.ts +1153 -6
  350. package/src/tracing/index.ts +176 -0
  351. package/src/uploads/client.ts +861 -0
  352. package/src/uploads/index.ts +1071 -0
  353. package/dist/ports/mailer.d.ts +0 -6
  354. package/dist/ports/mailer.d.ts.map +0 -1
  355. package/dist/ports/mailer.js +0 -2
  356. package/dist/ports/mailer.js.map +0 -1
  357. package/dist/ports/schedules.d.ts +0 -9
  358. package/dist/ports/schedules.d.ts.map +0 -1
  359. package/dist/ports/schedules.js +0 -2
  360. package/dist/ports/schedules.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { StandardSchemaV1 } from "@standard-schema/spec";
2
- import type { AnyPorts } from "../../ports";
3
- import type { ServiceProvider } from "../../providers";
2
+ import type { AnyPorts } from "../../ports/index.js";
3
+ import type { ServiceProvider } from "../../providers/index.js";
4
4
  declare function parseStandardSchema<Schema extends StandardSchemaV1<unknown, unknown>>(schema: Schema, input: unknown): Promise<StandardSchemaV1.InferOutput<Schema>>;
5
5
  /**
6
6
  * Load and validate config for a provider.
@@ -1 +1 @@
1
- {"version":3,"file":"loadProviderConfig.d.ts","sourceRoot":"","sources":["../../../src/server/providers/loadProviderConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAO9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAOvD,iBAAe,mBAAmB,CAChC,MAAM,SAAS,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,EAEjD,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAU/C;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,SAAS,QAAQ,EACtB,MAAM,SAAS,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,EAEjD,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,EACxC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,CA8B3D;AAED;;GAEG;AACH,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
1
+ {"version":3,"file":"loadProviderConfig.d.ts","sourceRoot":"","sources":["../../../src/server/providers/loadProviderConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAO9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAOhE,iBAAe,mBAAmB,CAChC,MAAM,SAAS,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,EAEjD,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAU/C;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,SAAS,QAAQ,EACtB,MAAM,SAAS,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,EAEjD,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,EACxC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,CA8B3D;AAED;;GAEG;AACH,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
- import { ConfigValidationError, parseStandardSchemaAsync, readEnv, } from "../../config";
2
- import { SchemaValidationError } from "../../errors";
1
+ import { ConfigValidationError, parseStandardSchemaAsync, readEnv, } from "../../config/index.js";
2
+ import { SchemaValidationError } from "../../errors/index.js";
3
3
  async function parseStandardSchema(schema, input) {
4
4
  try {
5
5
  return await parseStandardSchemaAsync(schema, input);
@@ -1 +1 @@
1
- {"version":3,"file":"loadProviderConfig.js","sourceRoot":"","sources":["../../../src/server/providers/loadProviderConfig.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,OAAO,GACR,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AASrD,KAAK,UAAU,mBAAmB,CAGhC,MAAc,EACd,KAAc;IAEd,IAAI,C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,CAAC,CAAC,CAAC,KAAK,SAAS,CACvD;YACH,CAAC,CAAC,EAAE,CAAC;QACP,MAAM,IAAI,GAAG,SAAS;YACpB,CAAC,CAAC,KAAK,CAAC,MAAM;gBACZ,CAAC,CAAC,mCAAmC,SAAS,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBACtE,CAAC,CAAC,sCAAsC,SAAS,GAAG;YACtD,CAAC,CAAC,EAAE,CAAC;QACP,MAAM,IAAI,KAAK,CACb,uCAAuC,QAAQ,CAAC,IAAI,IAAI,MAAM,KAAM,KAAe,CAAC,OAAO,GAAG,IAAI,EAAE,CACrG,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
1
+ {"version":3,"file":"loadProviderConfig.js","sourceRoot":"","sources":["../../../src/server/providers/loadProviderConfig.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,OAAO,GACR,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAS9D,KAAK,UAAU,mBAAmB,CAGhC,MAAc,EACd,KAAc;IAEd,IAAI,CAAC;QACH,OAAO,MAAM,wBAAwB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACvD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,qBAAqB,EAAE,CAAC;YAC3C,MAAM,IAAI,qBAAqB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAChD,CAAC;QAED,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAItC,QAAwC,EACxC,GAAuC,EACvC,SAAkC;IAElC,MAAM,SAAS,GAAG,QAAQ,CAAC,MAA+C,CAAC;IAC3E,IAAI,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IAEjC,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AAC"}
@@ -0,0 +1,67 @@
1
+ import type { ActivityActor, ActivityTenant } from "../ports/audit.js";
2
+ /**
3
+ * Ambient correlation values for the request currently being handled.
4
+ *
5
+ * The server enters this context before user hooks run so instrumentation
6
+ * sinks can correlate events recorded anywhere in the request lifecycle.
7
+ * Identity values (`actor`, `tenant`) are refreshed by the server whenever
8
+ * hooks finalize a new context, so wrappers such as `createAmbientAuditLog`
9
+ * observe the elevated identity at record time.
10
+ */
11
+ export interface ActiveRequestContext {
12
+ requestId?: string;
13
+ traceId?: string;
14
+ spanId?: string;
15
+ parentSpanId?: string;
16
+ traceparent?: string;
17
+ /**
18
+ * Actor for the current request or service execution, when known.
19
+ */
20
+ actor?: ActivityActor;
21
+ /**
22
+ * Tenant scope for the current request or service execution, when known.
23
+ */
24
+ tenant?: ActivityTenant;
25
+ }
26
+ /**
27
+ * Enter the ambient request context for the current async execution.
28
+ */
29
+ export declare function enterActiveRequestContext(context: ActiveRequestContext): void;
30
+ /**
31
+ * Clear the ambient request context for the current async execution.
32
+ */
33
+ export declare function clearActiveRequestContext(): void;
34
+ /**
35
+ * Read the ambient request context, when one is active.
36
+ */
37
+ export declare function getActiveRequestContext(): ActiveRequestContext | undefined;
38
+ /**
39
+ * Read a normalized actor from an app context object, when present.
40
+ */
41
+ export declare function readContextActor(ctx: unknown): ActivityActor | undefined;
42
+ /**
43
+ * Read a normalized tenant from an app context object, when present.
44
+ */
45
+ export declare function readContextTenant(ctx: unknown): ActivityTenant | undefined;
46
+ /**
47
+ * Update identity fields on the active ambient request context in place.
48
+ *
49
+ * The server calls this after hooks finalize a new request context so the
50
+ * elevated actor/tenant become visible to ambient consumers, including async
51
+ * frames that captured the context object before the update. No-op when no
52
+ * ambient context is active.
53
+ */
54
+ export declare function setActiveRequestIdentity(identity: {
55
+ actor?: ActivityActor;
56
+ tenant?: ActivityTenant;
57
+ }): void;
58
+ /**
59
+ * Fill missing correlation fields on an event from the ambient request
60
+ * context.
61
+ */
62
+ export declare function inheritActiveRequestContext<Event extends {
63
+ requestId?: string;
64
+ traceId?: string;
65
+ traceparent?: string;
66
+ }>(event: Event): Event;
67
+ //# sourceMappingURL=request-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-context.d.ts","sourceRoot":"","sources":["../../src/server/request-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEvE;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAMD;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAE7E;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,oBAAoB,GAAG,SAAS,CAE1E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,CAOxE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAO1E;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE;IACjD,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB,GAAG,IAAI,CAKP;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,SAAS;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,EACD,KAAK,EAAE,KAAK,GAAG,KAAK,CAUrB"}
@@ -0,0 +1,79 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ const activeRequestContext = new AsyncLocalStorage();
3
+ /**
4
+ * Enter the ambient request context for the current async execution.
5
+ */
6
+ export function enterActiveRequestContext(context) {
7
+ activeRequestContext.enterWith(context);
8
+ }
9
+ /**
10
+ * Clear the ambient request context for the current async execution.
11
+ */
12
+ export function clearActiveRequestContext() {
13
+ activeRequestContext.enterWith(undefined);
14
+ }
15
+ /**
16
+ * Read the ambient request context, when one is active.
17
+ */
18
+ export function getActiveRequestContext() {
19
+ return activeRequestContext.getStore();
20
+ }
21
+ /**
22
+ * Read a normalized actor from an app context object, when present.
23
+ */
24
+ export function readContextActor(ctx) {
25
+ if (!ctx || typeof ctx !== "object")
26
+ return undefined;
27
+ const actor = ctx.actor;
28
+ if (!actor || typeof actor !== "object")
29
+ return undefined;
30
+ return typeof actor.type === "string"
31
+ ? actor
32
+ : undefined;
33
+ }
34
+ /**
35
+ * Read a normalized tenant from an app context object, when present.
36
+ */
37
+ export function readContextTenant(ctx) {
38
+ if (!ctx || typeof ctx !== "object")
39
+ return undefined;
40
+ const tenant = ctx.tenant;
41
+ if (!tenant || typeof tenant !== "object")
42
+ return undefined;
43
+ return typeof tenant.id === "string"
44
+ ? tenant
45
+ : undefined;
46
+ }
47
+ /**
48
+ * Update identity fields on the active ambient request context in place.
49
+ *
50
+ * The server calls this after hooks finalize a new request context so the
51
+ * elevated actor/tenant become visible to ambient consumers, including async
52
+ * frames that captured the context object before the update. No-op when no
53
+ * ambient context is active.
54
+ */
55
+ export function setActiveRequestIdentity(identity) {
56
+ const context = activeRequestContext.getStore();
57
+ if (!context)
58
+ return;
59
+ if (identity.actor)
60
+ context.actor = identity.actor;
61
+ if (identity.tenant)
62
+ context.tenant = identity.tenant;
63
+ }
64
+ /**
65
+ * Fill missing correlation fields on an event from the ambient request
66
+ * context.
67
+ */
68
+ export function inheritActiveRequestContext(event) {
69
+ const context = getActiveRequestContext();
70
+ if (!context)
71
+ return event;
72
+ return {
73
+ ...event,
74
+ requestId: event.requestId ?? context.requestId,
75
+ traceId: event.traceId ?? context.traceId,
76
+ traceparent: event.traceparent ?? context.traceparent,
77
+ };
78
+ }
79
+ //# sourceMappingURL=request-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-context.js","sourceRoot":"","sources":["../../src/server/request-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AA4BrD,MAAM,oBAAoB,GAAG,IAAI,iBAAiB,EAE/C,CAAC;AAEJ;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAA6B;IACrE,oBAAoB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB;IACvC,oBAAoB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO,oBAAoB,CAAC,QAAQ,EAAE,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAY;IAC3C,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACtD,MAAM,KAAK,GAAI,GAA2B,CAAC,KAAK,CAAC;IACjD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC1D,OAAO,OAAQ,KAA4B,CAAC,IAAI,KAAK,QAAQ;QAC3D,CAAC,CAAE,KAAuB;QAC1B,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAY;IAC5C,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACtD,MAAM,MAAM,GAAI,GAA4B,CAAC,MAAM,CAAC;IACpD,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC5D,OAAO,OAAQ,MAA2B,CAAC,EAAE,KAAK,QAAQ;QACxD,CAAC,CAAE,MAAyB;QAC5B,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CAAC,QAGxC;IACC,MAAM,OAAO,GAAG,oBAAoB,CAAC,QAAQ,EAAE,CAAC;IAChD,IAAI,CAAC,OAAO;QAAE,OAAO;IACrB,IAAI,QAAQ,CAAC,KAAK;QAAE,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;IACnD,IAAI,QAAQ,CAAC,MAAM;QAAE,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAMzC,KAAY;IACZ,MAAM,OAAO,GAAG,uBAAuB,EAAE,CAAC;IAC1C,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAE3B,OAAO;QACL,GAAG,KAAK;QACR,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS;QAC/C,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO;QACzC,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,OAAO,CAAC,WAAW;KACtD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { AnyPorts } from "../ports/index.js";
2
+ import type { ServerContextConfig } from "./context.js";
3
+ /**
4
+ * Declare a server context blueprint once and share it between the runtime
5
+ * server and tests.
6
+ *
7
+ * The helper preserves the blueprint exactly as written — `request`,
8
+ * `service`, and `gate` keep their inferred types — so apps can keep the
9
+ * blueprint in a canonical `server/context.ts` file and pass the same value to
10
+ * `createServer(...)` (through an adapter such as `createNextServer` or
11
+ * `createFetchServer`) and to `createTestApp(...)`.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * // server/context.ts
16
+ * export const appContext = defineServerContext<AppContext, AppPorts>()({
17
+ * gate: (ports) => ports.gate,
18
+ * request: async ({ req, ports, requestId, trace }) => ({
19
+ * actor: await resolveActor(req),
20
+ * auth: null,
21
+ * requestId,
22
+ * ...trace,
23
+ * ports,
24
+ * }),
25
+ * service: ({ ports, requestId, trace }) => ({
26
+ * actor: createServiceActor("app-service"),
27
+ * auth: null,
28
+ * requestId,
29
+ * ...trace,
30
+ * ports,
31
+ * }),
32
+ * });
33
+ * ```
34
+ *
35
+ * @returns A function that collects and returns the typed context blueprint.
36
+ */
37
+ export declare function defineServerContext<Ctx, Ports extends AnyPorts = AnyPorts>(): <ServiceInput = void>(blueprint: ServerContextConfig<Ctx, Ports, ServiceInput>) => ServerContextConfig<Ctx, Ports, ServiceInput>;
38
+ //# sourceMappingURL=server-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-context.d.ts","sourceRoot":"","sources":["../../src/server/server-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,KAAK,SAAS,QAAQ,GAAG,QAAQ,KAAK,CAC7E,YAAY,GAAG,IAAI,EAEnB,SAAS,EAAE,mBAAmB,CAAC,GAAG,EAAE,KAAK,EAAE,YAAY,CAAC,KACrD,mBAAmB,CAAC,GAAG,EAAE,KAAK,EAAE,YAAY,CAAC,CAEjD"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Declare a server context blueprint once and share it between the runtime
3
+ * server and tests.
4
+ *
5
+ * The helper preserves the blueprint exactly as written — `request`,
6
+ * `service`, and `gate` keep their inferred types — so apps can keep the
7
+ * blueprint in a canonical `server/context.ts` file and pass the same value to
8
+ * `createServer(...)` (through an adapter such as `createNextServer` or
9
+ * `createFetchServer`) and to `createTestApp(...)`.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * // server/context.ts
14
+ * export const appContext = defineServerContext<AppContext, AppPorts>()({
15
+ * gate: (ports) => ports.gate,
16
+ * request: async ({ req, ports, requestId, trace }) => ({
17
+ * actor: await resolveActor(req),
18
+ * auth: null,
19
+ * requestId,
20
+ * ...trace,
21
+ * ports,
22
+ * }),
23
+ * service: ({ ports, requestId, trace }) => ({
24
+ * actor: createServiceActor("app-service"),
25
+ * auth: null,
26
+ * requestId,
27
+ * ...trace,
28
+ * ports,
29
+ * }),
30
+ * });
31
+ * ```
32
+ *
33
+ * @returns A function that collects and returns the typed context blueprint.
34
+ */
35
+ export function defineServerContext() {
36
+ return (blueprint) => blueprint;
37
+ }
38
+ //# sourceMappingURL=server-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-context.js","sourceRoot":"","sources":["../../src/server/server-context.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,mBAAmB;IAKjC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC;AAClC,CAAC"}
@@ -1,34 +1,56 @@
1
1
  import type { StandardSchemaV1 } from "@standard-schema/spec";
2
- import { type HttpContractConfig } from "../contracts";
3
- import type { AnyPorts } from "../ports";
4
- import type { ProvidedPortsOfList, ServiceProvider } from "../providers";
5
- import type { ContractLike, ResolveContract } from "./contract-like";
6
- import type { Handler, HttpRequestLike, HttpResponse, ServerCaughtErrorHook, ServerHook, ServerUnhandledErrorMapper } from "./http";
2
+ import { type HttpContractConfig } from "../contracts/index.js";
3
+ import type { AnyPorts } from "../ports/index.js";
4
+ import type { InferProviderPorts, ServiceProvider } from "../providers/index.js";
5
+ import type { ServerContextConfig, ServiceContextInputArgs } from "./context.js";
6
+ import type { ContractLike, ResolveContract } from "./contract-like.js";
7
+ import type { AddedCtxFromHooks, Handler, HttpRequestLike, HttpResponse, RouteHook, ServerCaughtErrorHook, ServerHook, ServerUnhandledErrorMapper } from "./http.js";
8
+ import type { ServerInstrumentationOptions } from "./instrumentation.js";
9
+ import type { AnyUseCaseLike, AnyUseCaseRouteDef, UseCaseRouteDef, ValidatedRouteInputs } from "./use-case-route.js";
7
10
  /**
8
- * Route registration for one contract.
11
+ * Route registration that connects a contract to the handler implementing it.
9
12
  *
10
- * Route definitions connect a contract to the handler that implements it. Most
11
- * apps keep these in `features/<feature>/routes.ts` and compose them with
12
- * `defineRoutes(...)`.
13
+ * Most apps keep route definitions in `features/<feature>/routes.ts` and
14
+ * compose them with `defineRoutes(...)`.
13
15
  */
14
- export type RouteDef<Ctx, CLike extends ContractLike = ContractLike> = {
16
+ export type HandlerRouteDef<Ctx, CLike extends ContractLike = ContractLike, Hooks extends readonly RouteHook<Ctx, object>[] = readonly RouteHook<Ctx, object>[]> = {
15
17
  /**
16
18
  * Contract builder or plain contract config for this route.
17
19
  */
18
20
  contract: CLike;
21
+ /**
22
+ * Route-scoped hooks that run after group hooks and before the handler.
23
+ */
24
+ hooks?: Hooks;
19
25
  /**
20
26
  * Handler that implements the contract.
21
27
  */
22
- handle: Handler<Ctx, ResolveContract<CLike>>;
28
+ handle: Handler<Ctx & AddedCtxFromHooks<Hooks>, ResolveContract<CLike>>;
29
+ useCase?: never;
30
+ input?: never;
31
+ status?: never;
23
32
  };
33
+ /**
34
+ * Route registration for one contract.
35
+ *
36
+ * Routes either bind the contract directly to a use case (`{ contract,
37
+ * useCase }`) or implement a full handler (`{ contract, handle }`). The full
38
+ * handler form is the escape hatch for response headers, streaming, native
39
+ * `Response` values, and multi-status handling.
40
+ */
41
+ export type RouteDef<Ctx, CLike extends ContractLike = ContractLike, Hooks extends readonly RouteHook<Ctx, object>[] = readonly RouteHook<Ctx, object>[]> = HandlerRouteDef<Ctx, CLike, Hooks> | AnyUseCaseRouteDef<Ctx, CLike, Hooks>;
42
+ type AnyRouteDef = RouteDef<any, any>;
43
+ type PlainRouteDef<Ctx> = RouteDef<Ctx, any, readonly []>;
44
+ type AnyContractRouteDef<Ctx> = RouteDef<Ctx, any>;
24
45
  declare const ROUTE_GROUP_KIND = "beignet.route-group";
25
46
  /**
26
47
  * Named collection of related route registrations.
27
48
  *
28
- * Route groups are an organization helper only. `defineRoutes(...)` flattens
29
- * them before server registration.
49
+ * Route groups colocate feature routes and can apply scoped route hooks to
50
+ * every route in the group. `defineRoutes(...)` flattens them before server
51
+ * registration while preserving those hooks.
30
52
  */
31
- export type RouteGroup<Ctx, Routes extends readonly RouteDef<Ctx, any>[] = readonly RouteDef<Ctx, any>[]> = {
53
+ export type RouteGroup<Ctx, Routes extends readonly AnyRouteDef[] = readonly AnyRouteDef[]> = {
32
54
  /**
33
55
  * Internal marker used by `defineRoutes(...)`.
34
56
  */
@@ -37,21 +59,57 @@ export type RouteGroup<Ctx, Routes extends readonly RouteDef<Ctx, any>[] = reado
37
59
  * Human-readable group name.
38
60
  */
39
61
  name: string;
62
+ /**
63
+ * Hooks applied to every route in this group.
64
+ */
65
+ hooks?: readonly RouteHook<Ctx, object>[];
40
66
  /**
41
67
  * Route definitions in this group.
42
68
  */
43
69
  routes: Routes;
44
70
  };
45
- type RouteInput<Ctx> = RouteDef<Ctx, any> | RouteGroup<Ctx, readonly RouteDef<Ctx, any>[]>;
46
- type RoutesFromInput<Input> = Input extends RouteGroup<any, infer Routes> ? Routes : Input extends RouteDef<any, any> ? readonly [Input] : readonly [];
47
- type FlattenRouteInputs<Inputs extends readonly unknown[]> = number extends Inputs["length"] ? readonly RouteDef<any, any>[] : Inputs extends readonly [infer First, ...infer Rest] ? readonly [...RoutesFromInput<First>, ...FlattenRouteInputs<Rest>] : readonly [];
71
+ type RouteInput<Ctx> = AnyContractRouteDef<Ctx> | AnyRouteDef | RouteGroup<Ctx, readonly AnyRouteDef[]>;
72
+ type ContextualRouteInput<Ctx> = PlainRouteDef<Ctx> | RouteGroup<Ctx, readonly AnyRouteDef[]>;
73
+ type RouteGroupBuilder<Ctx> = {
74
+ <const GroupHooks extends readonly RouteHook<Ctx, object>[] = readonly [], const R extends readonly PlainRouteDef<Ctx & AddedCtxFromHooks<GroupHooks>>[] = readonly PlainRouteDef<Ctx & AddedCtxFromHooks<GroupHooks>>[]>(group: {
75
+ name: string;
76
+ hooks?: GroupHooks;
77
+ routes: R & ValidatedRouteInputs<Ctx & AddedCtxFromHooks<GroupHooks>, R>;
78
+ }): RouteGroup<Ctx, R>;
79
+ <const GroupHooks extends readonly RouteHook<Ctx, object>[] = readonly [], const R extends readonly AnyRouteDef[] = readonly AnyRouteDef[]>(group: {
80
+ name: string;
81
+ hooks?: GroupHooks;
82
+ routes: R & ValidatedRouteInputs<Ctx & AddedCtxFromHooks<GroupHooks>, R>;
83
+ }): RouteGroup<Ctx, R>;
84
+ };
85
+ type RoutesFromInput<Input> = Input extends RouteGroup<infer _Ctx, infer Routes> ? Routes : Input extends AnyRouteDef ? readonly [Input] : readonly [];
86
+ type FlattenRouteInputs<Inputs extends readonly unknown[]> = number extends Inputs["length"] ? readonly AnyRouteDef[] : Inputs extends readonly [infer First, ...infer Rest] ? readonly [...RoutesFromInput<First>, ...FlattenRouteInputs<Rest>] : readonly [];
48
87
  type ContractsFromRouteList<Routes extends readonly RouteDef<any, any>[]> = {
49
88
  readonly [Index in keyof Routes]: Routes[Index] extends RouteDef<any, infer CLike> ? ResolveContract<CLike> : never;
50
89
  };
90
+ /**
91
+ * Define one route registration with hook-aware handler typing.
92
+ *
93
+ * Direct route objects are still supported. Use this helper when route-scoped
94
+ * hooks enrich `ctx` for a single handler and you want TypeScript to infer the
95
+ * added fields.
96
+ */
97
+ export declare function defineRoute<Ctx>(): {
98
+ <CLike extends ContractLike, UC extends AnyUseCaseLike, const Hooks extends readonly RouteHook<Ctx, object>[] = readonly []>(route: UseCaseRouteDef<Ctx, CLike, UC, Hooks>): UseCaseRouteDef<Ctx, CLike, UC, Hooks>;
99
+ <CLike extends ContractLike, const Hooks extends readonly RouteHook<Ctx, object>[] = readonly []>(route: HandlerRouteDef<Ctx, CLike, Hooks>): HandlerRouteDef<Ctx, CLike, Hooks>;
100
+ };
101
+ /**
102
+ * Loosely typed provider list element.
103
+ *
104
+ * Required-port, app-context, and service-input generics are erased here so
105
+ * providers created with the typed `createProvider<Requires, Context,
106
+ * ServiceInput>()` form stay assignable to server provider lists.
107
+ */
108
+ type AnyServiceProvider = ServiceProvider<unknown, StandardSchemaV1<any, any>, AnyPorts, any, any>;
51
109
  /**
52
110
  * Options for creating a Beignet server instance.
53
111
  */
54
- export type CreateServerOptions<Ctx, Ports extends AnyPorts, Routes extends readonly RouteDef<Ctx, any>[] = readonly RouteDef<Ctx, any>[], Providers extends readonly ServiceProvider<unknown, StandardSchemaV1<any, any>, AnyPorts>[] = readonly []> = {
112
+ export type CreateServerOptions<Ctx, Ports extends AnyPorts, ServiceInput = void, Routes extends readonly RouteDef<any, any>[] = readonly RouteDef<any, any>[], Providers extends readonly AnyServiceProvider[] = readonly []> = {
55
113
  /**
56
114
  * App-owned ports available to context creation, hooks, and handlers.
57
115
  */
@@ -72,24 +130,60 @@ export type CreateServerOptions<Ctx, Ports extends AnyPorts, Routes extends read
72
130
  */
73
131
  providerConfig?: Record<string, unknown>;
74
132
  /**
75
- * Create request context after a route is matched.
133
+ * Context blueprint for request and service contexts.
134
+ *
135
+ * Gate-less contexts may pass a plain request factory. Contexts with a
136
+ * `gate` property must use the blueprint form
137
+ * `{ gate: (ports) => ports.gate, request, service }` so the server owns
138
+ * gate attachment and identity changes can never go stale.
76
139
  *
77
140
  * The `ports` argument includes app ports plus ports provided during server
78
141
  * startup.
79
142
  */
80
- createContext: (args: {
81
- req: HttpRequestLike;
82
- ports: Ports & ProvidedPortsOfList<Providers>;
83
- contract?: HttpContractConfig;
84
- }) => Ctx | Promise<Ctx>;
143
+ context: ServerContextConfig<Ctx, Ports & InferProviderPorts<Providers>, ServiceInput>;
85
144
  /**
86
145
  * Server hooks that wrap every registered route.
87
146
  */
88
- hooks?: ServerHook<Ctx, Ports & ProvidedPortsOfList<Providers>>[];
147
+ hooks?: ServerHook<Ctx, Ports & InferProviderPorts<Providers>>[];
148
+ /**
149
+ * Server-owned request instrumentation.
150
+ *
151
+ * The server resolves a request ID and W3C trace context for every request
152
+ * before user hooks and context creation, writes `x-request-id` and
153
+ * `traceparent` response headers, and records request and error events into
154
+ * the resolved provider instrumentation port (`ports.instrumentation`, then
155
+ * `ports.devtools`) when one is installed.
156
+ *
157
+ * Pass `false` to disable headers and event recording. Context factories
158
+ * still receive `requestId` and `trace` arguments.
159
+ */
160
+ instrumentation?: ServerInstrumentationOptions<Ctx> | false;
161
+ /**
162
+ * Whether route-owned responses are validated against the contract's
163
+ * declared statuses and response schemas before they are sent.
164
+ *
165
+ * Disable this to trade response guarantees for throughput, mirroring the
166
+ * client-side `validateResponses` option.
167
+ *
168
+ * @default true
169
+ */
170
+ validateResponses?: boolean;
89
171
  /**
90
172
  * Route list to register up front.
91
173
  */
92
174
  routes?: Routes;
175
+ /**
176
+ * How to handle ports that are still unbound after all providers have
177
+ * started.
178
+ *
179
+ * Ports declared as `deferred` in `definePorts(...)` boot as throwing
180
+ * placeholders until a provider contributes them. The default `"error"`
181
+ * fails startup and lists the unbound port keys. Apps that bind every port
182
+ * directly are unaffected.
183
+ *
184
+ * @default "error"
185
+ */
186
+ onUnboundPorts?: "error" | "warn" | "ignore";
93
187
  /**
94
188
  * Global caught-error observer.
95
189
  */
@@ -105,7 +199,7 @@ interface RouteBuilder<Ctx, C extends HttpContractConfig> {
105
199
  /**
106
200
  * Runtime server object returned by `createServer(...)`.
107
201
  */
108
- export interface ServerInstance<Ctx, Ports extends AnyPorts = AnyPorts> {
202
+ export interface ServerInstance<Ctx, Ports extends AnyPorts = AnyPorts, ServiceInput = void> {
109
203
  /**
110
204
  * Catch-all request handler for platform adapters.
111
205
  */
@@ -114,6 +208,20 @@ export interface ServerInstance<Ctx, Ports extends AnyPorts = AnyPorts> {
114
208
  * Register and build a single route handler imperatively.
115
209
  */
116
210
  route: <CLike extends ContractLike>(contractLike: CLike) => RouteBuilder<Ctx, ResolveContract<CLike>>;
211
+ /**
212
+ * Build a fully assembled request context from a framework-neutral request.
213
+ *
214
+ * Use this for adapter entry points outside the route pipeline, such as
215
+ * server components or upload routes.
216
+ */
217
+ createRequestContext: (req: HttpRequestLike) => Promise<Ctx>;
218
+ /**
219
+ * Build a fully assembled service context for schedules, outbox drains,
220
+ * tasks, and background work.
221
+ *
222
+ * Requires `context.service` to be declared in `createServer(...)`.
223
+ */
224
+ createServiceContext: (...args: ServiceContextInputArgs<ServiceInput>) => Promise<Ctx>;
117
225
  /**
118
226
  * Contract configs registered through the `routes` option.
119
227
  */
@@ -135,11 +243,11 @@ export interface ServerInstance<Ctx, Ports extends AnyPorts = AnyPorts> {
135
243
  * Use adapter packages such as `@beignet/next` to expose `server.api` to a
136
244
  * specific runtime.
137
245
  *
138
- * @param options - Ports, providers, routes, hooks, context factory, and error
139
- * mapping hooks for the server.
246
+ * @param options - Ports, providers, routes, hooks, context blueprint, and
247
+ * error mapping hooks for the server.
140
248
  * @returns A started server instance with final ports and a catch-all handler.
141
249
  */
142
- export declare function createServer<Ctx, Ports extends AnyPorts, Routes extends readonly RouteDef<Ctx, any>[] = readonly RouteDef<Ctx, any>[], Providers extends readonly ServiceProvider<unknown, StandardSchemaV1<any, any>, AnyPorts>[] = readonly []>(options: CreateServerOptions<Ctx, Ports, Routes, Providers>): Promise<ServerInstance<Ctx, Ports & ProvidedPortsOfList<Providers>>>;
250
+ export declare function createServer<Ctx, Ports extends AnyPorts, ServiceInput = void, Routes extends readonly RouteDef<any, any>[] = readonly RouteDef<any, any>[], Providers extends readonly AnyServiceProvider[] = readonly []>(options: CreateServerOptions<Ctx, Ports, ServiceInput, Routes, Providers>): Promise<ServerInstance<Ctx, Ports & InferProviderPorts<Providers>, ServiceInput>>;
143
251
  /**
144
252
  * Define and flatten route registrations with strong type inference.
145
253
  *
@@ -149,11 +257,12 @@ export declare function createServer<Ctx, Ports extends AnyPorts, Routes extends
149
257
  * @example
150
258
  * ```ts
151
259
  * const routes = defineRoutes<AppContext>([
152
- * { contract: listPosts, handle: async ({ ctx }) => ctx.posts.list() },
260
+ * { contract: listPosts, useCase: listPostsUseCase },
153
261
  * ]);
154
262
  * ```
155
263
  */
156
- export declare function defineRoutes<Ctx, const R extends readonly RouteInput<Ctx>[] = readonly RouteInput<Ctx>[]>(routes: R): FlattenRouteInputs<R>;
264
+ export declare function defineRoutes<Ctx, const R extends readonly ContextualRouteInput<Ctx>[] = readonly ContextualRouteInput<Ctx>[]>(routes: R & ValidatedRouteInputs<Ctx, R>): FlattenRouteInputs<R>;
265
+ export declare function defineRoutes<Ctx, const R extends readonly RouteInput<Ctx>[] = readonly RouteInput<Ctx>[]>(routes: R & ValidatedRouteInputs<Ctx, R>): FlattenRouteInputs<R>;
157
266
  /**
158
267
  * Extract contract configs from a route list.
159
268
  *
@@ -165,21 +274,25 @@ export declare function contractsFromRoutes<const R extends readonly RouteDef<an
165
274
  * Define a named group of related route registrations.
166
275
  *
167
276
  * Route groups are flattened by defineRoutes, so createServer still receives
168
- * a regular route list while app code can keep feature route wiring colocated.
277
+ * a regular route list while app code can keep feature route wiring and scoped
278
+ * hooks colocated.
169
279
  *
170
280
  * @example
171
281
  * ```ts
172
- * const todoRoutes = defineRouteGroup<AppContext>({
282
+ * const todoRoutes = defineRouteGroup<AppContext>()({
173
283
  * name: "todos",
284
+ * hooks: [auth.optional()],
174
285
  * routes: [
175
- * { contract: listTodos, handle: async ({ ctx }) => ctx.todos.list() },
286
+ * { contract: listTodos, useCase: listTodosUseCase },
176
287
  * ]
177
288
  * });
178
289
  * ```
179
290
  */
291
+ export declare function defineRouteGroup<Ctx>(): RouteGroupBuilder<Ctx>;
180
292
  export declare function defineRouteGroup<Ctx, const R extends readonly RouteDef<Ctx, any>[] = readonly RouteDef<Ctx, any>[]>(group: {
181
293
  name: string;
182
- routes: R;
294
+ hooks?: readonly RouteHook<Ctx, object>[];
295
+ routes: R & ValidatedRouteInputs<Ctx, R>;
183
296
  }): RouteGroup<Ctx, R>;
184
297
  export {};
185
298
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAIL,KAAK,kBAAkB,EAIxB,MAAM,cAAc,CAAC;AAOtB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,KAAK,EACV,mBAAmB,EAEnB,eAAe,EAChB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGrE,OAAO,KAAK,EACV,OAAO,EAEP,eAAe,EACf,YAAY,EAGZ,qBAAqB,EACrB,UAAU,EACV,0BAA0B,EAC3B,MAAM,QAAQ,CAAC;AAOhB;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,CAAC,GAAG,EAAE,KAAK,SAAS,YAAY,GAAG,YAAY,IAAI;IACrE;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC;IAChB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;CAC9C,CAAC;AAEF,QAAA,MAAM,gBAAgB,wBAAwB,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,MAAM,UAAU,CACpB,GAAG,EAEH,MAAM,SAAS,SAAS,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,SAAS,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE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