@classytic/arc 2.46.0 → 2.47.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 (192) hide show
  1. package/dist/{EventTransport-DNgD9NP4.mjs → EventTransport-BHKy4_Bi.mjs} +4 -4
  2. package/dist/{HookSystem-DRbPzEcP.mjs → HookSystem-CAIDVoKC.mjs} +2 -2
  3. package/dist/{ResourceRegistry-Douk51fa.mjs → ResourceRegistry-23Ml6FNe.mjs} +2 -2
  4. package/dist/{acquire-RbtvDg9s.mjs → acquire-DoFX06fm.mjs} +1 -1
  5. package/dist/{actionPermissions-De0AJ7hm.mjs → actionPermissions-DXrlWHHK.mjs} +13 -13
  6. package/dist/audit/index.d.mts +1 -1
  7. package/dist/audit/index.mjs +4 -4
  8. package/dist/auth/audit.mjs +1 -1
  9. package/dist/auth/index.d.mts +1 -1
  10. package/dist/auth/index.mjs +7 -7
  11. package/dist/auth/redis-session.mjs +1 -1
  12. package/dist/{authorizationDecision-DeZMrHcm.mjs → authorizationDecision-DYiubkYw.mjs} +4 -4
  13. package/dist/{boundedMap-2WBh3gM9.mjs → boundedMap-CtdzpJ3X.mjs} +1 -1
  14. package/dist/{buildHandler-DxVOOBpw.mjs → buildHandler-CARdmPNo.mjs} +4 -4
  15. package/dist/cache/index.mjs +4 -4
  16. package/dist/{caching-BYRwYrUo.mjs → caching-QRiryDLs.mjs} +2 -2
  17. package/dist/{claimed-DYlELdnm.mjs → claimed-BLecr1j3.mjs} +1 -1
  18. package/dist/cleanup/index.d.mts +1 -1
  19. package/dist/cleanup/index.mjs +4 -4
  20. package/dist/cli/commands/describe.d.mts +1 -1
  21. package/dist/cli/commands/describe.mjs +3 -3
  22. package/dist/cli/commands/docs.mjs +3 -3
  23. package/dist/cli/commands/doctor.mjs +1 -1
  24. package/dist/cli/commands/generate.mjs +2 -2
  25. package/dist/cli/commands/init.mjs +2 -2
  26. package/dist/cli/commands/introspect.mjs +2 -2
  27. package/dist/cli/index.mjs +3 -3
  28. package/dist/{constants-CHZMUwBW.mjs → constants-Cx7BcnHT.mjs} +1 -1
  29. package/dist/context/index.mjs +5 -5
  30. package/dist/core/index.d.mts +2 -2
  31. package/dist/core/index.mjs +7 -7
  32. package/dist/{core-D9rS2BxO.mjs → core-0WyMuo0f.mjs} +3 -3
  33. package/dist/{createActionRouter-0qkCRzTL.mjs → createActionRouter-mLAGbpDV.mjs} +6 -6
  34. package/dist/{createAggregationRouter-CUf5Esd9.mjs → createAggregationRouter-BEAjn3dA.mjs} +7 -7
  35. package/dist/{createApp-DZIXfDKD.mjs → createApp-QDP4vYWH.mjs} +29 -29
  36. package/dist/{createMcpServer-DeVpqQF-.d.mts → createMcpServer-DzXHX0SO.d.mts} +1 -1
  37. package/dist/{defineAggregation-bmKQ4NmC.mjs → defineAggregation-CFNfvz-C.mjs} +1 -1
  38. package/dist/{defineResource-CGmdmGwh.mjs → defineResource-BROJmhzJ.mjs} +10 -8
  39. package/dist/discovery/index.mjs +1 -1
  40. package/dist/docs/index.d.mts +1 -1
  41. package/dist/docs/index.mjs +3 -3
  42. package/dist/{elevation-CzhqAyVN.mjs → elevation-DrXeEWWk.mjs} +5 -5
  43. package/dist/encryption/index.mjs +3 -3
  44. package/dist/{errorHandler-dFyGOEoB.mjs → errorHandler-BiBXtxj4.mjs} +3 -3
  45. package/dist/{errors-BY8vzlP4.mjs → errors-DnrUChAy.mjs} +1 -1
  46. package/dist/{eventPlugin-eMhAPtQA.mjs → eventPlugin-BhKLUe7H.mjs} +8 -8
  47. package/dist/{eventTypes-Do2KYeJx.mjs → eventTypes-CCIRGakw.mjs} +2 -2
  48. package/dist/events/index.d.mts +2 -2
  49. package/dist/events/index.mjs +8 -7
  50. package/dist/events/transports/redis-stream-entry.mjs +4 -4
  51. package/dist/events/transports/redis.mjs +2 -2
  52. package/dist/factory/index.d.mts +3 -3
  53. package/dist/factory/index.mjs +6 -6
  54. package/dist/{fastify-augmentation-Dtn0IIRn.d.mts → fastify-augmentation-bzkWPt1f.d.mts} +2 -2
  55. package/dist/{fields-LnbCcvsw.mjs → fields-CYdpcV73.mjs} +1 -1
  56. package/dist/{filter-merge-BAWi019Q.mjs → filter-merge-6kasezRH.mjs} +1 -1
  57. package/dist/{generate-oXoDnpJf.mjs → generate-DUkcbc4r.mjs} +2 -2
  58. package/dist/{headers-DBd3Qheo.mjs → headers-KxhrKevA.mjs} +2 -2
  59. package/dist/{health-BlJu9GXS.mjs → health-CRJg3IIq.mjs} +1 -1
  60. package/dist/{health-Dp-3EC9o.mjs → health-jkYNdobJ.mjs} +1 -1
  61. package/dist/hooks/index.d.mts +1 -1
  62. package/dist/hooks/index.mjs +2 -2
  63. package/dist/http-cache/index.d.mts +211 -0
  64. package/dist/http-cache/index.mjs +605 -0
  65. package/dist/http-cache/purgers/cloudflare.d.mts +13 -0
  66. package/dist/http-cache/purgers/cloudflare.mjs +46 -0
  67. package/dist/http-cache/purgers/fastly.d.mts +12 -0
  68. package/dist/http-cache/purgers/fastly.mjs +47 -0
  69. package/dist/http-cache/testing/index.d.mts +68 -0
  70. package/dist/http-cache/testing/index.mjs +168 -0
  71. package/dist/idempotency/index.mjs +8 -8
  72. package/dist/idempotency/redis.mjs +2 -2
  73. package/dist/{index-BTxzJ_MN.d.mts → index-BxZS-8So.d.mts} +2 -2
  74. package/dist/{index-DyJFTJLA.d.mts → index-Cy2-QffW.d.mts} +9 -0
  75. package/dist/{index-CUdaoCYt.d.mts → index-D1X_C_qz.d.mts} +2 -2
  76. package/dist/{index-Bqfo8hLz.d.mts → index-DFCCQ9AE.d.mts} +1 -1
  77. package/dist/index.d.mts +3 -3
  78. package/dist/index.mjs +11 -11
  79. package/dist/{init-BOaNkLYb.mjs → init-CACwpktI.mjs} +1 -1
  80. package/dist/integrations/event-gateway.mjs +2 -2
  81. package/dist/integrations/index.d.mts +1 -1
  82. package/dist/integrations/index.mjs +1 -1
  83. package/dist/integrations/jobs/index.mjs +3 -3
  84. package/dist/integrations/mcp/index.d.mts +3 -3
  85. package/dist/integrations/mcp/index.mjs +2 -2
  86. package/dist/integrations/mcp/testing.d.mts +2 -2
  87. package/dist/integrations/mcp/testing.mjs +2 -2
  88. package/dist/integrations/streamline.mjs +3 -3
  89. package/dist/integrations/webhooks.d.mts +1 -1
  90. package/dist/integrations/webhooks.mjs +4 -3
  91. package/dist/integrations/websocket-pushref-redis.mjs +1 -1
  92. package/dist/integrations/websocket-redis.mjs +1 -1
  93. package/dist/integrations/websocket.mjs +2 -2
  94. package/dist/{jsonBody-DpRpKR_K.mjs → jsonBody-CzDBkCme.mjs} +2 -2
  95. package/dist/{keys-FBz6Ull-.mjs → keys-Cbwf6r1B.mjs} +1 -1
  96. package/dist/{loadResources-Bx1sKPnF.mjs → loadResources-Kr6vuljv.mjs} +3 -3
  97. package/dist/{loadResourcesFromEntry-b_jcqbxh.mjs → loadResourcesFromEntry-D2e0qoDR.mjs} +2 -2
  98. package/dist/logger/index.mjs +2 -2
  99. package/dist/{logger-CbFcIEBZ.mjs → logger-C110X5Yz.mjs} +1 -1
  100. package/dist/{mcpPlugin-yix548XX.mjs → mcpPlugin-4lIPr9OJ.mjs} +22 -22
  101. package/dist/{memory-Bgw5dn8N.mjs → memory-D9qkhXiB.mjs} +3 -3
  102. package/dist/{metrics-CZDQWVjS.mjs → metrics-B-qrrWfI.mjs} +3 -3
  103. package/dist/middleware/index.d.mts +1 -1
  104. package/dist/middleware/index.mjs +3 -3
  105. package/dist/migrations/index.mjs +2 -2
  106. package/dist/{module-Dsc_nKL5.mjs → module-BD8xHgrz.mjs} +1 -1
  107. package/dist/{multiTenant-XCxAUlru.d.mts → multiTenant-KZj8j1uJ.d.mts} +1 -1
  108. package/dist/{multipartBody-B85ek8Kj.mjs → multipartBody-qU7KCn1l.mjs} +1 -1
  109. package/dist/{observeSend-BK-JN1jK.mjs → observeSend-BnPtTotW.mjs} +1 -1
  110. package/dist/{openapi-Co7hl073.mjs → openapi-DoVa5SVP.mjs} +6 -6
  111. package/dist/outbox-admin/index.mjs +5 -5
  112. package/dist/{outbox-module-XvUThpqn.d.mts → outbox-module-5Mnwcycy.d.mts} +1 -1
  113. package/dist/outbox-module-DyITEIop.mjs +297 -0
  114. package/dist/permissions/index.mjs +7 -7
  115. package/dist/{permissions-A1oKtpiC.mjs → permissions-BBy4bOGi.mjs} +9 -9
  116. package/dist/{pipe-Czpw9U2n.mjs → pipe-BOm2o4UA.mjs} +2 -2
  117. package/dist/pipeline/index.d.mts +1 -1
  118. package/dist/pipeline/index.mjs +2 -2
  119. package/dist/{plan-KVseuBCL.mjs → plan-DDIGwuxr.mjs} +1 -1
  120. package/dist/{plugin-DTWt_8C3.mjs → plugin-Bn4D_0XK.mjs} +48 -24
  121. package/dist/plugins/index.d.mts +2 -2
  122. package/dist/plugins/index.mjs +17 -17
  123. package/dist/plugins/response-cache.mjs +4 -4
  124. package/dist/plugins/tracing-entry.mjs +2 -2
  125. package/dist/{pluralize-msB9X3yw.mjs → pluralize-ClEjcKlG.mjs} +1 -1
  126. package/dist/policy.types-DPqToKG1.d.mts +50 -0
  127. package/dist/presets/filesUpload.d.mts +1 -1
  128. package/dist/presets/filesUpload.mjs +5 -5
  129. package/dist/presets/index.d.mts +2 -2
  130. package/dist/presets/index.mjs +2 -2
  131. package/dist/presets/multiTenant.d.mts +1 -1
  132. package/dist/presets/multiTenant.mjs +5 -5
  133. package/dist/presets/search.d.mts +1 -1
  134. package/dist/presets/search.mjs +2 -2
  135. package/dist/{presets-qKCehiJM.mjs → presets-DK2jh5YR.mjs} +4 -4
  136. package/dist/{projection-ClBqtsIw.mjs → projection-BHH-sXyS.mjs} +2 -2
  137. package/dist/purger.types-2wNJK_89.mjs +24 -0
  138. package/dist/purger.types-DvPp4-yd.d.mts +26 -0
  139. package/dist/{queryCachePlugin-3gJj5Rbz.mjs → queryCachePlugin-Ckqe98AM.mjs} +6 -6
  140. package/dist/{rateLimitKey-Kro---xl.mjs → rateLimitKey-CWAjlqcN.mjs} +1 -1
  141. package/dist/{realtime-Ber8uJN2.mjs → realtime-BIJi9USY.mjs} +11 -11
  142. package/dist/registry/index.d.mts +2 -2
  143. package/dist/registry/index.mjs +3 -3
  144. package/dist/{registry-BA-_vFYk.mjs → registry-y9ZA-R_J.mjs} +2 -2
  145. package/dist/{outbox-module-mg9kDYkd.mjs → relay-BNrC1CEP.mjs} +5 -299
  146. package/dist/{renewingLease-CMY8YOcc.mjs → renewingLease-CS43br5E.mjs} +1 -1
  147. package/dist/{replyHelpers-DK9P_XSz.mjs → replyHelpers-oZDzakGb.mjs} +2 -2
  148. package/dist/{requestContext-GYO_0gEw.mjs → requestContext-fWb_YaV2.mjs} +1 -1
  149. package/dist/{requirement-DeNjZIH3.mjs → requirement--2hWyyHi.mjs} +1 -1
  150. package/dist/{resourceRateLimit-tHLbrtWc.mjs → resourceRateLimit-1WbcyMZY.mjs} +2 -2
  151. package/dist/{rolldown-runtime-Kv1fZdLg.mjs → rolldown-runtime-yH2lHMo_.mjs} +1 -1
  152. package/dist/{routeValidator-C_H5NanI.mjs → routeValidator-BSlRIA5c.mjs} +1 -1
  153. package/dist/{runtimeCapabilities-DWqbxkyw.mjs → runtimeCapabilities-CYCEtU1W.mjs} +1 -1
  154. package/dist/{schedules-eO_RzhCU.mjs → schedules-B5WGlYIT.mjs} +5 -5
  155. package/dist/{schemaConverter-DBJrPZN4.mjs → schemaConverter-DtNvts-6.mjs} +2 -2
  156. package/dist/{schemaIR-CEScKT2v.mjs → schemaIR-uS_RHqa3.mjs} +2 -2
  157. package/dist/schemas/index.mjs +1 -1
  158. package/dist/scim/index.mjs +2 -2
  159. package/dist/scope/index.mjs +5 -5
  160. package/dist/{scope-B-Sm9m_E.mjs → scope-BwVLSyNG.mjs} +4 -4
  161. package/dist/{shutdown-DzLFbe27.mjs → shutdown-BJiJN7FT.mjs} +1 -1
  162. package/dist/{simpleEqualityMatcher-DOJhwQ8g.mjs → simpleEqualityMatcher-DGRLq-1k.mjs} +1 -1
  163. package/dist/{sse-2972pVwV.mjs → sse-B_50llZu.mjs} +7 -7
  164. package/dist/{sseStream-AWLEeNV-.mjs → sseStream-BjSo9Ult.mjs} +2 -2
  165. package/dist/{store-helpers-VzjgVTkM.mjs → store-helpers-D-n5cwy5.mjs} +1 -1
  166. package/dist/{streaming-DvraWW6x.mjs → streaming-Dcgqa-hH.mjs} +1 -1
  167. package/dist/{subscriberIdentity-Bya56jsg.mjs → subscriberIdentity-C9KhIXTF.mjs} +1 -1
  168. package/dist/{tenancy-DSa_0hhw.mjs → tenancy-COrhjPRZ.mjs} +2 -2
  169. package/dist/{tenantPreparation-BrpkQre3.mjs → tenantPreparation-BElWHytd.mjs} +4 -4
  170. package/dist/testing/cleanupStoreContract.mjs +1 -1
  171. package/dist/testing/index.d.mts +3 -3
  172. package/dist/testing/index.mjs +11 -11
  173. package/dist/testing/outboxStoreContract.mjs +2 -2
  174. package/dist/testing/requiredPorts.mjs +2 -2
  175. package/dist/testing/storageContract.mjs +1 -1
  176. package/dist/{timing-6rQTuCwg.mjs → timing-CaxKbRk_.mjs} +1 -1
  177. package/dist/{transactionContext-DaxYUEgH.mjs → transactionContext-8qKON0Nk.mjs} +1 -1
  178. package/dist/{typeGuards-UKnX8wPX.mjs → typeGuards-DVjVSsXO.mjs} +1 -1
  179. package/dist/types/index.d.mts +1 -1
  180. package/dist/types/index.mjs +1 -1
  181. package/dist/types/storage.mjs +1 -1
  182. package/dist/{types-CuGjhn83.mjs → types-DZHqOuJE.mjs} +4 -4
  183. package/dist/{types-BYEb_dLW.d.mts → types-DeLiuaNv.d.mts} +1 -1
  184. package/dist/usage/index.mjs +4 -4
  185. package/dist/{userHelpers-oX5_mOVs.mjs → userHelpers-_eGj6kf0.mjs} +1 -1
  186. package/dist/utils/index.d.mts +1 -1
  187. package/dist/utils/index.mjs +12 -12
  188. package/dist/{utils-CjjGOT4E.mjs → utils-Dd6MWpye.mjs} +5 -5
  189. package/dist/{validate-4RlTKOJb.mjs → validate-BaF5wd0x.mjs} +3 -3
  190. package/dist/{versioning-Dk2-19La.mjs → versioning-DyV7mwtK.mjs} +3 -3
  191. package/dist/{workScope-DoBsoVo4.mjs → workScope-CmCBUmPR.mjs} +2 -2
  192. package/package.json +48 -20
