@classytic/arc 2.30.0 → 2.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +7 -0
  3. package/TRADEMARK.md +22 -0
  4. package/dist/{BaseController-B5DwufbB.mjs → BaseController-De7GqHck.mjs} +16 -17
  5. package/dist/{EventTransport-QmY7A258.d.mts → EventTransport-2uVV34WU.d.mts} +1 -0
  6. package/dist/{EventTransport-C6YA8xY9.mjs → EventTransport-9mlTgqzE.mjs} +1 -0
  7. package/dist/{HookSystem-WkIougo6.mjs → HookSystem-BcmPyq5I.mjs} +2 -1
  8. package/dist/{QueryCache-DOMT_iq7.d.mts → QueryCache-DFA-QrU9.d.mts} +2 -1
  9. package/dist/{ResourceRegistry-y9Hnypus.mjs → ResourceRegistry-qq0mn2s9.mjs} +3 -2
  10. package/dist/{actionPermissions-CAphcmUG.mjs → actionPermissions-BE5NwaQk.mjs} +1 -0
  11. package/dist/audit/index.d.mts +3 -2
  12. package/dist/audit/index.mjs +2 -1
  13. package/dist/auth/audit.d.mts +1 -0
  14. package/dist/auth/audit.mjs +1 -0
  15. package/dist/auth/index.d.mts +5 -4
  16. package/dist/auth/index.mjs +6 -5
  17. package/dist/auth/redis-session.d.mts +2 -1
  18. package/dist/auth/redis-session.mjs +1 -0
  19. package/dist/{applyPermissionResult-Cf6zUCvb.mjs → authorizationDecision-ChvUQGG1.mjs} +19 -10
  20. package/dist/{buildHandler-BYS3Vkfz.mjs → buildHandler-CDrCJzmB.mjs} +4 -3
  21. package/dist/cache/index.d.mts +4 -3
  22. package/dist/cache/index.mjs +4 -3
  23. package/dist/{caching-_NJeDd1_.mjs → caching-BFHA6Scf.mjs} +2 -1
  24. package/dist/cleanup/index.d.mts +4 -3
  25. package/dist/cleanup/index.mjs +9 -13
  26. package/dist/cli/commands/describe.d.mts +2 -1
  27. package/dist/cli/commands/describe.mjs +3 -2
  28. package/dist/cli/commands/docs.d.mts +1 -0
  29. package/dist/cli/commands/docs.mjs +3 -2
  30. package/dist/cli/commands/doctor.d.mts +1 -0
  31. package/dist/cli/commands/doctor.mjs +1 -0
  32. package/dist/cli/commands/generate.d.mts +2 -1
  33. package/dist/cli/commands/generate.mjs +2 -1
  34. package/dist/cli/commands/init.d.mts +2 -1
  35. package/dist/cli/commands/init.mjs +2 -1
  36. package/dist/cli/commands/introspect.d.mts +1 -0
  37. package/dist/cli/commands/introspect.mjs +2 -1
  38. package/dist/cli/index.d.mts +3 -2
  39. package/dist/cli/index.mjs +3 -2
  40. package/dist/{constants-DNre0wRg.mjs → constants-D3Dv4LAV.mjs} +1 -0
  41. package/dist/context/index.d.mts +1 -0
  42. package/dist/context/index.mjs +3 -2
  43. package/dist/core/index.d.mts +3 -2
  44. package/dist/core/index.mjs +7 -6
  45. package/dist/{core-poalJLvp.mjs → core-BGpIxINN.mjs} +3 -2
  46. package/dist/{createActionRouter-BxuywVRB.mjs → createActionRouter-CDXEdasl.mjs} +8 -7
  47. package/dist/{createAggregationRouter-BiY-lGdY.mjs → createAggregationRouter-KrQDzx-k.mjs} +7 -6
  48. package/dist/{createApp-CXrKFciH.mjs → createApp-Df89BEni.mjs} +484 -209
  49. package/dist/{defineAggregation-ufWjUwml.mjs → defineAggregation-DbPPS8RI.mjs} +1 -0
  50. package/dist/{defineResource-CxWqDCAy.mjs → defineResource-Bv6EtN1x.mjs} +63 -38
  51. package/dist/discovery/index.d.mts +1 -0
  52. package/dist/discovery/index.mjs +1 -0
  53. package/dist/docs/index.d.mts +3 -2
  54. package/dist/docs/index.mjs +3 -2
  55. package/dist/{elevation-C9s5hFP_.d.mts → elevation-BXCfVcNG.d.mts} +1 -0
  56. package/dist/{elevation-CIz1GjGm.mjs → elevation-D2l1mh4g.mjs} +4 -3
  57. package/dist/encryption/index.d.mts +2 -1
  58. package/dist/encryption/index.mjs +3 -2
  59. package/dist/{errorHandler-Bq2OeEQL.mjs → errorHandler-C5NeD6bT.mjs} +3 -2
  60. package/dist/{errorHandler-C6yv4ZTW.d.mts → errorHandler-CpYUJmPA.d.mts} +1 -0
  61. package/dist/{errors-DHcHVAgk.d.mts → errors-BGdVwP25.d.mts} +1 -0
  62. package/dist/{errors-DkO8Nk6-.mjs → errors-Cj42AntO.mjs} +1 -0
  63. package/dist/{eventPlugin-D2NNR4py.mjs → eventPlugin-CkffEihm.mjs} +5 -4
  64. package/dist/{eventPlugin-Bg3cP2_u.d.mts → eventPlugin-GF5nnBIq.d.mts} +2 -1
  65. package/dist/events/index.d.mts +4 -3
  66. package/dist/events/index.mjs +16 -4
  67. package/dist/events/transports/redis-stream-entry.d.mts +2 -1
  68. package/dist/events/transports/redis-stream-entry.mjs +1 -0
  69. package/dist/events/transports/redis.d.mts +2 -1
  70. package/dist/events/transports/redis.mjs +1 -0
  71. package/dist/{externalPaths-BE6wFpYv.d.mts → externalPaths-CmGOxOtD.d.mts} +1 -0
  72. package/dist/factory/index.d.mts +9 -5
  73. package/dist/factory/index.mjs +7 -6
  74. package/dist/{fastify-augmentation-0WhPnUH7.d.mts → fastify-augmentation-zh0_AYHa.d.mts} +13 -4
  75. package/dist/{fields-CQ_7KQWw.mjs → fields-CB5Cuzk9.mjs} +1 -0
  76. package/dist/{fields-D3lhgzhD.d.mts → fields-I_EeRWND.d.mts} +1 -0
  77. package/dist/{generate-BnsL9GBm.d.mts → generate-DCGuEbqI.d.mts} +1 -0
  78. package/dist/{generate-D0wZupBg.mjs → generate-EcA6ui4i.mjs} +2 -1
  79. package/dist/{headers-BvlQSDMB.mjs → headers-3zvE0rM3.mjs} +2 -1
  80. package/dist/{health-CB_m4S32.mjs → health-DjZYjM7H.mjs} +1 -0
  81. package/dist/hooks/index.d.mts +2 -1
  82. package/dist/hooks/index.mjs +2 -1
  83. package/dist/idempotency/index.d.mts +3 -2
  84. package/dist/idempotency/index.mjs +4 -3
  85. package/dist/idempotency/redis.d.mts +2 -1
  86. package/dist/idempotency/redis.mjs +1 -0
  87. package/dist/{index-Cx7bro4R.d.mts → index-Bc2ox8_U.d.mts} +5 -4
  88. package/dist/{index-CG4yqMDB.d.mts → index-C-481Zf2.d.mts} +74 -18
  89. package/dist/{index-Ch16aAah.d.mts → index-CEJNZFtX.d.mts} +53 -15
  90. package/dist/index-CFThn1K9.d.mts +224 -0
  91. package/dist/{index-Q5gzEIWY.d.mts → index-CpzxqePp.d.mts} +107 -32
  92. package/dist/index.d.mts +9 -8
  93. package/dist/index.mjs +11 -10
  94. package/dist/{init-tlRSt667.mjs → init-BEiNZBsJ.mjs} +19 -23
  95. package/dist/{init-BPEu8cs-.d.mts → init-Cscs4lab.d.mts} +1 -0
  96. package/dist/integrations/event-gateway.d.mts +3 -2
  97. package/dist/integrations/event-gateway.mjs +2 -1
  98. package/dist/integrations/index.d.mts +4 -3
  99. package/dist/integrations/index.mjs +1 -0
  100. package/dist/integrations/jobs/index.d.mts +2 -1
  101. package/dist/integrations/jobs/index.mjs +108 -32
  102. package/dist/integrations/mcp/index.d.mts +6 -6
  103. package/dist/integrations/mcp/index.mjs +2 -1
  104. package/dist/integrations/mcp/testing.d.mts +3 -2
  105. package/dist/integrations/mcp/testing.mjs +2 -2
  106. package/dist/integrations/streamline.d.mts +1 -0
  107. package/dist/integrations/streamline.mjs +3 -2
  108. package/dist/integrations/webhooks.d.mts +1 -0
  109. package/dist/integrations/webhooks.mjs +1 -0
  110. package/dist/integrations/websocket-pushref-redis.d.mts +2 -1
  111. package/dist/integrations/websocket-pushref-redis.mjs +1 -0
  112. package/dist/integrations/websocket-redis.d.mts +2 -1
  113. package/dist/integrations/websocket-redis.mjs +1 -0
  114. package/dist/integrations/websocket.d.mts +3 -2
  115. package/dist/integrations/websocket.mjs +1 -0
  116. package/dist/{interface-BGZCzOGL.d.mts → interface-BOk3YnTz.d.mts} +1 -0
  117. package/dist/{interface-Uk8ONJv7.d.mts → interface-DEWNOMza.d.mts} +1 -0
  118. package/dist/{interface-n5hpKg1d.mjs → interface-DYzM0q-u.mjs} +1 -0
  119. package/dist/{jsonBody-BlzAoGCe.mjs → jsonBody-BYbLDi5D.mjs} +2 -1
  120. package/dist/{keys-Cd316u_y.mjs → keys-C0_pa1tY.mjs} +1 -0
  121. package/dist/{loadResources-DpU8pfjV.mjs → loadResources-yawi9tAE.mjs} +2 -1
  122. package/dist/{loadResourcesFromEntry-kvGT6EcO.mjs → loadResourcesFromEntry-BAjYZonx.mjs} +2 -1
  123. package/dist/logger/index.d.mts +1 -0
  124. package/dist/logger/index.mjs +1 -0
  125. package/dist/{mcpPlugin-nRzm5g2s.mjs → mcpPlugin-B_es0hiF.mjs} +22 -23
  126. package/dist/{memory-CmnzXE5Z.mjs → memory-DR6wpa9F.mjs} +2 -1
  127. package/dist/{metrics-fdxI5mn_.mjs → metrics-CUdw_wLB.mjs} +2 -1
  128. package/dist/middleware/index.d.mts +2 -1
  129. package/dist/middleware/index.mjs +3 -2
  130. package/dist/migrations/index.d.mts +1 -0
  131. package/dist/migrations/index.mjs +2 -1
  132. package/dist/module-0pFJA6YW.mjs +78 -0
  133. package/dist/{multipartBody-D0eBvkeq.mjs → multipartBody-wOgj_fnj.mjs} +1 -0
  134. package/dist/{openapi-B8Vkbxbn.mjs → openapi-B2L4js1v.mjs} +6 -5
  135. package/dist/permissions/index.d.mts +5 -4
  136. package/dist/permissions/index.mjs +6 -5
  137. package/dist/{permissions-Bfu_8y1U.mjs → permissions-L--QDAir.mjs} +214 -41
  138. package/dist/{pipe-BOLmGIxa.mjs → pipe-DRDNsI2T.mjs} +2 -1
  139. package/dist/pipeline/index.d.mts +2 -1
  140. package/dist/pipeline/index.mjs +2 -1
  141. package/dist/{pipeline-BJnpkY9i.mjs → pipeline-UPQFatit.mjs} +6 -5
  142. package/dist/plugins/index.d.mts +8 -7
  143. package/dist/plugins/index.mjs +16 -15
  144. package/dist/plugins/response-cache.d.mts +1 -0
  145. package/dist/plugins/response-cache.mjs +2 -1
  146. package/dist/plugins/tracing-entry.d.mts +2 -1
  147. package/dist/plugins/tracing-entry.mjs +2 -1
  148. package/dist/{pluralize-BhrgwZb9.mjs → pluralize-O0FZgESl.mjs} +1 -0
  149. package/dist/{preloadResources-DCfa2egz.d.mts → preloadResources-CyoJMSiO.d.mts} +117 -12
  150. package/dist/{preloadResources-DSY5HGpS.mjs → preloadResources-Dz6BjzM6.mjs} +1 -0
  151. package/dist/presets/filesUpload.d.mts +6 -5
  152. package/dist/presets/filesUpload.mjs +9 -11
  153. package/dist/presets/index.d.mts +3 -2
  154. package/dist/presets/index.mjs +2 -1
  155. package/dist/presets/multiTenant.d.mts +2 -1
  156. package/dist/presets/multiTenant.mjs +3 -2
  157. package/dist/presets/search.d.mts +3 -2
  158. package/dist/presets/search.mjs +2 -1
  159. package/dist/{presets-CJOEXLuk.mjs → presets-C4-g4_4P.mjs} +4 -3
  160. package/dist/{projection-UBDgfMwu.mjs → projection-BHw6xlOQ.mjs} +2 -1
  161. package/dist/{pushref-registry-BbcnpNTm.d.mts → pushref-registry-Dov9l4qE.d.mts} +1 -0
  162. package/dist/{queryCachePlugin-DSGuSVLW.mjs → queryCachePlugin-BZr8v46E.mjs} +5 -4
  163. package/dist/{queryCachePlugin-br4otiqF.d.mts → queryCachePlugin-BzqxconG.d.mts} +3 -2
  164. package/dist/{rateLimit-DrED-C4v.mjs → rateLimit-CMPY5Qms.mjs} +7 -3
  165. package/dist/{rateLimitKey-BoWRH3e7.mjs → rateLimitKey-Dn5JNmkj.mjs} +1 -0
  166. package/dist/{realtime-B9nmIY5V.mjs → realtime-C5NoxWFY.mjs} +20 -9
  167. package/dist/{redis-UDtLaNj6.d.mts → redis-CduhKsJi.d.mts} +2 -1
  168. package/dist/{redis-stream-uIaauNpZ.d.mts → redis-stream-qN6A-RFv.d.mts} +2 -1
  169. package/dist/{registerRoute-JkxIEBJq.mjs → registerRoute-CBN84fc7.mjs} +4 -3
  170. package/dist/registry/index.d.mts +3 -2
  171. package/dist/registry/index.mjs +3 -2
  172. package/dist/{registry-BYXUUg21.mjs → registry-4213U4zb.mjs} +2 -1
  173. package/dist/{renewingLease-3cuQH7h8.mjs → renewingLease-Dll8mGgc.mjs} +1 -0
  174. package/dist/{replyHelpers-67tRawQZ.mjs → replyHelpers-DIiZKGUt.mjs} +2 -1
  175. package/dist/{repositoryFilter-Dz8k3S4P.mjs → repositoryFilter-f9eAfq_l.mjs} +1 -0
  176. package/dist/{requestContext-MrlJwECf.mjs → requestContext-2TxXOJ7T.mjs} +1 -0
  177. package/dist/{rolldown-runtime-8H4AJuhK.mjs → rolldown-runtime-CUsjNX9R.mjs} +1 -0
  178. package/dist/{schedules-CjOd2MG9.mjs → schedules-DdtlICTf.mjs} +3 -2
  179. package/dist/{schemaConverter-DJvodiHj.mjs → schemaConverter-D--wdJM-.mjs} +70 -17
  180. package/dist/{schemaIR-Ca7ySNPx.mjs → schemaIR-Bm2enbnh.mjs} +2 -1
  181. package/dist/schemas/index.d.mts +1 -0
  182. package/dist/schemas/index.mjs +1 -0
  183. package/dist/scim/index.d.mts +1 -0
  184. package/dist/scim/index.mjs +2 -1
  185. package/dist/scope/index.d.mts +3 -2
  186. package/dist/scope/index.mjs +5 -4
  187. package/dist/{scope-DfaPntpo.mjs → scope-DHx5Fous.mjs} +4 -3
  188. package/dist/{sessionManager-BHOM3N_0.d.mts → sessionManager-qimlKV0P.d.mts} +1 -0
  189. package/dist/{simpleEqualityMatcher-Cg05HPsn.mjs → simpleEqualityMatcher-DjQJ7FKA.mjs} +1 -0
  190. package/dist/{sse-BQ1w0dfl.mjs → sse-CUTo9y0X.mjs} +5 -4
  191. package/dist/{sseStream-BQ7Qaynp.mjs → sseStream-B_5XcVVd.mjs} +2 -1
  192. package/dist/{storage-DLUZ04kK.d.mts → storage-Cx9Sz3Ou.d.mts} +1 -0
  193. package/dist/{store-helpers-DY6xq4sM.mjs → store-helpers-D1MP_gRG.mjs} +1 -0
  194. package/dist/{streaming-BQcW6_Kq.mjs → streaming-PSZwi8JV.mjs} +1 -0
  195. package/dist/{subscribe-helpers-DfzsivM6.mjs → subscribe-helpers-C0Tb2aUp.mjs} +2 -1
  196. package/dist/sync/changelog.d.mts +1 -0
  197. package/dist/sync/changelog.mjs +1 -0
  198. package/dist/testing/cleanupStoreContract.d.mts +2 -1
  199. package/dist/testing/cleanupStoreContract.mjs +1 -0
  200. package/dist/testing/index.d.mts +139 -12
  201. package/dist/testing/index.mjs +230 -16
  202. package/dist/testing/outboxStoreContract.d.mts +1 -0
  203. package/dist/testing/outboxStoreContract.mjs +1 -0
  204. package/dist/testing/storageContract.d.mts +2 -1
  205. package/dist/testing/storageContract.mjs +1 -0
  206. package/dist/{tracing-CsGKQJGg.d.mts → tracing-Dro5eH6j.d.mts} +1 -0
  207. package/dist/{transactionContext-PNdoyLLm.mjs → transactionContext-dAfBVUrk.mjs} +1 -0
  208. package/dist/{typeGuards-C9KXUly6.mjs → typeGuards-B0ryPo3I.mjs} +1 -0
  209. package/dist/types/index.d.mts +6 -5
  210. package/dist/types/index.mjs +1 -0
  211. package/dist/types/storage.d.mts +2 -1
  212. package/dist/types/storage.mjs +1 -0
  213. package/dist/{types-ChvvVNP8.d.mts → types-B7XeLEgK.d.mts} +34 -2
  214. package/dist/{types-Cc91nXuA.d.mts → types-ByHn9rEO.d.mts} +1 -0
  215. package/dist/{types-C_ZZRcD6.d.mts → types-C4QE8qnm.d.mts} +1 -0
  216. package/dist/{types-D_n8L6VY.d.mts → types-CBgvkp8O.d.mts} +51 -12
  217. package/dist/{types-DjC-KUCz.d.mts → types-ChuShpCP.d.mts} +1 -0
  218. package/dist/{types-Bmmn-fO0.d.mts → types-CwcUQ610.d.mts} +2 -6
  219. package/dist/{types-CSyCxl2V.mjs → types-Cys0ko9Z.mjs} +4 -3
  220. package/dist/usage/index.d.mts +3 -2
  221. package/dist/usage/index.mjs +0 -0
  222. package/dist/{userHelpers-Cg_y3fBz.mjs → userHelpers-ChYJ6CdK.mjs} +1 -0
  223. package/dist/utils/index.d.mts +16 -7
  224. package/dist/utils/index.mjs +10 -9
  225. package/dist/{utils-taUVD4p3.mjs → utils-vL8BrDE2.mjs} +3 -2
  226. package/dist/{validate-Bk44F2yT.mjs → validate-_KbifpHF.mjs} +2 -1
  227. package/dist/{versioning-gKWyryT3.mjs → versioning-CHDTor3P.mjs} +3 -2
  228. package/dist/{versioning-DXgY5BUm.d.mts → versioning-D_rhHfZm.d.mts} +5 -2
  229. package/dist/{websocket-_Pd0CgR0.d.mts → websocket-BOXVggMf.d.mts} +2 -1
  230. package/package.json +547 -539
  231. package/skills/arc/SKILL.md +22 -8
  232. package/skills/arc/references/api-reference.md +4 -0
  233. package/skills/arc/references/auth.md +3 -0
  234. package/skills/arc/references/integrations.md +33 -0
  235. package/skills/arc/references/mcp.md +6 -7
  236. package/skills/arc/references/production.md +24 -25
  237. package/skills/arc-code-review/references/anti-patterns.md +3 -3
  238. package/dist/index-CCzVR-N3.d.mts +0 -107
  239. package/dist/module-_-M7C5ES.mjs +0 -29
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
1
2
  //#region src/core/aggregation/defineAggregation.ts
