@classytic/arc 2.18.5 → 2.19.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.
Files changed (44) hide show
  1. package/dist/{actionPermissions-h7DYDNMg.mjs → actionPermissions-D7NGwcAR.mjs} +1 -0
  2. package/dist/auth/index.d.mts +1 -1
  3. package/dist/auth/index.mjs +10 -1
  4. package/dist/cli/commands/describe.d.mts +1 -1
  5. package/dist/cli/commands/docs.mjs +1 -1
  6. package/dist/core/index.d.mts +2 -2
  7. package/dist/core/index.mjs +2 -2
  8. package/dist/{core-ZnQBa5rh.mjs → core-Ba-6Sue6.mjs} +16 -11
  9. package/dist/{createActionRouter-CagItpxI.mjs → createActionRouter-B_WzBFyf.mjs} +6 -5
  10. package/dist/{createAggregationRouter-DVKroXhC.mjs → createAggregationRouter-B_G_nIjm.mjs} +1 -1
  11. package/dist/docs/index.d.mts +1 -1
  12. package/dist/docs/index.mjs +1 -1
  13. package/dist/encryption/index.d.mts +222 -0
  14. package/dist/encryption/index.mjs +270 -0
  15. package/dist/factory/index.d.mts +1 -1
  16. package/dist/{fastify-augmentation-Cxb0ROIw.d.mts → fastify-augmentation-D-5_yQJi.d.mts} +1 -1
  17. package/dist/hooks/index.d.mts +1 -1
  18. package/dist/{index-Dh0_RSTd.d.mts → index-CP6A1Ffj.d.mts} +7 -7
  19. package/dist/{index-CHNQIhcb.d.mts → index-CUTG2Cuo.d.mts} +83 -1
  20. package/dist/index.d.mts +2 -2
  21. package/dist/index.mjs +3 -3
  22. package/dist/integrations/index.d.mts +1 -1
  23. package/dist/integrations/mcp/index.d.mts +2 -2
  24. package/dist/integrations/mcp/index.mjs +1 -1
  25. package/dist/integrations/mcp/testing.d.mts +1 -1
  26. package/dist/integrations/mcp/testing.mjs +1 -1
  27. package/dist/{mcpPlugin-D1wuRD2c.mjs → mcpPlugin-C088Nd-G.mjs} +1 -1
  28. package/dist/middleware/index.d.mts +1 -1
  29. package/dist/{openapi-xVJibapr.mjs → openapi-DZ-5a5Op.mjs} +2 -2
  30. package/dist/pipeline/index.d.mts +1 -1
  31. package/dist/plugins/index.d.mts +2 -2
  32. package/dist/plugins/tracing-entry.mjs +1 -1
  33. package/dist/presets/filesUpload.d.mts +1 -1
  34. package/dist/presets/index.d.mts +1 -1
  35. package/dist/presets/multiTenant.d.mts +1 -1
  36. package/dist/presets/search.d.mts +1 -1
  37. package/dist/{registerRoute-CPmdkZGu.mjs → registerRoute-BdV8DDwU.mjs} +19 -1
  38. package/dist/registry/index.d.mts +1 -1
  39. package/dist/testing/index.d.mts +2 -2
  40. package/dist/types/index.d.mts +2 -2
  41. package/dist/{types-CmkknLzI.d.mts → types-9_wtNPsI.d.mts} +1 -1
  42. package/dist/{types-D60PFwfG.d.mts → types-DpvSF5Hh.d.mts} +1 -1
  43. package/dist/utils/index.d.mts +1 -1
  44. package/package.json +10 -1
@@ -1,4 +1,4 @@
1
- import { dt as RouteDefinition, ft as RouteMcpConfig, ht as ControllerHandler, rt as PresetResult } from "../index-CHNQIhcb.mjs";
1
+ import { ft as RouteDefinition, gt as ControllerHandler, pt as RouteMcpConfig, rt as PresetResult } from "../index-CUTG2Cuo.mjs";
2
2
  import { c as PermissionCheck } from "../fields-C7ahdGYf.mjs";
3
3
 
4
4
  //#region src/presets/search.d.ts
