@classytic/arc 2.52.0 → 2.53.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 +2 -1
- package/dist/{EventTransport-DeNze_-C.mjs → EventTransport-B3jTKMQH.mjs} +2 -2
- package/dist/{HookSystem-DTffXM1X.mjs → HookSystem-DNwxV463.mjs} +2 -2
- package/dist/{ResourceRegistry-tlqXSZoK.mjs → ResourceRegistry-Ck7RFodL.mjs} +2 -2
- package/dist/{acquire-7JKEkKnN.mjs → acquire-DkLruwhL.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 +1 -1
- package/dist/auth/index.mjs +7 -7
- package/dist/auth/redis-session.mjs +1 -1
- package/dist/auth/social/index.mjs +1 -1
- package/dist/{authorizationDecision-DKmH4tZ-.mjs → authorizationDecision-gB5-bHDp.mjs} +5 -5
- package/dist/bootError-BT3z3cvX.mjs +38 -0
- package/dist/{boundedMap-zxGBpXX0.mjs → boundedMap-Ddw2yGb2.mjs} +1 -1
- package/dist/{buildHandler-ZDV6LRZ_.mjs → buildHandler-B8IDGmhD.mjs} +5 -5
- package/dist/cache/index.mjs +4 -4
- package/dist/{caching-DceUN9Xk.mjs → caching-BitJDAY0.mjs} +2 -2
- package/dist/{claimed-DsP5Hi_f.mjs → claimed-CM_-lFHX.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 +18 -1
- package/dist/cli/commands/describe.mjs +39 -7
- package/dist/cli/commands/docs.mjs +3 -3
- package/dist/cli/commands/doctor.d.mts +3 -1
- package/dist/cli/commands/doctor.mjs +135 -22
- 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-Ca2IQFy2.mjs → constants-D9EiaO5s.mjs} +1 -1
- package/dist/context/index.d.mts +5 -2
- package/dist/context/index.mjs +5 -5
- package/dist/core/index.d.mts +2 -2
- package/dist/core/index.mjs +7 -7
- package/dist/{core-M18RhMqi.mjs → core-B_06Fcn0.mjs} +3 -3
- package/dist/{createActionRouter-zXlrwWVs.mjs → createActionRouter-DtxUXOCI.mjs} +5 -5
- package/dist/{createAggregationRouter-CN0Da9nC.mjs → createAggregationRouter-BMiKyDoW.mjs} +7 -7
- package/dist/{createApp-BC67ACu4.mjs → createApp-CEdGZtkP.mjs} +207 -44
- package/dist/{createMcpServer-CS2KOVP6.d.mts → createMcpServer-Bk3ls5jS.d.mts} +1 -1
- package/dist/{defineAggregation-DqAGb5oI.mjs → defineAggregation-DUsrGcsm.mjs} +1 -1
- package/dist/{defineResource-DC5UqkQv.mjs → defineResource-q8TsJpOm.mjs} +92 -36
- package/dist/deprecation-DX625dth.mjs +27 -0
- 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-DiXVg98q.mjs → elevation-NJ3908pJ.mjs} +5 -5
- package/dist/encryption/index.mjs +3 -3
- package/dist/{errorHandler-BUTm9P_f.mjs → errorHandler-Ke6PGvF7.mjs} +7 -4
- package/dist/{errors-DxpHZBlW.mjs → errors-Ukhmfmmx.mjs} +1 -1
- package/dist/{eventPlugin-BY38F6yK.d.mts → eventPlugin-BeJasppx.d.mts} +7 -18
- package/dist/{eventPlugin-ZsIQPRso.mjs → eventPlugin-DTKAgSvb.mjs} +10 -8
- package/dist/{eventTypes-D-pFtqT1.mjs → eventTypes-DpDQtyR6.mjs} +2 -2
- package/dist/events/index.d.mts +2 -2
- package/dist/events/index.mjs +8 -8
- package/dist/events/transports/redis-stream-entry.mjs +4 -4
- package/dist/events/transports/redis.mjs +2 -2
- package/dist/factory/index.d.mts +28 -5
- package/dist/factory/index.mjs +12 -7
- package/dist/{fastify-augmentation-CPReFhZ1.d.mts → fastify-augmentation-DjxuSRG4.d.mts} +4 -3
- package/dist/{fieldTypes-f-3TZgR3.mjs → fieldTypes-BtFpQO6I.mjs} +2 -2
- package/dist/{fields-kCbIDTjA.mjs → fields-B7fuROWK.mjs} +1 -1
- package/dist/{filter-merge-UJCgjbZR.mjs → filter-merge-BuzZ-r9z.mjs} +1 -1
- package/dist/{generate-CLpmzbJ_.mjs → generate-c4F39pk1.mjs} +4 -4
- package/dist/{headers-Bh47h0XH.mjs → headers-Ib7BDgRI.mjs} +2 -2
- package/dist/{health-CEpgVAl7.mjs → health-22T82HAa.mjs} +1 -1
- package/dist/health-skjSwNaC.d.mts +36 -0
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +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 +7 -1
- package/dist/idempotency/index.mjs +9 -7
- package/dist/idempotency/redis.mjs +2 -2
- package/dist/{index-CMNpMBtW.d.mts → index-BzUyno-u.d.mts} +14 -5
- package/dist/{index-yXXCsKl7.d.mts → index-CXqYFGoH.d.mts} +13 -4
- package/dist/{index-CSbDhif4.d.mts → index-CaBFPmnu.d.mts} +10 -6
- package/dist/{index-DCH08eqQ.d.mts → index-DWn0o4U7.d.mts} +2 -2
- package/dist/{index-DLCcLUQT.d.mts → index-DtHACefu.d.mts} +109 -116
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +12 -12
- package/dist/{init-B43DXBpc.mjs → init-XY5slyuS.mjs} +3 -3
- package/dist/integrations/event-gateway.mjs +2 -2
- package/dist/integrations/index.d.mts +1 -1
- package/dist/integrations/index.mjs +1 -1
- package/dist/integrations/jobs/index.mjs +3 -3
- package/dist/integrations/mcp/index.d.mts +9 -4
- package/dist/integrations/mcp/index.mjs +2 -2
- package/dist/integrations/mcp/testing.d.mts +2 -2
- package/dist/integrations/mcp/testing.mjs +2 -2
- 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/invariants-COekUeoh.mjs +120 -0
- package/dist/{jsonBody-CkKs6dA_.mjs → jsonBody-BNlcGUnb.mjs} +2 -2
- package/dist/{keys-DHrHnT0f.mjs → keys-DwvXJwUX.mjs} +1 -1
- package/dist/{loadResources-CFdzAWQZ.mjs → loadResources-izEeQLO_.mjs} +3 -3
- package/dist/{loadResourcesFromEntry-DkoSiJsI.mjs → loadResourcesFromEntry-CijqjbHE.mjs} +2 -2
- package/dist/logger/index.mjs +2 -2
- package/dist/{logger-DJwz_-Pl.mjs → logger-DdMS0XC_.mjs} +1 -1
- package/dist/{mcpPlugin-CA_MDFlS.mjs → mcpPlugin-D0tSZqKk.mjs} +24 -22
- package/dist/{memory-B9CFHbA_.mjs → memory-Ay0haw9n.mjs} +3 -3
- package/dist/{metrics-DSKv-T9K.mjs → metrics-Bpgf4UL6.mjs} +3 -3
- 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-C0JCsnO7.mjs → module-BLrTmMyk.mjs} +1 -1
- package/dist/{multiTenant-QtDzxx_K.d.mts → multiTenant-Cf0Ye-Wu.d.mts} +1 -1
- package/dist/{multipartBody-Bxz-q6hI.mjs → multipartBody-L2gr96df.mjs} +1 -1
- package/dist/{observeSend-DfNkdGww.mjs → observeSend-B7FEdk_g.mjs} +1 -1
- package/dist/{openapi-Dmp7Ipsi.mjs → openapi-COrL_33P.mjs} +6 -6
- package/dist/outbox-admin/index.d.mts +1 -1
- package/dist/outbox-admin/index.mjs +6 -6
- package/dist/{outbox-module-vT6PaThj.mjs → outbox-module-BY2HtnjU.mjs} +7 -7
- package/dist/{outbox-module-DzW6zwWJ.d.mts → outbox-module-C1QWMloZ.d.mts} +5 -8
- package/dist/permissions/index.d.mts +2 -2
- package/dist/permissions/index.mjs +8 -8
- package/dist/{permissions-Cga6KBOX.mjs → permissions-CEyeDHtT.mjs} +36 -17
- package/dist/{pipe-CqPweKdL.mjs → pipe-DIAr91at.mjs} +2 -2
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/pipeline/index.mjs +2 -2
- package/dist/{plan-CbDTFbTj.mjs → plan-BhKHIkFl.mjs} +75 -20
- package/dist/{plugin-8Z1khbAI.mjs → plugin-D6hrdx-j.mjs} +72 -38
- package/dist/plugins/index.d.mts +4 -3
- package/dist/plugins/index.mjs +18 -18
- package/dist/plugins/response-cache.mjs +4 -4
- package/dist/plugins/tracing-entry.mjs +177 -85
- package/dist/{pluralize-D4vcPLVs.mjs → pluralize-CJKgYkVc.mjs} +1 -1
- package/dist/presetPermission-2pcRVYRG.mjs +23 -0
- package/dist/presets/filesUpload.d.mts +4 -2
- package/dist/presets/filesUpload.mjs +11 -6
- package/dist/presets/index.d.mts +6 -4
- 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 +2 -2
- package/dist/presets/search.mjs +54 -38
- package/dist/{presets-D28IABZe.mjs → presets-st11ePNn.mjs} +150 -41
- package/dist/{projection-aHCtDQQ9.mjs → projection-B4rqiJTi.mjs} +2 -2
- package/dist/{purger.types-CNFmEtFu.mjs → purger.types-BcHeAhY_.mjs} +1 -1
- package/dist/{queryCachePlugin-CwpEjCwz.mjs → queryCachePlugin-BgSc2bga.mjs} +6 -6
- package/dist/rateLimitKey-DLGdeFd2.mjs +138 -0
- package/dist/{realtime-Dvu8ES2z.mjs → realtime-CpYpIFsm.mjs} +11 -11
- package/dist/registry/index.d.mts +2 -2
- package/dist/registry/index.mjs +3 -3
- package/dist/{registry-DmxbzW7-.mjs → registry-BQsdAlZ_.mjs} +2 -2
- package/dist/{relay-CEaCmUfG.mjs → relay-CmT3gtkP.mjs} +11 -12
- package/dist/{renewingLease-g2FjB3im.mjs → renewingLease-DaoP0K-e.mjs} +1 -1
- package/dist/{replyHelpers-CSByAX_Z.mjs → replyHelpers-SiLr1wK4.mjs} +2 -2
- package/dist/{requestContext-yc7MSgmq.mjs → requestContext-B-TjFpWt.mjs} +8 -3
- package/dist/{health-W4S2yFBL.mjs → requestId-ClcKoWLq.mjs} +154 -116
- package/dist/{requirement-Dm8njSoC.mjs → requirement-BygDzjDS.mjs} +1 -1
- package/dist/{resourceRateLimit-PQaY3HW1.mjs → resourceRateLimit-DdIYis3m.mjs} +2 -2
- package/dist/{rolldown-runtime-BBBkGgwA.mjs → rolldown-runtime-Cy6j0m8_.mjs} +1 -1
- package/dist/{routeValidator-fuG51bQA.mjs → routeValidator-Bn-x2gaJ.mjs} +1 -1
- package/dist/{runtimeCapabilities-B8IT7xiQ.mjs → runtimeCapabilities-DY20Pibh.mjs} +7 -2
- package/dist/{schedules-0-aS4jDV.mjs → schedules-CwqC0Mp0.mjs} +5 -5
- package/dist/{schemaConverter-Cs3SwP4R.mjs → schemaConverter-XoLKVpzG.mjs} +2 -2
- package/dist/{schemaIR-By8XiNeE.mjs → schemaIR-DP7mMj7c.mjs} +16 -16
- package/dist/schemas/index.mjs +1 -1
- package/dist/scim/index.mjs +2 -2
- package/dist/scope/index.d.mts +6 -2
- package/dist/scope/index.mjs +5 -5
- package/dist/{scope-BWNAlBj0.mjs → scope-B0vgM2Zw.mjs} +4 -4
- package/dist/{shutdown-Cf-27xsS.mjs → shutdown-C76Hn-Th.mjs} +1 -1
- package/dist/{simpleEqualityMatcher-e-dgJcUO.mjs → simpleEqualityMatcher-Qbl-11cE.mjs} +1 -1
- package/dist/{sse-C3bj5qWi.mjs → sse-eyb8lNuI.mjs} +7 -7
- package/dist/{sseStream-BYZbpFDa.mjs → sseStream-BsBesrfw.mjs} +2 -2
- package/dist/{store-helpers-B9HierHY.mjs → store-helpers-D1yIVa91.mjs} +1 -1
- package/dist/{streaming-EN8NJWxr.mjs → streaming-DKziqs1Z.mjs} +1 -1
- package/dist/{subscriberIdentity-DSqCh38x.mjs → subscriberIdentity-DpdSQMQq.mjs} +1 -1
- package/dist/{tenancy-CAqjGQcQ.mjs → tenancy-YuRYsOPr.mjs} +2 -2
- package/dist/{tenantPreparation-CVBWarqs.mjs → tenantPreparation-Bk8ouRB3.mjs} +17 -5
- package/dist/testing/cleanupStoreContract.mjs +1 -1
- package/dist/testing/index.d.mts +4 -4
- package/dist/testing/index.mjs +11 -11
- package/dist/testing/outboxStoreContract.mjs +2 -2
- package/dist/testing/requiredPorts.d.mts +1 -1
- package/dist/testing/requiredPorts.mjs +2 -2
- package/dist/testing/storageContract.mjs +1 -1
- package/dist/{timing-CKI_Oyub.mjs → timing-BtIDIdQz.mjs} +1 -1
- package/dist/{transactionContext-D0UZFoSy.mjs → transactionContext-BsQ5ortM.mjs} +1 -1
- package/dist/{typeGuards-CLYkmBLT.mjs → typeGuards-Cr2_zEW0.mjs} +1 -1
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +1 -1
- package/dist/types/storage.mjs +1 -1
- package/dist/{types-BeEJm-DV.d.mts → types-CQhHTZXs.d.mts} +48 -35
- package/dist/{types-B4E0sc6D.d.mts → types-DWFgq8EP.d.mts} +1 -1
- package/dist/{types-Cunc4shv.mjs → types-ZvdR7MVa.mjs} +4 -4
- package/dist/usage/index.mjs +4 -4
- package/dist/{userHelpers-cT5j1kgp.mjs → userHelpers-CwpEK36a.mjs} +1 -1
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.mjs +12 -12
- package/dist/{utils-DlNkm1dI.mjs → utils-CnrfcYMq.mjs} +6 -6
- package/dist/{validate-63QThRoS.mjs → validate-BTQBh-Dr.mjs} +3 -3
- package/dist/{versioning-f2YGmh4i.mjs → versioning-DiLykI6U.mjs} +3 -3
- package/dist/{workScope-DwspXz70.mjs → workScope-C3tPz_Gt.mjs} +2 -2
- package/package.json +34 -9
- package/skills/arc/SKILL.md +5 -5
- package/skills/arc/references/api-reference.md +1 -1
- package/skills/arc/references/boot.md +17 -2
- package/skills/arc/references/events.md +0 -1
- package/skills/arc/references/mcp-setup.md +3 -2
- package/skills/arc/references/multi-tenancy.md +1 -1
- package/skills/arc/references/production-api.md +19 -12
- package/skills/arc/references/production-audit.md +1 -1
- package/skills/arc/references/production-boot.md +3 -3
- package/skills/arc/references/production-idempotency.md +2 -2
- package/skills/arc/references/production-observability.md +14 -2
- package/skills/arc/references/production-reliability.md +1 -1
- package/skills/arc/references/querying.md +1 -2
- package/skills/arc/references/resources.md +8 -6
- package/skills/arc/references/testing.md +1 -1
- package/skills/arc-code-review/references/arc-cheatsheet.md +1 -1
- package/skills/arc-code-review/references/recipe-scope-permissions.md +1 -1
- package/skills/arc-module-publishing/references/resource-assembly.md +2 -2
- package/dist/rateLimitKey-D9dl3FQn.mjs +0 -40
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import "../index-
|
|
4
|
-
import { r as CreateAppOptions } from "../index-
|
|
2
|
+
import { _ as ModuleDisposer, g as PortName, o as ArcPorts, p as ModuleName, r as ArcModuleInput, v as ModuleSetupContext } from "../types-CQhHTZXs.mjs";
|
|
3
|
+
import "../index-CaBFPmnu.mjs";
|
|
4
|
+
import { r as CreateAppOptions } from "../index-CXqYFGoH.mjs";
|
|
5
5
|
import { i as RequestScope } from "../types-DnkIALZ8.mjs";
|
|
6
6
|
import { l as PermissionCheck, t as AnyRecord } from "../base-HXNgPQww.mjs";
|
|
7
|
-
import { F as ResourceDefinition } from "../index-
|
|
7
|
+
import { F as ResourceDefinition } from "../index-DtHACefu.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,13 +1,13 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { d as resolveModule, l as isLazyBridge, o as resolveModuleClosure } from "../plan-
|
|
3
|
-
import { h as asModulePorts, r as createApp } from "../createApp-
|
|
4
|
-
import { n as getModuleExports } from "../module-
|
|
5
|
-
import { g as getUserId } from "../types-
|
|
6
|
-
import { t as defineAggregation } from "../defineAggregation-
|
|
7
|
-
import { f as BaseController } from "../plugin-
|
|
8
|
-
import { t as defineResource } from "../defineResource-
|
|
9
|
-
import { t as CRUD_OPERATIONS } from "../constants-
|
|
10
|
-
import { E as requireOrgRole } from "../permissions-
|
|
1
|
+
/*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
|
|
2
|
+
import { d as resolveModule, l as isLazyBridge, o as resolveModuleClosure } from "../plan-BhKHIkFl.mjs";
|
|
3
|
+
import { h as asModulePorts, r as createApp } from "../createApp-CEdGZtkP.mjs";
|
|
4
|
+
import { n as getModuleExports } from "../module-BLrTmMyk.mjs";
|
|
5
|
+
import { g as getUserId } from "../types-ZvdR7MVa.mjs";
|
|
6
|
+
import { t as defineAggregation } from "../defineAggregation-DUsrGcsm.mjs";
|
|
7
|
+
import { f as BaseController } from "../plugin-D6hrdx-j.mjs";
|
|
8
|
+
import { t as defineResource } from "../defineResource-q8TsJpOm.mjs";
|
|
9
|
+
import { t as CRUD_OPERATIONS } from "../constants-D9EiaO5s.mjs";
|
|
10
|
+
import { E as requireOrgRole } from "../permissions-CEyeDHtT.mjs";
|
|
11
11
|
import { runStorageContract } from "./storageContract.mjs";
|
|
12
12
|
import Fastify from "fastify";
|
|
13
13
|
import { mkdir, mkdtemp, readFile, readdir, rm, stat } from "node:fs/promises";
|
|
@@ -1873,7 +1873,7 @@ function pickDefaultAuth(authMode, callerAuth) {
|
|
|
1873
1873
|
};
|
|
1874
1874
|
}
|
|
1875
1875
|
async function createTestApp(options = {}) {
|
|
1876
|
-
const { createApp } = await import("../createApp-
|
|
1876
|
+
const { createApp } = await import("../createApp-CEdGZtkP.mjs").then((n) => n.i);
|
|
1877
1877
|
const { resources = [], db = "in-memory", connectMongoose = false, authMode = "jwt", defaultOrgId, plugins, auth: callerAuth, ...appOptions } = options;
|
|
1878
1878
|
let dbHandle;
|
|
1879
1879
|
let dbUri;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as claimedAttempts } from "../claimed-
|
|
1
|
+
/*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as claimedAttempts } from "../claimed-CM_-lFHX.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
1
|
|
|
2
|
-
import { r as ArcModuleInput } from "../types-
|
|
2
|
+
import { r as ArcModuleInput } from "../types-CQhHTZXs.mjs";
|
|
3
3
|
export interface RequiredPortsOptions {
|
|
4
4
|
/** Modules composed alongside — the peers the module `dependsOn` or `requires.modules`. */
|
|
5
5
|
readonly with?: readonly ArcModuleInput[];
|
|
@@ -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.53.0 | MIT | https://classytic.com */
|
|
2
|
+
import { c as declareModules, d as resolveModule, i as planModules, r as compositionProblems } from "../plan-BhKHIkFl.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.53.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
|
|
4
|
+
import { $ as FieldRule, A as RequestWithExtras, At as RouteMcpConfig, B as OnTenantDeleteConfig, Bn as ControllerHandler, C as RequestIdOptions, D as FastifyWithAuth, Dt as ActionHandlerFn, E as FastifyRequestExtras, Et as ActionEntry, Ft as Authenticator, G as PresetResult, Gn as IRequestContext, H as PresetController, Hn as FastifyHandler, I as CrudController, In as MutationWriteContext, It as AuthenticatorContext, J as LookupPolicy, K as CrudRouteKey, Kn as RawRouteHandler, L as ResourceConfig, Ln as ResourceWrites, Lt as JwtContext, Mt as RateLimitConfig, Nt as AuthHelpers, O as FastifyWithDecorators, Ot as ActionsMap, Pt as AuthPluginOptions, Q as ArcFieldRule, R as ResourceIdempotencyConfig, Rn as WriteContext, Rt as TokenPair, S as IntrospectionPluginOptions, T as EventsDecorator, Tt as ActionDefinition, U as PresetFunction, Un as IController, V as ResolvedTenantPurge, Vn as ControllerLike, W as PresetHook, Wn as IControllerResponse, X as OpenApiSchemas, Y as MiddlewareConfig, Z as RouteSchemaOptions, _ as ServiceContext, a as IntrospectionData, b as HealthCheck, c as ResourceMetadata, d as LookupOption, et as ResourceHookContext, f as OwnershipCheck, g as RequestContext, h as QueryParserInterface, i as PaginationResult, jt as RouteMethod, k as MiddlewareHandler, kn as BaseControllerOptions, kt as RouteDefinition, l as ArcInternalMetadata, m as PopulateOption, n as InferDocType, nt as ResourceExtensions, o as RegistryEntry, p as ParsedQuery, q as CrudSchemas, qn as RouteHandler, r as InferResourceDoc, rt as EventDefinition, s as RegistryStats, t as InferAdapterDoc, tt as ResourceHooks, u as ControllerQueryOptions, v as CrudRouterOptions, w as ArcDecorator, wt as ResourceCacheConfig, x as HealthOptions, y as GracefulShutdownOptions, z as ResourcePermissions, zn as WriteVerbKey } from "../index-DtHACefu.mjs";
|
|
5
5
|
import { n as ElevationOptions, t as ElevationEvent } from "../elevation-DPD0hcU-.mjs";
|
|
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 };
|
|
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, PresetController, 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.53.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.53.0 | MIT | https://classytic.com */
|
|
2
2
|
export {};
|
|
@@ -1,41 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
import { n as DomainEvent, r as EventHandler } from "./EventTransport-CYEoCJGe.mjs";
|
|
3
3
|
import { n as ErrorMapper } from "./errorHandler-B9r88jZV.mjs";
|
|
4
|
+
import { t as HealthCheck } from "./health-skjSwNaC.mjs";
|
|
4
5
|
import { FastifyInstance, FastifyPluginAsync } from "fastify";
|
|
5
6
|
import { LockAdapter } from "@classytic/repo-core/lock";
|
|
6
|
-
interface HealthCheck {
|
|
7
|
-
/** Name of the dependency */
|
|
8
|
-
name: string;
|
|
9
|
-
/**
|
|
10
|
-
* Function that returns true if healthy, false otherwise.
|
|
11
|
-
*
|
|
12
|
-
* Receives an `AbortSignal` aborted when the check's timeout elapses —
|
|
13
|
-
* pass it to fetch/driver calls so a stalled dependency probe actually
|
|
14
|
-
* STOPS instead of accumulating an abandoned operation per readiness
|
|
15
|
-
* poll. Ignoring the parameter is fine (back-compat): the timeout still
|
|
16
|
-
* bounds how long the PROBE waits, just not the underlying work.
|
|
17
|
-
*/
|
|
18
|
-
check: (signal?: AbortSignal) => Promise<boolean> | boolean;
|
|
19
|
-
/** Optional timeout in ms (default: 5000) */
|
|
20
|
-
timeout?: number;
|
|
21
|
-
/** Whether this check is critical for readiness (default: true) */
|
|
22
|
-
critical?: boolean;
|
|
23
|
-
}
|
|
24
|
-
interface HealthOptions {
|
|
25
|
-
/** Route prefix (default: '/_health') */
|
|
26
|
-
prefix?: string;
|
|
27
|
-
/** Health check dependencies */
|
|
28
|
-
checks?: readonly HealthCheck[];
|
|
29
|
-
/** Enable metrics endpoint (default: false) */
|
|
30
|
-
metrics?: boolean;
|
|
31
|
-
/** Custom metrics collector function */
|
|
32
|
-
metricsCollector?: () => Promise<string> | string;
|
|
33
|
-
/** Version info to include in responses */
|
|
34
|
-
version?: string;
|
|
35
|
-
/** Collect HTTP request metrics (default: true if metrics enabled) */
|
|
36
|
-
collectHttpMetrics?: boolean;
|
|
37
|
-
}
|
|
38
|
-
declare const _default$1: FastifyPluginAsync<HealthOptions>;
|
|
39
7
|
/**
|
|
40
8
|
* Daily gate — "once per LOCAL calendar day, at/after a wall-clock time in an IANA zone".
|
|
41
9
|
*
|
|
@@ -525,9 +493,54 @@ interface EventHandlerDefinition {
|
|
|
525
493
|
*/
|
|
526
494
|
durability?: "retry" | "boundary";
|
|
527
495
|
}
|
|
528
|
-
|
|
496
|
+
/**
|
|
497
|
+
* The decisions a module's factory made from its own config, as plain data
|
|
498
|
+
* (strings, numbers, booleans, null, arrays, plain objects). Printed by
|
|
499
|
+
* `arc describe` and the boot error, so NEVER put a secret in it.
|
|
500
|
+
*/
|
|
501
|
+
type ModuleFacts = {
|
|
502
|
+
readonly [key: string]: unknown;
|
|
503
|
+
};
|
|
504
|
+
/** Every composed module's facts by name (`{}` for a module that declares none). */
|
|
505
|
+
type ComposedModuleFacts = {
|
|
506
|
+
readonly [moduleName: string]: ModuleFacts | undefined;
|
|
507
|
+
};
|
|
508
|
+
/**
|
|
509
|
+
* A rule over facts, evaluated once at boot before any module setup. Fatal under every
|
|
510
|
+
* preset: every failure is collected, then boot throws one `ArcBootError`.
|
|
511
|
+
*/
|
|
512
|
+
interface ModuleInvariant<TFacts extends ModuleFacts = ModuleFacts> {
|
|
513
|
+
/** Stable code, conventionally `<module>.<rule>`, e.g. `media.upload-receiver`. */
|
|
514
|
+
readonly code: string;
|
|
515
|
+
/** One line telling the operator what to change. */
|
|
516
|
+
readonly fix: string;
|
|
517
|
+
/**
|
|
518
|
+
* Pure and synchronous: `true` passes; `false` or a short reason string fails.
|
|
519
|
+
* `all` holds every composed module's facts by name, for cross-module rules.
|
|
520
|
+
*/
|
|
521
|
+
check(facts: Readonly<TFacts>, all: ComposedModuleFacts): boolean | string;
|
|
522
|
+
}
|
|
523
|
+
interface ArcModule<TExports = unknown, TPorts extends PortName = PortName, TOptionalPorts extends PortName = PortName, TFacts extends ModuleFacts = ModuleFacts> {
|
|
529
524
|
/** Stable identifier — appears in boot logs and duplicate-module detection. */
|
|
530
525
|
readonly name: string;
|
|
526
|
+
/**
|
|
527
|
+
* The config decisions this module's factory made, as plain serialisable data — no
|
|
528
|
+
* secrets. Read by `invariants` (this module's and others') and printed by `arc describe`.
|
|
529
|
+
*/
|
|
530
|
+
readonly facts?: TFacts;
|
|
531
|
+
/**
|
|
532
|
+
* Rules over `facts` checked before any module's `plugins`/`bootstrap` runs, so a
|
|
533
|
+
* module that contradicts itself (or a sibling) never boots:
|
|
534
|
+
*
|
|
535
|
+
* ```ts
|
|
536
|
+
* defineModule({ name: "media",
|
|
537
|
+
* facts: { driver: cfg.driver, uploadReceiver: cfg.receiver },
|
|
538
|
+
* invariants: [{ code: "media.upload-receiver", fix: "enable the receiver or use a cloud driver",
|
|
539
|
+
* check: (f) => f.driver !== "local" || f.uploadReceiver || "local driver with the receiver off" }],
|
|
540
|
+
* })
|
|
541
|
+
* ```
|
|
542
|
+
*/
|
|
543
|
+
readonly invariants?: readonly ModuleInvariant<TFacts>[];
|
|
531
544
|
/**
|
|
532
545
|
* Names of modules this one must be composed AFTER. A dependency's
|
|
533
546
|
* `bootstrap` (and its `fastify.arc.modules[dep]` export) is always live
|
|
@@ -822,4 +835,4 @@ interface ArcCompositionConfig {}
|
|
|
822
835
|
type ModuleName = ArcCompositionConfig extends {
|
|
823
836
|
readonly strictModuleNames: true;
|
|
824
837
|
} ? keyof ArcModuleRegistry & string : string;
|
|
825
|
-
export {
|
|
838
|
+
export { DailyClock as A, DailyScheduleOptions as C, SchedulesPluginOptions as D, ScheduleStats as E, MemoryDailyLedger as F, createDailyGate as I, createMemoryDailyLedger as L, DailyGateOptions as M, DailyLedger as N, _default as O, DailyRunOutcome as P, loadResources as S, ScheduleRunContext as T, ModuleDisposer as _, ArcPortRegistry as a, ResourceLike as b, EventHandlerDefinition as c, ModuleFacts as d, ModuleInvariant as f, PortName as g, ModuleRequirements as h, ArcModuleRegistry as i, DailyGate as j, DailyClaimInfo as k, LazyBridge as l, ModulePorts as m, ArcModule as n, ArcPorts as o, ModuleName as p, ArcModuleInput as r, ComposedModuleFacts as s, ArcCompositionConfig as t, ModuleContribution as u, ModuleSetupContext as v, ScheduleDefinition as w, ResourceModule as x, LoadResourcesOptions as y };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { i as ResourceRateLimiter } from "./resourceRateLimit-BPiESPtG.mjs";
|
|
3
|
-
import { F as ResourceDefinition } from "./index-
|
|
3
|
+
import { F as ResourceDefinition } from "./index-DtHACefu.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
/** Behavioral hints for MCP clients (tool annotations per MCP spec) */
|
|
6
6
|
interface ToolAnnotations {
|
|
@@ -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.53.0 | MIT | https://classytic.com */
|
|
2
|
+
import { l as UnauthorizedError, o as OrgRequiredError } from "./errors-Ukhmfmmx.mjs";
|
|
3
|
+
import { n as requireSingleHeaderValue } from "./headers-Ib7BDgRI.mjs";
|
|
4
|
+
import { t as getUserId$1 } from "./userHelpers-CwpEK36a.mjs";
|
|
5
5
|
// src/scope/types.ts
|
|
6
6
|
/**
|
|
7
7
|
* Request Scope — The One Standard
|
package/dist/usage/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as ArcError } from "../errors-
|
|
3
|
-
import { c as getOrgId, g as getUserId, i as getClientId } from "../types-
|
|
4
|
-
import { n as declareRuntimeCapability } from "../runtimeCapabilities-
|
|
1
|
+
/*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as ArcError } from "../errors-Ukhmfmmx.mjs";
|
|
3
|
+
import { c as getOrgId, g as getUserId, i as getClientId } from "../types-ZvdR7MVa.mjs";
|
|
4
|
+
import { n as declareRuntimeCapability } from "../runtimeCapabilities-DY20Pibh.mjs";
|
|
5
5
|
import { usagePeriod } from "@classytic/repo-core/usage";
|
|
6
6
|
import fp from "fastify-plugin";
|
|
7
7
|
// src/usage/requireQuota.ts
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { a as NotFoundError, c as RateLimitError, d as ValidationError, f as createDomainError, i as ForbiddenError, l as ServiceUnavailableError, m as isArcError, n as ConflictError, o as OrgAccessDeniedError, p as createError, r as ErrorOptions, s as OrgRequiredError, t as ArcError, u as UnauthorizedError } from "../errors-DTo0me1o.mjs";
|
|
3
3
|
import { n as ErrorMapper } from "../errorHandler-B9r88jZV.mjs";
|
|
4
4
|
import { F as getHeader, I as requireSingleHeaderValue, P as ArcHeaders } from "../types-DnkIALZ8.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { X as OpenApiSchemas, h as QueryParserInterface, p as ParsedQuery } from "../index-DtHACefu.mjs";
|
|
6
6
|
import { a as SSE_DEFAULT_DRAIN_TIMEOUT_MS, c as SseStreamOptions, i as registerSseStats, l as openSseStream, n as SseConnectionGauge, o as SSE_DEFAULT_MAX_BUFFERED_BYTES, r as createSseConnectionGauge, s as SseStream, t as SSEStats } from "../sseStats-DQqNN385.mjs";
|
|
7
7
|
import { f as getUserId, m as normalizeRoles, p as getUserRoles, t as AnyRecord } from "../base-HXNgPQww.mjs";
|
|
8
8
|
import { errorContractSchema } from "@classytic/repo-core/errors";
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { a as OrgAccessDeniedError, c as ServiceUnavailableError, d as createDomainError, f as createError, i as NotFoundError, l as UnauthorizedError, n as ConflictError, o as OrgRequiredError, p as isArcError, r as ForbiddenError, s as RateLimitError, t as ArcError, u as ValidationError } from "../errors-
|
|
3
|
-
import { t as simpleEqualityMatcher } from "../simpleEqualityMatcher-
|
|
4
|
-
import { n as requireSingleHeaderValue, t as getHeader } from "../headers-
|
|
5
|
-
import { n as getUserRoles, r as normalizeRoles, t as getUserId } from "../userHelpers-
|
|
6
|
-
import { A as MONGO_DIALECT, C as listResponse, D as responses, E as queryParams, O as ArcQueryParser, S as keysetListResponse, T as paginationSchema, _ as bareListResponse, a as defineGuard, b as getDefaultCrudSchemas, c as withCompensation, d as CircuitBreakerError, f as CircuitBreakerRegistry, g as aggregateListResponse, h as createCircuitBreakerRegistry, i as handleRaw, j as NEUTRAL_DIALECT, k as createQueryParser, l as RedisCircuitBreakerState, m as createCircuitBreaker, n as createReplayHub, o as defineErrorMapper, p as CircuitState, r as lastEventIdOf, s as defineCompensation, t as createStateMachine, u as CircuitBreaker, v as deleteResponse, w as offsetListResponse, x as getListQueryParams, y as errorContractSchema } from "../utils-
|
|
7
|
-
import { a as isZodSchema, i as isJsonSchema, n as convertRouteSchema, o as toJsonSchema, t as convertOpenApiSchemas } from "../schemaConverter-
|
|
8
|
-
import { a as promoteStreamTokenToHeader, i as pipeUIMessageStreamToReply, n as forwardedStreamHeaders, r as isReadableStream, t as UI_MESSAGE_STREAM_HEADERS } from "../streaming-
|
|
9
|
-
import { a as registerSseStats, i as createSseConnectionGauge, n as SSE_DEFAULT_MAX_BUFFERED_BYTES, r as openSseStream, t as SSE_DEFAULT_DRAIN_TIMEOUT_MS } from "../sseStream-
|
|
10
|
-
import { n as declareRuntimeCapability } from "../runtimeCapabilities-
|
|
11
|
-
import { i as runAdmittedWork, r as registerShutdownParticipant } from "../shutdown-
|
|
12
|
-
import { t as hasEvents } from "../typeGuards-
|
|
1
|
+
/*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
|
|
2
|
+
import { a as OrgAccessDeniedError, c as ServiceUnavailableError, d as createDomainError, f as createError, i as NotFoundError, l as UnauthorizedError, n as ConflictError, o as OrgRequiredError, p as isArcError, r as ForbiddenError, s as RateLimitError, t as ArcError, u as ValidationError } from "../errors-Ukhmfmmx.mjs";
|
|
3
|
+
import { t as simpleEqualityMatcher } from "../simpleEqualityMatcher-Qbl-11cE.mjs";
|
|
4
|
+
import { n as requireSingleHeaderValue, t as getHeader } from "../headers-Ib7BDgRI.mjs";
|
|
5
|
+
import { n as getUserRoles, r as normalizeRoles, t as getUserId } from "../userHelpers-CwpEK36a.mjs";
|
|
6
|
+
import { A as MONGO_DIALECT, C as listResponse, D as responses, E as queryParams, O as ArcQueryParser, S as keysetListResponse, T as paginationSchema, _ as bareListResponse, a as defineGuard, b as getDefaultCrudSchemas, c as withCompensation, d as CircuitBreakerError, f as CircuitBreakerRegistry, g as aggregateListResponse, h as createCircuitBreakerRegistry, i as handleRaw, j as NEUTRAL_DIALECT, k as createQueryParser, l as RedisCircuitBreakerState, m as createCircuitBreaker, n as createReplayHub, o as defineErrorMapper, p as CircuitState, r as lastEventIdOf, s as defineCompensation, t as createStateMachine, u as CircuitBreaker, v as deleteResponse, w as offsetListResponse, x as getListQueryParams, y as errorContractSchema } from "../utils-CnrfcYMq.mjs";
|
|
7
|
+
import { a as isZodSchema, i as isJsonSchema, n as convertRouteSchema, o as toJsonSchema, t as convertOpenApiSchemas } from "../schemaConverter-XoLKVpzG.mjs";
|
|
8
|
+
import { a as promoteStreamTokenToHeader, i as pipeUIMessageStreamToReply, n as forwardedStreamHeaders, r as isReadableStream, t as UI_MESSAGE_STREAM_HEADERS } from "../streaming-DKziqs1Z.mjs";
|
|
9
|
+
import { a as registerSseStats, i as createSseConnectionGauge, n as SSE_DEFAULT_MAX_BUFFERED_BYTES, r as openSseStream, t as SSE_DEFAULT_DRAIN_TIMEOUT_MS } from "../sseStream-BsBesrfw.mjs";
|
|
10
|
+
import { n as declareRuntimeCapability } from "../runtimeCapabilities-DY20Pibh.mjs";
|
|
11
|
+
import { i as runAdmittedWork, r as registerShutdownParticipant } from "../shutdown-C76Hn-Th.mjs";
|
|
12
|
+
import { t as hasEvents } from "../typeGuards-Cr2_zEW0.mjs";
|
|
13
13
|
export { ArcError, ArcQueryParser, CircuitBreaker, CircuitBreakerError, CircuitBreakerRegistry, CircuitState, ConflictError, ForbiddenError, MONGO_DIALECT, NEUTRAL_DIALECT, NotFoundError, OrgAccessDeniedError, OrgRequiredError, RateLimitError, RedisCircuitBreakerState, SSE_DEFAULT_DRAIN_TIMEOUT_MS, SSE_DEFAULT_MAX_BUFFERED_BYTES, ServiceUnavailableError, UI_MESSAGE_STREAM_HEADERS, UnauthorizedError, ValidationError, aggregateListResponse, bareListResponse, convertOpenApiSchemas, convertRouteSchema, createCircuitBreaker, createCircuitBreakerRegistry, createDomainError, createError, createQueryParser, createReplayHub, createSseConnectionGauge, createStateMachine, declareRuntimeCapability, defineCompensation, defineErrorMapper, defineGuard, deleteResponse, errorContractSchema, forwardedStreamHeaders, getDefaultCrudSchemas, getHeader, getListQueryParams, getUserId, getUserRoles, handleRaw, hasEvents, isArcError, isJsonSchema, isReadableStream, isZodSchema, keysetListResponse, lastEventIdOf, listResponse, normalizeRoles, offsetListResponse, openSseStream, paginationSchema, pipeUIMessageStreamToReply, promoteStreamTokenToHeader, queryParams, registerShutdownParticipant, registerSseStats, requireSingleHeaderValue, responses, runAdmittedWork, simpleEqualityMatcher, toJsonSchema, withCompensation };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as ArcError, u as ValidationError } from "./errors-
|
|
3
|
-
import { t as runObservingSend } from "./observeSend-
|
|
4
|
-
import { h as RESERVED_QUERY_PARAMS } from "./constants-
|
|
5
|
-
import { t as arcLog } from "./logger-
|
|
6
|
-
import { a as registerSseStats } from "./sseStream-
|
|
1
|
+
/*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as ArcError, u as ValidationError } from "./errors-Ukhmfmmx.mjs";
|
|
3
|
+
import { t as runObservingSend } from "./observeSend-B7FEdk_g.mjs";
|
|
4
|
+
import { h as RESERVED_QUERY_PARAMS } from "./constants-D9EiaO5s.mjs";
|
|
5
|
+
import { t as arcLog } from "./logger-DdMS0XC_.mjs";
|
|
6
|
+
import { a as registerSseStats } from "./sseStream-BsBesrfw.mjs";
|
|
7
7
|
import { errorContractSchema as errorContractSchema$1 } from "@classytic/repo-core/errors";
|
|
8
8
|
import { readEnv } from "@classytic/primitives/environment";
|
|
9
9
|
import { OPERATOR_DESCRIPTIONS, URL_OPERATORS, escapeRegex, isQueryGrammarError, readFilterClauses, readPageRequest, readSearch, readSelect, readSort } from "@classytic/repo-core/query-parser";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
3
|
-
import { x as pathTouchesBlocked } from "./plugin-
|
|
1
|
+
/*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-Cy6j0m8_.mjs";
|
|
3
|
+
import { x as pathTouchesBlocked } from "./plugin-D6hrdx-j.mjs";
|
|
4
4
|
// src/core/aggregation/normalize.ts
|
|
5
5
|
/**
|
|
6
6
|
* Framework cap on URL-driven aggregation limits when the host opts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
3
|
-
import { d as createDomainError } from "./errors-
|
|
1
|
+
/*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-Cy6j0m8_.mjs";
|
|
3
|
+
import { d as createDomainError } from "./errors-Ukhmfmmx.mjs";
|
|
4
4
|
import fp from "fastify-plugin";
|
|
5
5
|
// src/plugins/versioning.ts
|
|
6
6
|
var versioning_exports = /* @__PURE__ */ __exportAll({ default: () => versioning_default });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as requestContext } from "./requestContext-
|
|
1
|
+
/*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as requestContext } from "./requestContext-B-TjFpWt.mjs";
|
|
3
3
|
// src/context/workScope.ts
|
|
4
4
|
/** Enter a scope for `fn`, or run it inside the active one. */
|
|
5
5
|
function runWorkScope(seed, fn) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classytic/arc",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.53.0",
|
|
4
4
|
"description": "Resource-oriented backend framework for Fastify - clean, minimal, powerful, tree-shakable",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -338,6 +338,7 @@
|
|
|
338
338
|
"check:type-lane": "node scripts/check-type-lane.mjs",
|
|
339
339
|
"lint": "biome check src/ && npm run check:skills",
|
|
340
340
|
"check:skills": "node scripts/check-skills.mjs",
|
|
341
|
+
"check:docs-imports": "node scripts/check-docs-imports.mjs",
|
|
341
342
|
"lint:fix": "biome check --fix src/",
|
|
342
343
|
"lint:all": "biome check src/ tests/",
|
|
343
344
|
"test": "vitest run",
|
|
@@ -399,12 +400,16 @@
|
|
|
399
400
|
"@modelcontextprotocol/client": ">=2.4.0",
|
|
400
401
|
"@modelcontextprotocol/node": ">=2.1.2",
|
|
401
402
|
"@modelcontextprotocol/server": ">=2.4.0",
|
|
402
|
-
"@opentelemetry/api": ">=1.
|
|
403
|
-
"@opentelemetry/auto-instrumentations-node": ">=0.
|
|
404
|
-
"@opentelemetry/
|
|
405
|
-
"@opentelemetry/
|
|
406
|
-
"@opentelemetry/
|
|
407
|
-
"@opentelemetry/
|
|
403
|
+
"@opentelemetry/api": ">=1.10.0",
|
|
404
|
+
"@opentelemetry/auto-instrumentations-node": ">=0.83.1",
|
|
405
|
+
"@opentelemetry/context-async-hooks": ">=3.1.1",
|
|
406
|
+
"@opentelemetry/core": ">=3.1.1",
|
|
407
|
+
"@opentelemetry/exporter-trace-otlp-http": ">=0.301.2",
|
|
408
|
+
"@opentelemetry/instrumentation-http": ">=0.301.2",
|
|
409
|
+
"@opentelemetry/instrumentation-mongodb": ">=0.78.0",
|
|
410
|
+
"@opentelemetry/resources": ">=3.1.1",
|
|
411
|
+
"@opentelemetry/sdk-trace": ">=3.1.1",
|
|
412
|
+
"@opentelemetry/semantic-conventions": ">=1.45.0",
|
|
408
413
|
"better-auth": ">=1.7.18",
|
|
409
414
|
"bullmq": ">=6.7.2",
|
|
410
415
|
"fastify": ">=5.12.8",
|
|
@@ -465,6 +470,12 @@
|
|
|
465
470
|
"@opentelemetry/auto-instrumentations-node": {
|
|
466
471
|
"optional": true
|
|
467
472
|
},
|
|
473
|
+
"@opentelemetry/context-async-hooks": {
|
|
474
|
+
"optional": true
|
|
475
|
+
},
|
|
476
|
+
"@opentelemetry/core": {
|
|
477
|
+
"optional": true
|
|
478
|
+
},
|
|
468
479
|
"@opentelemetry/exporter-trace-otlp-http": {
|
|
469
480
|
"optional": true
|
|
470
481
|
},
|
|
@@ -474,7 +485,13 @@
|
|
|
474
485
|
"@opentelemetry/instrumentation-mongodb": {
|
|
475
486
|
"optional": true
|
|
476
487
|
},
|
|
477
|
-
"@opentelemetry/
|
|
488
|
+
"@opentelemetry/resources": {
|
|
489
|
+
"optional": true
|
|
490
|
+
},
|
|
491
|
+
"@opentelemetry/sdk-trace": {
|
|
492
|
+
"optional": true
|
|
493
|
+
},
|
|
494
|
+
"@opentelemetry/semantic-conventions": {
|
|
478
495
|
"optional": true
|
|
479
496
|
},
|
|
480
497
|
"better-auth": {
|
|
@@ -538,7 +555,15 @@
|
|
|
538
555
|
"@modelcontextprotocol/client": "^2.4.0",
|
|
539
556
|
"@modelcontextprotocol/node": "^2.1.2",
|
|
540
557
|
"@modelcontextprotocol/server": "^2.4.0",
|
|
541
|
-
"@opentelemetry/api": "
|
|
558
|
+
"@opentelemetry/api": "1.10.0",
|
|
559
|
+
"@opentelemetry/auto-instrumentations-node": "0.83.1",
|
|
560
|
+
"@opentelemetry/context-async-hooks": "3.1.1",
|
|
561
|
+
"@opentelemetry/exporter-trace-otlp-http": "0.301.2",
|
|
562
|
+
"@opentelemetry/instrumentation-http": "0.301.2",
|
|
563
|
+
"@opentelemetry/instrumentation-mongodb": "0.78.0",
|
|
564
|
+
"@opentelemetry/resources": "3.1.1",
|
|
565
|
+
"@opentelemetry/sdk-trace": "3.1.1",
|
|
566
|
+
"@opentelemetry/semantic-conventions": "1.45.0",
|
|
542
567
|
"@types/node": "^26.6.6",
|
|
543
568
|
"@types/qs": "^6.15.1",
|
|
544
569
|
"@vitest/coverage-v8": "^5.1.0",
|
package/skills/arc/SKILL.md
CHANGED
|
@@ -56,16 +56,16 @@ const app = await createApp({
|
|
|
56
56
|
});
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
Custom route, parsed once. A function `handler` runs the full pipeline and becomes an MCP tool:
|
|
60
60
|
|
|
61
61
|
```typescript
|
|
62
62
|
import { parsed, routeInput } from '@classytic/arc/core';
|
|
63
63
|
const body = z.object({ title: z.string().trim().min(2), tags: z.array(z.string()).default([]) });
|
|
64
64
|
routes: [{ method: 'POST', path: '/notes', permissions: requireAuth(), ...routeInput({ body }),
|
|
65
|
-
|
|
65
|
+
handler: async (ctx) => ({ data: await notes.create(parsed(body, ctx.body)) }) }]
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
`rawHandler: (req, reply)` skips the pipeline: only for streams, raw-body webhooks, files, redirects.
|
|
69
69
|
|
|
70
70
|
Test: `const ctx = await createTestApp({ resources: [productResource] }); expectArc(await ctx.app.inject({ method: 'GET', url: '/products' })).ok();`
|
|
71
71
|
|
|
@@ -75,8 +75,8 @@ Test: `const ctx = await createTestApp({ resources: [productResource] }); expect
|
|
|
75
75
|
- `.default()` stays optional on the wire (zod input direction); `.refine()` needs `routeInput` or `parse: true`.
|
|
76
76
|
- `request.user` is undefined on public routes: guard it.
|
|
77
77
|
- Public + row filter needs `allowPublic({ policy })`, not `allow({ policy })`.
|
|
78
|
-
- A non-writable field in a body is 403
|
|
79
|
-
- An unknown filter key is
|
|
78
|
+
- A non-writable or `immutable` field in a body is 403, not stripped.
|
|
79
|
+
- An unknown filter key is 400, not dropped; `strictFilterFields: false` drops.
|
|
80
80
|
- `distributed` runtime needs shared stores and a schedule `lock` or `singleReplica`.
|
|
81
81
|
- Own `setNotFoundHandler` needs `errorHandler: { notFound: false }`.
|
|
82
82
|
- Refusing hook: `return reply.send(...)` or throw, never a bare send.
|
|
@@ -6,7 +6,7 @@ Import only from these subpaths (tree-shaken, no deep imports). Authoritative li
|
|
|
6
6
|
|---|---|
|
|
7
7
|
| `@classytic/arc` | `defineResource`, `defineAction`, `defineAggregation`, `defineResourceVariants`, `mergeResourceConfig`, `BaseController`, `BaseCrudController`, `BulkMixin`, `SlugMixin`, `SoftDeleteMixin`, `TreeMixin`, permission helpers, `ArcError`, `NotFoundError`, `ValidationError`, `createDomainError`, constants (`CRUD_OPERATIONS`, `DEFAULT_LIMIT` ...) |
|
|
8
8
|
| `/core` | Same resource and controller API plus `routeInput`, `crudInput`, `parsed`, `noPayloadSchema`, `createCrudRouter`, `QueryResolver`, `AccessControl`, `BodySanitizer`, `validateResourceConfig` |
|
|
9
|
-
| `/factory` | `createApp`, `createWorker`, `loadResources`, `defineModule`, `extendModule`, `getModuleExports`, `orderModules`, `planModules`, `verifyModuleGraph`, `renderModuleGraph`, `toAsyncApi`, `toFetchHandler`, `eventTopology`, `verifyEventDurability`, `createRelayNudge`, presets (`productionPreset`, `developmentPreset`, `testingPreset`, `edgePreset`) |
|
|
9
|
+
| `/factory` | `createApp`, `createWorker`, `loadResources`, `defineModule`, `ArcBootError`, `extendModule`, `getModuleExports`, `orderModules`, `planModules`, `verifyModuleGraph`, `renderModuleGraph`, `toAsyncApi`, `toFetchHandler`, `eventTopology`, `verifyEventDurability`, `createRelayNudge`, presets (`productionPreset`, `developmentPreset`, `testingPreset`, `edgePreset`) |
|
|
10
10
|
| `/permissions` | `allowPublic`, `requireAuth`, `requireRoles`, `requireOwnership`, `requireOrgMembership`, `requireOrgRole`, `requireTeamMembership`, `requireServiceScope`, `requireScopeContext`, `requireOrgInScope`, `requirePlatformRole`, `requireGrant`, `requireAgentScope`, `requireMandate`, `requireDPoP`, `allOf`, `anyOf`, `not`, `when`, `allow`, `deny`, `denyAll`, `permissionMatrix`, `createDynamicPermissionMatrix`, `createRoleHierarchy`, `fields`, `roles`, `introspectModule` |
|
|
11
11
|
| `/scope` | `getUserId`, `getOrgId`, `getOrgRoles`, `getTeamId`, `getClientId`, `getScopeContext`, `getRequestScope`, `getServiceScopes`, `getMandate`, `getDPoPJkt`, `isMember`, `isService`, `isElevated`, `isAuthenticated`, `hasOrgAccess`, `isOrgInScope`, `requireUserId`, `requireOrgId`, `requireTeamId`, `requireClientId`, `elevationPlugin`, `createTenantKeyGenerator`, `PUBLIC_SCOPE`, `AUTHENTICATED_SCOPE` |
|
|
12
12
|
| `/presets` (+ `/presets/tenant`, `/files-upload`, `/search`) | `multiTenantPreset`, `softDeletePreset`, `bulkPreset`, `slugLookupPreset`, `treePreset`, `ownedByUserPreset`, `auditedPreset`, `searchPreset`, `filesUploadPreset`, `registerPreset`, `applyPresets` |
|
|
@@ -34,6 +34,21 @@ Boot order is fixed: `beforeBoot` -> module graph -> arc core -> `plugins` -> `b
|
|
|
34
34
|
| `stores` | event transport, query cache, idempotency, etc.; arc closes only stores it built |
|
|
35
35
|
| `rateLimit.plan` | per-plan ceilings: `{ resolve, limits: { free: { max: 60 }, enterprise: false }, default }` |
|
|
36
36
|
|
|
37
|
+
### Module facts and invariants
|
|
38
|
+
|
|
39
|
+
A module whose config decisions contradict each other should fail boot, not its first request:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
defineModule({
|
|
43
|
+
name: 'media',
|
|
44
|
+
facts: { driver: cfg.driver, uploadReceiver: cfg.receiver }, // plain data, never secrets
|
|
45
|
+
invariants: [{ code: 'media.upload-receiver', fix: 'enable the receiver or use a cloud driver',
|
|
46
|
+
check: (f, all) => f.driver !== 'local' || f.uploadReceiver || 'local driver, receiver off' }],
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`check` is pure and sync: `true` passes, `false` or a reason string fails; `all` maps every composed module's facts by name. Runs after planning, before any module `plugins`/`bootstrap`, under every preset; all failures throw one `ArcBootError` (`problems: [{ code, module, message, fix }]`). Every createApp config failure is an `ArcBootError` with a code: match `err.code` / `err.problems`, not message text.
|
|
51
|
+
|
|
37
52
|
`createWorker(sameOptions)` (`@classytic/arc/factory`) boots the headless process: no HTTP, runs events, schedules and relays. Error disclosure (`includeStack`, `exposeInternalMessages`) derives from `preset`, else the environment; host keys merge over the derived pair.
|
|
38
53
|
|
|
39
54
|
Unknown routes answer `404 { code: 'arc.not_found', message, status, correlationId }` by default. A host that calls `setNotFoundHandler` itself passes `errorHandler: { notFound: false }` (Fastify allows one per scope); `notFound: (request, reply) => ...` replaces arc's.
|
|
@@ -65,7 +80,7 @@ import { defineGuard } from '@classytic/arc/utils';
|
|
|
65
80
|
|
|
66
81
|
middlewares: { create: [multipartBody({ allowedMimeTypes: ['image/png'], maxFileSize: 5_000_000 })] } // no-op for JSON
|
|
67
82
|
routeGuards: [tenantGuard.preHandler] // every route; order: auth, permissions, cache/idempotency, routeGuards, route preHandler
|
|
68
|
-
routes: [{ method: 'POST', path: '/export', handler:
|
|
83
|
+
routes: [{ method: 'POST', path: '/export', handler: (ctx) => ctrl.export(ctx), permissions: requireAuth(),
|
|
69
84
|
rateLimit: { max: 5, timeWindow: '1 minute' } }] // false = never throttle
|
|
70
85
|
routes: [{ preAuth: [(req) => { req.headers.authorization = `Bearer ${req.query.token}`; }] }] // EventSource token
|
|
71
86
|
```
|
|
@@ -77,4 +92,4 @@ routes: [{ preAuth: [(req) => { req.headers.authorization = `Bearer ${req.query.
|
|
|
77
92
|
|
|
78
93
|
## CLI
|
|
79
94
|
|
|
80
|
-
`arc init my-api --mongokit --better-auth --ts` scaffolds; `arc generate resource product [--mcp]`; `arc docs ./openapi.json --entry ./dist/index.js`; `arc introspect`; `arc describe <file> --json
|
|
95
|
+
`arc init my-api --mongokit --better-auth --ts` scaffolds; `arc generate resource product [--mcp]`; `arc docs ./openapi.json --entry ./dist/index.js`; `arc introspect`; `arc describe <file> --json` (resources, plus `modules` with facts and invariant results for exported module objects; never boots); `arc doctor` (static: env vars implied by installed deps and `.env.example`, `[info]` notes for unset `trustProxy` and no readiness checks).
|
|
@@ -38,7 +38,6 @@ Without `createApp`: `await fastify.register(eventPlugin, { transport })` from `
|
|
|
38
38
|
| `registry`, `validateMode` | Payload validation on publish: `'warn'` (default with registry) \| `'reject'` \| `'off'` |
|
|
39
39
|
| `onPublish`, `onPublishError` | Telemetry callbacks (isolated, never affect delivery) |
|
|
40
40
|
| `warnOnDuplicate` | Dual-publish detector, on outside production |
|
|
41
|
-
| `wal` | Low-level hook; not at-least-once. Use the outbox |
|
|
42
41
|
|
|
43
42
|
CRUD events auto-emit on `arcPlugins.emitEvents` (default true) as `<resource>.created|updated|deleted` with payload `{ resource, operation, data, userId?, organizationId?, timestamp }`. Build names with `crudEventType('product', 'created')`. Lifecycle names: `ARC_LIFECYCLE_EVENTS`.
|
|
44
43
|
|
|
@@ -24,10 +24,11 @@ const app = await createApp({
|
|
|
24
24
|
| `create` | `create_{name}` | not destructive, not idempotent |
|
|
25
25
|
| `update`, `delete` | `update_{name}`, `delete_{name}` | `destructiveHint`, `idempotentHint` |
|
|
26
26
|
| `actions` | `{action}_{name}` (input: `id` + action schema) | `destructiveHint` |
|
|
27
|
-
| custom routes
|
|
27
|
+
| custom routes | `{operation or slug}_{name}` | by HTTP method: GET/HEAD read-only; PUT/DELETE destructive + idempotent; POST/PATCH destructive |
|
|
28
28
|
|
|
29
29
|
- CRUD hints are all explicit and include `openWorldHint: false`; an omitted hint means the cautious spec default.
|
|
30
|
-
- A CRUD op becomes a tool only when `permissions.<op>` is declared and the op is not
|
|
30
|
+
- A CRUD op becomes a tool only when `permissions.<op>` is declared and the op is not left out of a `crud` allow-list.
|
|
31
|
+
- `crud: false` mounts no CRUD routes but keeps every permitted CRUD tool. For "no HTTP CRUD, only these tools", pair it with `overrides: { <resource>: { operations: ['list', 'get'] } }`.
|
|
31
32
|
- Tools run the same controller pipeline as REST: auth, tenant scope, permission policy, hooks, field masking, events.
|
|
32
33
|
- `list_*` accepts `page`, `limit`, `cursor` (keyset; `page` ignored when set), `sort`, `search`, `select`, `populate`, filters. `get_*` accepts `id`, `select`. `limit` max follows the resource `queryParser.maxLimit`.
|
|
33
34
|
- Mutating tools accept `_idempotencyKey` when an idempotency store is wired (register `idempotencyPlugin` before `mcpPlugin`). `idempotency.required` on a resource without a store throws at boot.
|
|
@@ -73,7 +73,7 @@ multiTenantPreset({ tenantFields: [
|
|
|
73
73
|
2. `kind: 'elevated'` without an org bypasses tenant filtering: unusable for normal per-org access.
|
|
74
74
|
3. Mark the tenant field `systemManaged` in `fieldRules`: `BodySanitizer` strips client values and the scope value is injected on write.
|
|
75
75
|
4. The preset overwrites a body-supplied org on UPDATE (blocks tenant hopping). Elevated without an org still bypasses.
|
|
76
|
-
5. `createTenantKeyGenerator()` (`@classytic/arc/scope
|
|
76
|
+
5. `createApp`'s default rate-limit key is per signed-in user, per IP when anonymous. For one quota per org: `keyGenerator: createTenantKeyGenerator({ strategy: 'organization' })` (`@classytic/arc/scope`; also the behaviour when `strategy` is omitted).
|
|
77
77
|
|
|
78
78
|
## Helpers (`@classytic/arc/scope`)
|
|
79
79
|
|