@classytic/arc 2.47.0 → 2.49.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/dist/{EventTransport-BHKy4_Bi.mjs → EventTransport-DbHZK230.mjs} +2 -2
- package/dist/{HookSystem-CAIDVoKC.mjs → HookSystem-DMoeJ6Do.mjs} +2 -2
- package/dist/{QueryCache-DdvrGG8Q.d.mts → QueryCache-BE47tmlO.d.mts} +36 -1
- package/dist/{ResourceRegistry-23Ml6FNe.mjs → ResourceRegistry-CP-iTcKy.mjs} +2 -2
- package/dist/{acquire-DoFX06fm.mjs → acquire-CB0va87C.mjs} +1 -1
- package/dist/audit/index.d.mts +1 -1
- package/dist/audit/index.mjs +4 -4
- package/dist/auth/audit.mjs +1 -1
- package/dist/auth/index.d.mts +2 -2
- package/dist/auth/index.mjs +53 -15
- package/dist/auth/redis-session.mjs +1 -1
- package/dist/{authorizationDecision-DYiubkYw.mjs → authorizationDecision-DHO94aV2.mjs} +4 -4
- package/dist/{boundedMap-CtdzpJ3X.mjs → boundedMap-C51EUUOm.mjs} +1 -1
- package/dist/{buildHandler-CARdmPNo.mjs → buildHandler-9DuwEKvr.mjs} +23 -16
- package/dist/cache/index.d.mts +2 -2
- package/dist/cache/index.mjs +4 -4
- package/dist/{caching-QRiryDLs.mjs → caching-COTX3sDa.mjs} +3 -6
- package/dist/{claimed-BLecr1j3.mjs → claimed-C7T1nHlo.mjs} +1 -1
- package/dist/cleanup/index.d.mts +2 -2
- package/dist/cleanup/index.mjs +4 -4
- package/dist/cli/commands/describe.d.mts +1 -1
- package/dist/cli/commands/describe.mjs +3 -3
- package/dist/cli/commands/docs.mjs +3 -3
- package/dist/cli/commands/doctor.mjs +1 -1
- package/dist/cli/commands/generate.mjs +2 -2
- package/dist/cli/commands/init.mjs +2 -2
- package/dist/cli/commands/introspect.mjs +2 -2
- package/dist/cli/index.mjs +3 -3
- package/dist/{constants-Cx7BcnHT.mjs → constants-DOnfMd7i.mjs} +1 -1
- package/dist/context/index.mjs +5 -5
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.mjs +7 -7
- package/dist/{core-0WyMuo0f.mjs → core-BoEdFDDw.mjs} +3 -3
- package/dist/{createActionRouter-mLAGbpDV.mjs → createActionRouter-CpTn15dm.mjs} +54 -18
- package/dist/{createAggregationRouter-BEAjn3dA.mjs → createAggregationRouter-CD_Hydp0.mjs} +13 -11
- package/dist/{createApp-QDP4vYWH.mjs → createApp-Be6XTGD9.mjs} +332 -40
- package/dist/{createMcpServer-DzXHX0SO.d.mts → createMcpServer-CS2KOVP6.d.mts} +9 -10
- package/dist/{defineAggregation-CFNfvz-C.mjs → defineAggregation-BI5pRb8c.mjs} +1 -1
- package/dist/{defineResource-BROJmhzJ.mjs → defineResource-BAzNu5Um.mjs} +8 -8
- package/dist/discovery/index.mjs +1 -1
- package/dist/docs/index.d.mts +1 -1
- package/dist/docs/index.mjs +3 -3
- package/dist/{elevation-DrXeEWWk.mjs → elevation-DupGuM41.mjs} +6 -9
- package/dist/encryption/index.mjs +3 -3
- package/dist/{errorHandler-BiBXtxj4.mjs → errorHandler-DA03vRqp.mjs} +4 -7
- package/dist/{errors-DnrUChAy.mjs → errors-BpYV859Y.mjs} +1 -1
- package/dist/{eventPlugin-BhKLUe7H.mjs → eventPlugin-D7LYtYzL.mjs} +9 -13
- package/dist/{eventTypes-CCIRGakw.mjs → eventTypes-BqA-N-Uz.mjs} +2 -2
- package/dist/events/index.d.mts +18 -5
- package/dist/events/index.mjs +8 -8
- package/dist/events/transports/redis-stream-entry.mjs +4 -4
- package/dist/events/transports/redis.d.mts +35 -0
- package/dist/events/transports/redis.mjs +87 -11
- package/dist/factory/index.d.mts +4 -4
- package/dist/factory/index.mjs +6 -6
- package/dist/{fastify-augmentation-bzkWPt1f.d.mts → fastify-augmentation-baQc3MaO.d.mts} +2 -2
- package/dist/fieldTypes-EFWxCkZ5.mjs +80 -0
- package/dist/{fields-CYdpcV73.mjs → fields-CT1Erg7o.mjs} +1 -1
- package/dist/{filter-merge-6kasezRH.mjs → filter-merge-B1eJ1pMx.mjs} +1 -1
- package/dist/{generate-DUkcbc4r.mjs → generate-Cr0ULavs.mjs} +2 -2
- package/dist/{headers-KxhrKevA.mjs → headers-D4bncIOf.mjs} +2 -2
- package/dist/{health-jkYNdobJ.mjs → health-BoFxrkJE.mjs} +1 -1
- package/dist/{health-CRJg3IIq.mjs → health-DN_pUVMX.mjs} +1 -1
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/http-cache/index.d.mts +2 -2
- package/dist/http-cache/index.mjs +4 -4
- package/dist/http-cache/purgers/cloudflare.mjs +2 -2
- package/dist/http-cache/purgers/fastly.mjs +2 -2
- package/dist/http-cache/testing/index.mjs +1 -1
- package/dist/idempotency/index.d.mts +1 -1
- package/dist/idempotency/index.mjs +10 -8
- package/dist/idempotency/redis.mjs +2 -2
- package/dist/{index-B5i9-vuP.d.mts → index-CMNpMBtW.d.mts} +1 -1
- package/dist/{index-BxZS-8So.d.mts → index-DKM2p5w5.d.mts} +48 -23
- package/dist/{index-Cy2-QffW.d.mts → index-DLCcLUQT.d.mts} +69 -6
- package/dist/{index-DFCCQ9AE.d.mts → index-DexdFs1a.d.mts} +1 -1
- package/dist/{index-D1X_C_qz.d.mts → index-Dhrks-hM.d.mts} +60 -10
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +11 -11
- package/dist/{init-CACwpktI.mjs → init-C4a24wD2.mjs} +1 -1
- package/dist/integrations/event-gateway.mjs +2 -2
- package/dist/integrations/index.d.mts +2 -2
- package/dist/integrations/index.mjs +1 -1
- package/dist/integrations/jobs/index.mjs +3 -3
- package/dist/integrations/mcp/index.d.mts +6 -38
- package/dist/integrations/mcp/index.mjs +2 -2
- package/dist/integrations/mcp/testing.d.mts +11 -15
- package/dist/integrations/mcp/testing.mjs +22 -42
- package/dist/integrations/streamline.mjs +3 -3
- package/dist/integrations/webhooks.d.mts +1 -1
- package/dist/integrations/webhooks.mjs +4 -4
- package/dist/integrations/websocket-pushref-redis.mjs +1 -1
- package/dist/integrations/websocket-redis.mjs +1 -1
- package/dist/integrations/websocket.mjs +2 -2
- package/dist/{jsonBody-CzDBkCme.mjs → jsonBody-DoTt5BS6.mjs} +2 -2
- package/dist/{keys-Cbwf6r1B.mjs → keys--l9n7aOC.mjs} +1 -1
- package/dist/{loadResources-Kr6vuljv.mjs → loadResources-rygByIQA.mjs} +3 -3
- package/dist/{loadResourcesFromEntry-D2e0qoDR.mjs → loadResourcesFromEntry-ItNBIQ5w.mjs} +2 -2
- package/dist/logger/index.mjs +2 -2
- package/dist/{logger-C110X5Yz.mjs → logger-UbknHqHy.mjs} +1 -1
- package/dist/{mcpPlugin-4lIPr9OJ.mjs → mcpPlugin-CTkk4RP8.mjs} +218 -378
- package/dist/{memory-D9qkhXiB.mjs → memory-C47xVsjX.mjs} +3 -3
- package/dist/{metrics-B-qrrWfI.mjs → metrics-TJyAb1Xk.mjs} +4 -7
- package/dist/middleware/index.d.mts +1 -1
- package/dist/middleware/index.mjs +3 -3
- package/dist/migrations/index.mjs +2 -2
- package/dist/{module-BD8xHgrz.mjs → module-CWiqsXnh.mjs} +1 -1
- package/dist/{multiTenant-KZj8j1uJ.d.mts → multiTenant-QtDzxx_K.d.mts} +1 -1
- package/dist/{multipartBody-qU7KCn1l.mjs → multipartBody-BdG1qbn1.mjs} +1 -1
- package/dist/{observeSend-BnPtTotW.mjs → observeSend-DrA3ADFN.mjs} +1 -1
- package/dist/{openapi-DoVa5SVP.mjs → openapi-D6MAbYpv.mjs} +7 -7
- package/dist/outbox-admin/index.d.mts +1 -1
- package/dist/outbox-admin/index.mjs +5 -5
- package/dist/{outbox-module-DyITEIop.mjs → outbox-module-D5QABFQW.mjs} +197 -28
- package/dist/{outbox-module-5Mnwcycy.d.mts → outbox-module-DzW6zwWJ.d.mts} +103 -10
- package/dist/permissions/index.d.mts +2 -2
- package/dist/permissions/index.mjs +7 -7
- package/dist/{permissions-BBy4bOGi.mjs → permissions-CFsmdYUt.mjs} +9 -9
- package/dist/{pipe-BOm2o4UA.mjs → pipe-B_05AgGt.mjs} +2 -2
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/pipeline/index.mjs +2 -2
- package/dist/{plan-DDIGwuxr.mjs → plan-BnlNJhrj.mjs} +1 -1
- package/dist/{plugin-Bn4D_0XK.mjs → plugin-CrMPYbdj.mjs} +94 -50
- package/dist/plugins/index.d.mts +6 -5
- package/dist/plugins/index.mjs +19 -18
- package/dist/plugins/response-cache.mjs +4 -4
- package/dist/plugins/tracing-entry.mjs +2 -2
- package/dist/{pluralize-ClEjcKlG.mjs → pluralize-oVIxJ4CY.mjs} +1 -1
- package/dist/presets/filesUpload.d.mts +1 -1
- package/dist/presets/filesUpload.mjs +5 -5
- package/dist/presets/index.d.mts +2 -2
- package/dist/presets/index.mjs +2 -2
- package/dist/presets/multiTenant.d.mts +1 -1
- package/dist/presets/multiTenant.mjs +5 -5
- package/dist/presets/search.d.mts +1 -1
- package/dist/presets/search.mjs +2 -2
- package/dist/{presets-DK2jh5YR.mjs → presets-CUd3L7v6.mjs} +4 -4
- package/dist/{projection-BHH-sXyS.mjs → projection-DowJlIto.mjs} +2 -2
- package/dist/{purger.types-2wNJK_89.mjs → purger.types-BjKy8869.mjs} +1 -1
- package/dist/{queryCachePlugin-Ckqe98AM.mjs → queryCachePlugin-BvB3k_Fh.mjs} +114 -14
- package/dist/{queryCachePlugin-DYQUyeJ9.d.mts → queryCachePlugin-DrQNnGws.d.mts} +1 -1
- package/dist/{rateLimitKey-CWAjlqcN.mjs → rateLimitKey-56nH1cWN.mjs} +1 -1
- package/dist/{realtime-BIJi9USY.mjs → realtime-DXGBPtYK.mjs} +19 -22
- package/dist/registry/index.d.mts +2 -2
- package/dist/registry/index.mjs +3 -3
- package/dist/{registry-y9ZA-R_J.mjs → registry-Biz-6sEZ.mjs} +2 -2
- package/dist/{relay-BNrC1CEP.mjs → relay-DEIoMntZ.mjs} +200 -99
- package/dist/{renewingLease-CS43br5E.mjs → renewingLease-BCJpW9-u.mjs} +1 -1
- package/dist/{replyHelpers-oZDzakGb.mjs → replyHelpers-DliJNb0-.mjs} +2 -2
- package/dist/{requestContext-fWb_YaV2.mjs → requestContext-tUgLt9Ky.mjs} +1 -1
- package/dist/{requirement--2hWyyHi.mjs → requirement-0l2DApiQ.mjs} +1 -1
- package/dist/{resourceRateLimit-DCWglD7V.d.mts → resourceRateLimit-BPiESPtG.d.mts} +4 -0
- package/dist/{resourceRateLimit-1WbcyMZY.mjs → resourceRateLimit-iSXF8rLH.mjs} +19 -4
- package/dist/{rolldown-runtime-yH2lHMo_.mjs → rolldown-runtime-gKJR3o-6.mjs} +1 -1
- package/dist/{routeValidator-BSlRIA5c.mjs → routeValidator-xNYA4rr1.mjs} +47 -5
- package/dist/{runtimeCapabilities-CYCEtU1W.mjs → runtimeCapabilities-BQK-GrYe.mjs} +1 -1
- package/dist/{schedules-B5WGlYIT.mjs → schedules-D9iMVFhF.mjs} +6 -9
- package/dist/{schemaConverter-DtNvts-6.mjs → schemaConverter-cIh4oX9a.mjs} +2 -2
- package/dist/{actionPermissions-DXrlWHHK.mjs → schemaIR-BsY4y9VP.mjs} +184 -16
- package/dist/schemas/index.mjs +1 -1
- package/dist/scim/index.mjs +2 -2
- package/dist/scope/index.d.mts +1 -1
- package/dist/scope/index.mjs +5 -5
- package/dist/{scope-BwVLSyNG.mjs → scope-QyhM9w8z.mjs} +4 -4
- package/dist/{shutdown-BJiJN7FT.mjs → shutdown-BM7Q0h4B.mjs} +1 -1
- package/dist/{sse-B_50llZu.mjs → sse-ofvlcTQQ.mjs} +9 -35
- package/dist/sseStats-DQqNN385.d.mts +112 -0
- package/dist/sseStream-BxQW7hPq.mjs +166 -0
- package/dist/{store-helpers-D-n5cwy5.mjs → store-helpers-_FRhHDyv.mjs} +1 -1
- package/dist/{simpleEqualityMatcher-DGRLq-1k.mjs → streamFrames-B3ZJfI02.mjs} +19 -2
- package/dist/{streaming-Dcgqa-hH.mjs → streaming-HZr63UiM.mjs} +1 -1
- package/dist/{subscriberIdentity-C9KhIXTF.mjs → subscriberIdentity-DSgnoT_D.mjs} +1 -1
- package/dist/{tenancy-COrhjPRZ.mjs → tenancy-_ukT0oBt.mjs} +2 -2
- package/dist/{tenantPreparation-BElWHytd.mjs → tenantPreparation-DSlQI53c.mjs} +4 -4
- package/dist/testing/cleanupStoreContract.mjs +1 -1
- package/dist/testing/index.d.mts +4 -4
- package/dist/testing/index.mjs +324 -17
- package/dist/testing/outboxStoreContract.mjs +2 -2
- package/dist/testing/requiredPorts.mjs +2 -2
- package/dist/testing/storageContract.mjs +1 -1
- package/dist/{timing-CaxKbRk_.mjs → timing-Z8p-Zlw1.mjs} +1 -1
- package/dist/{transactionContext-8qKON0Nk.mjs → transactionContext-DBbSTfY3.mjs} +1 -1
- package/dist/{typeGuards-DVjVSsXO.mjs → typeGuards-_6nNQqgq.mjs} +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/storage.mjs +1 -1
- package/dist/{types-DeLiuaNv.d.mts → types-B4E0sc6D.d.mts} +20 -31
- package/dist/{types-DZHqOuJE.mjs → types-CrOlZ4rY.mjs} +4 -4
- package/dist/usage/index.d.mts +1 -1
- package/dist/usage/index.mjs +7 -7
- package/dist/{userHelpers-_eGj6kf0.mjs → userHelpers-CBKx3XJN.mjs} +1 -1
- package/dist/utils/index.d.mts +239 -34
- package/dist/utils/index.mjs +13 -13
- package/dist/{utils-Dd6MWpye.mjs → utils--HE8R8sH.mjs} +761 -8
- package/dist/{validate-BaF5wd0x.mjs → validate-BUeE2MLR.mjs} +3 -3
- package/dist/{versioning-S18y2-0C.d.mts → versioning-B07RgD27.d.mts} +2 -13
- package/dist/{versioning-DyV7mwtK.mjs → versioning-qYgqwOhL.mjs} +4 -7
- package/dist/{workScope-CmCBUmPR.mjs → workScope-C-1QHNmV.mjs} +2 -2
- package/llms.txt +2 -2
- package/package.json +42 -50
- package/skills/arc/references/api-reference.md +2 -2
- package/skills/arc/references/auth-better-auth.md +1 -0
- package/skills/arc/references/events-outbox.md +7 -4
- package/skills/arc/references/events.md +2 -2
- package/skills/arc/references/mcp-custom-tools.md +1 -1
- package/skills/arc/references/mcp-setup.md +11 -10
- package/skills/arc/references/mcp-testing.md +3 -3
- package/skills/arc/references/production-api.md +4 -0
- package/skills/arc/references/production-boot.md +2 -0
- package/skills/arc/references/production-idempotency.md +1 -1
- package/skills/arc/references/production-realtime.md +28 -2
- package/skills/arc/references/validation.md +4 -0
- package/skills/arc/references/writes-hooks-errors.md +1 -0
- package/dist/schemaIR-uS_RHqa3.mjs +0 -108
- package/dist/sseStream-BjSo9Ult.mjs +0 -57
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
|
|
2
2
|
// src/utils/simpleEqualityMatcher.ts
|
|
3
3
|
/**
|
|
4
4
|
* `simpleEqualityMatcher` — a minimal, dialect-agnostic flat-key equality
|
|
@@ -39,4 +39,21 @@ function simpleEqualityMatcher(item, filters) {
|
|
|
39
39
|
}
|
|
40
40
|
return true;
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
// src/utils/streamFrames.ts
|
|
43
|
+
/**
|
|
44
|
+
* SSE control-frame vocabulary shared by every arc stream and `@classytic/arc-next/sse`.
|
|
45
|
+
*
|
|
46
|
+
* Kept apart from `replayStream.ts` so a feed that only names the frames
|
|
47
|
+
* (`realtimePlugin`) does not pull the replay hub, and `node:crypto`, into its chunk.
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* SSE control frame names. The same literals ship from `@classytic/arc-next/sse`;
|
|
51
|
+
* a test in each package pins them.
|
|
52
|
+
*/
|
|
53
|
+
const STREAM_FRAMES = {
|
|
54
|
+
READY: "ready",
|
|
55
|
+
RESYNC: "resync",
|
|
56
|
+
REVOKED: "revoked",
|
|
57
|
+
RETRY: "retry"
|
|
58
|
+
};
|
|
59
|
+
export { simpleEqualityMatcher as n, STREAM_FRAMES as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
|
|
2
2
|
// src/events/subscriberIdentity.ts
|
|
3
3
|
const SUBSCRIBER_ID = Symbol.for("@classytic/arc/subscriber-id");
|
|
4
4
|
/** Assign a deployment-stable identity for durable per-handler progress; never use an index. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { b as isElevated, c as getOrgId } from "./types-
|
|
1
|
+
/*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
|
|
2
|
+
import { b as isElevated, c as getOrgId } from "./types-CrOlZ4rY.mjs";
|
|
3
3
|
// src/core/tenancy.ts
|
|
4
4
|
function eventAudienceOf(scope) {
|
|
5
5
|
const tenancy = resolveTenancy({ _scope: scope }, "organizationId");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as conjoinPolicyFilters } from "./filter-merge-
|
|
3
|
-
import { d as
|
|
4
|
-
import {
|
|
1
|
+
/*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as conjoinPolicyFilters } from "./filter-merge-B1eJ1pMx.mjs";
|
|
3
|
+
import { b as isElevated, c as getOrgId, d as getScopeContext, m as getTeamId, v as hasOrgAccess } from "./types-CrOlZ4rY.mjs";
|
|
4
|
+
import { d as createDomainError } from "./errors-BpYV859Y.mjs";
|
|
5
5
|
// src/permissions/tenantPreparation.ts
|
|
6
6
|
/** Tenant preparation shared by HTTP middleware and direct transport invocation. */
|
|
7
7
|
const PREPARATION = Symbol.for("arc.tenantPreparation");
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
+
import { h as ModuleSetupContext, m as ModuleDisposer, o as ArcPorts, p as PortName, r as ArcModuleInput, u as ModuleName } from "../types-BeEJm-DV.mjs";
|
|
3
|
+
import "../index-DexdFs1a.mjs";
|
|
4
|
+
import { r as CreateAppOptions } from "../index-Dhrks-hM.mjs";
|
|
2
5
|
import { i as RequestScope } from "../types-DnkIALZ8.mjs";
|
|
3
6
|
import { l as PermissionCheck, t as AnyRecord } from "../base-HXNgPQww.mjs";
|
|
4
|
-
import { F as ResourceDefinition } from "../index-
|
|
5
|
-
import { h as ModuleSetupContext, m as ModuleDisposer, o as ArcPorts, p as PortName, r as ArcModuleInput, u as ModuleName } from "../types-BeEJm-DV.mjs";
|
|
6
|
-
import "../index-DFCCQ9AE.mjs";
|
|
7
|
-
import { n as CreateAppOptions } from "../index-D1X_C_qz.mjs";
|
|
7
|
+
import { F as ResourceDefinition } from "../index-DLCcLUQT.mjs";
|
|
8
8
|
import { StorageContractSetup, StorageContractSetupResult, runStorageContract } from "./storageContract.mjs";
|
|
9
9
|
import { StandardRepo } from "@classytic/repo-core/repository";
|
|
10
10
|
import { FastifyInstance, FastifyServerOptions } from "fastify";
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
/*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
|
|
2
|
+
import { d as resolveModule, l as isLazyBridge, o as resolveModuleClosure } from "../plan-BnlNJhrj.mjs";
|
|
3
|
+
import { h as asModulePorts, r as createApp } from "../createApp-Be6XTGD9.mjs";
|
|
4
|
+
import { n as getModuleExports } from "../module-CWiqsXnh.mjs";
|
|
5
|
+
import { g as getUserId } from "../types-CrOlZ4rY.mjs";
|
|
6
|
+
import { t as defineAggregation } from "../defineAggregation-BI5pRb8c.mjs";
|
|
7
|
+
import { f as BaseController } from "../plugin-CrMPYbdj.mjs";
|
|
8
|
+
import { t as defineResource } from "../defineResource-BAzNu5Um.mjs";
|
|
9
|
+
import { t as CRUD_OPERATIONS } from "../constants-DOnfMd7i.mjs";
|
|
10
|
+
import { E as requireOrgRole } from "../permissions-CFsmdYUt.mjs";
|
|
11
11
|
import { runStorageContract } from "./storageContract.mjs";
|
|
12
12
|
import Fastify from "fastify";
|
|
13
|
+
import { mkdir, mkdtemp, readFile, readdir, rm, stat } from "node:fs/promises";
|
|
14
|
+
import { join, resolve } from "node:path";
|
|
15
|
+
import { tmpdir } from "node:os";
|
|
13
16
|
import { afterAll, describe, expect, it, vi } from "vitest";
|
|
17
|
+
import { rmSync } from "node:fs";
|
|
14
18
|
// src/testing/assertions.ts
|
|
15
19
|
/**
|
|
16
20
|
* expectArc — Arc-specific response assertions
|
|
@@ -134,6 +138,303 @@ function expectArc(response) {
|
|
|
134
138
|
};
|
|
135
139
|
return assertion;
|
|
136
140
|
}
|
|
141
|
+
// src/testing/mongoMemoryTmp.ts
|
|
142
|
+
/** Prefix mongodb-memory-server gives its data dirs (and that ours use). */
|
|
143
|
+
const MONGO_MEM_DIR_PREFIX = "mongo-mem-";
|
|
144
|
+
/** Replica-set keyfile dirs: no lock file to prove them dead, so never swept. */
|
|
145
|
+
const KEYFILE_DIR_PREFIX = "mongo-mem-keyfile-";
|
|
146
|
+
const HOUR_MS = 36e5;
|
|
147
|
+
const DEFAULT_MAX_AGE_HOURS = 6;
|
|
148
|
+
/** The dedicated base dir from `TEST_MONGO_TMPDIR`, resolved, or undefined. */
|
|
149
|
+
function mongoMemoryTmpBase() {
|
|
150
|
+
const raw = process.env.TEST_MONGO_TMPDIR?.trim();
|
|
151
|
+
return raw ? resolve(raw) : void 0;
|
|
152
|
+
}
|
|
153
|
+
/** Minimum age (ms) of a dir the sweep may remove; `null` when the sweep is off. */
|
|
154
|
+
function staleMongoMemoryAgeMs() {
|
|
155
|
+
const raw = process.env.TEST_MONGO_SWEEP_HOURS?.trim().toLowerCase();
|
|
156
|
+
if (raw === "0" || raw === "off" || raw === "false") return null;
|
|
157
|
+
const hours = Number(raw);
|
|
158
|
+
return raw && Number.isFinite(hours) && hours > 0 ? hours * HOUR_MS : DEFAULT_MAX_AGE_HOURS * HOUR_MS;
|
|
159
|
+
}
|
|
160
|
+
/** Whether a process with this pid exists. EPERM means it exists but is not ours. */
|
|
161
|
+
function isPidAlive(pid) {
|
|
162
|
+
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
163
|
+
try {
|
|
164
|
+
process.kill(pid, 0);
|
|
165
|
+
return true;
|
|
166
|
+
} catch (err) {
|
|
167
|
+
return err.code === "EPERM";
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/** The pid in a data dir's `mongod.lock`. mongod empties it on a clean shutdown. */
|
|
171
|
+
async function lockPid(dir) {
|
|
172
|
+
try {
|
|
173
|
+
const pid = Number.parseInt((await readFile(join(dir, "mongod.lock"), "utf8")).trim(), 10);
|
|
174
|
+
return Number.isInteger(pid) && pid > 0 ? pid : void 0;
|
|
175
|
+
} catch {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Newest mtime of the dir and its direct entries. The dir's own mtime changes
|
|
181
|
+
* only when an entry is added or removed; a live mongod's activity shows in its
|
|
182
|
+
* files (WiredTiger.wt, sizeStorer.wt, the journal), so those count too.
|
|
183
|
+
*/
|
|
184
|
+
async function newestMtimeMs(dir) {
|
|
185
|
+
let newest = (await stat(dir)).mtimeMs;
|
|
186
|
+
let names = [];
|
|
187
|
+
try {
|
|
188
|
+
names = await readdir(dir);
|
|
189
|
+
} catch {}
|
|
190
|
+
for (const name of names) try {
|
|
191
|
+
const { mtimeMs } = await stat(join(dir, name));
|
|
192
|
+
if (mtimeMs > newest) newest = mtimeMs;
|
|
193
|
+
} catch {}
|
|
194
|
+
return newest;
|
|
195
|
+
}
|
|
196
|
+
function defaultSweepDirs() {
|
|
197
|
+
const base = mongoMemoryTmpBase();
|
|
198
|
+
return base ? [tmpdir(), base] : [tmpdir()];
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Remove abandoned `mongo-mem-*` data dirs.
|
|
202
|
+
*
|
|
203
|
+
* A dir is removed only when BOTH hold: its `mongod.lock` names no live process
|
|
204
|
+
* (or is empty or missing), and nothing in it changed for `maxAgeMs`. Keyfile
|
|
205
|
+
* dirs and anything without the prefix are never touched. Errors are collected,
|
|
206
|
+
* never thrown: a sweep must not fail a test run.
|
|
207
|
+
*/
|
|
208
|
+
async function sweepStaleMongoMemoryDirs(options = {}) {
|
|
209
|
+
const result = {
|
|
210
|
+
removed: [],
|
|
211
|
+
kept: [],
|
|
212
|
+
failed: []
|
|
213
|
+
};
|
|
214
|
+
const maxAgeMs = options.maxAgeMs === void 0 ? staleMongoMemoryAgeMs() : options.maxAgeMs;
|
|
215
|
+
if (maxAgeMs === null) return result;
|
|
216
|
+
const now = options.now ?? Date.now();
|
|
217
|
+
const alive = options.isAlive ?? isPidAlive;
|
|
218
|
+
const bases = new Set((options.dirs ?? defaultSweepDirs()).map((d) => resolve(d)));
|
|
219
|
+
for (const base of bases) {
|
|
220
|
+
let entries;
|
|
221
|
+
try {
|
|
222
|
+
entries = await readdir(base, { withFileTypes: true });
|
|
223
|
+
} catch {
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
for (const entry of entries) {
|
|
227
|
+
if (!entry.isDirectory()) continue;
|
|
228
|
+
if (!entry.name.startsWith("mongo-mem-")) continue;
|
|
229
|
+
if (entry.name.startsWith(KEYFILE_DIR_PREFIX)) continue;
|
|
230
|
+
const path = join(base, entry.name);
|
|
231
|
+
try {
|
|
232
|
+
const pid = await lockPid(path);
|
|
233
|
+
if (pid !== void 0 && alive(pid)) {
|
|
234
|
+
result.kept.push({
|
|
235
|
+
path,
|
|
236
|
+
reason: "live-process"
|
|
237
|
+
});
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
if (now - await newestMtimeMs(path) < maxAgeMs) {
|
|
241
|
+
result.kept.push({
|
|
242
|
+
path,
|
|
243
|
+
reason: "recent"
|
|
244
|
+
});
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
await rm(path, {
|
|
248
|
+
recursive: true,
|
|
249
|
+
force: true,
|
|
250
|
+
maxRetries: 2,
|
|
251
|
+
retryDelay: 100
|
|
252
|
+
});
|
|
253
|
+
result.removed.push(path);
|
|
254
|
+
} catch (err) {
|
|
255
|
+
result.failed.push({
|
|
256
|
+
path,
|
|
257
|
+
error: err.message
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return result;
|
|
263
|
+
}
|
|
264
|
+
let processSweep;
|
|
265
|
+
/**
|
|
266
|
+
* Run the sweep at most once per process, in the background. Started before a
|
|
267
|
+
* process boots its first server; never awaited there, because a first sweep
|
|
268
|
+
* after a long leak can have gigabytes to delete. Logs one line when it removed
|
|
269
|
+
* anything, so a machine that keeps leaking is noticed.
|
|
270
|
+
*/
|
|
271
|
+
function sweepStaleMongoMemoryDirsOnce(label = "arc-testing") {
|
|
272
|
+
processSweep ??= sweepStaleMongoMemoryDirs().then((r) => {
|
|
273
|
+
if (r.removed.length > 0) console.warn(`[${label}] removed ${r.removed.length} abandoned mongo-mem-* temp dir(s) left by killed or crashed test runs`);
|
|
274
|
+
return r;
|
|
275
|
+
}, () => ({
|
|
276
|
+
removed: [],
|
|
277
|
+
kept: [],
|
|
278
|
+
failed: []
|
|
279
|
+
}));
|
|
280
|
+
return processSweep;
|
|
281
|
+
}
|
|
282
|
+
async function newDataDir(base) {
|
|
283
|
+
await mkdir(base, { recursive: true });
|
|
284
|
+
return mkdtemp(join(base, MONGO_MEM_DIR_PREFIX));
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Point every member at a fresh dir under `base`, unless the caller set its own
|
|
288
|
+
* `dbPath` / `instanceOpts` (then the caller owns that location).
|
|
289
|
+
*/
|
|
290
|
+
async function withDedicatedDataDirs(kind, opts, base, owned) {
|
|
291
|
+
if (kind === "standalone") {
|
|
292
|
+
const instance = opts.instance ?? {};
|
|
293
|
+
if (instance.dbPath !== void 0) return opts;
|
|
294
|
+
const dbPath = await newDataDir(base);
|
|
295
|
+
owned.push(dbPath);
|
|
296
|
+
return {
|
|
297
|
+
...opts,
|
|
298
|
+
instance: {
|
|
299
|
+
...instance,
|
|
300
|
+
dbPath
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
const existing = opts.instanceOpts;
|
|
305
|
+
if (existing && existing.length > 0) return opts;
|
|
306
|
+
const count = Number(opts.replSet?.count ?? 1);
|
|
307
|
+
const instanceOpts = [];
|
|
308
|
+
for (let i = 0; i < Math.max(1, count); i += 1) {
|
|
309
|
+
const dbPath = await newDataDir(base);
|
|
310
|
+
owned.push(dbPath);
|
|
311
|
+
instanceOpts.push({ dbPath });
|
|
312
|
+
}
|
|
313
|
+
return {
|
|
314
|
+
...opts,
|
|
315
|
+
instanceOpts
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
function instancesOf(server) {
|
|
319
|
+
const members = server.servers;
|
|
320
|
+
return Array.isArray(members) ? members : [server];
|
|
321
|
+
}
|
|
322
|
+
const sleepCell = new Int32Array(new SharedArrayBuffer(4));
|
|
323
|
+
/** Synchronous sleep, for the `exit` path where no timer fires. */
|
|
324
|
+
function sleepSync(ms) {
|
|
325
|
+
Atomics.wait(sleepCell, 0, 0, ms);
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Remove a dir synchronously, retrying for up to `timeoutMs`. A killed mongod
|
|
329
|
+
* is reported gone before Windows releases its file handles, so the first
|
|
330
|
+
* attempts can fail with EPERM / EBUSY.
|
|
331
|
+
*/
|
|
332
|
+
function removeDirSync(dir, timeoutMs = 0) {
|
|
333
|
+
const deadline = Date.now() + timeoutMs;
|
|
334
|
+
for (;;) try {
|
|
335
|
+
rmSync(dir, {
|
|
336
|
+
recursive: true,
|
|
337
|
+
force: true
|
|
338
|
+
});
|
|
339
|
+
return;
|
|
340
|
+
} catch {
|
|
341
|
+
if (Date.now() >= deadline) return;
|
|
342
|
+
sleepSync(50);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
/** Block until none of `pids` is alive, at most `timeoutMs`. */
|
|
346
|
+
function waitForExitSync(pids, timeoutMs) {
|
|
347
|
+
const deadline = Date.now() + timeoutMs;
|
|
348
|
+
while (pids.some(isPidAlive) && Date.now() < deadline) sleepSync(25);
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Create and start a `MongoMemoryServer` (`standalone`) or `MongoMemoryReplSet`
|
|
352
|
+
* (`replset`) with the cleanup guarantees described at the top of this file.
|
|
353
|
+
*
|
|
354
|
+
* `Ctor` is the class itself, so a caller that loads mongodb-memory-server its
|
|
355
|
+
* own way (by resolved path, through an alias) keeps doing so.
|
|
356
|
+
*/
|
|
357
|
+
async function launchMongoMemory(Ctor, kind, createOptions = {}) {
|
|
358
|
+
const base = mongoMemoryTmpBase();
|
|
359
|
+
const ownedDirs = [];
|
|
360
|
+
const opts = base ? await withDedicatedDataDirs(kind, createOptions, base, ownedDirs) : createOptions;
|
|
361
|
+
const cleanup = {
|
|
362
|
+
doCleanup: true,
|
|
363
|
+
force: ownedDirs.length > 0
|
|
364
|
+
};
|
|
365
|
+
const server = new Ctor(opts);
|
|
366
|
+
try {
|
|
367
|
+
await server.start();
|
|
368
|
+
} catch (err) {
|
|
369
|
+
await server.stop(cleanup).catch(() => void 0);
|
|
370
|
+
for (const dir of ownedDirs) removeDirSync(dir, 2e3);
|
|
371
|
+
throw err;
|
|
372
|
+
}
|
|
373
|
+
let stopped = false;
|
|
374
|
+
return {
|
|
375
|
+
server,
|
|
376
|
+
ownedDirs,
|
|
377
|
+
async stop() {
|
|
378
|
+
if (stopped) return;
|
|
379
|
+
stopped = true;
|
|
380
|
+
if (await server.stop(cleanup) !== false) for (const dir of ownedDirs) removeDirSync(dir);
|
|
381
|
+
},
|
|
382
|
+
stopSync() {
|
|
383
|
+
if (stopped) return;
|
|
384
|
+
stopped = true;
|
|
385
|
+
const dirs = new Set(ownedDirs);
|
|
386
|
+
const pids = [];
|
|
387
|
+
for (const member of instancesOf(server)) {
|
|
388
|
+
const info = member.instanceInfo;
|
|
389
|
+
const pid = info?.instance?.mongodProcess?.pid;
|
|
390
|
+
if (pid) {
|
|
391
|
+
pids.push(pid);
|
|
392
|
+
try {
|
|
393
|
+
process.kill(pid, "SIGKILL");
|
|
394
|
+
} catch {}
|
|
395
|
+
}
|
|
396
|
+
if (info?.tmpDir) dirs.add(info.tmpDir);
|
|
397
|
+
}
|
|
398
|
+
waitForExitSync(pids, 5e3);
|
|
399
|
+
for (const dir of dirs) removeDirSync(dir, 5e3);
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
const tracked = /* @__PURE__ */ new Set();
|
|
404
|
+
let exitHooked = false;
|
|
405
|
+
/**
|
|
406
|
+
* Stop a launched server when the process ends without its teardown: Ctrl-C /
|
|
407
|
+
* SIGTERM stop it properly, then re-raise so the exit code stays truthful; an
|
|
408
|
+
* `exit` (including an uncaught exception) kills mongod and removes the dir
|
|
409
|
+
* synchronously. Returns an untrack function for the orderly path.
|
|
410
|
+
*/
|
|
411
|
+
function stopOnProcessExit(handle) {
|
|
412
|
+
tracked.add(handle);
|
|
413
|
+
if (!exitHooked) {
|
|
414
|
+
exitHooked = true;
|
|
415
|
+
const onSignal = (signal) => {
|
|
416
|
+
const all = [...tracked];
|
|
417
|
+
tracked.clear();
|
|
418
|
+
Promise.all(all.map((h) => h.stop().catch(() => void 0))).finally(() => {
|
|
419
|
+
process.removeListener(signal, onSignal);
|
|
420
|
+
process.kill(process.pid, signal);
|
|
421
|
+
});
|
|
422
|
+
};
|
|
423
|
+
for (const signal of [
|
|
424
|
+
"SIGINT",
|
|
425
|
+
"SIGTERM",
|
|
426
|
+
"SIGHUP",
|
|
427
|
+
"SIGBREAK"
|
|
428
|
+
]) process.once(signal, onSignal);
|
|
429
|
+
process.once("exit", () => {
|
|
430
|
+
for (const h of tracked) h.stopSync();
|
|
431
|
+
tracked.clear();
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
return () => {
|
|
435
|
+
tracked.delete(handle);
|
|
436
|
+
};
|
|
437
|
+
}
|
|
137
438
|
// src/testing/testActor.ts
|
|
138
439
|
/**
|
|
139
440
|
* Test-only actor installation — how a package's HTTP tests say "run this
|
|
@@ -267,8 +568,10 @@ async function mongoMemoryDatabase(opts) {
|
|
|
267
568
|
} catch {
|
|
268
569
|
throw new Error("[arc-testing] bootModuleApp's default database is in-memory MongoDB — install 'mongodb-memory-server' + 'mongoose' as devDependencies, or inject your own `database` factory for a different store");
|
|
269
570
|
}
|
|
270
|
-
|
|
271
|
-
const
|
|
571
|
+
sweepStaleMongoMemoryDirsOnce();
|
|
572
|
+
const launched = opts.replset ? await launchMongoMemory(mms.MongoMemoryReplSet, "replset", { replSet: { count: 1 } }) : await launchMongoMemory(mms.MongoMemoryServer, "standalone");
|
|
573
|
+
const untrack = stopOnProcessExit(launched);
|
|
574
|
+
const uri = launched.server.getUri();
|
|
272
575
|
const mongoose = (await import("mongoose")).default;
|
|
273
576
|
if (mongoose.connection.readyState !== 0) await mongoose.disconnect();
|
|
274
577
|
await mongoose.connect(uri);
|
|
@@ -278,7 +581,8 @@ async function mongoMemoryDatabase(opts) {
|
|
|
278
581
|
connection: mongoose.connection,
|
|
279
582
|
teardown: async () => {
|
|
280
583
|
if (mongoose.connection.readyState !== 0) await mongoose.disconnect().catch(() => void 0);
|
|
281
|
-
|
|
584
|
+
untrack();
|
|
585
|
+
await launched.stop().catch(() => void 0);
|
|
282
586
|
}
|
|
283
587
|
};
|
|
284
588
|
}
|
|
@@ -1536,11 +1840,14 @@ function scopeRoleGate(...allowed) {
|
|
|
1536
1840
|
async function startInMemoryMongo() {
|
|
1537
1841
|
try {
|
|
1538
1842
|
const { MongoMemoryServer } = await import("mongodb-memory-server");
|
|
1539
|
-
|
|
1843
|
+
sweepStaleMongoMemoryDirsOnce();
|
|
1844
|
+
const launched = await launchMongoMemory(MongoMemoryServer, "standalone");
|
|
1845
|
+
const untrack = stopOnProcessExit(launched);
|
|
1540
1846
|
return {
|
|
1541
|
-
uri:
|
|
1847
|
+
uri: launched.server.getUri(),
|
|
1542
1848
|
async stop() {
|
|
1543
|
-
|
|
1849
|
+
untrack();
|
|
1850
|
+
await launched.stop();
|
|
1544
1851
|
}
|
|
1545
1852
|
};
|
|
1546
1853
|
} catch (err) {
|
|
@@ -1566,7 +1873,7 @@ function pickDefaultAuth(authMode, callerAuth) {
|
|
|
1566
1873
|
};
|
|
1567
1874
|
}
|
|
1568
1875
|
async function createTestApp(options = {}) {
|
|
1569
|
-
const { createApp } = await import("../createApp-
|
|
1876
|
+
const { createApp } = await import("../createApp-Be6XTGD9.mjs").then((n) => n.i);
|
|
1570
1877
|
const { resources = [], db = "in-memory", connectMongoose = false, authMode = "jwt", defaultOrgId, plugins, auth: callerAuth, ...appOptions } = options;
|
|
1571
1878
|
let dbHandle;
|
|
1572
1879
|
let dbUri;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as claimedAttempts } from "../claimed-
|
|
1
|
+
/*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as claimedAttempts } from "../claimed-C7T1nHlo.mjs";
|
|
3
3
|
import { OutboxConflictError, OutboxOwnershipError } from "@classytic/primitives/outbox";
|
|
4
4
|
import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
5
5
|
// src/testing/outboxStoreContract.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { c as declareModules, d as resolveModule, i as planModules, r as compositionProblems } from "../plan-
|
|
1
|
+
/*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
|
|
2
|
+
import { c as declareModules, d as resolveModule, i as planModules, r as compositionProblems } from "../plan-BnlNJhrj.mjs";
|
|
3
3
|
// src/testing/requiredPorts.ts
|
|
4
4
|
/**
|
|
5
5
|
* Assert a module declares EXACTLY `ports` as required, and that composing it without any one of
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
// src/utils/operationIdentity.ts
|
|
4
4
|
/** Security context included in idempotency identities across transports. */
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { i as RequestScope } from "../types-DnkIALZ8.mjs";
|
|
3
3
|
import { a as UserLike, c as DataPolicy, d as UserBase, i as ObjectId, l as PermissionCheck, n as ArcRequest, o as UserOrganization, r as JWTPayload, s as AuthorizationDecision, t as AnyRecord, u as PermissionContext } from "../base-HXNgPQww.mjs";
|
|
4
|
-
import { $ as ResourceHookContext, A as RequestWithExtras, At as
|
|
4
|
+
import { $ as ResourceHookContext, A as RequestWithExtras, At as RouteMethod, B as OnTenantDeleteConfig, Bn as ControllerLike, C as RequestIdOptions, Ct as ResourceCacheConfig, D as FastifyWithAuth, Dt as ActionsMap, E as FastifyRequestExtras, Et as ActionHandlerFn, Fn as MutationWriteContext, Ft as AuthenticatorContext, G as CrudRouteKey, Gn as RawRouteHandler, H as PresetFunction, Hn as IController, I as CrudController, In as ResourceWrites, It as JwtContext, J as MiddlewareConfig, K as CrudSchemas, Kn as RouteHandler, L as ResourceConfig, Ln as WriteContext, Lt as TokenPair, Mt as AuthHelpers, Nt as AuthPluginOptions, O as FastifyWithDecorators, On as BaseControllerOptions, Ot as RouteDefinition, Pt as Authenticator, Q as FieldRule, R as ResourceIdempotencyConfig, Rn as WriteVerbKey, S as IntrospectionPluginOptions, T as EventsDecorator, Tt as ActionEntry, U as PresetHook, Un as IControllerResponse, V as ResolvedTenantPurge, Vn as FastifyHandler, W as PresetResult, Wn as IRequestContext, X as RouteSchemaOptions, Y as OpenApiSchemas, Z as ArcFieldRule, _ as ServiceContext, a as IntrospectionData, b as HealthCheck, c as ResourceMetadata, d as LookupOption, et as ResourceHooks, f as OwnershipCheck, g as RequestContext, h as QueryParserInterface, i as PaginationResult, jt as RateLimitConfig, k as MiddlewareHandler, kt as RouteMcpConfig, l as ArcInternalMetadata, m as PopulateOption, n as InferDocType, nt as EventDefinition, o as RegistryEntry, p as ParsedQuery, q as LookupPolicy, r as InferResourceDoc, s as RegistryStats, t as InferAdapterDoc, tt as ResourceExtensions, u as ControllerQueryOptions, v as CrudRouterOptions, w as ArcDecorator, wt as ActionDefinition, x as HealthOptions, y as GracefulShutdownOptions, z as ResourcePermissions, zn as ControllerHandler } from "../index-DLCcLUQT.mjs";
|
|
5
5
|
import { n as ElevationOptions, t as ElevationEvent } from "../elevation-DPD0hcU-.mjs";
|
|
6
6
|
export type { ActionDefinition, ActionEntry, ActionHandlerFn, ActionsMap, AnyRecord, ArcDecorator, ArcFieldRule, ArcInternalMetadata, ArcRequest, AuthHelpers, AuthPluginOptions, Authenticator, AuthenticatorContext, AuthorizationDecision, BaseControllerOptions, ControllerHandler, ControllerLike, ControllerQueryOptions, CrudController, CrudRouteKey, CrudRouterOptions, CrudSchemas, DataPolicy, ElevationEvent, ElevationOptions, EventDefinition, EventsDecorator, FastifyHandler, FastifyRequestExtras, FastifyWithAuth, FastifyWithDecorators, FieldRule, GracefulShutdownOptions, HealthCheck, HealthOptions, IController, IControllerResponse, IRequestContext, InferAdapterDoc, InferDocType, InferResourceDoc, IntrospectionData, IntrospectionPluginOptions, JWTPayload, JwtContext, LookupOption, LookupPolicy, MiddlewareConfig, MiddlewareHandler, MutationWriteContext, ObjectId, OnTenantDeleteConfig, OpenApiSchemas, OwnershipCheck, PaginationResult, ParsedQuery, PermissionCheck, PermissionContext, PopulateOption, PresetFunction, PresetHook, PresetResult, QueryParserInterface, RateLimitConfig, RawRouteHandler, RegistryEntry, RegistryStats, RequestContext, RequestIdOptions, RequestScope, RequestWithExtras, ResolvedTenantPurge, ResourceCacheConfig, ResourceConfig, ResourceExtensions, ResourceHookContext, ResourceHooks, ResourceIdempotencyConfig, ResourceMetadata, ResourcePermissions, ResourceWrites, RouteDefinition, RouteHandler, RouteMcpConfig, RouteMethod, RouteSchemaOptions, ServiceContext, TokenPair, UserBase, UserLike, UserOrganization, WriteContext, WriteVerbKey };
|
package/dist/types/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
|
|
2
2
|
export {};
|
package/dist/types/storage.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
|
|
2
2
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { i as ResourceRateLimiter } from "./resourceRateLimit-BPiESPtG.mjs";
|
|
3
|
+
import { F as ResourceDefinition } from "./index-DLCcLUQT.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
/** Behavioral hints for MCP clients (tool annotations per MCP spec) */
|
|
6
6
|
interface ToolAnnotations {
|
|
@@ -37,7 +37,11 @@ interface ToolAnnotations {
|
|
|
37
37
|
interface ToolContext<TSession = McpAuthResult> {
|
|
38
38
|
/** Session identity — `null` in no-auth mode */
|
|
39
39
|
session: TSession | null;
|
|
40
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Server-side log line, tagged with the tool name — the host logger
|
|
42
|
+
* (`fastify.log` under `mcpPlugin`), a no-op without one. Never sent to the
|
|
43
|
+
* client: MCP 2026-07-28 deprecates protocol logging (SEP-2577).
|
|
44
|
+
*/
|
|
41
45
|
log: (level: "info" | "warning" | "error" | "debug", message: string) => Promise<void>;
|
|
42
46
|
/** Raw MCP SDK extra context (for advanced use) */
|
|
43
47
|
extra: Record<string, unknown>;
|
|
@@ -373,19 +377,9 @@ interface McpPluginOptions {
|
|
|
373
377
|
/** Custom prompts */
|
|
374
378
|
extraPrompts?: PromptDefinition[];
|
|
375
379
|
/**
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
*
|
|
379
|
-
*/
|
|
380
|
-
stateful?: boolean;
|
|
381
|
-
/** Session TTL in ms (default: 1800000 = 30 min). Only used when stateful: true. */
|
|
382
|
-
sessionTtlMs?: number;
|
|
383
|
-
/** Max concurrent sessions (default: 1000). Only used when stateful: true. */
|
|
384
|
-
maxSessions?: number;
|
|
385
|
-
/**
|
|
386
|
-
* Auth cache TTL in ms for stateless mode (default: 5000 = 5 sec).
|
|
387
|
-
* Caches auth resolver results briefly to avoid redundant DB lookups
|
|
388
|
-
* across initialize → tools/list → tools/call sequences.
|
|
380
|
+
* Auth cache TTL in ms (default: 5000 = 5 sec). Every MCP request is
|
|
381
|
+
* authenticated, so this spares the resolver repeated DB lookups across a
|
|
382
|
+
* client's `server/discover` → `tools/list` → `tools/call` burst.
|
|
389
383
|
* Set to `0` to disable.
|
|
390
384
|
*/
|
|
391
385
|
authCacheTtlMs?: number;
|
|
@@ -451,20 +445,6 @@ interface McpAuthResult {
|
|
|
451
445
|
/** Any extra metadata from the auth resolver */
|
|
452
446
|
[key: string]: unknown;
|
|
453
447
|
}
|
|
454
|
-
/** Internal session entry */
|
|
455
|
-
interface SessionEntry {
|
|
456
|
-
transport: {
|
|
457
|
-
handleRequest: (req: unknown, res: unknown, body?: unknown) => Promise<void>;
|
|
458
|
-
close: () => void;
|
|
459
|
-
};
|
|
460
|
-
lastAccessed: number;
|
|
461
|
-
organizationId: string;
|
|
462
|
-
auth: McpAuthResult | null;
|
|
463
|
-
/** Mutable ref updated per-request — tool handler closures read from this */
|
|
464
|
-
authRef: {
|
|
465
|
-
current: McpAuthResult | null;
|
|
466
|
-
};
|
|
467
|
-
}
|
|
468
448
|
/**
|
|
469
449
|
* Configuration for createMcpServer() — Level 2 declarative factory.
|
|
470
450
|
*
|
|
@@ -490,7 +470,16 @@ interface CreateMcpServerConfig {
|
|
|
490
470
|
instructions?: string;
|
|
491
471
|
tools?: ToolDefinition[];
|
|
492
472
|
prompts?: PromptDefinition[];
|
|
473
|
+
/** Sink for tools' `ctx.log` — pino-shaped (`fastify.log` fits). Omitted: `ctx.log` is a no-op. */
|
|
474
|
+
logger?: McpToolLogger;
|
|
475
|
+
}
|
|
476
|
+
/** The pino-shaped subset `ctx.log` writes through. */
|
|
477
|
+
interface McpToolLogger {
|
|
478
|
+
info(obj: object, msg: string): void;
|
|
479
|
+
warn(obj: object, msg: string): void;
|
|
480
|
+
error(obj: object, msg: string): void;
|
|
481
|
+
debug(obj: object, msg: string): void;
|
|
493
482
|
}
|
|
494
483
|
/** CRUD operation type */
|
|
495
484
|
type CrudOperation = "list" | "get" | "create" | "update" | "delete";
|
|
496
|
-
export { ToolDefinition as _, CrudDescriptionOverride as a, McpAuthResult as c, McpResourceConfig as d,
|
|
485
|
+
export { ToolDefinition as _, CrudDescriptionOverride as a, McpAuthResult as c, McpResourceConfig as d, McpToolLogger as f, ToolContext as g, ToolAnnotations as h, CrudDescriptionMeta as i, McpExecutionWiring as l, PromptResult as m, CallToolResult as n, CrudOperation as o, PromptDefinition as p, CreateMcpServerConfig as r, McpAuthResolver as s, BetterAuthHandler as t, McpPluginOptions as u, ToolInputSchema as v };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { l as UnauthorizedError, o as OrgRequiredError } from "./errors-
|
|
3
|
-
import { n as requireSingleHeaderValue } from "./headers-
|
|
4
|
-
import { t as getUserId$1 } from "./userHelpers-
|
|
1
|
+
/*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
|
|
2
|
+
import { l as UnauthorizedError, o as OrgRequiredError } from "./errors-BpYV859Y.mjs";
|
|
3
|
+
import { n as requireSingleHeaderValue } from "./headers-D4bncIOf.mjs";
|
|
4
|
+
import { t as getUserId$1 } from "./userHelpers-CBKx3XJN.mjs";
|
|
5
5
|
// src/scope/types.ts
|
|
6
6
|
/**
|
|
7
7
|
* Request Scope — The One Standard
|
package/dist/usage/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { i as RequestScope } from "../types-DnkIALZ8.mjs";
|
|
3
2
|
import { l as PermissionCheck, u as PermissionContext } from "../base-HXNgPQww.mjs";
|
|
3
|
+
import { i as RequestScope } from "../types-DnkIALZ8.mjs";
|
|
4
4
|
import { UsageBucket, UsageStore, usagePeriod } from "@classytic/repo-core/usage";
|
|
5
5
|
import { FastifyPluginAsync, FastifyRequest } from "fastify";
|
|
6
6
|
interface QuotaOptions {
|