@classytic/arc 2.28.0 → 2.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +7 -0
  3. package/TRADEMARK.md +22 -0
  4. package/dist/{BaseController-B65zbz9m.mjs → BaseController-De7GqHck.mjs} +25 -24
  5. package/dist/{EventTransport-QmY7A258.d.mts → EventTransport-2uVV34WU.d.mts} +1 -0
  6. package/dist/EventTransport-9mlTgqzE.mjs +104 -0
  7. package/dist/{HookSystem-C1vB_Gc9.mjs → HookSystem-BcmPyq5I.mjs} +16 -35
  8. package/dist/{QueryCache-DOMT_iq7.d.mts → QueryCache-DFA-QrU9.d.mts} +2 -1
  9. package/dist/{ResourceRegistry-y9Hnypus.mjs → ResourceRegistry-qq0mn2s9.mjs} +3 -2
  10. package/dist/{actionPermissions-CAphcmUG.mjs → actionPermissions-BE5NwaQk.mjs} +1 -0
  11. package/dist/audit/index.d.mts +3 -2
  12. package/dist/audit/index.mjs +3 -2
  13. package/dist/auth/audit.d.mts +1 -0
  14. package/dist/auth/audit.mjs +1 -0
  15. package/dist/auth/index.d.mts +5 -4
  16. package/dist/auth/index.mjs +6 -5
  17. package/dist/auth/redis-session.d.mts +2 -1
  18. package/dist/auth/redis-session.mjs +1 -0
  19. package/dist/authorizationDecision-ChvUQGG1.mjs +266 -0
  20. package/dist/{buildHandler-Dtwd8fdz.mjs → buildHandler-CDrCJzmB.mjs} +34 -7
  21. package/dist/cache/index.d.mts +4 -3
  22. package/dist/cache/index.mjs +4 -3
  23. package/dist/{caching-_NJeDd1_.mjs → caching-BFHA6Scf.mjs} +2 -1
  24. package/dist/cleanup/index.d.mts +4 -3
  25. package/dist/cleanup/index.mjs +9 -13
  26. package/dist/cli/commands/describe.d.mts +2 -1
  27. package/dist/cli/commands/describe.mjs +3 -2
  28. package/dist/cli/commands/docs.d.mts +1 -0
  29. package/dist/cli/commands/docs.mjs +3 -2
  30. package/dist/cli/commands/doctor.d.mts +1 -0
  31. package/dist/cli/commands/doctor.mjs +1 -0
  32. package/dist/cli/commands/generate.d.mts +2 -1
  33. package/dist/cli/commands/generate.mjs +2 -1
  34. package/dist/cli/commands/init.d.mts +2 -1
  35. package/dist/cli/commands/init.mjs +2 -1
  36. package/dist/cli/commands/introspect.d.mts +1 -0
  37. package/dist/cli/commands/introspect.mjs +2 -1
  38. package/dist/cli/index.d.mts +3 -2
  39. package/dist/cli/index.mjs +3 -2
  40. package/dist/{constants-DNre0wRg.mjs → constants-D3Dv4LAV.mjs} +1 -0
  41. package/dist/context/index.d.mts +1 -0
  42. package/dist/context/index.mjs +3 -2
  43. package/dist/core/index.d.mts +3 -2
  44. package/dist/core/index.mjs +7 -5
  45. package/dist/{core-BGa8TXJR.mjs → core-BGpIxINN.mjs} +4 -49
  46. package/dist/{createActionRouter-C-N7z2EL.mjs → createActionRouter-CDXEdasl.mjs} +8 -7
  47. package/dist/{createAggregationRouter-wzwFa_dW.mjs → createAggregationRouter-KrQDzx-k.mjs} +10 -22
  48. package/dist/{createApp-Du5G54TM.mjs → createApp-Df89BEni.mjs} +505 -209
  49. package/dist/defineAggregation-DbPPS8RI.mjs +48 -0
  50. package/dist/{defineResource-2zvVVpxg.mjs → defineResource-Bv6EtN1x.mjs} +90 -72
  51. package/dist/discovery/index.d.mts +1 -0
  52. package/dist/discovery/index.mjs +1 -0
  53. package/dist/docs/index.d.mts +3 -2
  54. package/dist/docs/index.mjs +3 -2
  55. package/dist/{elevation-C9s5hFP_.d.mts → elevation-BXCfVcNG.d.mts} +1 -0
  56. package/dist/{elevation-CIz1GjGm.mjs → elevation-D2l1mh4g.mjs} +4 -3
  57. package/dist/encryption/index.d.mts +2 -1
  58. package/dist/encryption/index.mjs +3 -2
  59. package/dist/{errorHandler-Bq2OeEQL.mjs → errorHandler-C5NeD6bT.mjs} +3 -2
  60. package/dist/{errorHandler-C6yv4ZTW.d.mts → errorHandler-CpYUJmPA.d.mts} +1 -0
  61. package/dist/{errors-DHcHVAgk.d.mts → errors-BGdVwP25.d.mts} +1 -0
  62. package/dist/{errors-DkO8Nk6-.mjs → errors-Cj42AntO.mjs} +1 -0
  63. package/dist/{eventPlugin-DrQ_FesK.mjs → eventPlugin-CkffEihm.mjs} +6 -106
  64. package/dist/{eventPlugin-Bg3cP2_u.d.mts → eventPlugin-GF5nnBIq.d.mts} +2 -1
  65. package/dist/events/index.d.mts +4 -3
  66. package/dist/events/index.mjs +17 -340
  67. package/dist/events/transports/redis-stream-entry.d.mts +2 -1
  68. package/dist/events/transports/redis-stream-entry.mjs +1 -0
  69. package/dist/events/transports/redis.d.mts +2 -1
  70. package/dist/events/transports/redis.mjs +1 -0
  71. package/dist/{externalPaths-BE6wFpYv.d.mts → externalPaths-CmGOxOtD.d.mts} +1 -0
  72. package/dist/factory/index.d.mts +9 -5
  73. package/dist/factory/index.mjs +7 -6
  74. package/dist/{fastify-augmentation-OzYGIiU1.d.mts → fastify-augmentation-zh0_AYHa.d.mts} +13 -4
  75. package/dist/{applyPermissionResult-BnyVE9eD.mjs → fields-CB5Cuzk9.mjs} +2 -107
  76. package/dist/{fields-D3lhgzhD.d.mts → fields-I_EeRWND.d.mts} +1 -0
  77. package/dist/{generate-BnsL9GBm.d.mts → generate-DCGuEbqI.d.mts} +1 -0
  78. package/dist/{generate-D0wZupBg.mjs → generate-EcA6ui4i.mjs} +2 -1
  79. package/dist/{headers-BvlQSDMB.mjs → headers-3zvE0rM3.mjs} +2 -1
  80. package/dist/{health-CB_m4S32.mjs → health-DjZYjM7H.mjs} +1 -0
  81. package/dist/hooks/index.d.mts +2 -1
  82. package/dist/hooks/index.mjs +2 -1
  83. package/dist/idempotency/index.d.mts +3 -2
  84. package/dist/idempotency/index.mjs +5 -4
  85. package/dist/idempotency/redis.d.mts +2 -1
  86. package/dist/idempotency/redis.mjs +1 -0
  87. package/dist/{index-CjVg-Epg.d.mts → index-Bc2ox8_U.d.mts} +6 -5
  88. package/dist/{index-CG4yqMDB.d.mts → index-C-481Zf2.d.mts} +74 -18
  89. package/dist/{index-BMnbzvtO.d.mts → index-CEJNZFtX.d.mts} +242 -24
  90. package/dist/index-CFThn1K9.d.mts +224 -0
  91. package/dist/{index-DPRH0Cme.d.mts → index-CpzxqePp.d.mts} +203 -97
  92. package/dist/index.d.mts +9 -8
  93. package/dist/index.mjs +11 -9
  94. package/dist/{init-tlRSt667.mjs → init-BEiNZBsJ.mjs} +19 -23
  95. package/dist/{init-BPEu8cs-.d.mts → init-Cscs4lab.d.mts} +1 -0
  96. package/dist/integrations/event-gateway.d.mts +3 -2
  97. package/dist/integrations/event-gateway.mjs +2 -1
  98. package/dist/integrations/index.d.mts +4 -3
  99. package/dist/integrations/index.mjs +1 -0
  100. package/dist/integrations/jobs/index.d.mts +2 -1
  101. package/dist/integrations/jobs/index.mjs +108 -32
  102. package/dist/integrations/mcp/index.d.mts +9 -9
  103. package/dist/integrations/mcp/index.mjs +2 -1
  104. package/dist/integrations/mcp/testing.d.mts +3 -2
  105. package/dist/integrations/mcp/testing.mjs +2 -2
  106. package/dist/integrations/streamline.d.mts +1 -0
  107. package/dist/integrations/streamline.mjs +3 -2
  108. package/dist/integrations/webhooks.d.mts +1 -0
  109. package/dist/integrations/webhooks.mjs +1 -0
  110. package/dist/integrations/websocket-pushref-redis.d.mts +2 -1
  111. package/dist/integrations/websocket-pushref-redis.mjs +1 -0
  112. package/dist/integrations/websocket-redis.d.mts +2 -1
  113. package/dist/integrations/websocket-redis.mjs +1 -0
  114. package/dist/integrations/websocket.d.mts +3 -2
  115. package/dist/integrations/websocket.mjs +1 -0
  116. package/dist/{interface-BGZCzOGL.d.mts → interface-BOk3YnTz.d.mts} +1 -0
  117. package/dist/{interface-Uk8ONJv7.d.mts → interface-DEWNOMza.d.mts} +1 -0
  118. package/dist/{interface-n5hpKg1d.mjs → interface-DYzM0q-u.mjs} +1 -0
  119. package/dist/{jsonBody-BlzAoGCe.mjs → jsonBody-BYbLDi5D.mjs} +2 -1
  120. package/dist/{keys-Cd316u_y.mjs → keys-C0_pa1tY.mjs} +1 -0
  121. package/dist/{loadResources-DpU8pfjV.mjs → loadResources-yawi9tAE.mjs} +2 -1
  122. package/dist/{loadResourcesFromEntry-kvGT6EcO.mjs → loadResourcesFromEntry-BAjYZonx.mjs} +2 -1
  123. package/dist/logger/index.d.mts +1 -0
  124. package/dist/logger/index.mjs +1 -0
  125. package/dist/{mcpPlugin-Cs6nRGCt.mjs → mcpPlugin-B_es0hiF.mjs} +52 -60
  126. package/dist/{memory-CmnzXE5Z.mjs → memory-DR6wpa9F.mjs} +2 -1
  127. package/dist/{metrics-fdxI5mn_.mjs → metrics-CUdw_wLB.mjs} +2 -1
  128. package/dist/middleware/index.d.mts +2 -1
  129. package/dist/middleware/index.mjs +3 -2
  130. package/dist/migrations/index.d.mts +1 -3
  131. package/dist/migrations/index.mjs +2 -4
  132. package/dist/module-0pFJA6YW.mjs +78 -0
  133. package/dist/{multipartBody-D0eBvkeq.mjs → multipartBody-wOgj_fnj.mjs} +1 -0
  134. package/dist/{openapi-BLV4OMXb.mjs → openapi-B2L4js1v.mjs} +6 -5
  135. package/dist/permissions/index.d.mts +5 -4
  136. package/dist/permissions/index.mjs +6 -4
  137. package/dist/{permissions-BrtiBKGs.mjs → permissions-L--QDAir.mjs} +518 -316
  138. package/dist/{pipe-BOLmGIxa.mjs → pipe-DRDNsI2T.mjs} +2 -1
  139. package/dist/pipeline/index.d.mts +2 -1
  140. package/dist/pipeline/index.mjs +2 -1
  141. package/dist/{pipeline-BGRnV-To.mjs → pipeline-UPQFatit.mjs} +7 -20
  142. package/dist/plugins/index.d.mts +8 -7
  143. package/dist/plugins/index.mjs +16 -15
  144. package/dist/plugins/response-cache.d.mts +1 -0
  145. package/dist/plugins/response-cache.mjs +2 -1
  146. package/dist/plugins/tracing-entry.d.mts +2 -1
  147. package/dist/plugins/tracing-entry.mjs +2 -1
  148. package/dist/{pluralize-BhrgwZb9.mjs → pluralize-O0FZgESl.mjs} +1 -0
  149. package/dist/{preloadResources-CM4uUaFv.d.mts → preloadResources-CyoJMSiO.d.mts} +117 -12
  150. package/dist/{preloadResources-DSY5HGpS.mjs → preloadResources-Dz6BjzM6.mjs} +1 -0
  151. package/dist/presets/filesUpload.d.mts +6 -5
  152. package/dist/presets/filesUpload.mjs +9 -11
  153. package/dist/presets/index.d.mts +15 -2
  154. package/dist/presets/index.mjs +2 -1
  155. package/dist/presets/multiTenant.d.mts +2 -1
  156. package/dist/presets/multiTenant.mjs +3 -2
  157. package/dist/presets/search.d.mts +3 -2
  158. package/dist/presets/search.mjs +2 -1
  159. package/dist/{presets-DwFDVKP0.mjs → presets-C4-g4_4P.mjs} +27 -10
  160. package/dist/projection-BHw6xlOQ.mjs +18 -0
  161. package/dist/{pushref-registry-BbcnpNTm.d.mts → pushref-registry-Dov9l4qE.d.mts} +1 -0
  162. package/dist/{queryCachePlugin-DSGuSVLW.mjs → queryCachePlugin-BZr8v46E.mjs} +5 -4
  163. package/dist/{queryCachePlugin-br4otiqF.d.mts → queryCachePlugin-BzqxconG.d.mts} +3 -2
  164. package/dist/{rateLimit-DrED-C4v.mjs → rateLimit-CMPY5Qms.mjs} +7 -3
  165. package/dist/{rateLimitKey-BoWRH3e7.mjs → rateLimitKey-Dn5JNmkj.mjs} +1 -0
  166. package/dist/{realtime-DEuDu9io.mjs → realtime-C5NoxWFY.mjs} +20 -8
  167. package/dist/{redis-UDtLaNj6.d.mts → redis-CduhKsJi.d.mts} +2 -1
  168. package/dist/{redis-stream-uIaauNpZ.d.mts → redis-stream-qN6A-RFv.d.mts} +2 -1
  169. package/dist/{registerRoute-DTp18Ah_.mjs → registerRoute-CBN84fc7.mjs} +5 -2
  170. package/dist/registry/index.d.mts +3 -2
  171. package/dist/registry/index.mjs +3 -2
  172. package/dist/{registry-9km_w1aP.mjs → registry-4213U4zb.mjs} +3 -2
  173. package/dist/{renewingLease-3cuQH7h8.mjs → renewingLease-Dll8mGgc.mjs} +1 -0
  174. package/dist/{replyHelpers-67tRawQZ.mjs → replyHelpers-DIiZKGUt.mjs} +2 -1
  175. package/dist/repositoryFilter-f9eAfq_l.mjs +45 -0
  176. package/dist/{requestContext-MrlJwECf.mjs → requestContext-2TxXOJ7T.mjs} +1 -0
  177. package/dist/{rolldown-runtime-8H4AJuhK.mjs → rolldown-runtime-CUsjNX9R.mjs} +1 -0
  178. package/dist/{schedules-CjOd2MG9.mjs → schedules-DdtlICTf.mjs} +3 -2
  179. package/dist/{schemaConverter-DJvodiHj.mjs → schemaConverter-D--wdJM-.mjs} +70 -17
  180. package/dist/{schemaIR-Ca7ySNPx.mjs → schemaIR-Bm2enbnh.mjs} +2 -1
  181. package/dist/schemas/index.d.mts +1 -0
  182. package/dist/schemas/index.mjs +1 -0
  183. package/dist/scim/index.d.mts +1 -0
  184. package/dist/scim/index.mjs +2 -1
  185. package/dist/scope/index.d.mts +3 -2
  186. package/dist/scope/index.mjs +5 -4
  187. package/dist/{scope-DfaPntpo.mjs → scope-DHx5Fous.mjs} +4 -3
  188. package/dist/{sessionManager-BHOM3N_0.d.mts → sessionManager-qimlKV0P.d.mts} +1 -0
  189. package/dist/{simpleEqualityMatcher-Cg05HPsn.mjs → simpleEqualityMatcher-DjQJ7FKA.mjs} +1 -0
  190. package/dist/{sse-BQ1w0dfl.mjs → sse-CUTo9y0X.mjs} +5 -4
  191. package/dist/{sseStream-BQ7Qaynp.mjs → sseStream-B_5XcVVd.mjs} +2 -1
  192. package/dist/{storage-DLUZ04kK.d.mts → storage-Cx9Sz3Ou.d.mts} +1 -0
  193. package/dist/{store-helpers-DY6xq4sM.mjs → store-helpers-D1MP_gRG.mjs} +1 -0
  194. package/dist/{streaming-BQcW6_Kq.mjs → streaming-PSZwi8JV.mjs} +1 -0
  195. package/dist/subscribe-helpers-C0Tb2aUp.mjs +340 -0
  196. package/dist/sync/changelog.d.mts +1 -0
  197. package/dist/sync/changelog.mjs +1 -0
  198. package/dist/testing/cleanupStoreContract.d.mts +2 -1
  199. package/dist/testing/cleanupStoreContract.mjs +1 -0
  200. package/dist/testing/index.d.mts +167 -12
  201. package/dist/testing/index.mjs +522 -205
  202. package/dist/testing/outboxStoreContract.d.mts +1 -0
  203. package/dist/testing/outboxStoreContract.mjs +1 -0
  204. package/dist/testing/storageContract.d.mts +2 -1
  205. package/dist/testing/storageContract.mjs +1 -0
  206. package/dist/{tracing-CsGKQJGg.d.mts → tracing-Dro5eH6j.d.mts} +1 -0
  207. package/dist/{transactionContext-PNdoyLLm.mjs → transactionContext-dAfBVUrk.mjs} +1 -0
  208. package/dist/{typeGuards-C9KXUly6.mjs → typeGuards-B0ryPo3I.mjs} +1 -0
  209. package/dist/types/index.d.mts +6 -5
  210. package/dist/types/index.mjs +1 -0
  211. package/dist/types/storage.d.mts +2 -1
  212. package/dist/types/storage.mjs +1 -0
  213. package/dist/{types-Dmw-6Qeo.d.mts → types-B7XeLEgK.d.mts} +127 -90
  214. package/dist/{types-Cc91nXuA.d.mts → types-ByHn9rEO.d.mts} +1 -0
  215. package/dist/{types-C_ZZRcD6.d.mts → types-C4QE8qnm.d.mts} +1 -0
  216. package/dist/{types-Cu6vVJmh.d.mts → types-CBgvkp8O.d.mts} +82 -12
  217. package/dist/{types-DjC-KUCz.d.mts → types-ChuShpCP.d.mts} +1 -0
  218. package/dist/{types-QFGc3Cjv.d.mts → types-CwcUQ610.d.mts} +2 -6
  219. package/dist/{types-CSyCxl2V.mjs → types-Cys0ko9Z.mjs} +4 -3
  220. package/dist/usage/index.d.mts +3 -2
  221. package/dist/usage/index.mjs +0 -0
  222. package/dist/{userHelpers-Cg_y3fBz.mjs → userHelpers-ChYJ6CdK.mjs} +1 -0
  223. package/dist/utils/index.d.mts +16 -10
  224. package/dist/utils/index.mjs +10 -9
  225. package/dist/{utils-taUVD4p3.mjs → utils-vL8BrDE2.mjs} +3 -2
  226. package/dist/{validate-Bk44F2yT.mjs → validate-_KbifpHF.mjs} +2 -1
  227. package/dist/{versioning-gKWyryT3.mjs → versioning-CHDTor3P.mjs} +3 -2
  228. package/dist/{versioning-DXgY5BUm.d.mts → versioning-D_rhHfZm.d.mts} +5 -2
  229. package/dist/{websocket-_Pd0CgR0.d.mts → websocket-BOXVggMf.d.mts} +2 -1
  230. package/package.json +15 -7
  231. package/skills/arc/SKILL.md +22 -8
  232. package/skills/arc/references/api-reference.md +4 -0
  233. package/skills/arc/references/auth.md +3 -0
  234. package/skills/arc/references/integrations.md +33 -0
  235. package/skills/arc/references/mcp.md +6 -7
  236. package/skills/arc/references/production.md +24 -25
  237. package/skills/arc-code-review/references/anti-patterns.md +3 -3
  238. package/dist/index-CZY4EGga.d.mts +0 -107
  239. package/dist/module-_-M7C5ES.mjs +0 -29
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Classytic
3
+ Copyright (c) 2025 Classytic LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -324,3 +324,10 @@ arc doctor # diagnose env
324
324
  ## License
