@classytic/arc 2.45.2 → 2.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{EventTransport-DHb1tpu-.mjs → EventTransport-BHKy4_Bi.mjs} +5 -6
- package/dist/{EventTransport-CiicKz2Z.d.mts → EventTransport-CYEoCJGe.d.mts} +0 -2
- package/dist/{HookSystem-C1u0EUnt.mjs → HookSystem-CAIDVoKC.mjs} +3 -4
- package/dist/{QueryCache--5uAuYPW.d.mts → QueryCache-DdvrGG8Q.d.mts} +1 -3
- package/dist/{ResourceRegistry-D2jXWVN_.mjs → ResourceRegistry-23Ml6FNe.mjs} +15 -4
- package/dist/{acquire-DTkA8Lme.mjs → acquire-DoFX06fm.mjs} +2 -3
- package/dist/{actionPermissions-DRVk6m7x.mjs → actionPermissions-DXrlWHHK.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-D48fUJv1.mjs → authorizationDecision-DYiubkYw.mjs} +5 -6
- package/dist/{base-CZyixEQR.d.mts → base-HXNgPQww.d.mts} +1 -7
- package/dist/{boundedMap-DkKiPifd.mjs → boundedMap-CtdzpJ3X.mjs} +2 -3
- package/dist/{buildHandler-BiZ4VATS.mjs → buildHandler-CARdmPNo.mjs} +5 -6
- package/dist/cache/index.d.mts +4 -10
- package/dist/cache/index.mjs +5 -6
- package/dist/{caching-Cj0as-P1.mjs → caching-QRiryDLs.mjs} +3 -4
- package/dist/{claimed-ChI13rUR.mjs → claimed-BLecr1j3.mjs} +2 -3
- package/dist/cleanup/index.d.mts +4 -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-D_aiew34.mjs → constants-Cx7BcnHT.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-QIZ2560Y.mjs → core-0WyMuo0f.mjs} +9 -12
- package/dist/{createActionRouter-CvH84dyx.mjs → createActionRouter-mLAGbpDV.mjs} +7 -8
- package/dist/{createAggregationRouter-DGyK2Hp6.mjs → createAggregationRouter-BEAjn3dA.mjs} +9 -10
- package/dist/{createApp-CKjZpmq9.mjs → createApp-QDP4vYWH.mjs} +49 -62
- package/dist/{createMcpServer-DSztofa9.d.mts → createMcpServer-DzXHX0SO.d.mts} +1 -3
- package/dist/{defineAggregation-BLza7Ca4.mjs → defineAggregation-CFNfvz-C.mjs} +2 -3
- package/dist/{defineResource-CEo0gDCb.mjs → defineResource-BROJmhzJ.mjs} +80 -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-BW2J3tNj.d.mts → elevation-DPD0hcU-.d.mts} +0 -2
- package/dist/{elevation-BJTsSnke.mjs → elevation-DrXeEWWk.mjs} +9 -10
- 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-2p4SL5zm.mjs → errorHandler-BiBXtxj4.mjs} +16 -6
- package/dist/{errors-JYc9vwqE.d.mts → errors-DTo0me1o.d.mts} +0 -2
- package/dist/{errors-grZkIA8N.mjs → errors-DnrUChAy.mjs} +2 -3
- package/dist/{eventPlugin-BtmA4-3P.d.mts → eventPlugin-BY38F6yK.d.mts} +1 -7
- package/dist/{eventPlugin-ItcYBGUs.mjs → eventPlugin-BhKLUe7H.mjs} +10 -12
- package/dist/{eventTypes-Ck6fD3ne.mjs → eventTypes-CCIRGakw.mjs} +5 -8
- package/dist/events/index.d.mts +5 -17
- package/dist/events/index.mjs +9 -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-bzkWPt1f.d.mts} +4 -10
- package/dist/{fields-BRX0Krcj.mjs → fields-CYdpcV73.mjs} +2 -3
- package/dist/{fields-BBSpf8pS.d.mts → fields-JTkrtO-r.d.mts} +0 -2
- package/dist/{filter-merge-CDc7YMwX.mjs → filter-merge-6kasezRH.mjs} +2 -3
- package/dist/{generate-DCGuEbqI.d.mts → generate-C-g_KOkV.d.mts} +0 -4
- package/dist/{generate-hvg7V2g1.mjs → generate-DUkcbc4r.mjs} +7 -12
- package/dist/{headers-Cqkg4LzI.mjs → headers-KxhrKevA.mjs} +3 -4
- package/dist/{health-PVt0VjOx.mjs → health-CRJg3IIq.mjs} +2 -3
- package/dist/{health-DyeP3mTW.mjs → health-jkYNdobJ.mjs} +4 -7
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/http-cache/index.d.mts +211 -0
- package/dist/http-cache/index.mjs +605 -0
- package/dist/http-cache/purgers/cloudflare.d.mts +13 -0
- package/dist/http-cache/purgers/cloudflare.mjs +46 -0
- package/dist/http-cache/purgers/fastly.d.mts +12 -0
- package/dist/http-cache/purgers/fastly.mjs +47 -0
- package/dist/http-cache/testing/index.d.mts +68 -0
- package/dist/http-cache/testing/index.mjs +168 -0
- package/dist/idempotency/index.d.mts +3 -9
- package/dist/idempotency/index.mjs +11 -14
- 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-BxZS-8So.d.mts} +67 -25
- package/dist/{index-WH7xgvxS.d.mts → index-Cy2-QffW.d.mts} +40 -92
- package/dist/{index-uhkUA5-U.d.mts → index-D1X_C_qz.d.mts} +13 -23
- package/dist/{index-CUJvoyw3.d.mts → index-DFCCQ9AE.d.mts} +2 -24
- package/dist/index.d.mts +7 -9
- package/dist/index.mjs +12 -13
- package/dist/{init-jC3rMPzb.mjs → init-CACwpktI.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 +5 -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-ptwyzZQ-.mjs → jsonBody-CzDBkCme.mjs} +3 -4
- package/dist/{keys-C1vFuSbv.mjs → keys-Cbwf6r1B.mjs} +2 -3
- package/dist/{loadResources-CHPDyIPn.mjs → loadResources-Kr6vuljv.mjs} +4 -5
- package/dist/{loadResourcesFromEntry-BkHHTu_B.mjs → loadResourcesFromEntry-D2e0qoDR.mjs} +3 -4
- package/dist/logger/index.d.mts +1 -3
- package/dist/logger/index.mjs +2 -2
- package/dist/{logger-C5bvCiAK.mjs → logger-C110X5Yz.mjs} +3 -5
- package/dist/{mcpPlugin-C9qohJCF.mjs → mcpPlugin-4lIPr9OJ.mjs} +41 -60
- package/dist/{memory-CxiTwT0j.mjs → memory-D9qkhXiB.mjs} +4 -5
- package/dist/{metrics-Ckp2zRy-.mjs → metrics-B-qrrWfI.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-CfnKuIuH.mjs → module-BD8xHgrz.mjs} +2 -3
- package/dist/{multiTenant-CAtYlW6H.d.mts → multiTenant-KZj8j1uJ.d.mts} +1 -5
- package/dist/{multipartBody-BFasGtP9.mjs → multipartBody-qU7KCn1l.mjs} +2 -3
- package/dist/observeSend-BnPtTotW.mjs +20 -0
- package/dist/{openapi-DAPxjYHX.mjs → openapi-DoVa5SVP.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-5Mnwcycy.d.mts} +3 -9
- package/dist/outbox-module-DyITEIop.mjs +297 -0
- package/dist/permissions/index.d.mts +4 -4
- package/dist/permissions/index.mjs +7 -7
- package/dist/{permissions-B14c3OMp.mjs → permissions-BBy4bOGi.mjs} +19 -29
- package/dist/{pipe-CQv7PsAK.mjs → pipe-BOm2o4UA.mjs} +3 -4
- package/dist/pipeline/index.d.mts +1 -9
- package/dist/pipeline/index.mjs +5 -8
- package/dist/{plan-CpnTykjb.mjs → plan-DDIGwuxr.mjs} +5 -9
- package/dist/{plugin-DXTjVg_Q.mjs → plugin-Bn4D_0XK.mjs} +156 -64
- 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-C3VJKRGp.mjs → pluralize-ClEjcKlG.mjs} +2 -3
- package/dist/policy.types-DPqToKG1.d.mts +50 -0
- 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-CquqYJPy.mjs → presets-DK2jh5YR.mjs} +11 -18
- package/dist/{projection-CgfSLOSM.mjs → projection-BHH-sXyS.mjs} +3 -4
- package/dist/purger.types-2wNJK_89.mjs +24 -0
- package/dist/purger.types-DvPp4-yd.d.mts +26 -0
- package/dist/{pushref-registry-UxCkoA4C.d.mts → pushref-registry-d86QUaSq.d.mts} +0 -6
- package/dist/{queryCachePlugin-D0HUISHJ.mjs → queryCachePlugin-Ckqe98AM.mjs} +8 -10
- package/dist/{queryCachePlugin-C2lZjTxk.d.mts → queryCachePlugin-DYQUyeJ9.d.mts} +2 -4
- package/dist/{rateLimitKey-AvkBOMkl.mjs → rateLimitKey-CWAjlqcN.mjs} +2 -3
- package/dist/{realtime-CbWtVbqK.mjs → realtime-BIJi9USY.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-BVwpAuFI.mjs → registry-y9ZA-R_J.mjs} +7 -12
- package/dist/{outbox-module-B4FAkx3A.mjs → relay-BNrC1CEP.mjs} +8 -306
- package/dist/{renewingLease-CykpeNcQ.mjs → renewingLease-CS43br5E.mjs} +2 -3
- package/dist/{replyHelpers-DA51IZio.mjs → replyHelpers-oZDzakGb.mjs} +3 -4
- package/dist/{requestContext-DIWHKDtQ.mjs → requestContext-fWb_YaV2.mjs} +2 -3
- package/dist/{requirement-Cp_fsMDL.mjs → requirement--2hWyyHi.mjs} +2 -3
- package/dist/{requirement-CbiLdQ1n.d.mts → requirement-CTRQjjQx.d.mts} +0 -2
- package/dist/{resourceRateLimit-BFuluodF.mjs → resourceRateLimit-1WbcyMZY.mjs} +3 -4
- package/dist/{resourceRateLimit-Wf6d6FL9.d.mts → resourceRateLimit-DCWglD7V.d.mts} +1 -3
- package/dist/{rolldown-runtime-D_lMdYOd.mjs → rolldown-runtime-yH2lHMo_.mjs} +2 -3
- package/dist/{routeValidator-DuLonYwr.mjs → routeValidator-BSlRIA5c.mjs} +2 -3
- package/dist/{runtimeCapabilities-CydRfm0i.mjs → runtimeCapabilities-CYCEtU1W.mjs} +2 -3
- package/dist/{schedules-B693KXxa.mjs → schedules-B5WGlYIT.mjs} +132 -9
- package/dist/{schemaConverter-DNvZWTV6.mjs → schemaConverter-DtNvts-6.mjs} +3 -4
- package/dist/{schemaIR-REV2y7Wd.mjs → schemaIR-uS_RHqa3.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-Bevxy_ST.mjs → scope-BwVLSyNG.mjs} +5 -6
- package/dist/{sessionManager-qimlKV0P.d.mts → sessionManager-CdvDF04x.d.mts} +2 -4
- package/dist/{shutdown-CfrqPR7A.mjs → shutdown-BJiJN7FT.mjs} +2 -3
- package/dist/{simpleEqualityMatcher-BJwfuRKP.mjs → simpleEqualityMatcher-DGRLq-1k.mjs} +2 -3
- package/dist/{sse-CuNNWr2z.mjs → sse-B_50llZu.mjs} +8 -9
- package/dist/{sseStream-C_2ujAVY.mjs → sseStream-BjSo9Ult.mjs} +3 -4
- package/dist/{storage-Cx9Sz3Ou.d.mts → storage-odC5MNKN.d.mts} +0 -2
- package/dist/{store-helpers-C8uBGCbb.mjs → store-helpers-D-n5cwy5.mjs} +2 -3
- package/dist/{streaming-Bdq_M4d5.mjs → streaming-Dcgqa-hH.mjs} +2 -3
- package/dist/{subscriberIdentity-B-KpZkdl.mjs → subscriberIdentity-C9KhIXTF.mjs} +2 -3
- package/dist/{tenancy-C5PCvm1h.mjs → tenancy-COrhjPRZ.mjs} +3 -4
- package/dist/{tenantPreparation-dYvWrgNa.mjs → tenantPreparation-BElWHytd.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-DCqsezX8.mjs → timing-CaxKbRk_.mjs} +3 -5
- package/dist/{tracing-Dro5eH6j.d.mts → tracing-JSFiBl5r.d.mts} +0 -2
- package/dist/{transactionContext-DrcNyjpv.mjs → transactionContext-8qKON0Nk.mjs} +2 -3
- package/dist/{typeGuards-CEl10KPy.mjs → typeGuards-DVjVSsXO.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-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-D9NWjpYc.mjs → types-DZHqOuJE.mjs} +5 -6
- package/dist/{types-D3Ixsh00.d.mts → types-DeLiuaNv.d.mts} +2 -4
- 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-BHig1kHq.mjs → userHelpers-_eGj6kf0.mjs} +2 -3
- package/dist/utils/index.d.mts +5 -39
- package/dist/utils/index.mjs +12 -12
- package/dist/{utils-BG5P7_Vb.mjs → utils-Dd6MWpye.mjs} +20 -30
- package/dist/{validate-D_mdOCir.mjs → validate-BaF5wd0x.mjs} +5 -7
- package/dist/{versioning-DBGHjPh7.mjs → versioning-DyV7mwtK.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-DPPfM4m6.mjs → workScope-CmCBUmPR.mjs} +3 -4
- package/llms.txt +37 -30
- package/package.json +51 -22
- 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,29 +1,29 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { g as SYSTEM_FIELDS, o as DEFAULT_TENANT_FIELD, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS } from "./constants-
|
|
3
|
-
import { t as arcLog } from "./logger-
|
|
4
|
-
import { t as conjoinPolicyFilters } from "./filter-merge-
|
|
5
|
-
import { d as createDomainError, f as createError, i as NotFoundError, p as isArcError, r as ForbiddenError, u as ValidationError } from "./errors-
|
|
6
|
-
import { t as simpleEqualityMatcher } from "./simpleEqualityMatcher-
|
|
7
|
-
import { n as requireSingleHeaderValue } from "./headers-
|
|
8
|
-
import { n as getUserRoles, t as getUserId } from "./userHelpers-
|
|
9
|
-
import { b as isElevated, c as getOrgId, n as PUBLIC_SCOPE, x as isMember } from "./types-
|
|
10
|
-
import { r as resolveTenancy } from "./tenancy-
|
|
11
|
-
import { t as buildQueryKey } from "./keys-
|
|
12
|
-
import { t as transactionContext } from "./transactionContext-
|
|
13
|
-
import { a as resolveEffectiveRoles, n as applyFieldWritePermissions } from "./fields-
|
|
14
|
-
import { E as ArcQueryParser, v as getDefaultCrudSchemas } from "./utils-
|
|
15
|
-
import { n as convertRouteSchema, r as ensureSchemaConverter, t as convertOpenApiSchemas } from "./schemaConverter-
|
|
16
|
-
import { i as pipeUIMessageStreamToReply, r as isReadableStream } from "./streaming-
|
|
17
|
-
import { _ as buildArcDecorator, a as resolveRouterPluginMw, b as createRequestContext, c as buildPipelineHandler, d as buildCrudPermissionMw, f as buildRouteHooks, h as buildAuthMiddleware, i as buildRouteConfig, l as resolvePipelineSteps, m as routeHookOptions, n as tryRegisterRoute, o as selectPluginMw, p as resolveRoutePreHandlers, r as buildRateLimitConfig, t as resolveActionPermission, v as createCrudHandlers, y as createFastifyHandler } from "./actionPermissions-
|
|
18
|
-
import { a as withoutTenantInjection } from "./tenantPreparation-
|
|
19
|
-
import { t as hasEvents } from "./typeGuards-
|
|
20
|
-
import { n as idempotencyConfigProblem } from "./requirement
|
|
1
|
+
/*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
|
|
2
|
+
import { g as SYSTEM_FIELDS, o as DEFAULT_TENANT_FIELD, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS } from "./constants-Cx7BcnHT.mjs";
|
|
3
|
+
import { t as arcLog } from "./logger-C110X5Yz.mjs";
|
|
4
|
+
import { t as conjoinPolicyFilters } from "./filter-merge-6kasezRH.mjs";
|
|
5
|
+
import { d as createDomainError, f as createError, i as NotFoundError, p as isArcError, r as ForbiddenError, u as ValidationError } from "./errors-DnrUChAy.mjs";
|
|
6
|
+
import { t as simpleEqualityMatcher } from "./simpleEqualityMatcher-DGRLq-1k.mjs";
|
|
7
|
+
import { n as requireSingleHeaderValue } from "./headers-KxhrKevA.mjs";
|
|
8
|
+
import { n as getUserRoles, t as getUserId } from "./userHelpers-_eGj6kf0.mjs";
|
|
9
|
+
import { b as isElevated, c as getOrgId, n as PUBLIC_SCOPE, x as isMember } from "./types-DZHqOuJE.mjs";
|
|
10
|
+
import { r as resolveTenancy } from "./tenancy-COrhjPRZ.mjs";
|
|
11
|
+
import { t as buildQueryKey } from "./keys-Cbwf6r1B.mjs";
|
|
12
|
+
import { t as transactionContext } from "./transactionContext-8qKON0Nk.mjs";
|
|
13
|
+
import { a as resolveEffectiveRoles, n as applyFieldWritePermissions } from "./fields-CYdpcV73.mjs";
|
|
14
|
+
import { E as ArcQueryParser, v as getDefaultCrudSchemas } from "./utils-Dd6MWpye.mjs";
|
|
15
|
+
import { n as convertRouteSchema, r as ensureSchemaConverter, t as convertOpenApiSchemas } from "./schemaConverter-DtNvts-6.mjs";
|
|
16
|
+
import { i as pipeUIMessageStreamToReply, r as isReadableStream } from "./streaming-Dcgqa-hH.mjs";
|
|
17
|
+
import { _ as buildArcDecorator, a as resolveRouterPluginMw, b as createRequestContext, c as buildPipelineHandler, d as buildCrudPermissionMw, f as buildRouteHooks, h as buildAuthMiddleware, i as buildRouteConfig, l as resolvePipelineSteps, m as routeHookOptions, n as tryRegisterRoute, o as selectPluginMw, p as resolveRoutePreHandlers, r as buildRateLimitConfig, t as resolveActionPermission, v as createCrudHandlers, y as createFastifyHandler } from "./actionPermissions-DXrlWHHK.mjs";
|
|
18
|
+
import { a as withoutTenantInjection } from "./tenantPreparation-BElWHytd.mjs";
|
|
19
|
+
import { t as hasEvents } from "./typeGuards-DVjVSsXO.mjs";
|
|
20
|
+
import { n as idempotencyConfigProblem } from "./requirement--2hWyyHi.mjs";
|
|
21
21
|
import { ARC_ERROR_CODES } from "@classytic/repo-core/errors";
|
|
22
22
|
import { policyRecordToFilter } from "@classytic/repo-core/filter";
|
|
23
23
|
import { retryingTransaction } from "@classytic/repo-core/repository";
|
|
24
24
|
import { scheduleBackground } from "@classytic/repo-core/cache";
|
|
25
25
|
import { isProductionEnv, readEnv } from "@classytic/primitives/environment";
|
|
26
|
-
|
|
26
|
+
// src/core/repositoryFilter.ts
|
|
27
27
|
const NATIVE_FILTER_DIALECT = Symbol.for("@classytic/arc/native-filter-dialect");
|
|
28
28
|
/**
|
|
29
29
|
* Mark a server-owned policy as intentionally adapter-native. This is an
|
|
@@ -96,8 +96,7 @@ function toRepositoryFilter(record) {
|
|
|
96
96
|
return record;
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
|
|
100
|
-
//#region src/core/AccessControl.ts
|
|
99
|
+
// src/core/AccessControl.ts
|
|
101
100
|
const log$1 = arcLog("access-control");
|
|
102
101
|
var AccessControl = class {
|
|
103
102
|
tenantField;
|
|
@@ -329,8 +328,7 @@ var AccessControl = class {
|
|
|
329
328
|
return req.metadata;
|
|
330
329
|
}
|
|
331
330
|
};
|
|
332
|
-
|
|
333
|
-
//#region src/core/BodySanitizer.ts
|
|
331
|
+
// src/core/BodySanitizer.ts
|
|
334
332
|
/**
|
|
335
333
|
* BodySanitizer - Composable body sanitization logic extracted from BaseController.
|
|
336
334
|
*
|
|
@@ -390,8 +388,7 @@ var BodySanitizer = class {
|
|
|
390
388
|
return sanitized;
|
|
391
389
|
}
|
|
392
390
|
};
|
|
393
|
-
|
|
394
|
-
//#region src/core/crud/requestPipeline.ts
|
|
391
|
+
// src/core/crud/requestPipeline.ts
|
|
395
392
|
/**
|
|
396
393
|
* Build the canonical repo-options bag from the Fastify request.
|
|
397
394
|
*
|
|
@@ -650,8 +647,7 @@ async function executeAfterHook(ctx, op, data, meta) {
|
|
|
650
647
|
...meta ? { meta } : {}
|
|
651
648
|
});
|
|
652
649
|
}
|
|
653
|
-
|
|
654
|
-
//#region src/utils/repoFeature.ts
|
|
650
|
+
// src/utils/repoFeature.ts
|
|
655
651
|
/**
|
|
656
652
|
* Repository feature-detection helper for arc mixins.
|
|
657
653
|
*
|
|
@@ -689,8 +685,7 @@ async function executeAfterHook(ctx, op, data, meta) {
|
|
|
689
685
|
function withRepoFeatures(repo) {
|
|
690
686
|
return repo;
|
|
691
687
|
}
|
|
692
|
-
|
|
693
|
-
//#region src/core/crud/resourceVerbs.ts
|
|
688
|
+
// src/core/crud/resourceVerbs.ts
|
|
694
689
|
const isTruthyFlag = (value) => value !== void 0 && value !== "" && value !== "false" && value !== false;
|
|
695
690
|
/**
|
|
696
691
|
* Match a request query against the resource-dispatch verbs. Returns
|
|
@@ -745,8 +740,7 @@ async function runExistsVerb(repository, resolveScope) {
|
|
|
745
740
|
const { filter, options } = resolveScope();
|
|
746
741
|
return await repo.exists(filter, options);
|
|
747
742
|
}
|
|
748
|
-
|
|
749
|
-
//#region src/core/fieldRulePredicates.ts
|
|
743
|
+
// src/core/fieldRulePredicates.ts
|
|
750
744
|
/**
|
|
751
745
|
* True when the field is allowed to appear in client-readable surfaces
|
|
752
746
|
* (response payloads, `select=` whitelists, `_distinct` queries).
|
|
@@ -790,8 +784,7 @@ function collectReadBlockedFields(schemaOptions) {
|
|
|
790
784
|
}
|
|
791
785
|
return blocked.size > 0 ? blocked : null;
|
|
792
786
|
}
|
|
793
|
-
|
|
794
|
-
//#region src/core/QueryResolver.ts
|
|
787
|
+
// src/core/QueryResolver.ts
|
|
795
788
|
/**
|
|
796
789
|
* QueryResolver - Composable query resolution logic extracted from BaseController.
|
|
797
790
|
*
|
|
@@ -1142,8 +1135,7 @@ function readKeysetControls(query) {
|
|
|
1142
1135
|
...typeof before === "string" ? { before } : {}
|
|
1143
1136
|
};
|
|
1144
1137
|
}
|
|
1145
|
-
|
|
1146
|
-
//#region src/core/BaseCrudController.ts
|
|
1138
|
+
// src/core/BaseCrudController.ts
|
|
1147
1139
|
/**
|
|
1148
1140
|
* Framework-agnostic CRUD controller implementing IController.
|
|
1149
1141
|
* Composes AccessControl, BodySanitizer, and QueryResolver.
|
|
@@ -1880,8 +1872,7 @@ var BaseCrudController = class {
|
|
|
1880
1872
|
* A duck-typed `configure()` is not proof that `writes` is dispatched.
|
|
1881
1873
|
*/
|
|
1882
1874
|
markWriteVerbCapable(BaseCrudController.prototype);
|
|
1883
|
-
|
|
1884
|
-
//#region src/core/mixins/bulk.ts
|
|
1875
|
+
// src/core/mixins/bulk.ts
|
|
1885
1876
|
/**
|
|
1886
1877
|
* BulkMixin — `bulkCreate` / `bulkUpdate` / `bulkDelete` endpoints.
|
|
1887
1878
|
*
|
|
@@ -2081,8 +2072,7 @@ function BulkMixin(Base) {
|
|
|
2081
2072
|
}
|
|
2082
2073
|
};
|
|
2083
2074
|
}
|
|
2084
|
-
|
|
2085
|
-
//#region src/core/mixins/slug.ts
|
|
2075
|
+
// src/core/mixins/slug.ts
|
|
2086
2076
|
function SlugMixin(Base) {
|
|
2087
2077
|
return class SlugController extends Base {
|
|
2088
2078
|
async getBySlug(req) {
|
|
@@ -2119,8 +2109,7 @@ function SlugMixin(Base) {
|
|
|
2119
2109
|
}
|
|
2120
2110
|
};
|
|
2121
2111
|
}
|
|
2122
|
-
|
|
2123
|
-
//#region src/core/mixins/softDelete.ts
|
|
2112
|
+
// src/core/mixins/softDelete.ts
|
|
2124
2113
|
function SoftDeleteMixin(Base) {
|
|
2125
2114
|
return class SoftDeleteController extends Base {
|
|
2126
2115
|
async getDeleted(req) {
|
|
@@ -2180,8 +2169,7 @@ function SoftDeleteMixin(Base) {
|
|
|
2180
2169
|
}
|
|
2181
2170
|
};
|
|
2182
2171
|
}
|
|
2183
|
-
|
|
2184
|
-
//#region src/core/mixins/tree.ts
|
|
2172
|
+
// src/core/mixins/tree.ts
|
|
2185
2173
|
function TreeMixin(Base) {
|
|
2186
2174
|
return class TreeController extends Base {
|
|
2187
2175
|
async getTree(req) {
|
|
@@ -2206,15 +2194,13 @@ function TreeMixin(Base) {
|
|
|
2206
2194
|
}
|
|
2207
2195
|
};
|
|
2208
2196
|
}
|
|
2209
|
-
|
|
2210
|
-
//#region src/core/BaseController.ts
|
|
2197
|
+
// src/core/BaseController.ts
|
|
2211
2198
|
/**
|
|
2212
2199
|
* Fully-composed controller: `BaseCrudController` + SoftDelete + Tree +
|
|
2213
2200
|
* Slug + Bulk. The companion interface above types every method over `TDoc`.
|
|
2214
2201
|
*/
|
|
2215
2202
|
var BaseController = class extends SoftDeleteMixin(TreeMixin(SlugMixin(BulkMixin(BaseCrudController)))) {};
|
|
2216
|
-
|
|
2217
|
-
//#region src/core/middlewares/fieldWrite.ts
|
|
2203
|
+
// src/core/middlewares/fieldWrite.ts
|
|
2218
2204
|
/**
|
|
2219
2205
|
* Build a preHandler that enforces field-write permissions on the request body.
|
|
2220
2206
|
*
|
|
@@ -2255,13 +2241,35 @@ function methodCarriesBody(method) {
|
|
|
2255
2241
|
const m = method.toUpperCase();
|
|
2256
2242
|
return m === "POST" || m === "PUT" || m === "PATCH";
|
|
2257
2243
|
}
|
|
2258
|
-
|
|
2259
|
-
//#region src/core/createCrudRouter.ts
|
|
2244
|
+
// src/core/createCrudRouter.ts
|
|
2260
2245
|
/**
|
|
2261
2246
|
* Fold a route's host-supplied `config` together with arc's derived one into the
|
|
2262
2247
|
* SINGLE `config` key Fastify reads. Returns arc's object untouched when the host
|
|
2263
2248
|
* supplied none, so the route options stay literally what was declared.
|
|
2264
2249
|
*/
|
|
2250
|
+
/** The `config.httpCache` a CRUD read route carries when its resource declared `httpCache`. */
|
|
2251
|
+
function routeHttpCache(httpCache, resourceName, op) {
|
|
2252
|
+
if (!httpCache || op !== "list" && op !== "get") return void 0;
|
|
2253
|
+
const policy = op === "list" ? httpCache.list : httpCache.get;
|
|
2254
|
+
if (!policy) return void 0;
|
|
2255
|
+
const extra = httpCache.tags?.extra;
|
|
2256
|
+
return {
|
|
2257
|
+
...policy,
|
|
2258
|
+
resource: {
|
|
2259
|
+
name: resourceName,
|
|
2260
|
+
op,
|
|
2261
|
+
...extra ? { extra } : {}
|
|
2262
|
+
}
|
|
2263
|
+
};
|
|
2264
|
+
}
|
|
2265
|
+
/** Add `httpCache` to a route's `config`, keeping whatever `buildRouteConfig` produced. */
|
|
2266
|
+
function withHttpCache(base, policy) {
|
|
2267
|
+
if (!policy) return base;
|
|
2268
|
+
return { config: {
|
|
2269
|
+
...base.config ?? {},
|
|
2270
|
+
httpCache: policy
|
|
2271
|
+
} };
|
|
2272
|
+
}
|
|
2265
2273
|
function mergeRouteConfig(hostConfig, arcConfig) {
|
|
2266
2274
|
if (!hostConfig) return arcConfig;
|
|
2267
2275
|
return { config: {
|
|
@@ -2390,7 +2398,7 @@ function createCustomRoutes(fastify, routes, controller, options) {
|
|
|
2390
2398
|
* @param options - Router configuration
|
|
2391
2399
|
*/
|
|
2392
2400
|
function createCrudRouter(fastify, controller, options = {}) {
|
|
2393
|
-
const { tag = "Resource", schemas = {}, permissions = {}, middlewares = {}, routeGuards = [], routes: customRoutes = [], disableDefaultRoutes = false, disabledRoutes = [], resourceName = "unknown", schemaOptions, rateLimit, pipe: pipeline, fields: fieldPermissions, onFieldWriteDenied, updateMethod = DEFAULT_UPDATE_METHOD, idField, extensions, idempotency } = options;
|
|
2401
|
+
const { tag = "Resource", schemas = {}, permissions = {}, middlewares = {}, routeGuards = [], routes: customRoutes = [], disableDefaultRoutes = false, disabledRoutes = [], resourceName = "unknown", schemaOptions, rateLimit, pipe: pipeline, fields: fieldPermissions, onFieldWriteDenied, updateMethod = DEFAULT_UPDATE_METHOD, idField, extensions, idempotency, httpCache } = options;
|
|
2394
2402
|
const idempotentOps = new Set(idempotency?.required ?? []);
|
|
2395
2403
|
for (const op of idempotentOps) if (disableDefaultRoutes || disabledRoutes.includes(op)) throw new Error(`[arc] Resource "${resourceName}" declares idempotency.required '${op}', but that built-in route is not mounted — drop it from idempotency.required.`);
|
|
2396
2404
|
const rateLimitConfig = buildRateLimitConfig(rateLimit);
|
|
@@ -2488,7 +2496,7 @@ function createCrudRouter(fastify, controller, options = {}) {
|
|
|
2488
2496
|
}, defaultSchemas[spec.op], schemas[spec.op]),
|
|
2489
2497
|
...routeHookOptions(hooks),
|
|
2490
2498
|
handler: handlers[spec.op],
|
|
2491
|
-
...buildRouteConfig(rateLimitConfig, extensions, void 0, idempotentOps.has(spec.op) ? { required: true } : void 0)
|
|
2499
|
+
...withHttpCache(buildRouteConfig(rateLimitConfig, extensions, void 0, idempotentOps.has(spec.op) ? { required: true } : void 0), routeHttpCache(httpCache, resourceName, spec.op))
|
|
2492
2500
|
}, {
|
|
2493
2501
|
resourceName,
|
|
2494
2502
|
op: spec.op
|
|
@@ -2529,8 +2537,7 @@ function buildCrudHandlers(ctrl, pipeline, resourceName) {
|
|
|
2529
2537
|
function createPermissionMiddleware(permission, resourceName, action) {
|
|
2530
2538
|
return buildCrudPermissionMw(permission, resourceName, action);
|
|
2531
2539
|
}
|
|
2532
|
-
|
|
2533
|
-
//#region src/core/schemaOptions.ts
|
|
2540
|
+
// src/core/schemaOptions.ts
|
|
2534
2541
|
/**
|
|
2535
2542
|
* Inject the tenant-scoping field rule into `schemaOptions.fieldRules`:
|
|
2536
2543
|
*
|
|
@@ -2631,8 +2638,94 @@ function stripSystemManagedFromBodyRequired(schemas, schemaOptions) {
|
|
|
2631
2638
|
if (updateBody !== schemas.updateBody) next.updateBody = updateBody;
|
|
2632
2639
|
return next;
|
|
2633
2640
|
}
|
|
2634
|
-
|
|
2635
|
-
|
|
2641
|
+
// src/core/routeInput.ts
|
|
2642
|
+
function isParseable(schema) {
|
|
2643
|
+
return typeof schema === "object" && schema !== null && typeof schema.safeParse === "function";
|
|
2644
|
+
}
|
|
2645
|
+
/** Parse `value` with `schema`; zod issues become one `ValidationError` (400, `details[]`). */
|
|
2646
|
+
function parseOrThrow(schema, value) {
|
|
2647
|
+
const result = schema.safeParse(value);
|
|
2648
|
+
if (result.success) return result.data;
|
|
2649
|
+
throw new ValidationError("Validation failed", (result.error?.issues ?? []).map((issue) => ({
|
|
2650
|
+
field: issue.path.map(String).join("."),
|
|
2651
|
+
message: issue.message
|
|
2652
|
+
})));
|
|
2653
|
+
}
|
|
2654
|
+
/**
|
|
2655
|
+
* Spread into a route entry: `{ method, path, permissions, ...routeInput({ body }), handler }`.
|
|
2656
|
+
* `preHandler` is empty when no zod body/querystring/params slot is declared.
|
|
2657
|
+
*/
|
|
2658
|
+
function routeInput(slots) {
|
|
2659
|
+
const { body, querystring, params } = slots;
|
|
2660
|
+
const parseBody = isParseable(body) ? body : void 0;
|
|
2661
|
+
const parseQuery = isParseable(querystring) ? querystring : void 0;
|
|
2662
|
+
const parseParams = isParseable(params) ? params : void 0;
|
|
2663
|
+
if (!parseBody && !parseQuery && !parseParams) return {
|
|
2664
|
+
schema: slots,
|
|
2665
|
+
preHandler: []
|
|
2666
|
+
};
|
|
2667
|
+
const parse = async (request) => {
|
|
2668
|
+
if (parseParams) request.params = parseOrThrow(parseParams, request.params ?? {});
|
|
2669
|
+
if (parseQuery) request.query = parseOrThrow(parseQuery, request.query ?? {});
|
|
2670
|
+
if (parseBody) request.body = parseOrThrow(parseBody, request.body ?? {});
|
|
2671
|
+
};
|
|
2672
|
+
return {
|
|
2673
|
+
schema: slots,
|
|
2674
|
+
preHandler: [parse]
|
|
2675
|
+
};
|
|
2676
|
+
}
|
|
2677
|
+
/** The request part {@link routeInput} already parsed with `schema`: typed from it, not parsed again. */
|
|
2678
|
+
function parsed(_schema, value) {
|
|
2679
|
+
return value;
|
|
2680
|
+
}
|
|
2681
|
+
/**
|
|
2682
|
+
* A body that must be empty. As an action `schema` (or route `body`) AJV rejects any stray field,
|
|
2683
|
+
* and the reference states that the verb takes nothing else. Plain JSON Schema, so no zod needed.
|
|
2684
|
+
*/
|
|
2685
|
+
const noPayloadSchema = Object.freeze({
|
|
2686
|
+
type: "object",
|
|
2687
|
+
properties: {},
|
|
2688
|
+
additionalProperties: false
|
|
2689
|
+
});
|
|
2690
|
+
/**
|
|
2691
|
+
* Wire shape of a resource's own CRUD writes. Spread into `defineResource`:
|
|
2692
|
+
* `customSchemas` is what AJV validates (and, for zod, converts input-direction: a `.default()`
|
|
2693
|
+
* stays optional; `z.strictObject` refuses unknown keys); `openApiSchemas` makes the generated
|
|
2694
|
+
* reference describe what the route accepts rather than the stored model.
|
|
2695
|
+
*
|
|
2696
|
+
* `parse: true` also adds a create/update middleware that replaces `request.body` with the zod
|
|
2697
|
+
* OUTPUT (trim, defaults, refinements). It writes `middlewares.create` / `middlewares.update`, so
|
|
2698
|
+
* merge your own: `middlewares: { create: [...mine, ...crud.middlewares.create] }`.
|
|
2699
|
+
*/
|
|
2700
|
+
function crudInput(input) {
|
|
2701
|
+
const { create, update } = input;
|
|
2702
|
+
const parseBody = (schema) => input.parse && isParseable(schema) ? [(async (request) => {
|
|
2703
|
+
request.body = parseOrThrow(schema, request.body ?? {});
|
|
2704
|
+
})] : [];
|
|
2705
|
+
return {
|
|
2706
|
+
customSchemas: {
|
|
2707
|
+
...create ? { create: { body: create } } : {},
|
|
2708
|
+
...update ? { update: { body: update } } : {}
|
|
2709
|
+
},
|
|
2710
|
+
openApiSchemas: {
|
|
2711
|
+
...create ? { createBody: create } : {},
|
|
2712
|
+
...update ? { updateBody: update } : {}
|
|
2713
|
+
},
|
|
2714
|
+
middlewares: {
|
|
2715
|
+
...create && input.parse ? { create: parseBody(create) } : {},
|
|
2716
|
+
...update && input.parse ? { update: parseBody(update) } : {}
|
|
2717
|
+
}
|
|
2718
|
+
};
|
|
2719
|
+
}
|
|
2720
|
+
/**
|
|
2721
|
+
* Wrap an action handler so `data` is the zod schema's OUTPUT. Used by `ActionDefinition.parse`
|
|
2722
|
+
* and `defineAction({ parse: true })`; a non-zod schema returns the handler unchanged.
|
|
2723
|
+
*/
|
|
2724
|
+
function withParsedInput(handler, schema) {
|
|
2725
|
+
if (!isParseable(schema)) return handler;
|
|
2726
|
+
return (id, data, req) => handler(id, parseOrThrow(schema, data), req);
|
|
2727
|
+
}
|
|
2728
|
+
// src/core/defineResource/schemas.ts
|
|
2636
2729
|
/**
|
|
2637
2730
|
* OpenAPI schema resolution — Phase 7 of `defineResource()`.
|
|
2638
2731
|
*
|
|
@@ -2793,8 +2886,7 @@ function mergeUserOpenApiOverrides(openApiSchemas, userOverrides) {
|
|
|
2793
2886
|
...userOverrides
|
|
2794
2887
|
};
|
|
2795
2888
|
}
|
|
2796
|
-
|
|
2797
|
-
//#region src/core/defineResource/plugin.ts
|
|
2889
|
+
// src/core/defineResource/plugin.ts
|
|
2798
2890
|
/**
|
|
2799
2891
|
* Build the CRUD schema map from the adapter's `OpenApiSchemas`, then layer
|
|
2800
2892
|
* `customSchemas` on top per slot (auto-gen always runs, so customising one
|
|
@@ -2949,7 +3041,7 @@ function normalizeActionsToRouterConfig(actions, resourceActionPermissions, tag,
|
|
|
2949
3041
|
if (typeof entry === "function") handlers[name] = entry;
|
|
2950
3042
|
else {
|
|
2951
3043
|
const def = entry;
|
|
2952
|
-
handlers[name] = def.handler;
|
|
3044
|
+
handlers[name] = def.parse ? withParsedInput(def.handler, def.schema) : def.handler;
|
|
2953
3045
|
if (def.schema) schemas[name] = def.schema;
|
|
2954
3046
|
if (def.id === false) idLessActionNames.push(name);
|
|
2955
3047
|
if (def.idempotency?.required === true) idempotentActionNames.push(name);
|
|
@@ -3076,6 +3168,7 @@ function buildResourcePlugin(resource) {
|
|
|
3076
3168
|
schemaOptions: resource.schemaOptions,
|
|
3077
3169
|
rateLimit: resource.rateLimit,
|
|
3078
3170
|
idempotency: resource.idempotency,
|
|
3171
|
+
httpCache: resource.httpCache,
|
|
3079
3172
|
updateMethod: resource.updateMethod,
|
|
3080
3173
|
pipe: resource.pipe,
|
|
3081
3174
|
fields: resource.fields,
|
|
@@ -3084,7 +3177,7 @@ function buildResourcePlugin(resource) {
|
|
|
3084
3177
|
extensions: resource.extensions
|
|
3085
3178
|
});
|
|
3086
3179
|
if (resource.actions && Object.keys(resource.actions).length > 0) {
|
|
3087
|
-
const { createActionRouter } = await import("./createActionRouter-
|
|
3180
|
+
const { createActionRouter } = await import("./createActionRouter-mLAGbpDV.mjs").then((n) => n.n);
|
|
3088
3181
|
const actionConfig = normalizeActionsToRouterConfig(resource.actions, resource.actionPermissions, resource.tag, resource.permissions, resource.name, typedInstance.log);
|
|
3089
3182
|
const actionTarget = resolveActionTargetFence(resource, actionConfig);
|
|
3090
3183
|
createActionRouter(typedInstance, {
|
|
@@ -3104,7 +3197,7 @@ function buildResourcePlugin(resource) {
|
|
|
3104
3197
|
});
|
|
3105
3198
|
}
|
|
3106
3199
|
if (resource.aggregations && Object.keys(resource.aggregations).length > 0) {
|
|
3107
|
-
const [{ createAggregationRouter }, { adapterSupportsAggregate, ArcAggregationConfigError }] = await Promise.all([import("./createAggregationRouter-
|
|
3200
|
+
const [{ createAggregationRouter }, { adapterSupportsAggregate, ArcAggregationConfigError }] = await Promise.all([import("./createAggregationRouter-BEAjn3dA.mjs"), import("./validate-BaF5wd0x.mjs").then((n) => n.r)]);
|
|
3108
3201
|
const repoForAgg = resource.controller?.repository ?? resource.repository;
|
|
3109
3202
|
if (!adapterSupportsAggregate(repoForAgg)) {
|
|
3110
3203
|
const undispatchable = Object.entries(resource.aggregations).filter(([, cfg]) => !cfg.materialized).map(([name]) => name);
|
|
@@ -3141,5 +3234,4 @@ function buildResourcePlugin(resource) {
|
|
|
3141
3234
|
} catch {}
|
|
3142
3235
|
};
|
|
3143
3236
|
}
|
|
3144
|
-
|
|
3145
|
-
export { toRepositoryFilter as C, nativePolicyFilter as S, pathTouchesBlocked as _, autoInjectTenantFieldRules as a, BodySanitizer as b, BaseController as c, SlugMixin as d, BulkMixin as f, isFieldReadable as g, collectReadBlockedFields as h, resolveOpenApiSchemas as i, TreeMixin as l, QueryResolver as m, normalizeActionsToRouterConfig as n, createCrudRouter as o, BaseCrudController as p, resolveActionTargetFence as r, createPermissionMiddleware as s, buildResourcePlugin as t, SoftDeleteMixin as u, detectOverriddenWriteSlots as v, AccessControl as x, isWriteVerbCapable as y };
|
|
3237
|
+
export { isWriteVerbCapable as C, toRepositoryFilter as D, nativePolicyFilter as E, detectOverriddenWriteSlots as S, AccessControl as T, BaseCrudController as _, crudInput as a, isFieldReadable as b, routeInput as c, createPermissionMiddleware as d, BaseController as f, BulkMixin as g, SlugMixin as h, resolveOpenApiSchemas as i, autoInjectTenantFieldRules as l, SoftDeleteMixin as m, normalizeActionsToRouterConfig as n, noPayloadSchema as o, TreeMixin as p, resolveActionTargetFence as r, parsed as s, buildResourcePlugin as t, createCrudRouter as u, QueryResolver as v, BodySanitizer as w, pathTouchesBlocked as x, collectReadBlockedFields as y };
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
import { t as AnyRecord } from "../base-
|
|
3
|
-
import { Et as RouteDefinition, J as MiddlewareConfig, U as PresetHook, X as RouteSchemaOptions } from "../index-
|
|
4
|
-
import { i as errorHandlerPlugin, n as ErrorMapper, r as defaultIsDuplicateKeyError, t as ErrorHandlerOptions } from "../errorHandler
|
|
5
|
-
import { C as
|
|
6
|
-
import { i as _default, n as ArcCorePluginOptions, r as PluginMeta, t as ArcCore } from "../fastify-augmentation-
|
|
7
|
-
import { _ as ShutdownState, a as MetricsOptions, c as RealtimeOptions, d as SSEStats, f as _default$9, g as GracefulShutdownOptions, h as _default$1, i as MetricsCollector, l as _default$6, m as CachingRule, n as _default$10, o as _default$4, p as CachingOptions, r as MetricEntry, s as ChangeOperation, t as VersioningOptions, u as SSEOptions, v as _default$2 } from "../versioning-
|
|
8
|
-
import { t as TracingOptions } from "../tracing-
|
|
2
|
+
import { t as AnyRecord } from "../base-HXNgPQww.mjs";
|
|
3
|
+
import { Et as RouteDefinition, J as MiddlewareConfig, U as PresetHook, X as RouteSchemaOptions } from "../index-Cy2-QffW.mjs";
|
|
4
|
+
import { i as errorHandlerPlugin, n as ErrorMapper, r as defaultIsDuplicateKeyError, t as ErrorHandlerOptions } from "../errorHandler-B9r88jZV.mjs";
|
|
5
|
+
import { A as DailyLedger, C as ScheduleStats, D as DailyClock, E as DailyClaimInfo, F as HealthCheck, I as HealthOptions, L as _default$3, M as MemoryDailyLedger, N as createDailyGate, O as DailyGate, P as createMemoryDailyLedger, S as ScheduleRunContext, T as _default$8, b as DailyScheduleOptions, j as DailyRunOutcome, k as DailyGateOptions, w as SchedulesPluginOptions, x as ScheduleDefinition } from "../types-BeEJm-DV.mjs";
|
|
6
|
+
import { i as _default, n as ArcCorePluginOptions, r as PluginMeta, t as ArcCore } from "../fastify-augmentation-bzkWPt1f.mjs";
|
|
7
|
+
import { _ as ShutdownState, a as MetricsOptions, c as RealtimeOptions, d as SSEStats, f as _default$9, g as GracefulShutdownOptions, h as _default$1, i as MetricsCollector, l as _default$6, m as CachingRule, n as _default$10, o as _default$4, p as CachingOptions, r as MetricEntry, s as ChangeOperation, t as VersioningOptions, u as SSEOptions, v as _default$2 } from "../versioning-S18y2-0C.mjs";
|
|
8
|
+
import { t as TracingOptions } from "../tracing-JSFiBl5r.mjs";
|
|
9
9
|
import { PaginatedResult } from "@classytic/repo-core/pagination";
|
|
10
10
|
import { FastifyInstance, FastifyPluginAsync } from "fastify";
|
|
11
|
-
//#region src/plugins/createPlugin.d.ts
|
|
12
11
|
interface PluginResourceResult {
|
|
13
12
|
/** Additional routes to add to the resource (v2.8 `RouteDefinition` shape) */
|
|
14
13
|
routes?: RouteDefinition[];
|
|
@@ -58,8 +57,6 @@ interface ArcPlugin<TRootOpts extends object = AnyRecord, TResourceOpts extends
|
|
|
58
57
|
* @returns ArcPlugin with forRoot() and forResource() methods
|
|
59
58
|
*/
|
|
60
59
|
export declare function createPlugin<TRootOpts extends object = AnyRecord, TResourceOpts extends object = AnyRecord>(name: string, definition: CreatePluginDefinition<TRootOpts, TResourceOpts>): ArcPlugin<TRootOpts, TResourceOpts>;
|
|
61
|
-
//#endregion
|
|
62
|
-
//#region src/plugins/pressure.d.ts
|
|
63
60
|
/**
|
|
64
61
|
* One measurable source of load, normalised by whoever owns it.
|
|
65
62
|
*
|
|
@@ -147,8 +144,6 @@ declare module "fastify" {
|
|
|
147
144
|
* the raw plugin, matching every other arc plugin entry.
|
|
148
145
|
*/
|
|
149
146
|
declare const _default$5: FastifyPluginAsync<PressureOptions>;
|
|
150
|
-
//#endregion
|
|
151
|
-
//#region src/plugins/replyHelpers.d.ts
|
|
152
147
|
declare module "fastify" {
|
|
153
148
|
interface FastifyReply {
|
|
154
149
|
/**
|
|
@@ -177,8 +172,6 @@ declare module "fastify" {
|
|
|
177
172
|
}
|
|
178
173
|
declare function replyHelpersPluginFn(fastify: FastifyInstance): Promise<void>;
|
|
179
174
|
export declare const replyHelpersPlugin: typeof replyHelpersPluginFn;
|
|
180
|
-
//#endregion
|
|
181
|
-
//#region src/plugins/requestId.d.ts
|
|
182
175
|
interface RequestIdOptions {
|
|
183
176
|
/** Header name to read/write request ID (default: 'x-request-id') */
|
|
184
177
|
header?: string;
|
|
@@ -225,5 +218,4 @@ export declare function createRequestIdGenerator(opts?: Pick<RequestIdOptions, "
|
|
|
225
218
|
headers: Record<string, string | string[] | undefined>;
|
|
226
219
|
}) => string;
|
|
227
220
|
declare const _default$7: FastifyPluginAsync<RequestIdOptions>;
|
|
228
|
-
|
|
229
|
-
export { type ArcCore, type ArcCorePluginOptions, type ArcPlugin, type CachingOptions, type CachingRule, type ChangeOperation, type CreatePluginDefinition, type ErrorHandlerOptions, type ErrorMapper, type GracefulShutdownOptions, type HealthCheck, type HealthOptions, type MetricEntry, type MetricsCollector, type MetricsOptions, type PluginMeta, type PluginResourceResult, type PressureApi, type PressureOptions, type PressureSignal, type PressureSnapshot, type PressureState, type PressureThresholds, type RealtimeOptions, type RequestIdOptions, type SSEOptions, type SSEStats, type ScheduleDefinition, type ScheduleStats, type SchedulesPluginOptions, type ShutdownState, type TracingOptions, type VersioningOptions, _default as arcCorePlugin, _default$1 as cachingPlugin, defaultIsDuplicateKeyError, errorHandlerPlugin, _default$2 as gracefulShutdownPlugin, _default$3 as healthPlugin, _default$4 as metricsPlugin, _default$5 as pressurePlugin, _default$6 as realtimePlugin, _default$7 as requestIdPlugin, _default$8 as schedulesPlugin, _default$9 as ssePlugin, _default$10 as versioningPlugin };
|
|
221
|
+
export { type ArcCore, type ArcCorePluginOptions, type ArcPlugin, type CachingOptions, type CachingRule, type ChangeOperation, type CreatePluginDefinition, type DailyClaimInfo, type DailyClock, type DailyGate, type DailyGateOptions, type DailyLedger, type DailyRunOutcome, type DailyScheduleOptions, type ErrorHandlerOptions, type ErrorMapper, type GracefulShutdownOptions, type HealthCheck, type HealthOptions, type MemoryDailyLedger, type MetricEntry, type MetricsCollector, type MetricsOptions, type PluginMeta, type PluginResourceResult, type PressureApi, type PressureOptions, type PressureSignal, type PressureSnapshot, type PressureState, type PressureThresholds, type RealtimeOptions, type RequestIdOptions, type SSEOptions, type SSEStats, type ScheduleDefinition, type ScheduleRunContext, type ScheduleStats, type SchedulesPluginOptions, type ShutdownState, type TracingOptions, type VersioningOptions, _default as arcCorePlugin, _default$1 as cachingPlugin, createDailyGate, createMemoryDailyLedger, defaultIsDuplicateKeyError, errorHandlerPlugin, _default$2 as gracefulShutdownPlugin, _default$3 as healthPlugin, _default$4 as metricsPlugin, _default$5 as pressurePlugin, _default$6 as realtimePlugin, _default$7 as requestIdPlugin, _default$8 as schedulesPlugin, _default$9 as ssePlugin, _default$10 as versioningPlugin };
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { m as MUTATION_OPERATIONS } from "../constants-
|
|
3
|
-
import { t as arcLog } from "../logger-
|
|
4
|
-
import { c as getOrgId } from "../types-
|
|
5
|
-
import { n as requestContext } from "../requestContext-
|
|
6
|
-
import { t as hasEvents } from "../typeGuards-
|
|
7
|
-
import { t as HookSystem } from "../HookSystem-
|
|
8
|
-
import { t as ResourceRegistry } from "../ResourceRegistry-
|
|
9
|
-
import { c as createRequestIdGenerator, l as requestId_default, n as health_default, u as sanitizeRequestId } from "../health-
|
|
10
|
-
import { t as caching_default } from "../caching-
|
|
11
|
-
import {
|
|
12
|
-
import { t as
|
|
13
|
-
import { t as
|
|
14
|
-
import { t as
|
|
15
|
-
import { t as
|
|
16
|
-
import { t as sse_default } from "../sse-
|
|
17
|
-
import { t as versioning_default } from "../versioning-
|
|
1
|
+
/*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
|
|
2
|
+
import { m as MUTATION_OPERATIONS } from "../constants-Cx7BcnHT.mjs";
|
|
3
|
+
import { t as arcLog } from "../logger-C110X5Yz.mjs";
|
|
4
|
+
import { c as getOrgId } from "../types-DZHqOuJE.mjs";
|
|
5
|
+
import { n as requestContext } from "../requestContext-fWb_YaV2.mjs";
|
|
6
|
+
import { t as hasEvents } from "../typeGuards-DVjVSsXO.mjs";
|
|
7
|
+
import { t as HookSystem } from "../HookSystem-CAIDVoKC.mjs";
|
|
8
|
+
import { t as ResourceRegistry } from "../ResourceRegistry-23Ml6FNe.mjs";
|
|
9
|
+
import { c as createRequestIdGenerator, l as requestId_default, n as health_default, u as sanitizeRequestId } from "../health-jkYNdobJ.mjs";
|
|
10
|
+
import { t as caching_default } from "../caching-QRiryDLs.mjs";
|
|
11
|
+
import { i as createMemoryDailyLedger, r as createDailyGate, t as schedules_default } from "../schedules-B5WGlYIT.mjs";
|
|
12
|
+
import { n as errorHandlerPlugin, t as defaultIsDuplicateKeyError } from "../errorHandler-BiBXtxj4.mjs";
|
|
13
|
+
import { t as metrics_default } from "../metrics-B-qrrWfI.mjs";
|
|
14
|
+
import { t as realtime_default } from "../realtime-BIJi9USY.mjs";
|
|
15
|
+
import { t as replyHelpersPlugin } from "../replyHelpers-oZDzakGb.mjs";
|
|
16
|
+
import { t as sse_default } from "../sse-B_50llZu.mjs";
|
|
17
|
+
import { t as versioning_default } from "../versioning-DyV7mwtK.mjs";
|
|
18
18
|
import fp from "fastify-plugin";
|
|
19
19
|
import { performance as performance$1 } from "node:perf_hooks";
|
|
20
|
-
|
|
20
|
+
// src/core/arcCorePlugin.ts
|
|
21
21
|
const arcCorePlugin = async (fastify, opts = {}) => {
|
|
22
22
|
const { emitEvents = true, hookSystem, registry } = opts;
|
|
23
23
|
const actualHookSystem = hookSystem ?? new HookSystem();
|
|
@@ -121,8 +121,7 @@ var arcCorePlugin_default = fp(arcCorePlugin, {
|
|
|
121
121
|
name: "arc-core",
|
|
122
122
|
fastify: "5.x"
|
|
123
123
|
});
|
|
124
|
-
|
|
125
|
-
//#region src/plugins/createPlugin.ts
|
|
124
|
+
// src/plugins/createPlugin.ts
|
|
126
125
|
/**
|
|
127
126
|
* Create a structured plugin with forRoot (global) and forResource (per-resource) support.
|
|
128
127
|
*
|
|
@@ -152,8 +151,7 @@ function createPlugin(name, definition) {
|
|
|
152
151
|
}
|
|
153
152
|
};
|
|
154
153
|
}
|
|
155
|
-
|
|
156
|
-
//#region src/plugins/gracefulShutdown.ts
|
|
154
|
+
// src/plugins/gracefulShutdown.ts
|
|
157
155
|
const gracefulShutdownPlugin = async (fastify, opts = {}) => {
|
|
158
156
|
const { timeout = 3e4, onShutdown, signals = ["SIGTERM", "SIGINT"], logEvents = true, drainDelayMs = 0, onForceExit = () => process.exit(1) } = opts;
|
|
159
157
|
const state = { draining: false };
|
|
@@ -218,8 +216,7 @@ var gracefulShutdown_default = fp(gracefulShutdownPlugin, {
|
|
|
218
216
|
name: "arc-graceful-shutdown",
|
|
219
217
|
fastify: "5.x"
|
|
220
218
|
});
|
|
221
|
-
|
|
222
|
-
//#region src/plugins/pressure.ts
|
|
219
|
+
// src/plugins/pressure.ts
|
|
223
220
|
/**
|
|
224
221
|
* Admission control — ONE place that decides "are we saturated?".
|
|
225
222
|
*
|
|
@@ -389,5 +386,4 @@ var pressure_default = fp(pressurePlugin, {
|
|
|
389
386
|
name: "arc-pressure",
|
|
390
387
|
fastify: "5.x"
|
|
391
388
|
});
|
|
392
|
-
|
|
393
|
-
export { arcCorePlugin_default as arcCorePlugin, caching_default as cachingPlugin, createPlugin, createRequestIdGenerator, defaultIsDuplicateKeyError, errorHandlerPlugin, gracefulShutdown_default as gracefulShutdownPlugin, health_default as healthPlugin, metrics_default as metricsPlugin, pressure_default as pressurePlugin, realtime_default as realtimePlugin, replyHelpersPlugin, requestId_default as requestIdPlugin, sanitizeRequestId, schedules_default as schedulesPlugin, sse_default as ssePlugin, versioning_default as versioningPlugin };
|
|
389
|
+
export { arcCorePlugin_default as arcCorePlugin, caching_default as cachingPlugin, createDailyGate, createMemoryDailyLedger, createPlugin, createRequestIdGenerator, defaultIsDuplicateKeyError, errorHandlerPlugin, gracefulShutdown_default as gracefulShutdownPlugin, health_default as healthPlugin, metrics_default as metricsPlugin, pressure_default as pressurePlugin, realtime_default as realtimePlugin, replyHelpersPlugin, requestId_default as requestIdPlugin, sanitizeRequestId, schedules_default as schedulesPlugin, sse_default as ssePlugin, versioning_default as versioningPlugin };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
import { FastifyPluginAsync, FastifyRequest } from "fastify";
|
|
3
|
-
//#region src/plugins/response-cache.d.ts
|
|
4
3
|
export interface ResponseCacheRule {
|
|
5
4
|
/** Path prefix to match (e.g., '/api/products') */
|
|
6
5
|
match: string;
|
|
@@ -77,7 +76,7 @@ declare module "fastify" {
|
|
|
77
76
|
* }, handler);
|
|
78
77
|
* ```
|
|
79
78
|
*/
|
|
80
|
-
middleware: (request: FastifyRequest, reply: FastifyReply) => Promise<
|
|
79
|
+
middleware: (request: FastifyRequest, reply: FastifyReply) => Promise<unknown>;
|
|
81
80
|
};
|
|
82
81
|
}
|
|
83
82
|
interface FastifyRequest {
|
|
@@ -85,5 +84,4 @@ declare module "fastify" {
|
|
|
85
84
|
__arcCacheTTL?: number;
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
|
-
export declare const responseCachePlugin: FastifyPluginAsync<ResponseCacheOptions>;
|
|
89
|
-
//#endregion
|
|
87
|
+
export declare const responseCachePlugin: FastifyPluginAsync<ResponseCacheOptions>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as declareRuntimeCapability } from "../runtimeCapabilities-
|
|
3
|
-
import { t as hasEvents } from "../typeGuards-
|
|
4
|
-
import { n as evictToSize, r as touch, t as assertCapacity } from "../boundedMap-
|
|
1
|
+
/*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as declareRuntimeCapability } from "../runtimeCapabilities-CYCEtU1W.mjs";
|
|
3
|
+
import { t as hasEvents } from "../typeGuards-DVjVSsXO.mjs";
|
|
4
|
+
import { n as evictToSize, r as touch, t as assertCapacity } from "../boundedMap-CtdzpJ3X.mjs";
|
|
5
5
|
import fp from "fastify-plugin";
|
|
6
|
-
|
|
6
|
+
// src/plugins/response-cache.ts
|
|
7
7
|
/**
|
|
8
8
|
* Simple LRU cache using Map iteration order.
|
|
9
9
|
* Map in JS preserves insertion order — we re-insert on access to make it LRU.
|
|
@@ -138,16 +138,17 @@ const responseCachePluginImpl = async (fastify, opts = {}) => {
|
|
|
138
138
|
});
|
|
139
139
|
const cacheMiddleware = async (request, reply) => {
|
|
140
140
|
const ttl = request.__arcCacheTTL;
|
|
141
|
-
if (!ttl || ttl <= 0) return;
|
|
142
|
-
if (request.method !== "GET" && request.method !== "HEAD") return;
|
|
141
|
+
if (!ttl || ttl <= 0) return void 0;
|
|
142
|
+
if (request.method !== "GET" && request.method !== "HEAD") return void 0;
|
|
143
143
|
const key = buildKey(request);
|
|
144
|
-
if (!key) return;
|
|
144
|
+
if (!key) return void 0;
|
|
145
145
|
const entry = cache.get(key);
|
|
146
|
-
if (!entry) return;
|
|
146
|
+
if (!entry) return void 0;
|
|
147
147
|
if (xCacheHeader) reply.header("x-cache", "HIT");
|
|
148
148
|
for (const [name, value] of Object.entries(entry.headers)) reply.header(name, value);
|
|
149
149
|
request.__arcCacheTTL = 0;
|
|
150
150
|
reply.code(entry.statusCode).send(entry.body);
|
|
151
|
+
return reply;
|
|
151
152
|
};
|
|
152
153
|
fastify.addHook("preSerialization", async (request, reply, payload) => {
|
|
153
154
|
const ttl = request.__arcCacheTTL;
|
|
@@ -218,5 +219,4 @@ const responseCachePlugin = fp(responseCachePluginImpl, {
|
|
|
218
219
|
name: "arc-response-cache",
|
|
219
220
|
fastify: "5.x"
|
|
220
221
|
});
|
|
221
|
-
//#endregion
|
|
222
222
|
export { responseCachePlugin };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as traced, i as isTracingAvailable, n as _default, r as createSpan, t as TracingOptions } from "../tracing-
|
|
2
|
+
import { a as traced, i as isTracingAvailable, n as _default, r as createSpan, t as TracingOptions } from "../tracing-JSFiBl5r.mjs";
|
|
3
3
|
export { type TracingOptions, createSpan, isTracingAvailable, traced, _default as tracingPlugin };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.47.0 | MIT | https://classytic.com */
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import fp from "fastify-plugin";
|
|
4
|
-
|
|
4
|
+
// src/plugins/tracing.ts
|
|
5
5
|
/**
|
|
6
6
|
* OpenTelemetry Distributed Tracing Plugin
|
|
7
7
|
*
|
|
@@ -59,7 +59,7 @@ try {
|
|
|
59
59
|
function createTracerProvider(options) {
|
|
60
60
|
if (!isAvailable || !NodeTracerProvider || !BatchSpanProcessor || !OTLPTraceExporter) return null;
|
|
61
61
|
const { serviceName = "@classytic/arc", serviceVersion, exporterUrl = "http://localhost:4318/v1/traces" } = options;
|
|
62
|
-
const resolvedVersion = serviceVersion ?? "2.
|
|
62
|
+
const resolvedVersion = serviceVersion ?? "2.47.0";
|
|
63
63
|
const exporter = new OTLPTraceExporter({ url: exporterUrl });
|
|
64
64
|
const provider = new NodeTracerProvider({ resource: { attributes: {
|
|
65
65
|
"service.name": serviceName,
|
|
@@ -216,5 +216,4 @@ var tracing_default = fp(tracingPlugin, {
|
|
|
216
216
|
name: "arc-tracing",
|
|
217
217
|
fastify: "5.x"
|
|
218
218
|
});
|
|
219
|
-
//#endregion
|
|
220
219
|
export { createSpan, isTracingAvailable, traced, tracing_default as tracingPlugin };
|