@classytic/arc 2.43.0 → 2.45.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 (214) hide show
  1. package/dist/{EventTransport-tzA7CAB4.mjs → EventTransport-Ci6hGO1Y.mjs} +2 -2
  2. package/dist/{HookSystem-B6UaKRbF.mjs → HookSystem-CtnnYHME.mjs} +2 -2
  3. package/dist/{ResourceRegistry-CuCARu2B.mjs → ResourceRegistry-BNoHOx-D.mjs} +2 -2
  4. package/dist/acquire-BW_2Dt60.mjs +35 -0
  5. package/dist/{actionPermissions-BotX1YOa.mjs → actionPermissions-TAc_6LCw.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 +14 -12
  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-BixzgirP.mjs} +4 -4
  15. package/dist/{boundedMap-BULzfXYU.mjs → boundedMap-DQfXgxMo.mjs} +1 -1
  16. package/dist/{buildHandler-CRQ8EcX5.mjs → buildHandler-mEUmO2_u.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-TQfW2QX7.mjs} +2 -2
  20. package/dist/{claimed-B10RTfkM.mjs → claimed-CnEEOHuL.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-B90SnSQn.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-DV9PSXtr.mjs} +13 -4
  40. package/dist/{createActionRouter-xjqonMRO.mjs → createActionRouter-BgPCYU2U.mjs} +18 -8
  41. package/dist/{createAggregationRouter-zRYWw_5D.mjs → createAggregationRouter-lNCkDwKe.mjs} +7 -7
  42. package/dist/{createApp-D-953ZAq.mjs → createApp-BSBPntOQ.mjs} +34 -32
  43. package/dist/{createMcpServer-C9cxS8zt.d.mts → createMcpServer-DSztofa9.d.mts} +1 -1
  44. package/dist/{defineAggregation-Bm8RjMbq.mjs → defineAggregation-CwD8_XNd.mjs} +1 -1
  45. package/dist/{defineResource-DIC7JZGU.mjs → defineResource-CRkhRRSj.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-BAfsnnO0.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-DbHGwrQM.mjs} +3 -3
  54. package/dist/{errors-CtrywMHP.mjs → errors-C9G4A8cN.mjs} +1 -1
  55. package/dist/{eventPlugin-Q6BhzHzs.mjs → eventPlugin-Dghr7iL5.mjs} +8 -8
  56. package/dist/{eventTypes-Cdhm6ZlV.mjs → eventTypes-DDy7BMAn.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-Da--1DNS.mjs} +1 -1
  66. package/dist/{filter-merge-IpGywvym.mjs → filter-merge-BYKBa9b2.mjs} +1 -1
  67. package/dist/{generate-DRTkLlIl.mjs → generate-Cm5Ct81v.mjs} +2 -2
  68. package/dist/{headers-BbkIF6vA.mjs → headers-B6DRXXzT.mjs} +2 -2
  69. package/dist/{health-D-Ft6JM6.mjs → health-hRGgxnOC.mjs} +1 -1
  70. package/dist/{health-DqbsG-_w.mjs → health-pLbfckGB.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-JdbZAIsm.d.mts → index-CUJvoyw3.d.mts} +1 -1
  79. package/dist/{index-mqaqZNpe.d.mts → index-WH7xgvxS.d.mts} +52 -1
  80. package/dist/{index-C8zVGYsk.d.mts → index-uhkUA5-U.d.mts} +4 -4
  81. package/dist/index.d.mts +5 -5
  82. package/dist/index.mjs +11 -11
  83. package/dist/{init-B_oUYDXI.mjs → init-lpaUB-Ph.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-CzKHE-Fg.mjs} +2 -2
  104. package/dist/{keys-B2KtgMLJ.mjs → keys-BoZKnBel.mjs} +1 -1
  105. package/dist/{loadResources-Dn4lalw2.mjs → loadResources-BEKG6bP9.mjs} +3 -3
  106. package/dist/{loadResourcesFromEntry-3sLYbuse.mjs → loadResourcesFromEntry-BEPA0ptL.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-vxu0DXf_.mjs} +1 -1
  110. package/dist/{mcpPlugin-C08HalN5.mjs → mcpPlugin-DP_UB0LK.mjs} +42 -29
  111. package/dist/{memory-9Cp7611C.mjs → memory-DJN6kyC8.mjs} +3 -3
  112. package/dist/{metrics-CWI11eRu.mjs → metrics-wfr7XFE7.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-BtdcGn_E.mjs} +1 -1
  118. package/dist/mongodb-memory-server-Cn57YIsc.mjs +35539 -0
  119. package/dist/mongoose-DzFjTtBN.mjs +67451 -0
  120. package/dist/{multiTenant-cY0FkDiA.d.mts → multiTenant-CAtYlW6H.d.mts} +1 -1
  121. package/dist/{multipartBody-CXM2a-Dy.mjs → multipartBody-NHGOuUnG.mjs} +1 -1
  122. package/dist/node-C0HB_V6E.mjs +41236 -0
  123. package/dist/{openapi-DT_G4VhY.mjs → openapi-BCOaGAgE.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-BVDiMwXb.mjs} +9 -9
  127. package/dist/permissions/index.mjs +7 -7
  128. package/dist/{permissions-Cm0uYHvd.mjs → permissions-IdHJ0_5V.mjs} +9 -9
  129. package/dist/{pipe-BqeGT6UO.mjs → pipe-BPJPifhi.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-CEedaMlr.mjs} +1 -1
  133. package/dist/{plugin-BccET1tL.mjs → plugin-BDBOS3-c.mjs} +39 -27
  134. package/dist/plugins/index.d.mts +8 -8
  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-B4FcZEyI.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-BPjNc-Np.mjs} +4 -4
  149. package/dist/{projection-Ce4aQhQk.mjs → projection-BXUOYosj.mjs} +2 -2
  150. package/dist/{queryCachePlugin-CFWNH8aT.mjs → queryCachePlugin-s4pBvjFF.mjs} +6 -6
  151. package/dist/{rateLimitKey-C4O-kPm0.mjs → rateLimitKey-C4mkCwQ-.mjs} +1 -1
  152. package/dist/{realtime-DmPE9S54.mjs → realtime-MPj6eIoV.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-DIdh6mWE.mjs} +5 -4
  157. package/dist/{renewingLease-qODa7KJQ.mjs → renewingLease-boGRXWCr.mjs} +1 -1
  158. package/dist/{replyHelpers-CG_VtVgS.mjs → replyHelpers-BW_p67QD.mjs} +2 -2
  159. package/dist/{requestContext-Dsu9P1bV.mjs → requestContext-B8JKbeb7.mjs} +1 -1
  160. package/dist/{requirement-KDdoRcOP.mjs → requirement-tXpcD56f.mjs} +1 -1
  161. package/dist/{resourceRateLimit-dSjVr1pk.mjs → resourceRateLimit-DWob9nQ8.mjs} +2 -2
  162. package/dist/rolldown-runtime-AD16t29l.mjs +45 -0
  163. package/dist/{routeValidator-D36SW8qt.mjs → routeValidator-CnmenC4Y.mjs} +1 -1
  164. package/dist/{runtimeCapabilities-0tccjRlj.mjs → runtimeCapabilities-C7gAbIxC.mjs} +1 -1
  165. package/dist/{schedules-C-OpmHBq.mjs → schedules-Dr9gNFzx.mjs} +5 -5
  166. package/dist/{schemaConverter-BORek3O-.mjs → schemaConverter-rzBovk00.mjs} +2 -2
  167. package/dist/{schemaIR-C7Vbp71I.mjs → schemaIR-GrOK1JO4.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-DpOpxyHT.mjs} +4 -4
  175. package/dist/{shutdown-MqA81z_P.mjs → shutdown-BW8qwgpx.mjs} +1 -1
  176. package/dist/{simpleEqualityMatcher-auW8QjXN.mjs → simpleEqualityMatcher-WdZw6GOt.mjs} +1 -1
  177. package/dist/sse-D8AgoUN3.mjs +212 -0
  178. package/dist/{sseStream-B5_Afiqn.mjs → sseStream-B7rPhIQw.mjs} +2 -2
  179. package/dist/{store-helpers-BOzk-CuX.mjs → store-helpers-Bxk7TDgG.mjs} +1 -1
  180. package/dist/{streaming-DjTQhZrN.mjs → streaming-BLg1buwL.mjs} +1 -1
  181. package/dist/{subscriberIdentity-CW39uA8G.mjs → subscriberIdentity-Cxp19Ked.mjs} +1 -1
  182. package/dist/{tenancy--ed9eH_z.mjs → tenancy-D7jo78AP.mjs} +2 -2
  183. package/dist/{tenantPreparation-BKon6Yox.mjs → tenantPreparation-DqJnokDW.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-Y6_ZpoYG.mjs} +1 -1
  195. package/dist/{transactionContext-DjFkrNG6.mjs → transactionContext-BWp0MBGL.mjs} +1 -1
  196. package/dist/{typeGuards-CySF12G-.mjs → typeGuards-CtZJypJO.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-Bk9NOgOC.mjs → types-4JKkSvds.mjs} +4 -4
  201. package/dist/{types-B4Aq4Sdj.d.mts → types-D3Ixsh00.d.mts} +1 -1
  202. package/dist/usage/index.d.mts +4 -4
  203. package/dist/usage/index.mjs +4 -4
  204. package/dist/{userHelpers-aklawRaK.mjs → userHelpers-Nc5ePCsf.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-QWSIKqAk.mjs} +4 -4
  208. package/dist/{validate-9yzHC1e2.mjs → validate-CT4umNhp.mjs} +3 -3
  209. package/dist/{versioning-Bsb51gGT.d.mts → versioning-Bqm_57Qt.d.mts} +23 -1
  210. package/dist/{versioning-fhhWHV74.mjs → versioning-JIqxO64K.mjs} +3 -3
  211. package/dist/{workScope-zpPyge4t.mjs → workScope-BDjGXwU9.mjs} +2 -2
  212. package/package.json +47 -52
  213. package/dist/rolldown-runtime-D1w9Y1VJ.mjs +0 -15
  214. package/dist/sse-CYzQBVFe.mjs +0 -89