@@ -1,17 +1,10 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
2
- import { t as transactionContext } from "./transactionContext-DaxYUEgH.mjs";
3
- import { n as requestContext } from "./requestContext-GYO_0gEw.mjs";
4
- import { n as evictToSize, r as touch } from "./boundedMap-2WBh3gM9.mjs";
5
- import { i as resolveEventTransport } from "./EventTransport-DNgD9NP4.mjs";
6
- import { t as emitObserved } from "./eventPlugin-eMhAPtQA.mjs";
7
- import { n as canReportHealth, r as readOutboxHealth } from "./health-BlJu9GXS.mjs";
8
- import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "./store-helpers-VzjgVTkM.mjs";
9
- import { t as claimedAttempts } from "./claimed-DYlELdnm.mjs";
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
+ import { n as evictToSize, r as touch } from "./boundedMap-CtdzpJ3X.mjs";
3
+ import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "./store-helpers-D-n5cwy5.mjs";
4
+ import { t as claimedAttempts } from "./claimed-BLecr1j3.mjs";
10
5
  import { and, anyOf, eq, lte, ne, or } from "@classytic/repo-core/filter";
11
- import { randomBytes } from "node:crypto";
12
6
  import { InvalidOutboxEventError, OutboxConflictError, OutboxOwnershipError, outboxPayloadFingerprint } from "@classytic/primitives/outbox";