@@ -260,6 +260,24 @@ function resolveRouterPluginMw(fastify, resourceHasQueryCache) {
260
260
  //#endregion
261
261
  //#region src/core/middlewares/rateLimit.ts
262
262
  /**
263
+ * Build the per-route Fastify `config` object shared by the CRUD, custom, and
264
+ * action routers. Two independent concerns ride on `routeOptions.config`:
265
+ * - `config.rateLimit` — read by `@fastify/rate-limit`.
266
+ * - `config.arcExtensions` — read by arc plugins (encryption, …) at request
267
+ * time, sourced from `defineResource({ extensions })`.
268
+ *
269
+ * Returns `{}` (no `config` key) when neither is present, so routes without
270
+ * either stay config-free and the spread is a genuine no-op. Both fields are
271
+ * optional in the return type, so no cast is needed when only one is set.
272
+ */
273
+ function buildRouteConfig(rateLimitConfig, extensions) {
274
+ if (!rateLimitConfig && !extensions) return {};
275
+ return { config: {
276
+ ...rateLimitConfig ?? {},
277
+ ...extensions ? { arcExtensions: extensions } : {}
278
+ } };
279
+ }
280
+ /**
263
281
  * Build the `config` object for Fastify route options so
264
282
  * @fastify/rate-limit picks up per-route overrides.
265
283
  *
@@ -311,4 +329,4 @@ function tryRegisterRoute(fastify, opts, context) {
311
329
  }
312
330
  }
313
331
  //#endregion
314
- export { buildActionPermissionMw as a, resolveRoutePreHandlers as c, buildArcDecorator as d, selectPluginMw as i, buildAuthMiddleware as l, buildRateLimitConfig as n, buildCrudPermissionMw as o, resolveRouterPluginMw as r, buildPreHandlerChain as s, tryRegisterRoute as t, buildAuthMiddlewareForPermissions as u };
332
+ export { selectPluginMw as a, buildPreHandlerChain as c, buildAuthMiddlewareForPermissions as d, buildArcDecorator as f, resolveRouterPluginMw as i, resolveRoutePreHandlers as l, buildRateLimitConfig as n, buildActionPermissionMw as o, buildRouteConfig as r, buildCrudPermissionMw as s, tryRegisterRoute as t, buildAuthMiddleware as u };
@@ -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-CHNQIhcb.mjs";
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-CUTG2Cuo.mjs";
2
2
  import { FastifyPluginAsync } from "fastify";
3
3
  import { TenantPurgeProgress, TenantPurgeStrategy } from "@classytic/repo-core/repository";
4
4
 
@@ -1,5 +1,5 @@
1
- import { Kt as AnyRecord, V as ResourceDefinition } from "../index-CHNQIhcb.mjs";
2
- import { d as preloadResourcesAsync, r as CreateAppOptions, u as preloadResources } from "../types-CmkknLzI.mjs";
1
+ import { V as ResourceDefinition, qt as AnyRecord } from "../index-CUTG2Cuo.mjs";
2
+ import { d as preloadResourcesAsync, r as CreateAppOptions, u as preloadResources } from "../types-9_wtNPsI.mjs";
3
3
  import { StorageContractSetup, StorageContractSetupResult, runStorageContract } from "./storageContract.mjs";
4
4
  import { FastifyInstance, FastifyServerOptions } from "fastify";
5
5
  import { Mock } from "vitest";
@@ -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, 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-CHNQIhcb.mjs";
1
+ import { $ as OnTenantDeleteConfig, $t as UserOrganization, A as RequestIdOptions, C as RequestContext, D as HealthCheck, E as GracefulShutdownOptions, F as FastifyWithDecorators, Fn as BaseControllerOptions, G as ActionsMap, Gt as JwtContext, H as ActionDefinition, Ht as AuthPluginOptions, I as MiddlewareHandler, J as CrudRouteKey, Jt as ApiResponse, K as ArcFieldRule, Kt as TokenPair, L as RequestWithExtras, M as EventsDecorator, N as FastifyRequestExtras, O as HealthOptions, P as FastifyWithAuth, Q as MiddlewareConfig, Qt as UserLike, S as QueryParserInterface, St as RouteHandler, T as CrudRouterOptions, U as ActionEntry, Ut as Authenticator, Vt as AuthHelpers, W as ActionHandlerFn, Wt as AuthenticatorContext, X as EventDefinition, Xt as JWTPayload, Y as CrudSchemas, Yt as ArcRequest, Z as FieldRule, Zt as ObjectId, _ as ControllerQueryOptions, _t as ControllerLike, a as InferAdapterDoc, at as ResolvedTenantPurge, b as ParsedQuery, bt as IControllerResponse, c as TypedController, ct as ResourceExtensions, d as PaginationResult, dt as ResourcePermissions, et as OpenApiSchemas, f as IntrospectionData, ft as RouteDefinition, g as ArcInternalMetadata, gt as ControllerHandler, h as ResourceMetadata, ht as RouteSchemaOptions, i as ValidationResult, it as RateLimitConfig, j as ArcDecorator, k as IntrospectionPluginOptions, l as TypedRepository, lt as ResourceHookContext, m as RegistryStats, mt as RouteMethod, n as ConfigError, nt as PresetHook, o as InferDocType, ot as ResourceCacheConfig, p as RegistryEntry, pt as RouteMcpConfig, q as CrudController, qt as AnyRecord, r as ValidateOptions, rt as PresetResult, s as InferResourceDoc, st as ResourceConfig, t as RouteHandlerMethod, tt as PresetFunction, u as TypedResourceConfig, ut as ResourceHooks, v as LookupOption, vt as FastifyHandler, w as ServiceContext, x as PopulateOption, xt as IRequestContext, y as OwnershipCheck, yt as IController } from "../index-CUTG2Cuo.mjs";
2
2
  import { i as RequestScope } from "../types-LNebCoJx.mjs";
3
3
  import { c as PermissionCheck, d as UserBase, l as PermissionContext, u as PermissionResult } from "../fields-C7ahdGYf.mjs";
4
4
  import { n as ElevationOptions, t as ElevationEvent } from "../elevation-xGUBq6p_.mjs";
5
- export type { 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 };
5
+ export type { 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, ResourceExtensions, ResourceHookContext, ResourceHooks, ResourceMetadata, ResourcePermissions, RouteDefinition, RouteHandler, RouteHandlerMethod, RouteMcpConfig, RouteMethod, RouteSchemaOptions, ServiceContext, TokenPair, TypedController, TypedRepository, TypedResourceConfig, UserBase, UserLike, UserOrganization, ValidateOptions, ValidationResult };
@@ -1,4 +1,4 @@
1
- import { Ht as Authenticator } from "./index-CHNQIhcb.mjs";
1
+ import { Ut as Authenticator } from "./index-CUTG2Cuo.mjs";
2
2
  import { r as CacheStore } from "./interface-C1_WLTMK.mjs";
3
3
  import { n as ElevationOptions } from "./elevation-xGUBq6p_.mjs";
4
4
  import { a as EventTransport } from "./EventTransport-IEn7Tn-Q.mjs";
@@ -1,4 +1,4 @@
1
- import { V as ResourceDefinition } from "./index-CHNQIhcb.mjs";
1
+ import { V as ResourceDefinition } from "./index-CUTG2Cuo.mjs";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region src/integrations/mcp/types.d.ts
@@ -1,4 +1,4 @@
1
- import { Kt as AnyRecord, S as QueryParserInterface, Zt as UserLike, b as ParsedQuery, et as OpenApiSchemas, st as ResourceConfig } from "../index-CHNQIhcb.mjs";
1
+ import { Qt as UserLike, S as QueryParserInterface, b as ParsedQuery, et as OpenApiSchemas, qt as AnyRecord, st as ResourceConfig } from "../index-CUTG2Cuo.mjs";
2
2
  import { n as ErrorMapper } from "../errorHandler-BtUUDPEa.mjs";
3
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-DOHkjQlD.mjs";
4
4
  import { errorContractSchema, errorDetailSchema } from "@classytic/repo-core/errors";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classytic/arc",
3
- "version": "2.18.5",
3
+ "version": "2.19.0",
4
4
  "description": "Resource-oriented backend framework for Fastify - clean, minimal, powerful, tree-shakable",
5
5
  "type": "module",
6
6
  "exports": {
@@ -96,6 +96,10 @@
96
96
  "types": "./dist/docs/index.d.mts",
97
97
  "default": "./dist/docs/index.mjs"
98
98
  },
99
+ "./encryption": {
100
+ "types": "./dist/encryption/index.d.mts",
101
+ "default": "./dist/encryption/index.mjs"
102
+ },
99
103
  "./idempotency": {
100
104
  "types": "./dist/idempotency/index.d.mts",
101
105
  "default": "./dist/idempotency/index.mjs"
@@ -270,6 +274,7 @@
270
274
  "fastify-raw-body": ">=5.0.0",
271
275
  "h3-js": ">=4.0.0",
272
276
  "ioredis": ">=5.0.0",
277
+ "jose": ">=5.0.0",
273
278
  "pino-pretty": ">=13.0.0",
274
279
  "zod": ">=4.0.0"
275
280
  },
@@ -331,6 +336,9 @@
331
336
  "ioredis": {
332
337
  "optional": true
333
338
  },
339
+ "jose": {
340
+ "optional": true
341
+ },
334
342
  "@sinclair/typebox": {
335
343
  "optional": true
336
344
  },
@@ -391,6 +399,7 @@
391
399
  "fastify-raw-body": "^5.0.0",
392
400
  "h3-js": "^4.4.0",
393
401
  "ioredis": "^5.11.1",
402
+ "jose": "^6.2.3",
394
403
  "jsonwebtoken": "^9.0.3",
395
404
  "knip": "^6.17.1",
396
405
  "mongodb": "^7.3.0",