@classytic/arc 2.10.3 → 2.11.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 +1 -1
- package/dist/{BaseController-CbKKIflT.mjs → BaseController-JNV08qOT.mjs} +595 -537
- package/dist/{queryCachePlugin-BKbWjgDG.d.mts → QueryCache-DOBNHBE0.d.mts} +2 -32
- package/dist/actionPermissions-C8YYU92K.mjs +22 -0
- package/dist/adapters/index.d.mts +2 -2
- package/dist/adapters/index.mjs +1 -1
- package/dist/{adapters-BXY4i-hw.mjs → adapters-D0tT2Tyo.mjs} +54 -0
- package/dist/audit/index.d.mts +2 -2
- package/dist/audit/index.mjs +15 -17
- package/dist/auth/index.d.mts +4 -4
- package/dist/auth/index.mjs +3 -3
- package/dist/auth/redis-session.d.mts +1 -1
- package/dist/{betterAuthOpenApi-BBRVhjQN.mjs → betterAuthOpenApi-DwxtK3uG.mjs} +1 -1
- package/dist/cache/index.d.mts +3 -2
- package/dist/cache/index.mjs +3 -3
- package/dist/cli/commands/docs.mjs +2 -2
- package/dist/cli/commands/generate.mjs +37 -27
- package/dist/cli/commands/init.mjs +47 -34
- package/dist/cli/commands/introspect.mjs +1 -1
- package/dist/context/index.d.mts +58 -0
- package/dist/context/index.mjs +2 -0
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.mjs +4 -3
- package/dist/core-DXdSSFW-.mjs +1037 -0
- package/dist/createActionRouter-BwaSM0No.mjs +166 -0
- package/dist/{createApp-BuvPma24.mjs → createApp-DvNYEhpb.mjs} +118 -36
- package/dist/docs/index.d.mts +2 -2
- package/dist/docs/index.mjs +1 -1
- package/dist/{elevation-C7hgL_aI.mjs → elevation-DOFoxoDs.mjs} +1 -1
- package/dist/errorHandler-Co3lnVmJ.d.mts +114 -0
- package/dist/{eventPlugin-DCUjuiQT.mjs → eventPlugin--5HIkdPU.mjs} +1 -1
- package/dist/{eventPlugin-CxWgpd6K.d.mts → eventPlugin-CUNjYYRY.d.mts} +1 -1
- package/dist/events/index.d.mts +4 -4
- package/dist/events/index.mjs +69 -51
- 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 +1 -1
- package/dist/factory/index.mjs +2 -2
- package/dist/{fields-Lo1VUDpt.d.mts → fields-C8Y0XLAu.d.mts} +1 -1
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/idempotency/index.d.mts +3 -3
- package/dist/idempotency/index.mjs +38 -27
- package/dist/idempotency/redis.d.mts +1 -1
- package/dist/{index-ChIw3776.d.mts → index-BYCqHCVu.d.mts} +4 -4
- package/dist/{index-Cl0uoKd5.d.mts → index-Cm0vUrr_.d.mts} +2100 -1688
- package/dist/{index-DStwgFUK.d.mts → index-DAushRTt.d.mts} +29 -10
- package/dist/index-DsJ1MNfC.d.mts +1179 -0
- package/dist/{index-8qw4y6ff.d.mts → index-t8pLpPFW.d.mts} +13 -10
- package/dist/index.d.mts +7 -251
- package/dist/index.mjs +8 -128
- 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/mcp/index.d.mts +2 -2
- 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 +46 -5
- package/dist/integrations/streamline.mjs +50 -21
- package/dist/integrations/websocket-redis.d.mts +1 -1
- package/dist/integrations/websocket.d.mts +2 -154
- package/dist/integrations/websocket.mjs +292 -224
- package/dist/{keys-qcD-TVJl.mjs → keys-CARyUjiR.mjs} +2 -0
- package/dist/{loadResources-BAzJItAJ.mjs → loadResources-YNwKHvRA.mjs} +3 -1
- package/dist/logger/index.d.mts +81 -0
- package/dist/{logger-DLg8-Ueg.mjs → logger/index.mjs} +1 -6
- package/dist/middleware/index.d.mts +109 -0
- package/dist/middleware/index.mjs +70 -0
- package/dist/multipartBody-CvTR1Un6.mjs +123 -0
- package/dist/{openapi-B5F8AddX.mjs → openapi-C0L9ar7m.mjs} +9 -7
- package/dist/org/index.d.mts +2 -2
- package/dist/permissions/index.d.mts +2 -2
- package/dist/permissions/index.mjs +1 -3
- package/dist/{permissions-Dk6mshja.mjs → permissions-B4vU9L0Q.mjs} +220 -2
- package/dist/pipe-DVoIheVC.mjs +62 -0
- package/dist/pipeline/index.d.mts +62 -0
- package/dist/pipeline/index.mjs +53 -0
- package/dist/plugins/index.d.mts +25 -5
- package/dist/plugins/index.mjs +10 -10
- package/dist/plugins/response-cache.mjs +1 -1
- package/dist/plugins/tracing-entry.d.mts +1 -1
- package/dist/plugins/tracing-entry.mjs +42 -24
- package/dist/presets/filesUpload.d.mts +4 -4
- package/dist/presets/filesUpload.mjs +255 -1
- package/dist/presets/index.d.mts +1 -1
- package/dist/presets/index.mjs +2 -2
- package/dist/presets/multiTenant.d.mts +1 -1
- package/dist/presets/multiTenant.mjs +48 -8
- package/dist/presets/search.d.mts +2 -2
- package/dist/presets/search.mjs +1 -1
- package/dist/{presets-fLJVXdVn.mjs → presets-k604Lj99.mjs} +1 -1
- package/dist/queryCachePlugin-BUXBSm4F.d.mts +34 -0
- package/dist/{queryCachePlugin-DQCEfJis.mjs → queryCachePlugin-Bq6bO6vc.mjs} +3 -3
- package/dist/{redis-DqyeggCa.d.mts → redis-Cm1gnRDf.d.mts} +1 -1
- package/dist/{redis-stream-CakIQmwR.d.mts → redis-stream-CM8TXTix.d.mts} +1 -1
- package/dist/registry/index.d.mts +1 -1
- package/dist/registry/index.mjs +2 -2
- package/dist/{requestContext-xHIKedG6.mjs → requestContext-CfRkaxwf.mjs} +1 -1
- package/dist/{resourceToTools-BElv3xPT.mjs → resourceToTools--okX6QBr.mjs} +534 -415
- package/dist/routerShared-DeESFp4a.mjs +515 -0
- package/dist/schemaIR-BlG9bY7v.mjs +137 -0
- package/dist/scope/index.d.mts +2 -2
- package/dist/scope/index.mjs +1 -1
- package/dist/{sse-yBCgOLGu.mjs → sse-V7aXc3bW.mjs} +1 -1
- package/dist/{store-helpers-ZCSMJJAX.mjs → store-helpers-BhrzxvyQ.mjs} +4 -0
- package/dist/testing/index.d.mts +367 -711
- package/dist/testing/index.mjs +646 -1434
- package/dist/testing/storageContract.d.mts +1 -1
- package/dist/{tracing-65B51Dw3.d.mts → tracing-DokiEsuz.d.mts} +9 -4
- package/dist/types/index.d.mts +5 -5
- package/dist/types/index.mjs +1 -3
- package/dist/types/storage.d.mts +1 -1
- package/dist/{types-Co8k3NyS.d.mts → types-CgikqKAj.d.mts} +133 -21
- package/dist/{types-Btdda02s.d.mts → types-D9NqiYIw.d.mts} +1 -1
- package/dist/utils/index.d.mts +2 -898
- package/dist/utils/index.mjs +4 -5
- package/dist/utils-D3Yxnrwr.mjs +1639 -0
- package/dist/versioning-M9lNLhO8.d.mts +117 -0
- package/dist/websocket-CyJ1VIFI.d.mts +186 -0
- package/package.json +26 -8
- package/skills/arc/SKILL.md +124 -39
- package/skills/arc/references/testing.md +212 -183
- package/dist/applyPermissionResult-QhV1Pa-g.mjs +0 -37
- package/dist/core-CcR01lup.mjs +0 -1411
- package/dist/createActionRouter-Bp_5c_2b.mjs +0 -249
- package/dist/errorHandler-DRQ3EqfL.d.mts +0 -218
- package/dist/errors-CCSsMpXE.d.mts +0 -140
- package/dist/fields-bxkeltzz.mjs +0 -126
- package/dist/filesUpload-t21LS-py.mjs +0 -377
- package/dist/queryParser-DBqBB6AC.mjs +0 -352
- package/dist/types-Csi3FLfq.mjs +0 -27
- package/dist/utils-B2fNOD_i.mjs +0 -929
- /package/dist/{EventTransport-CUw5NNWe.d.mts → EventTransport-CfVEGaEl.d.mts} +0 -0
- /package/dist/{HookSystem-BNYKnrXF.mjs → HookSystem-CGsMd6oK.mjs} +0 -0
- /package/dist/{ResourceRegistry-BPd6NQDm.mjs → ResourceRegistry-DkAeAuTX.mjs} +0 -0
- /package/dist/{caching-CBpK_SCM.mjs → caching-CheW3m-S.mjs} +0 -0
- /package/dist/{elevation-C5SwtkAn.d.mts → elevation-s5ykdNHr.d.mts} +0 -0
- /package/dist/{errorHandler-Bb49BvPD.mjs → errorHandler-BQm8ZxTK.mjs} +0 -0
- /package/dist/{externalPaths-BQ8QijNH.d.mts → externalPaths-Bapitwvd.d.mts} +0 -0
- /package/dist/{interface-CSbZdv_3.d.mts → interface-CkkWm5uR.d.mts} +0 -0
- /package/dist/{interface-D218ikEo.d.mts → interface-Da0r7Lna.d.mts} +0 -0
- /package/dist/{memory-B5Amv9A1.mjs → memory-DikHSvWa.mjs} +0 -0
- /package/dist/{metrics-DuhiSEZI.mjs → metrics-Csh4nsvv.mjs} +0 -0
- /package/dist/{pluralize-A0tWEl1K.mjs → pluralize-BneOJkpi.mjs} +0 -0
- /package/dist/{registry-B3lRFBWo.mjs → registry-D63ee7fl.mjs} +0 -0
- /package/dist/{replyHelpers-CXtJDAZ0.mjs → replyHelpers-ByllIXXV.mjs} +0 -0
- /package/dist/{schemaConverter-BxFDdtXu.mjs → schemaConverter-B0oKLuqI.mjs} +0 -0
- /package/dist/{sessionManager-BkzVU8h2.d.mts → sessionManager-D-oNWHz3.d.mts} +0 -0
- /package/dist/{storage-CVk_SEn2.d.mts → storage-BwGQXUpd.d.mts} +0 -0
- /package/dist/{typeGuards-Cj5Rgvlg.mjs → typeGuards-CcFZXgU7.mjs} +0 -0
- /package/dist/{types-BD85MlEK.d.mts → types-tgR4Pt8F.d.mts} +0 -0
- /package/dist/{versioning-C2U_bLY0.mjs → versioning-CGPjkqAg.mjs} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { B as ResourceDefinition, C as RequestContext, F as FastifyWithDecorators, Pt as AnyRecord, T as CrudRouterOptions, _t as IControllerResponse, at as ResourceConfig, gt as IController, q as CrudController, vt as IRequestContext } from "./index-Cm0vUrr_.mjs";
|
|
2
|
+
import { r as RequestScope } from "./types-tgR4Pt8F.mjs";
|
|
3
|
+
import { c as PermissionCheck } from "./fields-C8Y0XLAu.mjs";
|
|
4
4
|
import { FastifyReply, FastifyRequest, RouteHandlerMethod } from "fastify";
|
|
5
5
|
|
|
6
6
|
//#region src/constants.d.ts
|
|
@@ -54,16 +54,19 @@ declare const RESERVED_QUERY_PARAMS: Readonly<Set<string>>;
|
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region src/core/createCrudRouter.d.ts
|
|
56
56
|
/**
|
|
57
|
-
* Create CRUD routes for a controller
|
|
57
|
+
* Create CRUD routes for a controller.
|
|
58
58
|
*
|
|
59
|
-
* @param fastify
|
|
60
|
-
* @param controller - CRUD controller with handler methods
|
|
61
|
-
*
|
|
59
|
+
* @param fastify - Fastify instance with Arc decorators
|
|
60
|
+
* @param controller - CRUD controller with handler methods (optional when
|
|
61
|
+
* `disableDefaultRoutes: true` and only custom `routes`
|
|
62
|
+
* are being registered)
|
|
63
|
+
* @param options - Router configuration
|
|
62
64
|
*/
|
|
63
65
|
declare function createCrudRouter<TDoc = unknown>(fastify: FastifyWithDecorators, controller: CrudController<TDoc> | undefined, options?: CrudRouterOptions): void;
|
|
64
66
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
+
* Build a permission middleware from a PermissionCheck — useful when hosts
|
|
68
|
+
* register their own routes outside the resource system but still want to
|
|
69
|
+
* evaluate permissions through the shared applicator.
|
|
67
70
|
*/
|
|
68
71
|
declare function createPermissionMiddleware(permission: PermissionCheck, resourceName: string, action: string): RouteHandlerMethod | null;
|
|
69
72
|
//#endregion
|
|
@@ -108,7 +111,7 @@ type VariantsResult<TDoc, V extends VariantsMap<TDoc>> = { [K in keyof V]: Resou
|
|
|
108
111
|
* @returns A record where each key from `variants` maps to a real
|
|
109
112
|
* `ResourceDefinition` ready for `.toPlugin()` registration.
|
|
110
113
|
*/
|
|
111
|
-
declare function defineResourceVariants<TDoc = AnyRecord, V extends VariantsMap<TDoc> = VariantsMap<TDoc>>(base: Omit<ResourceConfig<TDoc>, "name" | "prefix">, variants: V): VariantsResult<TDoc, V>;
|
|
114
|
+
declare function defineResourceVariants<TDoc extends AnyRecord = AnyRecord, V extends VariantsMap<TDoc> = VariantsMap<TDoc>>(base: Omit<ResourceConfig<TDoc>, "name" | "prefix">, variants: V): VariantsResult<TDoc, V>;
|
|
112
115
|
//#endregion
|
|
113
116
|
//#region src/core/fastifyAdapter.d.ts
|
|
114
117
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -1,255 +1,11 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
import { l as createMongooseAdapter, o as createPrismaAdapter, s as MongooseAdapter, t as PrismaAdapter } from "./index-
|
|
4
|
-
import { C as MAX_REGEX_LENGTH, D as RESERVED_QUERY_PARAMS, E as MutationOperation, O as SYSTEM_FIELDS, S as MAX_FILTER_DEPTH, T as MUTATION_OPERATIONS, _ as DEFAULT_UPDATE_METHOD, a as getControllerScope, b as HookOperation, d as CrudOperation, f as DEFAULT_ID_FIELD, g as DEFAULT_TENANT_FIELD, h as DEFAULT_SORT, m as DEFAULT_MAX_LIMIT, p as DEFAULT_LIMIT, s as defineResourceVariants, u as CRUD_OPERATIONS, v as HOOK_OPERATIONS, w as MAX_SEARCH_LENGTH, x as HookPhase, y as HOOK_PHASES } from "./index-
|
|
5
|
-
import { A as requireRoles, C as allOf, E as denyAll, M as when, O as requireAuth, S as createOrgPermissions, T as anyOf, a as presets_d_exports, c as readOnly, d as requireOrgRole, f as requireScopeContext, i as ownerWithAdminBypass, k as requireOwnership, l as requireOrgInScope, m as requireTeamMembership, n as authenticated, o as publicRead, p as requireServiceScope, r as fullPublic, s as publicReadAdminWrite, t as adminOnly, u as requireOrgMembership, v as DynamicPermissionMatrix, w as allowPublic, x as createDynamicPermissionMatrix, y as DynamicPermissionMatrixConfig } from "./index-
|
|
6
|
-
import {
|
|
7
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
8
|
-
import { RouteHandlerMethod as RouteHandlerMethod$1 } from "fastify";
|
|
1
|
+
import { $t as ArcListResult, A as RequestIdOptions, An as RelationMetadata, B as ResourceDefinition, Bt as UserOrganization, C as RequestContext, D as HealthCheck, E as GracefulShutdownOptions, F as FastifyWithDecorators, Ft as ApiResponse, Gt as TreeMixin, Ht as SoftDeleteExt, It as ArcRequest, J as CrudRouteKey, Jt as BulkExt, Kt as SlugExt, L as RequestWithExtras, Lt as JWTPayload, Mn as SchemaMetadata, N as FastifyRequestExtras, Nn as ValidationResult, O as HealthOptions, On as DataAdapter, P as FastifyWithAuth, Pt as AnyRecord, Q as MiddlewareConfig, Qt as ArcGetResult, S as QueryParserInterface, T as CrudRouterOptions, Ut as SoftDeleteMixin, V as defineResource, Vt as BaseController, Wt as TreeExt, X as EventDefinition, Xt as ArcCreateResult, Y as CrudSchemas, Yt as BulkMixin, Z as FieldRule, Zt as ArcDeleteResult, _t as IControllerResponse, a as InferAdapterDoc, at as ResourceConfig, c as TypedController, d as PaginationResult, en as ArcUpdateResult, et as PresetFunction, f as IntrospectionData, ft as RouteSchemaOptions, g as ArcInternalMetadata, gt as IController, h as ResourceMetadata, i as ValidationResult$1, jn as RepositoryLike, k as IntrospectionPluginOptions, kn as FieldMetadata, kt as AuthPluginOptions, l as TypedRepository, m as RegistryStats, mt as ControllerLike, n as ConfigError, nn as BaseCrudController, nt as PresetResult, o as InferDocType, p as RegistryEntry, q as CrudController, qt as SlugMixin, r as ValidateOptions, rn as ListResult, rt as RateLimitConfig, s as InferResourceDoc, t as RouteHandlerMethod, tn as BaseControllerOptions, u as TypedResourceConfig, vt as IRequestContext, w as ServiceContext, y as OwnershipCheck, yt as RouteHandler } from "./index-Cm0vUrr_.mjs";
|
|
2
|
+
import { a as applyFieldWritePermissions, c as PermissionCheck, d as UserBase, i as applyFieldReadPermissions, l as PermissionContext, n as FieldPermissionMap, o as fields, t as FieldPermission, u as PermissionResult } from "./fields-C8Y0XLAu.mjs";
|
|
3
|
+
import { l as createMongooseAdapter, o as createPrismaAdapter, s as MongooseAdapter, t as PrismaAdapter } from "./index-DAushRTt.mjs";
|
|
4
|
+
import { C as MAX_REGEX_LENGTH, D as RESERVED_QUERY_PARAMS, E as MutationOperation, O as SYSTEM_FIELDS, S as MAX_FILTER_DEPTH, T as MUTATION_OPERATIONS, _ as DEFAULT_UPDATE_METHOD, a as getControllerScope, b as HookOperation, d as CrudOperation, f as DEFAULT_ID_FIELD, g as DEFAULT_TENANT_FIELD, h as DEFAULT_SORT, m as DEFAULT_MAX_LIMIT, p as DEFAULT_LIMIT, s as defineResourceVariants, u as CRUD_OPERATIONS, v as HOOK_OPERATIONS, w as MAX_SEARCH_LENGTH, x as HookPhase, y as HOOK_PHASES } from "./index-t8pLpPFW.mjs";
|
|
5
|
+
import { A as requireRoles, C as allOf, E as denyAll, M as when, O as requireAuth, S as createOrgPermissions, T as anyOf, a as presets_d_exports, c as readOnly, d as requireOrgRole, f as requireScopeContext, i as ownerWithAdminBypass, k as requireOwnership, l as requireOrgInScope, m as requireTeamMembership, n as authenticated, o as publicRead, p as requireServiceScope, r as fullPublic, s as publicReadAdminWrite, t as adminOnly, u as requireOrgMembership, v as DynamicPermissionMatrix, w as allowPublic, x as createDynamicPermissionMatrix, y as DynamicPermissionMatrixConfig } from "./index-BYCqHCVu.mjs";
|
|
6
|
+
import { ft as UnauthorizedError, j as envelope, mt as createDomainError, ot as ForbiddenError, pt as ValidationError, rt as ArcError, st as NotFoundError, t as getUserId } from "./index-DsJ1MNfC.mjs";
|
|
9
7
|
|
|
10
|
-
//#region src/context/requestContext.d.ts
|
|
11
|
-
/**
|
|
12
|
-
* Shape of the request-scoped context store.
|
|
13
|
-
* Populated by Arc's onRequest hook in arcCorePlugin.
|
|
14
|
-
*/
|
|
15
|
-
interface RequestStore {
|
|
16
|
-
/** Unique request identifier */
|
|
17
|
-
requestId?: string;
|
|
18
|
-
/** Authenticated user (if any) */
|
|
19
|
-
user?: {
|
|
20
|
-
id?: string;
|
|
21
|
-
_id?: string;
|
|
22
|
-
roles?: string[];
|
|
23
|
-
[key: string]: unknown;
|
|
24
|
-
} | null;
|
|
25
|
-
/** Active organization ID (multi-tenant) */
|
|
26
|
-
organizationId?: string;
|
|
27
|
-
/** Active team ID (team-scoped resources) */
|
|
28
|
-
teamId?: string;
|
|
29
|
-
/** Current resource name (set by arcDecorator in CRUD routes) */
|
|
30
|
-
resourceName?: string;
|
|
31
|
-
/** Request start time (for timing) */
|
|
32
|
-
startTime: number;
|
|
33
|
-
/** Additional context — extensible by app */
|
|
34
|
-
[key: string]: unknown;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Request context API.
|
|
38
|
-
*
|
|
39
|
-
* - `get()` — returns current store or undefined if outside request scope
|
|
40
|
-
* - `run(store, fn)` — run a function with a specific store (used by Arc internals)
|
|
41
|
-
* - `getStore()` — alias for get() (matches Node.js API naming)
|
|
42
|
-
*/
|
|
43
|
-
declare const requestContext: {
|
|
44
|
-
/**
|
|
45
|
-
* Get the current request context.
|
|
46
|
-
* Returns undefined if called outside a request lifecycle.
|
|
47
|
-
*/
|
|
48
|
-
get(): RequestStore | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* Alias for get() — matches Node.js AsyncLocalStorage API naming.
|
|
51
|
-
*/
|
|
52
|
-
getStore(): RequestStore | undefined;
|
|
53
|
-
/**
|
|
54
|
-
* Run a function within a specific request context.
|
|
55
|
-
* Used internally by Arc's onRequest hook.
|
|
56
|
-
*/
|
|
57
|
-
run<T>(store: RequestStore, fn: () => T): T;
|
|
58
|
-
/**
|
|
59
|
-
* The underlying AsyncLocalStorage instance.
|
|
60
|
-
* Exposed for advanced use cases (testing, custom integrations).
|
|
61
|
-
*/
|
|
62
|
-
storage: AsyncLocalStorage<RequestStore>;
|
|
63
|
-
};
|
|
64
|
-
//#endregion
|
|
65
|
-
//#region src/core/validateResourceConfig.d.ts
|
|
66
|
-
interface ConfigError$1 {
|
|
67
|
-
field: string;
|
|
68
|
-
message: string;
|
|
69
|
-
suggestion?: string;
|
|
70
|
-
}
|
|
71
|
-
interface ValidationResult$2 {
|
|
72
|
-
valid: boolean;
|
|
73
|
-
errors: ConfigError$1[];
|
|
74
|
-
warnings: ConfigError$1[];
|
|
75
|
-
}
|
|
76
|
-
interface ValidateOptions$1 {
|
|
77
|
-
/** Skip controller method validation (for testing) */
|
|
78
|
-
skipControllerCheck?: boolean;
|
|
79
|
-
/** Allow unknown preset names */
|
|
80
|
-
allowUnknownPresets?: boolean;
|
|
81
|
-
/** Custom valid permission keys beyond CRUD */
|
|
82
|
-
additionalPermissionKeys?: string[];
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Validate a resource configuration
|
|
86
|
-
*/
|
|
87
|
-
declare function validateResourceConfig(config: ResourceConfig, options?: ValidateOptions$1): ValidationResult$2;
|
|
88
|
-
/**
|
|
89
|
-
* Format validation errors for display
|
|
90
|
-
*/
|
|
91
|
-
declare function formatValidationErrors(resourceName: string, result: ValidationResult$2): string;
|
|
92
|
-
/**
|
|
93
|
-
* Validate and throw if invalid
|
|
94
|
-
*/
|
|
95
|
-
declare function assertValidConfig(config: ResourceConfig, options?: ValidateOptions$1): void;
|
|
96
|
-
//#endregion
|
|
97
|
-
//#region src/middleware/middleware.d.ts
|
|
98
|
-
interface NamedMiddleware {
|
|
99
|
-
/** Unique name for debugging/introspection */
|
|
100
|
-
readonly name: string;
|
|
101
|
-
/** Operations this middleware applies to (default: all) */
|
|
102
|
-
readonly operations?: Array<"list" | "get" | "create" | "update" | "delete" | string>;
|
|
103
|
-
/** Priority — lower numbers run first (default: 10) */
|
|
104
|
-
readonly priority: number;
|
|
105
|
-
/** Conditional execution — return true to run, false to skip */
|
|
106
|
-
readonly when?: (request: RequestWithExtras) => boolean | Promise<boolean>;
|
|
107
|
-
/** The middleware handler */
|
|
108
|
-
readonly handler: MiddlewareHandler;
|
|
109
|
-
}
|
|
110
|
-
interface MiddlewareOptions {
|
|
111
|
-
operations?: NamedMiddleware["operations"];
|
|
112
|
-
priority?: number;
|
|
113
|
-
when?: NamedMiddleware["when"];
|
|
114
|
-
handler: MiddlewareHandler;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Create a named middleware with priority and conditions.
|
|
118
|
-
*/
|
|
119
|
-
declare function middleware(name: string, options: MiddlewareOptions): NamedMiddleware;
|
|
120
|
-
/**
|
|
121
|
-
* Sort named middlewares by priority (ascending — lower runs first).
|
|
122
|
-
* Returns a MiddlewareConfig map keyed by operation, ready to pass to `defineResource()`.
|
|
123
|
-
*/
|
|
124
|
-
declare function sortMiddlewares(middlewares: NamedMiddleware[]): MiddlewareConfig;
|
|
125
|
-
//#endregion
|
|
126
|
-
//#region src/pipeline/guard.d.ts
|
|
127
|
-
interface GuardOptions {
|
|
128
|
-
operations?: OperationFilter;
|
|
129
|
-
handler: (ctx: PipelineContext) => boolean | Promise<boolean>;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Create a named guard.
|
|
133
|
-
*
|
|
134
|
-
* @param name - Guard name (for debugging/introspection)
|
|
135
|
-
* @param handlerOrOptions - Handler function or options object
|
|
136
|
-
*/
|
|
137
|
-
declare function guard(name: string, handlerOrOptions: ((ctx: PipelineContext) => boolean | Promise<boolean>) | GuardOptions): Guard;
|
|
138
|
-
//#endregion
|
|
139
|
-
//#region src/pipeline/intercept.d.ts
|
|
140
|
-
interface InterceptOptions {
|
|
141
|
-
operations?: OperationFilter;
|
|
142
|
-
handler: (ctx: PipelineContext, next: NextFunction) => Promise<IControllerResponse<unknown>>;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Create a named interceptor.
|
|
146
|
-
*
|
|
147
|
-
* @param name - Interceptor name (for debugging/introspection)
|
|
148
|
-
* @param handlerOrOptions - Handler function or options object
|
|
149
|
-
*/
|
|
150
|
-
declare function intercept(name: string, handlerOrOptions: ((ctx: PipelineContext, next: NextFunction) => Promise<IControllerResponse<unknown>>) | InterceptOptions): Interceptor;
|
|
151
|
-
//#endregion
|
|
152
|
-
//#region src/pipeline/pipe.d.ts
|
|
153
|
-
/**
|
|
154
|
-
* Compose pipeline steps into an ordered array.
|
|
155
|
-
* Accepts guards, transforms, and interceptors in any order.
|
|
156
|
-
*/
|
|
157
|
-
declare function pipe(...steps: PipelineStep[]): PipelineStep[];
|
|
158
|
-
//#endregion
|
|
159
|
-
//#region src/pipeline/transform.d.ts
|
|
160
|
-
interface TransformOptions {
|
|
161
|
-
operations?: OperationFilter;
|
|
162
|
-
handler: (ctx: PipelineContext) => PipelineContext | undefined | Promise<PipelineContext | undefined>;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Create a named transform.
|
|
166
|
-
*
|
|
167
|
-
* @param name - Transform name (for debugging/introspection)
|
|
168
|
-
* @param handlerOrOptions - Handler function or options object
|
|
169
|
-
*/
|
|
170
|
-
declare function transform(name: string, handlerOrOptions: ((ctx: PipelineContext) => PipelineContext | undefined | Promise<PipelineContext | undefined>) | TransformOptions): Transform;
|
|
171
|
-
//#endregion
|
|
172
|
-
//#region src/logger/index.d.ts
|
|
173
|
-
/**
|
|
174
|
-
* Arc Logger — Centralized debug & warning system
|
|
175
|
-
*
|
|
176
|
-
* Lightweight, zero-dependency logger for Arc framework internals.
|
|
177
|
-
* Inspired by the `debug` npm package — disabled by default, opt-in via
|
|
178
|
-
* environment variable or `createApp({ debug })` option.
|
|
179
|
-
*
|
|
180
|
-
* @example
|
|
181
|
-
* ```typescript
|
|
182
|
-
* // Enable via env var
|
|
183
|
-
* ARC_DEBUG=1 node server.js // all modules
|
|
184
|
-
* ARC_DEBUG=scope,elevation node server.js // specific modules
|
|
185
|
-
*
|
|
186
|
-
* // Enable via createApp
|
|
187
|
-
* const app = await createApp({ debug: true });
|
|
188
|
-
* const app = await createApp({ debug: 'scope,elevation' });
|
|
189
|
-
*
|
|
190
|
-
* // Suppress warnings (not recommended)
|
|
191
|
-
* ARC_SUPPRESS_WARNINGS=1 node server.js
|
|
192
|
-
*
|
|
193
|
-
* // Framework internals use:
|
|
194
|
-
* import { arcLog } from '../logger/index.js';
|
|
195
|
-
* const log = arcLog('elevation');
|
|
196
|
-
* log.debug('Elevation applied', { userId });
|
|
197
|
-
* log.warn('Something unexpected');
|
|
198
|
-
* ```
|
|
199
|
-
*/
|
|
200
|
-
interface ArcLoggerOptions {
|
|
201
|
-
/**
|
|
202
|
-
* Enable debug output.
|
|
203
|
-
* - `true` or `'*'` — all modules
|
|
204
|
-
* - `string` — comma-separated module names (e.g., `'scope,elevation'`)
|
|
205
|
-
* - `false` — disabled (default)
|
|
206
|
-
*/
|
|
207
|
-
debug?: boolean | string;
|
|
208
|
-
/**
|
|
209
|
-
* Custom log writer. Defaults to `console`.
|
|
210
|
-
* Useful for routing Arc logs into Fastify's pino logger or test fixtures.
|
|
211
|
-
*/
|
|
212
|
-
writer?: ArcLogWriter;
|
|
213
|
-
}
|
|
214
|
-
interface ArcLogWriter {
|
|
215
|
-
debug: (...args: unknown[]) => void;
|
|
216
|
-
info: (...args: unknown[]) => void;
|
|
217
|
-
warn: (...args: unknown[]) => void;
|
|
218
|
-
error: (...args: unknown[]) => void;
|
|
219
|
-
}
|
|
220
|
-
interface ArcLogger {
|
|
221
|
-
debug: (...args: unknown[]) => void;
|
|
222
|
-
info: (...args: unknown[]) => void;
|
|
223
|
-
warn: (...args: unknown[]) => void;
|
|
224
|
-
error: (...args: unknown[]) => void;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Configure the Arc logger globally.
|
|
228
|
-
*
|
|
229
|
-
* Called automatically by `createApp({ debug })`, but can also be
|
|
230
|
-
* called manually for standalone usage outside of `createApp`.
|
|
231
|
-
*/
|
|
232
|
-
declare function configureArcLogger(options: ArcLoggerOptions): void;
|
|
233
|
-
/**
|
|
234
|
-
* Create a module-scoped logger.
|
|
235
|
-
*
|
|
236
|
-
* Debug and info messages are gated by the `ARC_DEBUG` env var or
|
|
237
|
-
* `createApp({ debug })` option. Warnings always show (unless
|
|
238
|
-
* `ARC_SUPPRESS_WARNINGS=1`). Errors always show.
|
|
239
|
-
*
|
|
240
|
-
* @param module - Module name (e.g., 'scope', 'elevation', 'sse', 'preset')
|
|
241
|
-
* @returns Logger instance for that module
|
|
242
|
-
*
|
|
243
|
-
* @example
|
|
244
|
-
* ```typescript
|
|
245
|
-
* const log = arcLog('elevation');
|
|
246
|
-
* log.debug('Checking elevation header');
|
|
247
|
-
* log.warn('No authenticate decorator found');
|
|
248
|
-
* ```
|
|
249
|
-
*/
|
|
250
|
-
declare function arcLog(module: string): ArcLogger;
|
|
251
|
-
//#endregion
|
|
252
8
|
//#region src/index.d.ts
|
|
253
9
|
declare const version: string;
|
|
254
10
|
//#endregion
|
|
255
|
-
export { type ValidationResult as AdapterValidationResult, type AnyRecord, type ApiResponse,
|
|
11
|
+
export { type ValidationResult as AdapterValidationResult, type AnyRecord, type ApiResponse, type ArcCreateResult, type ArcDeleteResult, ArcError, type ArcGetResult, type ArcInternalMetadata, type ArcListResult, type ArcRequest, type ArcUpdateResult, type AuthPluginOptions, BaseController, type BaseControllerOptions, BaseCrudController, type BulkExt, BulkMixin, CRUD_OPERATIONS, type ConfigError, type ControllerLike, type CrudController, type CrudOperation, type CrudRouteKey, type CrudRouterOptions, type CrudSchemas, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, type DataAdapter, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type EventDefinition, type FastifyRequestExtras, type FastifyWithAuth, type FastifyWithDecorators, type FieldMetadata, type FieldPermission, type FieldPermissionMap, type FieldRule, ForbiddenError, type GracefulShutdownOptions, HOOK_OPERATIONS, HOOK_PHASES, type HealthCheck, type HealthOptions, type HookOperation, type HookPhase, type IController, type IControllerResponse, type IRequestContext, type InferAdapterDoc, type InferDocType, type InferResourceDoc, type IntrospectionData, type IntrospectionPluginOptions, type JWTPayload, type ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, type MiddlewareConfig, MongooseAdapter, type MutationOperation, NotFoundError, type OwnershipCheck, type PaginationResult, type PermissionCheck, type PermissionContext, type PermissionResult, type PresetFunction, type PresetResult, PrismaAdapter, type QueryParserInterface, RESERVED_QUERY_PARAMS, type RateLimitConfig, type RegistryEntry, type RegistryStats, type RelationMetadata, type RepositoryLike, type RequestContext, type RequestIdOptions, type RequestWithExtras, type ResourceConfig, ResourceDefinition, type ResourceMetadata, type RouteHandler, type RouteHandlerMethod, type RouteSchemaOptions, SYSTEM_FIELDS, type SchemaMetadata, type ServiceContext, type SlugExt, SlugMixin, type SoftDeleteExt, SoftDeleteMixin, type TreeExt, TreeMixin, type TypedController, type TypedRepository, type TypedResourceConfig, UnauthorizedError, type UserBase, type UserOrganization, type ValidateOptions, ValidationError, type ValidationResult$1 as ValidationResult, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createMongooseAdapter, createOrgPermissions, createPrismaAdapter, defineResource, defineResourceVariants, denyAll, envelope, fields, fullPublic, getControllerScope, getUserId, ownerWithAdminBypass, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };
|
package/dist/index.mjs
CHANGED
|
@@ -1,132 +1,12 @@
|
|
|
1
|
-
import { a as createMongooseAdapter, i as MongooseAdapter, r as createPrismaAdapter, t as PrismaAdapter } from "./adapters-
|
|
1
|
+
import { a as createMongooseAdapter, i as MongooseAdapter, r as createPrismaAdapter, t as PrismaAdapter } from "./adapters-D0tT2Tyo.mjs";
|
|
2
2
|
import { a as DEFAULT_SORT, c as HOOK_OPERATIONS, d as MAX_REGEX_LENGTH, f as MAX_SEARCH_LENGTH, h as SYSTEM_FIELDS, i as DEFAULT_MAX_LIMIT, l as HOOK_PHASES, m as RESERVED_QUERY_PARAMS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MUTATION_OPERATIONS, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as MAX_FILTER_DEPTH } from "./constants-BhY1OHoH.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
3
|
+
import { j as getUserId, r as envelope } from "./utils-D3Yxnrwr.mjs";
|
|
4
|
+
import { a as BulkMixin, i as SlugMixin, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, t as BaseController } from "./BaseController-JNV08qOT.mjs";
|
|
5
|
+
import { C as requireAuth, D as when, M as applyFieldWritePermissions, N as fields, T as requireRoles, _ as requireTeamMembership, a as presets_exports, b as anyOf, c as readOnly, d as createOrgPermissions, f as requireOrgInScope, g as requireServiceScope, h as requireScopeContext, i as ownerWithAdminBypass, j as applyFieldReadPermissions, m as requireOrgRole, n as authenticated, o as publicRead, p as requireOrgMembership, r as fullPublic, s as publicReadAdminWrite, t as adminOnly, u as createDynamicPermissionMatrix, v as allOf, w as requireOwnership, x as denyAll, y as allowPublic } from "./permissions-B4vU9L0Q.mjs";
|
|
6
6
|
import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-D5c-5BJL.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { C as requireAuth, D as when, T as requireRoles, _ as requireTeamMembership, a as presets_exports, b as anyOf, c as readOnly, d as createOrgPermissions, f as requireOrgInScope, g as requireServiceScope, h as requireScopeContext, i as ownerWithAdminBypass, m as requireOrgRole, n as authenticated, o as publicRead, p as requireOrgMembership, r as fullPublic, s as publicReadAdminWrite, t as adminOnly, u as createDynamicPermissionMatrix, v as allOf, w as requireOwnership, x as denyAll, y as allowPublic } from "./permissions-Dk6mshja.mjs";
|
|
10
|
-
import { n as configureArcLogger, t as arcLog } from "./logger-DLg8-Ueg.mjs";
|
|
11
|
-
//#region src/middleware/middleware.ts
|
|
12
|
-
/**
|
|
13
|
-
* Named Middleware — Priority-based, conditional middleware execution.
|
|
14
|
-
*
|
|
15
|
-
* Named middleware replaces flat arrays with structured, inspectable middleware
|
|
16
|
-
* that runs in priority order and supports conditional execution.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* import { middleware } from '@classytic/arc';
|
|
21
|
-
*
|
|
22
|
-
* const verifyEmail = middleware('verifyEmail', {
|
|
23
|
-
* operations: ['create', 'update'],
|
|
24
|
-
* priority: 5,
|
|
25
|
-
* when: (req) => !req.user?.emailVerified,
|
|
26
|
-
* handler: async (req, reply) => {
|
|
27
|
-
* reply.code(403).send({ error: 'Email verification required' });
|
|
28
|
-
* },
|
|
29
|
-
* });
|
|
30
|
-
*
|
|
31
|
-
* const rateLimit = middleware('rateLimit', {
|
|
32
|
-
* priority: 1,
|
|
33
|
-
* handler: async (req, reply) => {
|
|
34
|
-
* // rate limit logic
|
|
35
|
-
* },
|
|
36
|
-
* });
|
|
37
|
-
*
|
|
38
|
-
* const productResource = defineResource({
|
|
39
|
-
* name: 'product',
|
|
40
|
-
* adapter,
|
|
41
|
-
* middlewares: sortMiddlewares([verifyEmail, rateLimit]),
|
|
42
|
-
* });
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
/**
|
|
46
|
-
* Create a named middleware with priority and conditions.
|
|
47
|
-
*/
|
|
48
|
-
function middleware(name, options) {
|
|
49
|
-
return {
|
|
50
|
-
name,
|
|
51
|
-
operations: options.operations,
|
|
52
|
-
priority: options.priority ?? 10,
|
|
53
|
-
when: options.when,
|
|
54
|
-
handler: options.handler
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Sort named middlewares by priority (ascending — lower runs first).
|
|
59
|
-
* Returns a MiddlewareConfig map keyed by operation, ready to pass to `defineResource()`.
|
|
60
|
-
*/
|
|
61
|
-
function sortMiddlewares(middlewares) {
|
|
62
|
-
const sorted = [...middlewares].sort((a, b) => a.priority - b.priority);
|
|
63
|
-
const operations = CRUD_OPERATIONS;
|
|
64
|
-
const result = {};
|
|
65
|
-
for (const op of operations) {
|
|
66
|
-
const applicable = sorted.filter((m) => !m.operations || m.operations.length === 0 || m.operations.includes(op));
|
|
67
|
-
if (applicable.length > 0) result[op] = applicable.map((m) => {
|
|
68
|
-
if (!m.when) return m.handler;
|
|
69
|
-
const wrapped = async (request, reply) => {
|
|
70
|
-
if (await m.when?.(request)) return m.handler(request, reply);
|
|
71
|
-
};
|
|
72
|
-
return wrapped;
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
return result;
|
|
76
|
-
}
|
|
77
|
-
//#endregion
|
|
78
|
-
//#region src/pipeline/guard.ts
|
|
79
|
-
/**
|
|
80
|
-
* Create a named guard.
|
|
81
|
-
*
|
|
82
|
-
* @param name - Guard name (for debugging/introspection)
|
|
83
|
-
* @param handlerOrOptions - Handler function or options object
|
|
84
|
-
*/
|
|
85
|
-
function guard(name, handlerOrOptions) {
|
|
86
|
-
const opts = typeof handlerOrOptions === "function" ? { handler: handlerOrOptions } : handlerOrOptions;
|
|
87
|
-
return {
|
|
88
|
-
_type: "guard",
|
|
89
|
-
name,
|
|
90
|
-
operations: opts.operations,
|
|
91
|
-
handler: opts.handler
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
//#endregion
|
|
95
|
-
//#region src/pipeline/intercept.ts
|
|
96
|
-
/**
|
|
97
|
-
* Create a named interceptor.
|
|
98
|
-
*
|
|
99
|
-
* @param name - Interceptor name (for debugging/introspection)
|
|
100
|
-
* @param handlerOrOptions - Handler function or options object
|
|
101
|
-
*/
|
|
102
|
-
function intercept(name, handlerOrOptions) {
|
|
103
|
-
const opts = typeof handlerOrOptions === "function" ? { handler: handlerOrOptions } : handlerOrOptions;
|
|
104
|
-
return {
|
|
105
|
-
_type: "interceptor",
|
|
106
|
-
name,
|
|
107
|
-
operations: opts.operations,
|
|
108
|
-
handler: opts.handler
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
//#endregion
|
|
112
|
-
//#region src/pipeline/transform.ts
|
|
113
|
-
/**
|
|
114
|
-
* Create a named transform.
|
|
115
|
-
*
|
|
116
|
-
* @param name - Transform name (for debugging/introspection)
|
|
117
|
-
* @param handlerOrOptions - Handler function or options object
|
|
118
|
-
*/
|
|
119
|
-
function transform(name, handlerOrOptions) {
|
|
120
|
-
const opts = typeof handlerOrOptions === "function" ? { handler: handlerOrOptions } : handlerOrOptions;
|
|
121
|
-
return {
|
|
122
|
-
_type: "transform",
|
|
123
|
-
name,
|
|
124
|
-
operations: opts.operations,
|
|
125
|
-
handler: opts.handler
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
//#endregion
|
|
7
|
+
import { _ as getControllerScope } from "./routerShared-DeESFp4a.mjs";
|
|
8
|
+
import { n as ResourceDefinition, r as defineResource, t as defineResourceVariants } from "./core-DXdSSFW-.mjs";
|
|
129
9
|
//#region src/index.ts
|
|
130
|
-
const version = "2.
|
|
10
|
+
const version = "2.11.0";
|
|
131
11
|
//#endregion
|
|
132
|
-
export { ArcError, BaseController, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, ForbiddenError, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, MongooseAdapter, NotFoundError, PrismaAdapter, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, UnauthorizedError, ValidationError, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions,
|
|
12
|
+
export { ArcError, BaseController, BaseCrudController, BulkMixin, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, ForbiddenError, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, MongooseAdapter, NotFoundError, PrismaAdapter, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, SlugMixin, SoftDeleteMixin, TreeMixin, UnauthorizedError, ValidationError, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createMongooseAdapter, createOrgPermissions, createPrismaAdapter, defineResource, defineResourceVariants, denyAll, envelope, fields, fullPublic, getControllerScope, getUserId, ownerWithAdminBypass, presets_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as DomainEvent } from "../EventTransport-
|
|
2
|
-
import {
|
|
1
|
+
import { n as DomainEvent } from "../EventTransport-CfVEGaEl.mjs";
|
|
2
|
+
import { a as WebSocketMessage, i as WebSocketClient } from "../websocket-CyJ1VIFI.mjs";
|
|
3
3
|
import { FastifyPluginAsync, FastifyRequest } from "fastify";
|
|
4
4
|
|
|
5
5
|
//#region src/integrations/event-gateway.d.ts
|
|
@@ -4,7 +4,7 @@ const eventGatewayPluginImpl = async (fastify, opts = {}) => {
|
|
|
4
4
|
const { auth = true, orgScoped = false, roomPolicy, maxMessageBytes, maxSubscriptionsPerClient, authenticate } = opts;
|
|
5
5
|
if (auth && !authenticate && !fastify.hasDecorator("authenticate")) throw new Error("[arc-event-gateway] auth is true but fastify.authenticate is not registered. Register an auth plugin first, provide a custom authenticate function, or set auth: false.");
|
|
6
6
|
if (opts.sse !== false) {
|
|
7
|
-
const { default: ssePlugin } = await import("../sse-
|
|
7
|
+
const { default: ssePlugin } = await import("../sse-V7aXc3bW.mjs").then((n) => n.r);
|
|
8
8
|
await fastify.register(ssePlugin, {
|
|
9
9
|
path: opts.sse?.path ?? "/events/stream",
|
|
10
10
|
requireAuth: auth,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as WebSocketMessage, i as WebSocketClient, o as WebSocketPluginOptions } from "../websocket-CyJ1VIFI.mjs";
|
|
2
2
|
import { EventGatewayOptions } from "./event-gateway.mjs";
|
|
3
3
|
import { JobDefinition, JobDispatchOptions, JobDispatcher, JobMeta, JobsPluginOptions, QueueStats } from "./jobs.mjs";
|
|
4
|
-
import { c as McpResourceConfig, f as ToolAnnotations, i as CrudOperation, l as PromptDefinition, m as ToolDefinition, n as CallToolResult, o as McpAuthResult, p as ToolContext, r as CreateMcpServerConfig, s as McpPluginOptions, t as BetterAuthHandler } from "../types-
|
|
4
|
+
import { c as McpResourceConfig, f as ToolAnnotations, i as CrudOperation, l as PromptDefinition, m as ToolDefinition, n as CallToolResult, o as McpAuthResult, p as ToolContext, r as CreateMcpServerConfig, s as McpPluginOptions, t as BetterAuthHandler } from "../types-D9NqiYIw.mjs";
|
|
5
5
|
import { StreamlinePluginOptions, WorkflowLike, WorkflowRunLike } from "./streamline.mjs";
|
|
6
6
|
import { WebhookDeliveryRecord, WebhookManager, WebhookPluginOptions, WebhookStore, WebhookSubscription } from "./webhooks.mjs";
|
|
7
7
|
export { type BetterAuthHandler, type CallToolResult, type CreateMcpServerConfig, type CrudOperation, type EventGatewayOptions, type JobDefinition, type JobDispatchOptions, type JobDispatcher, type JobMeta, type JobsPluginOptions, type McpAuthResult, type McpPluginOptions, type McpResourceConfig, type PromptDefinition, type QueueStats, type StreamlinePluginOptions, type ToolAnnotations, type ToolContext, type ToolDefinition, type WebSocketClient, type WebSocketMessage, type WebSocketPluginOptions, type WebhookDeliveryRecord, type WebhookManager, type WebhookPluginOptions, type WebhookStore, type WebhookSubscription, type WorkflowLike, type WorkflowRunLike };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as McpAuthResolver, c as McpResourceConfig, d as SessionEntry, f as ToolAnnotations, i as CrudOperation, l as PromptDefinition, m as ToolDefinition, n as CallToolResult, o as McpAuthResult, p as ToolContext, r as CreateMcpServerConfig, s as McpPluginOptions, t as BetterAuthHandler, u as PromptResult } from "../../types-
|
|
1
|
+
import { B as ResourceDefinition } from "../../index-Cm0vUrr_.mjs";
|
|
2
|
+
import { a as McpAuthResolver, c as McpResourceConfig, d as SessionEntry, f as ToolAnnotations, i as CrudOperation, l as PromptDefinition, m as ToolDefinition, n as CallToolResult, o as McpAuthResult, p as ToolContext, r as CreateMcpServerConfig, s as McpPluginOptions, t as BetterAuthHandler, u as PromptResult } from "../../types-D9NqiYIw.mjs";
|
|
3
3
|
import { FastifyPluginAsync } from "fastify";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as fieldRulesToZod, r as createMcpServer, t as resourceToTools } from "../../resourceToTools
|
|
1
|
+
import { n as fieldRulesToZod, r as createMcpServer, t as resourceToTools } from "../../resourceToTools--okX6QBr.mjs";
|
|
2
2
|
import { createHash, randomUUID } from "node:crypto";
|
|
3
3
|
import fp from "fastify-plugin";
|
|
4
4
|
//#region src/integrations/mcp/defineTool.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as createMcpServer, t as resourceToTools } from "../../resourceToTools
|
|
1
|
+
import { r as createMcpServer, t as resourceToTools } from "../../resourceToTools--okX6QBr.mjs";
|
|
2
2
|
//#region src/integrations/mcp/testing.ts
|
|
3
3
|
/**
|
|
4
4
|
* @classytic/arc/mcp/testing — MCP Test Utilities
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FastifyPluginAsync } from "fastify";
|
|
2
2
|
|
|
3
3
|
//#region src/integrations/streamline.d.ts
|
|
4
|
-
/** Start options — matches @classytic/streamline v2.1 StartOptions */
|
|
4
|
+
/** Start options — matches @classytic/streamline v2.1+ StartOptions */
|
|
5
5
|
interface WorkflowStartOptions {
|
|
6
6
|
meta?: Record<string, unknown>;
|
|
7
7
|
idempotencyKey?: string;
|
|
@@ -65,15 +65,38 @@ interface StreamlinePluginOptions {
|
|
|
65
65
|
/** Connect workflow lifecycle events to Arc's event bus (default: true) */
|
|
66
66
|
bridgeEvents?: boolean;
|
|
67
67
|
/**
|
|
68
|
-
* Bridge
|
|
68
|
+
* Bridge the workflow's internal event bus (step + workflow lifecycle +
|
|
69
|
+
* engine telemetry) to Arc's event bus, topic-scoped as
|
|
70
|
+
* `workflow.${workflowId}.${eventName}`.
|
|
71
|
+
*
|
|
72
|
+
* Covers the full streamline 2.2 event surface:
|
|
73
|
+
* - Step events: started, completed, failed, waiting, skipped,
|
|
74
|
+
* retry-scheduled, compensated
|
|
75
|
+
* - Workflow lifecycle: started, completed, failed, waiting, resumed,
|
|
76
|
+
* cancelled, recovered, retry, compensating
|
|
77
|
+
* - Engine telemetry: engine:error, scheduler:error,
|
|
78
|
+
* scheduler:circuit-open
|
|
79
|
+
*
|
|
80
|
+
* Subscriptions use structural `container.eventBus.on(...)` — future
|
|
81
|
+
* streamline releases can add events without breaking arc; missing
|
|
82
|
+
* events are simply never handled (no crash). Requires the workflow
|
|
83
|
+
* to expose `container.eventBus`.
|
|
84
|
+
*
|
|
69
85
|
* Disabled by default — enable for dashboards or monitoring.
|
|
70
|
-
* Requires the workflow to expose `container.eventBus` (streamline >=2.1).
|
|
71
86
|
* @default false
|
|
72
87
|
*/
|
|
88
|
+
bridgeBusEvents?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* @deprecated v2.11.0 — renamed to `bridgeBusEvents` which now covers
|
|
91
|
+
* step + workflow + engine events (not just step-level). Still accepted
|
|
92
|
+
* as an alias; will be removed in v3. Prefer `bridgeBusEvents`.
|
|
93
|
+
*/
|
|
73
94
|
bridgeStepEvents?: boolean;
|
|
74
95
|
/**
|
|
75
96
|
* Enable SSE streaming endpoint: GET /:workflowId/runs/:runId/stream
|
|
76
|
-
* Streams step-level events as Server-Sent Events for live
|
|
97
|
+
* Streams step-level + lifecycle events as Server-Sent Events for live
|
|
98
|
+
* UI updates. Auto-closes the stream on terminal workflow events
|
|
99
|
+
* (completed / failed / cancelled).
|
|
77
100
|
* @default false
|
|
78
101
|
*/
|
|
79
102
|
enableStreaming?: boolean;
|
|
@@ -86,7 +109,25 @@ interface StreamlinePluginOptions {
|
|
|
86
109
|
get?: (request: unknown) => boolean | Promise<boolean>;
|
|
87
110
|
};
|
|
88
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Full event list published on a streamline workflow's internal `eventBus`
|
|
114
|
+
* (tracks streamline 2.2's `EventPayloadMap` in
|
|
115
|
+
* `@classytic/streamline/src/core/events.ts`).
|
|
116
|
+
*
|
|
117
|
+
* Hardcoded here by design — arc subscribes via structural
|
|
118
|
+
* `eventBus.on(name, handler)`, which is a no-op for events the running
|
|
119
|
+
* streamline version doesn't emit. New events a future streamline release
|
|
120
|
+
* adds can be bridged by updating this list; arc never breaks just
|
|
121
|
+
* because streamline extended its bus.
|
|
122
|
+
*/
|
|
123
|
+
declare const STREAMLINE_BUS_EVENTS: readonly ["step:started", "step:completed", "step:failed", "step:waiting", "step:skipped", "step:retry-scheduled", "step:compensated", "workflow:started", "workflow:completed", "workflow:failed", "workflow:waiting", "workflow:resumed", "workflow:cancelled", "workflow:recovered", "workflow:retry", "workflow:compensating", "engine:error", "scheduler:error", "scheduler:circuit-open"];
|
|
124
|
+
/**
|
|
125
|
+
* Workflow events that should auto-close an SSE stream when observed.
|
|
126
|
+
* Recovered / waiting / resumed / retry / compensating are NOT terminal —
|
|
127
|
+
* the run is still active after them.
|
|
128
|
+
*/
|
|
129
|
+
declare const STREAMLINE_TERMINAL_EVENTS: readonly ["workflow:completed", "workflow:failed", "workflow:cancelled"];
|
|
89
130
|
/** Pluggable streamline integration for Arc */
|
|
90
131
|
declare const streamlinePlugin: FastifyPluginAsync<StreamlinePluginOptions>;
|
|
91
132
|
//#endregion
|
|
92
|
-
export { StreamlinePluginOptions, WorkflowLike, WorkflowRunLike, WorkflowStartOptions, streamlinePlugin };
|
|
133
|
+
export { STREAMLINE_BUS_EVENTS, STREAMLINE_TERMINAL_EVENTS, StreamlinePluginOptions, WorkflowLike, WorkflowRunLike, WorkflowStartOptions, streamlinePlugin };
|