@classytic/arc 2.18.2 → 2.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BaseController-DPwe89qs.mjs → BaseController-B-uXzf6I.mjs} +403 -216
- package/dist/{QueryCache-8YmAQ-zW.d.mts → QueryCache-Dsyv2mLS.d.mts} +1 -1
- package/dist/audit/index.d.mts +1 -1
- package/dist/auth/index.d.mts +4 -4
- package/dist/auth/index.mjs +4 -4
- package/dist/auth/redis-session.d.mts +1 -1
- package/dist/{betterAuthOpenApi-ClWxaceA.mjs → betterAuthOpenApi-DAAhMZff.mjs} +1 -1
- package/dist/{buildHandler-C_SkBNF3.mjs → buildHandler-Cvrc2p7r.mjs} +1 -1
- package/dist/cache/index.d.mts +3 -3
- package/dist/cache/index.mjs +3 -3
- package/dist/cli/commands/describe.d.mts +1 -1
- package/dist/cli/commands/describe.mjs +1 -1
- package/dist/cli/commands/docs.mjs +2 -2
- package/dist/cli/commands/generate.d.mts +1 -1
- package/dist/cli/commands/generate.mjs +1 -1
- package/dist/cli/commands/init.d.mts +1 -1
- package/dist/cli/commands/init.mjs +1 -1
- package/dist/cli/commands/introspect.mjs +1 -1
- package/dist/cli/index.d.mts +2 -2
- package/dist/cli/index.mjs +2 -2
- package/dist/core/index.d.mts +2 -2
- package/dist/core/index.mjs +3 -3
- package/dist/{core-B41eZxyM.mjs → core-C88uIwd3.mjs} +161 -103
- package/dist/{createActionRouter-CRaIwB5S.mjs → createActionRouter-DGCCp-kP.mjs} +4 -2
- package/dist/{createAggregationRouter-n3O6WdLO.mjs → createAggregationRouter-Ca77b8iK.mjs} +3 -3
- package/dist/{createApp-DZvrb587.mjs → createApp-DLuUGVZQ.mjs} +11 -11
- package/dist/{defineEvent-NPKUJRt8.mjs → defineEvent-DC981g-o.mjs} +1 -1
- package/dist/docs/index.d.mts +2 -2
- package/dist/docs/index.mjs +2 -2
- package/dist/{elevation-6mfTLBC-.mjs → elevation-BzhyVWfn.mjs} +1 -1
- package/dist/{eventPlugin-Dxp9JlKK.mjs → eventPlugin-Bw4bUDEO.mjs} +2 -2
- package/dist/{eventPlugin-DjEx_J3j.d.mts → eventPlugin-C1W1CRbf.d.mts} +1 -1
- package/dist/events/index.d.mts +8 -5
- package/dist/events/index.mjs +26 -7
- package/dist/events/transports/redis-stream-entry.d.mts +1 -1
- package/dist/events/transports/redis-stream-entry.mjs +52 -5
- package/dist/events/transports/redis.d.mts +1 -1
- package/dist/factory/index.d.mts +1 -1
- package/dist/factory/index.mjs +3 -3
- package/dist/{fastify-augmentation-CL48B6gW.d.mts → fastify-augmentation-BdCl_eNo.d.mts} +2 -2
- package/dist/{fields-DqZLp5d6.d.mts → fields-CKLrhyOb.d.mts} +1 -1
- package/dist/{generate-CcM24hoq.mjs → generate-BaxDdmJ8.mjs} +1 -1
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/idempotency/index.d.mts +2 -2
- package/dist/idempotency/index.mjs +1 -1
- package/dist/idempotency/redis.d.mts +1 -1
- package/dist/{index-CNiryUMN.d.mts → index-Cvo1u9n6.d.mts} +3 -3
- package/dist/{index-C000faom.d.mts → index-QYma8mdC.d.mts} +215 -241
- package/dist/{index-3L-adFJO.d.mts → index-vcWUGkwf.d.mts} +3 -3
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +5 -5
- package/dist/{init-DQ_rY1J7.mjs → init-DSsdRfk9.mjs} +3 -3
- package/dist/integrations/event-gateway.d.mts +2 -2
- package/dist/integrations/event-gateway.mjs +1 -1
- package/dist/integrations/index.d.mts +2 -2
- package/dist/integrations/jobs.mjs +66 -1
- package/dist/integrations/mcp/index.d.mts +4 -4
- package/dist/integrations/mcp/index.mjs +1 -1
- package/dist/integrations/mcp/testing.d.mts +1 -1
- package/dist/integrations/mcp/testing.mjs +1 -1
- package/dist/integrations/streamline.d.mts +16 -1
- package/dist/integrations/streamline.mjs +33 -2
- package/dist/integrations/websocket-pushref-redis.d.mts +1 -1
- package/dist/integrations/websocket-redis.d.mts +1 -1
- package/dist/integrations/websocket.d.mts +2 -2
- package/dist/{loadResourcesFromEntry-DCjYMgfC.mjs → loadResourcesFromEntry-XHNeUWpu.mjs} +1 -1
- package/dist/{mcpPlugin-BrepZ0cV.mjs → mcpPlugin-CzKdt3B8.mjs} +9 -9
- package/dist/middleware/index.d.mts +1 -1
- package/dist/middleware/index.mjs +1 -1
- package/dist/{openapi-CLZx9bwS.mjs → openapi-ButnRyOM.mjs} +5 -5
- package/dist/permissions/index.d.mts +2 -2
- package/dist/permissions/index.mjs +2 -2
- package/dist/{permissions-B1Qy55fg.mjs → permissions-3uzwkbQt.mjs} +99 -99
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/pipeline/index.mjs +1 -1
- package/dist/pipeline-D4sqiokR.mjs +336 -0
- package/dist/plugins/index.d.mts +5 -5
- package/dist/plugins/index.mjs +9 -9
- package/dist/plugins/response-cache.mjs +1 -1
- package/dist/plugins/tracing-entry.d.mts +1 -1
- package/dist/plugins/tracing-entry.mjs +1 -1
- package/dist/presets/filesUpload.d.mts +4 -4
- package/dist/presets/filesUpload.mjs +2 -2
- package/dist/presets/index.d.mts +1 -1
- package/dist/presets/index.mjs +1 -1
- package/dist/presets/multiTenant.d.mts +1 -1
- package/dist/presets/search.d.mts +2 -2
- package/dist/presets/search.mjs +1 -1
- package/dist/{presets-BYbPobbF.mjs → presets-CF79RHEo.mjs} +1 -1
- package/dist/{queryCachePlugin-Do4P_WBC.d.mts → queryCachePlugin-Bd2tYgh5.d.mts} +2 -2
- package/dist/{queryCachePlugin-B4XMSSe7.mjs → queryCachePlugin-CnAeFqju.mjs} +3 -3
- package/dist/rateLimit-yKvxWAky.mjs +207 -0
- package/dist/{redis-cpqVb85w.d.mts → redis-3hqH_Qk_.d.mts} +1 -1
- package/dist/{redis-stream-BuiAS3aE.d.mts → redis-stream-BtEUtjxZ.d.mts} +5 -4
- package/dist/registerRoute-BEYn0ylk.mjs +108 -0
- package/dist/registry/index.d.mts +1 -1
- package/dist/registry/index.mjs +2 -2
- package/dist/{schemaIR-Bk6Tns82.mjs → schemaIR-CE6USIRi.mjs} +1 -1
- package/dist/scope/index.d.mts +2 -2
- package/dist/scope/index.mjs +2 -2
- package/dist/testing/index.d.mts +2 -2
- package/dist/testing/index.mjs +12 -2
- package/dist/testing/storageContract.d.mts +1 -1
- package/dist/types/index.d.mts +4 -4
- package/dist/types/storage.d.mts +1 -1
- package/dist/{types-DH-7WO64.d.mts → types-BWBcb88c.d.mts} +1 -1
- package/dist/{types-DEEWwQFR.d.mts → types-WVlAVp8T.d.mts} +10 -10
- package/dist/utils/index.d.mts +3 -3
- package/dist/utils/index.mjs +3 -3
- package/dist/{utils-BMQK8mRl.mjs → utils-xAQeDyU_.mjs} +1 -1
- package/dist/{validate-DFIP2VrM.mjs → validate-0__MuUsK.mjs} +201 -190
- package/dist/{versioning-5H4930tj.d.mts → versioning-BSEDGXKC.d.mts} +1 -1
- package/dist/{websocket-BZMUP7Gr.d.mts → websocket-BFBT5rH-.d.mts} +1 -1
- package/package.json +5 -5
- package/skills/arc/references/api-reference.md +1 -1
- package/dist/routerShared-Dl0A77Ba.mjs +0 -724
- /package/dist/{EventTransport-ClEDfiMS.mjs → EventTransport-7LPXLEUX.mjs} +0 -0
- /package/dist/{EventTransport-B1GFiYUy.d.mts → EventTransport-CaaXM5Y1.d.mts} +0 -0
- /package/dist/{HookSystem-Cmf7-Etp.mjs → HookSystem-BfCpWbwM.mjs} +0 -0
- /package/dist/{ResourceRegistry-CzSzVK1m.mjs → ResourceRegistry-CWmOggxS.mjs} +0 -0
- /package/dist/{actionPermissions-Bjmvn7Eb.mjs → actionPermissions-CX9QIMTd.mjs} +0 -0
- /package/dist/{caching-8MfrrUYU.mjs → caching-C0DdKiYB.mjs} +0 -0
- /package/dist/{elevation-DvwtjDwu.d.mts → elevation-DW90z5bT.d.mts} +0 -0
- /package/dist/{errorHandler-wQejMBT3.mjs → errorHandler-Bua97SEt.mjs} +0 -0
- /package/dist/{errorHandler-DuqTqeqn.d.mts → errorHandler-_Lp2k9M3.d.mts} +0 -0
- /package/dist/{errors-4ZloYFvm.d.mts → errors-DZOemeGa.d.mts} +0 -0
- /package/dist/{externalPaths-ClykOQqa.d.mts → externalPaths-DLle0R07.d.mts} +0 -0
- /package/dist/{generate-cRnsafMS.d.mts → generate-Dmk8cfvX.d.mts} +0 -0
- /package/dist/{init-D-vrTZ1G.d.mts → init-BS4Daqnv.d.mts} +0 -0
- /package/dist/{interface-DoE6UoC2.d.mts → interface-CsrGR8LF.d.mts} +0 -0
- /package/dist/{interface-BVkZsvEe.d.mts → interface-DL7LlWS5.d.mts} +0 -0
- /package/dist/{keys-DopsCuyQ.mjs → keys-B3yyBEyH.mjs} +0 -0
- /package/dist/{loadResources-fol6JuvW.mjs → loadResources-CwXt9MCh.mjs} +0 -0
- /package/dist/{memory-QOLe11D5.mjs → memory-TdTHCS9-.mjs} +0 -0
- /package/dist/{metrics-B-PU4-Yu.mjs → metrics-Da2EUPi9.mjs} +0 -0
- /package/dist/{multipartBody-VjVWmZl8.mjs → multipartBody-709YcXi1.mjs} +0 -0
- /package/dist/{pipe-DiCyvyPN.mjs → pipe-9Tl-OAus.mjs} +0 -0
- /package/dist/{pluralize-B9M8xvy-.mjs → pluralize-BxdUl2P4.mjs} +0 -0
- /package/dist/{preloadResources-BOXzPhKU.mjs → preloadResources-B-j-iqo-.mjs} +0 -0
- /package/dist/{pushref-registry-Bq_-EVsC.d.mts → pushref-registry-Dqclzjy7.d.mts} +0 -0
- /package/dist/{registry-BrlHkrRS.mjs → registry-Br15xdGM.mjs} +0 -0
- /package/dist/{replyHelpers-boS5Rx26.mjs → replyHelpers-DXHVxrrj.mjs} +0 -0
- /package/dist/{schemaConverter-De34B1ZG.mjs → schemaConverter-DatAaVNj.mjs} +0 -0
- /package/dist/{sessionManager-DlmaHUAl.d.mts → sessionManager-CyHpYXoB.d.mts} +0 -0
- /package/dist/{sse-jh5OqFjR.mjs → sse-Xq8UtuQx.mjs} +0 -0
- /package/dist/{storage-BFmamN5m.d.mts → storage-C5q8fuEt.d.mts} +0 -0
- /package/dist/{store-helpers-5JgaxieH.mjs → store-helpers-DjSYI2uP.mjs} +0 -0
- /package/dist/{tracing-BYQ3hsbM.d.mts → tracing-Bnb1-YVd.d.mts} +0 -0
- /package/dist/{typeGuards-BzkXkvVv.mjs → typeGuards-CcFZXgU7.mjs} +0 -0
- /package/dist/{types-CfapW2t8.d.mts → types-BJwJN2Pg.d.mts} +0 -0
- /package/dist/{types-DV9WDfeg.mjs → types-D57iXYb8.mjs} +0 -0
- /package/dist/{versioning-CuIwUQZ2.mjs → versioning-C0K8KQLx.mjs} +0 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { n as requestContext } from "./requestContext-DDLS3NVU.mjs";
|
|
2
|
+
//#region src/core/middlewares/arcDecorator.ts
|
|
3
|
+
/**
|
|
4
|
+
* Build the `arcDecorator` preHandler for a resource.
|
|
5
|
+
*
|
|
6
|
+
* The decorator is a closure over frozen metadata — allocated once per
|
|
7
|
+
* resource and shared across every request. Stamps `req.arc` with the
|
|
8
|
+
* resource's field permissions, hooks, events bus, and schema options
|
|
9
|
+
* so `sendControllerResponse`, `BaseController.run*`, and custom
|
|
10
|
+
* middleware can read a consistent view.
|
|
11
|
+
*
|
|
12
|
+
* Also populates `requestContext.resourceName` for async-context access
|
|
13
|
+
* in code paths that can't reach `req.arc` directly (e.g. detached logger
|
|
14
|
+
* formatters).
|
|
15
|
+
*/
|
|
16
|
+
function buildArcDecorator(meta) {
|
|
17
|
+
const frozen = Object.freeze({ ...meta });
|
|
18
|
+
return async (req, _reply) => {
|
|
19
|
+
req.arc = frozen;
|
|
20
|
+
const store = requestContext.get();
|
|
21
|
+
if (store) store.resourceName = frozen.resourceName;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/core/middlewares/auth.ts
|
|
26
|
+
/**
|
|
27
|
+
* A permission requires authentication unless it carries the `_isPublic`
|
|
28
|
+
* marker set by `allowPublic()`. Absence of a permission is treated as
|
|
29
|
+
* public (no auth) — matches historical CRUD behaviour.
|
|
30
|
+
*/
|
|
31
|
+
function requiresAuthentication(permission) {
|
|
32
|
+
if (!permission) return false;
|
|
33
|
+
return !permission._isPublic;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Pick the right Fastify auth decorator for a single-permission route:
|
|
37
|
+
* - protected route → `fastify.authenticate` (401 on missing token)
|
|
38
|
+
* - public route → `fastify.optionalAuthenticate` (parses token if present)
|
|
39
|
+
*
|
|
40
|
+
* Public routes still get optional auth so downstream multi-tenant filters
|
|
41
|
+
* can narrow queries when a Bearer token IS supplied.
|
|
42
|
+
*/
|
|
43
|
+
function buildAuthMiddleware(fastify, permission) {
|
|
44
|
+
if (requiresAuthentication(permission)) return fastify.authenticate ?? null;
|
|
45
|
+
return fastify.optionalAuthenticate ?? null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Pick the right auth decorator for a multi-permission route (Action router).
|
|
49
|
+
*
|
|
50
|
+
* The input is the array of resolved per-action permissions — one slot per
|
|
51
|
+
* action, in registration order, already flattened against `globalAuth`
|
|
52
|
+
* fallback by the caller (`actionPermissions[name] ?? globalAuth`). A slot
|
|
53
|
+
* may be `undefined` when the action has no per-action check AND no
|
|
54
|
+
* `globalAuth` fallback — that is "public by omission" and must be honored
|
|
55
|
+
* here the same way `buildActionPermissionMw` honors it (by skipping the
|
|
56
|
+
* permission evaluation entirely). If we filtered undefineds out at this
|
|
57
|
+
* layer, a mixed endpoint like `{ ping: undefined, promote: requireRoles(...) }`
|
|
58
|
+
* would collapse to "all protected" and 401 the public `ping` action at the
|
|
59
|
+
* auth layer before the permission prehandler could let it through.
|
|
60
|
+
*
|
|
61
|
+
* Rules:
|
|
62
|
+
* - ALL public (explicit allowPublic OR omission) → `optionalAuthenticate`
|
|
63
|
+
* - ALL protected → `authenticate` (fail-fast)
|
|
64
|
+
* - MIXED → `optionalAuthenticate`
|
|
65
|
+
* (parse token if present; per-action check fails-closed when user=null)
|
|
66
|
+
*
|
|
67
|
+
* The mixed case was previously handled by an in-handler
|
|
68
|
+
* `fastify.authenticate()` call that bypassed the preHandler chain; this
|
|
69
|
+
* helper moves that logic back into the preHandler stack so the request
|
|
70
|
+
* lifecycle is consistent across router types.
|
|
71
|
+
*/
|
|
72
|
+
function buildAuthMiddlewareForPermissions(fastify, permissions) {
|
|
73
|
+
if (permissions.length === 0) return fastify.optionalAuthenticate ?? null;
|
|
74
|
+
const hasProtected = permissions.some((p) => requiresAuthentication(p));
|
|
75
|
+
const hasPublic = permissions.some((p) => p && p._isPublic === true) || permissions.some((p) => !p);
|
|
76
|
+
if (hasProtected && !hasPublic) return fastify.authenticate ?? null;
|
|
77
|
+
return fastify.optionalAuthenticate ?? null;
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/core/middlewares/chain.ts
|
|
81
|
+
/**
|
|
82
|
+
* Compose preHandler[] in the canonical order. Every null/undefined entry is
|
|
83
|
+
* dropped. Keeps CRUD and Action routers from accidentally ordering the same
|
|
84
|
+
* ingredients differently (regression risk: cache before auth → user-scoped
|
|
85
|
+
* cache keys leak across users).
|
|
86
|
+
*
|
|
87
|
+
* Canonical order:
|
|
88
|
+
* preAuth → arcDecorator → authMw → permissionMw → pluginMw → routeGuards → customMws
|
|
89
|
+
*/
|
|
90
|
+
function buildPreHandlerChain(parts) {
|
|
91
|
+
return [
|
|
92
|
+
...parts.preAuth ?? [],
|
|
93
|
+
parts.arcDecorator,
|
|
94
|
+
parts.authMw ?? null,
|
|
95
|
+
parts.permissionMw ?? null,
|
|
96
|
+
parts.pluginMw ?? null,
|
|
97
|
+
...parts.routeGuards ?? [],
|
|
98
|
+
...parts.customMws ?? []
|
|
99
|
+
].filter(Boolean);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* `RouteDefinition.preHandler` accepts two shapes:
|
|
103
|
+
*
|
|
104
|
+
* 1. **Array form** — `RouteHandlerMethod[]`. Used directly.
|
|
105
|
+
* 2. **Factory form** — `(fastify) => RouteHandlerMethod[]`. Called once at
|
|
106
|
+
* route-registration time with the Fastify instance, so handlers can
|
|
107
|
+
* capture decorators (`fastify.authenticate`, `fastify.events`, etc.)
|
|
108
|
+
* that aren't on the request.
|
|
109
|
+
*
|
|
110
|
+
* The two forms are equally idiomatic, but the discrimination is by
|
|
111
|
+
* `typeof preHandler === "function"`. Single-function shapes such as
|
|
112
|
+
* `multipartBody({...})` (a `RouteHandlerMethod`) **structurally satisfy
|
|
113
|
+
* the factory branch** at the call site, then fail with a cryptic
|
|
114
|
+
* `Cannot read properties of undefined (reading 'content-type')` once the
|
|
115
|
+
* handler runs with `fastify` in the request slot.
|
|
116
|
+
*
|
|
117
|
+
* This resolver:
|
|
118
|
+
* 1. Distinguishes the two valid shapes.
|
|
119
|
+
* 2. Validates the factory's RETURN — must be an array of functions.
|
|
120
|
+
* 3. Throws an actionable error pointing at the route + the fix when
|
|
121
|
+
* a single `RouteHandlerMethod` was passed instead of an array, OR
|
|
122
|
+
* when a factory returned the wrong shape.
|
|
123
|
+
*
|
|
124
|
+
* The error message names the route (`{method} {path}`) and the
|
|
125
|
+
* canonical fix (`preHandler: [yourHandler]`) so the failure mode is
|
|
126
|
+
* obvious instead of debug-archaeology.
|
|
127
|
+
*
|
|
128
|
+
* @param preHandler The `route.preHandler` value (any of the valid shapes
|
|
129
|
+
* plus the common bare-handler mistake).
|
|
130
|
+
* @param fastify Passed to factory-form preHandlers.
|
|
131
|
+
* @param routeId `"GET /todos/:id/attach"` (or similar) — used in the
|
|
132
|
+
* error message so a multi-route file points at the
|
|
133
|
+
* actual offender.
|
|
134
|
+
*/
|
|
135
|
+
function resolveRoutePreHandlers(preHandler, fastify, routeId) {
|
|
136
|
+
if (preHandler === void 0 || preHandler === null) return [];
|
|
137
|
+
if (Array.isArray(preHandler)) return preHandler.filter((h) => typeof h === "function");
|
|
138
|
+
if (typeof preHandler === "function") {
|
|
139
|
+
let result;
|
|
140
|
+
try {
|
|
141
|
+
result = preHandler(fastify);
|
|
142
|
+
} catch (err) {
|
|
143
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
144
|
+
throw new TypeError(`Route ${routeId}: preHandler factory threw during route registration: ${msg}.\nIf you intended to pass a single handler (e.g. \`multipartBody({...})\`), wrap it in an array: \`preHandler: [yourHandler]\`. The factory form is \`(fastify) => RouteHandlerMethod[]\` — it must return an array.`, { cause: err instanceof Error ? err : void 0 });
|
|
145
|
+
}
|
|
146
|
+
if (result && typeof result.then === "function") result.catch(() => void 0);
|
|
147
|
+
if (!Array.isArray(result)) throw new TypeError(`Route ${routeId}: preHandler factory must return an array of handlers, got ${describeValue(result)}.\nCommon cause: passing a single \`RouteHandlerMethod\` (e.g. \`multipartBody({...})\`) where an array was expected. Wrap it: \`preHandler: [yourHandler]\`. The factory form \`(fastify) => RouteHandlerMethod[]\` is for cases that need the Fastify instance — e.g. \`(fastify) => [fastify.authenticate, myHandler]\`.`);
|
|
148
|
+
return result.filter((h) => typeof h === "function");
|
|
149
|
+
}
|
|
150
|
+
throw new TypeError(`Route ${routeId}: preHandler must be an array of handlers OR a factory \`(fastify) => RouteHandlerMethod[]\`. Got ${describeValue(preHandler)}.`);
|
|
151
|
+
}
|
|
152
|
+
function describeValue(v) {
|
|
153
|
+
if (v === null) return "null";
|
|
154
|
+
if (v === void 0) return "undefined";
|
|
155
|
+
if (typeof v === "function") return "a function (single handler — wrap in array)";
|
|
156
|
+
if (Array.isArray(v)) return `an array of length ${v.length}`;
|
|
157
|
+
return `${typeof v} (${JSON.stringify(v).slice(0, 80)})`;
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/core/middlewares/pluginMw.ts
|
|
161
|
+
/**
|
|
162
|
+
* Pick the request-lifecycle plugin middleware for an HTTP method:
|
|
163
|
+
* - GET / HEAD → response cache (if present)
|
|
164
|
+
* - POST / PUT / PATCH → idempotency (if present)
|
|
165
|
+
* - DELETE → none
|
|
166
|
+
*
|
|
167
|
+
* Either field may be `null` if the corresponding plugin wasn't registered.
|
|
168
|
+
*/
|
|
169
|
+
function selectPluginMw(method, mws) {
|
|
170
|
+
const upper = method.toUpperCase();
|
|
171
|
+
if (upper === "GET" || upper === "HEAD") return mws.cacheMw;
|
|
172
|
+
if (upper === "POST" || upper === "PUT" || upper === "PATCH") return mws.idempotencyMw;
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Resolve the default cache/idempotency middlewares for a resource.
|
|
177
|
+
*
|
|
178
|
+
* Skips response-cache when the resource has QueryCache active — QueryCache
|
|
179
|
+
* handles caching at the controller level with SWR, so the HTTP-level
|
|
180
|
+
* response-cache would double-cache.
|
|
181
|
+
*/
|
|
182
|
+
function resolveRouterPluginMw(fastify, resourceHasQueryCache) {
|
|
183
|
+
return {
|
|
184
|
+
cacheMw: !resourceHasQueryCache && fastify.hasDecorator("responseCache") ? fastify.responseCache.middleware : null,
|
|
185
|
+
idempotencyMw: fastify.hasDecorator("idempotency") ? fastify.idempotency.middleware : null
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/core/middlewares/rateLimit.ts
|
|
190
|
+
/**
|
|
191
|
+
* Build the `config` object for Fastify route options so
|
|
192
|
+
* @fastify/rate-limit picks up per-route overrides.
|
|
193
|
+
*
|
|
194
|
+
* - `undefined` → no override (inherits instance config)
|
|
195
|
+
* - `false` → explicitly disable rate limiting
|
|
196
|
+
* - `{ max, timeWindow }` → apply that limit
|
|
197
|
+
*/
|
|
198
|
+
function buildRateLimitConfig(rateLimit) {
|
|
199
|
+
if (rateLimit === void 0) return void 0;
|
|
200
|
+
if (rateLimit === false) return { rateLimit: false };
|
|
201
|
+
return { rateLimit: {
|
|
202
|
+
max: rateLimit.max,
|
|
203
|
+
timeWindow: rateLimit.timeWindow
|
|
204
|
+
} };
|
|
205
|
+
}
|
|
206
|
+
//#endregion
|
|
207
|
+
export { resolveRoutePreHandlers as a, buildArcDecorator as c, buildPreHandlerChain as i, resolveRouterPluginMw as n, buildAuthMiddleware as o, selectPluginMw as r, buildAuthMiddlewareForPermissions as s, buildRateLimitConfig as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as EventTransport, i as EventLogger, n as DomainEvent, r as EventHandler } from "./EventTransport-
|
|
1
|
+
import { a as EventTransport, i as EventLogger, n as DomainEvent, r as EventHandler } from "./EventTransport-CaaXM5Y1.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/events/transports/redis-stream.d.ts
|
|
4
4
|
interface RedisStreamLike {
|
|
@@ -161,9 +161,10 @@ declare class RedisStreamTransport implements EventTransport {
|
|
|
161
161
|
* Last-seen failure context per message id, populated when an in-process
|
|
162
162
|
* handler throws in {@link processEntry}. Consumed (and cleared) by
|
|
163
163
|
* {@link moveToDlq} so the dead-letter envelope carries the actual error
|
|
164
|
-
* message instead of opaque "reclaimed without context".
|
|
165
|
-
*
|
|
166
|
-
*
|
|
164
|
+
* message instead of opaque "reclaimed without context". Entries are
|
|
165
|
+
* deleted on ack and on DLQ write; messages resolved by ANOTHER consumer
|
|
166
|
+
* never drain locally, so the map is additionally hard-capped at
|
|
167
|
+
* {@link MAX_FAILURE_CONTEXT_ENTRIES} with oldest-first eviction.
|
|
167
168
|
*/
|
|
168
169
|
private failureContext;
|
|
169
170
|
/** One-shot guard so the "client lacks xrange" warning fires once per process. */
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { f as createError } from "./errors-j4aJm1Wg.mjs";
|
|
2
|
+
import { M as evaluateAndApplyPermission } from "./permissions-3uzwkbQt.mjs";
|
|
3
|
+
//#region src/core/middlewares/permissions.ts
|
|
4
|
+
/**
|
|
5
|
+
* Build a PermissionContext from a Fastify request. Extracted so the CRUD
|
|
6
|
+
* permission middleware and the dynamic action-permission check use the same
|
|
7
|
+
* field layout — divergence here silently broke policy filters for actions.
|
|
8
|
+
*/
|
|
9
|
+
function buildPermissionContext(req, opts) {
|
|
10
|
+
const reqWithExtras = req;
|
|
11
|
+
const params = req.params;
|
|
12
|
+
return {
|
|
13
|
+
user: reqWithExtras.user ?? null,
|
|
14
|
+
request: req,
|
|
15
|
+
resource: opts.resource,
|
|
16
|
+
action: opts.action,
|
|
17
|
+
resourceId: opts.resourceId ?? params?.id,
|
|
18
|
+
params,
|
|
19
|
+
data: opts.data ?? req.body
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Static per-route CRUD permission gate. The permission and action are known
|
|
24
|
+
* at route-registration time, so the gate is a plain preHandler.
|
|
25
|
+
*
|
|
26
|
+
* Actions use the dynamic counterpart `buildActionPermissionMw` — their
|
|
27
|
+
* permission is resolved from `body.action` at request time.
|
|
28
|
+
*/
|
|
29
|
+
function buildCrudPermissionMw(permissionCheck, resourceName, action) {
|
|
30
|
+
if (!permissionCheck) return null;
|
|
31
|
+
return async (req, reply) => {
|
|
32
|
+
await evaluateAndApplyPermission(permissionCheck, buildPermissionContext(req, {
|
|
33
|
+
resource: resourceName,
|
|
34
|
+
action
|
|
35
|
+
}), req, reply);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Dynamic per-action permission gate for the action router.
|
|
40
|
+
*
|
|
41
|
+
* Resolves the permission from `body.action` at request time and runs
|
|
42
|
+
* `evaluateAndApplyPermission` from the canonical `permissionMw` slot — so
|
|
43
|
+
* `_policyFilters` and `request.scope` are installed BEFORE `pluginMw`
|
|
44
|
+
* (idempotency) and `routeGuards` run. Previously this check lived inside
|
|
45
|
+
* the main action handler, which meant idempotency recorded unauthorized
|
|
46
|
+
* requests and route guards saw unfiltered scope — the very divergence
|
|
47
|
+
* routerShared exists to prevent.
|
|
48
|
+
*
|
|
49
|
+
* Also acts as a defensive fallback for invalid action names — the
|
|
50
|
+
* `oneOf` body schema normally rejects these at AJV validation, but
|
|
51
|
+
* hosts that disable schema validation still get a 400 here.
|
|
52
|
+
*/
|
|
53
|
+
function buildActionPermissionMw(actionEnum, actionPermissions, globalAuth, resourceName) {
|
|
54
|
+
const enumSet = new Set(actionEnum);
|
|
55
|
+
const validActions = [...actionEnum];
|
|
56
|
+
return async (req, reply) => {
|
|
57
|
+
const body = req.body ?? {};
|
|
58
|
+
const action = body.action;
|
|
59
|
+
if (!action || !enumSet.has(action)) throw createError(400, `Invalid action '${action ?? ""}'. Valid actions: ${validActions.join(", ")}`, { validActions });
|
|
60
|
+
const permissionCheck = actionPermissions[action] ?? globalAuth;
|
|
61
|
+
if (!permissionCheck) return;
|
|
62
|
+
const { action: _discard, ...data } = body;
|
|
63
|
+
const params = req.params;
|
|
64
|
+
await evaluateAndApplyPermission(permissionCheck, buildPermissionContext(req, {
|
|
65
|
+
resource: resourceName,
|
|
66
|
+
action,
|
|
67
|
+
resourceId: params?.id,
|
|
68
|
+
data
|
|
69
|
+
}), req, reply, { defaultDenialMessage: (user) => user ? `Permission denied for '${action}'` : "Authentication required" });
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/core/middlewares/registerRoute.ts
|
|
74
|
+
/**
|
|
75
|
+
* Register a route with friendly handling of `FST_ERR_DUPLICATED_ROUTE`.
|
|
76
|
+
*
|
|
77
|
+
* Boot-time `validateRouteCrudCollisions()` catches custom-route → auto-CRUD
|
|
78
|
+
* overlaps before Fastify ever runs, but a few cases still slip through to
|
|
79
|
+
* Fastify itself: two presets contributing the same `routes` entry, hosts
|
|
80
|
+
* mounting two resources at the same prefix, custom routes that share a
|
|
81
|
+
* URL with another plugin. Fastify's default message ("Method 'GET'
|
|
82
|
+
* already declared for route '/'") gives no hint at the resource-shaped
|
|
83
|
+
* fix — `disabledRoutes: ['list']` — so wrap it with one.
|
|
84
|
+
*/
|
|
85
|
+
function tryRegisterRoute(fastify, opts, context) {
|
|
86
|
+
try {
|
|
87
|
+
fastify.route(opts);
|
|
88
|
+
} catch (err) {
|
|
89
|
+
const fastifyErr = err;
|
|
90
|
+
if (fastifyErr?.code !== "FST_ERR_DUPLICATED_ROUTE") throw err;
|
|
91
|
+
const method = opts.method;
|
|
92
|
+
const url = opts.url;
|
|
93
|
+
const opHint = context.op ? ` (op: ${context.op})` : "";
|
|
94
|
+
const fixHint = context.op && [
|
|
95
|
+
"list",
|
|
96
|
+
"get",
|
|
97
|
+
"create",
|
|
98
|
+
"update",
|
|
99
|
+
"delete"
|
|
100
|
+
].includes(context.op) ? ` Suppress the auto-CRUD route with \`disabledRoutes: ['${context.op}']\`.` : " If a custom route in `routes:` collides with auto-CRUD, add `disabledRoutes: ['list' | 'get' | 'create' | 'update' | 'delete']` to `defineResource()` to suppress the matching auto-CRUD route.";
|
|
101
|
+
const enhanced = /* @__PURE__ */ new Error(`[arc] Duplicate route ${method} ${url} on resource "${context.resourceName}"${opHint}.${fixHint} Original: ${fastifyErr.message ?? "FST_ERR_DUPLICATED_ROUTE"}`);
|
|
102
|
+
enhanced.code = "FST_ERR_DUPLICATED_ROUTE";
|
|
103
|
+
enhanced.cause = err;
|
|
104
|
+
throw enhanced;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
export { buildActionPermissionMw as n, buildCrudPermissionMw as r, tryRegisterRoute as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as CrudRouteKey, R as RegisterOptions, V as ResourceDefinition, at as ResolvedTenantPurge, k as IntrospectionPluginOptions, p as RegistryEntry, z as ResourceRegistry } from "../index-
|
|
1
|
+
import { J as CrudRouteKey, R as RegisterOptions, V as ResourceDefinition, at as ResolvedTenantPurge, k as IntrospectionPluginOptions, p as RegistryEntry, z as ResourceRegistry } from "../index-QYma8mdC.mjs";
|
|
2
2
|
import { FastifyPluginAsync } from "fastify";
|
|
3
3
|
import { TenantPurgeProgress, TenantPurgeStrategy } from "@classytic/repo-core/repository";
|
|
4
4
|
|
package/dist/registry/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as cascadeDeleteForOrganization, c as assertNoTenantData, i as introspectionPlugin_default, n as buildResourceManifestFromRegistry, o as getCascadingResources, r as introspectionPlugin, s as getCascadingResourcesWithMetadata, t as buildResourceManifest } from "../registry-
|
|
2
|
-
import { t as ResourceRegistry } from "../ResourceRegistry-
|
|
1
|
+
import { a as cascadeDeleteForOrganization, c as assertNoTenantData, i as introspectionPlugin_default, n as buildResourceManifestFromRegistry, o as getCascadingResources, r as introspectionPlugin, s as getCascadingResourcesWithMetadata, t as buildResourceManifest } from "../registry-Br15xdGM.mjs";
|
|
2
|
+
import { t as ResourceRegistry } from "../ResourceRegistry-CWmOggxS.mjs";
|
|
3
3
|
export { ResourceRegistry, assertNoTenantData, buildResourceManifest, buildResourceManifestFromRegistry, cascadeDeleteForOrganization, getCascadingResources, getCascadingResourcesWithMetadata, introspectionPlugin_default as introspectionPlugin, introspectionPlugin as introspectionPluginFn };
|
package/dist/scope/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as isMember, D as requireOrgId, E as requireClientId, O as requireTeamId, S as isElevated, T as isService, _ as getTenantFromRequest, a as getAncestorOrgIds, b as hasOrgAccess, c as getMandate, d as getOrgRoles, f as getRequestScope, g as getTeamId, h as getServiceScopes, i as RequestScope, k as requireUserId, l as getOrgContext, m as getScopeContextMap, n as Mandate, o as getClientId, p as getScopeContext, r as PUBLIC_SCOPE, s as getDPoPJkt, t as AUTHENTICATED_SCOPE, u as getOrgId, v as getUserId, w as isOrgInScope, x as isAuthenticated, y as getUserRoles } from "../types-
|
|
2
|
-
import { i as elevationPlugin, n as ElevationOptions, r as _default, t as ElevationEvent } from "../elevation-
|
|
1
|
+
import { C as isMember, D as requireOrgId, E as requireClientId, O as requireTeamId, S as isElevated, T as isService, _ as getTenantFromRequest, a as getAncestorOrgIds, b as hasOrgAccess, c as getMandate, d as getOrgRoles, f as getRequestScope, g as getTeamId, h as getServiceScopes, i as RequestScope, k as requireUserId, l as getOrgContext, m as getScopeContextMap, n as Mandate, o as getClientId, p as getScopeContext, r as PUBLIC_SCOPE, s as getDPoPJkt, t as AUTHENTICATED_SCOPE, u as getOrgId, v as getUserId, w as isOrgInScope, x as isAuthenticated, y as getUserRoles } from "../types-BJwJN2Pg.mjs";
|
|
2
|
+
import { i as elevationPlugin, n as ElevationOptions, r as _default, t as ElevationEvent } from "../elevation-DW90z5bT.mjs";
|
|
3
3
|
import { FastifyReply, FastifyRequest } from "fastify";
|
|
4
4
|
|
|
5
5
|
//#region src/scope/rateLimitKey.d.ts
|
package/dist/scope/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as isService, D as requireUserId, E as requireTeamId, S as isOrgInScope, T as requireOrgId, _ as getUserRoles, a as getDPoPJkt, b as isElevated, c as getOrgId, d as getScopeContext, f as getScopeContextMap, g as getUserId, h as getTenantFromRequest, i as getClientId, l as getOrgRoles, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, r as getAncestorOrgIds, s as getOrgContext, t as AUTHENTICATED_SCOPE, u as getRequestScope, v as hasOrgAccess, w as requireClientId, x as isMember, y as isAuthenticated } from "../types-Bi0r0vjG.mjs";
|
|
2
|
-
import { n as normalizeRoles } from "../types-
|
|
3
|
-
import { n as elevation_default, t as elevationPlugin } from "../elevation-
|
|
2
|
+
import { n as normalizeRoles } from "../types-D57iXYb8.mjs";
|
|
3
|
+
import { n as elevation_default, t as elevationPlugin } from "../elevation-BzhyVWfn.mjs";
|
|
4
4
|
//#region src/scope/rateLimitKey.ts
|
|
5
5
|
function createTenantKeyGenerator(opts) {
|
|
6
6
|
if (opts?.strategy) return opts.strategy;
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Kt as AnyRecord, V as ResourceDefinition } from "../index-
|
|
2
|
-
import { d as preloadResourcesAsync, r as CreateAppOptions, u as preloadResources } from "../types-
|
|
1
|
+
import { Kt as AnyRecord, V as ResourceDefinition } from "../index-QYma8mdC.mjs";
|
|
2
|
+
import { d as preloadResourcesAsync, r as CreateAppOptions, u as preloadResources } from "../types-WVlAVp8T.mjs";
|
|
3
3
|
import { StorageContractSetup, StorageContractSetupResult, runStorageContract } from "./storageContract.mjs";
|
|
4
4
|
import { FastifyInstance, FastifyServerOptions } from "fastify";
|
|
5
5
|
import { Mock } from "vitest";
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as CRUD_OPERATIONS } from "../constants-TrJVIJl0.mjs";
|
|
2
|
-
import { n as preloadResourcesAsync, t as preloadResources } from "../preloadResources-
|
|
2
|
+
import { n as preloadResourcesAsync, t as preloadResources } from "../preloadResources-B-j-iqo-.mjs";
|
|
3
3
|
import { runStorageContract } from "./storageContract.mjs";
|
|
4
4
|
import Fastify from "fastify";
|
|
5
5
|
import { afterAll, describe, expect, it, vi } from "vitest";
|
|
@@ -821,6 +821,16 @@ function createMockRepository(overrides = {}) {
|
|
|
821
821
|
}),
|
|
822
822
|
claim: vi.fn().mockResolvedValue(null),
|
|
823
823
|
claimVersion: vi.fn().mockResolvedValue(null),
|
|
824
|
+
capabilities: {
|
|
825
|
+
transactions: false,
|
|
826
|
+
nestedTransactions: false,
|
|
827
|
+
upsert: false,
|
|
828
|
+
duplicateKeyError: false,
|
|
829
|
+
distinct: false,
|
|
830
|
+
aggregate: false,
|
|
831
|
+
getOrCreate: false,
|
|
832
|
+
countAndExists: false
|
|
833
|
+
},
|
|
824
834
|
getBySlug: vi.fn().mockResolvedValue(null),
|
|
825
835
|
getDeleted: vi.fn().mockResolvedValue([]),
|
|
826
836
|
restore: vi.fn().mockResolvedValue(null),
|
|
@@ -1036,7 +1046,7 @@ function pickDefaultAuth(authMode, callerAuth) {
|
|
|
1036
1046
|
};
|
|
1037
1047
|
}
|
|
1038
1048
|
async function createTestApp(options = {}) {
|
|
1039
|
-
const { createApp } = await import("../createApp-
|
|
1049
|
+
const { createApp } = await import("../createApp-DLuUGVZQ.mjs").then((n) => n.r);
|
|
1040
1050
|
const { resources = [], db = "in-memory", connectMongoose = false, authMode = "jwt", defaultOrgId, plugins, auth: callerAuth, ...appOptions } = options;
|
|
1041
1051
|
let dbHandle;
|
|
1042
1052
|
let dbUri;
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as OnTenantDeleteConfig, A as RequestIdOptions, Bt as AuthHelpers, C as RequestContext, D as HealthCheck, E as GracefulShutdownOptions, F as FastifyWithDecorators, G as ActionsMap, Gt as TokenPair, H as ActionDefinition, Ht as Authenticator, I as MiddlewareHandler, J as CrudRouteKey, Jt as ArcRequest, K as ArcFieldRule, Kt as AnyRecord, L as RequestWithExtras, M as EventsDecorator, N as FastifyRequestExtras, O as HealthOptions, P as FastifyWithAuth, Q as MiddlewareConfig, Qt as UserOrganization, S as QueryParserInterface, T as CrudRouterOptions, U as ActionEntry, Ut as AuthenticatorContext, Vt as AuthPluginOptions, W as ActionHandlerFn, Wt as JwtContext, X as EventDefinition, Xt as ObjectId, Y as CrudSchemas, Yt as JWTPayload, Z as FieldRule, Zt as UserLike, _ as ControllerQueryOptions, _t as FastifyHandler, a as InferAdapterDoc, at as ResolvedTenantPurge, b as ParsedQuery, bt as IRequestContext, c as TypedController,
|
|
2
|
-
import { i as RequestScope } from "../types-
|
|
3
|
-
import { c as PermissionCheck, d as UserBase, l as PermissionContext, u as PermissionResult } from "../fields-
|
|
4
|
-
import { n as ElevationOptions, t as ElevationEvent } from "../elevation-
|
|
1
|
+
import { $ as OnTenantDeleteConfig, A as RequestIdOptions, Bt as AuthHelpers, C as RequestContext, D as HealthCheck, E as GracefulShutdownOptions, F as FastifyWithDecorators, G as ActionsMap, Gt as TokenPair, H as ActionDefinition, Ht as Authenticator, I as MiddlewareHandler, J as CrudRouteKey, Jt as ArcRequest, K as ArcFieldRule, Kt as AnyRecord, L as RequestWithExtras, M as EventsDecorator, N as FastifyRequestExtras, O as HealthOptions, P as FastifyWithAuth, Pn as BaseControllerOptions, Q as MiddlewareConfig, Qt as UserOrganization, S as QueryParserInterface, T as CrudRouterOptions, U as ActionEntry, Ut as AuthenticatorContext, Vt as AuthPluginOptions, W as ActionHandlerFn, Wt as JwtContext, X as EventDefinition, Xt as ObjectId, Y as CrudSchemas, Yt as JWTPayload, Z as FieldRule, Zt as UserLike, _ as ControllerQueryOptions, _t as FastifyHandler, a as InferAdapterDoc, at as ResolvedTenantPurge, b as ParsedQuery, bt as IRequestContext, c as TypedController, ct as ResourceHookContext, d as PaginationResult, dt as RouteDefinition, et as OpenApiSchemas, f as IntrospectionData, ft as RouteMcpConfig, g as ArcInternalMetadata, gt as ControllerLike, h as ResourceMetadata, ht as ControllerHandler, i as ValidationResult, it as RateLimitConfig, j as ArcDecorator, k as IntrospectionPluginOptions, l as TypedRepository, lt as ResourceHooks, m as RegistryStats, mt as RouteSchemaOptions, n as ConfigError, nt as PresetHook, o as InferDocType, ot as ResourceCacheConfig, p as RegistryEntry, pt as RouteMethod, q as CrudController, qt as ApiResponse, r as ValidateOptions, rt as PresetResult, s as InferResourceDoc, st as ResourceConfig, t as RouteHandlerMethod, tt as PresetFunction, u as TypedResourceConfig, ut as ResourcePermissions, v as LookupOption, vt as IController, w as ServiceContext, x as PopulateOption, xt as RouteHandler, y as OwnershipCheck, yt as IControllerResponse } from "../index-QYma8mdC.mjs";
|
|
2
|
+
import { i as RequestScope } from "../types-BJwJN2Pg.mjs";
|
|
3
|
+
import { c as PermissionCheck, d as UserBase, l as PermissionContext, u as PermissionResult } from "../fields-CKLrhyOb.mjs";
|
|
4
|
+
import { n as ElevationOptions, t as ElevationEvent } from "../elevation-DW90z5bT.mjs";
|
|
5
5
|
export { ActionDefinition, ActionEntry, ActionHandlerFn, ActionsMap, AnyRecord, ApiResponse, ArcDecorator, ArcFieldRule, ArcInternalMetadata, ArcRequest, AuthHelpers, AuthPluginOptions, Authenticator, AuthenticatorContext, BaseControllerOptions, ConfigError, ControllerHandler, ControllerLike, ControllerQueryOptions, CrudController, CrudRouteKey, CrudRouterOptions, CrudSchemas, ElevationEvent, ElevationOptions, EventDefinition, EventsDecorator, FastifyHandler, FastifyRequestExtras, FastifyWithAuth, FastifyWithDecorators, FieldRule, GracefulShutdownOptions, HealthCheck, HealthOptions, IController, IControllerResponse, IRequestContext, InferAdapterDoc, InferDocType, InferResourceDoc, IntrospectionData, IntrospectionPluginOptions, JWTPayload, JwtContext, LookupOption, MiddlewareConfig, MiddlewareHandler, ObjectId, OnTenantDeleteConfig, OpenApiSchemas, OwnershipCheck, PaginationResult, ParsedQuery, PermissionCheck, PermissionContext, PermissionResult, PopulateOption, PresetFunction, PresetHook, PresetResult, QueryParserInterface, RateLimitConfig, RegistryEntry, RegistryStats, RequestContext, RequestIdOptions, RequestScope, RequestWithExtras, ResolvedTenantPurge, ResourceCacheConfig, ResourceConfig, ResourceHookContext, ResourceHooks, ResourceMetadata, ResourcePermissions, RouteDefinition, RouteHandler, RouteHandlerMethod, RouteMcpConfig, RouteMethod, RouteSchemaOptions, ServiceContext, TokenPair, TypedController, TypedRepository, TypedResourceConfig, UserBase, UserLike, UserOrganization, ValidateOptions, ValidationResult };
|
package/dist/types/storage.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as StorageReadResult, i as StorageReadRange, n as StorageContext, o as StorageUploadInput, r as StorageFile, t as Storage } from "../storage-
|
|
1
|
+
import { a as StorageReadResult, i as StorageReadRange, n as StorageContext, o as StorageUploadInput, r as StorageFile, t as Storage } from "../storage-C5q8fuEt.mjs";
|
|
2
2
|
export { Storage, StorageContext, StorageFile, StorageReadRange, StorageReadResult, StorageUploadInput };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as ElevationOptions } from "./elevation-
|
|
4
|
-
import { a as EventTransport } from "./EventTransport-
|
|
5
|
-
import { t as ExternalOpenApiPaths } from "./externalPaths-
|
|
6
|
-
import { r as QueryCachePluginOptions } from "./queryCachePlugin-
|
|
7
|
-
import { t as EventPluginOptions } from "./eventPlugin-
|
|
8
|
-
import { _ as HealthOptions, f as CachingOptions, l as SSEOptions, o as MetricsOptions, t as VersioningOptions } from "./versioning-
|
|
9
|
-
import { t as ErrorHandlerOptions } from "./errorHandler-
|
|
10
|
-
import { r as IdempotencyStore } from "./interface-
|
|
1
|
+
import { Ht as Authenticator } from "./index-QYma8mdC.mjs";
|
|
2
|
+
import { r as CacheStore } from "./interface-DL7LlWS5.mjs";
|
|
3
|
+
import { n as ElevationOptions } from "./elevation-DW90z5bT.mjs";
|
|
4
|
+
import { a as EventTransport } from "./EventTransport-CaaXM5Y1.mjs";
|
|
5
|
+
import { t as ExternalOpenApiPaths } from "./externalPaths-DLle0R07.mjs";
|
|
6
|
+
import { r as QueryCachePluginOptions } from "./queryCachePlugin-Bd2tYgh5.mjs";
|
|
7
|
+
import { t as EventPluginOptions } from "./eventPlugin-C1W1CRbf.mjs";
|
|
8
|
+
import { _ as HealthOptions, f as CachingOptions, l as SSEOptions, o as MetricsOptions, t as VersioningOptions } from "./versioning-BSEDGXKC.mjs";
|
|
9
|
+
import { t as ErrorHandlerOptions } from "./errorHandler-_Lp2k9M3.mjs";
|
|
10
|
+
import { r as IdempotencyStore } from "./interface-CsrGR8LF.mjs";
|
|
11
11
|
import { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest, FastifyServerOptions } from "fastify";
|
|
12
12
|
|
|
13
13
|
//#region src/factory/loadResources.d.ts
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Kt as AnyRecord, S as QueryParserInterface, Zt as UserLike, b as ParsedQuery, et as OpenApiSchemas, st as ResourceConfig } from "../index-
|
|
2
|
-
import { n as ErrorMapper } from "../errorHandler-
|
|
3
|
-
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-
|
|
1
|
+
import { Kt as AnyRecord, S as QueryParserInterface, Zt as UserLike, b as ParsedQuery, et as OpenApiSchemas, st as ResourceConfig } from "../index-QYma8mdC.mjs";
|
|
2
|
+
import { n as ErrorMapper } from "../errorHandler-_Lp2k9M3.mjs";
|
|
3
|
+
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-DZOemeGa.mjs";
|
|
4
4
|
import { errorContractSchema, errorDetailSchema } from "@classytic/repo-core/errors";
|
|
5
5
|
import { FastifyInstance, FastifyReply, FastifyRequest, RouteHandlerMethod } from "fastify";
|
|
6
6
|
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
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-j4aJm1Wg.mjs";
|
|
2
|
-
import { A as CircuitState, C as defineGuard, D as CircuitBreaker, E as withCompensation, F as validateResourceConfig, I as simpleEqualityMatcher, M as createCircuitBreakerRegistry, N as assertValidConfig, O as CircuitBreakerError, P as formatValidationErrors, S as handleRaw, T as defineCompensation, _ as paginationSchema, a as createStateMachine, b as ArcQueryParser, c as bareListResponse, d as errorDetailSchema, f as getDefaultCrudSchemas, g as offsetListResponse, h as listResponse, i as pipeUIMessageStreamToReply, j as createCircuitBreaker, k as CircuitBreakerRegistry, l as deleteResponse, m as keysetListResponse, n as UI_MESSAGE_STREAM_HEADERS, o as scheduleBackground, p as getListQueryParams, r as isReadableStream, s as aggregateListResponse, t as getUserId, u as errorContractSchema, v as queryParams, w as defineErrorMapper, x as createQueryParser, y as responses } from "../utils-
|
|
3
|
-
import { a as toJsonSchema, i as isZodSchema, n as convertRouteSchema, r as isJsonSchema, t as convertOpenApiSchemas } from "../schemaConverter-
|
|
4
|
-
import { t as hasEvents } from "../typeGuards-
|
|
2
|
+
import { A as CircuitState, C as defineGuard, D as CircuitBreaker, E as withCompensation, F as validateResourceConfig, I as simpleEqualityMatcher, M as createCircuitBreakerRegistry, N as assertValidConfig, O as CircuitBreakerError, P as formatValidationErrors, S as handleRaw, T as defineCompensation, _ as paginationSchema, a as createStateMachine, b as ArcQueryParser, c as bareListResponse, d as errorDetailSchema, f as getDefaultCrudSchemas, g as offsetListResponse, h as listResponse, i as pipeUIMessageStreamToReply, j as createCircuitBreaker, k as CircuitBreakerRegistry, l as deleteResponse, m as keysetListResponse, n as UI_MESSAGE_STREAM_HEADERS, o as scheduleBackground, p as getListQueryParams, r as isReadableStream, s as aggregateListResponse, t as getUserId, u as errorContractSchema, v as queryParams, w as defineErrorMapper, x as createQueryParser, y as responses } from "../utils-xAQeDyU_.mjs";
|
|
3
|
+
import { a as toJsonSchema, i as isZodSchema, n as convertRouteSchema, r as isJsonSchema, t as convertOpenApiSchemas } from "../schemaConverter-DatAaVNj.mjs";
|
|
4
|
+
import { t as hasEvents } from "../typeGuards-CcFZXgU7.mjs";
|
|
5
5
|
export { ArcError, ArcQueryParser, CircuitBreaker, CircuitBreakerError, CircuitBreakerRegistry, CircuitState, ConflictError, ForbiddenError, NotFoundError, OrgAccessDeniedError, OrgRequiredError, RateLimitError, ServiceUnavailableError, UI_MESSAGE_STREAM_HEADERS, UnauthorizedError, ValidationError, aggregateListResponse, assertValidConfig, bareListResponse, convertOpenApiSchemas, convertRouteSchema, createCircuitBreaker, createCircuitBreakerRegistry, createDomainError, createError, createQueryParser, createStateMachine, defineCompensation, defineErrorMapper, defineGuard, deleteResponse, errorContractSchema, errorDetailSchema, formatValidationErrors, getDefaultCrudSchemas, getListQueryParams, getUserId, handleRaw, hasEvents, isArcError, isJsonSchema, isReadableStream, isZodSchema, keysetListResponse, listResponse, offsetListResponse, paginationSchema, pipeUIMessageStreamToReply, queryParams, responses, scheduleBackground, simpleEqualityMatcher, toJsonSchema, validateResourceConfig, withCompensation };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { m as RESERVED_QUERY_PARAMS, t as CRUD_OPERATIONS } from "./constants-TrJVIJl0.mjs";
|
|
2
2
|
import { arcLog } from "./logger/index.mjs";
|
|
3
3
|
import { t as ArcError } from "./errors-j4aJm1Wg.mjs";
|
|
4
|
-
import { r as getAvailablePresets } from "./presets-
|
|
4
|
+
import { r as getAvailablePresets } from "./presets-CF79RHEo.mjs";
|
|
5
5
|
import { errorContractSchema as errorContractSchema$1, errorDetailSchema as errorDetailSchema$1 } from "@classytic/repo-core/errors";
|
|
6
6
|
import { Readable } from "node:stream";
|
|
7
7
|
//#region src/utils/simpleEqualityMatcher.ts
|