@classytic/arc 2.45.1 → 2.46.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.
- package/README.md +1 -1
- package/dist/{EventTransport-CiicKz2Z.d.mts → EventTransport-CYEoCJGe.d.mts} +0 -2
- package/dist/{EventTransport-4b0noGwa.mjs → EventTransport-DNgD9NP4.mjs} +3 -4
- package/dist/{HookSystem-4pABQnGn.mjs → HookSystem-DRbPzEcP.mjs} +3 -4
- package/dist/{QueryCache--5uAuYPW.d.mts → QueryCache-DdvrGG8Q.d.mts} +1 -3
- package/dist/{ResourceRegistry-BBaN_Ne-.mjs → ResourceRegistry-Douk51fa.mjs} +15 -4
- package/dist/{acquire-kiZzy5bX.mjs → acquire-RbtvDg9s.mjs} +2 -3
- package/dist/{actionPermissions-BLnbDA6g.mjs → actionPermissions-De0AJ7hm.mjs} +37 -42
- package/dist/audit/index.d.mts +2 -10
- package/dist/audit/index.mjs +8 -12
- package/dist/auth/audit.d.mts +0 -2
- package/dist/auth/audit.mjs +2 -3
- package/dist/auth/index.d.mts +9 -17
- package/dist/auth/index.mjs +26 -29
- package/dist/auth/redis-session.d.mts +2 -4
- package/dist/auth/redis-session.mjs +2 -3
- package/dist/{authorizationDecision-CVlaTjAX.mjs → authorizationDecision-DeZMrHcm.mjs} +5 -6
- package/dist/{base-CZyixEQR.d.mts → base-HXNgPQww.d.mts} +1 -7
- package/dist/{boundedMap-DSy7KkeX.mjs → boundedMap-2WBh3gM9.mjs} +2 -3
- package/dist/{buildHandler-B4IhILv9.mjs → buildHandler-DxVOOBpw.mjs} +5 -6
- package/dist/cache/index.d.mts +4 -10
- package/dist/cache/index.mjs +5 -6
- package/dist/{caching-DqakP2vY.mjs → caching-BYRwYrUo.mjs} +3 -4
- package/dist/{claimed-XoiVrWZ2.mjs → claimed-DYlELdnm.mjs} +2 -3
- package/dist/cleanup/index.d.mts +9 -18
- package/dist/cleanup/index.mjs +12 -20
- package/dist/cli/commands/describe.d.mts +1 -3
- package/dist/cli/commands/describe.mjs +4 -5
- package/dist/cli/commands/docs.d.mts +1 -3
- package/dist/cli/commands/docs.mjs +4 -5
- package/dist/cli/commands/doctor.d.mts +1 -3
- package/dist/cli/commands/doctor.mjs +2 -3
- package/dist/cli/commands/generate.d.mts +1 -1
- package/dist/cli/commands/generate.mjs +2 -2
- package/dist/cli/commands/init.d.mts +1 -1
- package/dist/cli/commands/init.mjs +2 -2
- package/dist/cli/commands/introspect.d.mts +1 -3
- package/dist/cli/commands/introspect.mjs +3 -4
- package/dist/cli/index.d.mts +2 -2
- package/dist/cli/index.mjs +3 -3
- package/dist/{constants-CtWkmWn3.mjs → constants-CHZMUwBW.mjs} +2 -3
- package/dist/context/index.d.mts +0 -8
- package/dist/context/index.mjs +6 -7
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.mjs +8 -8
- package/dist/{core-Cro2v5a7.mjs → core-D9rS2BxO.mjs} +9 -12
- package/dist/{createActionRouter-k-gwiPv6.mjs → createActionRouter-0qkCRzTL.mjs} +7 -8
- package/dist/{createAggregationRouter-BqWqhAPG.mjs → createAggregationRouter-CUf5Esd9.mjs} +9 -10
- package/dist/{createApp-Dw7L72Hz.mjs → createApp-DZIXfDKD.mjs} +49 -62
- package/dist/{createMcpServer-DSztofa9.d.mts → createMcpServer-DeVpqQF-.d.mts} +1 -3
- package/dist/{defineAggregation-pxbd7BBK.mjs → defineAggregation-bmKQ4NmC.mjs} +2 -3
- package/dist/{defineResource-DwgEjLCO.mjs → defineResource-CGmdmGwh.mjs} +78 -29
- package/dist/discovery/index.d.mts +1 -3
- package/dist/discovery/index.mjs +2 -3
- package/dist/docs/index.d.mts +8 -8
- package/dist/docs/index.mjs +4 -5
- package/dist/{elevation-B9wF2Z1F.mjs → elevation-CzhqAyVN.mjs} +9 -10
- package/dist/{elevation-BW2J3tNj.d.mts → elevation-DPD0hcU-.d.mts} +0 -2
- package/dist/encryption/index.d.mts +1 -7
- package/dist/encryption/index.mjs +8 -13
- package/dist/{errorHandler--4rSMMvq.d.mts → errorHandler-B9r88jZV.d.mts} +8 -3
- package/dist/{errorHandler-Dr2nG0Ui.mjs → errorHandler-dFyGOEoB.mjs} +16 -6
- package/dist/{errors-BtHzrSA6.mjs → errors-BY8vzlP4.mjs} +2 -3
- package/dist/{errors-JYc9vwqE.d.mts → errors-DTo0me1o.d.mts} +0 -2
- package/dist/{eventPlugin-BtmA4-3P.d.mts → eventPlugin-BY38F6yK.d.mts} +1 -7
- package/dist/{eventPlugin-Dvs7OBw8.mjs → eventPlugin-eMhAPtQA.mjs} +10 -12
- package/dist/{eventTypes-BVoCTG5c.mjs → eventTypes-Do2KYeJx.mjs} +5 -8
- package/dist/events/index.d.mts +4 -16
- package/dist/events/index.mjs +8 -9
- package/dist/events/transports/redis-stream-entry.d.mts +1 -1
- package/dist/events/transports/redis-stream-entry.mjs +5 -6
- package/dist/events/transports/redis.d.mts +2 -4
- package/dist/events/transports/redis.mjs +3 -4
- package/dist/{externalPaths-CmGOxOtD.d.mts → externalPaths-BOqdq5wr.d.mts} +0 -2
- package/dist/factory/index.d.mts +4 -14
- package/dist/factory/index.mjs +12 -18
- package/dist/{fastify-augmentation-DRlCIWE9.d.mts → fastify-augmentation-Dtn0IIRn.d.mts} +4 -10
- package/dist/{fields-BBSpf8pS.d.mts → fields-JTkrtO-r.d.mts} +0 -2
- package/dist/{fields-C1e_7Fwi.mjs → fields-LnbCcvsw.mjs} +2 -3
- package/dist/{filter-merge-xaiEKtz8.mjs → filter-merge-BAWi019Q.mjs} +2 -3
- package/dist/{generate-DCGuEbqI.d.mts → generate-C-g_KOkV.d.mts} +0 -4
- package/dist/{generate-DJiJMaXN.mjs → generate-oXoDnpJf.mjs} +7 -12
- package/dist/{headers-Dr-wt6Tr.mjs → headers-DBd3Qheo.mjs} +3 -4
- package/dist/{health-DkkWbJtQ.mjs → health-BlJu9GXS.mjs} +2 -3
- package/dist/{health-BLYn_Hds.mjs → health-Dp-3EC9o.mjs} +4 -7
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/idempotency/index.d.mts +3 -9
- package/dist/idempotency/index.mjs +10 -13
- package/dist/idempotency/redis.d.mts +1 -1
- package/dist/idempotency/redis.mjs +3 -4
- package/dist/{index-Bxriq3so.d.mts → index-B5i9-vuP.d.mts} +4 -26
- package/dist/{index-Chgz3d0i.d.mts → index-BAXDo5eE.d.mts} +1 -7
- package/dist/{index-Beg3aNnK.d.mts → index-BTxzJ_MN.d.mts} +67 -25
- package/dist/{index-CUJvoyw3.d.mts → index-Bqfo8hLz.d.mts} +2 -24
- package/dist/{index-uhkUA5-U.d.mts → index-CUdaoCYt.d.mts} +13 -23
- package/dist/{index-WH7xgvxS.d.mts → index-DyJFTJLA.d.mts} +31 -92
- package/dist/index.d.mts +7 -9
- package/dist/index.mjs +12 -13
- package/dist/{init-CW3kJqNW.mjs → init-BOaNkLYb.mjs} +18 -35
- package/dist/{init-Cscs4lab.d.mts → init-CV2_Fw3H.d.mts} +0 -4
- package/dist/integrations/event-gateway.d.mts +3 -5
- package/dist/integrations/event-gateway.mjs +3 -4
- package/dist/integrations/index.d.mts +3 -3
- package/dist/integrations/index.mjs +1 -1
- package/dist/integrations/jobs/index.d.mts +1 -1
- package/dist/integrations/jobs/index.mjs +7 -11
- package/dist/integrations/mcp/index.d.mts +7 -39
- package/dist/integrations/mcp/index.mjs +8 -14
- package/dist/integrations/mcp/testing.d.mts +3 -5
- package/dist/integrations/mcp/testing.mjs +3 -4
- package/dist/integrations/streamline.d.mts +1 -3
- package/dist/integrations/streamline.mjs +4 -5
- package/dist/integrations/webhooks.d.mts +2 -4
- package/dist/integrations/webhooks.mjs +4 -5
- package/dist/integrations/websocket-pushref-redis.d.mts +2 -4
- package/dist/integrations/websocket-pushref-redis.mjs +2 -3
- package/dist/integrations/websocket-redis.d.mts +2 -4
- package/dist/integrations/websocket-redis.mjs +2 -3
- package/dist/integrations/websocket.d.mts +2 -2
- package/dist/integrations/websocket.mjs +13 -24
- package/dist/{interface-JJzwH4Ro.d.mts → interface-BmExzQRD.d.mts} +0 -2
- package/dist/{interface-BOk3YnTz.d.mts → interface-WR1U0K7t.d.mts} +0 -2
- package/dist/{jsonBody-DPU8yYwA.mjs → jsonBody-DpRpKR_K.mjs} +3 -4
- package/dist/{keys-Dgn6OYhl.mjs → keys-FBz6Ull-.mjs} +2 -3
- package/dist/{loadResources-BtKj6P1P.mjs → loadResources-Bx1sKPnF.mjs} +4 -5
- package/dist/{loadResourcesFromEntry-Bmq6TnB7.mjs → loadResourcesFromEntry-b_jcqbxh.mjs} +3 -4
- package/dist/logger/index.d.mts +1 -3
- package/dist/logger/index.mjs +2 -2
- package/dist/{logger-qQNLlOAU.mjs → logger-CbFcIEBZ.mjs} +3 -5
- package/dist/{mcpPlugin-DDfe8jAP.mjs → mcpPlugin-yix548XX.mjs} +41 -60
- package/dist/{memory-C0Blueoh.mjs → memory-Bgw5dn8N.mjs} +4 -5
- package/dist/{metrics-DYka72iN.mjs → metrics-CZDQWVjS.mjs} +4 -5
- package/dist/middleware/index.d.mts +1 -5
- package/dist/middleware/index.mjs +4 -5
- package/dist/migrations/index.d.mts +0 -2
- package/dist/migrations/index.mjs +3 -4
- package/dist/{module-BszSyWbd.mjs → module-Dsc_nKL5.mjs} +2 -3
- package/dist/{multiTenant-CAtYlW6H.d.mts → multiTenant-XCxAUlru.d.mts} +1 -5
- package/dist/{multipartBody-RHvIkNmc.mjs → multipartBody-B85ek8Kj.mjs} +2 -3
- package/dist/observeSend-BK-JN1jK.mjs +20 -0
- package/dist/{openapi-BrFPc3Ny.mjs → openapi-Co7hl073.mjs} +18 -28
- package/dist/outbox-admin/index.d.mts +2 -4
- package/dist/outbox-admin/index.mjs +6 -7
- package/dist/{outbox-module-gZCHoE4H.d.mts → outbox-module-XvUThpqn.d.mts} +2 -8
- package/dist/{outbox-module-DF4Bu_Qa.mjs → outbox-module-mg9kDYkd.mjs} +13 -17
- package/dist/permissions/index.d.mts +4 -4
- package/dist/permissions/index.mjs +7 -7
- package/dist/{permissions-DN1CWH56.mjs → permissions-A1oKtpiC.mjs} +19 -29
- package/dist/{pipe-B8uq865o.mjs → pipe-Czpw9U2n.mjs} +3 -4
- package/dist/pipeline/index.d.mts +1 -9
- package/dist/pipeline/index.mjs +5 -8
- package/dist/{plan-DUGfynNg.mjs → plan-KVseuBCL.mjs} +5 -9
- package/dist/{plugin-ByU3h-bR.mjs → plugin-DTWt_8C3.mjs} +130 -62
- package/dist/plugins/index.d.mts +8 -16
- package/dist/plugins/index.mjs +22 -26
- package/dist/plugins/response-cache.d.mts +2 -4
- package/dist/plugins/response-cache.mjs +10 -10
- package/dist/plugins/tracing-entry.d.mts +1 -1
- package/dist/plugins/tracing-entry.mjs +3 -4
- package/dist/{pluralize-Cdya8zYt.mjs → pluralize-msB9X3yw.mjs} +2 -3
- package/dist/presets/filesUpload.d.mts +4 -6
- package/dist/presets/filesUpload.mjs +6 -7
- package/dist/presets/index.d.mts +3 -19
- package/dist/presets/index.mjs +2 -2
- package/dist/presets/multiTenant.d.mts +1 -1
- package/dist/presets/multiTenant.mjs +7 -7
- package/dist/presets/search.d.mts +3 -5
- package/dist/presets/search.mjs +3 -4
- package/dist/{presets-CCOlKTZw.mjs → presets-qKCehiJM.mjs} +11 -18
- package/dist/{projection-BGty6ie4.mjs → projection-ClBqtsIw.mjs} +3 -4
- package/dist/{pushref-registry-UxCkoA4C.d.mts → pushref-registry-d86QUaSq.d.mts} +0 -6
- package/dist/{queryCachePlugin-B7itTkWu.mjs → queryCachePlugin-3gJj5Rbz.mjs} +8 -10
- package/dist/{queryCachePlugin-C2lZjTxk.d.mts → queryCachePlugin-DYQUyeJ9.d.mts} +2 -4
- package/dist/{rateLimitKey-DBWO59H9.mjs → rateLimitKey-Kro---xl.mjs} +2 -3
- package/dist/{realtime-_59Rlje8.mjs → realtime-Ber8uJN2.mjs} +17 -19
- package/dist/{redis-BDgv9Glw.d.mts → redis-RpDMemdm.d.mts} +2 -4
- package/dist/{redis-stream-BMk-bpQS.d.mts → redis-stream-CS1N9dwM.d.mts} +1 -3
- package/dist/{redisShapes-CQksY67q.d.mts → redisShapes-CqBXTn_s.d.mts} +0 -2
- package/dist/registry/index.d.mts +2 -12
- package/dist/registry/index.mjs +3 -3
- package/dist/{registry-uG4wr541.mjs → registry-BA-_vFYk.mjs} +7 -12
- package/dist/{renewingLease-CiU3ZynH.mjs → renewingLease-CMY8YOcc.mjs} +2 -3
- package/dist/{replyHelpers-Dr2pnXZg.mjs → replyHelpers-DK9P_XSz.mjs} +3 -4
- package/dist/{requestContext-DBKIdmDi.mjs → requestContext-GYO_0gEw.mjs} +2 -3
- package/dist/{requirement-CbiLdQ1n.d.mts → requirement-CTRQjjQx.d.mts} +0 -2
- package/dist/{requirement-DxOaghWD.mjs → requirement-DeNjZIH3.mjs} +2 -3
- package/dist/{resourceRateLimit-Wf6d6FL9.d.mts → resourceRateLimit-DCWglD7V.d.mts} +1 -3
- package/dist/{resourceRateLimit-BBdj5yRq.mjs → resourceRateLimit-tHLbrtWc.mjs} +3 -4
- package/dist/{rolldown-runtime-DpVPUeXF.mjs → rolldown-runtime-Kv1fZdLg.mjs} +2 -3
- package/dist/{routeValidator-BNTqM1Eh.mjs → routeValidator-C_H5NanI.mjs} +2 -3
- package/dist/{runtimeCapabilities-D_3eUO6V.mjs → runtimeCapabilities-DWqbxkyw.mjs} +2 -3
- package/dist/{schedules-CVS7c1nv.mjs → schedules-eO_RzhCU.mjs} +132 -9
- package/dist/{schemaConverter-BQbg7loK.mjs → schemaConverter-DBJrPZN4.mjs} +3 -4
- package/dist/{schemaIR-CUI3hPQR.mjs → schemaIR-CEScKT2v.mjs} +3 -4
- package/dist/schemas/index.d.mts +0 -2
- package/dist/schemas/index.mjs +2 -3
- package/dist/scim/index.d.mts +0 -12
- package/dist/scim/index.mjs +10 -18
- package/dist/scope/index.d.mts +2 -6
- package/dist/scope/index.mjs +5 -5
- package/dist/{scope-DFXngazv.mjs → scope-B-Sm9m_E.mjs} +5 -6
- package/dist/{sessionManager-qimlKV0P.d.mts → sessionManager-CdvDF04x.d.mts} +2 -4
- package/dist/{shutdown-BCXCwghd.mjs → shutdown-DzLFbe27.mjs} +2 -3
- package/dist/{simpleEqualityMatcher-5jOzYQ_L.mjs → simpleEqualityMatcher-DOJhwQ8g.mjs} +2 -3
- package/dist/{sse-BilBz766.mjs → sse-2972pVwV.mjs} +8 -9
- package/dist/{sseStream-BG_uJL6J.mjs → sseStream-AWLEeNV-.mjs} +3 -4
- package/dist/{storage-Cx9Sz3Ou.d.mts → storage-odC5MNKN.d.mts} +0 -2
- package/dist/{store-helpers-CzLZdVa1.mjs → store-helpers-VzjgVTkM.mjs} +2 -3
- package/dist/{streaming-DgUvMWlv.mjs → streaming-DvraWW6x.mjs} +2 -3
- package/dist/{subscriberIdentity-EWnIZ-U8.mjs → subscriberIdentity-Bya56jsg.mjs} +2 -3
- package/dist/{tenancy-CVMvO5DH.mjs → tenancy-DSa_0hhw.mjs} +3 -4
- package/dist/{tenantPreparation-DIH-GX4g.mjs → tenantPreparation-BrpkQre3.mjs} +5 -6
- package/dist/testing/cleanupStoreContract.d.mts +2 -4
- package/dist/testing/cleanupStoreContract.mjs +2 -3
- package/dist/testing/index.d.mts +6 -32
- package/dist/testing/index.mjs +24 -37
- package/dist/testing/outboxStoreContract.d.mts +1 -3
- package/dist/testing/outboxStoreContract.mjs +3 -4
- package/dist/testing/requiredPorts.d.mts +2 -4
- package/dist/testing/requiredPorts.mjs +3 -4
- package/dist/testing/storageContract.d.mts +2 -4
- package/dist/testing/storageContract.mjs +2 -3
- package/dist/{timing-q9NITK04.mjs → timing-6rQTuCwg.mjs} +3 -5
- package/dist/{tracing-Dro5eH6j.d.mts → tracing-JSFiBl5r.d.mts} +0 -2
- package/dist/{transactionContext-NHmhDIOF.mjs → transactionContext-DaxYUEgH.mjs} +2 -3
- package/dist/{typeGuards-CPYR9RCg.mjs → typeGuards-UKnX8wPX.mjs} +2 -3
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.mjs +1 -1
- package/dist/types/storage.d.mts +1 -1
- package/dist/types/storage.mjs +1 -1
- package/dist/{types-ByHn9rEO.d.mts → types-0Dqlbgn8.d.mts} +0 -2
- package/dist/{types-D3Ixsh00.d.mts → types-BYEb_dLW.d.mts} +2 -4
- package/dist/{types-BJ-2XqVF.d.mts → types-BeEJm-DV.d.mts} +114 -14
- package/dist/{types-DVLddu2q.d.mts → types-C0YJAiL0.d.mts} +0 -2
- package/dist/{types-BI4sbUJ3.mjs → types-CuGjhn83.mjs} +5 -6
- package/dist/{types-Ddl9OjmE.d.mts → types-DnkIALZ8.d.mts} +0 -4
- package/dist/usage/index.d.mts +2 -10
- package/dist/usage/index.mjs +8 -12
- package/dist/{userHelpers-oBTU3a_k.mjs → userHelpers-oX5_mOVs.mjs} +2 -3
- package/dist/utils/index.d.mts +5 -39
- package/dist/utils/index.mjs +12 -12
- package/dist/{utils-BmE8zRrh.mjs → utils-CjjGOT4E.mjs} +20 -30
- package/dist/{validate-Dby08LhR.mjs → validate-4RlTKOJb.mjs} +5 -7
- package/dist/{versioning-P6JMNcJr.mjs → versioning-Dk2-19La.mjs} +4 -5
- package/dist/{versioning-Bqm_57Qt.d.mts → versioning-S18y2-0C.d.mts} +1 -15
- package/dist/{websocket-Cs4awVyD.d.mts → websocket-BGuc-WVZ.d.mts} +1 -15
- package/dist/{workScope-BcMLKa3G.mjs → workScope-DoBsoVo4.mjs} +3 -4
- package/llms.txt +37 -30
- package/package.json +9 -8
- package/skills/arc/SKILL.md +65 -844
- package/skills/arc/references/agent-auth.md +82 -193
- package/skills/arc/references/api-reference.md +41 -245
- package/skills/arc/references/auth-api-keys.md +99 -0
- package/skills/arc/references/auth-better-auth-overlay.md +87 -0
- package/skills/arc/references/auth-better-auth.md +78 -0
- package/skills/arc/references/auth-permissions.md +100 -0
- package/skills/arc/references/auth-strategies.md +122 -0
- package/skills/arc/references/boot.md +80 -0
- package/skills/arc/references/enterprise-auth.md +65 -81
- package/skills/arc/references/events-outbox.md +90 -0
- package/skills/arc/references/events.md +75 -440
- package/skills/arc/references/integrations-jobs.md +74 -0
- package/skills/arc/references/integrations-realtime.md +84 -0
- package/skills/arc/references/integrations-webhooks.md +71 -0
- package/skills/arc/references/integrations-workflows.md +47 -0
- package/skills/arc/references/mcp-auth.md +83 -0
- package/skills/arc/references/mcp-custom-tools.md +125 -0
- package/skills/arc/references/mcp-setup.md +115 -0
- package/skills/arc/references/mcp-testing.md +63 -0
- package/skills/arc/references/multi-tenancy.md +56 -230
- package/skills/arc/references/permissions-scope.md +81 -0
- package/skills/arc/references/production-api.md +119 -0
- package/skills/arc/references/production-audit.md +101 -0
- package/skills/arc/references/production-boot.md +91 -0
- package/skills/arc/references/production-caching.md +63 -0
- package/skills/arc/references/production-distributed.md +75 -0
- package/skills/arc/references/production-idempotency.md +83 -0
- package/skills/arc/references/production-observability.md +83 -0
- package/skills/arc/references/production-realtime.md +70 -0
- package/skills/arc/references/production-reliability.md +100 -0
- package/skills/arc/references/production-shutdown.md +43 -0
- package/skills/arc/references/querying.md +76 -0
- package/skills/arc/references/resources.md +97 -0
- package/skills/arc/references/schedules.md +79 -0
- package/skills/arc/references/scim.md +61 -208
- package/skills/arc/references/tenancy-scope-install.md +82 -0
- package/skills/arc/references/testing.md +101 -144
- package/skills/arc/references/usage-cleanup-capabilities.md +45 -0
- package/skills/arc/references/validation.md +91 -0
- package/skills/arc/references/writes-hooks-errors.md +80 -0
- package/skills/arc-code-review/SKILL.md +67 -114
- package/skills/arc-code-review/references/arc-cheatsheet.md +68 -167
- package/skills/arc-code-review/references/mongokit-repositories.md +104 -0
- package/skills/arc-code-review/references/recipe-events-cache-jobs.md +112 -0
- package/skills/arc-code-review/references/recipe-resource.md +100 -0
- package/skills/arc-code-review/references/recipe-schemas-fields.md +93 -0
- package/skills/arc-code-review/references/recipe-scope-permissions.md +82 -0
- package/skills/arc-code-review/references/scaffolding.md +61 -198
- package/skills/arc-code-review/references/severity.md +49 -102
- package/skills/arc-code-review/references/smells-auth-scope.md +80 -0
- package/skills/arc-code-review/references/smells-data-events.md +66 -0
- package/skills/arc-code-review/references/smells-imports-style.md +59 -0
- package/skills/arc-code-review/references/smells-platform.md +89 -0
- package/skills/arc-code-review/references/smells-routes-schemas.md +66 -0
- package/skills/arc-module-publishing/SKILL.md +82 -208
- package/skills/arc-module-publishing/references/action-presets-and-plugins.md +87 -0
- package/skills/arc-module-publishing/references/build-and-types.md +73 -0
- package/skills/arc-module-publishing/references/module-lifecycle.md +101 -0
- package/skills/arc-module-publishing/references/package-manifest.md +34 -122
- package/skills/arc-module-publishing/references/publishing-workflow.md +44 -140
- package/skills/arc-module-publishing/references/resource-assembly.md +102 -0
- package/skills/arc-module-publishing/references/testing-packages.md +82 -0
- package/skills/arc/references/auth.md +0 -729
- package/skills/arc/references/integrations.md +0 -452
- package/skills/arc/references/mcp.md +0 -691
- package/skills/arc/references/production.md +0 -835
- package/skills/arc-code-review/references/anti-patterns.md +0 -1008
- package/skills/arc-code-review/references/migration-recipes.md +0 -649
- package/skills/arc-code-review/references/mongokit-migration.md +0 -360
- package/skills/arc-module-publishing/references/authoring-modules.md +0 -327
|
@@ -1,141 +1,94 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: arc-code-review
|
|
3
|
-
description:
|
|
4
|
-
Audit a client codebase that has @classytic/arc installed for gaps in arc-convention adoption.
|
|
5
|
-
Surfaces hand-rolled CRUD/auth/query/cache code that should be one defineResource() call,
|
|
6
|
-
Mongoose models that should use @classytic/mongokit, manual JSON Schema that should be fieldRules,
|
|
7
|
-
bypassed RequestScope, missing presets, and other patterns that defeat arc's "less code, more
|
|
8
|
-
maintainability" promise. Produces a prioritized migration report with before/after recipes.
|
|
9
|
-
Use when reviewing/auditing a downstream project that depends on @classytic/arc, when the
|
|
10
|
-
user asks for an "arc audit", "arc gap analysis", "arc migration plan", "why isn't arc helping
|
|
11
|
-
us", or when refactoring a Fastify/Express service to arc conventions.
|
|
12
|
-
Triggers: arc audit, arc review, arc gap, arc migration, arc convention check, arc compliance,
|
|
13
|
-
classytic audit, defineResource refactor, mongoose to mongokit, hand-rolled crud to arc,
|
|
14
|
-
arc adoption, arc lint, arc smell, arc anti-pattern.
|
|
3
|
+
description: Audit a client codebase that uses @classytic/arc for hand-rolled code arc already provides (CRUD routes, permission checks, scope reads, manual zod parsing, cron gates, cache, mongoose repos) and report prioritized replace-X-with-Y fixes. Use for an arc audit, gap analysis, or refactoring a Fastify service to arc. Triggers: arc audit, arc review, arc smell, arc adoption.
|
|
15
4
|
license: MIT
|
|
16
5
|
metadata:
|
|
17
6
|
author: Classytic
|
|
7
|
+
minVersion: "2.46.0"
|
|
18
8
|
tags:
|
|
19
9
|
- arc
|
|
20
10
|
- code-review
|
|
21
11
|
- audit
|
|
22
|
-
- migration
|
|
23
12
|
- refactor
|
|
24
|
-
- fastify
|
|
25
|
-
- mongoose
|
|
26
|
-
- mongokit
|
|
27
|
-
- convention-check
|
|
28
|
-
progressive_disclosure:
|
|
29
|
-
entry_point:
|
|
30
|
-
summary: "Audit a client codebase using @classytic/arc for unrealized convention gains. Detect hand-rolled CRUD/auth/query/cache, Mongoose-without-mongokit, bypassed scope, and emit a prioritized migration report."
|
|
31
|
-
when_to_use: "Reviewing or migrating a project that has arc installed but hasn't adopted defineResource()/presets/permissions/scope/mongokit. Use whenever the user asks 'why isn't arc helping us' or wants a gap analysis."
|
|
32
|
-
quick_start: "1. Confirm arc/mongokit versions 2. Run detection sweep (references/anti-patterns.md) 3. Score each finding (references/severity.md) 4. Emit report using template below"
|
|
33
|
-
context_limit: 900
|
|
34
13
|
---
|
|
35
14
|
|
|
36
15
|
# arc-code-review
|
|
37
16
|
|
|
38
|
-
Audit
|
|
17
|
+
Audit a project that depends on `@classytic/arc`: find code arc generates or enforces, score it, emit a report with a concrete fix per finding. For work on arc itself, use the arc skill.
|
|
39
18
|
|
|
40
|
-
##
|
|
19
|
+
## Do not hand-roll
|
|
41
20
|
|
|
42
|
-
|
|
43
|
-
- The user asks for an "arc audit", "arc gap analysis", "arc migration plan", or "why isn't arc helping us".
|
|
44
|
-
- A repo `dependsOn @classytic/arc` (or `@classytic/mongokit`) and the conversation is about refactoring, code-review, or onboarding.
|
|
45
|
-
- The user mentions hand-rolled CRUD, manual JSON Schema, raw `req.user` access, manual `Model.find()` in route handlers, or hand-written OpenAPI alongside arc.
|
|
46
|
-
- Migrating a Fastify/Express service to arc conventions.
|
|
47
|
-
|
|
48
|
-
**Do NOT use** for arc framework development itself — that's the `arc` skill in `skills/arc/`. This skill audits *consumers* of arc.
|
|
49
|
-
|
|
50
|
-
## Mental model — what arc replaces
|
|
51
|
-
|
|
52
|
-
One `defineResource()` call **replaces all of these** in a typical Fastify service:
|
|
53
|
-
|
|
54
|
-
| Hand-rolled today | Arc capability that subsumes it | Reference |
|
|
21
|
+
| Smell in client code | Arc API | Import |
|
|
55
22
|
|---|---|---|
|
|
56
|
-
| 5
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
| `
|
|
61
|
-
|
|
|
62
|
-
| `
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
23
|
+
| 5 `fastify.get/post/patch/delete` per entity | `defineResource` | `@classytic/arc` |
|
|
24
|
+
| Role or owner checks inside handlers | `requireRoles`, `requireOwnership`, `anyOf`, `allOf` in `permissions` | `@classytic/arc/permissions` |
|
|
25
|
+
| `req.user._id`, `req.user.orgId` | `getUserId`, `getOrgId`, `requireOrgId`, `requireUserId` | `@classytic/arc/scope` |
|
|
26
|
+
| `.parse()` in every handler, hand-written JSON Schema | zod v4 once: `routeInput`, `crudInput`, `parsed`, `defineAction({ schema, parse: true })`, `noPayloadSchema` | `@classytic/arc/core` |
|
|
27
|
+
| `{ body: X }` as an action schema | the action `schema` IS the body schema | `@classytic/arc/core` |
|
|
28
|
+
| `toJSON` transform stripping secrets | `schemaOptions.fieldRules` with `hidden`, `fields.visibleTo` | `@classytic/arc`, `@classytic/arc/permissions` |
|
|
29
|
+
| Manual `req.query` filter and page parsing | built-in parser, `ArcQueryParser` | `@classytic/arc/utils` |
|
|
30
|
+
| `setNotFoundHandler` returning custom JSON | default 404 `arc.not_found`; `errorHandler: { notFound }` | `createApp` option |
|
|
31
|
+
| `emit('x.created')` after each write | automatic CRUD events, `eventPlugin`, `defineEvent` | `@classytic/arc/events` |
|
|
32
|
+
| `cache.del('list')` after writes | `cache: { staleTime, tags }`, `arcPlugins.queryCache` | `defineResource` option |
|
|
33
|
+
| `setInterval`, node-cron, marker rows for once-a-day | `schedulesPlugin` with `daily: { hour, minute?, zone, ledger }`, `DailyLedger`, `createMemoryDailyLedger` | `@classytic/arc/plugins` |
|
|
34
|
+
| Hand-wired BullMQ queue | `jobsPlugin`, `defineJob` | `@classytic/arc/integrations/jobs` |
|
|
35
|
+
| `Idempotency-Key` table | `idempotencyPlugin` | `@classytic/arc/idempotency` |
|
|
36
|
+
| Audit rows written in handlers | `auditPlugin`, `audit: true` | `@classytic/arc/audit` |
|
|
37
|
+
| `Model.aggregate([...])` in a route | `aggregations`, `defineAggregation` | `@classytic/arc` |
|
|
38
|
+
| Soft delete, slug, tree, bulk, tenant glue | `presets: [...]` | `@classytic/arc/presets` |
|
|
39
|
+
| Hand-written MCP tools | `mcpPlugin` | `@classytic/arc/mcp` |
|
|
40
|
+
| Webhook HMAC over parsed body | `verifySignature(req.rawBody, ...)` | `@classytic/arc/integrations/webhooks` |
|
|
41
|
+
| Repository classes over Mongoose | mongokit `createRepository` (see the mongokit skill) | `@classytic/mongokit` |
|
|
42
|
+
|
|
43
|
+
## Golden path
|
|
44
|
+
|
|
45
|
+
1. Read `package.json`: arc, mongokit, repo-core versions. No arc dependency means this skill does not apply.
|
|
46
|
+
2. Find `createApp(` and every `defineResource(`; list per resource: permissions, presets, schema, cache, events.
|
|
47
|
+
3. Sweep `src/` (skip tests and `dist`) with the greps in references/smells-*.md. Record file:line.
|
|
48
|
+
4. Score with references/severity.md. Escalate write paths and auth, webhook or payment code.
|
|
49
|
+
5. Write the report. Cite file:line for every finding and show before/after for the first hit of each pattern.
|
|
50
|
+
6. Order the plan: auth and scope, then schemas, then CRUD consolidation, then data layer, then jobs and events.
|
|
83
51
|
|
|
84
52
|
```markdown
|
|
85
|
-
# Arc
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
## Critical findings
|
|
96
|
-
### C1. <short title> (<N occurrences>)
|
|
97
|
-
**Pattern:** <what's wrong, in 1 sentence>
|
|
98
|
-
**Locations:** `src/foo/bar.ts:42`, `src/foo/baz.ts:118`, ...
|
|
99
|
-
**Why it matters:** <security / drift / maintainability impact>
|
|
100
|
-
**Fix:** <link to migration recipe>
|
|
101
|
-
|
|
102
|
-
## High / Medium / Low findings
|
|
103
|
-
(same shape)
|
|
104
|
-
|
|
105
|
-
## Migration plan (recommended order)
|
|
106
|
-
1. <Step 1 — usually scope/permissions because they're security-critical>
|
|
107
|
-
2. <Step 2 — usually CRUD consolidation>
|
|
108
|
-
3. ...
|
|
109
|
-
|
|
110
|
-
## Per-resource scorecard
|
|
111
|
-
| Resource | defineResource? | presets used | permissions | cache | events | mongokit | Score |
|
|
112
|
-
|---|---|---|---|---|---|---|---|
|
|
113
|
-
| product | ✅ | softDelete | ✅ | ❌ | manual | ❌ | 6/10 |
|
|
53
|
+
# Arc audit: <project>
|
|
54
|
+
Arc <ver> | Mongokit <ver or none> | <YYYY-MM-DD> | findings: <c> critical, <h> high, <m> medium, <l> low
|
|
55
|
+
## Summary
|
|
56
|
+
<removable LOC estimate, top 3 risks>
|
|
57
|
+
## Findings (sorted by severity, then occurrence count)
|
|
58
|
+
### C1. <title> (<n> hits)
|
|
59
|
+
Locations: `src/a.ts:42` Why: <impact> Fix: <recipe>
|
|
60
|
+
## Plan
|
|
61
|
+
1. ...
|
|
114
62
|
```
|
|
115
63
|
|
|
116
|
-
##
|
|
117
|
-
|
|
118
|
-
- **Critical:** auth bypass, scope leak, fields exposed that should be `hidden`, hand-rolled idempotency that diverges from arc's behavior under load.
|
|
119
|
-
- **High:** duplicated CRUD that will rot (one resource gets a fix the others don't), manual permissions instead of combinators, mongoose imports leaking outside adapters.
|
|
120
|
-
- **Medium:** manual query parsing, manual cache invalidation, missing presets, hand-written OpenAPI.
|
|
121
|
-
- **Low:** style (default exports, `console.log`, `any`), naming conventions, missing `displayName`/`module` metadata.
|
|
64
|
+
## Gotchas
|
|
122
65
|
|
|
123
|
-
|
|
66
|
+
- Report arc misuse (a bug) separately from a missing arc feature (an opportunity).
|
|
67
|
+
- Do not suggest a feature the app has not enabled; say to enable it first (`arcPlugins.queryCache`, `eventPlugin`).
|
|
68
|
+
- A pattern repeated 30 times outranks one isolated high.
|
|
69
|
+
- `softDelete` preset adds routes only; filtering lives in the repository (`softDelete: true`).
|
|
70
|
+
- Hosts needing calendar cron or durable retries legitimately use `jobsPlugin`; do not flag them.
|
|
71
|
+
- `schemaGenerator: false` on the mongokit adapter silently drops OpenAPI and MCP bodies.
|
|
72
|
+
- Tenant config key is `tenantField`; an unknown key is ignored and queries go unscoped.
|
|
124
73
|
|
|
125
|
-
##
|
|
74
|
+
## Never
|
|
126
75
|
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
- **Sort by severity, then by file count.** A pattern repeated 30× outranks an isolated critical bug for migration ROI.
|
|
131
|
-
- **Distinguish "missing arc feature" from "arc misuse".** The first is opportunity; the second is a bug.
|
|
132
|
-
- **Don't recommend arc features the project hasn't enabled.** If `arcPlugins.queryCache: false`, don't suggest cache tags — recommend enabling it first.
|
|
76
|
+
- Recommend a deep import or a driver import outside the model, repository and adapter files.
|
|
77
|
+
- Rewrite without citing the arc API and subpath in the fix.
|
|
78
|
+
- Edit client code unless asked.
|
|
133
79
|
|
|
134
80
|
## References
|
|
135
81
|
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
-
|
|
141
|
-
-
|
|
82
|
+
- [references/smells-routes-schemas.md](references/smells-routes-schemas.md): read for route, schema, query, not-found, OpenAPI smells.
|
|
83
|
+
- [references/smells-auth-scope.md](references/smells-auth-scope.md): read for permission, scope, tenant, webhook, SSE smells.
|
|
84
|
+
- [references/smells-data-events.md](references/smells-data-events.md): read for driver, repository, event, cache, audit smells.
|
|
85
|
+
- [references/smells-platform.md](references/smells-platform.md): read for job, daily gate, preset, MCP, lifecycle smells.
|
|
86
|
+
- [references/smells-imports-style.md](references/smells-imports-style.md): read for canonical import homes and style smells.
|
|
87
|
+
- [references/severity.md](references/severity.md): read to score findings and size effort.
|
|
88
|
+
- [references/recipe-resource.md](references/recipe-resource.md): read for CRUD to defineResource, presets.
|
|
89
|
+
- [references/recipe-schemas-fields.md](references/recipe-schemas-fields.md): read for routeInput, crudInput, actions, hidden fields, errors.
|
|
90
|
+
- [references/recipe-scope-permissions.md](references/recipe-scope-permissions.md): read for permissions, scope accessors, tenancy recipes.
|
|
91
|
+
- [references/recipe-events-cache-jobs.md](references/recipe-events-cache-jobs.md): read for events, cache, schedules, idempotency, MCP.
|
|
92
|
+
- [references/mongokit-repositories.md](references/mongokit-repositories.md): read to replace Mongoose repository classes and wire the adapter.
|
|
93
|
+
- [references/arc-cheatsheet.md](references/arc-cheatsheet.md): read for the defineResource surface, scope kinds, presets, subpaths.
|
|
94
|
+
- [references/scaffolding.md](references/scaffolding.md): read for arc CLI and generated layout.
|
|
@@ -1,198 +1,99 @@
|
|
|
1
|
-
# Arc
|
|
1
|
+
# Arc at a glance (for gap detection)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
For full API read the arc skill. Use this to recognize what a project hand-rolls.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## defineResource surface
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|---|---|
|
|
9
|
-
| 5× `fastify.get/post/patch/delete` for one resource | `defineResource({ name, adapter, permissions, … })` — CRUD auto-generated |
|
|
10
|
-
| `if (req.user.role !== 'admin') return reply.code(403)…` | `permissions: { update: requireRoles(['admin']) }` |
|
|
11
|
-
| `req.user._id`, `req.user.orgId` direct reads | `getUserId(scope)` / `getOrgId(scope)` from `@classytic/arc/scope` |
|
|
12
|
-
| Hand-written `schema: { body, response }` per route | `schemaOptions.fieldRules` |
|
|
13
|
-
| `schema.set('toJSON', { transform })` to strip `password`/`__v` | `fieldRules: { password: { hidden: true } }` |
|
|
14
|
-
| Manual `req.query.filter` parsing, `$or`/`$and` building | `ArcQueryParser` / mongokit `QueryParser` |
|
|
15
|
-
| Hand-maintained `openapi.yaml` | `arc docs ./openapi.json` |
|
|
16
|
-
| `eventBus.emit('product.created', …)` in handler | CRUD events auto-emit; `events: { created: {} }` for custom |
|
|
17
|
-
| `cache.del('products-*')` after mutation | `cache: { tags: ['catalog'] }` — auto-invalidated |
|
|
18
|
-
| Soft-delete: hand-rolled `/deleted` route + `deletedAt` field + restore handler | `presets: ['softDelete']` |
|
|
19
|
-
| `class UserRepository { async create() { Model.create() } }` | `new Repository(Model)` from mongokit |
|
|
20
|
-
| Per-schema `schema.pre('save', …)` for timestamps/validation | mongokit's `timestampPlugin()`, `validationChainPlugin()` |
|
|
21
|
-
| Hand-written MCP tool handlers | `mcpPlugin({ resources })` — auto-generated, same perms |
|
|
22
|
-
| `Model.aggregate([…])` in route handler | `aggregations: { name: defineAggregation({ … }) }` |
|
|
23
|
-
| Custom `withRetry` / `withDLQ` plumbing on events | `RedisStreamTransport` (durable, consumer groups, DLQ) |
|
|
24
|
-
| Hand-rolled idempotency token check | `idempotencyPlugin` (header-based, configurable store) |
|
|
25
|
-
| Manual SCIM provisioning endpoints | `@classytic/arc/scim` — `scimPlugin({ users, groups, bearer })` |
|
|
26
|
-
| `setInterval` sweeps + hand-rolled leader lock / job registry | `schedulesPlugin` from `@classytic/arc/plugins` (2.21 — interval jobs, LockAdapter lease, no Redis) |
|
|
27
|
-
| `as never` casts + spread-merges assembling resources in module packages | `mergeResourceConfig` + `ResourceSeams` (2.21) with kernel-typed engine ports |
|
|
28
|
-
| Same `view`/`manage` gate repeated across 5 CRUD keys | `permissionMatrix({ read, write, delete? })` (2.21) |
|
|
29
|
-
| DB connect + dynamic-import ordering in the composition root | `createApp({ beforeBoot })` (2.21 — runs before Fastify + all imports) |
|
|
30
|
-
| `import { x } from 'better-auth/plugins'` (barrel) | dedicated path `better-auth/plugins/<name>` — tree-shaking (BA best practice) |
|
|
31
|
-
| Hand-rolled per-tenant usage/billing counters | `usagePlugin` from `@classytic/arc/usage` (2.22 — per-actor per-period counters, fail-safe, `UsageStore` backends) |
|
|
32
|
-
| Per-plan rate limits via custom middleware | `rateLimit.plan { resolve, limits, default }` (2.22 — `false` = unlimited, fail-safe fallback, tenant-keyed buckets) |
|
|
33
|
-
| Hand-built audit-timeline endpoints (`GET /:id/history` handlers over audit rows) | `history: true` on `defineResource` (2.22 — implies `audit: true`, stricter-than-read gate) |
|
|
34
|
-
|
|
35
|
-
## Boot order (FIXED)
|
|
36
|
-
|
|
37
|
-
```
|
|
38
|
-
0. beforeBoot() ← pre-everything (DB connect; before Fastify + imports) — 2.21
|
|
39
|
-
0.5 module resolve ← thunk imports + dependsOn topo-sort; module errorMappers merge
|
|
40
|
-
1. Arc core (security, auth, events)
|
|
41
|
-
2. plugins() ← user infra (docs, webhooks)
|
|
42
|
-
3. bootstrap[] ← domain init (engines, singletons)
|
|
43
|
-
4. resources (factory runs after bootstrap)
|
|
44
|
-
5. resources[] ← register each
|
|
45
|
-
6. afterResources()
|
|
46
|
-
7. onReady / onClose
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
**Lifecycle smell:** top-level `await ensureCatalogEngine()` in a `*.resource.ts` file. Fix: pass `resources` as `async (fastify) => [...]` so it runs after `bootstrap[]`.
|
|
50
|
-
|
|
51
|
-
## defineResource — full surface
|
|
52
|
-
|
|
53
|
-
```typescript
|
|
7
|
+
```ts
|
|
54
8
|
defineResource({
|
|
55
|
-
name
|
|
56
|
-
adapter,
|
|
57
|
-
controller
|
|
9
|
+
name, displayName, tag, prefix, skipGlobalPrefix, module,
|
|
10
|
+
adapter, // from the kit's /adapter subpath
|
|
11
|
+
controller, writes, transactional, concurrency,
|
|
58
12
|
permissions: { list, get, create, update, delete },
|
|
59
|
-
presets
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
rateLimit
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
audit?, history?, mcp?, // mcp: false to exclude from MCP tool gen; history: true → GET /:id/history (2.22)
|
|
68
|
-
displayName?, module?,
|
|
69
|
-
onTenantDelete?, // GDPR cascade strategy
|
|
13
|
+
presets, hooks, pipe, middlewares, routeGuards,
|
|
14
|
+
routes, actions, actionPermissions, aggregations,
|
|
15
|
+
schemaOptions: { fieldRules, query, ... }, customSchemas, openApiSchemas,
|
|
16
|
+
fields, onFieldWriteDenied, onImmutableWrite,
|
|
17
|
+
tenantField, onTenantDelete, idField, lookupFields, defaultSort, defaultLimit, maxLimit,
|
|
18
|
+
cache, events, audit, history, rateLimit, idempotency, mcp, queryParser,
|
|
19
|
+
disableDefaultRoutes, disabledRoutes, crud,
|
|
20
|
+
strictPermissions, strictSchemas, skipValidation,
|
|
70
21
|
});
|
|
71
22
|
```
|
|
72
23
|
|
|
24
|
+
`writes` binds a CRUD slot to a domain command while keeping sanitize, tenant injection and hooks. `transactional: true` runs each write in a retrying repository transaction. `concurrency` enables ETag and `If-Match`. `history: true` adds `GET /:id/history`.
|
|
25
|
+
|
|
73
26
|
## Permissions
|
|
74
27
|
|
|
75
|
-
```
|
|
76
|
-
allowPublic()
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
allOf(...) · anyOf(...) · not(...) · when(...) · denyAll()
|
|
82
|
-
permissionMatrix({ read, write, delete? }) // 2.21 — expands to the full CRUD map
|
|
83
|
-
createDynamicPermissionMatrix({ resolveRolePermissions, cacheStore })
|
|
28
|
+
```ts
|
|
29
|
+
allowPublic() requireAuth() requireRoles(["admin"]) requireOwnership("userId")
|
|
30
|
+
requireOrgMembership() requireOrgRole("admin") requireTeamMembership()
|
|
31
|
+
requireServiceScope("jobs:bulk") requireScopeContext("branchId") requireOrgInScope(targetId)
|
|
32
|
+
allOf(...) anyOf(...) not(...) when(...) denyAll()
|
|
33
|
+
permissionMatrix({ read, write, delete? }) createDynamicPermissionMatrix({ ... })
|
|
84
34
|
```
|
|
85
35
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
Field-level: `fields.hidden()`, `fields.visibleTo([...])`, `fields.writableBy([...])`, `fields.redactFor([...], '***')`.
|
|
36
|
+
All from `@classytic/arc/permissions` (the common ones also from the root). A check returns `boolean` or a decision carrying `filters` (row-level policy) and `scope`. Field level: `fields.hidden()`, `visibleTo`, `writableBy`, `redactFor`, passed in the resource `fields` option.
|
|
89
37
|
|
|
90
38
|
## RequestScope
|
|
91
39
|
|
|
92
|
-
```
|
|
40
|
+
```ts
|
|
93
41
|
type RequestScope =
|
|
94
|
-
| { kind:
|
|
95
|
-
| { kind:
|
|
96
|
-
| { kind:
|
|
97
|
-
| { kind:
|
|
98
|
-
| { kind:
|
|
42
|
+
| { kind: "public" }
|
|
43
|
+
| { kind: "authenticated"; userId?; userRoles? }
|
|
44
|
+
| { kind: "member"; userId?; userRoles; organizationId; orgRoles; teamId?; context?; ancestorOrgIds? }
|
|
45
|
+
| { kind: "service"; clientId; organizationId; scopes?; context?; ancestorOrgIds?; mandate?; dpopJkt? }
|
|
46
|
+
| { kind: "elevated"; userId?; organizationId?; elevatedBy; context?; ancestorOrgIds? };
|
|
99
47
|
```
|
|
100
48
|
|
|
101
|
-
|
|
49
|
+
Read only through `@classytic/arc/scope`: `getUserId`, `getOrgId`, `requireOrgId`, `requireUserId`, `getScopeContext`, `isOrgInScope`, `hasOrgAccess`.
|
|
102
50
|
|
|
103
51
|
## Presets
|
|
104
52
|
|
|
105
|
-
| Preset |
|
|
53
|
+
| Preset | Adds | Config |
|
|
106
54
|
|---|---|---|
|
|
107
|
-
| `softDelete` | `GET /deleted`, `POST /:id/restore` |
|
|
108
|
-
| `slugLookup` | `GET /slug/:slug` | `
|
|
109
|
-
| `tree` |
|
|
110
|
-
| `ownedByUser` |
|
|
111
|
-
| `multiTenant` |
|
|
112
|
-
| `audited` |
|
|
113
|
-
| `bulk` |
|
|
114
|
-
| `filesUpload` |
|
|
115
|
-
| `search` |
|
|
55
|
+
| `softDelete` | `GET /deleted`, `POST /:id/restore` | |
|
|
56
|
+
| `slugLookup` | `GET /slug/:slug` | `slugField` |
|
|
57
|
+
| `tree` | tree and children routes | `parentField` |
|
|
58
|
+
| `ownedByUser` | owner scoping | `ownerField` |
|
|
59
|
+
| `multiTenant` | tenant scoping | `tenantField` or `tenantFields` |
|
|
60
|
+
| `audited` | audit writes | |
|
|
61
|
+
| `bulk` | bulk create, update, delete | `operations`, `maxCreateItems` |
|
|
62
|
+
| `filesUpload` | upload routes | `storage`, `allowedMimeTypes`, `maxFileSize` |
|
|
63
|
+
| `search` | search, similar, embed routes | `search`, `similar`, `embed` |
|
|
116
64
|
|
|
117
65
|
## fieldRules flags
|
|
118
66
|
|
|
119
|
-
`systemManaged
|
|
120
|
-
|
|
121
|
-
## Aggregations
|
|
122
|
-
|
|
123
|
-
```typescript
|
|
124
|
-
aggregations: {
|
|
125
|
-
byMethod: defineAggregation({
|
|
126
|
-
groupBy: 'method',
|
|
127
|
-
measures: { total: 'sum:amount', count: 'count' },
|
|
128
|
-
requireDateRange: { field: 'createdAt', maxRangeDays: 365 },
|
|
129
|
-
cache: { staleTime: 60, swr: true, tags: ['revenue'] },
|
|
130
|
-
permissions: canViewRevenue(),
|
|
131
|
-
}),
|
|
132
|
-
}
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
Registers `GET /:prefix/aggregations/:name`. Same perms + cache + tag invalidation + MCP tool as CRUD. **Anti-pattern:** custom routes calling `Model.aggregate([...])` directly.
|
|
136
|
-
|
|
137
|
-
## CLI
|
|
67
|
+
`systemManaged`, `preserveForElevated`, `immutable`, `immutableAfterCreate`, `optional`, `nullable`, `hidden`, `aggregable`, `minLength`, `maxLength`, `min`, `max`, `pattern`, `enum`, `description`.
|
|
138
68
|
|
|
139
|
-
|
|
140
|
-
arc init my-api --mongokit --better-auth --ts
|
|
141
|
-
arc generate resource product [--mcp]
|
|
142
|
-
arc docs ./openapi.json --entry ./dist/index.js
|
|
143
|
-
arc introspect --entry ./dist/index.js
|
|
144
|
-
arc describe ./dist/resources.js --json
|
|
145
|
-
arc doctor
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
Generated layout: `src/resources/{name}/{name}.{model,repository,resource,mcp}.ts`. Naming: `org-profile` (kebab input) → `OrgProfile` (class) / `orgProfile` (var) / `org-profile.*.ts` (files).
|
|
69
|
+
## createApp options that replace host code
|
|
149
70
|
|
|
150
|
-
|
|
71
|
+
`auth`, `modules`, `resources`, `resourcePrefix`, `beforeBoot`, `plugins`, `bootstrap`, `afterResources`, `onReady`, `onClose`, `stores` (`events`, `cache`, `idempotency`, `queryCache`), `errorHandler`, `rateLimit`, `cors`, `helmet`, `elevation`, `multipart`, `rawBody`, `ports`, `moduleGraph`, `preset` (`production`, `development`, `testing`, `edge`, `worker`), and `arcPlugins`: `requestId`, `health`, `gracefulShutdown`, `emitEvents`, `events`, `schedules`, `caching`, `sse`, `realtime`, `queryCache`, `metrics`, `versioning`.
|
|
151
72
|
|
|
152
|
-
|
|
73
|
+
Boot order: `beforeBoot`, module resolve, arc core, `plugins`, `bootstrap`, `resources`, `afterResources`, `onReady`, `onClose`.
|
|
153
74
|
|
|
154
|
-
|
|
155
|
-
import { createMongooseAdapter } from '@classytic/mongokit/adapter';
|
|
156
|
-
import { createDrizzleAdapter } from '@classytic/sqlitekit/adapter';
|
|
157
|
-
import { createPrismaAdapter } from '@classytic/prismakit/adapter';
|
|
75
|
+
## Subpaths and what lives there
|
|
158
76
|
|
|
159
|
-
|
|
160
|
-
// RepositoryLike<TDoc> = MinimalRepo<TDoc> & Partial<StandardRepo<TDoc>>
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
| Plugin | Required repo methods |
|
|
77
|
+
| Subpath | Holds |
|
|
164
78
|
|---|---|
|
|
165
|
-
| `
|
|
166
|
-
| `
|
|
167
|
-
| `
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
A project importing only from the root barrel is probably under-using subpath features (caching, scope accessors, presets, MCP, testing harness).
|
|
188
|
-
|
|
189
|
-
## Non-negotiables (mirror in client projects)
|
|
190
|
-
|
|
191
|
-
1. No `console.log` in `src/` (except `cli/`) — use logger.
|
|
192
|
-
2. No `mongoose` / `drizzle-orm` / `@prisma/client` imports outside the host's adapter wiring file.
|
|
193
|
-
3. No `any` — use `unknown`. No `@ts-ignore` — fix the type.
|
|
194
|
-
4. No default exports in `src/` (knip enforces in arc).
|
|
195
|
-
5. Always read `request.user` via guard, or use `@classytic/arc/scope` accessors.
|
|
196
|
-
6. Always use `req.rawBody` for `verifySignature(...)`, never parsed body.
|
|
197
|
-
7. Set response headers in `onRequest` or `preSerialization`, never `onSend`.
|
|
198
|
-
8. `request.user: Record<string, unknown> | undefined` — required property, NOT optional.
|
|
79
|
+
| `@classytic/arc` | `defineResource`, `defineAction`, `defineAggregation`, `mergeResourceConfig`, controllers, mixins, errors, common permissions |
|
|
80
|
+
| `/core` | `routeInput`, `crudInput`, `parsed`, `noPayloadSchema`, `defineAction` |
|
|
81
|
+
| `/factory` | `createApp`, `defineModule`, `getModuleExports`, `loadResources` |
|
|
82
|
+
| `/permissions`, `/scope` | checks, matrices, scope accessors |
|
|
83
|
+
| `/presets` | `multiTenantPreset`, `bulkPreset`, ... |
|
|
84
|
+
| `/plugins` | `schedulesPlugin`, `createDailyGate`, `createMemoryDailyLedger`, `errorHandlerPlugin`, `healthPlugin`, `ssePlugin` |
|
|
85
|
+
| `/cache`, `/events`, `/idempotency`, `/audit` | stores, transports, outbox, plugins |
|
|
86
|
+
| `/utils` | errors, `createDomainError`, `defineErrorMapper`, `ArcQueryParser` |
|
|
87
|
+
| `/mcp`, `/docs`, `/testing` | MCP plugin, OpenAPI, test harnesses |
|
|
88
|
+
| `/integrations/jobs`, `/integrations/webhooks`, `/integrations/websocket` | queue, signed webhooks, sockets |
|
|
89
|
+
|
|
90
|
+
Imports only from the root barrel suggest under-use of caching, scope, presets, MCP and testing.
|
|
91
|
+
|
|
92
|
+
## Non-negotiables to mirror in client code
|
|
93
|
+
|
|
94
|
+
1. No `console.log` in `src/`; use the logger.
|
|
95
|
+
2. No driver imports outside model, repository and adapter files.
|
|
96
|
+
3. No `any`, no `@ts-ignore`, no default exports.
|
|
97
|
+
4. Read `request.user` only behind a guard, or use scope accessors.
|
|
98
|
+
5. Verify webhooks over `req.rawBody`.
|
|
99
|
+
6. Set headers in `onRequest` or `preSerialization`, never async `onSend`.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Recipe: Mongoose repositories to mongokit
|
|
2
|
+
|
|
3
|
+
For the full mongokit API, see the mongokit skill. This file covers what an arc audit recommends.
|
|
4
|
+
|
|
5
|
+
mongokit wraps a Mongoose model in a `Repository<TDoc>` that satisfies repo-core's `StandardRepo`, so it plugs into arc through `createMongooseAdapter(Model, repo)` from `@classytic/mongokit/adapter` with no casts. It does not own the connection (`mongoose.connect()` stays in `beforeBoot`) and does not strip response fields (arc `fieldRules.hidden` does).
|
|
6
|
+
|
|
7
|
+
## Signals
|
|
8
|
+
|
|
9
|
+
| Signal | Grep or check |
|
|
10
|
+
|---|---|
|
|
11
|
+
| mongoose without mongokit | `package.json` has `mongoose`, lacks `@classytic/mongokit` |
|
|
12
|
+
| per-model repository class | `class \w+Repository\b` |
|
|
13
|
+
| scattered hooks | `schema\.pre\(`, `schema\.post\(` |
|
|
14
|
+
| toJSON transform | `schema\.set\(['"]toJSON` |
|
|
15
|
+
| manual pagination | `skip\(.*page`, `countDocuments\(` |
|
|
16
|
+
| tenant filter per method | `organizationId` read from `req.user` beside `find` |
|
|
17
|
+
| session threading | `startSession\(`, `commitTransaction` |
|
|
18
|
+
| duplicate checks by lookup | `findOne\(\{ email` before `create` |
|
|
19
|
+
|
|
20
|
+
A 150-line repository class usually becomes about 10 lines.
|
|
21
|
+
|
|
22
|
+
## Mapping
|
|
23
|
+
|
|
24
|
+
| Hand-rolled | mongokit |
|
|
25
|
+
|---|---|
|
|
26
|
+
| `class UserRepository { create() { Model.create() } ... }` | `createRepository(Model, config)` |
|
|
27
|
+
| `pre('save')` stamping `updatedAt` | `timestamps: true` |
|
|
28
|
+
| `{ deletedAt: null }` on every read, restore handler | `softDelete: true` |
|
|
29
|
+
| `organizationId` appended to every query | `tenant: { tenantField: "organizationId", required: true }` |
|
|
30
|
+
| skip/limit plus `countDocuments` | `repo.getAll({ mode: "offset", page, limit, filters, sort }, scope)` |
|
|
31
|
+
| cursor pagination by hand | `repo.getAll({ mode: "keyset", after, limit, sort }, scope)` |
|
|
32
|
+
| `findOne` then `create` uniqueness | unique index plus `validationChainPlugin([uniqueField("email")])`, `isDuplicateKeyError` |
|
|
33
|
+
| `findOneAndUpdate(..., { runValidators })` | `repo.update(id, data, scope)` |
|
|
34
|
+
| `startSession` plus `withTransaction` | `repo.withTransaction(async (tx) => ...)` or `withTransaction(connection, fn)` |
|
|
35
|
+
| cache around `find` | `cache: {...}` option |
|
|
36
|
+
| audit rows in handlers | `audit: {...}` option |
|
|
37
|
+
| prefixed ids (`ord_...`) | `customId: {...}`, `prefixedId`, `sequentialId` |
|
|
38
|
+
| status change with legality check | `repo.applyTransition` |
|
|
39
|
+
| URL query to filter | `QueryParser` |
|
|
40
|
+
|
|
41
|
+
## Recipe
|
|
42
|
+
|
|
43
|
+
Before:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
export class UserRepository {
|
|
47
|
+
async getById(id: string, orgId: string) {
|
|
48
|
+
return User.findOne({ _id: id, organizationId: orgId, deletedAt: null }).lean();
|
|
49
|
+
}
|
|
50
|
+
async list(orgId: string, page: number, limit: number) {
|
|
51
|
+
const query = { organizationId: orgId, deletedAt: null };
|
|
52
|
+
const docs = await User.find(query).skip((page - 1) * limit).limit(limit).lean();
|
|
53
|
+
return { docs, total: await User.countDocuments(query) };
|
|
54
|
+
}
|
|
55
|
+
// update, softDelete, restore, uniqueness check: 60 more lines
|
|
56
|
+
}
|
|
57
|
+
userSchema.pre("save", function (next) { this.updatedAt = new Date(); next(); });
|
|
58
|
+
userSchema.set("toJSON", { transform: (_d, ret) => { delete ret.password; return ret; } });
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
After:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
// user.repository.ts
|
|
65
|
+
import { createRepository } from "@classytic/mongokit";
|
|
66
|
+
import { User } from "./user.model.js";
|
|
67
|
+
|
|
68
|
+
export const userRepo = createRepository(User, {
|
|
69
|
+
tenant: { tenantField: "organizationId", required: true },
|
|
70
|
+
softDelete: true,
|
|
71
|
+
timestamps: true,
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// user.resource.ts
|
|
75
|
+
import { defineResource, requireRoles } from "@classytic/arc";
|
|
76
|
+
import { createMongooseAdapter } from "@classytic/mongokit/adapter";
|
|
77
|
+
|
|
78
|
+
export const userResource = defineResource({
|
|
79
|
+
name: "user",
|
|
80
|
+
adapter: createMongooseAdapter(User, userRepo),
|
|
81
|
+
presets: ["softDelete"],
|
|
82
|
+
permissions: { list: requireRoles(["admin"]), get: requireRoles(["admin"]), create: requireRoles(["admin"]), update: requireRoles(["admin"]), delete: requireRoles(["admin"]) },
|
|
83
|
+
schemaOptions: { fieldRules: { password: { hidden: true }, organizationId: { systemManaged: true } } },
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`createRepository` installs plugins in the safe order (tenant before soft delete and cache, soft delete before batch). Hand-built `new Repository(Model, [...])` chains must keep that order.
|
|
88
|
+
|
|
89
|
+
## Where tenancy lives
|
|
90
|
+
|
|
91
|
+
One layer. Arc's `multiTenant` preset is the HTTP and MCP boundary and threads scope into the repo call. The repository `tenant` option protects non-HTTP callers (jobs, CLI) and is a safe second layer. Reads through the raw Mongoose model skip tenant, soft delete and cache: flag them.
|
|
92
|
+
|
|
93
|
+
## Order of adoption per model
|
|
94
|
+
|
|
95
|
+
1. Replace the repository class with `createRepository`.
|
|
96
|
+
2. Delete `pre('save')` stamping and the `toJSON` transform; declare `fieldRules` on the resource.
|
|
97
|
+
3. Convert remaining schema hooks to `repo.on("before:create" | "after:update" | ..., fn)`.
|
|
98
|
+
4. Replace pagination wrappers with `getAll`.
|
|
99
|
+
5. Wire `createMongooseAdapter(Model, repo)`; leave `schemaGenerator` at its default.
|
|
100
|
+
6. Run the existing tests unchanged; mongokit defaults match Mongoose semantics.
|
|
101
|
+
|
|
102
|
+
## Not mongokit's job
|
|
103
|
+
|
|
104
|
+
Connection lifecycle, response transforms (`_id` to `id`, field stripping), runtime type generation, CLI scaffolding (`arc generate` does that).
|