@classytic/arc 2.51.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-K7Q9WPjm.mjs → EventTransport-B3jTKMQH.mjs} +2 -2
- package/dist/{HookSystem-DBAu9uNT.mjs → HookSystem-DNwxV463.mjs} +2 -2
- package/dist/{ResourceRegistry-BelzCRMy.mjs → ResourceRegistry-Ck7RFodL.mjs} +2 -2
- package/dist/{acquire-B0zhfGSm.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-Dxj_cy6N.mjs → authorizationDecision-gB5-bHDp.mjs} +9 -7
- package/dist/bootError-BT3z3cvX.mjs +38 -0
- package/dist/{boundedMap-DOBai-H3.mjs → boundedMap-Ddw2yGb2.mjs} +1 -1
- package/dist/{buildHandler-Dyl8P9j0.mjs → buildHandler-B8IDGmhD.mjs} +5 -5
- package/dist/cache/index.mjs +4 -4
- package/dist/{caching-CUmaNL8Y.mjs → caching-BitJDAY0.mjs} +2 -2
- package/dist/{claimed-DJPk4VZr.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-DH41jnNT.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-DPmRWlpx.mjs → core-B_06Fcn0.mjs} +3 -3
- package/dist/{createActionRouter-B1xhER6i.mjs → createActionRouter-DtxUXOCI.mjs} +5 -5
- package/dist/{createAggregationRouter-CNntJL-z.mjs → createAggregationRouter-BMiKyDoW.mjs} +7 -7
- package/dist/{createApp-DpG26bCu.mjs → createApp-CEdGZtkP.mjs} +207 -44
- package/dist/{createMcpServer-CS2KOVP6.d.mts → createMcpServer-Bk3ls5jS.d.mts} +1 -1
- package/dist/{defineAggregation-rI3EbZUg.mjs → defineAggregation-DUsrGcsm.mjs} +1 -1
- package/dist/{defineResource-5DcG_wlI.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-XFu7J3aj.mjs → elevation-NJ3908pJ.mjs} +5 -5
- package/dist/encryption/index.d.mts +26 -1
- package/dist/encryption/index.mjs +56 -6
- package/dist/{errorHandler-xDVUWOMu.mjs → errorHandler-Ke6PGvF7.mjs} +7 -4
- package/dist/{errors-KBZ3tQk5.mjs → errors-Ukhmfmmx.mjs} +1 -1
- package/dist/{eventPlugin-BY38F6yK.d.mts → eventPlugin-BeJasppx.d.mts} +7 -18
- package/dist/{eventPlugin-C4lNj2Dw.mjs → eventPlugin-DTKAgSvb.mjs} +10 -8
- package/dist/{eventTypes-DZRoUAdk.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-baQc3MaO.d.mts → fastify-augmentation-DjxuSRG4.d.mts} +4 -3
- package/dist/{fieldTypes-DrXUW1jc.mjs → fieldTypes-BtFpQO6I.mjs} +2 -2
- package/dist/{fields-C5J8WTd2.mjs → fields-B7fuROWK.mjs} +1 -1
- package/dist/{filter-merge-DTjYoDrj.mjs → filter-merge-BuzZ-r9z.mjs} +1 -1
- package/dist/{generate-SA8oMlLB.mjs → generate-c4F39pk1.mjs} +4 -4
- package/dist/{headers-D5wrBLOk.mjs → headers-Ib7BDgRI.mjs} +2 -2
- package/dist/{health-BLal039H.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-Dhrks-hM.d.mts → index-CXqYFGoH.d.mts} +13 -4
- package/dist/{index-DexdFs1a.d.mts → index-CaBFPmnu.d.mts} +29 -7
- package/dist/{index-DKM2p5w5.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-DeKHaNZn.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-rDPGT5A9.mjs → jsonBody-BNlcGUnb.mjs} +2 -2
- package/dist/{keys-t7i-lJ2r.mjs → keys-DwvXJwUX.mjs} +1 -1
- package/dist/{loadResources-CcupAVJH.mjs → loadResources-izEeQLO_.mjs} +3 -3
- package/dist/{loadResourcesFromEntry-BpjYlaoj.mjs → loadResourcesFromEntry-CijqjbHE.mjs} +2 -2
- package/dist/logger/index.mjs +2 -2
- package/dist/{logger-IL7Btm-N.mjs → logger-DdMS0XC_.mjs} +1 -1
- package/dist/{mcpPlugin-BsdH7Vot.mjs → mcpPlugin-D0tSZqKk.mjs} +24 -22
- package/dist/{memory-Dkp6ZD3F.mjs → memory-Ay0haw9n.mjs} +3 -3
- package/dist/{metrics-CDPqgdKr.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-KFxT1Iuk.mjs → module-BLrTmMyk.mjs} +17 -2
- package/dist/{multiTenant-QtDzxx_K.d.mts → multiTenant-Cf0Ye-Wu.d.mts} +1 -1
- package/dist/{multipartBody-BHktuarE.mjs → multipartBody-L2gr96df.mjs} +1 -1
- package/dist/{observeSend-CY-sLanc.mjs → observeSend-B7FEdk_g.mjs} +1 -1
- package/dist/{openapi-DbeXiy2v.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-BWqkTE8-.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-e5YMrFbm.mjs → permissions-CEyeDHtT.mjs} +36 -17
- package/dist/{pipe-CMnKfdF4.mjs → pipe-DIAr91at.mjs} +2 -2
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/pipeline/index.mjs +2 -2
- package/dist/{plan-BvLJGm3U.mjs → plan-BhKHIkFl.mjs} +75 -20
- package/dist/{plugin-DYmu8uT4.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-ClwfBdIx.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-DX_lPabi.mjs → presets-st11ePNn.mjs} +150 -41
- package/dist/{projection-DnZiFPPE.mjs → projection-B4rqiJTi.mjs} +2 -2
- package/dist/{purger.types-BEzTVDOU.mjs → purger.types-BcHeAhY_.mjs} +1 -1
- package/dist/{queryCachePlugin-C57-Nj-g.mjs → queryCachePlugin-BgSc2bga.mjs} +6 -6
- package/dist/rateLimitKey-DLGdeFd2.mjs +138 -0
- package/dist/{realtime-C-VIoXMg.mjs → realtime-CpYpIFsm.mjs} +11 -11
- package/dist/registry/index.d.mts +2 -2
- package/dist/registry/index.mjs +3 -3
- package/dist/{registry-DbQvODPH.mjs → registry-BQsdAlZ_.mjs} +2 -2
- package/dist/{relay-B61seKq1.mjs → relay-CmT3gtkP.mjs} +11 -12
- package/dist/{renewingLease-Dp7wmzNN.mjs → renewingLease-DaoP0K-e.mjs} +1 -1
- package/dist/{replyHelpers-CHii_jIO.mjs → replyHelpers-SiLr1wK4.mjs} +2 -2
- package/dist/{requestContext-C_mbAm8o.mjs → requestContext-B-TjFpWt.mjs} +8 -3
- package/dist/{health-vEo3fni4.mjs → requestId-ClcKoWLq.mjs} +154 -116
- package/dist/{requirement-C8OsWLYp.mjs → requirement-BygDzjDS.mjs} +1 -1
- package/dist/{resourceRateLimit-DhbQZjE2.mjs → resourceRateLimit-DdIYis3m.mjs} +2 -2
- package/dist/{rolldown-runtime-HTi8KV7V.mjs → rolldown-runtime-Cy6j0m8_.mjs} +1 -1
- package/dist/{routeValidator-DnQ2BGnH.mjs → routeValidator-Bn-x2gaJ.mjs} +1 -1
- package/dist/{runtimeCapabilities-G9QXHov1.mjs → runtimeCapabilities-DY20Pibh.mjs} +7 -2
- package/dist/{schedules-DAthT5O3.mjs → schedules-CwqC0Mp0.mjs} +5 -5
- package/dist/{schemaConverter-BOt_ed78.mjs → schemaConverter-XoLKVpzG.mjs} +2 -2
- package/dist/{schemaIR-MZVVj6Cw.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-btg-225w.mjs → scope-B0vgM2Zw.mjs} +4 -4
- package/dist/{shutdown-Dfy8La90.mjs → shutdown-C76Hn-Th.mjs} +1 -1
- package/dist/{simpleEqualityMatcher-D5dOqbbj.mjs → simpleEqualityMatcher-Qbl-11cE.mjs} +1 -1
- package/dist/{sse-DivxX1m6.mjs → sse-eyb8lNuI.mjs} +7 -7
- package/dist/{sseStream-hQxQjvre.mjs → sseStream-BsBesrfw.mjs} +2 -2
- package/dist/{store-helpers-DfqfssAw.mjs → store-helpers-D1yIVa91.mjs} +1 -1
- package/dist/{streaming-CQiOktsh.mjs → streaming-DKziqs1Z.mjs} +1 -1
- package/dist/{subscriberIdentity-Bf8VLqA7.mjs → subscriberIdentity-DpdSQMQq.mjs} +1 -1
- package/dist/{tenancy-Btmaf1MB.mjs → tenancy-YuRYsOPr.mjs} +2 -2
- package/dist/{tenantPreparation-4e3qyb6q.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-DXx0IWyi.mjs → timing-BtIDIdQz.mjs} +1 -1
- package/dist/{transactionContext-DperjON1.mjs → transactionContext-BsQ5ortM.mjs} +1 -1
- package/dist/{typeGuards-eoQLIOh6.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-CcpISJe8.mjs → types-ZvdR7MVa.mjs} +4 -4
- package/dist/usage/index.mjs +4 -4
- package/dist/{userHelpers-Cp5zqlEN.mjs → userHelpers-CwpEK36a.mjs} +1 -1
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.mjs +12 -12
- package/dist/{utils-dKN-_315.mjs → utils-CnrfcYMq.mjs} +6 -6
- package/dist/{validate-BZHaAdgy.mjs → validate-BTQBh-Dr.mjs} +3 -3
- package/dist/{versioning-CPLP0VbB.mjs → versioning-DiLykI6U.mjs} +3 -3
- package/dist/{workScope-BI72KXsI.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-B1RxyGt3.mjs +0 -40
package/dist/context/index.d.mts
CHANGED
|
@@ -49,7 +49,7 @@ interface RequestStore {
|
|
|
49
49
|
*
|
|
50
50
|
* - `get()` — returns current store or undefined if outside request scope
|
|
51
51
|
* - `run(store, fn)` — run a function with a specific store (used by Arc internals)
|
|
52
|
-
* - `getStore()` — alias for get()
|
|
52
|
+
* - `getStore()` — deprecated alias for get()
|
|
53
53
|
*/
|
|
54
54
|
export declare const requestContext: {
|
|
55
55
|
/**
|
|
@@ -58,7 +58,10 @@ export declare const requestContext: {
|
|
|
58
58
|
*/
|
|
59
59
|
get(): RequestStore | undefined;
|
|
60
60
|
/**
|
|
61
|
-
* Alias for get()
|
|
61
|
+
* Alias for get().
|
|
62
|
+
*
|
|
63
|
+
* @deprecated Use `requestContext.get()`. Warns once per process; removed
|
|
64
|
+
* in the next minor.
|
|
62
65
|
*/
|
|
63
66
|
getStore(): RequestStore | undefined;
|
|
64
67
|
/**
|
package/dist/context/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as requestContext, t as getTraceHeaders } from "../requestContext-
|
|
3
|
-
import { n as evictToSize, r as touch } from "../boundedMap-
|
|
4
|
-
import { n as scopedValue, r as workSeedFromEvent, t as runWorkScope } from "../workScope-
|
|
5
|
-
import { t as transactionContext } from "../transactionContext-
|
|
1
|
+
/*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as requestContext, t as getTraceHeaders } from "../requestContext-B-TjFpWt.mjs";
|
|
3
|
+
import { n as evictToSize, r as touch } from "../boundedMap-Ddw2yGb2.mjs";
|
|
4
|
+
import { n as scopedValue, r as workSeedFromEvent, t as runWorkScope } from "../workScope-C3tPz_Gt.mjs";
|
|
5
|
+
import { t as transactionContext } from "../transactionContext-BsQ5ortM.mjs";
|
|
6
6
|
// src/context/requestScopedCache.ts
|
|
7
7
|
/** The memo slot the per-scope store hangs off. */
|
|
8
8
|
const SLOT = Symbol.for("arc.requestScopedCache");
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
import { $t as
|
|
3
|
-
import { $ as MAX_SEARCH_LENGTH, A as ResourceSeams, B as DEFAULT_ID_FIELD, C as getControllerScope, D as VariantsResult, E as VariantsMap, F as createCrudRouter, G as DEFAULT_UPDATE_METHOD, H as DEFAULT_MAX_LIMIT, I as createPermissionMiddleware, J as HOOK_PHASES, K as DEFAULT_VERSION_FIELD, L as defineAggregation, M as mergeResourceConfig, N as DefineActionConfig, O as defineResourceVariants, P as defineAction, Q as MAX_REGEX_LENGTH, R as CRUD_OPERATIONS, S as getControllerContext, T as VariantOverride, U as DEFAULT_SORT, V as DEFAULT_LIMIT, W as DEFAULT_TENANT_FIELD, X as HookPhase, Y as HookOperation, Z as MAX_FILTER_DEPTH, _ as nativePolicyFilter, a as formatValidationErrors, b as createFastifyHandler, c as InputSchema, d as RouteInputSlots, et as MUTATION_OPERATIONS, f as crudInput, g as NativePolicyFilter, h as routeInput, i as assertValidConfig, j as SeamedResourceConfig, k as AdapterLike, l as RouteInputIssue, m as parsed, n as ValidateOptions, nt as RESERVED_QUERY_PARAMS, o as validateResourceConfig, p as noPayloadSchema, q as HOOK_OPERATIONS, r as ValidationResult, rt as SYSTEM_FIELDS, s as CrudInput, t as ConfigError, tt as MutationOperation, u as RouteInputOptions, v as collectReadBlockedFields, w as sendControllerResponse, x as createRequestContext, y as isFieldReadable, z as CrudOperation } from "../index-
|
|
2
|
+
import { $t as getEntityId, An as ControllerConfigurableOptions, Bt as SoftDeleteExt, F as ResourceDefinition, Fn as BodySanitizerConfig, Gt as SlugMixin, Ht as TreeExt, Jt as BaseCrudController, Kt as BulkExt, Mn as ListResult, Nn as MixinConstructor, P as defineResource, Pn as BodySanitizer, Qt as getActionTarget, Ut as TreeMixin, Vt as SoftDeleteMixin, Wt as SlugExt, Xt as QueryResolverConfig, Yt as QueryResolver, Zt as ActionTargetCheck, an as FetchDenialReason, at as AggMeasureShorthand, ct as AggregationDateRangeRequirement, dt as AggregationMaterializedResult, en as getEntityIdField, ft as AggregationRateLimit, ht as AggregationFieldTypes, in as AccessControlRepository, it as AggMeasureInput, jn as ControllerConstructionOptions, kn as BaseControllerOptions, lt as AggregationIndexHint, mt as AggregationFieldType, nn as AccessControl, on as FetchResult, ot as AggregationCacheConfig, pt as AggregationsMap, qt as BulkMixin, rn as AccessControlConfig, st as AggregationConfig, tn as getEntityQuery, ut as AggregationMaterializedContext, zt as BaseController } from "../index-DtHACefu.mjs";
|
|
3
|
+
import { $ as MAX_SEARCH_LENGTH, A as ResourceSeams, B as DEFAULT_ID_FIELD, C as getControllerScope, D as VariantsResult, E as VariantsMap, F as createCrudRouter, G as DEFAULT_UPDATE_METHOD, H as DEFAULT_MAX_LIMIT, I as createPermissionMiddleware, J as HOOK_PHASES, K as DEFAULT_VERSION_FIELD, L as defineAggregation, M as mergeResourceConfig, N as DefineActionConfig, O as defineResourceVariants, P as defineAction, Q as MAX_REGEX_LENGTH, R as CRUD_OPERATIONS, S as getControllerContext, T as VariantOverride, U as DEFAULT_SORT, V as DEFAULT_LIMIT, W as DEFAULT_TENANT_FIELD, X as HookPhase, Y as HookOperation, Z as MAX_FILTER_DEPTH, _ as nativePolicyFilter, a as formatValidationErrors, b as createFastifyHandler, c as InputSchema, d as RouteInputSlots, et as MUTATION_OPERATIONS, f as crudInput, g as NativePolicyFilter, h as routeInput, i as assertValidConfig, j as SeamedResourceConfig, k as AdapterLike, l as RouteInputIssue, m as parsed, n as ValidateOptions, nt as RESERVED_QUERY_PARAMS, o as validateResourceConfig, p as noPayloadSchema, q as HOOK_OPERATIONS, r as ValidationResult, rt as SYSTEM_FIELDS, s as CrudInput, t as ConfigError, tt as MutationOperation, u as RouteInputOptions, v as collectReadBlockedFields, w as sendControllerResponse, x as createRequestContext, y as isFieldReadable, z as CrudOperation } from "../index-DWn0o4U7.mjs";
|
|
4
4
|
export { AccessControl, type AccessControlConfig, type AccessControlRepository, type ActionTargetCheck, type AdapterLike, type AggMeasureInput, type AggMeasureShorthand, type AggregationCacheConfig, type AggregationConfig, type AggregationDateRangeRequirement, type AggregationFieldType, type AggregationFieldTypes, type AggregationIndexHint, type AggregationMaterializedContext, type AggregationMaterializedResult, type AggregationRateLimit, type AggregationsMap, BaseController, type BaseControllerOptions, BaseCrudController, BodySanitizer, type BodySanitizerConfig, type BulkExt, BulkMixin, CRUD_OPERATIONS, type ConfigError, type ControllerConfigurableOptions, type ControllerConstructionOptions, type CrudInput, CrudOperation, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, DEFAULT_VERSION_FIELD, type DefineActionConfig, type FetchDenialReason, type FetchResult, HOOK_OPERATIONS, HOOK_PHASES, HookOperation, HookPhase, type InputSchema, type ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, type MixinConstructor, MutationOperation, type NativePolicyFilter, QueryResolver, type QueryResolverConfig, RESERVED_QUERY_PARAMS, ResourceDefinition, type ResourceSeams, type RouteInputIssue, type RouteInputOptions, type RouteInputSlots, SYSTEM_FIELDS, type SeamedResourceConfig, type SlugExt, SlugMixin, type SoftDeleteExt, SoftDeleteMixin, type TreeExt, TreeMixin, type ValidateOptions, type ValidationResult, type VariantOverride, type VariantsMap, type VariantsResult, assertValidConfig, collectReadBlockedFields, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, crudInput, defineAction, defineAggregation, defineResource, defineResourceVariants, formatValidationErrors, getActionTarget, getControllerContext, getControllerScope, getEntityId, getEntityIdField, getEntityQuery, isFieldReadable, mergeResourceConfig, nativePolicyFilter, noPayloadSchema, parsed, routeInput, sendControllerResponse, validateResourceConfig };
|
package/dist/core/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { a as DEFAULT_SORT, c as DEFAULT_VERSION_FIELD, d as MAX_FILTER_DEPTH, f as MAX_REGEX_LENGTH, g as SYSTEM_FIELDS, h as RESERVED_QUERY_PARAMS, i as DEFAULT_MAX_LIMIT, l as HOOK_OPERATIONS, m as MUTATION_OPERATIONS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MAX_SEARCH_LENGTH, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as HOOK_PHASES } from "../constants-
|
|
3
|
-
import { E as nativePolicyFilter, T as AccessControl, _ as BaseCrudController, a as crudInput, b as isFieldReadable, c as routeInput, d as createPermissionMiddleware, f as BaseController, g as BulkMixin, h as SlugMixin, m as SoftDeleteMixin, o as noPayloadSchema, p as TreeMixin, s as parsed, u as createCrudRouter, v as QueryResolver, w as BodySanitizer, y as collectReadBlockedFields } from "../plugin-
|
|
4
|
-
import { t as defineAggregation } from "../defineAggregation-
|
|
5
|
-
import { C as createFastifyHandler, D as sendControllerResponse, E as getControllerScope, T as getControllerContext, w as createRequestContext } from "../schemaIR-
|
|
6
|
-
import { a as defineResourceVariants, i as getEntityQuery, n as getEntityId, o as mergeResourceConfig, r as getEntityIdField, s as defineAction, t as getActionTarget } from "../core-
|
|
7
|
-
import { a as ResourceDefinition, i as validateResourceConfig, n as assertValidConfig, r as formatValidationErrors, t as defineResource } from "../defineResource-
|
|
1
|
+
/*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
|
|
2
|
+
import { a as DEFAULT_SORT, c as DEFAULT_VERSION_FIELD, d as MAX_FILTER_DEPTH, f as MAX_REGEX_LENGTH, g as SYSTEM_FIELDS, h as RESERVED_QUERY_PARAMS, i as DEFAULT_MAX_LIMIT, l as HOOK_OPERATIONS, m as MUTATION_OPERATIONS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MAX_SEARCH_LENGTH, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as HOOK_PHASES } from "../constants-D9EiaO5s.mjs";
|
|
3
|
+
import { E as nativePolicyFilter, T as AccessControl, _ as BaseCrudController, a as crudInput, b as isFieldReadable, c as routeInput, d as createPermissionMiddleware, f as BaseController, g as BulkMixin, h as SlugMixin, m as SoftDeleteMixin, o as noPayloadSchema, p as TreeMixin, s as parsed, u as createCrudRouter, v as QueryResolver, w as BodySanitizer, y as collectReadBlockedFields } from "../plugin-D6hrdx-j.mjs";
|
|
4
|
+
import { t as defineAggregation } from "../defineAggregation-DUsrGcsm.mjs";
|
|
5
|
+
import { C as createFastifyHandler, D as sendControllerResponse, E as getControllerScope, T as getControllerContext, w as createRequestContext } from "../schemaIR-DP7mMj7c.mjs";
|
|
6
|
+
import { a as defineResourceVariants, i as getEntityQuery, n as getEntityId, o as mergeResourceConfig, r as getEntityIdField, s as defineAction, t as getActionTarget } from "../core-B_06Fcn0.mjs";
|
|
7
|
+
import { a as ResourceDefinition, i as validateResourceConfig, n as assertValidConfig, r as formatValidationErrors, t as defineResource } from "../defineResource-q8TsJpOm.mjs";
|
|
8
8
|
export { AccessControl, BaseController, BaseCrudController, BodySanitizer, BulkMixin, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, DEFAULT_VERSION_FIELD, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, QueryResolver, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, SlugMixin, SoftDeleteMixin, TreeMixin, assertValidConfig, collectReadBlockedFields, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, crudInput, defineAction, defineAggregation, defineResource, defineResourceVariants, formatValidationErrors, getActionTarget, getControllerContext, getControllerScope, getEntityId, getEntityIdField, getEntityQuery, isFieldReadable, mergeResourceConfig, nativePolicyFilter, noPayloadSchema, parsed, routeInput, sendControllerResponse, validateResourceConfig };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import "./constants-
|
|
3
|
-
import { t as defineResource } from "./defineResource-
|
|
1
|
+
/*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
|
|
2
|
+
import "./constants-D9EiaO5s.mjs";
|
|
3
|
+
import { t as defineResource } from "./defineResource-q8TsJpOm.mjs";
|
|
4
4
|
// src/core/defineAction.ts
|
|
5
5
|
/**
|
|
6
6
|
* Build an `ActionDefinition` with a typed handler. The literal schema
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
3
|
-
import "./constants-
|
|
4
|
-
import { f as createError, i as NotFoundError, u as ValidationError } from "./errors-
|
|
5
|
-
import { D as sendControllerResponse, b as buildAuthMiddlewareForPermissions, c as buildRouteConfig, d as buildActionPipelineHandler, g as buildRouteHooks, l as resolveRouterPluginMw, m as buildActionPermissionMw, o as tryRegisterRoute, p as resolvePipelineSteps, r as schemaIRToJsonSchemaBranch, s as buildRateLimitConfig, t as actionSchemaIR, u as selectPluginMw, v as routeHookOptions, x as buildArcDecorator } from "./schemaIR-
|
|
1
|
+
/*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-Cy6j0m8_.mjs";
|
|
3
|
+
import "./constants-D9EiaO5s.mjs";
|
|
4
|
+
import { f as createError, i as NotFoundError, u as ValidationError } from "./errors-Ukhmfmmx.mjs";
|
|
5
|
+
import { D as sendControllerResponse, b as buildAuthMiddlewareForPermissions, c as buildRouteConfig, d as buildActionPipelineHandler, g as buildRouteHooks, l as resolveRouterPluginMw, m as buildActionPermissionMw, o as tryRegisterRoute, p as resolvePipelineSteps, r as schemaIRToJsonSchemaBranch, s as buildRateLimitConfig, t as actionSchemaIR, u as selectPluginMw, v as routeHookOptions, x as buildArcDecorator } from "./schemaIR-DP7mMj7c.mjs";
|
|
6
6
|
// src/core/createActionRouter.ts
|
|
7
7
|
var createActionRouter_exports = /* @__PURE__ */ __exportAll({ createActionRouter: () => createActionRouter });
|
|
8
8
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as evaluateAndApplyPermission } from "./authorizationDecision-
|
|
3
|
-
import { u as getRequestScope } from "./types-
|
|
4
|
-
import { f as createError } from "./errors-
|
|
5
|
-
import { g as buildRouteHooks, l as resolveRouterPluginMw, o as tryRegisterRoute, s as buildRateLimitConfig, u as selectPluginMw, v as routeHookOptions, x as buildArcDecorator, y as buildAuthMiddleware } from "./schemaIR-
|
|
6
|
-
import { t as buildAggregationHandler } from "./buildHandler-
|
|
7
|
-
import { n as validateAggregations } from "./validate-
|
|
1
|
+
/*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as evaluateAndApplyPermission } from "./authorizationDecision-gB5-bHDp.mjs";
|
|
3
|
+
import { u as getRequestScope } from "./types-ZvdR7MVa.mjs";
|
|
4
|
+
import { f as createError } from "./errors-Ukhmfmmx.mjs";
|
|
5
|
+
import { g as buildRouteHooks, l as resolveRouterPluginMw, o as tryRegisterRoute, s as buildRateLimitConfig, u as selectPluginMw, v as routeHookOptions, x as buildArcDecorator, y as buildAuthMiddleware } from "./schemaIR-DP7mMj7c.mjs";
|
|
6
|
+
import { t as buildAggregationHandler } from "./buildHandler-B8IDGmhD.mjs";
|
|
7
|
+
import { n as validateAggregations } from "./validate-BTQBh-Dr.mjs";
|
|
8
8
|
// src/core/aggregation/createAggregationRouter.ts
|
|
9
9
|
/**
|
|
10
10
|
* Register one Fastify route per aggregation. No-op when the map is
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
3
|
-
import { a as enterArcLoggerScope, i as runWithArcLogger, n as configureArcLogger, r as createPinoWriter, t as arcLog } from "./logger-
|
|
4
|
-
import { n as PUBLIC_SCOPE } from "./types-
|
|
5
|
-
import { t as runObservingSend } from "./observeSend-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { i as
|
|
11
|
-
import {
|
|
12
|
-
import { t as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { r as
|
|
16
|
-
import { r as
|
|
1
|
+
/*! @classytic/arc v2.53.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-Cy6j0m8_.mjs";
|
|
3
|
+
import { a as enterArcLoggerScope, i as runWithArcLogger, n as configureArcLogger, r as createPinoWriter, t as arcLog } from "./logger-DdMS0XC_.mjs";
|
|
4
|
+
import { n as PUBLIC_SCOPE } from "./types-ZvdR7MVa.mjs";
|
|
5
|
+
import { t as runObservingSend } from "./observeSend-B7FEdk_g.mjs";
|
|
6
|
+
import { n as bootError, t as ArcBootError } from "./bootError-BT3z3cvX.mjs";
|
|
7
|
+
import { r as initRuntimeCapabilityRegistry, t as auditRuntimeCapabilities } from "./runtimeCapabilities-DY20Pibh.mjs";
|
|
8
|
+
import { a as runShutdown, t as initShutdownRegistry } from "./shutdown-C76Hn-Th.mjs";
|
|
9
|
+
import { n as ipBucket, r as isScopeAwareKeyGenerator, t as createTenantKeyGenerator } from "./rateLimitKey-DLGdeFd2.mjs";
|
|
10
|
+
import { i as resolveResourceRateLimiter, n as markRateLimitingDisabled } from "./resourceRateLimit-DdIYis3m.mjs";
|
|
11
|
+
import { i as markArcRootValidator, r as arcValidatorBuilder, t as arcAjvCustomOptions } from "./routeValidator-Bn-x2gaJ.mjs";
|
|
12
|
+
import { o as logBootHealthSummary, s as mergeHealthChecks, t as createRequestIdGenerator } from "./requestId-ClcKoWLq.mjs";
|
|
13
|
+
import { t as parseJsonBody } from "./jsonBody-BNlcGUnb.mjs";
|
|
14
|
+
import { a as portsForModule, b as verifyEventDurability, f as resolveModuleArm, g as crudEventsOf, h as buildModuleGraph, m as analyzeModuleGraph, n as composeModules, x as verifyModuleGraph } from "./plan-BhKHIkFl.mjs";
|
|
15
|
+
import { c as wrapWithAttribution, f as defineEvent, l as wrapWithBoundary, r as CRUD_EVENT_SCHEMA } from "./eventTypes-DpDQtyR6.mjs";
|
|
16
|
+
import { r as withSubscriberId } from "./subscriberIdentity-DpdSQMQq.mjs";
|
|
17
|
+
import { r as getOptionalModuleExports } from "./module-BLrTmMyk.mjs";
|
|
17
18
|
import { isProductionEnv, readEnv } from "@classytic/primitives/environment";
|
|
18
19
|
import Fastify from "fastify";
|
|
19
20
|
import qs from "qs";
|
|
@@ -255,7 +256,12 @@ async function collectModuleScheduledJobs(fastify, modules, countsByModule) {
|
|
|
255
256
|
countsByModule?.set(m.name, jobs.length);
|
|
256
257
|
for (const job of jobs) {
|
|
257
258
|
const prior = owner.get(job.name);
|
|
258
|
-
if (prior !== void 0) throw
|
|
259
|
+
if (prior !== void 0) throw bootError({
|
|
260
|
+
code: "duplicate-scheduled-job",
|
|
261
|
+
module: m.name,
|
|
262
|
+
message: `[arc] duplicate scheduled-job name "${job.name}" — declared by module "${prior}" and module "${m.name}". Scheduled-job names must be unique across the module graph.`,
|
|
263
|
+
fix: `rename one of the "${job.name}" scheduled jobs; prefix names with the owning module`
|
|
264
|
+
});
|
|
259
265
|
owner.set(job.name, m.name);
|
|
260
266
|
out.push(job);
|
|
261
267
|
}
|
|
@@ -354,18 +360,38 @@ async function subscribeModuleEventHandlers(fastify, modules, countsByModule, co
|
|
|
354
360
|
countsByModule?.set(m.name, handlers.length);
|
|
355
361
|
if (handlers.length === 0) continue;
|
|
356
362
|
const bus = fastify.events;
|
|
357
|
-
if (!bus) throw
|
|
363
|
+
if (!bus) throw bootError({
|
|
364
|
+
code: "module-events-unavailable",
|
|
365
|
+
module: m.name,
|
|
366
|
+
message: `[arc] module "${m.name}" declares eventHandlers but the event subsystem is unavailable (fastify.events). Enable arcPlugins.events.`,
|
|
367
|
+
fix: "enable arcPlugins.events, or drop the module's eventHandlers"
|
|
368
|
+
});
|
|
358
369
|
for (const [index, def] of handlers.entries()) {
|
|
359
370
|
if (def.name !== void 0) {
|
|
360
371
|
const prior = owner.get(def.name);
|
|
361
|
-
if (prior !== void 0) throw
|
|
372
|
+
if (prior !== void 0) throw bootError({
|
|
373
|
+
code: "duplicate-event-handler",
|
|
374
|
+
module: m.name,
|
|
375
|
+
message: `[arc] duplicate event-handler name "${def.name}" — declared by module "${prior}" and module "${m.name}". Named event handlers must be unique across the module graph; prefix names with the owning module.`,
|
|
376
|
+
fix: "rename one of the handlers; prefix names with the owning module"
|
|
377
|
+
});
|
|
362
378
|
owner.set(def.name, m.name);
|
|
363
379
|
}
|
|
364
380
|
const patterns = Array.isArray(def.event) ? def.event : [def.event];
|
|
365
|
-
if (def.durability === "retry" && def.boundary) throw
|
|
381
|
+
if (def.durability === "retry" && def.boundary) throw bootError({
|
|
382
|
+
code: "event-handler-retry-with-boundary",
|
|
383
|
+
module: m.name,
|
|
384
|
+
message: `[arc] event handler "${def.name ?? patterns.join(",")}" in module "${m.name}" declares durability 'retry' and a boundary — a boundary swallows, so it is 'boundary'.`,
|
|
385
|
+
fix: "drop the boundary for durability 'retry', or declare durability 'boundary'"
|
|
386
|
+
});
|
|
366
387
|
const label = handlerLabel(def, m.name, patterns, index);
|
|
367
388
|
const identity = def.name ?? [...patterns].sort().join(",");
|
|
368
|
-
if (!def.name && handlers.some((other) => other !== def && !other.name && (Array.isArray(other.event) ? [...other.event] : [other.event]).sort().join(",") === identity)) throw
|
|
389
|
+
if (!def.name && handlers.some((other) => other !== def && !other.name && (Array.isArray(other.event) ? [...other.event] : [other.event]).sort().join(",") === identity)) throw bootError({
|
|
390
|
+
code: "ambiguous-event-handlers",
|
|
391
|
+
module: m.name,
|
|
392
|
+
message: `[arc] module "${m.name}" has ambiguous unnamed event handlers for "${identity}" — give each handler a stable name.`,
|
|
393
|
+
fix: "give each event handler a stable name"
|
|
394
|
+
});
|
|
369
395
|
const handler = withSubscriberId(`${m.name}:${identity}`, applyBoundary(def, m.name, label, fastify));
|
|
370
396
|
handlersByModule?.set(m.name, [...handlersByModule.get(m.name) ?? [], {
|
|
371
397
|
label,
|
|
@@ -766,7 +792,7 @@ async function registerArcCore(fastify, config, trackPlugin) {
|
|
|
766
792
|
await fastify.register(arcCorePlugin, { emitEvents: config.arcPlugins?.emitEvents !== false });
|
|
767
793
|
trackPlugin("arc-core");
|
|
768
794
|
if (config.arcPlugins?.events !== false) {
|
|
769
|
-
const { default: eventPlugin } = await import("./eventPlugin-
|
|
795
|
+
const { default: eventPlugin } = await import("./eventPlugin-DTKAgSvb.mjs").then((n) => n.r);
|
|
770
796
|
const eventOpts = typeof config.arcPlugins?.events === "object" ? config.arcPlugins.events : {};
|
|
771
797
|
await fastify.register(eventPlugin, {
|
|
772
798
|
/**
|
|
@@ -821,15 +847,15 @@ async function registerArcPlugins(fastify, config, trackPlugin, modules, moduleH
|
|
|
821
847
|
trackPlugin("arc-graceful-shutdown", shutdownOpts);
|
|
822
848
|
}
|
|
823
849
|
if (config.arcPlugins?.caching) {
|
|
824
|
-
const { default: cachingPlugin } = await import("./caching-
|
|
850
|
+
const { default: cachingPlugin } = await import("./caching-BitJDAY0.mjs").then((n) => n.n);
|
|
825
851
|
const opts = config.arcPlugins.caching === true ? {} : config.arcPlugins.caching;
|
|
826
852
|
await fastify.register(cachingPlugin, opts);
|
|
827
853
|
trackPlugin("arc-caching", opts);
|
|
828
854
|
}
|
|
829
855
|
if (config.arcPlugins?.queryCache) {
|
|
830
|
-
const { queryCachePlugin } = await import("./queryCachePlugin-
|
|
856
|
+
const { queryCachePlugin } = await import("./queryCachePlugin-BgSc2bga.mjs").then((n) => n.n);
|
|
831
857
|
const opts = config.arcPlugins.queryCache === true ? {} : config.arcPlugins.queryCache;
|
|
832
|
-
const store = config.stores?.queryCache ?? new (await (import("./memory-
|
|
858
|
+
const store = config.stores?.queryCache ?? new (await (import("./memory-Ay0haw9n.mjs").then((n) => n.n))).MemoryCacheStore();
|
|
833
859
|
await fastify.register(queryCachePlugin, {
|
|
834
860
|
store,
|
|
835
861
|
...opts
|
|
@@ -839,7 +865,7 @@ async function registerArcPlugins(fastify, config, trackPlugin, modules, moduleH
|
|
|
839
865
|
if (config.arcPlugins?.sse) {
|
|
840
866
|
if (config.arcPlugins?.events === false) fastify.log.warn("SSE plugin requires events plugin (arcPlugins.events). SSE disabled.");
|
|
841
867
|
else {
|
|
842
|
-
const { default: ssePlugin } = await import("./sse-
|
|
868
|
+
const { default: ssePlugin } = await import("./sse-eyb8lNuI.mjs").then((n) => n.n);
|
|
843
869
|
const opts = config.arcPlugins.sse === true ? {} : config.arcPlugins.sse;
|
|
844
870
|
await fastify.register(ssePlugin, opts);
|
|
845
871
|
trackPlugin("arc-sse", opts);
|
|
@@ -848,20 +874,20 @@ async function registerArcPlugins(fastify, config, trackPlugin, modules, moduleH
|
|
|
848
874
|
if (config.arcPlugins?.realtime) {
|
|
849
875
|
if (config.arcPlugins?.events === false) fastify.log.warn("Realtime plugin requires events plugin (arcPlugins.events). Realtime disabled.");
|
|
850
876
|
else {
|
|
851
|
-
const { default: realtimePlugin } = await import("./realtime-
|
|
877
|
+
const { default: realtimePlugin } = await import("./realtime-CpYpIFsm.mjs").then((n) => n.n);
|
|
852
878
|
const opts = config.arcPlugins.realtime === true ? {} : config.arcPlugins.realtime;
|
|
853
879
|
await fastify.register(realtimePlugin, opts);
|
|
854
880
|
trackPlugin("arc-realtime", opts);
|
|
855
881
|
}
|
|
856
882
|
}
|
|
857
883
|
if (config.arcPlugins?.metrics) {
|
|
858
|
-
const { default: metricsPlugin } = await import("./metrics-
|
|
884
|
+
const { default: metricsPlugin } = await import("./metrics-Bpgf4UL6.mjs").then((n) => n.n);
|
|
859
885
|
const opts = config.arcPlugins.metrics === true ? {} : config.arcPlugins.metrics;
|
|
860
886
|
await fastify.register(metricsPlugin, opts);
|
|
861
887
|
trackPlugin("arc-metrics", opts);
|
|
862
888
|
}
|
|
863
889
|
if (config.arcPlugins?.versioning) {
|
|
864
|
-
const { default: versioningPlugin } = await import("./versioning-
|
|
890
|
+
const { default: versioningPlugin } = await import("./versioning-DiLykI6U.mjs").then((n) => n.n);
|
|
865
891
|
await fastify.register(versioningPlugin, config.arcPlugins.versioning);
|
|
866
892
|
trackPlugin("arc-versioning", config.arcPlugins.versioning);
|
|
867
893
|
}
|
|
@@ -938,7 +964,7 @@ async function registerAuth(fastify, config, trackPlugin) {
|
|
|
938
964
|
*/
|
|
939
965
|
async function registerElevation(fastify, config, trackPlugin) {
|
|
940
966
|
if (!config.elevation) return;
|
|
941
|
-
const { elevationPlugin } = await import("./elevation-
|
|
967
|
+
const { elevationPlugin } = await import("./elevation-NJ3908pJ.mjs").then((n) => n.n);
|
|
942
968
|
await fastify.register(elevationPlugin, config.elevation);
|
|
943
969
|
trackPlugin("arc-elevation", config.elevation);
|
|
944
970
|
fastify.log.debug("Elevation plugin enabled");
|
|
@@ -953,7 +979,7 @@ async function registerElevation(fastify, config, trackPlugin) {
|
|
|
953
979
|
*/
|
|
954
980
|
async function registerErrorHandler(fastify, config, trackPlugin, moduleErrorMappers) {
|
|
955
981
|
if (config.errorHandler === false) return;
|
|
956
|
-
const { errorHandlerPlugin } = await import("./errorHandler-
|
|
982
|
+
const { errorHandlerPlugin } = await import("./errorHandler-Ke6PGvF7.mjs").then((n) => n.r);
|
|
957
983
|
/**
|
|
958
984
|
* DISCLOSURE DEFAULTS MERGE — they used to be REPLACED, and that was two bugs.
|
|
959
985
|
*
|
|
@@ -1172,7 +1198,7 @@ async function registerResources(fastify, config, preResolvedModules, skippedBri
|
|
|
1172
1198
|
let discoveryPath;
|
|
1173
1199
|
let discoveryYieldedZero = false;
|
|
1174
1200
|
if (resolvedResources === void 0 && config.resourceDir) {
|
|
1175
|
-
const { loadResources } = await import("./loadResources-
|
|
1201
|
+
const { loadResources } = await import("./loadResources-izEeQLO_.mjs").then((n) => n.n);
|
|
1176
1202
|
const { resolve, dirname } = await import("node:path");
|
|
1177
1203
|
const { fileURLToPath } = await import("node:url");
|
|
1178
1204
|
const rawDir = config.resourceDir;
|
|
@@ -1297,7 +1323,7 @@ Resources supplied by "${m.name}": ${provided}.`);
|
|
|
1297
1323
|
if (fastify.hasDecorator("getScheduleStats")) throw new Error("[arc] modules declare scheduledJobs but schedulesPlugin was already registered manually. Configure their runner through arcPlugins.schedules so Arc can compose one schedule table.");
|
|
1298
1324
|
const frozenJobs = Object.freeze(scheduledJobs.map((job) => Object.freeze({ ...job })));
|
|
1299
1325
|
const scheduleOptions = typeof config.arcPlugins?.schedules === "object" ? config.arcPlugins.schedules : {};
|
|
1300
|
-
const { default: schedulesPlugin } = await import("./schedules-
|
|
1326
|
+
const { default: schedulesPlugin } = await import("./schedules-CwqC0Mp0.mjs").then((n) => n.n);
|
|
1301
1327
|
await fastify.register(schedulesPlugin, {
|
|
1302
1328
|
...scheduleOptions,
|
|
1303
1329
|
schedules: frozenJobs
|
|
@@ -1473,8 +1499,12 @@ const ARC_PROTOCOL_HEADERS = [
|
|
|
1473
1499
|
* Unlike `allowedHeaders`, an UNSET `exposedHeaders` is NOT safe — CORS
|
|
1474
1500
|
* exposes nothing beyond the safelist by default — so this is always
|
|
1475
1501
|
* merged, creating the list when the host declared none.
|
|
1502
|
+
*
|
|
1503
|
+
* `x-request-id` too: arc sets it on every response and every error body
|
|
1504
|
+
* carries the same value as `correlationId`; without exposing it, browser
|
|
1505
|
+
* code cannot quote it in a bug report or match a response to its log line.
|
|
1476
1506
|
*/
|
|
1477
|
-
const ARC_EXPOSED_HEADERS = ["set-auth-token"];
|
|
1507
|
+
const ARC_EXPOSED_HEADERS = ["set-auth-token", "x-request-id"];
|
|
1478
1508
|
/**
|
|
1479
1509
|
* Default `Access-Control-Max-Age` (seconds) when the host didn't set one.
|
|
1480
1510
|
* Arc's CORS method/header lists are static per deploy, so letting browsers
|
|
@@ -1608,7 +1638,15 @@ function buildPlanOpts(rest, plan) {
|
|
|
1608
1638
|
* preserved and OR-ed with the path match.
|
|
1609
1639
|
*/
|
|
1610
1640
|
function buildRateLimitOpts(input) {
|
|
1611
|
-
const { skipPaths, allowList, plan, ...bare } = input;
|
|
1641
|
+
const { skipPaths, allowList: hostAllowList, plan, ipCeiling: _ipCeiling, ...bare } = input;
|
|
1642
|
+
let allowList = hostAllowList;
|
|
1643
|
+
if (usesDefaultKey(input)) {
|
|
1644
|
+
bare.keyGenerator = createTenantKeyGenerator({ strategy: "user" });
|
|
1645
|
+
if (Array.isArray(allowList)) {
|
|
1646
|
+
const list = allowList;
|
|
1647
|
+
allowList = (req, key) => list.includes(key) || list.includes(req.ip);
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1612
1650
|
applyScopeAwareHook(bare);
|
|
1613
1651
|
const rest = plan ? buildPlanOpts(bare, plan) : bare;
|
|
1614
1652
|
if (!skipPaths || skipPaths.length === 0) return allowList === void 0 ? rest : {
|
|
@@ -1629,6 +1667,99 @@ function buildRateLimitOpts(input) {
|
|
|
1629
1667
|
};
|
|
1630
1668
|
}
|
|
1631
1669
|
/**
|
|
1670
|
+
* Arc's default key: per signed-in user, per IP when anonymous, at `preHandler`. Applies
|
|
1671
|
+
* only when the host chose nothing — no `keyGenerator`, no `plan`, and no explicit
|
|
1672
|
+
* `hook: 'onRequest'` (which cannot see a user, so it keeps the plugin's per-IP key rather
|
|
1673
|
+
* than failing boot).
|
|
1674
|
+
*/
|
|
1675
|
+
function usesDefaultKey(input) {
|
|
1676
|
+
return input.keyGenerator === void 0 && input.plan === void 0 && input.hook !== "onRequest";
|
|
1677
|
+
}
|
|
1678
|
+
/** Floor and multiplier for the default early per-IP ceiling (see `resolveIpCeiling`). */
|
|
1679
|
+
const IP_CEILING_FLOOR = 2e3;
|
|
1680
|
+
const IP_CEILING_FACTOR = 20;
|
|
1681
|
+
/** `@fastify/rate-limit`'s own `max` when none is given. */
|
|
1682
|
+
const PLUGIN_DEFAULT_MAX = 1e3;
|
|
1683
|
+
/**
|
|
1684
|
+
* The cheap early guard that rides alongside the default per-user key.
|
|
1685
|
+
*
|
|
1686
|
+
* The per-user limit runs at `preHandler`, so traffic that never reaches one (unmatched
|
|
1687
|
+
* routes, requests that fail auth first) would otherwise go uncounted. The ceiling counts
|
|
1688
|
+
* every request per IP at `onRequest`, before body parsing and auth, with a deliberately
|
|
1689
|
+
* high budget: `max(2000, 20 × max)` per window (2000/min at arc's default `max: 100`).
|
|
1690
|
+
* That is ~33 req/s from one address: an office of ~100 people actively using an app
|
|
1691
|
+
* shares it comfortably, while a scripted flood still trips it.
|
|
1692
|
+
*
|
|
1693
|
+
* Only with the default key; `ipCeiling: false` drops it, a number sets it.
|
|
1694
|
+
*/
|
|
1695
|
+
function resolveIpCeiling(input) {
|
|
1696
|
+
if (!usesDefaultKey(input)) return void 0;
|
|
1697
|
+
const configured = input.ipCeiling;
|
|
1698
|
+
if (configured === false) return void 0;
|
|
1699
|
+
const timeWindow = typeof input.timeWindow === "number" || typeof input.timeWindow === "string" ? input.timeWindow : "1 minute";
|
|
1700
|
+
if (configured !== void 0) {
|
|
1701
|
+
if (typeof configured !== "number" || !Number.isSafeInteger(configured) || configured <= 0) throw new Error("[arc] rateLimit.ipCeiling must be a positive integer or false.");
|
|
1702
|
+
return {
|
|
1703
|
+
max: configured,
|
|
1704
|
+
timeWindow
|
|
1705
|
+
};
|
|
1706
|
+
}
|
|
1707
|
+
const base = typeof input.max === "number" ? input.max : input.max === void 0 ? PLUGIN_DEFAULT_MAX : IP_CEILING_FLOOR / IP_CEILING_FACTOR;
|
|
1708
|
+
return {
|
|
1709
|
+
max: Math.max(IP_CEILING_FLOOR, base * IP_CEILING_FACTOR),
|
|
1710
|
+
timeWindow
|
|
1711
|
+
};
|
|
1712
|
+
}
|
|
1713
|
+
/**
|
|
1714
|
+
* Install the early per-IP ceiling on the SAME `@fastify/rate-limit` registration
|
|
1715
|
+
* (`createRateLimit`), so it shares the host's store, `allowList` and `skipPaths`.
|
|
1716
|
+
*
|
|
1717
|
+
* A second plugin registration was rejected: `@fastify/rate-limit` applies every route's
|
|
1718
|
+
* `config.rateLimit` override in EVERY registration, so a route limit would be counted a
|
|
1719
|
+
* second time per IP — the NAT throttling this default removes. `fastify.rateLimit()` was
|
|
1720
|
+
* rejected too: it shares the per-request "already ran" marker, so it would switch off the
|
|
1721
|
+
* per-user limit. Keys carry an `arc-ip-ceiling:` prefix so a shared store never mixes them
|
|
1722
|
+
* with the anonymous per-IP bucket.
|
|
1723
|
+
*
|
|
1724
|
+
* Must run after the plugin is registered. Store errors fail open: the per-user limiter
|
|
1725
|
+
* still governs, and this is a coarse flood guard, not the limit.
|
|
1726
|
+
*/
|
|
1727
|
+
function installIpCeiling(fastify, ceiling, opts) {
|
|
1728
|
+
if (!ceiling) return;
|
|
1729
|
+
const create = Reflect.get(fastify, "createRateLimit");
|
|
1730
|
+
if (typeof create !== "function") return;
|
|
1731
|
+
const limiter = create.call(fastify, {
|
|
1732
|
+
max: ceiling.max,
|
|
1733
|
+
timeWindow: ceiling.timeWindow,
|
|
1734
|
+
keyGenerator: (req) => `arc-ip-ceiling:${ipBucket(req.ip)}`
|
|
1735
|
+
});
|
|
1736
|
+
const onExceeded = typeof opts.onExceeded === "function" ? opts.onExceeded : void 0;
|
|
1737
|
+
const buildError = typeof opts.errorResponseBuilder === "function" ? opts.errorResponseBuilder : void 0;
|
|
1738
|
+
fastify.addHook("onRequest", async (req, reply) => {
|
|
1739
|
+
if (req.routeOptions?.config?.rateLimit === false) return;
|
|
1740
|
+
let result;
|
|
1741
|
+
try {
|
|
1742
|
+
result = await limiter(req);
|
|
1743
|
+
} catch (err) {
|
|
1744
|
+
req.log.debug({ err }, "[arc] rate-limit ip ceiling: store error, request let through");
|
|
1745
|
+
return;
|
|
1746
|
+
}
|
|
1747
|
+
if (result.isAllowed || !result.isExceeded) return;
|
|
1748
|
+
const seconds = Math.max(1, result.ttlInSeconds ?? 1);
|
|
1749
|
+
onExceeded?.(req, result.key);
|
|
1750
|
+
reply.header("retry-after", seconds);
|
|
1751
|
+
const context = {
|
|
1752
|
+
statusCode: 429,
|
|
1753
|
+
ban: false,
|
|
1754
|
+
max: result.max ?? ceiling.max,
|
|
1755
|
+
ttl: result.ttl ?? seconds * 1e3,
|
|
1756
|
+
after: `${seconds} second${seconds === 1 ? "" : "s"}`
|
|
1757
|
+
};
|
|
1758
|
+
if (buildError) throw buildError(req, context);
|
|
1759
|
+
throw Object.assign(/* @__PURE__ */ new Error(`Rate limit exceeded, retry in ${context.after}`), { statusCode: 429 });
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1762
|
+
/**
|
|
1632
1763
|
* A scope-keyed generator must run AFTER authentication, so arc places the hook itself.
|
|
1633
1764
|
*
|
|
1634
1765
|
* `@fastify/rate-limit` defaults to `onRequest`; arc authenticates in a `preHandler`. A
|
|
@@ -1922,11 +2053,13 @@ async function registerSecurityPlugins(fastify, config) {
|
|
|
1922
2053
|
} else fastify.log.warn("CORS disabled");
|
|
1923
2054
|
if (config.rateLimit !== false) {
|
|
1924
2055
|
const rateLimit = await loadPlugin("rateLimit");
|
|
1925
|
-
const
|
|
2056
|
+
const rateLimitInput = config.rateLimit ?? {
|
|
1926
2057
|
max: 100,
|
|
1927
2058
|
timeWindow: "1 minute"
|
|
1928
|
-
}
|
|
2059
|
+
};
|
|
2060
|
+
const rateLimitOpts = await applyRateLimitStoreFallback(buildRateLimitOpts(rateLimitInput), fastify.log);
|
|
1929
2061
|
await fastify.register(rateLimit, rateLimitOpts);
|
|
2062
|
+
installIpCeiling(fastify, resolveIpCeiling(rateLimitInput), rateLimitOpts);
|
|
1930
2063
|
const rateLimitRecord = typeof rateLimitOpts === "object" && rateLimitOpts !== null ? rateLimitOpts : void 0;
|
|
1931
2064
|
const hasStore = rateLimitRecord !== void 0 && (rateLimitRecord.store != null || rateLimitRecord.redis != null);
|
|
1932
2065
|
resolveResourceRateLimiter(fastify, hasStore ? "shared" : "memory");
|
|
@@ -2022,7 +2155,7 @@ var createApp_exports = /* @__PURE__ */ __exportAll({ createApp: () => createApp
|
|
|
2022
2155
|
* Reported together at production boot, so an opt-out is never silent.
|
|
2023
2156
|
*/
|
|
2024
2157
|
const STRICT_ENV_FLAGS = [
|
|
2025
|
-
["ARC_STRICT_PERMISSIONS", "An ungated
|
|
2158
|
+
["ARC_STRICT_PERMISSIONS", "An ungated CRUD route (read or write) no longer fails boot."],
|
|
2026
2159
|
["ARC_STRICT_QUERY_PARAMS", "An unknown filter key is DROPPED, which WIDENS the read."],
|
|
2027
2160
|
["ARC_STRICT_IMMUTABLE_WRITES", "A PATCH of an immutable field returns 200, unchanged."]
|
|
2028
2161
|
];
|
|
@@ -2069,7 +2202,11 @@ function resolveLoggerConfig(logger) {
|
|
|
2069
2202
|
function validateAuthOptions(options) {
|
|
2070
2203
|
const authConfig = options.auth;
|
|
2071
2204
|
if (authConfig === false || !authConfig) return;
|
|
2072
|
-
if (authConfig.type === "jwt" && !authConfig.jwt?.secret && !authConfig.authenticate) throw
|
|
2205
|
+
if (authConfig.type === "jwt" && !authConfig.jwt?.secret && !authConfig.authenticate) throw bootError({
|
|
2206
|
+
code: "auth-jwt-secret-missing",
|
|
2207
|
+
message: "createApp: JWT secret required when Arc auth is enabled.\nProvide auth.jwt.secret, auth.authenticate, or set auth: false to disable.\nExample: auth: { type: 'jwt', jwt: { secret: process.env.JWT_SECRET } }",
|
|
2208
|
+
fix: "set auth.jwt.secret (or auth.authenticate), or pass auth: false"
|
|
2209
|
+
});
|
|
2073
2210
|
}
|
|
2074
2211
|
function validateDistributedRuntime(options) {
|
|
2075
2212
|
const deferredWarnings = [];
|
|
@@ -2107,9 +2244,13 @@ function validateDistributedRuntime(options) {
|
|
|
2107
2244
|
});
|
|
2108
2245
|
if (missing.length > 0) {
|
|
2109
2246
|
const lines = missing.map((m) => ` • ${m.key.padEnd(20)} → ${m.hint}`).join("\n");
|
|
2110
|
-
throw new
|
|
2247
|
+
throw new ArcBootError(`[Arc] runtime: 'distributed' requires durable (Redis/MongoDB) adapters, not memory.
|
|
2111
2248
|
|
|
2112
|
-
Missing:\n${lines}\n\nFix: pass durable adapters under \`stores\`, or use runtime: 'memory' for single-instance dev
|
|
2249
|
+
Missing:\n${lines}\n\nFix: pass durable adapters under \`stores\`, or use runtime: 'memory' for single-instance dev.`, missing.map((m) => ({
|
|
2250
|
+
code: "distributed-requires-shared-store",
|
|
2251
|
+
message: `runtime: 'distributed' needs ${m.key}`,
|
|
2252
|
+
fix: `pass ${m.hint}`
|
|
2253
|
+
})));
|
|
2113
2254
|
}
|
|
2114
2255
|
return deferredWarnings;
|
|
2115
2256
|
}
|
|
@@ -2140,13 +2281,21 @@ async function createApp(options) {
|
|
|
2140
2281
|
* TOPOLOGY is declared, never guessed: a second replica on the in-memory runtime silently
|
|
2141
2282
|
* loses cross-instance events and caches.
|
|
2142
2283
|
*/
|
|
2143
|
-
if (options.preset === "production" && options.runtime === void 0) throw
|
|
2284
|
+
if (options.preset === "production" && options.runtime === void 0) throw bootError({
|
|
2285
|
+
code: "production-runtime-undeclared",
|
|
2286
|
+
message: "createApp: preset 'production' requires an explicit `runtime` — 'memory' for a single instance, 'distributed' before running a second replica (it requires shared stores and is audited at boot).",
|
|
2287
|
+
fix: "set runtime: 'memory' (one instance) or runtime: 'distributed' (replicas)"
|
|
2288
|
+
});
|
|
2144
2289
|
/**
|
|
2145
2290
|
* A relay/scheduler process declaring HTTP resources is a wiring error —
|
|
2146
2291
|
* mounting routes anyway would hide the misdeployment behind a working endpoint.
|
|
2147
2292
|
*/
|
|
2148
2293
|
const declaredRole = options.role ?? "all";
|
|
2149
|
-
if ((declaredRole === "relay" || declaredRole === "scheduler") && (options.resources !== void 0 || options.resourceDir !== void 0)) throw
|
|
2294
|
+
if ((declaredRole === "relay" || declaredRole === "scheduler") && (options.resources !== void 0 || options.resourceDir !== void 0)) throw bootError({
|
|
2295
|
+
code: "role-declares-resources",
|
|
2296
|
+
message: `createApp: role '${declaredRole}' declares HTTP resources — a ${declaredRole} process must not serve routes. Remove \`resources\`/\`resourceDir\`, or change the role.`,
|
|
2297
|
+
fix: "remove resources/resourceDir from this process, or change the role"
|
|
2298
|
+
});
|
|
2150
2299
|
/**
|
|
2151
2300
|
* This app's own `arcLog` config, entered for the WHOLE boot. Held by
|
|
2152
2301
|
* reference and mutated in `buildApp` once `fastify.log` exists — a copy
|
|
@@ -2291,7 +2440,7 @@ async function buildApp(options, loggerScope, onInstance, onBootDisposer) {
|
|
|
2291
2440
|
await registerErrorHandler(fastify, config, trackPlugin, moduleErrorMappers);
|
|
2292
2441
|
await registerResources(fastify, config, resolvedModules, skippedBridges);
|
|
2293
2442
|
if (config.replyHelpers) {
|
|
2294
|
-
const { replyHelpersPlugin } = await import("./replyHelpers-
|
|
2443
|
+
const { replyHelpersPlugin } = await import("./replyHelpers-SiLr1wK4.mjs").then((n) => n.n);
|
|
2295
2444
|
await fastify.register(replyHelpersPlugin);
|
|
2296
2445
|
}
|
|
2297
2446
|
if (config.serializeBigInt) {
|
|
@@ -2308,6 +2457,20 @@ async function buildApp(options, loggerScope, onInstance, onBootDisposer) {
|
|
|
2308
2457
|
}
|
|
2309
2458
|
const authMode = config.auth === false ? "none" : config.auth ? config.auth.type : "none";
|
|
2310
2459
|
auditRuntimeCapabilities(fastify, config.runtime ?? "memory");
|
|
2460
|
+
if (config.arcPlugins?.health !== false) {
|
|
2461
|
+
const appHealth = config.arcPlugins?.health;
|
|
2462
|
+
const bootChecks = [...moduleHealthChecks, ...typeof appHealth === "object" && appHealth !== null ? appHealth.checks ?? [] : []];
|
|
2463
|
+
const production = config.preset === "production";
|
|
2464
|
+
const summarize = () => void logBootHealthSummary(fastify.log, bootChecks, { production });
|
|
2465
|
+
try {
|
|
2466
|
+
fastify.addHook("onReady", (done) => {
|
|
2467
|
+
summarize();
|
|
2468
|
+
done();
|
|
2469
|
+
});
|
|
2470
|
+
} catch {
|
|
2471
|
+
summarize();
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2311
2474
|
fastify.log.info({
|
|
2312
2475
|
preset: config.preset ?? "custom",
|
|
2313
2476
|
runtime: config.runtime ?? "memory",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { _ as ToolDefinition, c as McpAuthResult, r as CreateMcpServerConfig } from "./types-
|
|
2
|
+
import { _ as ToolDefinition, c as McpAuthResult, r as CreateMcpServerConfig } from "./types-DWFgq8EP.mjs";
|
|
3
3
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
4
4
|
/**
|
|
5
5
|
* Mutable auth ref — updated per-request by mcpPlugin.
|