2
3
  /**
3
4
  * Declare a single resource aggregation. Exported configs flow into
@@ -1,21 +1,22 @@
1
- import { s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS } from "./constants-DNre0wRg.mjs";
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
2
+ import { s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS } from "./constants-D3Dv4LAV.mjs";
2
3
  import { arcLog } from "./logger/index.mjs";
3
- import { r as ForbiddenError } from "./errors-DkO8Nk6-.mjs";
4
- import { n as getUserRoles } from "./userHelpers-Cg_y3fBz.mjs";
5
- import { b as isElevated, n as PUBLIC_SCOPE, x as isMember } from "./types-CSyCxl2V.mjs";
6
- import { d as DEFAULT_FIELD_WRITE_DENIAL_POLICY, t as BaseController } from "./BaseController-B5DwufbB.mjs";
7
- import { a as buildRouteHooks, c as buildAuthMiddleware, i as selectPluginMw, n as buildRouteConfig, o as resolveRoutePreHandlers, r as resolveRouterPluginMw, s as routeHookOptions, t as buildRateLimitConfig, u as buildArcDecorator } from "./rateLimit-DrED-C4v.mjs";
8
- import { i as resolveEffectiveRoles, n as applyFieldWritePermissions } from "./fields-CQ_7KQWw.mjs";
9
- import { r as buildCrudPermissionMw, t as tryRegisterRoute } from "./registerRoute-JkxIEBJq.mjs";
10
- import { c as getDefaultCrudSchemas } from "./utils-taUVD4p3.mjs";
11
- import { n as convertRouteSchema, r as ensureSchemaConverter, t as convertOpenApiSchemas } from "./schemaConverter-DJvodiHj.mjs";
12
- import { i as pipeUIMessageStreamToReply, r as isReadableStream } from "./streaming-BQcW6_Kq.mjs";
13
- import { t as hasEvents } from "./typeGuards-C9KXUly6.mjs";
14
- import { a as createFastifyHandler, i as createCrudHandlers, n as buildPipelineHandler, o as createRequestContext, r as resolvePipelineSteps } from "./pipeline-BJnpkY9i.mjs";
15
- import { I as requireAuth } from "./permissions-Bfu_8y1U.mjs";
16
- import { r as getAvailablePresets, t as applyPresets } from "./presets-CJOEXLuk.mjs";
17
- import { t as pluralize } from "./pluralize-BhrgwZb9.mjs";
18
- import { t as resolveActionPermission } from "./actionPermissions-CAphcmUG.mjs";
4
+ import { r as ForbiddenError } from "./errors-Cj42AntO.mjs";
5
+ import { n as getUserRoles } from "./userHelpers-ChYJ6CdK.mjs";
6
+ import { b as isElevated, n as PUBLIC_SCOPE, x as isMember } from "./types-Cys0ko9Z.mjs";
7
+ import { d as DEFAULT_FIELD_WRITE_DENIAL_POLICY, t as BaseController } from "./BaseController-De7GqHck.mjs";
8
+ import { a as buildRouteHooks, c as buildAuthMiddleware, i as selectPluginMw, n as buildRouteConfig, o as resolveRoutePreHandlers, r as resolveRouterPluginMw, s as routeHookOptions, t as buildRateLimitConfig, u as buildArcDecorator } from "./rateLimit-CMPY5Qms.mjs";
9
+ import { i as resolveEffectiveRoles, n as applyFieldWritePermissions } from "./fields-CB5Cuzk9.mjs";
10
+ import { r as buildCrudPermissionMw, t as tryRegisterRoute } from "./registerRoute-CBN84fc7.mjs";
11
+ import { c as getDefaultCrudSchemas } from "./utils-vL8BrDE2.mjs";
12
+ import { n as convertRouteSchema, r as ensureSchemaConverter, t as convertOpenApiSchemas } from "./schemaConverter-D--wdJM-.mjs";
13
+ import { i as pipeUIMessageStreamToReply, r as isReadableStream } from "./streaming-PSZwi8JV.mjs";
14
+ import { t as hasEvents } from "./typeGuards-B0ryPo3I.mjs";
15
+ import { a as createFastifyHandler, i as createCrudHandlers, n as buildPipelineHandler, o as createRequestContext, r as resolvePipelineSteps } from "./pipeline-UPQFatit.mjs";
16
+ import { I as requireAuth } from "./permissions-L--QDAir.mjs";
17
+ import { r as getAvailablePresets, t as applyPresets } from "./presets-C4-g4_4P.mjs";
18
+ import { t as pluralize } from "./pluralize-O0FZgESl.mjs";
19
+ import { t as resolveActionPermission } from "./actionPermissions-BE5NwaQk.mjs";
19
20
  //#region src/core/middlewares/fieldWrite.ts
20
21
  /**
21
22
  * Build a preHandler that enforces field-write permissions on the request body.
@@ -58,25 +59,30 @@ function methodCarriesBody(method) {
58
59
  //#region src/core/createCrudRouter.ts
59
60
  /**
60
61
  * Mount custom routes (from presets or user-defined `routes`) on Fastify.
61
- * `wrapHandler` is derived inline from `!route.raw`.
62
+ * `wrapHandler` is derived inline from whether `rawHandler` was set.
62
63
  */