@@ -1,9 +1,10 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
2
- import { d as createDomainError } from "../errors-CtrywMHP.mjs";
3
- import { n as requireSingleHeaderValue } from "../headers-BbkIF6vA.mjs";
4
- import { i as requestRequiresIdempotencyKey, n as idempotencyConfigProblem, r as requestDedupedByHandler, t as declaresIdempotencyFence } from "../requirement-KDdoRcOP.mjs";
5
- import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "../store-helpers-BOzk-CuX.mjs";
6
- import { n as createIdempotencyResult, r as operationIdentity, t as resolveIdempotencyTiming } from "../timing-qczZ0YC-.mjs";
1
+ /*! @classytic/arc v2.45.0 | MIT | https://classytic.com */
2
+ import { d as createDomainError } from "../errors-C9G4A8cN.mjs";
3
+ import { n as requireSingleHeaderValue } from "../headers-B6DRXXzT.mjs";
4
+ import { i as requestRequiresIdempotencyKey, n as idempotencyConfigProblem, r as requestDedupedByHandler, t as declaresIdempotencyFence } from "../requirement-tXpcD56f.mjs";
5
+ import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "../store-helpers-Bxk7TDgG.mjs";
6
+ import { n as createIdempotencyResult, r as operationIdentity, t as resolveIdempotencyTiming } from "../timing-Y6_ZpoYG.mjs";
7
+ import { n as acquireIdempotencyKey, r as releaseIdempotencyLock } from "../acquire-BW_2Dt60.mjs";
7
8
  import { ARC_ERROR_CODES } from "@classytic/repo-core/errors";
8
9
  import { and, eq, exists, gt, lt, or, startsWith } from "@classytic/repo-core/filter";
9
10
  import { createHash } from "node:crypto";
@@ -64,22 +65,12 @@ function repositoryAsIdempotencyStore(repository, defaultTtlMs) {
64
65
  }
