@classytic/arc 2.43.0 → 2.44.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 (212) hide show
  1. package/dist/{EventTransport-tzA7CAB4.mjs → EventTransport-DZWDsaPa.mjs} +2 -2
  2. package/dist/{HookSystem-B6UaKRbF.mjs → HookSystem-yjEgn7Cm.mjs} +2 -2
  3. package/dist/{ResourceRegistry-CuCARu2B.mjs → ResourceRegistry-DJxHUpE4.mjs} +2 -2
  4. package/dist/acquire-BozJ-9yt.mjs +35 -0
  5. package/dist/{actionPermissions-BotX1YOa.mjs → actionPermissions-5N04zBL4.mjs} +13 -17
  6. package/dist/audit/index.d.mts +6 -6
  7. package/dist/audit/index.mjs +4 -4
  8. package/dist/auth/audit.d.mts +8 -8
  9. package/dist/auth/audit.mjs +1 -1
  10. package/dist/auth/index.d.mts +5 -5
  11. package/dist/auth/index.mjs +11 -8
  12. package/dist/auth/redis-session.d.mts +4 -5
  13. package/dist/auth/redis-session.mjs +1 -1
  14. package/dist/{authorizationDecision-DQYrkl5f.mjs → authorizationDecision-wX3SA9w_.mjs} +4 -4
  15. package/dist/{boundedMap-BULzfXYU.mjs → boundedMap-DWiKW7lP.mjs} +1 -1
  16. package/dist/{buildHandler-CRQ8EcX5.mjs → buildHandler-Bswu_vNb.mjs} +4 -4
  17. package/dist/cache/index.d.mts +9 -9
  18. package/dist/cache/index.mjs +4 -4
  19. package/dist/{caching-Cc2M1DwO.mjs → caching-Drp68DIS.mjs} +2 -2
  20. package/dist/{claimed-B10RTfkM.mjs → claimed-DYvQoZLv.mjs} +1 -1
  21. package/dist/cleanup/index.d.mts +14 -14
  22. package/dist/cleanup/index.mjs +4 -4
  23. package/dist/cli/commands/describe.d.mts +5 -5
  24. package/dist/cli/commands/describe.mjs +3 -3
  25. package/dist/cli/commands/docs.d.mts +2 -3
  26. package/dist/cli/commands/docs.mjs +3 -3
  27. package/dist/cli/commands/doctor.d.mts +2 -3
  28. package/dist/cli/commands/doctor.mjs +1 -1
  29. package/dist/cli/commands/generate.mjs +2 -3
  30. package/dist/cli/commands/init.mjs +2 -3
  31. package/dist/cli/commands/introspect.d.mts +2 -3
  32. package/dist/cli/commands/introspect.mjs +2 -2
  33. package/dist/cli/index.mjs +3 -3
  34. package/dist/{constants-Cu7Mx7_U.mjs → constants-B2QHb6u6.mjs} +1 -1
  35. package/dist/context/index.d.mts +9 -9
  36. package/dist/context/index.mjs +5 -5
  37. package/dist/core/index.d.mts +3 -3
  38. package/dist/core/index.mjs +8 -8
  39. package/dist/{core-Cb0LjccA.mjs → core-COcqo0Cp.mjs} +13 -4
  40. package/dist/{createActionRouter-xjqonMRO.mjs → createActionRouter-zG13rpPJ.mjs} +18 -8
  41. package/dist/{createAggregationRouter-zRYWw_5D.mjs → createAggregationRouter-CWRz96Vr.mjs} +7 -7
  42. package/dist/{createApp-D-953ZAq.mjs → createApp-BGLYtErt.mjs} +34 -32
  43. package/dist/{createMcpServer-C9cxS8zt.d.mts → createMcpServer-DSztofa9.d.mts} +1 -1
  44. package/dist/{defineAggregation-Bm8RjMbq.mjs → defineAggregation--3xguLkk.mjs} +1 -1
  45. package/dist/{defineResource-DIC7JZGU.mjs → defineResource-gUp9ug66.mjs} +7 -7
  46. package/dist/discovery/index.d.mts +6 -7
  47. package/dist/discovery/index.mjs +1 -1
  48. package/dist/docs/index.d.mts +3 -3
  49. package/dist/docs/index.mjs +3 -3
  50. package/dist/{elevation-DG8SrLN-.mjs → elevation-BG4gnMsJ.mjs} +5 -5
  51. package/dist/encryption/index.d.mts +5 -5
  52. package/dist/encryption/index.mjs +3 -3
  53. package/dist/{errorHandler-BnfDviL1.mjs → errorHandler-COHw3N1b.mjs} +3 -3
  54. package/dist/{errors-CtrywMHP.mjs → errors-CW4anJBy.mjs} +1 -1
  55. package/dist/{eventPlugin-Q6BhzHzs.mjs → eventPlugin-BweHAVws.mjs} +8 -8
  56. package/dist/{eventTypes-Cdhm6ZlV.mjs → eventTypes-N4-omQFR.mjs} +2 -2
  57. package/dist/events/index.d.mts +14 -14
  58. package/dist/events/index.mjs +7 -7
  59. package/dist/events/transports/redis-stream-entry.mjs +4 -4
  60. package/dist/events/transports/redis.d.mts +4 -5
  61. package/dist/events/transports/redis.mjs +2 -2
  62. package/dist/factory/index.d.mts +16 -16
  63. package/dist/factory/index.mjs +6 -6
  64. package/dist/{fastify-augmentation-DhUJ-mvo.d.mts → fastify-augmentation-DRlCIWE9.d.mts} +2 -2
  65. package/dist/{fields-ToPYpMqS.mjs → fields-A5crhsJb.mjs} +1 -1
  66. package/dist/{filter-merge-IpGywvym.mjs → filter-merge-DGM-GQ1J.mjs} +1 -1
  67. package/dist/{generate-DRTkLlIl.mjs → generate-BXKo2Gc8.mjs} +2 -2
  68. package/dist/{headers-BbkIF6vA.mjs → headers-DKZQKL-Z.mjs} +2 -2
  69. package/dist/{health-D-Ft6JM6.mjs → health-BYAwA6YS.mjs} +1 -1
  70. package/dist/{health-DqbsG-_w.mjs → health-CrqUp3sz.mjs} +1 -1
  71. package/dist/hooks/index.d.mts +1 -1
  72. package/dist/hooks/index.mjs +2 -3
  73. package/dist/idempotency/index.d.mts +8 -6
  74. package/dist/idempotency/index.mjs +108 -46
  75. package/dist/idempotency/redis.d.mts +1 -1
  76. package/dist/idempotency/redis.mjs +30 -2
  77. package/dist/{index-CRoPtISf.d.mts → index-Beg3aNnK.d.mts} +3 -31
  78. package/dist/{index-C8zVGYsk.d.mts → index-BkV55WlV.d.mts} +3 -3
  79. package/dist/{index-JdbZAIsm.d.mts → index-CUJvoyw3.d.mts} +1 -1
  80. package/dist/{index-mqaqZNpe.d.mts → index-WH7xgvxS.d.mts} +52 -1
  81. package/dist/index.d.mts +5 -5
  82. package/dist/index.mjs +11 -11
  83. package/dist/{init-B_oUYDXI.mjs → init-BPzK5Lnr.mjs} +1 -1
  84. package/dist/integrations/event-gateway.d.mts +3 -4
  85. package/dist/integrations/event-gateway.mjs +2 -2
  86. package/dist/integrations/index.d.mts +1 -1
  87. package/dist/integrations/index.mjs +1 -1
  88. package/dist/integrations/jobs/index.mjs +3 -3
  89. package/dist/integrations/mcp/index.d.mts +36 -36
  90. package/dist/integrations/mcp/index.mjs +2 -2
  91. package/dist/integrations/mcp/testing.d.mts +8 -9
  92. package/dist/integrations/mcp/testing.mjs +2 -2
  93. package/dist/integrations/streamline.d.mts +12 -13
  94. package/dist/integrations/streamline.mjs +18 -4
  95. package/dist/integrations/webhooks.d.mts +23 -23
  96. package/dist/integrations/webhooks.mjs +3 -3
  97. package/dist/integrations/websocket-pushref-redis.d.mts +4 -5
  98. package/dist/integrations/websocket-pushref-redis.mjs +1 -1
  99. package/dist/integrations/websocket-redis.d.mts +4 -5
  100. package/dist/integrations/websocket-redis.mjs +1 -1
  101. package/dist/integrations/websocket.mjs +2 -2
  102. package/dist/{interface-C0395yUN.d.mts → interface-JJzwH4Ro.d.mts} +22 -2
  103. package/dist/{jsonBody-B4YVGcql.mjs → jsonBody-YIq-vGLv.mjs} +2 -2
  104. package/dist/{keys-B2KtgMLJ.mjs → keys-CpoiZ8hU.mjs} +1 -1
  105. package/dist/{loadResources-Dn4lalw2.mjs → loadResources-6jO52-RR.mjs} +3 -3
  106. package/dist/{loadResourcesFromEntry-3sLYbuse.mjs → loadResourcesFromEntry-MP8xEppu.mjs} +2 -2
  107. package/dist/logger/index.d.mts +9 -10
  108. package/dist/logger/index.mjs +2 -3
  109. package/dist/{logger-DXjfIqjV.mjs → logger-D4V1zGLI.mjs} +1 -1
  110. package/dist/{mcpPlugin-C08HalN5.mjs → mcpPlugin-srPc7ItN.mjs} +42 -29
  111. package/dist/{memory-9Cp7611C.mjs → memory-CTa5pOCW.mjs} +3 -3
  112. package/dist/{metrics-CWI11eRu.mjs → metrics-DsZrvnpB.mjs} +3 -3
  113. package/dist/middleware/index.d.mts +5 -5
  114. package/dist/middleware/index.mjs +3 -3
  115. package/dist/migrations/index.d.mts +13 -13
  116. package/dist/migrations/index.mjs +2 -2
  117. package/dist/{module-BSvOQC7E.mjs → module--L0iBIZz.mjs} +1 -1
  118. package/dist/mongodb-memory-server-CHhYSq5y.mjs +35539 -0
  119. package/dist/mongoose-CYJCLyi-.mjs +67451 -0
  120. package/dist/{multiTenant-cY0FkDiA.d.mts → multiTenant-CAtYlW6H.d.mts} +1 -1
  121. package/dist/{multipartBody-CXM2a-Dy.mjs → multipartBody-Cc7eZ9cq.mjs} +1 -1
  122. package/dist/node-D8UZv_8c.mjs +41236 -0
  123. package/dist/{openapi-DT_G4VhY.mjs → openapi-CMegfsm8.mjs} +6 -6
  124. package/dist/outbox-admin/index.d.mts +2 -2
  125. package/dist/outbox-admin/index.mjs +5 -5
  126. package/dist/{outbox-module-Bjgzl6tg.mjs → outbox-module-Ryk270jd.mjs} +9 -9
  127. package/dist/permissions/index.mjs +7 -7
  128. package/dist/{permissions-Cm0uYHvd.mjs → permissions-C5ijIz5Q.mjs} +9 -9
  129. package/dist/{pipe-BqeGT6UO.mjs → pipe-D81zMtWs.mjs} +2 -2
  130. package/dist/pipeline/index.d.mts +7 -7
  131. package/dist/pipeline/index.mjs +2 -2
  132. package/dist/{plan-FVR6LP59.mjs → plan-CJGMKoui.mjs} +1 -1
  133. package/dist/{plugin-BccET1tL.mjs → plugin-DALd9dcF.mjs} +39 -27
  134. package/dist/plugins/index.d.mts +7 -7
  135. package/dist/plugins/index.mjs +17 -17
  136. package/dist/plugins/response-cache.d.mts +5 -6
  137. package/dist/plugins/response-cache.mjs +4 -4
  138. package/dist/plugins/tracing-entry.mjs +2 -2
  139. package/dist/{pluralize-CVIOcgMF.mjs → pluralize-COUNYo3d.mjs} +1 -1
  140. package/dist/presets/filesUpload.d.mts +7 -7
  141. package/dist/presets/filesUpload.mjs +5 -5
  142. package/dist/presets/index.d.mts +14 -14
  143. package/dist/presets/index.mjs +2 -2
  144. package/dist/presets/multiTenant.d.mts +1 -1
  145. package/dist/presets/multiTenant.mjs +5 -5
  146. package/dist/presets/search.d.mts +8 -9
  147. package/dist/presets/search.mjs +2 -2
  148. package/dist/{presets-Cpvj6fGO.mjs → presets-CONf2Qem.mjs} +4 -4
  149. package/dist/{projection-Ce4aQhQk.mjs → projection-wFoLqdss.mjs} +2 -2
  150. package/dist/{queryCachePlugin-CFWNH8aT.mjs → queryCachePlugin-BATECpyh.mjs} +6 -6
  151. package/dist/{rateLimitKey-C4O-kPm0.mjs → rateLimitKey-DVEZ_UpV.mjs} +1 -1
  152. package/dist/{realtime-DmPE9S54.mjs → realtime-xyubMKSB.mjs} +11 -11
  153. package/dist/{redis-vLvtcGy_.d.mts → redis-BDgv9Glw.d.mts} +5 -1
  154. package/dist/registry/index.d.mts +9 -9
  155. package/dist/registry/index.mjs +3 -3
  156. package/dist/{registry-Bcz9G1bh.mjs → registry-Bdzg-hdm.mjs} +5 -4
  157. package/dist/{renewingLease-qODa7KJQ.mjs → renewingLease-BFJxGPuh.mjs} +1 -1
  158. package/dist/{replyHelpers-CG_VtVgS.mjs → replyHelpers-Bnc6lJyy.mjs} +2 -2
  159. package/dist/{requestContext-Dsu9P1bV.mjs → requestContext-C10UeFe5.mjs} +1 -1
  160. package/dist/{requirement-KDdoRcOP.mjs → requirement-Bu50QALH.mjs} +1 -1
  161. package/dist/{resourceRateLimit-dSjVr1pk.mjs → resourceRateLimit-urWPJxrt.mjs} +2 -2
  162. package/dist/rolldown-runtime-MYrLNGnq.mjs +45 -0
  163. package/dist/{routeValidator-D36SW8qt.mjs → routeValidator-DHtpzrzk.mjs} +1 -1
  164. package/dist/{runtimeCapabilities-0tccjRlj.mjs → runtimeCapabilities-DIMKMV2G.mjs} +1 -1
  165. package/dist/{schedules-C-OpmHBq.mjs → schedules-CKTs5ys8.mjs} +5 -5
  166. package/dist/{schemaConverter-BORek3O-.mjs → schemaConverter-BVjkQ5DD.mjs} +2 -2
  167. package/dist/{schemaIR-C7Vbp71I.mjs → schemaIR-BA0Hb21Y.mjs} +2 -2
  168. package/dist/schemas/index.d.mts +10 -10
  169. package/dist/schemas/index.mjs +1 -1
  170. package/dist/scim/index.d.mts +13 -13
  171. package/dist/scim/index.mjs +2 -2
  172. package/dist/scope/index.d.mts +3 -3
  173. package/dist/scope/index.mjs +5 -5
  174. package/dist/{scope-DQthe88b.mjs → scope-DINaj7Ax.mjs} +4 -4
  175. package/dist/{shutdown-MqA81z_P.mjs → shutdown-LpLMH8T1.mjs} +1 -1
  176. package/dist/{simpleEqualityMatcher-auW8QjXN.mjs → simpleEqualityMatcher-DbwIM1f1.mjs} +1 -1
  177. package/dist/{sse-CYzQBVFe.mjs → sse-BzJFPX_1.mjs} +7 -7
  178. package/dist/{sseStream-B5_Afiqn.mjs → sseStream-DQChzGTs.mjs} +2 -2
  179. package/dist/{store-helpers-BOzk-CuX.mjs → store-helpers-Coj9RhOZ.mjs} +1 -1
  180. package/dist/{streaming-DjTQhZrN.mjs → streaming-JzB5CAga.mjs} +1 -1
  181. package/dist/{subscriberIdentity-CW39uA8G.mjs → subscriberIdentity-DeyppIif.mjs} +1 -1
  182. package/dist/{tenancy--ed9eH_z.mjs → tenancy-DxV8OuX2.mjs} +2 -2
  183. package/dist/{tenantPreparation-BKon6Yox.mjs → tenantPreparation-CBvvAcAj.mjs} +4 -4
  184. package/dist/testing/cleanupStoreContract.d.mts +4 -5
  185. package/dist/testing/cleanupStoreContract.mjs +1 -1
  186. package/dist/testing/index.d.mts +35 -35
  187. package/dist/testing/index.mjs +16 -15
  188. package/dist/testing/outboxStoreContract.d.mts +4 -5
  189. package/dist/testing/outboxStoreContract.mjs +2 -2
  190. package/dist/testing/requiredPorts.d.mts +4 -5
  191. package/dist/testing/requiredPorts.mjs +2 -2
  192. package/dist/testing/storageContract.d.mts +4 -5
  193. package/dist/testing/storageContract.mjs +1 -1
  194. package/dist/{timing-qczZ0YC-.mjs → timing-CntavTlR.mjs} +1 -1
  195. package/dist/{transactionContext-DjFkrNG6.mjs → transactionContext-orvnGu4F.mjs} +1 -1
  196. package/dist/{typeGuards-CySF12G-.mjs → typeGuards-kEaP_WmO.mjs} +1 -1
  197. package/dist/types/index.d.mts +1 -1
  198. package/dist/types/index.mjs +1 -1
  199. package/dist/types/storage.mjs +1 -1
  200. package/dist/{types-B4Aq4Sdj.d.mts → types-D3Ixsh00.d.mts} +1 -1
  201. package/dist/{types-Bk9NOgOC.mjs → types-fvO6Ovzx.mjs} +4 -4
  202. package/dist/usage/index.d.mts +4 -4
  203. package/dist/usage/index.mjs +4 -4
  204. package/dist/{userHelpers-aklawRaK.mjs → userHelpers-C76zD5pa.mjs} +1 -1
  205. package/dist/utils/index.d.mts +47 -47
  206. package/dist/utils/index.mjs +12 -12
  207. package/dist/{utils-ec1oTo1n.mjs → utils-BpkVZ8rB.mjs} +4 -4
  208. package/dist/{validate-9yzHC1e2.mjs → validate-CWp-lsrm.mjs} +3 -3
  209. package/dist/{versioning-fhhWHV74.mjs → versioning-CHhL9P3o.mjs} +3 -3
  210. package/dist/{workScope-zpPyge4t.mjs → workScope-n9a7d_lZ.mjs} +2 -2
  211. package/package.json +45 -51
  212. package/dist/rolldown-runtime-D1w9Y1VJ.mjs +0 -15
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
2
  //#region src/integrations/websocket-pushref-redis.ts