13
7
  import { update } from "@classytic/repo-core/update";
14
- import { hostname } from "node:os";
15
8
  // src/events/outbox/backoff.ts
16
9
  /**
17
10
  * Compute a `retryAt` `Date` using exponential backoff with jitter.
@@ -746,291 +739,4 @@ function normalizeError(err) {
746
739
  };
747
740
  return { message: String(err) };
748
741
  }
749
- // src/events/outbox-module.ts
750
- /**
751
- * The OUTBOX as a module — so the store is a SLOT other modules depend on, not a value the host
752
- * threads by hand.
753
- *
754
- * ## The failure this exists to make impossible
755
- *
756
- * A durable store passed as a constructor argument to N consumers will eventually miss one, and
757
- * the miss is silent. Observed in two independent ERP hosts on the same fleet:
758
- *
759
- * - one passed an outbox to its revenue-attach seam and **not** to `createOrder`, so
760
- * `order:created` published fire-and-forget — a failed publish discarded the revenue trigger
761
- * entirely: no attach, no dead-letter, no log. Cash collected, nothing recorded.
762
- * - the other had the identical gap, written independently.
763
- *
764
- * Six consumers had to be wired by hand in each host (order kernel, revenue kernel, access
765
- * kernel, revenue-attach durability, line-activation dead letters, promo-commit dead letters).
766
- * That is not a discipline problem; it is a design problem.
767
- *
768
- * As a module the store is registered ONCE and read from the registry. A consumer declares
769
- * `dependsOn: ['outbox']` and arc refuses to boot without it — the omission becomes a startup
770
- * failure instead of a quiet data-loss window.
771
- *
772
- * ## What this module does NOT do
773
- *
774
- * It does not build a store. Store construction is store-specific (a mongo model, a SQL table),
775
- * and arc is deliberately storage-agnostic — `repositoryAsOutboxStore` already adapts any
776
- * repository, and kits own their own schema (e.g. `@classytic/mongokit/outbox`). This module owns
777
- * the three things that are genuinely arc's: the module SLOT, the relay SCHEDULE, and shutdown.
778
- */
779
- /**
780
- * The store contract is `@classytic/primitives/outbox`'s, not arc's — arc adapts to it rather
781
- * than owning it, which is why a kit (mongokit) can supply a store with no arc dependency.
782
- */
783
- /** Default relay cadence. Frequent enough that a retry is not a user-visible delay. */
784
- const DEFAULT_RELAY_EVERY_MS = 5e3;
785
- /** How long the readiness check reuses a relay-health reading. See `health.probeCacheMs`. */
786
- const DEFAULT_PROBE_CACHE_MS = 5e3;
787
- /** How often an unhealthy outbox is logged. See `health.alertEveryMs`. */
788
- const DEFAULT_HEALTH_ALERT_EVERY_MS = 3e5;
789
- /**
790
- * One relay identity per RELAY INSTANCE — `<name>:<hostname>:<pid>:<random>`.
791
- *
792
- * A lease identifies an independently executing CLAIMANT, not a crash domain.
793
- * Arc lets two outbox modules coexist (`name` is the `dependsOn` key), each
794
- * with its own schedule arm, and nothing stops two of them pointing at the
795
- * same store: they tick independently, so they are two claimants and must be
796
- * two identities. Scoping this per-process instead would have made the module
797
- * WEAKER than the primitive it wraps — `EventOutbox`'s own fallback is already
798
- * per-instance — and would leave the store unable to tell the two apart after
799
- * a lease expiry, which is exactly the stale-owner hole this replaced.
800
- *
801
- * Every component earns its place: `name` distinguishes co-resident modules,
802
- * `hostname:pid` makes a lease row legible in ops tooling, and the random
803
- * suffix breaks the tie a container restart creates — same hostname, often the
804
- * same pid, and the restarted process must not inherit a predecessor's
805
- * identity while that predecessor's lease is still live.
806
- *
807
- * Called once per `bootstrap()`, so the id is stable across every tick of the
808
- * relay it belongs to — which the lease depends on.
809
- */
810
- function mintConsumerId(name) {
811
- return `${name}:${hostname()}:${process.pid}:${randomBytes(4).toString("hex")}`;
812
- }
813
- /**
814
- * Compose the outbox as a module.
815
- *
816
- * ```ts
817
- * // host
818
- * const model = createOutboxModel(connection, { visibleAtField: 'nextVisibleAt' });
819
- * createApp({ modules: [
820
- * createOutboxModule({
821
- * store: repositoryAsOutboxStore(new Repository(model), { visibleAtField: 'nextVisibleAt' }),
822
- * onError: (err, ctx) => app.log.error({ err, ...ctx }, 'outbox relay'),
823
- * }),
824
- * …
825
- * ]});
826
- *
827
- * // consumer module
828
- * defineModule({
829
- * name: 'order',
830
- * dependsOn: ['outbox'],
831
- * bootstrap: (f) => createOrder({
832
- * outbox: getModuleExports<OutboxModuleExports>(f, 'outbox').store,
833
- * }),
834
- * });
835
- * ```
836
- *
837
- * `dependsOn` is doing real work there: it both orders the bootstraps and makes a missing outbox a
838
- * boot error naming the module that needed it.
839
- */
840
- function createOutboxModule(options) {
841
- const name = options.name ?? "outbox";
842
- const relayEveryMs = options.relayEveryMs ?? DEFAULT_RELAY_EVERY_MS;
843
- const lagUnhealthyMs = (options.health === false ? void 0 : options.health?.relayLagUnhealthyMs) ?? 3e5;
844
- const probeCacheMs = (options.health === false ? void 0 : options.health?.probeCacheMs) ?? DEFAULT_PROBE_CACHE_MS;
845
- if (!Number.isFinite(probeCacheMs) || probeCacheMs < 0) throw new Error(`Outbox module "${name}": health.probeCacheMs must be a non-negative number, got ${String(probeCacheMs)}.`);
846
- const alertEveryMs = options.health === false ? 0 : options.health?.alertEveryMs ?? DEFAULT_HEALTH_ALERT_EVERY_MS;
847
- if (!Number.isFinite(alertEveryMs) || alertEveryMs < 0) throw new Error(`Outbox module "${name}": health.alertEveryMs must be a non-negative number, got ${String(alertEveryMs)}.`);
848
- let log;
849
- /** The unmeasurable-store warning is said once, not every alert tick. */
850
- let warnedUnmeasurable = false;
851
- /**
852
- * The readiness probe's reading, reused for `probeCacheMs` and shared by
853
- * concurrent probes (single-flight). A failed or unmeasurable reading is
854
- * cached as unhealthy for the same window — retrying a failing store on
855
- * every probe is load on the thing that is already failing.
856
- */
857
- let probeReading;
858
- let probeInFlight;
859
- const probeHealthy = (read) => {
860
- if (probeReading && Date.now() - probeReading.at < probeCacheMs) return Promise.resolve(probeReading.healthy);
861
- probeInFlight ??= read().then((h) => h.healthy, () => false).then((healthy) => {
862
- probeReading = {
863
- at: Date.now(),
864
- healthy
865
- };
866
- return healthy;
867
- }).finally(() => {
868
- probeInFlight = void 0;
869
- });
870
- return probeInFlight;
871
- };
872
- /**
873
- * Built at bootstrap and reused by the schedule.
874
- *
875
- * Not rebuilt per tick: `EventOutbox` carries the consumer id the lease is keyed on, and a fresh
876
- * instance per tick would be a fresh claimant every few seconds — which defeats the lease it
877
- * depends on for exactly-once publishing.
878
- */
879
- let exports;
880
- /** Passes THIS module started (nudge, schedule) that have not settled — `drain()` waits on them. */
881
- const inFlightPasses = /* @__PURE__ */ new Set();
882
- const trackPass = (pass) => {
883
- inFlightPasses.add(pass);
884
- const untrack = () => {
885
- inFlightPasses.delete(pass);
886
- };
887
- pass.then(untrack, untrack);
888
- return pass;
889
- };
890
- return {
891
- name,
892
- bootstrap: (fastify) => {
893
- log = fastify.log;
894
- const store = typeof options.store === "function" ? options.store(fastify) : options.store;
895
- /**
896
- * The RAW transport, never `fastify.events`.
897
- *
898
- * This read used to be `(fastify as { events?: EventTransport }).events` — a cast across
899
- * two INCOMPATIBLE shapes. The facade's `publish(type, payload, meta?)` took the relayed
900
- * `DomainEvent` as its `type` argument and failed the non-empty-string guard, so the
901
- * documented default path published NOTHING: subscribers saw nothing and every tick
902
- * reported `publishFailed: 1` until the row dead-lettered. The cast is what let two
903
- * mismatched signatures typecheck.
904
- */
905
- const transport = options.transport === void 0 ? resolveEventTransport(fastify) : typeof options.transport === "function" ? options.transport(fastify) : options.transport;
906
- /**
907
- * No transport is BOOT-FATAL, because the alternative is invisible:
908
- * `EventOutbox.relayBatch()` returns an empty result when it has none, so the
909
- * module's schedule would tick forever, publish nothing, and let the store grow —
910
- * a durable backlog nobody is draining, reported as healthy. The failure this
911
- * module exists to prevent, arrived at from the other side.
912
- */
913
- if (transport === void 0) throw new Error(`Outbox module "${name}" could not resolve an event transport, so its relay would tick forever without publishing while the store grows. Register arc's events plugin (it is on by default — check \`arcPlugins.events !== false\`), or pass an explicit \`transport\` to \`createOutboxModule\`. Note the outbox needs the RAW EventTransport, not the \`fastify.events\` facade: the facade takes \`(type, payload, meta?)\` and fails open, which would acknowledge rows whose publish actually failed.`);
914
- const relay = new EventOutbox({
915
- store,
916
- transport,
917
- onPublished: (event) => emitObserved(fastify.events, event),
918
- ...options.batchSize !== void 0 ? { batchSize: options.batchSize } : {},
919
- ...options.leaseMs !== void 0 ? { leaseMs: options.leaseMs } : {},
920
- consumerId: options.consumerId ?? mintConsumerId(name),
921
- onError: options.onError ?? ((info) => {
922
- fastify.log.error({
923
- err: info.error,
924
- kind: info.kind,
925
- ...info.event?.meta.id !== void 0 ? { eventId: info.event.meta.id } : {},
926
- ...info.event?.type !== void 0 ? { eventType: info.event.type } : {}
927
- }, `outbox relay "${name}" failed`);
928
- }),
929
- ...options.failurePolicy !== void 0 ? { failurePolicy: options.failurePolicy } : {},
930
- ...options.sessionProvider === false ? {} : { sessionProvider: options.sessionProvider ?? (() => transactionContext.get()) }
931
- });
932
- /**
933
- * One pass per burst of requests. `drainQueued` stays true from the
934
- * first request until the pass STARTS, so a request landing mid-pass
935
- * schedules the next one — a row written during a pass is never left
936
- * waiting for the interval.
937
- */
938
- let drainQueued = false;
939
- const requestDrain = () => {
940
- if (drainQueued) return;
941
- drainQueued = true;
942
- let passDone = () => {};
943
- trackPass(new Promise((resolve) => passDone = resolve));
944
- setImmediate(() => {
945
- drainQueued = false;
946
- requestContext.storage.exit(() => {
947
- relay.relayBatch().catch((err) => {
948
- fastify.log.error({ err }, `outbox relay "${name}" requested drain failed`);
949
- }).finally(passDone);
950
- });
951
- });
952
- };
953
- const drain = ({ maxPasses = 100 } = {}) => requestContext.storage.exit(async () => {
954
- const total = {
955
- passes: 0,
956
- relayed: 0,
957
- publishFailed: 0,
958
- deadLettered: 0,
959
- drained: false
960
- };
961
- while (total.passes < maxPasses) {
962
- if (inFlightPasses.size > 0) await Promise.allSettled([...inFlightPasses]);
963
- const r = await relay.relayBatch();
964
- total.passes++;
965
- total.relayed += r.relayed;
966
- total.publishFailed += r.publishFailed;
967
- total.deadLettered += r.deadLettered;
968
- if (r.attempted === 0 && inFlightPasses.size === 0) {
969
- total.drained = true;
970
- break;
971
- }
972
- }
973
- return total;
974
- });
975
- const health = async () => {
976
- if (!canReportHealth(store)) throw new Error(`Outbox module "${name}": relay health needs BOTH countByStatus and oldestPendingAgeMs on the store, and it is missing at least one.`);
977
- return readOutboxHealth(store, lagUnhealthyMs);
978
- };
979
- exports = {
980
- store,
981
- relay,
982
- requestDrain,
983
- drain,
984
- health
985
- };
986
- return exports;
987
- },
988
- ...options.health === false ? {} : { healthChecks: [{
989
- name: `${name}.relay`,
990
- critical: false,
991
- check: () => exports ? probeHealthy(exports.health) : Promise.resolve(false)
992
- }] },
993
- /**
994
- * The relay runs on the module's OWN schedule arm, so the host stops owning the tick — and
995
- * a host that forgets to start one cannot exist.
996
- */
997
- scheduledJobs: () => [{
998
- name: `${name}.relay`,
999
- kind: "relay",
1000
- every: relayEveryMs,
1001
- runOnStart: options.runOnStart ?? true,
1002
- handler: async () => {
1003
- if (exports) await trackPass(exports.relay.relay());
1004
- }
1005
- }, ...alertEveryMs > 0 ? [{
1006
- name: `${name}.health`,
1007
- kind: "relay",
1008
- every: alertEveryMs,
1009
- handler: async () => {
1010
- if (!exports || !log) return;
1011
- if (!canReportHealth(exports.store)) {
1012
- if (!warnedUnmeasurable) {
1013
- warnedUnmeasurable = true;
1014
- log.warn({
1015
- marker: "OUTBOX_HEALTH_UNMEASURABLE",
1016
- outbox: name
1017
- }, `outbox "${name}" store lacks countByStatus or oldestPendingAgeMs — relay stalls cannot be alerted on`);
1018
- }
1019
- return;
1020
- }
1021
- const h = await exports.health();
1022
- if (h.deadLetter > 0) log.warn({
1023
- marker: "OUTBOX_DEAD_LETTER",
1024
- outbox: name,
1025
- ...h
1026
- }, `outbox "${name}" has dead-lettered events — inspect and replay them`);
1027
- if (h.relayLagMs !== null && h.relayLagMs >= lagUnhealthyMs) log.error({
1028
- marker: "OUTBOX_RELAY_LAG",
1029
- outbox: name,
1030
- ...h
1031
- }, `outbox "${name}" relay is behind — events are committed but not delivered`);
1032
- }
1033
- }] : []]
1034
- };
1035
- }
1036
- export { exponentialBackoff as i, EventOutbox as n, repositoryAsOutboxStore as r, createOutboxModule as t };
742
+ export { repositoryAsOutboxStore as n, exponentialBackoff as r, EventOutbox as t };
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
2
  // src/lock/renewingLease.ts