325
325
 
326
326
  MIT
327
+
328
+
329
+ ## Trademark
330
+
331
+ The code is MIT-licensed. **"Classytic", "arc", and the logos are trademarks of
332
+ Classytic LLC** and are **not** licensed under MIT — see [TRADEMARK.md](TRADEMARK.md).
333
+ Forks must be renamed; the license covers the code, not the brand.
package/TRADEMARK.md ADDED
@@ -0,0 +1,22 @@
1
+ # Trademark Notice
2
+
3
+ The **source code** in this package is licensed under the MIT License (see
4
+ [LICENSE](LICENSE)). Trademarks are **not** part of that license.
5
+
6
+ **"Classytic", "arc", the Classytic and arc logos**, and related names and marks
7
+ are trademarks of **Classytic LLC** (Wyoming, USA). The MIT License covers the
8
+ code only — it grants **no right** to use Classytic LLC's names, logos, or brand.
9
+
10
+ ## You may
11
+ - use, fork, modify, and redistribute the **code** under the MIT License;
12
+ - state truthfully that your product "uses" or "is built on" arc / Classytic
13
+ software, without implying endorsement.
14
+
15
+ ## You may not (without written permission from Classytic LLC)
16
+ - use "Classytic", "arc", or confusingly similar names as the name of your own
17
+ product, package, company, or service;
18
+ - use the Classytic / arc logos or brand styling;
19
+ - imply sponsorship, affiliation, or endorsement by Classytic LLC.
20
+
21
+ Forks or redistributions must be **renamed** so they are not confused with the
22
+ official project. Permission / questions: **trademark@classytic.com**.
@@ -1,12 +1,15 @@
1
- import { h as SYSTEM_FIELDS, o as DEFAULT_TENANT_FIELD } from "./constants-DNre0wRg.mjs";
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
2
+ import { h as SYSTEM_FIELDS, o as DEFAULT_TENANT_FIELD } from "./constants-D3Dv4LAV.mjs";
2
3
  import { arcLog } from "./logger/index.mjs";
