@classytic/arc 2.15.4 → 2.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/bin/arc.js +12 -0
- package/dist/{BaseController-dx3m2J8V.mjs → BaseController-Vk8I7C0x.mjs} +61 -19
- package/dist/{HookSystem-Iiebom92.mjs → HookSystem-Cmf7-Etp.mjs} +8 -4
- package/dist/{QueryCache-D41bfdBB.d.mts → QueryCache-8YmAQ-zW.d.mts} +1 -1
- package/dist/{ResourceRegistry-CTERg_2x.mjs → ResourceRegistry-CzSzVK1m.mjs} +55 -9
- package/dist/audit/index.d.mts +1 -1
- package/dist/audit/index.mjs +4 -2
- 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--M_i87dQ.mjs → betterAuthOpenApi-ClWxaceA.mjs} +10 -6
- package/dist/buildHandler-C_SkBNF3.mjs +302 -0
- package/dist/cache/index.d.mts +3 -3
- package/dist/cache/index.mjs +3 -3
- package/dist/{caching-SM8gghN6.mjs → caching-8MfrrUYU.mjs} +1 -1
- package/dist/cli/commands/describe.d.mts +35 -1
- package/dist/cli/commands/describe.mjs +52 -12
- package/dist/cli/commands/docs.d.mts +1 -4
- package/dist/cli/commands/docs.mjs +4 -16
- package/dist/cli/commands/generate.d.mts +2 -20
- package/dist/cli/commands/generate.mjs +1 -546
- package/dist/cli/commands/init.d.mts +2 -40
- package/dist/cli/commands/init.mjs +1 -3045
- package/dist/cli/commands/introspect.mjs +53 -64
- package/dist/cli/index.d.mts +2 -2
- package/dist/cli/index.mjs +2 -2
- package/dist/{constants-Cxde4rpC.mjs → constants-TrJVIJl0.mjs} +7 -0
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.mjs +5 -5
- package/dist/{core-CvmOqEms.mjs → core-wKeGXn38.mjs} +222 -44
- package/dist/createActionRouter-eiOFtnC3.mjs +288 -0
- package/dist/{createAggregationRouter-B0bPDf5b.mjs → createAggregationRouter-C4unhBnV.mjs} +3 -2
- package/dist/{createApp-PFegs47-.mjs → createApp-DdPBtmzp.mjs} +16 -14
- package/dist/{defineEvent-D5h7EvAx.mjs → defineEvent-NPKUJRt8.mjs} +1 -1
- package/dist/docs/index.d.mts +2 -2
- package/dist/docs/index.mjs +1 -1
- package/dist/{errorHandler-Bk-AGhkU.mjs → errorHandler-DNPzqaTT.mjs} +17 -14
- package/dist/errors-4ZloYFvm.d.mts +91 -0
- package/dist/{eventPlugin-CaKTYkYM.mjs → eventPlugin-CnJCUyM0.mjs} +1 -1
- package/dist/{eventPlugin-qXpqTebY.d.mts → eventPlugin-DjEx_J3j.d.mts} +1 -1
- package/dist/events/index.d.mts +3 -3
- package/dist/events/index.mjs +5 -5
- package/dist/events/transports/redis-stream-entry.d.mts +1 -1
- package/dist/events/transports/redis.d.mts +1 -1
- package/dist/factory/index.d.mts +2 -2
- package/dist/factory/index.mjs +4 -3
- package/dist/fastify-augmentation-CJm0vh-l.d.mts +42 -0
- package/dist/{fields-COhcH3fk.d.mts → fields-DqZLp5d6.d.mts} +1 -1
- package/dist/generate-CcM24hoq.mjs +654 -0
- package/dist/generate-cRnsafMS.d.mts +38 -0
- 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-BTqLEvhu.d.mts → index-3L-adFJO.d.mts} +12 -12
- package/dist/{index-BstGxcc3.d.mts → index-CC_pgZjY.d.mts} +88 -17
- package/dist/{index-BswOSJCE.d.mts → index-DBDgy6Hw.d.mts} +430 -19
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +7 -8
- package/dist/init-D-vrTZ1G.d.mts +71 -0
- package/dist/init-DYzfniuX.mjs +3098 -0
- 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 +3 -3
- package/dist/integrations/mcp/index.d.mts +239 -7
- package/dist/integrations/mcp/index.mjs +2 -528
- package/dist/integrations/mcp/testing.d.mts +2 -2
- package/dist/integrations/mcp/testing.mjs +6 -10
- package/dist/integrations/streamline.mjs +26 -1
- package/dist/integrations/websocket-redis.d.mts +1 -1
- package/dist/integrations/websocket.d.mts +1 -1
- package/dist/integrations/websocket.mjs +1 -0
- package/dist/loadResourcesFromEntry-DCjYMgfC.mjs +51 -0
- package/dist/{resourceToTools-tFYUNmM0.mjs → mcpPlugin-Dbgz9_Rj.mjs} +1021 -318
- package/dist/{memory-UBydS5ku.mjs → memory-QOLe11D5.mjs} +2 -0
- package/dist/middleware/index.d.mts +1 -1
- package/dist/middleware/index.mjs +1 -1
- package/dist/{openapi-BHXhoX8O.mjs → openapi-BRnd3pT7.mjs} +82 -44
- package/dist/permissions/index.d.mts +2 -2
- package/dist/permissions/index.mjs +1 -1
- package/dist/{permissions-ohQyv50e.mjs → permissions-CTxMrreC.mjs} +2 -2
- package/dist/{pipe-Zr0KXjQe.mjs → pipe-DiCyvyPN.mjs} +1 -0
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/pipeline/index.mjs +1 -1
- package/dist/plugins/index.d.mts +5 -59
- package/dist/plugins/index.mjs +10 -10
- package/dist/plugins/response-cache.mjs +5 -5
- package/dist/plugins/tracing-entry.d.mts +1 -1
- package/dist/plugins/tracing-entry.mjs +1 -1
- package/dist/{pluralize-DQgqgifU.mjs → pluralize-B9M8xvy-.mjs} +2 -1
- package/dist/preloadResources-BOXzPhKU.mjs +45 -0
- 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/multiTenant.mjs +4 -3
- package/dist/presets/search.d.mts +2 -2
- package/dist/presets/search.mjs +1 -1
- package/dist/{presets-BbkjdPeH.mjs → presets-C9BE6WaZ.mjs} +2 -2
- package/dist/{queryCachePlugin-m1XsgAIJ.mjs → queryCachePlugin-B4XMSSe7.mjs} +2 -2
- package/dist/{queryCachePlugin-CqMdLI2-.d.mts → queryCachePlugin-Do4P_WBC.d.mts} +2 -2
- package/dist/{redis-DiMkdHEl.d.mts → redis-cpqVb85w.d.mts} +1 -1
- package/dist/{redis-stream-D6HzR1Z_.d.mts → redis-stream-BuiAS3aE.d.mts} +1 -1
- package/dist/registry/index.d.mts +341 -2
- package/dist/registry/index.mjs +3 -3
- package/dist/registry-BrlHkrRS.mjs +582 -0
- package/dist/{routerShared-DrOa-26E.mjs → routerShared-ClV4cCaa.mjs} +40 -16
- package/dist/scope/index.d.mts +3 -3
- package/dist/scope/index.mjs +3 -3
- package/dist/{sse-Bz-5ZeTt.mjs → sse-jh5OqFjR.mjs} +1 -1
- package/dist/testing/index.d.mts +2 -25
- package/dist/testing/index.mjs +17 -51
- package/dist/testing/storageContract.d.mts +1 -1
- package/dist/types/index.d.mts +5 -5
- package/dist/types/storage.d.mts +1 -1
- package/dist/{types-BQsjgQzS.d.mts → types-BD0BCdf6.d.mts} +106 -12
- package/dist/{types-C_s5moIu.mjs → types-Bi0r0vjG.mjs} +53 -1
- package/dist/{types-CTYvcwHe.d.mts → types-CfapW2t8.d.mts} +42 -1
- package/dist/{types-DrBaUwyV.d.mts → types-Dw--SyTq.d.mts} +57 -11
- package/dist/utils/index.d.mts +1287 -2
- package/dist/utils/index.mjs +1 -1
- package/dist/{utils-_h9B3c57.mjs → utils-DPXZnZUx.mjs} +158 -41
- package/dist/{buildHandler-CcFOpJLh.mjs → validate-DFIP2VrM.mjs} +73 -302
- package/dist/{versioning-hmkPcDlX.d.mts → versioning-5H4930tj.d.mts} +1 -1
- package/package.json +22 -29
- package/skills/arc/SKILL.md +300 -706
- package/skills/arc/references/auth.md +19 -7
- package/skills/arc-code-review/SKILL.md +1 -1
- package/skills/arc-code-review/references/arc-cheatsheet.md +100 -322
- package/dist/createActionRouter-S3MLVYot.mjs +0 -220
- package/dist/index-bRjYu21O.d.mts +0 -1320
- package/dist/org/index.d.mts +0 -66
- package/dist/org/index.mjs +0 -486
- package/dist/org/types.d.mts +0 -82
- package/dist/org/types.mjs +0 -1
- package/dist/registry-I-ogLgL9.mjs +0 -46
- /package/dist/{EventTransport-CT_52aWU.d.mts → EventTransport-B1GFiYUy.d.mts} +0 -0
- /package/dist/{EventTransport-DLWoUMHy.mjs → EventTransport-ClEDfiMS.mjs} +0 -0
- /package/dist/{actionPermissions-CyUkQu6O.mjs → actionPermissions-Bjmvn7Eb.mjs} +0 -0
- /package/dist/{elevation-DgoeTyfX.mjs → elevation-Dci0AYLT.mjs} +0 -0
- /package/dist/{elevation-BXOWoGCF.d.mts → elevation-DvwtjDwu.d.mts} +0 -0
- /package/dist/{errorHandler-DFr45ZG4.d.mts → errorHandler-DuqTqeqn.d.mts} +0 -0
- /package/dist/{externalPaths-BD5nw6St.d.mts → externalPaths-ClykOQqa.d.mts} +0 -0
- /package/dist/{interface-beEtJyWM.d.mts → interface-BVkZsvEe.d.mts} +0 -0
- /package/dist/{interface-DfLGcus7.d.mts → interface-DoE6UoC2.d.mts} +0 -0
- /package/dist/{keys-CGcCbNyu.mjs → keys-DopsCuyQ.mjs} +0 -0
- /package/dist/{loadResources-DBMQg_Aj.mjs → loadResources-fol6JuvW.mjs} +0 -0
- /package/dist/{metrics-Qnvwc-LQ.mjs → metrics-B-PU4-Yu.mjs} +0 -0
- /package/dist/{replyHelpers-CK-FNO8E.mjs → replyHelpers-boS5Rx26.mjs} +0 -0
- /package/dist/{schemaIR-lYhC2gE5.mjs → schemaIR-DAOvBWgT.mjs} +0 -0
- /package/dist/{sessionManager-C4Le_UB3.d.mts → sessionManager-DlmaHUAl.d.mts} +0 -0
- /package/dist/{storage-Dfzt4VTl.d.mts → storage-HcAgP5Ni.d.mts} +0 -0
- /package/dist/{store-helpers-BkIN9-vu.mjs → store-helpers-5JgaxieH.mjs} +0 -0
- /package/dist/{tracing-QJVprktp.d.mts → tracing-bRqqUxFO.d.mts} +0 -0
- /package/dist/{versioning-BUrT5aP4.mjs → versioning-CuIwUQZ2.mjs} +0 -0
- /package/dist/{websocket-ChC2rqe1.d.mts → websocket-BJ0w-3Dt.d.mts} +0 -0
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { An as
|
|
1
|
+
import { An as HookSystem, Dn as HookOperation, En as HookHandler, Fn as beforeCreate, In as beforeDelete, Ln as beforeUpdate, Mn as afterCreate, Nn as afterDelete, On as HookPhase, Pn as afterUpdate, Rn as createHookSystem, Tn as HookContext, jn as HookSystemOptions, kn as HookRegistration, wn as DefineHookOptions, zn as defineHook } from "../index-DBDgy6Hw.mjs";
|
|
2
2
|
export { type DefineHookOptions, type HookContext, type HookHandler, type HookOperation, type HookPhase, type HookRegistration, HookSystem, type HookSystemOptions, afterCreate, afterDelete, afterUpdate, beforeCreate, beforeDelete, beforeUpdate, createHookSystem, defineHook };
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as beforeCreate, c as createHookSystem, i as afterUpdate, l as defineHook, n as afterCreate, o as beforeDelete, r as afterDelete, s as beforeUpdate, t as HookSystem } from "../HookSystem-
|
|
1
|
+
import { a as beforeCreate, c as createHookSystem, i as afterUpdate, l as defineHook, n as afterCreate, o as beforeDelete, r as afterDelete, s as beforeUpdate, t as HookSystem } from "../HookSystem-Cmf7-Etp.mjs";
|
|
2
2
|
export { HookSystem, afterCreate, afterDelete, afterUpdate, beforeCreate, beforeDelete, beforeUpdate, createHookSystem, defineHook };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as createIdempotencyResult, n as IdempotencyResult, r as IdempotencyStore, t as IdempotencyLock } from "../interface-
|
|
2
|
-
import { i as RedisIdempotencyStoreOptions, n as RedisClient } from "../redis-
|
|
1
|
+
import { i as createIdempotencyResult, n as IdempotencyResult, r as IdempotencyStore, t as IdempotencyLock } from "../interface-DoE6UoC2.mjs";
|
|
2
|
+
import { i as RedisIdempotencyStoreOptions, n as RedisClient } from "../redis-cpqVb85w.mjs";
|
|
3
3
|
import { FastifyPluginAsync } from "fastify";
|
|
4
4
|
import { RepositoryLike } from "@classytic/repo-core/adapter";
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "../store-helpers-
|
|
1
|
+
import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "../store-helpers-5JgaxieH.mjs";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import fp from "fastify-plugin";
|
|
4
4
|
import { and, eq, exists, gt, lt, or, startsWith } from "@classytic/repo-core/filter";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as UpstashRedisLike, i as RedisIdempotencyStoreOptions, n as RedisClient, o as ioredisAsIdempotencyClient, r as RedisIdempotencyStore, s as upstashAsIdempotencyClient, t as IoredisLike } from "../redis-
|
|
1
|
+
import { a as UpstashRedisLike, i as RedisIdempotencyStoreOptions, n as RedisClient, o as ioredisAsIdempotencyClient, r as RedisIdempotencyStore, s as upstashAsIdempotencyClient, t as IoredisLike } from "../redis-cpqVb85w.mjs";
|
|
2
2
|
export { type IoredisLike, type RedisClient, RedisIdempotencyStore, type RedisIdempotencyStoreOptions, type UpstashRedisLike, ioredisAsIdempotencyClient, upstashAsIdempotencyClient };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as CacheStore, t as CacheLogger } from "./interface-
|
|
2
|
-
import { i as RequestScope, n as Mandate } from "./types-
|
|
3
|
-
import { c as PermissionCheck, l as PermissionContext, u as PermissionResult } from "./fields-
|
|
1
|
+
import { r as CacheStore, t as CacheLogger } from "./interface-BVkZsvEe.mjs";
|
|
2
|
+
import { i as RequestScope, n as Mandate } from "./types-CfapW2t8.mjs";
|
|
3
|
+
import { c as PermissionCheck, l as PermissionContext, u as PermissionResult } from "./fields-DqZLp5d6.mjs";
|
|
4
4
|
import { FastifyReply, FastifyRequest } from "fastify";
|
|
5
5
|
|
|
6
6
|
//#region src/permissions/agent.d.ts
|
|
@@ -625,33 +625,33 @@ declare namespace presets_d_exports {
|
|
|
625
625
|
/**
|
|
626
626
|
* ResourcePermissions shape — matches the type in types/index.ts
|
|
627
627
|
*/
|
|
628
|
-
interface ResourcePermissions<TDoc =
|
|
628
|
+
interface ResourcePermissions<TDoc = Record<string, unknown>> {
|
|
629
629
|
list?: PermissionCheck<TDoc>;
|
|
630
630
|
get?: PermissionCheck<TDoc>;
|
|
631
631
|
create?: PermissionCheck<TDoc>;
|
|
632
632
|
update?: PermissionCheck<TDoc>;
|
|
633
633
|
delete?: PermissionCheck<TDoc>;
|
|
634
634
|
}
|
|
635
|
-
type PermissionOverrides<TDoc =
|
|
635
|
+
type PermissionOverrides<TDoc = Record<string, unknown>> = Partial<ResourcePermissions<TDoc>>;
|
|
636
636
|
/**
|
|
637
637
|
* Public read, authenticated write.
|
|
638
638
|
* list + get = allowPublic(), create + update + delete = requireAuth()
|
|
639
639
|
*/
|
|
640
|
-
declare function publicRead<TDoc =
|
|
640
|
+
declare function publicRead<TDoc = Record<string, unknown>>(overrides?: PermissionOverrides<TDoc>): ResourcePermissions<TDoc>;
|
|
641
641
|
/**
|
|
642
642
|
* Public read, admin write.
|
|
643
643
|
* list + get = allowPublic(), create + update + delete = requireRoles(['admin'])
|
|
644
644
|
*/
|
|
645
|
-
declare function publicReadAdminWrite<TDoc =
|
|
645
|
+
declare function publicReadAdminWrite<TDoc = Record<string, unknown>>(roles?: readonly string[], overrides?: PermissionOverrides<TDoc>): ResourcePermissions<TDoc>;
|
|
646
646
|
/**
|
|
647
647
|
* All operations require authentication.
|
|
648
648
|
*/
|
|
649
|
-
declare function authenticated<TDoc =
|
|
649
|
+
declare function authenticated<TDoc = Record<string, unknown>>(overrides?: PermissionOverrides<TDoc>): ResourcePermissions<TDoc>;
|
|
650
650
|
/**
|
|
651
651
|
* All operations require specific roles.
|
|
652
652
|
* @param roles - Required roles (user needs at least one). Default: ['admin']
|
|
653
653
|
*/
|
|
654
|
-
declare function adminOnly<TDoc =
|
|
654
|
+
declare function adminOnly<TDoc = Record<string, unknown>>(roles?: readonly string[], overrides?: PermissionOverrides<TDoc>): ResourcePermissions<TDoc>;
|
|
655
655
|
/**
|
|
656
656
|
* Owner-scoped with admin bypass.
|
|
657
657
|
* list = auth (scoped to owner), get = auth, create = auth,
|
|
@@ -660,16 +660,16 @@ declare function adminOnly<TDoc = any>(roles?: readonly string[], overrides?: Pe
|
|
|
660
660
|
* @param ownerField - Field containing owner ID (default: 'userId')
|
|
661
661
|
* @param bypassRoles - Roles that bypass ownership check (default: ['admin'])
|
|
662
662
|
*/
|
|
663
|
-
declare function ownerWithAdminBypass<TDoc =
|
|
663
|
+
declare function ownerWithAdminBypass<TDoc = Record<string, unknown>>(ownerField?: Extract<keyof TDoc, string> | string, bypassRoles?: readonly string[], overrides?: PermissionOverrides<TDoc>): ResourcePermissions<TDoc>;
|
|
664
664
|
/**
|
|
665
665
|
* Full public access — no auth required for any operation.
|
|
666
666
|
* Use sparingly (dev/testing, truly public APIs).
|
|
667
667
|
*/
|
|
668
|
-
declare function fullPublic<TDoc =
|
|
668
|
+
declare function fullPublic<TDoc = Record<string, unknown>>(overrides?: PermissionOverrides<TDoc>): ResourcePermissions<TDoc>;
|
|
669
669
|
/**
|
|
670
670
|
* Read-only: list + get authenticated, write operations denied.
|
|
671
671
|
* Useful for computed/derived resources.
|
|
672
672
|
*/
|
|
673
|
-
declare function readOnly<TDoc =
|
|
673
|
+
declare function readOnly<TDoc = Record<string, unknown>>(overrides?: PermissionOverrides<TDoc>): ResourcePermissions<TDoc>;
|
|
674
674
|
//#endregion
|
|
675
675
|
export { requireRoles as A, allOf as C, not as D, denyAll as E, RequireAgentScopeOptions as F, RequireMandateOptions as I, requireAgentScope as L, when as M, applyPermissionResult as N, requireAuth as O, normalizePermissionResult as P, requireDPoP as R, createOrgPermissions as S, anyOf as T, ConnectEventsOptions as _, presets_d_exports as a, PermissionEventBus as b, readOnly as c, requireOrgRole as d, requireScopeContext as f, createRoleHierarchy as g, RoleHierarchy as h, ownerWithAdminBypass as i, roles as j, requireOwnership as k, requireOrgInScope as l, requireTeamMembership as m, authenticated as n, publicRead as o, requireServiceScope as p, fullPublic as r, publicReadAdminWrite as s, adminOnly as t, requireOrgMembership as u, DynamicPermissionMatrix as v, allowPublic as w, createDynamicPermissionMatrix as x, DynamicPermissionMatrixConfig as y, requireMandate as z };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { C as RequestContext,
|
|
2
|
-
import { i as RequestScope } from "./types-
|
|
3
|
-
import { c as PermissionCheck } from "./fields-
|
|
1
|
+
import { C as RequestContext, F as FastifyWithDecorators, H as ActionDefinition, K as ArcFieldRule, Kt as AnyRecord, L as RequestWithExtras, T as CrudRouterOptions, Tt as AggregationConfig, V as ResourceDefinition, bt as IRequestContext, ft as RouteMcpConfig, mt as RouteSchemaOptions, q as CrudController, st as ResourceConfig, vt as IController, yt as IControllerResponse } from "./index-DBDgy6Hw.mjs";
|
|
2
|
+
import { i as RequestScope } from "./types-CfapW2t8.mjs";
|
|
3
|
+
import { c as PermissionCheck } from "./fields-DqZLp5d6.mjs";
|
|
4
4
|
import { FastifyReply, FastifyRequest, RouteHandlerMethod } from "fastify";
|
|
5
|
+
import { z } from "zod";
|
|
5
6
|
import { AggDateBucket, AggMeasure, AggTopN } from "@classytic/repo-core/repository";
|
|
6
7
|
import { LookupSpec } from "@classytic/repo-core/lookup";
|
|
7
8
|
|
|
@@ -51,6 +52,12 @@ declare const MAX_FILTER_DEPTH: 10;
|
|
|
51
52
|
/**
|
|
52
53
|
* Query parameters consumed by the framework — never treated as filters.
|
|
53
54
|
* Shared by all query parsers (Arc built-in, Prisma, custom).
|
|
55
|
+
*
|
|
56
|
+
* `filter` is reserved so the bracket-wrapped form
|
|
57
|
+
* (`?filter[foo.bar]=X` / `?filter[price][gte]=40`) lands as the parser's
|
|
58
|
+
* canonical filter envelope instead of being attempted as a flat field
|
|
59
|
+
* filter. See `ArcQueryParser.parseFilters()` for the unwrap step that
|
|
60
|
+
* merges `q.filter[*]` back into the top-level filter map.
|
|
54
61
|
*/
|
|
55
62
|
declare const RESERVED_QUERY_PARAMS: Readonly<Set<string>>;
|
|
56
63
|
//#endregion
|
|
@@ -116,6 +123,50 @@ declare function createCrudRouter<TDoc = unknown>(fastify: FastifyWithDecorators
|
|
|
116
123
|
*/
|
|
117
124
|
declare function createPermissionMiddleware(permission: PermissionCheck, resourceName: string, action: string): RouteHandlerMethod | null;
|
|
118
125
|
//#endregion
|
|
126
|
+
//#region src/core/defineAction.d.ts
|
|
127
|
+
/**
|
|
128
|
+
* Config for `defineAction()`. `TSchema` is the literal Zod schema type
|
|
129
|
+
* captured from the call site; `TData` is its `z.infer` projection.
|
|
130
|
+
* Plain JSON-Schema entries skip the inference path entirely (they go
|
|
131
|
+
* through the untyped `ActionDefinition` form).
|
|
132
|
+
*/
|
|
133
|
+
interface DefineActionConfig<TSchema extends z.ZodTypeAny | undefined = undefined, TData = (TSchema extends z.ZodTypeAny ? z.infer<TSchema> : Record<string, unknown>)> {
|
|
134
|
+
/** Per-action body schema (Zod v4). Drives both AJV validation and the typed `data` param. */
|
|
135
|
+
schema?: TSchema;
|
|
136
|
+
/** Per-action permission gate. Falls back to resource-level if omitted. */
|
|
137
|
+
permissions?: PermissionCheck;
|
|
138
|
+
/** OpenAPI / MCP description. */
|
|
139
|
+
description?: string;
|
|
140
|
+
/**
|
|
141
|
+
* Mount point — `true` (default) for `POST /<prefix>/:id/action`,
|
|
142
|
+
* `false` for `POST /<prefix>/action` (no `:id`, for propose/search/
|
|
143
|
+
* bulk-style actions).
|
|
144
|
+
*/
|
|
145
|
+
id?: boolean;
|
|
146
|
+
/** MCP tool generation flag — `false` to skip, object for explicit overrides. */
|
|
147
|
+
mcp?: boolean | RouteMcpConfig;
|
|
148
|
+
/**
|
|
149
|
+
* Typed handler. `data` is inferred from `schema` — declare both and
|
|
150
|
+
* the compiler catches `data.stagId` typos at the use site.
|
|
151
|
+
*
|
|
152
|
+
* Handlers return arbitrary values; arc wraps them in
|
|
153
|
+
* `IControllerResponse` and ships them through `sendControllerResponse`
|
|
154
|
+
* just like the untyped `ActionDefinition.handler` does.
|
|
155
|
+
*/
|
|
156
|
+
handler: (id: string, data: TData, req: RequestWithExtras) => Promise<unknown>;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Build an `ActionDefinition` with a typed handler. The literal schema
|
|
160
|
+
* type captured here flows into `data`, so `defineAction({ schema:
|
|
161
|
+
* z.object({...}), handler })` produces fully-typed code with no
|
|
162
|
+
* `as MyShape` cast.
|
|
163
|
+
*
|
|
164
|
+
* Behaviorally identical to a bare `ActionDefinition` object — same
|
|
165
|
+
* validation path (AJV), same permission resolution, same MCP wiring.
|
|
166
|
+
* The runtime shape is unchanged; only the type-level inference is new.
|
|
167
|
+
*/
|
|
168
|
+
declare function defineAction<TSchema extends z.ZodTypeAny | undefined = undefined>(config: DefineActionConfig<TSchema>): ActionDefinition;
|
|
169
|
+
//#endregion
|
|
119
170
|
//#region src/core/defineResourceVariants.d.ts
|
|
120
171
|
/**
|
|
121
172
|
* Required identity fields for each variant. The user MUST provide a unique
|
|
@@ -189,9 +240,13 @@ declare function getEntityQuery(req: RequestWithExtras): Record<string, string>;
|
|
|
189
240
|
//#endregion
|
|
190
241
|
//#region src/core/fastifyAdapter.d.ts
|
|
191
242
|
/**
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
243
|
+
* Project `FastifyRequest` into the curated `IRequestContext` shape that
|
|
244
|
+
* arc's controllers receive. This is a developer-facing facade, not a
|
|
245
|
+
* portability boundary — arc is Fastify-only. The projection lifts the
|
|
246
|
+
* fields tenant-scoped controllers reach for (`organizationId`,
|
|
247
|
+
* `teamId`, `scope`, `context`, server accessor) onto a flat, typed
|
|
248
|
+
* surface so handler code doesn't have to dig through Fastify's
|
|
249
|
+
* decorator surface or `req.metadata._scope` internals.
|
|
195
250
|
*/
|
|
196
251
|
declare function createRequestContext(req: FastifyRequest): IRequestContext;
|
|
197
252
|
/**
|
|
@@ -207,25 +262,41 @@ declare function getControllerContext(req: IRequestContext): RequestContext;
|
|
|
207
262
|
*/
|
|
208
263
|
declare function getControllerScope(req: IRequestContext): RequestScope;
|
|
209
264
|
/**
|
|
210
|
-
* Send IControllerResponse
|
|
265
|
+
* Send a controller's `IControllerResponse` through Fastify's reply.
|
|
266
|
+
*
|
|
267
|
+
* The `IControllerResponse<T>` envelope is arc's internal pipeline
|
|
268
|
+
* contract — it's how custom `status`, `meta`, `headers`, and field
|
|
269
|
+
* permissions thread from a handler through interceptors to the wire
|
|
270
|
+
* without each step having to touch `reply` directly. Not a portability
|
|
271
|
+
* abstraction (arc is Fastify-only); a pipeline-internal one.
|
|
211
272
|
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
273
|
+
* **Auto-envelope of bare returns.** Custom route handlers are
|
|
274
|
+
* expected to return the envelope shape so this function can apply
|
|
275
|
+
* field permissions, attach `fieldCaps`, and flatten paginated lists.
|
|
276
|
+
* A handler that returns raw `T` (array, plain object, primitive) used
|
|
277
|
+
* to silently produce a broken response — `response.data` was
|
|
278
|
+
* `undefined`, the body sent was `undefined`, and any declared
|
|
279
|
+
* `fields:` permission map was bypassed (the leak shape mentora
|
|
280
|
+
* flagged). 2.17 detects bare returns and wraps them into
|
|
281
|
+
* `{ data: response, status: 200 }` before the field-permission
|
|
282
|
+
* pipeline runs, so `fields:` applies to ALL custom routes whether the
|
|
283
|
+
* handler envelopes its return value or not. The envelope shape is
|
|
284
|
+
* still the canonical contract — auto-wrapping is a safety net, not
|
|
285
|
+
* an invitation to drop the envelope.
|
|
214
286
|
*/
|
|
215
287
|
declare function sendControllerResponse<T>(reply: FastifyReply, response: IControllerResponse<T>, request?: FastifyRequest): void;
|
|
216
288
|
/**
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
289
|
+
* Bridge an `IController` method (`(ctx: IRequestContext) => Promise<IControllerResponse<T>>`)
|
|
290
|
+
* into a Fastify route handler. Translates between arc's curated request
|
|
291
|
+
* context surface and Fastify's request/reply, and routes the envelope
|
|
292
|
+
* through `sendControllerResponse` so the pipeline applies field
|
|
293
|
+
* permissions, status, and meta uniformly. Internal plumbing, not a
|
|
294
|
+
* portability layer — arc is Fastify-only.
|
|
220
295
|
*
|
|
221
296
|
* @example
|
|
222
297
|
* ```typescript
|
|
223
298
|
* const controller = new BaseController(repository);
|
|
224
|
-
*
|
|
225
|
-
* // Create Fastify handler
|
|
226
299
|
* const listHandler = createFastifyHandler(controller.list.bind(controller));
|
|
227
|
-
*
|
|
228
|
-
* // Register route
|
|
229
300
|
* fastify.get('/products', listHandler);
|
|
230
301
|
* ```
|
|
231
302
|
*/
|
|
@@ -273,4 +344,4 @@ declare function isFieldReadable(rule: ArcFieldRule | undefined): boolean;
|
|
|
273
344
|
*/
|
|
274
345
|
declare function collectReadBlockedFields(schemaOptions: RouteSchemaOptions | undefined): Set<string> | null;
|
|
275
346
|
//#endregion
|
|
276
|
-
export {
|
|
347
|
+
export { MAX_FILTER_DEPTH as A, DEFAULT_SORT as C, HOOK_PHASES as D, HOOK_OPERATIONS as E, RESERVED_QUERY_PARAMS as F, SYSTEM_FIELDS as I, MAX_SEARCH_LENGTH as M, MUTATION_OPERATIONS as N, HookOperation as O, MutationOperation as P, DEFAULT_MAX_LIMIT as S, DEFAULT_UPDATE_METHOD as T, defineAggregation as _, createRequestContext as a, DEFAULT_ID_FIELD as b, sendControllerResponse as c, getEntityQuery as d, defineResourceVariants as f, createPermissionMiddleware as g, createCrudRouter as h, createFastifyHandler as i, MAX_REGEX_LENGTH as j, HookPhase as k, getEntityId as l, defineAction as m, isFieldReadable as n, getControllerContext as o, DefineActionConfig as p, createCrudHandlers as r, getControllerScope as s, collectReadBlockedFields as t, getEntityIdField as u, CRUD_OPERATIONS as v, DEFAULT_TENANT_FIELD as w, DEFAULT_LIMIT as x, CrudOperation as y };
|