3
3
  /**
4
4
  * Start renewing an ALREADY-ACQUIRED lease. The caller performed the
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-Kv1fZdLg.mjs";
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-yH2lHMo_.mjs";
3
3
  import { toCanonicalList } from "@classytic/repo-core/pagination";
4
4
  import fp from "fastify-plugin";
5
5
  // src/plugins/replyHelpers.ts
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  // src/context/requestContext.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
2
  // src/idempotency/requirement.ts
3
3
  /** What is wrong with a route's idempotency declaration, or `undefined` when it is sound. */
4
4
  function idempotencyConfigProblem(config) {
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
2
- import { t as createTenantKeyGenerator } from "./rateLimitKey-Kro---xl.mjs";
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
+ import { t as createTenantKeyGenerator } from "./rateLimitKey-CWAjlqcN.mjs";
3
3
  // src/permissions/resourceRateLimit.ts
4
4
  function decision(allowed, max, remaining, ttlSeconds) {
5
5
  const reset = Math.max(1, ttlSeconds);
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
2
  import "node:module";
3
3
  // \0rolldown/runtime.js
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
2
  import { AjvCompiler } from "@fastify/ajv-compiler";
3
3
  // src/core/routeValidator.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
2
  // src/utils/runtimeCapabilities.ts
3
3
  /**
4
4
  * `Symbol.for` so declarations from two arc copies in one dependency graph
@@ -1,8 +1,8 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-Kv1fZdLg.mjs";
3
- import { a as runShutdown, i as runAdmittedWork, r as registerShutdownParticipant } from "./shutdown-DzLFbe27.mjs";
4
- import { t as runWorkScope } from "./workScope-DoBsoVo4.mjs";
5
- import { t as startRenewingLease } from "./renewingLease-CMY8YOcc.mjs";
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-yH2lHMo_.mjs";
3
+ import { a as runShutdown, i as runAdmittedWork, r as registerShutdownParticipant } from "./shutdown-BJiJN7FT.mjs";
4
+ import { t as runWorkScope } from "./workScope-CmCBUmPR.mjs";
5
+ import { t as startRenewingLease } from "./renewingLease-CS43br5E.mjs";
6
6
  import fp from "fastify-plugin";
7
7
  import { civilDateOf, civilDateToInstant, isValidTimeZone, localTimeParts } from "@classytic/primitives/timezone";
8
8
  // src/plugins/dailyGate.ts
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
2
- import { t as arcLog } from "./logger-CbFcIEBZ.mjs";
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
+ import { t as arcLog } from "./logger-C110X5Yz.mjs";
3
3
  // src/utils/schemaConverter.ts
4
4
  /**
5
5
  * Schema Converter — Detect-First, Convert-Only-When-Needed
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
2
- import { o as toJsonSchema } from "./schemaConverter-DBJrPZN4.mjs";
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
+ import { o as toJsonSchema } from "./schemaConverter-DtNvts-6.mjs";
3
3
  // src/core/schemaIR.ts
4
4
  /**
5
5
  * Schema IR — one canonical representation, two adapters.
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
2
  import { errorContractSchema, errorDetailSchema } from "@classytic/repo-core/errors";
3
3
  import { Type, Type as Type$1 } from "typebox";
4
4
  // src/schemas/index.ts
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
2
- import { t as parseJsonBody } from "../jsonBody-DpRpKR_K.mjs";
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
+ import { t as parseJsonBody } from "../jsonBody-CzDBkCme.mjs";
3
3
  import fp from "fastify-plugin";
4
4
  // src/scim/errors.ts
5
5
  var ScimError = class extends Error {
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
2
- import { C as isService, D as requireUserId, E as requireTeamId, O as scopeFirstCtx, S as isOrgInScope, T as requireOrgId, _ as getUserRoles, a as getDPoPJkt, b as isElevated, c as getOrgId, d as getScopeContext, f as getScopeContextMap, g as getUserId, h as getTenantFromRequest, i as getClientId, l as getOrgRoles, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, r as getAncestorOrgIds, s as getOrgContext, t as AUTHENTICATED_SCOPE, u as getRequestScope, v as hasOrgAccess, w as requireClientId, x as isMember, y as isAuthenticated } from "../types-CuGjhn83.mjs";
3
- import { t as createTenantKeyGenerator } from "../rateLimitKey-Kro---xl.mjs";
4
- import { t as elevation_default } from "../elevation-CzhqAyVN.mjs";
5
- import { t as resolveOrgFromHeader } from "../scope-B-Sm9m_E.mjs";
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
+ import { C as isService, D as requireUserId, E as requireTeamId, O as scopeFirstCtx, S as isOrgInScope, T as requireOrgId, _ as getUserRoles, a as getDPoPJkt, b as isElevated, c as getOrgId, d as getScopeContext, f as getScopeContextMap, g as getUserId, h as getTenantFromRequest, i as getClientId, l as getOrgRoles, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, r as getAncestorOrgIds, s as getOrgContext, t as AUTHENTICATED_SCOPE, u as getRequestScope, v as hasOrgAccess, w as requireClientId, x as isMember, y as isAuthenticated } from "../types-DZHqOuJE.mjs";
3
+ import { t as createTenantKeyGenerator } from "../rateLimitKey-CWAjlqcN.mjs";
4
+ import { t as elevation_default } from "../elevation-DrXeEWWk.mjs";
5
+ import { t as resolveOrgFromHeader } from "../scope-BwVLSyNG.mjs";
6
6
  export { AUTHENTICATED_SCOPE, PUBLIC_SCOPE, createTenantKeyGenerator, elevation_default as elevationPlugin, getAncestorOrgIds, getClientId, getDPoPJkt, getMandate, getOrgContext, getOrgId, getOrgRoles, getRequestScope, getScopeContext, getScopeContextMap, getServiceScopes, getTeamId, getTenantFromRequest, getUserId, getUserRoles, hasOrgAccess, isAuthenticated, isElevated, isMember, isOrgInScope, isService, requireClientId, requireOrgId, requireTeamId, requireUserId, resolveOrgFromHeader, scopeFirstCtx };
@@ -1,7 +1,7 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
2
- import { a as OrgAccessDeniedError, l as UnauthorizedError } from "./errors-BY8vzlP4.mjs";
3
- import { n as requireSingleHeaderValue } from "./headers-DBd3Qheo.mjs";
4
- import { n as getUserRoles } from "./userHelpers-oX5_mOVs.mjs";
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
+ import { a as OrgAccessDeniedError, l as UnauthorizedError } from "./errors-DnrUChAy.mjs";
3
+ import { n as requireSingleHeaderValue } from "./headers-KxhrKevA.mjs";
4
+ import { n as getUserRoles } from "./userHelpers-_eGj6kf0.mjs";
5
5
  // src/scope/resolveOrgFromHeader.ts
6
6
  /**
7
7
  * Create a preHandler hook that resolves org scope from a header.
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  // src/utils/shutdown.ts
4
4
  /** Stop admissions across every runtime before draining work and disposing domain engines. */
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
2
  // src/utils/simpleEqualityMatcher.ts
3
3
  /**
4
4
  * `simpleEqualityMatcher` — a minimal, dialect-agnostic flat-key equality
@@ -1,10 +1,10 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-Kv1fZdLg.mjs";
3
- import { t as arcLog } from "./logger-CbFcIEBZ.mjs";
4
- import { g as getUserId, n as PUBLIC_SCOPE } from "./types-CuGjhn83.mjs";
5
- import { n as isEventVisible, t as eventAudienceOf } from "./tenancy-DSa_0hhw.mjs";
6
- import { a as promoteStreamTokenToHeader } from "./streaming-DvraWW6x.mjs";
7
- import { t as openSseStream } from "./sseStream-AWLEeNV-.mjs";
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-yH2lHMo_.mjs";
3
+ import { t as arcLog } from "./logger-C110X5Yz.mjs";
4
+ import { g as getUserId, n as PUBLIC_SCOPE } from "./types-DZHqOuJE.mjs";
5
+ import { n as isEventVisible, t as eventAudienceOf } from "./tenancy-COrhjPRZ.mjs";
6
+ import { a as promoteStreamTokenToHeader } from "./streaming-Dcgqa-hH.mjs";
7
+ import { t as openSseStream } from "./sseStream-BjSo9Ult.mjs";
8
8
  import fp from "fastify-plugin";
9
9
  // src/plugins/sse.ts
10
10
  var sse_exports = /* @__PURE__ */ __exportAll({
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
2
- import { n as forwardedStreamHeaders } from "./streaming-DvraWW6x.mjs";
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
+ import { n as forwardedStreamHeaders } from "./streaming-Dcgqa-hH.mjs";
3
3
  // src/utils/sseStream.ts
4
4
  /**
5
5
  * Take over the reply socket and open an SSE stream. Call ONLY after every
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
2
  // src/utils/store-helpers.ts
3
3
  /**
4
4
  * Classify an error thrown by `getOne` / `getById` / `update` as a
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
2
  import { Readable } from "node:stream";
3
3
  // src/utils/streaming.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
2
  // src/events/subscriberIdentity.ts
3
3
  const SUBSCRIBER_ID = Symbol.for("@classytic/arc/subscriber-id");
4
4
  /** Assign a deployment-stable identity for durable per-handler progress; never use an index. */
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
2
- import { b as isElevated, c as getOrgId } from "./types-CuGjhn83.mjs";
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
+ import { b as isElevated, c as getOrgId } from "./types-DZHqOuJE.mjs";
3
3
  // src/core/tenancy.ts
4
4
  function eventAudienceOf(scope) {
5
5
  const tenancy = resolveTenancy({ _scope: scope }, "organizationId");
@@ -1,7 +1,7 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
2
- import { t as conjoinPolicyFilters } from "./filter-merge-BAWi019Q.mjs";
3
- import { d as createDomainError } from "./errors-BY8vzlP4.mjs";
4
- import { b as isElevated, c as getOrgId, d as getScopeContext, m as getTeamId, v as hasOrgAccess } from "./types-CuGjhn83.mjs";
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
+ import { t as conjoinPolicyFilters } from "./filter-merge-6kasezRH.mjs";
3
+ import { d as createDomainError } from "./errors-DnrUChAy.mjs";
4
+ import { b as isElevated, c as getOrgId, d as getScopeContext, m as getTeamId, v as hasOrgAccess } from "./types-DZHqOuJE.mjs";
5
5
  // src/permissions/tenantPreparation.ts
6
6
  /** Tenant preparation shared by HTTP middleware and direct transport invocation. */
7
7
  const PREPARATION = Symbol.for("arc.tenantPreparation");
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
2
  import { afterAll, beforeAll, describe, expect, it } from "vitest";
3
3
  // src/testing/cleanupStoreContract.ts
4
4
  /**
@@ -1,10 +1,10 @@
1
1
 
2
2
  import { i as RequestScope } from "../types-DnkIALZ8.mjs";
3
3
  import { l as PermissionCheck, t as AnyRecord } from "../base-HXNgPQww.mjs";
4
- import { F as ResourceDefinition } from "../index-DyJFTJLA.mjs";
4
+ import { F as ResourceDefinition } from "../index-Cy2-QffW.mjs";
5
5
  import { h as ModuleSetupContext, m as ModuleDisposer, o as ArcPorts, p as PortName, r as ArcModuleInput, u as ModuleName } from "../types-BeEJm-DV.mjs";
6
- import "../index-Bqfo8hLz.mjs";
7
- import { n as CreateAppOptions } from "../index-CUdaoCYt.mjs";
6
+ import "../index-DFCCQ9AE.mjs";
7
+ import { n as CreateAppOptions } from "../index-D1X_C_qz.mjs";
8
8
  import { StorageContractSetup, StorageContractSetupResult, runStorageContract } from "./storageContract.mjs";
9
9
  import { StandardRepo } from "@classytic/repo-core/repository";
10
10
  import { FastifyInstance, FastifyServerOptions } from "fastify";
@@ -1,13 +1,13 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
2
- import { t as CRUD_OPERATIONS } from "../constants-CHZMUwBW.mjs";
3
- import { f as BaseController } from "../plugin-DTWt_8C3.mjs";
4
- import { g as getUserId } from "../types-CuGjhn83.mjs";
5
- import { t as defineAggregation } from "../defineAggregation-bmKQ4NmC.mjs";
6
- import { t as defineResource } from "../defineResource-CGmdmGwh.mjs";
7
- import { E as requireOrgRole } from "../permissions-A1oKtpiC.mjs";
8
- import { h as asModulePorts, r as createApp } from "../createApp-DZIXfDKD.mjs";
9
- import { d as resolveModule, l as isLazyBridge, o as resolveModuleClosure } from "../plan-KVseuBCL.mjs";
10
- import { n as getModuleExports } from "../module-Dsc_nKL5.mjs";
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
+ import { t as CRUD_OPERATIONS } from "../constants-Cx7BcnHT.mjs";
3
+ import { f as BaseController } from "../plugin-Bn4D_0XK.mjs";
4
+ import { g as getUserId } from "../types-DZHqOuJE.mjs";
5
+ import { t as defineAggregation } from "../defineAggregation-CFNfvz-C.mjs";
6
+ import { t as defineResource } from "../defineResource-BROJmhzJ.mjs";
7
+ import { E as requireOrgRole } from "../permissions-BBy4bOGi.mjs";
8
+ import { h as asModulePorts, r as createApp } from "../createApp-QDP4vYWH.mjs";
9
+ import { d as resolveModule, l as isLazyBridge, o as resolveModuleClosure } from "../plan-DDIGwuxr.mjs";
10
+ import { n as getModuleExports } from "../module-BD8xHgrz.mjs";
11
11
  import { runStorageContract } from "./storageContract.mjs";
12
12
  import Fastify from "fastify";
13
13
  import { afterAll, describe, expect, it, vi } from "vitest";
@@ -1566,7 +1566,7 @@ function pickDefaultAuth(authMode, callerAuth) {
1566
1566
  };
1567
1567
  }
1568
1568
  async function createTestApp(options = {}) {
1569
- const { createApp } = await import("../createApp-DZIXfDKD.mjs").then((n) => n.i);
1569
+ const { createApp } = await import("../createApp-QDP4vYWH.mjs").then((n) => n.i);
1570
1570
  const { resources = [], db = "in-memory", connectMongoose = false, authMode = "jwt", defaultOrgId, plugins, auth: callerAuth, ...appOptions } = options;
1571
1571
  let dbHandle;
1572
1572
  let dbUri;
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
2
- import { t as claimedAttempts } from "../claimed-DYlELdnm.mjs";
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
+ import { t as claimedAttempts } from "../claimed-BLecr1j3.mjs";
3
3
  import { OutboxConflictError, OutboxOwnershipError } from "@classytic/primitives/outbox";
4
4
  import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest";
5
5
  // src/testing/outboxStoreContract.ts
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
2
- import { c as declareModules, d as resolveModule, i as planModules, r as compositionProblems } from "../plan-KVseuBCL.mjs";
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
+ import { c as declareModules, d as resolveModule, i as planModules, r as compositionProblems } from "../plan-DDIGwuxr.mjs";
3
3
  // src/testing/requiredPorts.ts
4
4
  /**
5
5
  * Assert a module declares EXACTLY `ports` as required, and that composing it without any one of
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
2
  import { afterAll, beforeAll, describe, expect, it } from "vitest";
3
3
  // src/testing/storageContract.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.46.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
2
2
  import { createHash } from "node:crypto";
3
3
  // src/utils/operationIdentity.ts
4
4
  /** Security context included in idempotency identities across transports. */