3
- import { d as createDomainError, f as createError, i as NotFoundError, p as isArcError, r as ForbiddenError } from "./errors-DkO8Nk6-.mjs";
4
- import { n as getUserRoles, t as getUserId } from "./userHelpers-Cg_y3fBz.mjs";
5
- import { b as isElevated, c as getOrgId, n as PUBLIC_SCOPE, x as isMember } from "./types-CSyCxl2V.mjs";
6
- import { t as simpleEqualityMatcher } from "./simpleEqualityMatcher-Cg05HPsn.mjs";
7
- import { a as applyFieldWritePermissions, s as resolveEffectiveRoles } from "./applyPermissionResult-BnyVE9eD.mjs";
8
- import { g as ArcQueryParser, n as scheduleBackground } from "./utils-taUVD4p3.mjs";
9
- import { t as buildQueryKey } from "./keys-Cd316u_y.mjs";
4
+ import { a as conjoinPolicyFilters } from "./authorizationDecision-ChvUQGG1.mjs";
5
+ import { d as createDomainError, f as createError, i as NotFoundError, p as isArcError, r as ForbiddenError } from "./errors-Cj42AntO.mjs";
6
+ import { n as getUserRoles, t as getUserId } from "./userHelpers-ChYJ6CdK.mjs";
7
+ import { b as isElevated, c as getOrgId, n as PUBLIC_SCOPE, x as isMember } from "./types-Cys0ko9Z.mjs";
8
+ import { t as simpleEqualityMatcher } from "./simpleEqualityMatcher-DjQJ7FKA.mjs";
9
+ import { t as toRepositoryFilter } from "./repositoryFilter-f9eAfq_l.mjs";
10
+ import { i as resolveEffectiveRoles, n as applyFieldWritePermissions } from "./fields-CB5Cuzk9.mjs";
11
+ import { g as ArcQueryParser, n as scheduleBackground } from "./utils-vL8BrDE2.mjs";
12
+ import { t as buildQueryKey } from "./keys-C0_pa1tY.mjs";
10
13
  //#region src/core/AccessControl.ts