3
3
  /**
4
4
  * Lua script for atomic claim. Runs server-side, single-roundtrip.
@@ -1,14 +1,14 @@
1
1
 
2
2
  import { f as WebSocketAdapter } from "../websocket-Cs4awVyD.mjs";
3
3
  //#region src/integrations/websocket-redis.d.ts
4
- interface RedisLike {
4
+ export interface RedisLike {
5
5
  publish(channel: string, message: string): Promise<number>;
6
6
  subscribe(...channels: string[]): Promise<unknown>;
7
7
  on(event: string, handler: (...args: unknown[]) => void): unknown;
8
8
  duplicate(): RedisLike;
9
9
  quit(): Promise<unknown>;
10
10
  }
11
- interface RedisWebSocketAdapterOptions {
11
+ export interface RedisWebSocketAdapterOptions {
12
12
  /**
13
13
  * Redis channel for WebSocket broadcasts.
14
14
  * @default 'arc-ws'
@@ -31,7 +31,7 @@ interface RedisWebSocketAdapterOptions {
31
31
  * 5. Each instance checks instanceId — skips if it's own message (prevents double delivery)
32
32
  * 6. Other instances call RoomManager.broadcast() to deliver to their local clients
33
33
  */
34
- declare class RedisWebSocketAdapter implements WebSocketAdapter {
34
+ export declare class RedisWebSocketAdapter implements WebSocketAdapter {
35
35
  readonly name = "redis";
36
36
  private pub;
37
37
  private sub;
@@ -42,5 +42,4 @@ declare class RedisWebSocketAdapter implements WebSocketAdapter {
42
42
  subscribe(callback: (room: string, message: string) => void): Promise<void>;
43
43
  close(): Promise<void>;
44
44
  }
45
- //#endregion
46
- export { RedisLike, RedisWebSocketAdapter, RedisWebSocketAdapterOptions };
45
+ //#endregion
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
2
  //#region src/integrations/websocket-redis.ts
3
3
  /**
4
4
  * Redis Pub/Sub adapter for cross-instance WebSocket broadcast.
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
2
- import { n as declareRuntimeCapability } from "../runtimeCapabilities-0tccjRlj.mjs";
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
+ import { n as declareRuntimeCapability } from "../runtimeCapabilities-DIMKMV2G.mjs";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import sjson from "secure-json-parse";
5
5
  import fp from "fastify-plugin";
@@ -38,11 +38,28 @@ interface IdempotencyLock {
38
38
  /** When the lock expires (auto-release) */
39
39
  expiresAt: Date;
40
40
  }
41
+ /** What one atomic {@link IdempotencyStore.acquire} found. */
42
+ type IdempotencyAcquisition = {
43
+ readonly status: "acquired";
44
+ } | {
45
+ readonly status: "completed";
46
+ readonly result: IdempotencyResult;
47
+ } | {
48
+ readonly status: "locked";
49
+ };
41
50
  interface IdempotencyStore {
42
51
  /** Store name for logging */
43
52
  readonly name: string;
44
53
  /** false when a conditional completion method cannot be atomic with this backing client. */
45
54
  readonly supportsFencedCompletion?: boolean;
55
+ /** true when `setIfLocked` also releases the lock, so a completed request needs no `unlock`. */
56
+ readonly completionReleasesLock?: boolean;
57
+ /**
58
+ * ONE atomic step: an unexpired completion → `completed`; an unexpired lock → `locked`;
59
+ * otherwise `requestId` now holds the lock (first use, expired lease, or expired result).
60
+ * Optional — without it callers run `get` → `tryLock` → `get`.
61
+ */
62
+ acquire?(key: string, requestId: string, lockTtlMs: number): Promise<IdempotencyAcquisition>;
46
63
  /**
47
64
  * Get a cached result for an idempotency key.
48
65
  * Returns undefined if not found or expired.
@@ -53,7 +70,10 @@ interface IdempotencyStore {
53
70
  * TTL is handled by the store implementation.
54
71
  */
55
72
  set(key: string, result: Omit<IdempotencyResult, "key">): Promise<void>;
56
- /** Atomically record only while requestId owns an unexpired lock. false means ownership lost. */
73
+ /**
74
+ * Atomically record only while requestId owns an unexpired lock. false means ownership lost.
75
+ * A store declaring `completionReleasesLock` clears the lock in the same write.
76
+ */
57
77
  setIfLocked?(key: string, requestId: string, result: Omit<IdempotencyResult, "key">): Promise<boolean>;
58
78
  /**
59
79
  * Try to acquire a lock for processing a key.
@@ -87,4 +107,4 @@ interface IdempotencyStore {
87
107
  */
88
108
  declare function createIdempotencyResult(statusCode: number, body: unknown, headers: Record<string, string>, ttlMs: number, requestFingerprint?: string): Omit<IdempotencyResult, "key">;
89
109
  //#endregion
90
- export { createIdempotencyResult as i, IdempotencyResult as n, IdempotencyStore as r, IdempotencyLock as t };
110
+ export { createIdempotencyResult as a, IdempotencyStore as i, IdempotencyLock as n, IdempotencyResult as r, IdempotencyAcquisition as t };
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
2
- import { t as ArcError } from "./errors-CtrywMHP.mjs";
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
+ import { t as ArcError } from "./errors-CW4anJBy.mjs";
3
3
  import sjson from "secure-json-parse";
4
4
  //#region src/utils/jsonBody.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
2
  import { contentHash } from "@classytic/repo-core/hash";
3
3
  //#region src/cache/keys.ts
4
4
  /**
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-D1w9Y1VJ.mjs";
3
- import { t as arcLog } from "./logger-DXjfIqjV.mjs";
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
+ import { r as __exportAll } from "./rolldown-runtime-MYrLNGnq.mjs";
3
+ import { t as arcLog } from "./logger-D4V1zGLI.mjs";
4
4
  import { readdir } from "node:fs/promises";
5
5
  import { dirname, join, resolve } from "node:path";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
2
- import { t as ResourceRegistry } from "./ResourceRegistry-CuCARu2B.mjs";
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
+ import { t as ResourceRegistry } from "./ResourceRegistry-DJxHUpE4.mjs";
3
3
  import { resolve } from "node:path";
4
4
  import { pathToFileURL } from "node:url";
5
5
  //#region src/cli/utils/loadResourcesFromEntry.ts
@@ -27,7 +27,7 @@
27
27
  * log.warn('Something unexpected');
28
28
  * ```
29
29
  */
30
- interface ArcLoggerOptions {
30
+ export interface ArcLoggerOptions {
31
31
  /**
32
32
  * Enable debug output.
33
33
  * - `true` or `'*'` — all modules
@@ -41,13 +41,13 @@ interface ArcLoggerOptions {
41
41
  */
42
42
  writer?: ArcLogWriter;
43
43
  }
44
- interface ArcLogWriter {
44
+ export interface ArcLogWriter {
45
45
  debug: (...args: unknown[]) => void;
46
46
  info: (...args: unknown[]) => void;
47
47
  warn: (...args: unknown[]) => void;
48
48
  error: (...args: unknown[]) => void;
49
49
  }
50
- interface ArcLogger {
50
+ export interface ArcLogger {
51
51
  debug: (...args: unknown[]) => void;
52
52
  info: (...args: unknown[]) => void;
53
53
  warn: (...args: unknown[]) => void;
@@ -61,7 +61,7 @@ interface ArcLogger {
61
61
  * constructed. Copying here would freeze the pre-Fastify view and send every
62
62
  * post-construction boot warning to the console instead of the app's logger.
63
63
  */
64
- declare function runWithArcLogger<T>(options: ArcLoggerOptions, fn: () => T): T;
64
+ export declare function runWithArcLogger<T>(options: ArcLoggerOptions, fn: () => T): T;
65
65
  /**
66
66
  * Configure the PROCESS-GLOBAL Arc logger — the fallback used outside any app.
67
67
  *
@@ -71,7 +71,7 @@ declare function runWithArcLogger<T>(options: ArcLoggerOptions, fn: () => T): T;
71
71
  * standalone use — `defineResource()` at module import, CLI commands, and any
72
72
  * code running before or outside a `createApp` boot.
73
73
  */
74
- declare function configureArcLogger(options: ArcLoggerOptions): void;
74
+ export declare function configureArcLogger(options: ArcLoggerOptions): void;
75
75
  /**
76
76
  * Create a module-scoped logger.
77
77
  *
@@ -89,13 +89,13 @@ declare function configureArcLogger(options: ArcLoggerOptions): void;
89
89
  * log.warn('No authenticate decorator found');
90
90
  * ```
91
91
  */
92
- declare function arcLog(module: string): ArcLogger;
92
+ export declare function arcLog(module: string): ArcLogger;
93
93
  /**
94
94
  * Minimal structural slice of a pino-style logger (`fastify.log`). Each
95
95
  * level accepts `(msg)` or `(mergeObject, msg)` — the pino calling
96
96
  * convention, which differs from console's variadic `(...args)`.
97
97
  */
98
- interface PinoLike {
98
+ export interface PinoLike {
99
99
  debug: (obj: unknown, msg?: string) => void;
100
100
  info: (obj: unknown, msg?: string) => void;
101
101
  warn: (obj: unknown, msg?: string) => void;
@@ -114,6 +114,5 @@ interface PinoLike {
114
114
  * `createApp` installs this automatically so arc-internal warnings flow
115
115
  * through the host's transports, level, and redaction config.
116
116
  */
117
- declare function createPinoWriter(logger: PinoLike): ArcLogWriter;
118
- //#endregion
119
- export { ArcLogWriter, ArcLogger, ArcLoggerOptions, PinoLike, arcLog, configureArcLogger, createPinoWriter, runWithArcLogger };
117
+ export declare function createPinoWriter(logger: PinoLike): ArcLogWriter;
118
+ //#endregion
@@ -1,3 +1,2 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
2
- import { i as runWithArcLogger, n as configureArcLogger, r as createPinoWriter, t as arcLog } from "../logger-DXjfIqjV.mjs";
3
- export { arcLog, configureArcLogger, createPinoWriter, runWithArcLogger };
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
+ export { t as arcLog, n as configureArcLogger, r as createPinoWriter, i as runWithArcLogger } from "../logger-D4V1zGLI.mjs";
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  //#region src/logger/scope.ts
4
4
  /**
@@ -1,24 +1,25 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
2
- import { t as arcLog } from "./logger-DXjfIqjV.mjs";
3
- import { i as NotFoundError, p as isArcError, t as ArcError } from "./errors-CtrywMHP.mjs";
4
- import { c as BaseController, n as normalizeActionsToRouterConfig, r as resolveActionTargetFence } from "./plugin-BccET1tL.mjs";
5
- import { n as requireSingleHeaderValue } from "./headers-BbkIF6vA.mjs";
6
- import { b as isElevated, c as getOrgId, g as getUserId, x as isMember } from "./types-Bk9NOgOC.mjs";
7
- import { a as resolveEffectiveRoles, t as applyFieldReadPermissions } from "./fields-ToPYpMqS.mjs";
8
- import { o as toJsonSchema } from "./schemaConverter-BORek3O-.mjs";
9
- import { t as buildRequestScopeProjection } from "./projection-Ce4aQhQk.mjs";
10
- import { l as resolvePipelineSteps, t as resolveActionPermission } from "./actionPermissions-BotX1YOa.mjs";
11
- import { a as withoutTenantInjection, r as prepareTenantContext } from "./tenantPreparation-BKon6Yox.mjs";
12
- import { r as evaluatePermissionDecision } from "./authorizationDecision-DQYrkl5f.mjs";
13
- import { n as declareRuntimeCapability } from "./runtimeCapabilities-0tccjRlj.mjs";
14
- import { t as executePipeline } from "./pipe-BqeGT6UO.mjs";
15
- import { a as resourceRateLimitWindowMs, i as resolveResourceRateLimiter, t as createMemoryResourceRateLimiter } from "./resourceRateLimit-dSjVr1pk.mjs";
16
- import { n as evictToSize, r as touch, t as assertCapacity } from "./boundedMap-BULzfXYU.mjs";
17
- import { t as pluralize } from "./pluralize-CVIOcgMF.mjs";
18
- import { n as createIdempotencyResult, r as operationIdentity, t as resolveIdempotencyTiming } from "./timing-qczZ0YC-.mjs";
19
- import { r as shouldRejectAdditionalProperties, t as normalizeSchemaIR } from "./schemaIR-C7Vbp71I.mjs";
20
- import { n as validateAggregations } from "./validate-9yzHC1e2.mjs";
21
- import { n as executeAggregation } from "./buildHandler-CRQ8EcX5.mjs";
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
+ import { t as arcLog } from "./logger-D4V1zGLI.mjs";
3
+ import { i as NotFoundError, p as isArcError, t as ArcError } from "./errors-CW4anJBy.mjs";
4
+ import { c as BaseController, n as normalizeActionsToRouterConfig, r as resolveActionTargetFence } from "./plugin-DALd9dcF.mjs";
5
+ import { n as requireSingleHeaderValue } from "./headers-DKZQKL-Z.mjs";
6
+ import { b as isElevated, c as getOrgId, g as getUserId, x as isMember } from "./types-fvO6Ovzx.mjs";
7
+ import { a as resolveEffectiveRoles, t as applyFieldReadPermissions } from "./fields-A5crhsJb.mjs";
8
+ import { o as toJsonSchema } from "./schemaConverter-BVjkQ5DD.mjs";
9
+ import { t as buildRequestScopeProjection } from "./projection-wFoLqdss.mjs";
10
+ import { l as resolvePipelineSteps, t as resolveActionPermission } from "./actionPermissions-5N04zBL4.mjs";
11
+ import { a as withoutTenantInjection, r as prepareTenantContext } from "./tenantPreparation-CBvvAcAj.mjs";
12
+ import { r as evaluatePermissionDecision } from "./authorizationDecision-wX3SA9w_.mjs";
13
+ import { n as declareRuntimeCapability } from "./runtimeCapabilities-DIMKMV2G.mjs";
14
+ import { t as executePipeline } from "./pipe-D81zMtWs.mjs";
15
+ import { a as resourceRateLimitWindowMs, i as resolveResourceRateLimiter, t as createMemoryResourceRateLimiter } from "./resourceRateLimit-urWPJxrt.mjs";
16
+ import { n as evictToSize, r as touch, t as assertCapacity } from "./boundedMap-DWiKW7lP.mjs";
17
+ import { t as pluralize } from "./pluralize-COUNYo3d.mjs";
18
+ import { n as createIdempotencyResult, r as operationIdentity, t as resolveIdempotencyTiming } from "./timing-CntavTlR.mjs";
19
+ import { n as acquireIdempotencyKey, r as releaseIdempotencyLock } from "./acquire-BozJ-9yt.mjs";
20
+ import { r as shouldRejectAdditionalProperties, t as normalizeSchemaIR } from "./schemaIR-BA0Hb21Y.mjs";
21
+ import { n as validateAggregations } from "./validate-CWp-lsrm.mjs";
22
+ import { n as executeAggregation } from "./buildHandler-Bswu_vNb.mjs";
22
23
  import { ARC_ERROR_CODES, isHttpError, toErrorContract } from "@classytic/repo-core/errors";
23
24
  import { createHash, randomUUID } from "node:crypto";
24
25
  import fp from "fastify-plugin";
@@ -635,17 +636,16 @@ async function runIdempotentTool(args) {
635
636
  return cached.body;
636
637
  }
637
638
  };
638
- const cachedResult = replay(await store.get(fullKey));
639
- if (cachedResult) return cachedResult;
640
639
  const lockId = randomUUID();
641
- if (!await store.tryLock(fullKey, lockId, lockTimeoutMs)) return toCallToolError({
640
+ const acquisition = await acquireIdempotencyKey(store, fullKey, lockId, lockTimeoutMs);
641
+ if (acquisition.status === "completed") return replay(acquisition.result);
642
+ if (acquisition.status === "locked") return toCallToolError({
642
643
  code: ARC_ERROR_CODES.IDEMPOTENCY_CONFLICT,
643
644
  message: "A call with this idempotency key is already in progress",
644
645
  status: 409
645
646
  });
647
+ let fencedCompletion = false;
646
648
  try {
647
- const completed = replay(await store.get(fullKey));
648
- if (completed) return completed;
649
649
  const result = JSON.parse(JSON.stringify(await dispatch()));
650
650
  if (!result.isError) {
651
651
  const completion = createIdempotencyResult(200, result, {}, ttlMs, fingerprint);
@@ -655,11 +655,12 @@ async function runIdempotentTool(args) {
655
655
  message: "The idempotency completion lease was lost; success could not be recorded",
656
656
  status: 409
657
657
  });
658
+ fencedCompletion = true;
658
659
  } else await store.set(fullKey, completion);
659
660
  }
660
661
  return result;
661
662
  } finally {
662
- await store.unlock(fullKey, lockId);
663
+ await releaseIdempotencyLock(store, fullKey, lockId, fencedCompletion);
663
664
  }
664
665
  }
665
666
  /** The 400 a keyless call to a key-required route gets over HTTP. */
@@ -1377,11 +1378,23 @@ function createActionToolHandler(actionName, handler, permissions, resourceName,
1377
1378
  }, session, "action", permResult?.policy, permResult?.scope, contextExtras);
1378
1379
  const id = idLess ? "" : typeof input.id === "string" ? input.id : "";
1379
1380
  const { id: _discardId, ...data } = input;
1380
- if (!idLess && parity?.fence && !await parity.fence(id, reqCtx)) throw new NotFoundError(resourceName);
1381
+ let target;
1382
+ if (!idLess && parity?.fence) {
1383
+ const check = await parity.fence(id, reqCtx);
1384
+ if (!check.visible) throw new NotFoundError(resourceName);
1385
+ target = check.doc;
1386
+ }
1381
1387
  if (parity?.allow && !await parity.allow(session, reqCtx.metadata._scope)) return rateLimitedResult(toolName);
1382
1388
  const run = async () => {
1383
- const req = idempotencyKey === void 0 ? reqCtx : {
1389
+ const withTarget = target === void 0 ? reqCtx : {
1384
1390
  ...reqCtx,
1391
+ arc: {
1392
+ ...reqCtx.arc,
1393
+ actionTarget: target
1394
+ }
1395
+ };
1396
+ const req = idempotencyKey === void 0 ? withTarget : {
1397
+ ...withTarget,
1385
1398
  idempotencyKey
1386
1399
  };
1387
1400
  const result = await handler(id, data, req);
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-D1w9Y1VJ.mjs";
3
- import { n as evictToSize } from "./boundedMap-BULzfXYU.mjs";
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
+ import { r as __exportAll } from "./rolldown-runtime-MYrLNGnq.mjs";
3
+ import { n as evictToSize } from "./boundedMap-DWiKW7lP.mjs";
4
4
  //#region src/cache/memory.ts
5
5
  var memory_exports = /* @__PURE__ */ __exportAll({ MemoryCacheStore: () => MemoryCacheStore });
6
6
  /**
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-D1w9Y1VJ.mjs";
3
- import { a as MetricHistogram, i as DURATION_BUCKETS_SECONDS, o as MetricSeries, s as renderMetricSample } from "./health-DqbsG-_w.mjs";
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
+ import { r as __exportAll } from "./rolldown-runtime-MYrLNGnq.mjs";
3
+ import { a as MetricHistogram, i as DURATION_BUCKETS_SECONDS, o as MetricSeries, s as renderMetricSample } from "./health-CrqUp3sz.mjs";
4
4
  import fp from "fastify-plugin";
5
5
  //#region src/plugins/metrics.ts
6
6
  var metrics_exports = /* @__PURE__ */ __exportAll({
@@ -1,5 +1,5 @@
1
1
 
2
- import { A as RequestWithExtras, J as MiddlewareConfig, k as MiddlewareHandler } from "../index-mqaqZNpe.mjs";
2
+ import { A as RequestWithExtras, J as MiddlewareConfig, k as MiddlewareHandler } from "../index-WH7xgvxS.mjs";
3
3
  import { RouteHandlerMethod } from "fastify";
4
4
  //#region src/middleware/middleware.d.ts
5
5
  interface NamedMiddleware {
@@ -23,12 +23,12 @@ interface MiddlewareOptions {
23
23
  /**
24
24
  * Create a named middleware with priority and conditions.
25
25
  */
26
- declare function middleware(name: string, options: MiddlewareOptions): NamedMiddleware;
26
+ export declare function middleware(name: string, options: MiddlewareOptions): NamedMiddleware;
27
27
  /**
28
28
  * Sort named middlewares by priority (ascending — lower runs first).
29
29
  * Returns a MiddlewareConfig map keyed by operation, ready to pass to `defineResource()`.
30
30
  */
31
- declare function sortMiddlewares(middlewares: NamedMiddleware[]): MiddlewareConfig;
31
+ export declare function sortMiddlewares(middlewares: NamedMiddleware[]): MiddlewareConfig;
32
32
  //#endregion
33
33
  //#region src/middleware/multipartBody.d.ts
34
34
  /** Parsed file from multipart form-data */
@@ -120,6 +120,6 @@ interface MultipartBodyOptions {
120
120
  * routes with strict rate limits — buffering video through the app tier is
121
121
  * the wrong architecture regardless of limits.
122
122
  */
123
- declare function multipartBody(options?: MultipartBodyOptions): RouteHandlerMethod;
123
+ export declare function multipartBody(options?: MultipartBodyOptions): RouteHandlerMethod;
124
124
  //#endregion
125
- export { type MiddlewareOptions, type MultipartBodyOptions, type NamedMiddleware, type ParsedFile, middleware, multipartBody, sortMiddlewares };
125
+ export type { MiddlewareOptions, MultipartBodyOptions, NamedMiddleware, ParsedFile };
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
2
- import { t as CRUD_OPERATIONS } from "../constants-Cu7Mx7_U.mjs";
3
- import { t as multipartBody } from "../multipartBody-CXM2a-Dy.mjs";
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
+ import { t as CRUD_OPERATIONS } from "../constants-B2QHb6u6.mjs";
3
+ import { t as multipartBody } from "../multipartBody-Cc7eZ9cq.mjs";
4
4
  //#region src/middleware/middleware.ts
5
5
  /**
6
6
  * Named Middleware — Priority-based, conditional middleware execution.
@@ -1,7 +1,7 @@
1
1
 
2
2
  import { LockAdapter } from "@classytic/repo-core/lock";
3
3
  //#region src/migrations/index.d.ts
4
- interface Migration {
4
+ export interface Migration {
5
5
  /** Migration version (sequential number) */
6
6
  version: number;
7
7
  /** Resource name this migration applies to */
@@ -22,7 +22,7 @@ interface Migration {
22
22
  */
23
23
  validate?: (db: unknown) => Promise<boolean>;
24
24
  }
25
- interface MigrationRecord {
25
+ export interface MigrationRecord {
26
26
  version: number;
27
27
  resource: string;
28
28
  description?: string;
@@ -43,7 +43,7 @@ interface MigrationRecord {
43
43
  * - PrismaMigrationStore (uses a `_migrations` table)
44
44
  * - or any custom store
45
45
  */
46
- interface MigrationStore {
46
+ export interface MigrationStore {
47
47
  /** Get all applied migration records, sorted by appliedAt ascending */
48
48
  getApplied(): Promise<MigrationRecord[]>;
49
49
  /**
@@ -60,7 +60,7 @@ interface MigrationStore {
60
60
  /**
61
61
  * Minimal logger interface — matches Fastify's logger, pino, console, etc.
62
62
  */
63
- interface MigrationLogger {
63
+ export interface MigrationLogger {
64
64
  info(msg: string): void;
65
65
  error(msg: string): void;
66
66
  }
@@ -93,7 +93,7 @@ interface MongoCollectionLike {
93
93
  interface MongoDbLike {
94
94
  collection(name: string): MongoCollectionLike;
95
95
  }
96
- declare class MongoMigrationStore implements MigrationStore {
96
+ export declare class MongoMigrationStore implements MigrationStore {
97
97
  private readonly collectionName;
98
98
  private readonly db;
99
99
  constructor(db: MongoDbLike, opts?: {
@@ -105,7 +105,7 @@ declare class MongoMigrationStore implements MigrationStore {
105
105
  }): Promise<void>;
106
106
  remove(migration: Migration): Promise<void>;
107
107
  }
108
- interface MigrationRunnerOptions {
108
+ export interface MigrationRunnerOptions {
109
109
  /** Migration store (required — use MongoMigrationStore or implement your own) */
110
110
  store: MigrationStore;
111
111
  /** Logger (defaults to process.stdout/stderr) */
@@ -144,11 +144,11 @@ interface MigrationRunnerOptions {
144
144
  * `up`/`down` source. Stable for a given build; a transpile-target change
145
145
  * can legitimately shift it (hence `checksumMismatch: 'warn'` default).
146
146
  */
147
- declare function computeMigrationChecksum(migration: Migration): string;
147
+ export declare function computeMigrationChecksum(migration: Migration): string;
148
148
  /**
149
149
  * Define a migration
150
150
  */
151
- declare function defineMigration(migration: Migration): Migration;
151
+ export declare function defineMigration(migration: Migration): Migration;
152
152
  /**
153
153
  * Migration Runner
154
154
  *
@@ -171,7 +171,7 @@ declare function defineMigration(migration: Migration): Migration;
171
171
  * await runner.up(migrations);
172
172
  * ```
173
173
  */
174
- declare class MigrationRunner {
174
+ export declare class MigrationRunner {
175
175
  private readonly db;
176
176
  private readonly store;
177
177
  private readonly log;
@@ -243,7 +243,7 @@ declare class MigrationRunner {
243
243
  /**
244
244
  * Schema version definition for resources
245
245
  */
246
- interface SchemaVersion {
246
+ export interface SchemaVersion {
247
247
  version: number;
248
248
  migrations: Migration[];
249
249
  }
@@ -258,11 +258,11 @@ interface SchemaVersion {
258
258
  * // ... rest of resource definition
259
259
  * });
260
260
  */
261
- declare function withSchemaVersion(version: number, migrations: Migration[]): SchemaVersion;
261
+ export declare function withSchemaVersion(version: number, migrations: Migration[]): SchemaVersion;
262
262
  /**
263
263
  * Global migration registry
264
264
  */
265
- declare class MigrationRegistry {
265
+ export declare class MigrationRegistry {
266
266
  private migrations;
267
267
  /**
268
268
  * Register a migration
@@ -290,4 +290,4 @@ declare class MigrationRegistry {
290
290
  clear(): void;
291
291
  }
292
292
  //#endregion
293
- export { Migration, MigrationLogger, MigrationRecord, MigrationRegistry, MigrationRunner, MigrationRunnerOptions, MigrationStore, MongoMigrationStore, SchemaVersion, computeMigrationChecksum, defineMigration, withSchemaVersion };
293
+ export {};
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
2
- import { t as startRenewingLease } from "../renewingLease-qODa7KJQ.mjs";
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
+ import { t as startRenewingLease } from "../renewingLease-BFJxGPuh.mjs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  //#region src/migrations/index.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
2
2
  //#region src/factory/module/index.ts
3
3
  /**
4
4
  * Identity helper for authoring a typed module — mirrors `defineResource`.