65
66
  return {
66
67
  name: "repository",
68
+ completionReleasesLock: true,
67
69
  async get(key) {
68
70
  const doc = await safeGetOne(eq(idField, key));
69
71
  if (!doc) return void 0;
70
72
  assertKeyIdentity("get", doc, key);
71
- if (!isCompleted(doc)) return void 0;
72
- if (new Date(doc.expiresAt) < /* @__PURE__ */ new Date()) return void 0;
73
- return {
74
- key,
75
- ...doc.result.requestFingerprint ? { requestFingerprint: doc.result.requestFingerprint } : {},
76
- statusCode: doc.result.statusCode,
77
- headers: doc.result.headers,
78
- body: doc.result.body,
79
- ...doc.result.bodyEncoding ? { bodyEncoding: doc.result.bodyEncoding } : {},
80
- createdAt: new Date(doc.createdAt),
81
- expiresAt: new Date(doc.expiresAt)
82
- };
73
+ return completedResult(doc, key);
83
74
  },
84
75
  async set(key, result) {
85
76
  const doc = await r.findOneAndUpdate(eq(idField, key), update({
@@ -103,21 +94,66 @@ function repositoryAsIdempotencyStore(repository, defaultTtlMs) {
103
94
  if (doc) assertKeyIdentity("set", doc, key);
104
95
  },
105
96
  async setIfLocked(key, requestId, result) {
106
- const doc = await r.findOneAndUpdate(and(eq(idField, key), eq("lock.requestId", requestId), gt("lock.expiresAt", /* @__PURE__ */ new Date())), update({ set: {
107
- result: {
108
- statusCode: result.statusCode,
109
- headers: result.headers,
110
- body: result.body,
111
- ...result.requestFingerprint ? { requestFingerprint: result.requestFingerprint } : {},
112
- ...result.bodyEncoding ? { bodyEncoding: result.bodyEncoding } : {}
97
+ const doc = await r.findOneAndUpdate(and(eq(idField, key), eq("lock.requestId", requestId), gt("lock.expiresAt", /* @__PURE__ */ new Date())), update({
98
+ set: {
99
+ result: {
100
+ statusCode: result.statusCode,
101
+ headers: result.headers,
102
+ body: result.body,
103
+ ...result.requestFingerprint ? { requestFingerprint: result.requestFingerprint } : {},
104
+ ...result.bodyEncoding ? { bodyEncoding: result.bodyEncoding } : {}
105
+ },
106
+ createdAt: result.createdAt,
107
+ expiresAt: result.expiresAt
113
108
  },
114
- createdAt: result.createdAt,
115
- expiresAt: result.expiresAt
116
- } }), { returnDocument: "after" });
109
+ unset: ["lock"]
110
+ }), { returnDocument: "after" });
117
111
  if (!doc) return false;
118
112
  assertKeyIdentity("setIfLocked", doc, key);
119
113
  return true;
120
114
  },
115
+ async acquire(key, requestId, lockTtlMs) {
116
+ for (let attempt = 0; attempt < 2; attempt++) {
117
+ const now = /* @__PURE__ */ new Date();
118
+ let doc = null;
119
+ try {
120
+ doc = await r.findOneAndUpdate(and(eq(idField, key), or(exists("result.statusCode", false), lt("expiresAt", now)), or(exists("lock", false), lt("lock.expiresAt", now))), update({
121
+ set: {
122
+ lock: {
123
+ requestId,
124
+ expiresAt: new Date(now.getTime() + lockTtlMs)
125
+ },
126
+ expiresAt: new Date(now.getTime() + defaultTtlMs)
127
+ },
128
+ unset: ["result"],
129
+ setOnInsert: {
130
+ [idField]: key,
131
+ createdAt: now
132
+ }
133
+ }), {
134
+ upsert: true,
135
+ returnDocument: "after"
136
+ });
137
+ } catch (err) {
138
+ if (!isDuplicateKeyError(err)) throw err;
139
+ }
140
+ if (doc) {
141
+ assertKeyIdentity("acquire", doc, key);
142
+ return { status: "acquired" };
143
+ }
144
+ const existing = await safeGetOne(eq(idField, key));
145
+ if (existing) {
146
+ assertKeyIdentity("acquire", existing, key);
147
+ const result = completedResult(existing, key);
148
+ if (result) return {
149
+ status: "completed",
150
+ result
151
+ };
152
+ if (existing.lock && new Date(existing.lock.expiresAt) > /* @__PURE__ */ new Date()) return { status: "locked" };
153
+ }
154
+ }
155
+ return { status: "locked" };
156
+ },
121
157
  async tryLock(key, requestId, ttlMs) {
122
158
  const now = /* @__PURE__ */ new Date();
123
159
  const lockExpiresAt = new Date(now.getTime() + ttlMs);
@@ -175,6 +211,21 @@ function repositoryAsIdempotencyStore(repository, defaultTtlMs) {
175
211
  async close() {}
176
212
  };
177
213
  }
214
+ /** The row's unexpired completed response, or `undefined`. */
215
+ function completedResult(doc, key) {
216
+ if (!isCompleted(doc)) return void 0;
217
+ if (new Date(doc.expiresAt) < /* @__PURE__ */ new Date()) return void 0;
218
+ return {
219
+ key,
220
+ ...doc.result.requestFingerprint ? { requestFingerprint: doc.result.requestFingerprint } : {},
221
+ statusCode: doc.result.statusCode,
222
+ headers: doc.result.headers,
223
+ body: doc.result.body,
224
+ ...doc.result.bodyEncoding ? { bodyEncoding: doc.result.bodyEncoding } : {},
225
+ createdAt: new Date(doc.createdAt),
226
+ expiresAt: new Date(doc.expiresAt)
227
+ };
228
+ }
178
229
  /**
179
230
  * A row holds a completed response only when it has a status code. A lock-only row can read back
180
231
  * with `result: {}` (a nested path in a mongoose schema); replaying that would answer nothing.
@@ -186,6 +237,7 @@ function isCompleted(doc) {
186
237
  //#region src/idempotency/stores/memory.ts
187
238
  var MemoryIdempotencyStore = class {
188
239
  name = "memory";
240
+ completionReleasesLock = true;
189
241
  results = /* @__PURE__ */ new Map();
190
242
  locks = /* @__PURE__ */ new Map();
191
243
  ttlMs;
@@ -223,8 +275,28 @@ var MemoryIdempotencyStore = class {
223
275
  const lock = this.locks.get(key);
224
276
  if (!lock || lock.requestId !== requestId || lock.expiresAt.getTime() <= Date.now()) return false;
225
277
  this.writeResult(key, result);
278
+ this.locks.delete(key);
226
279
  return true;
227
280
  }
281
+ async acquire(key, requestId, lockTtlMs) {
282
+ const result = this.results.get(key);
283
+ if (result) {
284
+ if (Date.now() <= new Date(result.expiresAt).getTime()) return {
285
+ status: "completed",
286
+ result
287
+ };
288
+ this.results.delete(key);
289
+ }
290
+ const lock = this.locks.get(key);
291
+ if (lock && Date.now() <= new Date(lock.expiresAt).getTime()) return { status: "locked" };
292
+ this.locks.set(key, {
293
+ key,
294
+ requestId,
295
+ lockedAt: /* @__PURE__ */ new Date(),
296
+ expiresAt: new Date(Date.now() + lockTtlMs)
297
+ });
298
+ return { status: "acquired" };
299
+ }
228
300
  async tryLock(key, requestId, ttlMs) {
229
301
  const existing = this.locks.get(key);
230
302
  if (existing) {
@@ -443,12 +515,12 @@ const idempotencyPlugin = async (fastify, opts = {}) => {
443
515
  request.idempotencyKey = idempotencyKey;
444
516
  const fullKey = `${idempotencyKey}:${operationIdentity$1(request)}`;
445
517
  const requestFingerprint = bodyFingerprint(request);
446
- const cached = await store.get(fullKey);
447
- if (cached) {
448
- replay(request, reply, cached, requestFingerprint);
518
+ const acquisition = await acquireIdempotencyKey(store, fullKey, request.id, lockTimeoutMs);
519
+ if (acquisition.status === "completed") {
520
+ replay(request, reply, acquisition.result, requestFingerprint);
449
521
  return reply;
450
522
  }
451
- if (!await store.tryLock(fullKey, request.id, lockTimeoutMs)) {
523
+ if (acquisition.status === "locked") {
452
524
  reply.code(409).header("Retry-After", retryAfterSeconds.toString()).send({
453
525
  code: ARC_ERROR_CODES.IDEMPOTENCY_CONFLICT,
454
526
  message: "Request with this idempotency key is already in progress",
@@ -459,19 +531,6 @@ const idempotencyPlugin = async (fastify, opts = {}) => {
459
531
  }
460
532
  request._idempotencyFullKey = fullKey;
461
533
  request._idempotencyFingerprint = requestFingerprint;
462
- try {
463
- const completed = await store.get(fullKey);
464
- if (completed) {
465
- await store.unlock(fullKey, request.id);
466
- request._idempotencyFullKey = void 0;
467
- replay(request, reply, completed, requestFingerprint);
468
- return reply;
469
- }
470
- } catch (err) {
471
- await store.unlock(fullKey, request.id);
472
- request._idempotencyFullKey = void 0;
473
- throw err;
474
- }
475
534
  reply.header(HEADER_IDEMPOTENCY_KEY, idempotencyKey);
476
535
  };
477
536
  fastify.addHook("onRoute", (route) => {
@@ -495,6 +554,8 @@ const idempotencyPlugin = async (fastify, opts = {}) => {
495
554
  lockTimeoutMs
496
555
  });
497
556
  const recordedResponses = /* @__PURE__ */ new WeakSet();
557
+ /** Completed through `setIfLocked` — the lock is already gone when the store says so. */
558
+ const fencedCompletions = /* @__PURE__ */ new WeakSet();
498
559
  async function recordResponse(request, reply, payload, binary = false) {
499
560
  if (request.idempotencyReplayed || recordedResponses.has(request)) return;
500
561
  const fullKey = request._idempotencyFullKey;
@@ -519,6 +580,7 @@ const idempotencyPlugin = async (fastify, opts = {}) => {
519
580
  };
520
581
  if (store.setIfLocked && store.supportsFencedCompletion !== false) {
521
582
  if (!await store.setIfLocked(fullKey, request.id, completion)) throw createDomainError(ARC_ERROR_CODES.IDEMPOTENCY_CONFLICT, "This request lost its idempotency lease before completion; its effect may have been applied. Retry the same key to retrieve the current owner's result.", 409);
583
+ fencedCompletions.add(request);
522
584
  } else await store.set(fullKey, completion);
523
585
  recordedResponses.add(request);
524
586
  }
@@ -532,7 +594,7 @@ const idempotencyPlugin = async (fastify, opts = {}) => {
532
594
  if (request.idempotencyReplayed) return;
533
595
  const fullKey = request._idempotencyFullKey;
534
596
  if (!fullKey) return;
535
- await store.unlock(fullKey, request.id);
597
+ await releaseIdempotencyLock(store, fullKey, request.id, fencedCompletions.has(request));
536
598
  });
537
599
  fastify.addHook("onClose", async () => {
538
600
  if (ownsStore) await store.close?.();
@@ -1,3 +1,3 @@
1
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-vLvtcGy_.mjs";
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-BDgv9Glw.mjs";
3
3
  export { type IoredisLike, type RedisClient, RedisIdempotencyStore, type RedisIdempotencyStoreOptions, type UpstashRedisLike, ioredisAsIdempotencyClient, upstashAsIdempotencyClient };
@@ -1,4 +1,5 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.45.0 | MIT | https://classytic.com */
2
+ import { t as acquireBySteps } from "../acquire-BW_2Dt60.mjs";
2
3
  import { createHash } from "node:crypto";
3
4
  //#region src/idempotency/stores/redis.ts
4
5
  /**
@@ -21,6 +22,8 @@ import { createHash } from "node:crypto";
21
22
  var RedisIdempotencyStore = class {
22
23
  name = "redis";
23
24
  supportsFencedCompletion;
25
+ /** The fenced completion script deletes the lock; it needs `eval`, as fencing does. */
26
+ completionReleasesLock;
24
27
  client;
25
28
  prefix;
26
29
  lockPrefix;
@@ -28,6 +31,7 @@ var RedisIdempotencyStore = class {
28
31
  constructor(options) {
29
32
  this.client = options.client;
30
33
  this.supportsFencedCompletion = typeof options.client.eval === "function";
34
+ this.completionReleasesLock = this.supportsFencedCompletion;
31
35
  this.prefix = options.prefix ?? "idem:";
32
36
  this.lockPrefix = options.lockPrefix ?? "idem:lock:";
33
37
  if (this.prefix.match(/\{([^}]+)\}/)?.[1] !== this.lockPrefix.match(/\{([^}]+)\}/)?.[1]) throw new Error("Redis idempotency prefixes must use the same Redis Cluster hash tag or neither may use one.");
@@ -40,7 +44,9 @@ var RedisIdempotencyStore = class {
40
44
  return `${this.lockPrefix}${key}:{${createHash("sha256").update(key).digest("hex")}}`;
41
45
  }
42
46
  async get(key) {
43
- const data = await this.client.get(this.resultKey(key));
47
+ return this.parseResult(await this.client.get(this.resultKey(key)));
48
+ }
49
+ parseResult(data) {
44
50
  if (!data) return void 0;
45
51
  try {
46
52
  const result = JSON.parse(data);
@@ -69,6 +75,27 @@ var RedisIdempotencyStore = class {
69
75
  NX: true
70
76
  }) === "OK";
71
77
  }
78
+ async acquire(key, requestId, lockTtlMs) {
79
+ const client = this.client;
80
+ if (typeof client.eval !== "function") return acquireBySteps(this, key, requestId, lockTtlMs);
81
+ const reply = await client.eval(`
82
+ local done = redis.call("get", KEYS[2])
83
+ if done then return {1, done} end
84
+ if redis.call("set", KEYS[1], ARGV[1], "NX", "PX", ARGV[2]) then return {2} end
85
+ return {0}
86
+ `, 2, this.lockKey(key), this.resultKey(key), requestId, Math.max(1, Math.ceil(lockTtlMs)));
87
+ const tag = Number(reply?.[0]);
88
+ if (tag === 2) return { status: "acquired" };
89
+ if (tag === 1) {
90
+ const result = this.parseResult(reply?.[1] ?? null);
91
+ if (result) return {
92
+ status: "completed",
93
+ result
94
+ };
95
+ return await this.tryLock(key, requestId, lockTtlMs) ? { status: "acquired" } : { status: "locked" };
96
+ }
97
+ return { status: "locked" };
98
+ }
72
99
  async setIfLocked(key, requestId, result) {
73
100
  if (typeof this.client.eval !== "function") throw new Error("Redis idempotency fenced completion requires eval; proxy eval through your Redis client adapter.");
74
101
  const ttlMs = new Date(result.expiresAt).getTime() - Date.now();
@@ -76,6 +103,7 @@ var RedisIdempotencyStore = class {
76
103
  const saved = await this.client.eval(`
77
104
  if redis.call("get", KEYS[1]) ~= ARGV[1] then return 0 end
78
105
  redis.call("set", KEYS[2], ARGV[2], "PX", ARGV[3])
106
+ redis.call("del", KEYS[1])
79
107
  return 1
80
108
  `, 2, this.lockKey(key), this.resultKey(key), requestId, JSON.stringify({
81
109
  key,
@@ -1,8 +1,8 @@
1
1
 
2
2
  import { i as RequestScope } from "./types-Ddl9OjmE.mjs";
3
3
  import { l as PermissionCheck, t as AnyRecord } from "./base-CZyixEQR.mjs";
4
- import { A as RequestWithExtras, Dt as RouteMcpConfig, F as ResourceDefinition, I as CrudController, In as IControllerResponse, L as ResourceConfig, Ln as IRequestContext, O as FastifyWithDecorators, St as ActionDefinition, X as RouteSchemaOptions, Z as ArcFieldRule, g as RequestContext, ot as AggregationConfig, v as CrudRouterOptions } from "./index-mqaqZNpe.mjs";
5
- import "./fastify-augmentation-DhUJ-mvo.mjs";
4
+ import { A as RequestWithExtras, Dt as RouteMcpConfig, F as ResourceDefinition, Hn as IRequestContext, I as CrudController, L as ResourceConfig, O as FastifyWithDecorators, St as ActionDefinition, Vn as IControllerResponse, X as RouteSchemaOptions, Z as ArcFieldRule, g as RequestContext, ot as AggregationConfig, v as CrudRouterOptions } from "./index-WH7xgvxS.mjs";
5
+ import "./fastify-augmentation-DRlCIWE9.mjs";
6
6
  import { Filter } from "@classytic/repo-core/filter";
7
7
  import { FastifyReply, FastifyRequest, RouteHandlerMethod } from "fastify";
8
8
  import { z } from "zod";
@@ -271,34 +271,6 @@ type VariantsResult<TDoc, V extends VariantsMap<TDoc>> = { [K in keyof V]: Resou
271
271
  */
272
272
  declare function defineResourceVariants<TDoc extends object = AnyRecord, V extends VariantsMap<TDoc> = VariantsMap<TDoc>>(base: Omit<ResourceConfig<TDoc>, "name" | "prefix">, variants: V): VariantsResult<TDoc, V>;
273
273
  //#endregion
274
- //#region src/core/entityHelpers.d.ts
275
- /**
276
- * Read the resource's configured `idField` for the current request.
277
- * Falls back to the framework default (`_id`) when the route hasn't
278
- * bound an idField — keeps handlers safe to author without checking
279
- * the resource config.
280
- */
281
- declare function getEntityIdField(req: RequestWithExtras): string;
282
- /**
283
- * Read the URL `:id` path param value as the resource handle.
284
- * Returns `undefined` when the route has no `:id` segment (collection
285
- * routes) — handlers that need the entity must be on row routes.
286
- */
287
- declare function getEntityId(req: RequestWithExtras): string | undefined;
288
- /**
289
- * Compose a `findOne` filter that resolves the current request's
290
- * entity, regardless of whether the resource binds `_id` or a custom
291
- * field. Idiomatic shape for arc action handlers.
292
- *
293
- * ```ts
294
- * const doc = await Model.findOne(getEntityQuery(req));
295
- * ```
296
- *
297
- * Returns `{}` when the route has no entity context (collection routes
298
- * or tests bypassing the router) — caller decides what that means.
299
- */
300
- declare function getEntityQuery(req: RequestWithExtras): Record<string, string>;
301
- //#endregion
302
274
  //#region src/core/fastifyAdapter.d.ts
303
275
  /**
304
276
  * Project `FastifyRequest` into the `IRequestContext` controllers receive,
@@ -396,4 +368,4 @@ declare function formatValidationErrors(resourceName: string, result: Validation
396
368
  */
397
369
  declare function assertValidConfig(config: ResourceConfig, options?: ValidateOptions): void;
398
370
  //#endregion
399
- export { createPermissionMiddleware as A, DEFAULT_VERSION_FIELD as B, AdapterLike as C, DefineActionConfig as D, mergeResourceConfig as E, DEFAULT_LIMIT as F, MAX_FILTER_DEPTH as G, HOOK_PHASES as H, DEFAULT_MAX_LIMIT as I, MUTATION_OPERATIONS as J, MAX_REGEX_LENGTH as K, DEFAULT_SORT as L, CRUD_OPERATIONS as M, CrudOperation as N, defineAction as O, DEFAULT_ID_FIELD as P, DEFAULT_TENANT_FIELD as R, defineResourceVariants as S, SeamedResourceConfig as T, HookOperation as U, HOOK_OPERATIONS as V, HookPhase as W, RESERVED_QUERY_PARAMS as X, MutationOperation as Y, SYSTEM_FIELDS as Z, getEntityIdField as _, formatValidationErrors as a, VariantsMap as b, nativePolicyFilter as c, createFastifyHandler as d, createRequestContext as f, getEntityId as g, sendControllerResponse as h, assertValidConfig as i, defineAggregation as j, createCrudRouter as k, collectReadBlockedFields as l, getControllerScope as m, ValidateOptions as n, validateResourceConfig as o, getControllerContext as p, MAX_SEARCH_LENGTH as q, ValidationResult as r, NativePolicyFilter as s, ConfigError as t, isFieldReadable as u, getEntityQuery as v, ResourceSeams as w, VariantsResult as x, VariantOverride as y, DEFAULT_UPDATE_METHOD as z };
371
+ export { CrudOperation as A, HookOperation as B, mergeResourceConfig as C, createPermissionMiddleware as D, createCrudRouter as E, DEFAULT_TENANT_FIELD as F, MUTATION_OPERATIONS as G, MAX_FILTER_DEPTH as H, DEFAULT_UPDATE_METHOD as I, SYSTEM_FIELDS as J, MutationOperation as K, DEFAULT_VERSION_FIELD as L, DEFAULT_LIMIT as M, DEFAULT_MAX_LIMIT as N, defineAggregation as O, DEFAULT_SORT as P, HOOK_OPERATIONS as R, SeamedResourceConfig as S, defineAction as T, MAX_REGEX_LENGTH as U, HookPhase as V, MAX_SEARCH_LENGTH as W, VariantsMap as _, formatValidationErrors as a, AdapterLike as b, nativePolicyFilter as c, createFastifyHandler as d, createRequestContext as f, VariantOverride as g, sendControllerResponse as h, assertValidConfig as i, DEFAULT_ID_FIELD as j, CRUD_OPERATIONS as k, collectReadBlockedFields as l, getControllerScope as m, ValidateOptions as n, validateResourceConfig as o, getControllerContext as p, RESERVED_QUERY_PARAMS as q, ValidationResult as r, NativePolicyFilter as s, ConfigError as t, isFieldReadable as u, VariantsResult as v, DefineActionConfig as w, ResourceSeams as x, defineResourceVariants as y, HOOK_PHASES as z };
@@ -1,5 +1,5 @@
1
1
 
2
- import { F as ResourceDefinition } from "./index-mqaqZNpe.mjs";
2
+ import { F as ResourceDefinition } from "./index-WH7xgvxS.mjs";
3
3
  import { h as ModuleSetupContext, i as ArcModuleRegistry, l as ModuleContribution, n as ArcModule, o as ArcPorts, p as PortName, r as ArcModuleInput, u as ModuleName } from "./types-BJ-2XqVF.mjs";
4
4
  import { FastifyInstance } from "fastify";
5
5
  //#region src/factory/module/graph.d.ts
@@ -1042,6 +1042,50 @@ declare class AccessControl {
1042
1042
  private _meta;
1043
1043
  }
1044
1044
  //#endregion
1045
+ //#region src/core/entityHelpers.d.ts
1046
+ /**
1047
+ * Read the resource's configured `idField` for the current request.
1048
+ * Falls back to the framework default (`_id`) when the route hasn't
1049
+ * bound an idField — keeps handlers safe to author without checking
1050
+ * the resource config.
1051
+ */
1052
+ declare function getEntityIdField(req: RequestWithExtras): string;
1053
+ /**
1054
+ * Read the URL `:id` path param value as the resource handle.
1055
+ * Returns `undefined` when the route has no `:id` segment (collection
1056
+ * routes) — handlers that need the entity must be on row routes.
1057
+ */
1058
+ declare function getEntityId(req: RequestWithExtras): string | undefined;
1059
+ /**
1060
+ * Compose a `findOne` filter that resolves the current request's
1061
+ * entity, regardless of whether the resource binds `_id` or a custom
1062
+ * field. Idiomatic shape for arc action handlers.
1063
+ *
1064
+ * ```ts
1065
+ * const doc = await Model.findOne(getEntityQuery(req));
1066
+ * ```
1067
+ *
1068
+ * Returns `{}` when the route has no entity context (collection routes
1069
+ * or tests bypassing the router) — caller decides what that means.
1070
+ */
1071
+ declare function getEntityQuery(req: RequestWithExtras): Record<string, string>;
1072
+ /** The action-target fence's answer and, when it read one, the row (`GET /:id`'s scope). */
1073
+ interface ActionTargetCheck {
1074
+ readonly visible: boolean;
1075
+ readonly doc?: unknown;
1076
+ }
1077
+ /**
1078
+ * The row the action-target fence loaded for this request, so the handler need not read it
1079
+ * again. `undefined` when no fence read happened (untenanted resource, `scope: 'handler'`,
1080
+ * id-less action) — load it yourself then. It is a snapshot taken after the idempotency lock
1081
+ * and before the handler: a guarded write must still carry its precondition in the filter.
1082
+ */
1083
+ declare function getActionTarget<TDoc = Record<string, unknown>>(req: {
1084
+ readonly arc?: {
1085
+ readonly actionTarget?: unknown;
1086
+ };
1087
+ }): TDoc | undefined;
1088
+ //#endregion
1045
1089
  //#region src/core/QueryResolver.d.ts
1046
1090
  interface QueryResolverConfig {
1047
1091
  /** Query parser instance (default: Arc built-in parser) */
@@ -1277,6 +1321,11 @@ declare class BaseCrudController<TDoc = AnyRecord, TRepository extends Repositor
1277
1321
  /** Whether {@link isActionTargetVisible} can answer — it reads through the repository. */
1278
1322
  canFenceActionTargets(): boolean;
1279
1323
  isActionTargetVisible(req: IRequestContext, id: string): Promise<boolean>;
1324
+ /**
1325
+ * The fence's answer plus the row it read (absent when the resource has no row scope, so
1326
+ * nothing was read). The router hands the row to the handler as `getActionTarget(req)`.
1327
+ */
1328
+ loadActionTarget(req: IRequestContext, id: string): Promise<ActionTargetCheck>;
1280
1329
  /** `ETag: "<version>"` for a versioned document under optimistic concurrency. */
1281
1330
  protected etagHeaders(doc: unknown): Record<string, string> | undefined;
1282
1331
  /**
@@ -3994,6 +4043,8 @@ interface RequestWithExtras extends FastifyRequest {
3994
4043
  * can still read the entity handle.
3995
4044
  */
3996
4045
  entityId?: string;
4046
+ /** The id-bound action's target as the fence read it — read via `getActionTarget(req)`. */
4047
+ actionTarget?: unknown;
3997
4048
  };
3998
4049
  context?: Record<string, unknown>;
3999
4050
  _policyFilters?: Record<string, unknown>;
@@ -4605,4 +4656,4 @@ type InferDocType<T> = T extends DataAdapter<infer D> ? D : T extends ResourceCo
4605
4656
  type InferAdapterDoc<A> = A extends DataAdapter<infer D> ? D : unknown;
4606
4657
  type InferResourceDoc<T> = T extends ResourceConfig<infer D> ? D : never;
4607
4658
  //#endregion
4608
- export { ResourceHookContext as $, AroundHookHandler as $t, RequestWithExtras as A, WriteContext as An, AuthHelpers as At, OnTenantDeleteConfig as B, ServerAccessor as Bn, TreeMixin as Bt, RequestIdOptions as C, ControllerConstructionOptions as Cn, ActionEntry as Ct, FastifyWithAuth as D, BodySanitizerConfig as Dn, RouteMcpConfig as Dt, FastifyRequestExtras as E, BodySanitizer as En, RouteDefinition as Et, ResourceDefinition as F, IController as Fn, TokenPair as Ft, CrudRouteKey as G, BaseCrudController as Gt, PresetFunction as H, SlugMixin as Ht, CrudController as I, IControllerResponse as In, BaseController as It, MiddlewareConfig as J, AccessControl as Jt, CrudSchemas as K, QueryResolver as Kt, ResourceConfig as L, IRequestContext as Ln, SoftDeleteExt as Lt, ResourceRegistry as M, ControllerHandler as Mn, Authenticator as Mt, RouteRow as N, ControllerLike as Nn, AuthenticatorContext as Nt, FastifyWithDecorators as O, MutationWriteContext as On, RouteMethod as Ot, defineResource as P, FastifyHandler as Pn, JwtContext as Pt, FieldRule$1 as Q, FetchResult as Qt, ResourceIdempotencyConfig as R, RawRouteHandler as Rn, SoftDeleteMixin as Rt, IntrospectionPluginOptions as S, ControllerConfigurableOptions as Sn, ActionDefinition as St, EventsDecorator as T, MixinConstructor as Tn, ActionsMap as Tt, PresetHook as U, BulkExt as Ut, ResolvedTenantPurge as V, SlugExt as Vt, PresetResult as W, BulkMixin as Wt, RouteSchemaOptions as X, AccessControlRepository as Xt, OpenApiSchemas as Y, AccessControlConfig as Yt, ArcFieldRule as Z, FetchDenialReason as Zt, ServiceContext as _, ArcDeleteResult as _n, PipelineConfig as _t, IntrospectionData as a, HookRegistration as an, AggregationCacheConfig as at, HealthCheck as b, ArcUpdateResult as bn, Transform as bt, ResourceMetadata as c, afterCreate as cn, AggregationIndexHint as ct, LookupOption as d, beforeCreate as dn, AggregationRateLimit as dt, DefineHookOptions as en, ResourceHooks as et, OwnershipCheck as f, beforeDelete as fn, AggregationsMap as ft, RequestContext as g, ArcCreateResult as gn, OperationFilter as gt, QueryParserInterface as h, defineHook as hn, NextFunction as ht, PaginationResult as i, HookPhase as in, AggMeasureShorthand as it, RegisterOptions as j, WriteVerbKey as jn, AuthPluginOptions as jt, MiddlewareHandler as k, ResourceWrites as kn, RateLimitConfig as kt, ArcInternalMetadata as l, afterDelete as ln, AggregationMaterializedContext as lt, PopulateOption as m, createHookSystem as mn, Interceptor as mt, InferDocType as n, HookHandler as nn, EventDefinition as nt, RegistryEntry as o, HookSystem as on, AggregationConfig as ot, ParsedQuery as p, beforeUpdate as pn, Guard as pt, LookupPolicy as q, QueryResolverConfig as qt, InferResourceDoc as r, HookOperation as rn, AggMeasureInput as rt, RegistryStats as s, HookSystemOptions as sn, AggregationDateRangeRequirement as st, InferAdapterDoc as t, HookContext as tn, ResourceExtensions as tt, ControllerQueryOptions as u, afterUpdate as un, AggregationMaterializedResult as ut, CrudRouterOptions as v, ArcGetResult as vn, PipelineContext as vt, ArcDecorator as w, ListResult as wn, ActionHandlerFn as wt, HealthOptions as x, BaseControllerOptions as xn, ResourceCacheConfig as xt, GracefulShutdownOptions as y, ArcListResult as yn, PipelineStep as yt, ResourcePermissions as z, RouteHandler as zn, TreeExt as zt };
4659
+ export { ResourceHookContext as $, AccessControl as $t, RequestWithExtras as A, MixinConstructor as An, AuthHelpers as At, OnTenantDeleteConfig as B, IController as Bn, TreeMixin as Bt, RequestIdOptions as C, ArcGetResult as Cn, ActionEntry as Ct, FastifyWithAuth as D, ControllerConfigurableOptions as Dn, RouteMcpConfig as Dt, FastifyRequestExtras as E, BaseControllerOptions as En, RouteDefinition as Et, ResourceDefinition as F, WriteContext as Fn, TokenPair as Ft, CrudRouteKey as G, ServerAccessor as Gn, BaseCrudController as Gt, PresetFunction as H, IRequestContext as Hn, SlugMixin as Ht, CrudController as I, WriteVerbKey as In, BaseController as It, MiddlewareConfig as J, ActionTargetCheck as Jt, CrudSchemas as K, QueryResolver as Kt, ResourceConfig as L, ControllerHandler as Ln, SoftDeleteExt as Lt, ResourceRegistry as M, BodySanitizerConfig as Mn, Authenticator as Mt, RouteRow as N, MutationWriteContext as Nn, AuthenticatorContext as Nt, FastifyWithDecorators as O, ControllerConstructionOptions as On, RouteMethod as Ot, defineResource as P, ResourceWrites as Pn, JwtContext as Pt, FieldRule$1 as Q, getEntityQuery as Qt, ResourceIdempotencyConfig as R, ControllerLike as Rn, SoftDeleteMixin as Rt, IntrospectionPluginOptions as S, ArcDeleteResult as Sn, ActionDefinition as St, EventsDecorator as T, ArcUpdateResult as Tn, ActionsMap as Tt, PresetHook as U, RawRouteHandler as Un, BulkExt as Ut, ResolvedTenantPurge as V, IControllerResponse as Vn, SlugExt as Vt, PresetResult as W, RouteHandler as Wn, BulkMixin as Wt, RouteSchemaOptions as X, getEntityId as Xt, OpenApiSchemas as Y, getActionTarget as Yt, ArcFieldRule as Z, getEntityIdField as Zt, ServiceContext as _, beforeDelete as _n, PipelineConfig as _t, IntrospectionData as a, DefineHookOptions as an, AggregationCacheConfig as at, HealthCheck as b, defineHook as bn, Transform as bt, ResourceMetadata as c, HookOperation as cn, AggregationIndexHint as ct, LookupOption as d, HookSystem as dn, AggregationRateLimit as dt, AccessControlConfig as en, ResourceHooks as et, OwnershipCheck as f, HookSystemOptions as fn, AggregationsMap as ft, RequestContext as g, beforeCreate as gn, OperationFilter as gt, QueryParserInterface as h, afterUpdate as hn, NextFunction as ht, PaginationResult as i, AroundHookHandler as in, AggMeasureShorthand as it, RegisterOptions as j, BodySanitizer as jn, AuthPluginOptions as jt, MiddlewareHandler as k, ListResult as kn, RateLimitConfig as kt, ArcInternalMetadata as l, HookPhase as ln, AggregationMaterializedContext as lt, PopulateOption as m, afterDelete as mn, Interceptor as mt, InferDocType as n, FetchDenialReason as nn, EventDefinition as nt, RegistryEntry as o, HookContext as on, AggregationConfig as ot, ParsedQuery as p, afterCreate as pn, Guard as pt, LookupPolicy as q, QueryResolverConfig as qt, InferResourceDoc as r, FetchResult as rn, AggMeasureInput as rt, RegistryStats as s, HookHandler as sn, AggregationDateRangeRequirement as st, InferAdapterDoc as t, AccessControlRepository as tn, ResourceExtensions as tt, ControllerQueryOptions as u, HookRegistration as un, AggregationMaterializedResult as ut, CrudRouterOptions as v, beforeUpdate as vn, PipelineContext as vt, ArcDecorator as w, ArcListResult as wn, ActionHandlerFn as wt, HealthOptions as x, ArcCreateResult as xn, ResourceCacheConfig as xt, GracefulShutdownOptions as y, createHookSystem as yn, PipelineStep as yt, ResourcePermissions as z, FastifyHandler as zn, TreeExt as zt };
@@ -1,5 +1,5 @@
1
1
 
2
- import { Mt as Authenticator } from "./index-mqaqZNpe.mjs";
2
+ import { Mt as Authenticator } from "./index-WH7xgvxS.mjs";
3
3
  import { r as CacheStore } from "./interface-BOk3YnTz.mjs";
4
4
  import { n as ElevationOptions } from "./elevation-BW2J3tNj.mjs";
5
5
  import { a as EventTransport } from "./EventTransport-CiicKz2Z.mjs";
@@ -7,10 +7,10 @@ import { t as ExternalOpenApiPaths } from "./externalPaths-CmGOxOtD.mjs";
7
7
  import { r as QueryCachePluginOptions } from "./queryCachePlugin-C2lZjTxk.mjs";
8
8
  import { t as ErrorHandlerOptions } from "./errorHandler--4rSMMvq.mjs";
9
9
  import { S as SchedulesPluginOptions, T as HealthOptions, _ as ResourceLike, o as ArcPorts, r as ArcModuleInput } from "./types-BJ-2XqVF.mjs";
10
- import { H as ModuleGraphOptions } from "./index-JdbZAIsm.mjs";
10
+ import { H as ModuleGraphOptions } from "./index-CUJvoyw3.mjs";
11
11
  import { t as EventPluginOptions } from "./eventPlugin-BtmA4-3P.mjs";
12
- import { a as MetricsOptions, c as RealtimeOptions, f as CachingOptions, h as GracefulShutdownOptions, t as VersioningOptions, u as SSEOptions } from "./versioning-Bsb51gGT.mjs";
13
- import { r as IdempotencyStore } from "./interface-C0395yUN.mjs";
12
+ import { a as MetricsOptions, c as RealtimeOptions, g as GracefulShutdownOptions, p as CachingOptions, t as VersioningOptions, u as SSEOptions } from "./versioning-Bqm_57Qt.mjs";
13
+ import { i as IdempotencyStore } from "./interface-JJzwH4Ro.mjs";
14
14
  import { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest, FastifyServerOptions } from "fastify";
15
15
  //#region src/factory/types/assets.d.ts
16
16
  /**
package/dist/index.d.mts CHANGED
@@ -1,12 +1,12 @@
1
1
 
2
2
  import { c as DataPolicy, d as UserBase, l as PermissionCheck, n as ArcRequest, o as UserOrganization, r as JWTPayload, s as AuthorizationDecision, t as AnyRecord, u as PermissionContext } from "./base-CZyixEQR.mjs";
3
- import { A as RequestWithExtras, An as WriteContext, Bt as TreeMixin, C as RequestIdOptions, Cn as ControllerConstructionOptions, D as FastifyWithAuth, E as FastifyRequestExtras, F as ResourceDefinition, Fn as IController, G as CrudRouteKey, Gt as BaseCrudController, H as PresetFunction, Ht as SlugMixin, I as CrudController, In as IControllerResponse, It as BaseController, J as MiddlewareConfig, K as CrudSchemas, L as ResourceConfig, Ln as IRequestContext, Lt as SoftDeleteExt, Nn as ControllerLike, O as FastifyWithDecorators, On as MutationWriteContext, P as defineResource, Q as FieldRule, Rn as RawRouteHandler, Rt as SoftDeleteMixin, S as IntrospectionPluginOptions, Sn as ControllerConfigurableOptions, Ut as BulkExt, Vt as SlugExt, W as PresetResult, Wt as BulkMixin, X as RouteSchemaOptions, _ as ServiceContext, _n as ArcDeleteResult, a as IntrospectionData, at as AggregationCacheConfig, b as HealthCheck, bn as ArcUpdateResult, c as ResourceMetadata, ct as AggregationIndexHint, dt as AggregationRateLimit, f as OwnershipCheck, ft as AggregationsMap, g as RequestContext, gn as ArcCreateResult, h as QueryParserInterface, i as PaginationResult, it as AggMeasureShorthand, jn as WriteVerbKey, jt as AuthPluginOptions, kn as ResourceWrites, kt as RateLimitConfig, l as ArcInternalMetadata, lt as AggregationMaterializedContext, n as InferDocType, nt as EventDefinition, o as RegistryEntry, ot as AggregationConfig, r as InferResourceDoc, rt as AggMeasureInput, s as RegistryStats, st as AggregationDateRangeRequirement, t as InferAdapterDoc, ut as AggregationMaterializedResult, v as CrudRouterOptions, vn as ArcGetResult, wn as ListResult, x as HealthOptions, xn as BaseControllerOptions, y as GracefulShutdownOptions, yn as ArcListResult, zn as RouteHandler, zt as TreeExt } from "./index-mqaqZNpe.mjs";
3
+ import { A as RequestWithExtras, Bn as IController, Bt as TreeMixin, C as RequestIdOptions, Cn as ArcGetResult, D as FastifyWithAuth, Dn as ControllerConfigurableOptions, E as FastifyRequestExtras, En as BaseControllerOptions, F as ResourceDefinition, Fn as WriteContext, G as CrudRouteKey, Gt as BaseCrudController, H as PresetFunction, Hn as IRequestContext, Ht as SlugMixin, I as CrudController, In as WriteVerbKey, It as BaseController, J as MiddlewareConfig, K as CrudSchemas, L as ResourceConfig, Lt as SoftDeleteExt, Nn as MutationWriteContext, O as FastifyWithDecorators, On as ControllerConstructionOptions, P as defineResource, Pn as ResourceWrites, Q as FieldRule, Rn as ControllerLike, Rt as SoftDeleteMixin, S as IntrospectionPluginOptions, Sn as ArcDeleteResult, Tn as ArcUpdateResult, Un as RawRouteHandler, Ut as BulkExt, Vn as IControllerResponse, Vt as SlugExt, W as PresetResult, Wn as RouteHandler, Wt as BulkMixin, X as RouteSchemaOptions, _ as ServiceContext, a as IntrospectionData, at as AggregationCacheConfig, b as HealthCheck, c as ResourceMetadata, ct as AggregationIndexHint, dt as AggregationRateLimit, f as OwnershipCheck, ft as AggregationsMap, g as RequestContext, h as QueryParserInterface, i as PaginationResult, it as AggMeasureShorthand, jt as AuthPluginOptions, kn as ListResult, kt as RateLimitConfig, l as ArcInternalMetadata, lt as AggregationMaterializedContext, n as InferDocType, nt as EventDefinition, o as RegistryEntry, ot as AggregationConfig, r as InferResourceDoc, rt as AggMeasureInput, s as RegistryStats, st as AggregationDateRangeRequirement, t as InferAdapterDoc, ut as AggregationMaterializedResult, v as CrudRouterOptions, wn as ArcListResult, x as HealthOptions, xn as ArcCreateResult, y as GracefulShutdownOptions, zt as TreeExt } from "./index-WH7xgvxS.mjs";
4
4
  import { a as applyFieldReadPermissions, n as FieldPermissionMap, o as applyFieldWritePermissions, s as fields, t as FieldPermission } from "./fields-BBSpf8pS.mjs";
5
- import "./fastify-augmentation-DhUJ-mvo.mjs";
6
- import { C as AdapterLike, E as mergeResourceConfig, F as DEFAULT_LIMIT, G as MAX_FILTER_DEPTH, H as HOOK_PHASES, I as DEFAULT_MAX_LIMIT, J as MUTATION_OPERATIONS, K as MAX_REGEX_LENGTH, L as DEFAULT_SORT, M as CRUD_OPERATIONS, N as CrudOperation, O as defineAction, P as DEFAULT_ID_FIELD, R as DEFAULT_TENANT_FIELD, S as defineResourceVariants, T as SeamedResourceConfig, U as HookOperation, V as HOOK_OPERATIONS, W as HookPhase, X as RESERVED_QUERY_PARAMS, Y as MutationOperation, Z as SYSTEM_FIELDS, c as nativePolicyFilter, j as defineAggregation, m as getControllerScope, q as MAX_SEARCH_LENGTH, s as NativePolicyFilter, w as ResourceSeams, z as DEFAULT_UPDATE_METHOD } from "./index-CRoPtISf.mjs";
5
+ import "./fastify-augmentation-DRlCIWE9.mjs";
6
+ import { A as CrudOperation, B as HookOperation, C as mergeResourceConfig, F as DEFAULT_TENANT_FIELD, G as MUTATION_OPERATIONS, H as MAX_FILTER_DEPTH, I as DEFAULT_UPDATE_METHOD, J as SYSTEM_FIELDS, K as MutationOperation, M as DEFAULT_LIMIT, N as DEFAULT_MAX_LIMIT, O as defineAggregation, P as DEFAULT_SORT, R as HOOK_OPERATIONS, S as SeamedResourceConfig, T as defineAction, U as MAX_REGEX_LENGTH, V as HookPhase, W as MAX_SEARCH_LENGTH, b as AdapterLike, c as nativePolicyFilter, j as DEFAULT_ID_FIELD, k as CRUD_OPERATIONS, m as getControllerScope, q as RESERVED_QUERY_PARAMS, s as NativePolicyFilter, x as ResourceSeams, y as defineResourceVariants, z as HOOK_PHASES } from "./index-Beg3aNnK.mjs";
7
7
  import { C as requireScopeContext, G as createDynamicPermissionMatrix, H as DynamicPermissionMatrix, J as PublicPolicy, K as createOrgPermissions, Q as anyOf, S as requireOrgRole, T as requireTeamMembership, U as DynamicPermissionMatrixConfig, Y as allOf, Z as allowPublic, _ as publicRead, at as requireRoles, b as requireOrgInScope, d as adminOnly, et as denyAll, f as authenticated, g as presets_d_exports, m as ownerWithAdminBypass, nt as requireAuth, p as fullPublic, q as AllowPublicOptions, rt as requireOwnership, st as when, v as publicReadAdminWrite, w as requireServiceScope, x as requireOrgMembership, y as readOnly } from "./index-Bxriq3so.mjs";
8
8
  import { a as NotFoundError, d as ValidationError, f as createDomainError, i as ForbiddenError, t as ArcError, u as UnauthorizedError } from "./errors-JYc9vwqE.mjs";
9
9
  //#region src/index.d.ts
10
- declare const version: string;
10
+ export declare const version: string;
11
11
  //#endregion
12
- export { type AdapterLike, type AggMeasureInput, type AggMeasureShorthand, type AggregationCacheConfig, type AggregationConfig, type AggregationDateRangeRequirement, type AggregationIndexHint, type AggregationMaterializedContext, type AggregationMaterializedResult, type AggregationRateLimit, type AggregationsMap, type AllowPublicOptions, type AnyRecord, type ArcCreateResult, type ArcDeleteResult, ArcError, type ArcGetResult, type ArcInternalMetadata, type ArcListResult, type ArcRequest, type ArcUpdateResult, type AuthPluginOptions, type AuthorizationDecision, BaseController, type BaseControllerOptions, BaseCrudController, type BulkExt, BulkMixin, CRUD_OPERATIONS, type ControllerConfigurableOptions, type ControllerConstructionOptions, type ControllerLike, type CrudController, type CrudOperation, type CrudRouteKey, type CrudRouterOptions, type CrudSchemas, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, type DataPolicy, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type EventDefinition, type FastifyRequestExtras, type FastifyWithAuth, type FastifyWithDecorators, type FieldPermission, type FieldPermissionMap, type FieldRule, ForbiddenError, type GracefulShutdownOptions, HOOK_OPERATIONS, HOOK_PHASES, type HealthCheck, type HealthOptions, type HookOperation, type HookPhase, type IController, type IControllerResponse, type IRequestContext, type InferAdapterDoc, type InferDocType, type InferResourceDoc, type IntrospectionData, type IntrospectionPluginOptions, type JWTPayload, type ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, type MiddlewareConfig, type MutationOperation, type MutationWriteContext, type NativePolicyFilter, NotFoundError, type OwnershipCheck, type PaginationResult, type PermissionCheck, type PermissionContext, type PresetFunction, type PresetResult, type PublicPolicy, type QueryParserInterface, RESERVED_QUERY_PARAMS, type RateLimitConfig, type RawRouteHandler, type RegistryEntry, type RegistryStats, type RequestContext, type RequestIdOptions, type RequestWithExtras, type ResourceConfig, ResourceDefinition, type ResourceMetadata, type ResourceSeams, type ResourceWrites, type RouteHandler, type RouteSchemaOptions, SYSTEM_FIELDS, type SeamedResourceConfig, type ServiceContext, type SlugExt, SlugMixin, type SoftDeleteExt, SoftDeleteMixin, type TreeExt, TreeMixin, UnauthorizedError, type UserBase, type UserOrganization, ValidationError, type WriteContext, type WriteVerbKey, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createOrgPermissions, defineAction, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, mergeResourceConfig, nativePolicyFilter, ownerWithAdminBypass, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };
12
+ export { type AdapterLike, type AggMeasureInput, type AggMeasureShorthand, type AggregationCacheConfig, type AggregationConfig, type AggregationDateRangeRequirement, type AggregationIndexHint, type AggregationMaterializedContext, type AggregationMaterializedResult, type AggregationRateLimit, type AggregationsMap, type AllowPublicOptions, type AnyRecord, type ArcCreateResult, type ArcDeleteResult, ArcError, type ArcGetResult, type ArcInternalMetadata, type ArcListResult, type ArcRequest, type ArcUpdateResult, type AuthPluginOptions, type AuthorizationDecision, BaseController, type BaseControllerOptions, BaseCrudController, type BulkExt, BulkMixin, CRUD_OPERATIONS, type ControllerConfigurableOptions, type ControllerConstructionOptions, type ControllerLike, type CrudController, type CrudOperation, type CrudRouteKey, type CrudRouterOptions, type CrudSchemas, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, type DataPolicy, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type EventDefinition, type FastifyRequestExtras, type FastifyWithAuth, type FastifyWithDecorators, type FieldPermission, type FieldPermissionMap, type FieldRule, ForbiddenError, type GracefulShutdownOptions, HOOK_OPERATIONS, HOOK_PHASES, type HealthCheck, type HealthOptions, type HookOperation, type HookPhase, type IController, type IControllerResponse, type IRequestContext, type InferAdapterDoc, type InferDocType, type InferResourceDoc, type IntrospectionData, type IntrospectionPluginOptions, type JWTPayload, type ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, type MiddlewareConfig, type MutationOperation, type MutationWriteContext, type NativePolicyFilter, NotFoundError, type OwnershipCheck, type PaginationResult, type PermissionCheck, type PermissionContext, type PresetFunction, type PresetResult, type PublicPolicy, type QueryParserInterface, RESERVED_QUERY_PARAMS, type RateLimitConfig, type RawRouteHandler, type RegistryEntry, type RegistryStats, type RequestContext, type RequestIdOptions, type RequestWithExtras, type ResourceConfig, ResourceDefinition, type ResourceMetadata, type ResourceSeams, type ResourceWrites, type RouteHandler, type RouteSchemaOptions, SYSTEM_FIELDS, type SeamedResourceConfig, type ServiceContext, type SlugExt, SlugMixin, type SoftDeleteExt, SoftDeleteMixin, type TreeExt, TreeMixin, UnauthorizedError, type UserBase, type UserOrganization, ValidationError, type WriteContext, type WriteVerbKey, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createOrgPermissions, defineAction, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, mergeResourceConfig, nativePolicyFilter, ownerWithAdminBypass, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, when };
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
2
- import { a as DEFAULT_SORT, d as MAX_FILTER_DEPTH, f as MAX_REGEX_LENGTH, g as SYSTEM_FIELDS, h as RESERVED_QUERY_PARAMS, i as DEFAULT_MAX_LIMIT, l as HOOK_OPERATIONS, m as MUTATION_OPERATIONS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MAX_SEARCH_LENGTH, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as HOOK_PHASES } from "./constants-Cu7Mx7_U.mjs";
3
- import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-CtrywMHP.mjs";
4
- import { S as nativePolicyFilter, c as BaseController, d as SlugMixin, f as BulkMixin, l as TreeMixin, p as BaseCrudController, u as SoftDeleteMixin } from "./plugin-BccET1tL.mjs";
5
- import { t as defineAggregation } from "./defineAggregation-Bm8RjMbq.mjs";
6
- import { i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "./fields-ToPYpMqS.mjs";
7
- import { S as getControllerScope } from "./actionPermissions-BotX1YOa.mjs";
8
- import { a as mergeResourceConfig, i as defineResourceVariants, o as defineAction } from "./core-Cb0LjccA.mjs";
9
- import { a as ResourceDefinition, t as defineResource } from "./defineResource-DIC7JZGU.mjs";
10
- import { B as requireAuth, C as createOrgPermissions, D as requireScopeContext, E as requireOrgRole, F as allowPublic, G as when, I as anyOf, N as allOf, O as requireServiceScope, R as denyAll, S as createDynamicPermissionMatrix, T as requireOrgMembership, U as requireRoles, V as requireOwnership, a as adminOnly, c as ownerWithAdminBypass, d as publicRead, f as publicReadAdminWrite, k as requireTeamMembership, o as authenticated, p as readOnly, s as fullPublic, u as presets_exports, w as requireOrgInScope } from "./permissions-Cm0uYHvd.mjs";
1
+ /*! @classytic/arc v2.45.0 | MIT | https://classytic.com */
2
+ import { a as DEFAULT_SORT, d as MAX_FILTER_DEPTH, f as MAX_REGEX_LENGTH, g as SYSTEM_FIELDS, h as RESERVED_QUERY_PARAMS, i as DEFAULT_MAX_LIMIT, l as HOOK_OPERATIONS, m as MUTATION_OPERATIONS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MAX_SEARCH_LENGTH, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as HOOK_PHASES } from "./constants-B90SnSQn.mjs";
3
+ import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-C9G4A8cN.mjs";
4
+ import { S as nativePolicyFilter, c as BaseController, d as SlugMixin, f as BulkMixin, l as TreeMixin, p as BaseCrudController, u as SoftDeleteMixin } from "./plugin-BDBOS3-c.mjs";
5
+ import { t as defineAggregation } from "./defineAggregation-CwD8_XNd.mjs";
6
+ import { i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "./fields-Da--1DNS.mjs";
7
+ import { S as getControllerScope } from "./actionPermissions-TAc_6LCw.mjs";
8
+ import { a as defineResourceVariants, o as mergeResourceConfig, s as defineAction } from "./core-DV9PSXtr.mjs";
9
+ import { a as ResourceDefinition, t as defineResource } from "./defineResource-CRkhRRSj.mjs";
10
+ import { B as requireAuth, C as createOrgPermissions, D as requireScopeContext, E as requireOrgRole, F as allowPublic, G as when, I as anyOf, N as allOf, O as requireServiceScope, R as denyAll, S as createDynamicPermissionMatrix, T as requireOrgMembership, U as requireRoles, V as requireOwnership, a as adminOnly, c as ownerWithAdminBypass, d as publicRead, f as publicReadAdminWrite, k as requireTeamMembership, o as authenticated, p as readOnly, s as fullPublic, u as presets_exports, w as requireOrgInScope } from "./permissions-IdHJ0_5V.mjs";
11
11
  //#region src/index.ts
12
- const version = "2.43.0";
12
+ const version = "2.45.0";
13
13
  //#endregion
14
14
  export { ArcError, BaseController, BaseCrudController, BulkMixin, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, ForbiddenError, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, NotFoundError, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, SlugMixin, SoftDeleteMixin, TreeMixin, UnauthorizedError, ValidationError, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createOrgPermissions, defineAction, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, mergeResourceConfig, nativePolicyFilter, ownerWithAdminBypass, presets_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.45.0 | MIT | https://classytic.com */
2
2
  import * as fs from "node:fs/promises";
3
3
  import * as path from "node:path";
4
4
  import { dirname, join } from "node:path";
@@ -3,7 +3,7 @@ import { n as DomainEvent } from "../EventTransport-CiicKz2Z.mjs";
3
3
  import { c as WebSocketClient, l as WebSocketMessage } from "../websocket-Cs4awVyD.mjs";
4
4
  import { FastifyPluginAsync, FastifyRequest } from "fastify";
5
5
  //#region src/integrations/event-gateway.d.ts
6
- interface EventGatewayOptions {
6
+ export interface EventGatewayOptions {
7
7
  /** Require auth for all real-time connections (default: true) */
8
8
  auth?: boolean;
9
9
  /** Custom auth function for WebSocket upgrade */
@@ -46,6 +46,5 @@ interface EventGatewayOptions {
46
46
  onDisconnect?: (client: WebSocketClient) => void | Promise<void>;
47
47
  };
48
48
  }
49
- declare const eventGatewayPlugin: FastifyPluginAsync<EventGatewayOptions>;
50
- //#endregion
51
- export { EventGatewayOptions, eventGatewayPlugin };
49
+ export declare const eventGatewayPlugin: FastifyPluginAsync<EventGatewayOptions>;
50
+ //#endregion
@@ -1,11 +1,11 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.45.0 | MIT | https://classytic.com */
2
2
  import fp from "fastify-plugin";
3
3
  //#region src/integrations/event-gateway.ts
4
4
  const eventGatewayPluginImpl = async (fastify, opts = {}) => {
5
5
  const { auth = true, orgScoped, roomPolicy, maxMessageBytes, maxSubscriptionsPerClient, authenticate } = opts;
6
6
  if (auth && !authenticate && !fastify.hasDecorator("authenticate")) throw new Error("[arc-event-gateway] auth is true but fastify.authenticate is not registered. Register an auth plugin first, provide a custom authenticate function, or set auth: false.");
7
7
  if (opts.sse !== false) {
8
- const { default: ssePlugin } = await import("../sse-CYzQBVFe.mjs").then((n) => n.n);
8
+ const { default: ssePlugin } = await import("../sse-D8AgoUN3.mjs").then((n) => n.n);
9
9
  await fastify.register(ssePlugin, {
10
10
  path: opts.sse?.path ?? "/events/stream",
11
11
  requireAuth: auth,
@@ -2,7 +2,7 @@
2
2
  import { c as WebSocketClient, l as WebSocketMessage, u as WebSocketPluginOptions } from "../websocket-Cs4awVyD.mjs";
3
3
  import { EventGatewayOptions } from "./event-gateway.mjs";
4
4
  import { a as JobMeta, c as JobsPluginOptions, i as JobDispatcher, l as QueueStats, n as JobDefinition, r as JobDispatchOptions } from "../index-Chgz3d0i.mjs";
5
- import { _ as ToolDefinition, c as McpAuthResult, d as McpResourceConfig, f as PromptDefinition, g as ToolContext, h as ToolAnnotations, n as CallToolResult, o as CrudOperation, r as CreateMcpServerConfig, t as BetterAuthHandler, u as McpPluginOptions } from "../types-B4Aq4Sdj.mjs";
5
+ import { _ as ToolDefinition, c as McpAuthResult, d as McpResourceConfig, f as PromptDefinition, g as ToolContext, h as ToolAnnotations, n as CallToolResult, o as CrudOperation, r as CreateMcpServerConfig, t as BetterAuthHandler, u as McpPluginOptions } from "../types-D3Ixsh00.mjs";
6
6
  import { StreamlinePluginOptions, WorkflowLike, WorkflowRunLike } from "./streamline.mjs";
7
7
  import { WebhookDeliveryRecord, WebhookManager, WebhookPluginOptions, WebhookStore, WebhookSubscription } from "./webhooks.mjs";
8
8
  export type { BetterAuthHandler, CallToolResult, CreateMcpServerConfig, CrudOperation, EventGatewayOptions, JobDefinition, JobDispatchOptions, JobDispatcher, JobMeta, JobsPluginOptions, McpAuthResult, McpPluginOptions, McpResourceConfig, PromptDefinition, QueueStats, StreamlinePluginOptions, ToolAnnotations, ToolContext, ToolDefinition, WebSocketClient, WebSocketMessage, WebSocketPluginOptions, WebhookDeliveryRecord, WebhookManager, WebhookPluginOptions, WebhookStore, WebhookSubscription, WorkflowLike, WorkflowRunLike };
@@ -1,2 +1,2 @@
1
- /*! @classytic/arc v2.43.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.45.0 | MIT | https://classytic.com */
2
2
  export {};