11
14
  const log$1 = arcLog("access-control");
12
15
  var AccessControl = class {
@@ -31,14 +34,14 @@ var AccessControl = class {
31
34
  * Combines ID filter with policy/org filters for proper security enforcement
32
35
  */
33
36
  buildIdFilter(id, req) {
34
- const filter = { [this.idField]: id };
37
+ let filter = { [this.idField]: id };
35
38
  const arcContext = this._meta(req);
36
39
  const policyFilters = arcContext?._policyFilters;
37
- if (policyFilters) Object.assign(filter, policyFilters);
40
+ if (policyFilters) filter = conjoinPolicyFilters(filter, policyFilters);
38
41
  const scope = arcContext?._scope;
39
42
  const orgId = scope ? getOrgId(scope) : void 0;
40
- if (this.tenantField && orgId && !policyFilters?.[this.tenantField]) filter[this.tenantField] = orgId;
41
- return filter;
43
+ if (this.tenantField && orgId) filter = conjoinPolicyFilters(filter, { [this.tenantField]: orgId });
44
+ return toRepositoryFilter(filter);
42
45
  }
43
46
  /**
44
47
  * Check if a post-fetch item matches the request's `_policyFilters`.
@@ -110,9 +113,9 @@ var AccessControl = class {
110
113
  checkOwnership(item, req) {
111
114
  const ownershipCheck = this._meta(req)?._ownershipCheck;
112
115
  if (!item || !ownershipCheck) return true;
113
- const { field, userId } = ownershipCheck;
116
+ const { field, userId, missingOwner } = ownershipCheck;
114
117
  const itemOwnerId = item[field];
115
- if (!itemOwnerId) return true;
118
+ if (!itemOwnerId) return missingOwner === "allow";
116
119
  return String(itemOwnerId) === String(userId);
117
120
  }
118
121
  /**
@@ -670,12 +673,12 @@ var QueryResolver = class {
670
673
  const page = parsed.after ? void 0 : parsed.page ? Math.max(1, parsed.page) : 1;
671
674
  const sortString = parsed.sort ? Object.entries(parsed.sort).map(([k, v]) => v === -1 ? `-${k}` : k).join(",") : this.defaultSort;
672
675
  const rawSelect = parsed.select ?? req.query?.select;
673
- const filters = { ...parsed.filters };
674
676
  const policyFilters = arcContext?._policyFilters;
675
- if (policyFilters) Object.assign(filters, policyFilters);
677
+ let filters = conjoinPolicyFilters(parsed.filters, policyFilters);
676
678
  const scope = arcContext?._scope;
677
679
  const orgId = scope ? getOrgId(scope) : void 0;
678
- if (this.tenantField && orgId && !policyFilters?.[this.tenantField]) filters[this.tenantField] = orgId;
680
+ if (this.tenantField && orgId && !policyFilters?.[this.tenantField]) filters = conjoinPolicyFilters(filters, { [this.tenantField]: orgId });
681
+ const portableFilters = toRepositoryFilter(filters);
679
682
  return {
680
683
  page,
681
684
  limit,
@@ -684,7 +687,7 @@ var QueryResolver = class {
684
687
  populate: this.sanitizePopulate(parsed.populate, this.schemaOptions),
685
688
  populateOptions: this.sanitizePopulateOptions(parsed.populateOptions, this.schemaOptions),
686
689
  lookups: this.sanitizeLookups(parsed.lookups, this.schemaOptions),
687
- filters,
690
+ filters: portableFilters,
688
691
  search: parsed.search,
689
692
  after: parsed.after,
690
693
  user: req.user,
@@ -800,7 +803,7 @@ var BaseCrudController = class {
800
803
  /**
801
804
  * Composable access control (ID filtering, policy checks, org scope, ownership).
802
805
  *
803
- * Not `readonly` since 2.15.0 — `configure()` rebuilds it when the host
806
+ * Not `readonly` — `configure()` rebuilds it when the host
804
807
  * supplies tenant/idField/matchesFilter post-construction. Same model as
805
808
  * `queryResolver` after `setQueryParser` shipped in 2.10.9.
806
809
  */
@@ -808,7 +811,7 @@ var BaseCrudController = class {
808
811
  /**
809
812
  * Composable body sanitization (field permissions, system fields).
810
813
  *
811
- * Not `readonly` since 2.15.0 — `configure()` rebuilds it when the host
814
+ * Not `readonly` — `configure()` rebuilds it when the host
812
815
  * supplies schemaOptions/onFieldWriteDenied post-construction.
813
816
  */
814
817
  bodySanitizer;
@@ -1486,10 +1489,8 @@ function BulkMixin(Base) {
1486
1489
  * Returns the merged filter, or `null` when access must be denied.
1487
1490
  */
1488
1491
  buildBulkFilter(userFilter, req) {
1489
- const filter = { ...userFilter };
1490
1492
  const arcContext = this.meta(req);
1491
- const policyFilters = arcContext?._policyFilters;
1492
- if (policyFilters) Object.assign(filter, policyFilters);
1493
+ let filter = conjoinPolicyFilters(userFilter, arcContext?._policyFilters);
1493
1494
  if (this.tenantField) {
1494
1495
  const scope = arcContext?._scope;
1495
1496
  if (!scope) return filter;
@@ -1497,7 +1498,7 @@ function BulkMixin(Base) {
1497
1498
  if (isElevated(scope)) return filter;
1498
1499
  const orgId = getOrgId(scope);
1499
1500
  if (!orgId) return null;
1500
- filter[this.tenantField] = orgId;
1501
+ filter = conjoinPolicyFilters(filter, { [this.tenantField]: orgId });
1501
1502
  }
1502
1503
  return filter;
1503
1504
  }
@@ -1,3 +1,4 @@
1
+
1
2
  import { DeadLetteredEvent, DomainEvent, DomainEvent as DomainEvent$1, EventHandler, EventHandler as EventHandler$1, EventLogger, EventLogger as EventLogger$1, EventTransport, EventTransport as EventTransport$1, PublishManyResult } from "@classytic/primitives/events";
2
3
  //#region src/events/EventTransport.d.ts
3
4
  interface MemoryEventTransportOptions {
@@ -0,0 +1,104 @@
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
2
+ import { createEvent, matchEventPattern } from "@classytic/primitives/events";
3
+ //#region src/events/EventTransport.ts
4
+ /**
5
+ * Internal arc events module — concrete in-memory transport.
6
+ *
7
+ * **Public type contracts moved out (arc 2.12).** `EventMeta`, `DomainEvent`,
8
+ * `EventHandler`, `EventLogger`, `EventTransport`, `DeadLetteredEvent`,
9
+ * `PublishManyResult`, plus the `createEvent` / `createChildEvent` /
10
+ * `matchEventPattern` helpers, are now owned by `@classytic/primitives/events`.
11
+ * Two reasons:
12
+ *
13
+ * 1. The shapes ARE the cross-package contract. arc, arc-next, mongokit's
14
+ * audit-log plugin, future kits and downstream services all share them.
15
+ * Owning them in `primitives` (pure types, zero runtime, zero deps)
16
+ * eliminates the "manually mirror in two places" problem the previous
17
+ * `primitives/src/events.ts` header explicitly called out.
18
+ * 2. Inverting the dependency direction lets future packages (sqlitekit
19
+ * audit, billing services) consume the contract without depending on
20
+ * arc's HTTP-coupled stack.
21
+ *
22
+ * Hosts MUST import the types from primitives directly:
23
+ *
24
+ * ```typescript
25
+ * import type {
26
+ * EventMeta, DomainEvent, EventHandler, EventTransport,
27
+ * DeadLetteredEvent, PublishManyResult,
28
+ * } from '@classytic/primitives/events';
29
+ * import { createEvent, createChildEvent } from '@classytic/primitives/events';
30
+ * ```
31
+ *
32
+ * arc's `events/index.ts` barrel does NOT re-export these — by design, so
33
+ * that consumer code is forced into the canonical import path and the org's
34
+ * "no re-exports" rule holds at every public surface.
35
+ *
36
+ * What stays here:
37
+ * - `MemoryEventTransport` — the in-memory `EventTransport` implementation
38
+ * used as arc's default transport. Its handler-set state is process-local;
39
+ * wrong layer for primitives.
40
+ * - `MemoryEventTransportOptions` — its options shape.
41
+ *
42
+ * Inside arc, files that previously imported types from `./EventTransport.js`
43
+ * keep working: this file re-exports them from primitives for arc's own
44
+ * call sites. That re-export is an internal refactor convenience — the
45
+ * public `events/index.ts` barrel stays clean.
46
+ */
47
+ /**
48
+ * In-memory event transport (default).
49
+ *
50
+ * Events are delivered synchronously within the process. Not suitable for
51
+ * multi-instance deployments — pair with `RedisEventTransport` /
52
+ * `RedisStreamTransport` (subpath imports) for those.
53
+ */
54
+ var MemoryEventTransport = class {
55
+ name = "memory";
56
+ handlers = /* @__PURE__ */ new Map();
57
+ logger;
58
+ constructor(options) {
59
+ this.logger = options?.logger ?? console;
60
+ }
61
+ async publish(event) {
62
+ const allHandlers = /* @__PURE__ */ new Set();
63
+ for (const [pattern, handlers] of this.handlers) if (matchEventPattern(pattern, event.type)) for (const h of handlers) allHandlers.add(h);
64
+ for (const handler of allHandlers) try {
65
+ await handler(event);
66
+ } catch (err) {
67
+ this.logger.error(`[EventTransport] Handler error for ${event.type}:`, err);
68
+ }
69
+ }
70
+ /**
71
+ * Reference `publishMany` implementation — delegates to `publish()` in order.
72
+ *
73
+ * Production transports (Kafka, Redis pipeline, SQS batch) should override
74
+ * this with a single batched network call. Memory transport has nothing to
75
+ * batch, so we just loop — the loop still returns a proper result map so
76
+ * `EventOutbox.relay` can exercise the batched code path in tests.
77
+ */
78
+ async publishMany(events) {
79
+ const results = /* @__PURE__ */ new Map();
80
+ for (const event of events) try {
81
+ await this.publish(event);
82
+ results.set(event.meta.id, null);
83
+ } catch (err) {
84
+ results.set(event.meta.id, err instanceof Error ? err : new Error(String(err)));
85
+ }
86
+ return results;
87
+ }
88
+ async subscribe(pattern, handler) {
89
+ if (!this.handlers.has(pattern)) this.handlers.set(pattern, /* @__PURE__ */ new Set());
90
+ this.handlers.get(pattern)?.add(handler);
91
+ return () => {
92
+ const set = this.handlers.get(pattern);
93
+ if (set) {
94
+ set.delete(handler);
95
+ if (set.size === 0) this.handlers.delete(pattern);
96
+ }
97
+ };
98
+ }
99
+ async close() {
100
+ this.handlers.clear();
101
+ }
102
+ };
103
+ //#endregion
104
+ export { createEvent as n, MemoryEventTransport as t };
@@ -1,4 +1,16 @@
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
2
+ import { t as buildRequestScopeProjection } from "./projection-BHw6xlOQ.mjs";
1
3
  //#region src/hooks/HookSystem.ts
4
+ /**
5
+ * Hook System
6
+ *
7
+ * Lifecycle hooks for resource operations.
8
+ * Allows intercepting and modifying data at various points.
9
+ */
10
+ /** Lift the validated scope out of the request context (undefined when unscoped). */
11
+ function scopeOf(context) {
12
+ return buildRequestScopeProjection(context?._scope);
13
+ }
2
14
  var HookSystem = class {
3
15
  hooks;
4
16
  logger;
@@ -9,16 +21,10 @@ var HookSystem = class {
9
21
  this.logger = options?.logger ?? { error: noop };
10
22
  this.warn = options?.logger?.warn ?? noop;
11
23
  }
12
- /**
13
- * Generate hook key
14
- */
15
24
  getKey(resource, operation, phase) {
16
25
  return `${resource}:${operation}:${phase}`;
17
26
  }
18
- /**
19
- * Register a hook
20
- * Supports both object parameter and positional arguments
21
- */
27
+ /** Supports both the object-parameter and positional argument forms. */
22
28
  register(resourceOrOptions, operation, phase, handler, priority = 10) {
23
29
  let hookName;
24
30
  let resource;
@@ -63,15 +69,9 @@ var HookSystem = class {
63
69
  if (idx !== -1) hooks.splice(idx, 1);
64
70
  };
65
71
  }
66
- /**
67
- * Register before hook
68
- */
69
72
  before(resource, operation, handler, priority = 10) {
70
73
  return this.register(resource, operation, "before", handler, priority);
71
74
  }
72
- /**
73
- * Register after hook
74
- */
75
75
  after(resource, operation, handler, priority = 10) {
76
76
  return this.register(resource, operation, "after", handler, priority);
77
77
  }
@@ -105,6 +105,7 @@ var HookSystem = class {
105
105
  data,
106
106
  user: options?.user,
107
107
  context: options?.context,
108
+ scope: scopeOf(options?.context),
108
109
  meta: options?.meta
109
110
  };
110
111
  return hook.handler(ctx, next);
@@ -113,9 +114,6 @@ var HookSystem = class {
113
114
  };
114
115
  return next();
115
116
  }
116
- /**
117
- * Execute hooks for a given context
118
- */
119
117
  async execute(ctx) {
120
118
  const key = this.getKey(ctx.resource, ctx.operation, ctx.phase);
121
119
  const hooks = this.hooks.get(key) ?? [];
@@ -133,6 +131,7 @@ var HookSystem = class {
133
131
  result: ctx.result,
134
132
  user: ctx.user,
135
133
  context: ctx.context,
134
+ scope: ctx.scope ?? scopeOf(ctx.context),
136
135
  meta: ctx.meta
137
136
  };
138
137
  const hookResult = await hook.handler(handlerContext);
@@ -140,9 +139,6 @@ var HookSystem = class {
140
139
  }
141
140
  return result;
142
141
  }
143
- /**
144
- * Execute before hooks
145
- */
146
142
  async executeBefore(resource, operation, data, options) {
147
143
  return await this.execute({
148
144
  resource,
@@ -154,10 +150,7 @@ var HookSystem = class {
154
150
  meta: options?.meta
155
151
  }) ?? data;
156
152
  }
157
- /**
158
- * Execute after hooks
159
- * Errors in after hooks are logged but don't fail the request
160
- */
153
+ /** Errors in after hooks are logged but never fail the request. */
161
154
  async executeAfter(resource, operation, result, options) {
162
155
  try {
163
156
  await this.execute({
@@ -226,17 +219,11 @@ var HookSystem = class {
226
219
  }
227
220
  return result;
228
221
  }
229
- /**
230
- * Get all registered hooks
231
- */
232
222
  getAll() {
233
223
  const all = [];
234
224
  for (const hooks of this.hooks.values()) all.push(...hooks);
235
225
  return all;
236
226
  }
237
- /**
238
- * Get hooks for a specific resource
239
- */
240
227
  getForResource(resource) {
241
228
  const all = [];
242
229
  for (const [key, hooks] of this.hooks.entries()) if (key.startsWith(`${resource}:`)) all.push(...hooks);
@@ -298,15 +285,9 @@ var HookSystem = class {
298
285
  const key = this.getKey(resource, operation, phase);
299
286
  return (this.hooks.get(key)?.length ?? 0) > 0;
300
287
  }
301
- /**
302
- * Clear all hooks
303
- */
304
288
  clear() {
305
289
  this.hooks.clear();
306
290
  }
307
- /**
308
- * Clear hooks for a specific resource
309
- */
310
291
  clearResource(resource) {
311
292
  for (const key of this.hooks.keys()) if (key.startsWith(`${resource}:`)) this.hooks.delete(key);
312
293
  }
@@ -1,4 +1,5 @@
1
- import { r as CacheStore } from "./interface-BGZCzOGL.mjs";
1
+
2
+ import { r as CacheStore } from "./interface-BOk3YnTz.mjs";
2
3
  //#region src/cache/QueryCache.d.ts
3
4
  /** Metadata wrapper stored in CacheStore */
4
5
  interface CacheEnvelope<T = unknown> {
@@ -1,4 +1,5 @@
1
- import "./constants-DNre0wRg.mjs";
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
2
+ import "./constants-D3Dv4LAV.mjs";
2
3
  //#region src/registry/ResourceRegistry.ts
3
4
  /**
4
5
  * Resource Registry
@@ -59,7 +60,7 @@ var ResourceRegistry = class {
59
60
  summary: r.summary,
60
61
  description: r.description,
61
62
  permissions: r.permissions,
62
- raw: r.raw,
63
+ raw: r.rawHandler !== void 0,
63
64
  schema: r.schema
64
65
  })),
65
66
  events: Object.keys(resource.events ?? {}),
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
1
2
  //#region src/core/actionPermissions.ts
2
3
  /**
3
4
  * Return the effective `PermissionCheck` for a single action, or `undefined`
@@ -1,5 +1,6 @@
1
- import "../index-DPRH0Cme.mjs";
2
- import { i as UserBase } from "../types-Dmw-6Qeo.mjs";
1
+
2
+ import "../index-CpzxqePp.mjs";
3
+ import { a as UserBase } from "../types-B7XeLEgK.mjs";
3
4
  import { FastifyPluginAsync } from "fastify";
4
5
  import { RepositoryLike } from "@classytic/repo-core/adapter";
5
6
  //#region src/audit/stores/interface.d.ts
@@ -1,6 +1,7 @@
1
- import { t as transactionContext } from "../transactionContext-PNdoyLLm.mjs";
2
- import fp from "fastify-plugin";
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
2
+ import { t as transactionContext } from "../transactionContext-dAfBVUrk.mjs";
3
3
  import { and, anyOf, eq, gte, lt, lte } from "@classytic/repo-core/filter";
4
+ import fp from "fastify-plugin";
4
5
  //#region src/audit/repository-audit-adapter.ts
5
6
  function repositoryAsAuditStore(repository, options = {}) {
6
7
  const idField = repository.idField ?? "_id";
@@ -1,3 +1,4 @@
1
+
1
2
  import { FastifyInstance } from "fastify";
2
3
  //#region src/auth/audit.d.ts
3
4
  /**
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
1
2
  //#region src/auth/audit.ts
2
3
  function compileGlobs(patterns) {
3
4
  if (patterns.length === 0) return () => false;
@@ -1,7 +1,8 @@
1
- import { Ht as AuthHelpers, Ut as AuthPluginOptions } from "../index-DPRH0Cme.mjs";
2
- import { t as PermissionCheck } from "../types-Dmw-6Qeo.mjs";
3
- import { t as ExternalOpenApiPaths } from "../externalPaths-BE6wFpYv.mjs";
4
- import { a as SessionManagerOptions, c as createSessionManager, i as SessionData, n as MemorySessionStoreOptions, o as SessionManagerResult, r as SessionCookieOptions, s as SessionStore, t as MemorySessionStore } from "../sessionManager-BHOM3N_0.mjs";
1
+
2
+ import { Ut as AuthHelpers, Wt as AuthPluginOptions } from "../index-CpzxqePp.mjs";
3
+ import { r as PermissionCheck } from "../types-B7XeLEgK.mjs";
4
+ import { t as ExternalOpenApiPaths } from "../externalPaths-CmGOxOtD.mjs";
5
+ import { a as SessionManagerOptions, c as createSessionManager, i as SessionData, n as MemorySessionStoreOptions, o as SessionManagerResult, r as SessionCookieOptions, s as SessionStore, t as MemorySessionStore } from "../sessionManager-qimlKV0P.mjs";
5
6
  import { FastifyPluginAsync, FastifyReply as FastifyReply$1, FastifyRequest } from "fastify";
6
7
  //#region src/auth/authPlugin.d.ts
7
8
  declare module "fastify" {
@@ -1,8 +1,9 @@
1
- import { d as createDomainError, l as UnauthorizedError, p as isArcError, t as ArcError } from "../errors-DkO8Nk6-.mjs";
2
- import { n as requireSingleHeaderValue } from "../headers-BvlQSDMB.mjs";
3
- import { n as getUserRoles, r as normalizeRoles } from "../userHelpers-Cg_y3fBz.mjs";
4
- import { o as toJsonSchema } from "../schemaConverter-DJvodiHj.mjs";
5
- import { _ as requireOrgMembership, v as requireOrgRole, x as requireTeamMembership } from "../permissions-BrtiBKGs.mjs";
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
2
+ import { d as createDomainError, l as UnauthorizedError, p as isArcError, t as ArcError } from "../errors-Cj42AntO.mjs";
3
+ import { n as requireSingleHeaderValue } from "../headers-3zvE0rM3.mjs";
4
+ import { n as getUserRoles, r as normalizeRoles } from "../userHelpers-ChYJ6CdK.mjs";
5
+ import { o as toJsonSchema } from "../schemaConverter-D--wdJM-.mjs";
6
+ import { S as requireOrgRole, T as requireTeamMembership, x as requireOrgMembership } from "../permissions-L--QDAir.mjs";
6
7
  import { createHmac, randomUUID, timingSafeEqual } from "node:crypto";
7
8
  import fp from "fastify-plugin";
8
9
  //#region src/auth/authPlugin.ts
@@ -1,4 +1,5 @@
1
- import { i as SessionData, s as SessionStore } from "../sessionManager-BHOM3N_0.mjs";
1
+
2
+ import { i as SessionData, s as SessionStore } from "../sessionManager-qimlKV0P.mjs";
2
3
  //#region src/auth/redis-session.d.ts
3
4
  /** Minimal Redis client interface — compatible with ioredis */
4
5
  interface RedisLike {
@@ -1,3 +1,4 @@
1
+ /*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
1
2
  import sjson from "secure-json-parse";
2
3
  //#region src/auth/redis-session.ts
3
4
  /**