63
64
  function createCustomRoutes(fastify, routes, controller, options) {
64
65
  const { tag, resourceName, arcDecorator, rateLimitConfig, pluginMw, pipeline, routeGuards, tenantScopeMw, fieldPermissions, onFieldWriteDenied, extensions } = options;
65
66
  for (const route of routes) {
67
+ if ("raw" in route) throw new Error(`Route ${route.method} ${route.path}: \`raw\` was removed in arc 2.31 — the FIELD now carries the intent. Move the function to \`rawHandler\` (Fastify-native \`(request, reply)\`) or leave it in \`handler\` (arc pipeline, \`(ctx)\`), and delete the flag. If this route comes from a dependency, that package needs a release built against arc >=2.31.`);
66
68
  const routeWithRefs = route;
67
- const hasHandler = route.handler !== void 0;
69
+ const hasHandler = route.handler !== void 0 || route.rawHandler !== void 0;
68
70
  const hasControllerMethod = typeof routeWithRefs.controllerMethod === "function";
69
71
  if (hasHandler && hasControllerMethod) throw new Error(`Route ${route.method} ${route.path}: pass either \`handler\` or \`controllerMethod\`, not both. Prefer \`controllerMethod: (c: MyController) => c.method\` for typed handler refs (TS catches typos).`);
70
- if (!hasHandler && !hasControllerMethod) throw new Error(`Route ${route.method} ${route.path}: must declare either \`handler\` (string / function) or \`controllerMethod: (c) => c.method\` (typed function-ref form).`);
72
+ if (!hasHandler && !hasControllerMethod) throw new Error(`Route ${route.method} ${route.path}: must declare one of \`handler\` (arc pipeline), \`rawHandler\` (Fastify-native), or \`controllerMethod: (c) => c.method\` (typed function-ref form).`);
71
73
  let resolvedHandler;
72
74
  if (hasControllerMethod) {
73
75
  if (!controller) throw new Error(`Route ${route.method} ${route.path}: \`controllerMethod\` requires a controller. Provide one via \`defineResource({ controller, … })\`, or use \`defineResource\` with an \`adapter\` so arc auto-creates a BaseController.`);
74
76
  const referenced = routeWithRefs.controllerMethod?.(controller);
75
77
  if (typeof referenced !== "function") throw new Error(`Route ${route.method} ${route.path}: \`controllerMethod\` did not return a function. Return the method itself: \`controllerMethod: (c) => c.myMethod\`.`);
76
78
  resolvedHandler = referenced.bind(controller);
77
- } else resolvedHandler = route.handler;
79
+ } else {
80
+ if (route.rawHandler && route.handler) throw new Error(`Route ${route.method} ${route.path}: set either \`handler\` (arc pipeline) or \`rawHandler\` (Fastify-native), not both.`);
81
+ resolvedHandler = route.rawHandler ?? route.handler;
82
+ }
78
83
  const opName = route.operation ?? (typeof resolvedHandler === "string" ? resolvedHandler : `${route.method.toLowerCase()}${route.path.replace(/[/:]/g, "_")}`);
79
- const wrapHandler = !route.raw;
84
+ const isRaw = route.rawHandler !== void 0;
85
+ const wrapHandler = !isRaw;
80
86
  let handler;
81
87
  if (typeof resolvedHandler === "string") {
82
88
  if (!controller) throw new Error(`Route ${route.method} ${route.path}: string handler '${resolvedHandler}' requires a controller. Either provide a controller or use a function handler instead.`);
@@ -104,7 +110,7 @@ function createCustomRoutes(fastify, routes, controller, options) {
104
110
  if (!tenantScopeMw || tenantScopeMw.length === 0) throw new Error(`Route ${route.method} ${route.path}: \`tenantScope: true\` requires a multi-tenant preset. Add \`multiTenantPreset()\` (or \`flexibleMultiTenantPreset()\`) to the resource's \`presets\`, or remove the \`tenantScope\` flag from this route.`);
105
111
  customPreHandlers.unshift(...tenantScopeMw);
106
112
  }
107
- if (route.raw !== true && route.fieldWrite !== false && methodCarriesBody(route.method)) {
113
+ if (!isRaw && route.fieldWrite !== false && methodCarriesBody(route.method)) {
108
114
  const fieldWriteMw = buildFieldWritePreHandler(fieldPermissions, onFieldWriteDenied);
109
115
  if (fieldWriteMw) customPreHandlers.push(fieldWriteMw);
110
116
  }
@@ -123,18 +129,18 @@ function createCustomRoutes(fastify, routes, controller, options) {
123
129
  url: route.path,
124
130
  schema,
125
131
  ...routeHookOptions(hooks),
126
- handler: isStream ? async (request, reply) => {
132
+ handler: isStream ? async function streamRoute(request, reply) {
127
133
  reply.raw.setHeader("Content-Type", "text/event-stream");
128
134
  reply.raw.setHeader("Cache-Control", "no-cache");
129
135
  reply.raw.setHeader("Connection", "keep-alive");
130
- const result = await handler(request, reply);
136
+ const result = await handler.call(this, request, reply);
131
137
  if (isReadableStream(result)) {
132
138
  await pipeUIMessageStreamToReply(reply, result);
133
139
  return reply;
134
140
  }
135
141
  return result;
136
142
  } : handler,
137
- ...buildRouteConfig(route.rateLimit !== void 0 ? buildRateLimitConfig(route.rateLimit) : rateLimitConfig, extensions)
143
+ ...buildRouteConfig(route.rateLimit !== void 0 ? buildRateLimitConfig(route.rateLimit) : rateLimitConfig, extensions, route.cors)
138
144
  }, {
139
145
  resourceName,
140
146
  op: opName
@@ -640,8 +646,7 @@ function expandHistory(config) {
640
646
  method: "GET",
641
647
  path: "/:id/history",
642
648
  summary: `Change history for a ${resourceName} record (audit-backed timeline)`,
643
- raw: true,
644
- handler: async (request, reply) => {
649
+ rawHandler: async (request, reply) => {
645
650
  const audit = request.server.audit;
646
651
  if (!audit?.query || audit._noop === true) return reply.code(503).send({
647
652
  code: "history.audit_unavailable",
@@ -1266,7 +1271,7 @@ function buildResourcePlugin(resource) {
1266
1271
  extensions: resource.extensions
1267
1272
  });
1268
1273
  if (resource.actions && Object.keys(resource.actions).length > 0) {
1269
- const { createActionRouter } = await import("./createActionRouter-BxuywVRB.mjs").then((n) => n.n);
1274
+ const { createActionRouter } = await import("./createActionRouter-CDXEdasl.mjs").then((n) => n.n);
1270
1275
  createActionRouter(typedInstance, {
1271
1276
  ...normalizeActionsToRouterConfig(resource.actions, resource.actionPermissions, resource.tag, resource.permissions, resource.name, typedInstance.log),
1272
1277
  resourceName: resource.name,
@@ -1281,7 +1286,7 @@ function buildResourcePlugin(resource) {
1281
1286
  });
1282
1287
  }
1283
1288
  if (resource.aggregations && Object.keys(resource.aggregations).length > 0) {
1284
- const [{ createAggregationRouter }, { adapterSupportsAggregate, ArcAggregationConfigError }] = await Promise.all([import("./createAggregationRouter-BiY-lGdY.mjs"), import("./validate-Bk44F2yT.mjs").then((n) => n.r)]);
1289
+ const [{ createAggregationRouter }, { adapterSupportsAggregate, ArcAggregationConfigError }] = await Promise.all([import("./createAggregationRouter-KrQDzx-k.mjs"), import("./validate-_KbifpHF.mjs").then((n) => n.r)]);
1285
1290
  const repoForAgg = resource.controller?.repository ?? resource.repository;
1286
1291
  if (!adapterSupportsAggregate(repoForAgg)) {
1287
1292
  const undispatchable = Object.entries(resource.aggregations).filter(([, cfg]) => !cfg.materialized).map(([name]) => name);
@@ -1537,7 +1542,7 @@ var ResourceDefinition = class {
1537
1542
  summary: r.summary,
1538
1543
  description: r.description,
1539
1544
  permissions: r.permissions,
1540
- raw: r.raw,
1545
+ raw: r.rawHandler !== void 0,
1541
1546
  schema: r.schema
1542
1547
  })),
1543
1548
  routes: [],
@@ -1815,17 +1820,22 @@ function validateResourceConfig(config, options = {}) {
1815
1820
  }
1816
1821
  function validateRouteHandlers(controller, routes, errors) {
1817
1822
  const ctrl = controller;
1818
- for (const route of routes) if (typeof route.handler === "string") {
1819
- if (typeof ctrl[route.handler] !== "function") errors.push({
1823
+ for (const route of routes) {
1824
+ const named = typeof route.handler === "string" ? route.handler : route.rawHandler;
1825
+ if (typeof named !== "string") continue;
1826
+ if (typeof ctrl[named] !== "function") errors.push({
1820
1827
  field: `routes[${route.method} ${route.path}]`,
1821
- message: `Handler "${route.handler}" not found on controller`,
1822
- suggestion: `Add method "${route.handler}" to controller or use a function handler`
1828
+ message: `Handler "${named}" not found on controller`,
1829
+ suggestion: `Add method "${named}" to controller or use a function handler`
1823
1830
  });
1824
1831
  }
1825
1832
  }
1826
1833
  function validatePermissionKeys(config, options, _errors, warnings) {
1827
1834
  const validKeys = /* @__PURE__ */ new Set([...CRUD_OPERATIONS, ...options.additionalPermissionKeys ?? []]);
1828
- for (const route of config.routes ?? []) if (typeof route.handler === "string") validKeys.add(route.handler);
1835
+ for (const route of config.routes ?? []) {
1836
+ if (typeof route.handler === "string") validKeys.add(route.handler);
1837
+ if (typeof route.rawHandler === "string") validKeys.add(route.rawHandler);
1838
+ }
1829
1839
  for (const preset of config.presets ?? []) {
1830
1840
  const presetName = typeof preset === "string" ? preset : preset.name;
1831
1841
  if (presetName === "softDelete") {
@@ -1966,11 +1976,26 @@ function validateRoutes(routes, errors) {
1966
1976
  suggestion: `Change to "/${route.path}"`
1967
1977
  });
1968
1978
  const routeWithRefs = route;
1969
- if (!route.handler && typeof routeWithRefs.controllerMethod !== "function") errors.push({
1979
+ if (!route.handler && !route.rawHandler && typeof routeWithRefs.controllerMethod !== "function") errors.push({
1970
1980
  field: `routes[${i}].handler`,
1971
- message: "Route must declare either `handler` (string / function) or `controllerMethod`",
1981
+ message: "Route must declare one of `handler` (arc pipeline), `rawHandler` (Fastify-native), or `controllerMethod`",
1972
1982
  suggestion: "Prefer `controllerMethod: (c: MyController) => c.method` for typed handler refs."
1973
1983
  });
1984
+ if (route.handler && route.rawHandler) errors.push({
1985
+ field: `routes[${i}].rawHandler`,
1986
+ message: "Route declares BOTH `handler` and `rawHandler`",
1987
+ suggestion: "Use `handler` for the arc pipeline (receives IRequestContext) or `rawHandler` for a Fastify-native handler (receives request, reply) — not both."
1988
+ });
1989
+ if ("raw" in route) errors.push({
1990
+ field: `routes[${i}].raw`,
1991
+ message: "`raw` was removed in arc 2.31 — the field now carries the intent",
1992
+ suggestion: "Move the function to `rawHandler` (Fastify-native) or leave it in `handler` (arc pipeline), and delete the flag. If the route comes from a dependency, that package needs a release built against arc >=2.31."
1993
+ });
1994
+ if (route.streamResponse === true && route.rawHandler === void 0) errors.push({
1995
+ field: `routes[${i}].streamResponse`,
1996
+ message: "`streamResponse: true` requires `rawHandler`",
1997
+ suggestion: "Streaming routes are invoked with `(request, reply)` and own the socket — declare the function as `rawHandler` (not `handler` or `controllerMethod`)."
1998
+ });
1974
1999
  const routeKey = `${route.method} ${route.path}`;
1975
2000
  if (seenRoutes.has(routeKey)) errors.push({
1976
2001
  field: `routes[${i}]`,
@@ -1,3 +1,4 @@
1
+
1
2
  import { FastifyPluginAsync } from "fastify";
2
3
  //#region src/discovery/index.d.ts
3
4
  /** A discovered resource — must have toPlugin() method */
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
1
2
  import { readdir } from "node:fs/promises";
2
3
  import { extname, join, resolve } from "node:path";
3
4
  import { pathToFileURL } from "node:url";
@@ -1,5 +1,6 @@
1
- import { p as RegistryEntry } from "../index-Q5gzEIWY.mjs";
2
- import { t as ExternalOpenApiPaths } from "../externalPaths-BE6wFpYv.mjs";
1
+
2
+ import { p as RegistryEntry } from "../index-CpzxqePp.mjs";
3
+ import { t as ExternalOpenApiPaths } from "../externalPaths-CmGOxOtD.mjs";
3
4
  import { FastifyPluginAsync } from "fastify";
4
5
  //#region src/docs/openapi/types.d.ts
5
6
  /**
@@ -1,5 +1,6 @@
1
- import { n as getUserRoles } from "../userHelpers-Cg_y3fBz.mjs";
2
- import { n as openApiPlugin, r as openapi_default, t as buildOpenApiSpec } from "../openapi-B8Vkbxbn.mjs";
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
2
+ import { n as getUserRoles } from "../userHelpers-ChYJ6CdK.mjs";
3
+ import { n as openApiPlugin, r as openapi_default, t as buildOpenApiSpec } from "../openapi-B2L4js1v.mjs";
3
4
  import fp from "fastify-plugin";
4
5
  //#region src/docs/scalar.ts
5
6
  const scalarPlugin = async (fastify, opts = {}) => {
@@ -1,3 +1,4 @@
1
+
1
2
  import { FastifyPluginAsync, FastifyRequest } from "fastify";
2
3
  //#region src/scope/elevation.d.ts
3
4
  interface ElevationOptions {
@@ -1,7 +1,8 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-CUsjNX9R.mjs";
2
3
  import { arcLog } from "./logger/index.mjs";
3
- import { n as requireSingleHeaderValue } from "./headers-BvlQSDMB.mjs";
4
- import { n as getUserRoles } from "./userHelpers-Cg_y3fBz.mjs";
4
+ import { n as requireSingleHeaderValue } from "./headers-3zvE0rM3.mjs";
5
+ import { n as getUserRoles } from "./userHelpers-ChYJ6CdK.mjs";
5
6
  import fp from "fastify-plugin";
6
7
  //#region src/scope/elevation.ts
7
8
  var elevation_exports = /* @__PURE__ */ __exportAll({
@@ -1,4 +1,5 @@
1
- import { a as JweAlg, c as KeyMaterial, i as EncryptionOptions, l as KeyProvider, n as EncryptionDirective, o as JweEnc, r as EncryptionMode, s as KeyContext, t as ActiveKey } from "../types-Cc91nXuA.mjs";
1
+
2
+ import { a as JweAlg, c as KeyMaterial, i as EncryptionOptions, l as KeyProvider, n as EncryptionDirective, o as JweEnc, r as EncryptionMode, s as KeyContext, t as ActiveKey } from "../types-ByHn9rEO.mjs";
2
3
  import { FastifyPluginAsync } from "fastify";
3
4
  //#region src/encryption/encryptionPlugin.d.ts
4
5
  declare const encryptionPlugin: FastifyPluginAsync<EncryptionOptions>;
@@ -1,5 +1,6 @@
1
- import { t as ArcError } from "../errors-DkO8Nk6-.mjs";
2
- import { t as parseJsonBody } from "../jsonBody-BlzAoGCe.mjs";
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
2
+ import { t as ArcError } from "../errors-Cj42AntO.mjs";
3
+ import { t as parseJsonBody } from "../jsonBody-BYbLDi5D.mjs";
3
4
  import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
4
5
  import fp from "fastify-plugin";
5
6
  //#region src/encryption/fieldCipher.ts
@@ -1,5 +1,6 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
- import { m as statusToArcCode, p as isArcError } from "./errors-DkO8Nk6-.mjs";
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-CUsjNX9R.mjs";
3
+ import { m as statusToArcCode, p as isArcError } from "./errors-Cj42AntO.mjs";
3
4
  import { isHttpError, toErrorContract } from "@classytic/repo-core/errors";
4
5
  import fp from "fastify-plugin";
5
6
  //#region src/plugins/errorHandler.ts
@@ -1,3 +1,4 @@
1
+
1
2
  import { ErrorDetail } from "@classytic/repo-core/errors";
2
3
  import { FastifyInstance, FastifyRequest } from "fastify";
3
4
  //#region src/plugins/errorHandler.d.ts
@@ -1,3 +1,4 @@
1
+
1
2
  import { HttpError } from "@classytic/repo-core/errors";
2
3
  //#region src/utils/errors.d.ts
3
4
  interface ErrorOptions {
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
1
2
  //#region src/utils/errors.ts
2
3
  /**
3
4
  * Base Arc Error. Implements the canonical `HttpError` contract — `status`
@@ -1,8 +1,9 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-CUsjNX9R.mjs";
2
3
  import { arcLog } from "./logger/index.mjs";
3
- import { d as createDomainError } from "./errors-DkO8Nk6-.mjs";
4
- import { n as requestContext } from "./requestContext-MrlJwECf.mjs";
5
- import { n as createEvent, t as MemoryEventTransport } from "./EventTransport-C6YA8xY9.mjs";
4
+ import { d as createDomainError } from "./errors-Cj42AntO.mjs";
5
+ import { n as requestContext } from "./requestContext-2TxXOJ7T.mjs";
6
+ import { n as createEvent, t as MemoryEventTransport } from "./EventTransport-9mlTgqzE.mjs";
6
7
  import fp from "fastify-plugin";
7
8
  //#region src/events/retry.ts
8
9
  /**
@@ -1,4 +1,5 @@
1
- import { a as EventTransport, i as EventLogger, n as DomainEvent, r as EventHandler } from "./EventTransport-QmY7A258.mjs";
1
+
2
+ import { a as EventTransport, i as EventLogger, n as DomainEvent, r as EventHandler } from "./EventTransport-2uVV34WU.mjs";
2
3
  import { FastifyPluginAsync } from "fastify";
3
4
  //#region src/events/defineEvent.d.ts
4
5
  interface EventSchema {
@@ -1,7 +1,8 @@
1
- import { a as EventTransport, i as EventLogger, n as DomainEvent, o as MemoryEventTransport, r as EventHandler, s as MemoryEventTransportOptions, t as DeadLetteredEvent } from "../EventTransport-QmY7A258.mjs";
2
- import { a as withRetry, c as EventDefinitionOutput, d as EventSchema, f as ValidationResult, i as createDeadLetterPublisher, l as EventRegistry, m as defineEvent, n as eventPlugin, o as CustomValidator, p as createEventRegistry, r as RetryOptions, s as EventDefinitionInput, t as EventPluginOptions, u as EventRegistryOptions } from "../eventPlugin-Bg3cP2_u.mjs";
1
+
2
+ import { a as EventTransport, i as EventLogger, n as DomainEvent, o as MemoryEventTransport, r as EventHandler, s as MemoryEventTransportOptions, t as DeadLetteredEvent } from "../EventTransport-2uVV34WU.mjs";
3
+ import { a as withRetry, c as EventDefinitionOutput, d as EventSchema, f as ValidationResult, i as createDeadLetterPublisher, l as EventRegistry, m as defineEvent, n as eventPlugin, o as CustomValidator, p as createEventRegistry, r as RetryOptions, s as EventDefinitionInput, t as EventPluginOptions, u as EventRegistryOptions } from "../eventPlugin-GF5nnBIq.mjs";
3
4
  import { RedisEventTransportOptions, RedisLike } from "./transports/redis.mjs";
4
- import { r as RedisStreamTransportOptions, t as RedisStreamLike } from "../redis-stream-uIaauNpZ.mjs";
5
+ import { r as RedisStreamTransportOptions, t as RedisStreamLike } from "../redis-stream-qN6A-RFv.mjs";
5
6
  import { OutboxAcknowledgeOptions, OutboxClaimOptions, OutboxErrorInfo, OutboxFailOptions, OutboxFailurePolicy, OutboxStore, OutboxWriteOptions } from "@classytic/primitives/outbox";
6
7
  import { RepositoryLike } from "@classytic/repo-core/adapter";
7
8
  //#region src/events/eventTypes.d.ts
@@ -1,7 +1,8 @@
1
- import { t as MemoryEventTransport } from "../EventTransport-C6YA8xY9.mjs";
2
- import { a as createEventRegistry, i as wrapWithSchema, n as subscribeWithSchema, o as defineEvent, r as wrapWithBoundary, t as subscribeWithBoundary } from "../subscribe-helpers-DfzsivM6.mjs";
3
- import { i as withRetry, r as createDeadLetterPublisher, t as eventPlugin } from "../eventPlugin-D2NNR4py.mjs";
4
- import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "../store-helpers-DY6xq4sM.mjs";
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
2
+ import { t as MemoryEventTransport } from "../EventTransport-9mlTgqzE.mjs";
3
+ import { a as createEventRegistry, i as wrapWithSchema, n as subscribeWithSchema, o as defineEvent, r as wrapWithBoundary, t as subscribeWithBoundary } from "../subscribe-helpers-C0Tb2aUp.mjs";
4
+ import { i as withRetry, r as createDeadLetterPublisher, t as eventPlugin } from "../eventPlugin-CkffEihm.mjs";
5
+ import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "../store-helpers-D1MP_gRG.mjs";
5
6
  import { and, anyOf, eq, lte, ne, or } from "@classytic/repo-core/filter";
6
7
  import { InvalidOutboxEventError, OutboxOwnershipError } from "@classytic/primitives/outbox";
7
8
  import { update } from "@classytic/repo-core/update";
@@ -330,6 +331,17 @@ function repositoryAsOutboxStore(repository, options) {
330
331
  */
331
332
  const claimableFilter = (now) => and(eq("status", "pending"), lte(visibleAtField, now), or(eq("leaseOwner", null), lte("leaseExpiresAt", now)));
332
333
  return {
334
+ /**
335
+ * Transactional: `save` forwards `options.session` to the backing
336
+ * repository's `create`, so the event row joins the caller's transaction on
337
+ * the SAME connection and commits or rolls back with the domain write.
338
+ *
339
+ * Declared explicitly because `OutboxWriteOptions.session` is best-effort by
340
+ * contract — a caller cannot infer atomicity from the presence of an outbox,
341
+ * only from this flag. See `OutboxStore.transactionalSave` in
342
+ * `@classytic/primitives/outbox`.
343
+ */
344
+ transactionalSave: true,
333
345
  async save(event, options) {
334
346
  if (!event?.type || typeof event.type !== "string") throw new InvalidOutboxEventError("event.type is required");
335
347
  if (!event.meta?.id || typeof event.meta.id !== "string") throw new InvalidOutboxEventError("event.meta.id is required");
@@ -1,2 +1,3 @@
1
- import { n as RedisStreamTransport, r as RedisStreamTransportOptions, t as RedisStreamLike } from "../../redis-stream-uIaauNpZ.mjs";
1
+
2
+ import { n as RedisStreamTransport, r as RedisStreamTransportOptions, t as RedisStreamLike } from "../../redis-stream-qN6A-RFv.mjs";
2
3
  export { type RedisStreamLike, RedisStreamTransport, type RedisStreamTransportOptions };
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
1
2
  import sjson from "secure-json-parse";
2
3
  //#region src/events/transports/redis-stream.ts
3
4
  /**
@@ -1,4 +1,5 @@
1
- import { a as EventTransport, i as EventLogger, n as DomainEvent, r as EventHandler } from "../../EventTransport-QmY7A258.mjs";
1
+
2
+ import { a as EventTransport, i as EventLogger, n as DomainEvent, r as EventHandler } from "../../EventTransport-2uVV34WU.mjs";
2
3
  //#region src/events/transports/redis.d.ts
3
4
  interface RedisLike {
4
5
  publish(channel: string, message: string): Promise<number>;
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
1
2
  import sjson from "secure-json-parse";
2
3
  //#region src/events/transports/redis.ts
3
4
  /**
@@ -1,3 +1,4 @@
1
+
1
2
  //#region src/docs/externalPaths.d.ts
2
3
  /**
3
4
  * External OpenAPI Path Provider
@@ -1,7 +1,8 @@
1
- import { a as ModuleContribution, c as ResourceModule, h as HealthCheck, i as EventHandlerDefinition, l as loadResources, n as ArcModuleInput, o as LoadResourcesOptions, r as ArcModuleRegistry, s as ResourceLike, t as ArcModule } from "../types-D_n8L6VY.mjs";
2
- import { a as orderModules, c as collectModuleScheduledJobs, i as resolveModule, l as collectModuleWorkflows, n as getModuleExports, o as subscribeModuleEventHandlers, r as resolveContribution, s as collectModuleHealthChecks, t as defineModule } from "../index-CCzVR-N3.mjs";
3
- import "../fastify-augmentation-0WhPnUH7.mjs";
4
- import { a as RawBodyOptions, c as BetterAuthOption, d as JwtAuthOption, i as MultipartOptions, l as CustomAuthenticatorOption, n as preloadResourcesAsync, o as UnderPressureOptions, r as CreateAppOptions, s as AuthOption, t as preloadResources, u as CustomPluginAuthOption } from "../preloadResources-DCfa2egz.mjs";
1
+
2
+ import { a as ModuleContribution, c as ResourceModule, h as HealthCheck, i as EventHandlerDefinition, l as loadResources, n as ArcModuleInput, o as LoadResourcesOptions, r as ArcModuleRegistry, s as ResourceLike, t as ArcModule } from "../types-CBgvkp8O.mjs";
3
+ import { a as lazyModuleExports, c as getModuleState, d as resolveModule, f as orderModules, g as collectModuleWorkflows, h as collectModuleScheduledJobs, i as hasModuleExports, l as hasModule, m as collectModuleHealthChecks, n as getModuleExports, o as lazyRequiredModuleExports, p as subscribeModuleEventHandlers, r as getOptionalModuleExports, s as ModuleState, t as defineModule, u as resolveContribution } from "../index-CFThn1K9.mjs";
4
+ import "../fastify-augmentation-zh0_AYHa.mjs";
5
+ import { a as RawBodyOptions, c as BetterAuthOption, d as JwtAuthOption, i as MultipartOptions, l as CustomAuthenticatorOption, n as preloadResourcesAsync, o as UnderPressureOptions, r as CreateAppOptions, s as AuthOption, t as preloadResources, u as CustomPluginAuthOption } from "../preloadResources-CyoJMSiO.mjs";
5
6
  import { FastifyInstance, FastifyServerOptions } from "fastify";
6
7
  //#region src/factory/createApp.d.ts
7
8
  /**
@@ -22,6 +23,9 @@ import { FastifyInstance, FastifyServerOptions } from "fastify";
22
23
  * 10. afterResources() — post-registration wiring
23
24
  * 11. onReady/onClose — lifecycle hooks
24
25
  * ```
26
+ *
27
+ * **Boot is all-or-nothing.** If any phase throws, the partially-built
28
+ * instance is closed before the error propagates — see the wrapper below.
25
29
  */
26
30
  declare function createApp(options: CreateAppOptions): Promise<FastifyInstance>;
27
31
  /**
@@ -133,4 +137,4 @@ declare const testingPreset: Partial<CreateAppOptions>;
133
137
  declare const edgePreset: Partial<CreateAppOptions>;
134
138
  declare function getPreset(name: "production" | "development" | "testing" | "edge" | "worker"): Partial<CreateAppOptions>;
135
139
  //#endregion
136
- export { ArcFactory, type ArcModule, type ArcModuleInput, type ArcModuleRegistry, type ArcWorker, type AuthOption, type BetterAuthOption, type CreateAppOptions, type CreateWorkerOptions, type CustomAuthenticatorOption, type CustomPluginAuthOption, type EventHandlerDefinition, type FetchHandlerOptions, type JwtAuthOption, type LoadResourcesOptions, type ModuleContribution, type MultipartOptions, type RawBodyOptions, type ResourceLike, type ResourceModule, type UnderPressureOptions, type WorkerHealthOptions, collectModuleHealthChecks, collectModuleScheduledJobs, collectModuleWorkflows, createApp, createWorker, defineModule, developmentPreset, edgePreset, getModuleExports, getPreset, loadResources, orderModules, preloadResources, preloadResourcesAsync, productionPreset, resolveContribution, resolveModule, subscribeModuleEventHandlers, testingPreset, toFetchHandler };
140
+ export { ArcFactory, type ArcModule, type ArcModuleInput, type ArcModuleRegistry, type ArcWorker, type AuthOption, type BetterAuthOption, type CreateAppOptions, type CreateWorkerOptions, type CustomAuthenticatorOption, type CustomPluginAuthOption, type EventHandlerDefinition, type FetchHandlerOptions, type JwtAuthOption, type LoadResourcesOptions, type ModuleContribution, type ModuleState, type MultipartOptions, type RawBodyOptions, type ResourceLike, type ResourceModule, type UnderPressureOptions, type WorkerHealthOptions, collectModuleHealthChecks, collectModuleScheduledJobs, collectModuleWorkflows, createApp, createWorker, defineModule, developmentPreset, edgePreset, getModuleExports, getModuleState, getOptionalModuleExports, getPreset, hasModule, hasModuleExports, lazyModuleExports, lazyRequiredModuleExports, loadResources, orderModules, preloadResources, preloadResourcesAsync, productionPreset, resolveContribution, resolveModule, subscribeModuleEventHandlers, testingPreset, toFetchHandler };
@@ -1,8 +1,9 @@
1
- import { r as mergeHealthChecks, t as healthPlugin } from "../health-CB_m4S32.mjs";
2
- import { a as edgePreset, c as testingPreset, d as subscribeModuleEventHandlers, f as collectModuleHealthChecks, g as resolveModule, h as resolveContribution, i as developmentPreset, l as workerPreset, m as collectModuleWorkflows, n as createApp, o as getPreset, p as collectModuleScheduledJobs, s as productionPreset, t as ArcFactory, u as orderModules } from "../createApp-CXrKFciH.mjs";
3
- import { n as getModuleExports, t as defineModule } from "../module-_-M7C5ES.mjs";
4
- import { t as loadResources } from "../loadResources-DpU8pfjV.mjs";
5
- import { n as preloadResourcesAsync, t as preloadResources } from "../preloadResources-DSY5HGpS.mjs";
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
2
+ import { r as mergeHealthChecks, t as healthPlugin } from "../health-DjZYjM7H.mjs";
3
+ import { _ as resolveContribution, a as edgePreset, c as testingPreset, d as hasModule, f as orderModules, g as collectModuleWorkflows, h as collectModuleScheduledJobs, i as developmentPreset, l as workerPreset, m as collectModuleHealthChecks, n as createApp, o as getPreset, p as subscribeModuleEventHandlers, s as productionPreset, t as ArcFactory, u as getModuleState, v as resolveModule } from "../createApp-Df89BEni.mjs";
4
+ import { a as lazyModuleExports, i as hasModuleExports, n as getModuleExports, o as lazyRequiredModuleExports, r as getOptionalModuleExports, t as defineModule } from "../module-0pFJA6YW.mjs";
5
+ import { t as loadResources } from "../loadResources-yawi9tAE.mjs";
6
+ import { n as preloadResourcesAsync, t as preloadResources } from "../preloadResources-Dz6BjzM6.mjs";
6
7
  //#region src/factory/createWorker.ts
7
8
  async function createWorker(options, workerOptions = {}) {
8
9
  const { auth: _auth, helmet: _helmet, cors: _cors, rateLimit: _rateLimit, multipart: _multipart, rawBody: _rawBody, sensible: _sensible, underPressure: _underPressure, replyHelpers: _replyHelpers, ...runtimeOptions } = options;
@@ -120,4 +121,4 @@ function payloadTooLarge(limit) {
120
121
  });
121
122
  }
122
123
  //#endregion
123
- export { ArcFactory, collectModuleHealthChecks, collectModuleScheduledJobs, collectModuleWorkflows, createApp, createWorker, defineModule, developmentPreset, edgePreset, getModuleExports, getPreset, loadResources, orderModules, preloadResources, preloadResourcesAsync, productionPreset, resolveContribution, resolveModule, subscribeModuleEventHandlers, testingPreset, toFetchHandler };
124
+ export { ArcFactory, collectModuleHealthChecks, collectModuleScheduledJobs, collectModuleWorkflows, createApp, createWorker, defineModule, developmentPreset, edgePreset, getModuleExports, getModuleState, getOptionalModuleExports, getPreset, hasModule, hasModuleExports, lazyModuleExports, lazyRequiredModuleExports, loadResources, orderModules, preloadResources, preloadResourcesAsync, productionPreset, resolveContribution, resolveModule, subscribeModuleEventHandlers, testingPreset, toFetchHandler };
@@ -1,7 +1,8 @@
1
- import { mn as HookSystem, z as ResourceRegistry } from "./index-Q5gzEIWY.mjs";
2
- import { t as ExternalOpenApiPaths } from "./externalPaths-BE6wFpYv.mjs";
3
- import { h as HealthCheck, r as ArcModuleRegistry, t as ArcModule, u as ScheduleDefinition } from "./types-D_n8L6VY.mjs";
4
- import "./index-CCzVR-N3.mjs";
1
+
2
+ import { hn as HookSystem, z as ResourceRegistry } from "./index-CpzxqePp.mjs";
3
+ import { t as ExternalOpenApiPaths } from "./externalPaths-CmGOxOtD.mjs";
4
+ import { h as HealthCheck, r as ArcModuleRegistry, t as ArcModule, u as ScheduleDefinition } from "./types-CBgvkp8O.mjs";
5
+ import { s as ModuleState } from "./index-CFThn1K9.mjs";
5
6
  import { FastifyPluginAsync } from "fastify";
6
7
  //#region src/core/arcCorePlugin.d.ts
7
8
  interface ArcCorePluginOptions {
@@ -39,6 +40,14 @@ interface ArcCore {
39
40
  * Populated lazily by `registerResources` — absent until a module exports.
40
41
  */
41
42
  modules?: Partial<ArcModuleRegistry> & Record<string, unknown>;
43
+ /**
44
+ * Lifecycle state per composed module (null-proto map, populated by
45
+ * `registerResources` the moment the graph is validated — so it answers
46
+ * "is this module composed?" even for resource-only modules that never
47
+ * record an export). Read via `hasModule(fastify, name)` /
48
+ * `getModuleState(fastify, name)`; the map itself is internal.
49
+ */
50
+ moduleStates?: Record<string, ModuleState>;
42
51
  /**
43
52
  * Module-contributed readiness checks, collected in dependency order and
44
53
  * frozen by `createApp`. The API role merges these into its `healthPlugin`;
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
1
2
  //#region src/permissions/fields.ts
2
3
  /**
3
4
  * Field-Level Permissions
@@ -1,3 +1,4 @@
1
+
1
2
  //#region src/permissions/fields.d.ts
2
3
  /**
3
4
  * Field-Level Permissions
@@ -1,3 +1,4 @@
1
+
1
2
  //#region src/cli/commands/generate/index.d.ts
2
3
  /**
3
4
  * `arc generate` orchestrator.
@@ -1,4 +1,5 @@
1
- import { t as pluralize } from "./pluralize-BhrgwZb9.mjs";
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
2
+ import { t as pluralize } from "./pluralize-O0FZgESl.mjs";
2
3
  import { join } from "node:path";
3
4
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
4
5
  //#region src/cli/commands/generate/name-helpers.ts
@@ -1,4 +1,5 @@
1
- import { u as ValidationError } from "./errors-DkO8Nk6-.mjs";
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
2
+ import { u as ValidationError } from "./errors-Cj42AntO.mjs";
2
3
  //#region src/utils/headers.ts
3
4
  /**
4
5
  * Canonical header typing + accessor.
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
1
2
  import { randomUUID } from "node:crypto";
2
3
  import fp from "fastify-plugin";
3
4
  //#region src/plugins/requestId.ts
@@ -1,2 +1,3 @@
1
- import { Cn as defineHook, Sn as createHookSystem, _n as afterDelete, bn as beforeDelete, cn as DefineHookOptions, dn as HookOperation, fn as HookPhase, gn as afterCreate, hn as HookSystemOptions, ln as HookContext, mn as HookSystem, pn as HookRegistration, un as HookHandler, vn as afterUpdate, xn as beforeUpdate, yn as beforeCreate } from "../index-Q5gzEIWY.mjs";
1
+
2
+ import { Cn as createHookSystem, Sn as beforeUpdate, _n as afterCreate, bn as beforeCreate, dn as HookHandler, fn as HookOperation, gn as HookSystemOptions, hn as HookSystem, ln as DefineHookOptions, mn as HookRegistration, pn as HookPhase, un as HookContext, vn as afterDelete, wn as defineHook, xn as beforeDelete, yn as afterUpdate } from "../index-CpzxqePp.mjs";
2
3
  export { type DefineHookOptions, type HookContext, type HookHandler, type HookOperation, type HookPhase, type HookRegistration, HookSystem, type HookSystemOptions, afterCreate, afterDelete, afterUpdate, beforeCreate, beforeDelete, beforeUpdate, createHookSystem, defineHook };
@@ -1,2 +1,3 @@
1
- import { a as beforeCreate, c as createHookSystem, i as afterUpdate, l as defineHook, n as afterCreate, o as beforeDelete, r as afterDelete, s as beforeUpdate, t as HookSystem } from "../HookSystem-WkIougo6.mjs";
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
2
+ import { a as beforeCreate, c as createHookSystem, i as afterUpdate, l as defineHook, n as afterCreate, o as beforeDelete, r as afterDelete, s as beforeUpdate, t as HookSystem } from "../HookSystem-BcmPyq5I.mjs";
2
3
  export { HookSystem, afterCreate, afterDelete, afterUpdate, beforeCreate, beforeDelete, beforeUpdate, createHookSystem, defineHook };
@@ -1,5 +1,6 @@
1
- import { i as createIdempotencyResult, n as IdempotencyResult, r as IdempotencyStore, t as IdempotencyLock } from "../interface-Uk8ONJv7.mjs";
2
- import { i as RedisIdempotencyStoreOptions, n as RedisClient } from "../redis-UDtLaNj6.mjs";
1
+
2
+ import { i as createIdempotencyResult, n as IdempotencyResult, r as IdempotencyStore, t as IdempotencyLock } from "../interface-DEWNOMza.mjs";
3
+ import { i as RedisIdempotencyStoreOptions, n as RedisClient } from "../redis-CduhKsJi.mjs";
3
4
  import { FastifyPluginAsync } from "fastify";
4
5
  import { RepositoryLike } from "@classytic/repo-core/adapter";
5
6
  //#region src/idempotency/idempotencyPlugin.d.ts
@@ -1,6 +1,7 @@
1
- import { n as requireSingleHeaderValue } from "../headers-BvlQSDMB.mjs";
2
- import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "../store-helpers-DY6xq4sM.mjs";
3
- import { t as createIdempotencyResult } from "../interface-n5hpKg1d.mjs";
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
2
+ import { n as requireSingleHeaderValue } from "../headers-3zvE0rM3.mjs";
3
+ import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "../store-helpers-D1MP_gRG.mjs";
4
+ import { t as createIdempotencyResult } from "../interface-DYzM0q-u.mjs";
4
5
  import { and, eq, exists, gt, lt, or, startsWith } from "@classytic/repo-core/filter";
5
6
  import { createHash } from "node:crypto";
6
7
  import fp from "fastify-plugin";
@@ -1,2 +1,3 @@
1
- import { a as UpstashRedisLike, i as RedisIdempotencyStoreOptions, n as RedisClient, o as ioredisAsIdempotencyClient, r as RedisIdempotencyStore, s as upstashAsIdempotencyClient, t as IoredisLike } from "../redis-UDtLaNj6.mjs";
1
+
2
+ import { a as UpstashRedisLike, i as RedisIdempotencyStoreOptions, n as RedisClient, o as ioredisAsIdempotencyClient, r as RedisIdempotencyStore, s as upstashAsIdempotencyClient, t as IoredisLike } from "../redis-CduhKsJi.mjs";
2
3
  export { type IoredisLike, type RedisClient, RedisIdempotencyStore, type RedisIdempotencyStoreOptions, type UpstashRedisLike, ioredisAsIdempotencyClient, upstashAsIdempotencyClient };
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
1
2
  //#region src/idempotency/stores/redis.ts
2
3
  var RedisIdempotencyStore = class {
3
4
  name = "redis";