@classytic/arc 2.7.3 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{HookSystem-D7lfx--K.mjs → HookSystem-BjFu7zf1.mjs} +3 -2
- package/dist/adapters/index.d.mts +2 -2
- package/dist/audit/index.d.mts +1 -1
- package/dist/audit/index.mjs +1 -1
- package/dist/audit/mongodb.d.mts +1 -1
- package/dist/audit/mongodb.mjs +1 -1
- package/dist/auth/index.d.mts +4 -4
- package/dist/auth/index.mjs +2 -2
- package/dist/auth/redis-session.d.mts +1 -1
- package/dist/{betterAuthOpenApi-CCw3YX0g.mjs → betterAuthOpenApi-CHCIuA-p.mjs} +1 -1
- package/dist/cache/index.d.mts +2 -2
- package/dist/cache/index.mjs +1 -1
- package/dist/cli/commands/docs.mjs +2 -2
- package/dist/cli/commands/generate.mjs +1 -1
- package/dist/cli/commands/introspect.mjs +1 -1
- package/dist/core/index.d.mts +2 -2
- package/dist/core/index.mjs +3 -2
- package/dist/core-BfrfxNqO.mjs +34 -0
- package/dist/{core-BWekSEju.mjs → createActionRouter-CbkIAaGh.mjs} +6 -36
- package/dist/{createApp-D7e77m8C.mjs → createApp-Cy8eUNKQ.mjs} +10 -10
- package/dist/{defineResource-DZzyl4a4.mjs → defineResource-CovBXvTB.mjs} +75 -9
- package/dist/docs/index.d.mts +2 -2
- package/dist/docs/index.mjs +1 -1
- package/dist/dynamic/index.d.mts +2 -2
- package/dist/dynamic/index.mjs +1 -1
- package/dist/{elevation-By_p2lnn.mjs → elevation-BBGFjzIP.mjs} +1 -1
- package/dist/{errorHandler-pCpEtNd7.d.mts → errorHandler-BeN-ERN7.d.mts} +1 -1
- package/dist/{eventPlugin-CdvUoUna.d.mts → eventPlugin-CAOWMQS8.d.mts} +1 -1
- package/dist/events/index.d.mts +3 -3
- package/dist/events/index.mjs +1 -1
- 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 +7 -6
- 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/mongodb.d.mts +1 -1
- package/dist/idempotency/mongodb.mjs +1 -3
- package/dist/idempotency/redis.d.mts +1 -1
- package/dist/{index-C9eYNjGR.d.mts → index-BpMhrFgn.d.mts} +1 -1
- package/dist/{index-B0extFr4.d.mts → index-CBru2y5Y.d.mts} +3 -3
- package/dist/{index-BjShrzoj.d.mts → index-qct60lnl.d.mts} +14 -14
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +4 -4
- package/dist/integrations/event-gateway.d.mts +1 -1
- package/dist/integrations/event-gateway.mjs +1 -1
- package/dist/integrations/index.d.mts +1 -1
- 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 +39 -7
- package/dist/integrations/streamline.mjs +106 -4
- package/dist/{interface-B91alUzq.d.mts → interface-IJqN3pXK.d.mts} +145 -4
- package/dist/{mongodb-Cgu9F1Nd.d.mts → mongodb-B1eVtFhw.d.mts} +1 -1
- package/dist/{mongodb-B7zupyck.d.mts → mongodb-NShVZDMr.d.mts} +1 -1
- package/dist/{openapi-BBSTVcMm.mjs → openapi-AYLVjqVe.mjs} +1 -1
- package/dist/org/index.d.mts +2 -2
- package/dist/permissions/index.d.mts +3 -3
- package/dist/plugins/index.d.mts +4 -4
- package/dist/plugins/index.mjs +8 -8
- package/dist/plugins/tracing-entry.d.mts +1 -1
- package/dist/plugins/tracing-entry.mjs +1 -1
- package/dist/policies/index.d.mts +1 -1
- package/dist/presets/index.d.mts +1 -1
- package/dist/presets/multiTenant.d.mts +1 -1
- package/dist/{queryCachePlugin-Ckl71mkc.d.mts → queryCachePlugin-BCFVXnxK.d.mts} +1 -1
- package/dist/{redis-3TQxm2VZ.d.mts → redis-Bunu3qWg.d.mts} +1 -1
- package/dist/{redis-stream-Dag5LFa9.d.mts → redis-stream-CF1lrKVk.d.mts} +1 -1
- package/dist/registry/index.d.mts +1 -1
- package/dist/registry/index.mjs +2 -2
- package/dist/{resourceToTools-BJkoQoUP.mjs → resourceToTools-C_1SMiCz.mjs} +1 -1
- package/dist/rpc/index.d.mts +1 -1
- package/dist/{schemaConverter-0TyONAwM.mjs → schemaConverter-Y5EejTnJ.mjs} +1 -4
- package/dist/scope/index.d.mts +2 -2
- package/dist/scope/index.mjs +1 -1
- package/dist/{sse-6W0hjVS_.mjs → sse-CD5Hghpu.mjs} +1 -1
- package/dist/testing/index.d.mts +2 -2
- package/dist/testing/index.mjs +1 -1
- package/dist/types/index.d.mts +5 -5
- package/dist/{types-B4BNthET.d.mts → types-BoaZHr-2.d.mts} +1 -1
- package/dist/{types-C5g2oRC7.d.mts → types-Ct0PUUSp.d.mts} +1 -1
- package/dist/{types-2FlNl0mL.d.mts → types-gUxAIZHp.d.mts} +13 -9
- package/dist/utils/index.d.mts +3 -3
- package/dist/utils/index.mjs +1 -1
- package/package.json +8 -7
- package/skills/arc/SKILL.md +23 -4
- package/skills/arc/references/integrations.md +1 -1
- package/skills/arc/references/mcp.md +2 -0
- /package/dist/{EventTransport-C4VheKeC.d.mts → EventTransport-n1KBxC_N.d.mts} +0 -0
- /package/dist/{ResourceRegistry-DsHiG9cL.mjs → ResourceRegistry-BOtJuRCs.mjs} +0 -0
- /package/dist/{caching-5DtLwIqb.mjs → caching-CHH-iHs3.mjs} +0 -0
- /package/dist/{circuitBreaker-BBPDt-J_.d.mts → circuitBreaker-BGVoB1hD.d.mts} +0 -0
- /package/dist/{elevation-D7WK0RXq.d.mts → elevation-UJO3-NvX.d.mts} +0 -0
- /package/dist/{errorHandler-CH8wk1eD.mjs → errorHandler-BW08lEiy.mjs} +0 -0
- /package/dist/{errors-BS6lZvWy.d.mts → errors-BI8kEKsO.d.mts} +0 -0
- /package/dist/{eventPlugin-B6U_nCFU.mjs → eventPlugin-x4jo3sG0.mjs} +0 -0
- /package/dist/{externalPaths-iba7jD3d.d.mts → externalPaths-BQ8QijNH.d.mts} +0 -0
- /package/dist/{fields-D4nMDqnK.d.mts → fields-DoeDgh2b.d.mts} +0 -0
- /package/dist/{interface-CSbZdv_3.d.mts → interface-CkkWm5uR.d.mts} +0 -0
- /package/dist/{interface-CG7oRZjX.d.mts → interface-bpoLKKqx.d.mts} +0 -0
- /package/dist/{logger-DLg8-Ueg.mjs → logger-CDjpjySd.mjs} +0 -0
- /package/dist/{metrics-Qnvwc-LQ.mjs → metrics-DuhiSEZI.mjs} +0 -0
- /package/dist/{mongodb-B7X7P1P8.mjs → mongodb-5Ff3w8jy.mjs} +0 -0
- /package/dist/{pluralize-Dckfq6US.mjs → pluralize-BneOJkpi.mjs} +0 -0
- /package/dist/{queryCachePlugin-CwTpR04-.mjs → queryCachePlugin-D0iIVhW_.mjs} +0 -0
- /package/dist/{registry-B3lRFBWo.mjs → registry-B0Wl7uVV.mjs} +0 -0
- /package/dist/{replyHelpers-uDUIYh7u.mjs → replyHelpers-CXtJDAZ0.mjs} +0 -0
- /package/dist/{sessionManager-CEo9jwPI.d.mts → sessionManager-BkzVU8h2.d.mts} +0 -0
- /package/dist/{tracing-DEqdGkr-.d.mts → tracing-xqXzWeaf.d.mts} +0 -0
- /package/dist/{types--D3vvfdt.d.mts → types-CN6JvmYz.d.mts} +0 -0
- /package/dist/{versioning-CdBbFefk.mjs → versioning-CPU_5Xfs.mjs} +0 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Database-agnostic resource framework for Fastify. Define resources, get CRUD routes, permissions, presets, caching, events, OpenAPI, and MCP tools — without boilerplate.
|
|
4
4
|
|
|
5
|
-
**v2.
|
|
5
|
+
**v2.8.0** | Fastify 5+ | Node.js 22+ | ESM only | 260+ test files, 3523+ tests
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -694,7 +694,7 @@ npx @classytic/arc doctor # Health check
|
|
|
694
694
|
| `@classytic/arc/docs` | OpenAPI generation |
|
|
695
695
|
| `@classytic/arc/cli` | CLI commands (programmatic) |
|
|
696
696
|
|
|
697
|
-
## v2.
|
|
697
|
+
## v2.8.0 Highlights
|
|
698
698
|
|
|
699
699
|
- **MCP Integration** — expose resources as AI agent tools (stateless by default, service scope, multi-tenancy)
|
|
700
700
|
- **Reply Helpers** — `reply.ok()`, `reply.fail()`, `reply.paginated()`, `reply.stream()` (opt-in)
|
|
@@ -5,8 +5,9 @@ var HookSystem = class {
|
|
|
5
5
|
warn;
|
|
6
6
|
constructor(options) {
|
|
7
7
|
this.hooks = /* @__PURE__ */ new Map();
|
|
8
|
-
|
|
9
|
-
this.
|
|
8
|
+
const noop = () => {};
|
|
9
|
+
this.logger = options?.logger ?? { error: noop };
|
|
10
|
+
this.warn = options?.logger?.warn ?? noop;
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* Generate hook key
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as RelationMetadata, c as ValidationResult, i as FieldMetadata, o as RepositoryLike, r as DataAdapter, s as SchemaMetadata, t as AdapterFactory } from "../interface-
|
|
2
|
-
import { a as PrismaQueryParserOptions, c as MongooseAdapterOptions, i as PrismaQueryParser, l as createMongooseAdapter, n as PrismaAdapterOptions, o as createPrismaAdapter, r as PrismaQueryOptions, s as MongooseAdapter, t as PrismaAdapter } from "../index-
|
|
1
|
+
import { a as RelationMetadata, c as ValidationResult, i as FieldMetadata, o as RepositoryLike, r as DataAdapter, s as SchemaMetadata, t as AdapterFactory } from "../interface-IJqN3pXK.mjs";
|
|
2
|
+
import { a as PrismaQueryParserOptions, c as MongooseAdapterOptions, i as PrismaQueryParser, l as createMongooseAdapter, n as PrismaAdapterOptions, o as createPrismaAdapter, r as PrismaQueryOptions, s as MongooseAdapter, t as PrismaAdapter } from "../index-BpMhrFgn.mjs";
|
|
3
3
|
export { AdapterFactory, DataAdapter, FieldMetadata, MongooseAdapter, MongooseAdapterOptions, PrismaAdapter, PrismaAdapterOptions, PrismaQueryOptions, PrismaQueryParser, PrismaQueryParserOptions, RelationMetadata, RepositoryLike, SchemaMetadata, ValidationResult, createMongooseAdapter, createPrismaAdapter };
|
package/dist/audit/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AuditContext, c as AuditStore, i as AuditAction, l as AuditStoreOptions, n as MongoAuditStoreOptions, o as AuditEntry, r as MongoConnection, s as AuditQueryOptions, u as createAuditEntry } from "../mongodb-
|
|
1
|
+
import { a as AuditContext, c as AuditStore, i as AuditAction, l as AuditStoreOptions, n as MongoAuditStoreOptions, o as AuditEntry, r as MongoConnection, s as AuditQueryOptions, u as createAuditEntry } from "../mongodb-B1eVtFhw.mjs";
|
|
2
2
|
import { FastifyPluginAsync } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region src/audit/auditPlugin.d.ts
|
package/dist/audit/index.mjs
CHANGED
package/dist/audit/mongodb.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as MongoAuditStoreOptions, t as MongoAuditStore } from "../mongodb-
|
|
1
|
+
import { n as MongoAuditStoreOptions, t as MongoAuditStore } from "../mongodb-B1eVtFhw.mjs";
|
|
2
2
|
export { MongoAuditStore, type MongoAuditStoreOptions };
|
package/dist/audit/mongodb.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as MongoAuditStore } from "../mongodb-
|
|
1
|
+
import { t as MongoAuditStore } from "../mongodb-5Ff3w8jy.mjs";
|
|
2
2
|
export { MongoAuditStore };
|
package/dist/auth/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as PermissionCheck } from "../types-
|
|
3
|
-
import { t as ExternalOpenApiPaths } from "../externalPaths-
|
|
4
|
-
import { a as SessionManagerOptions, c as createSessionManager, i as SessionData, n as MemorySessionStoreOptions, o as SessionManagerResult, r as SessionCookieOptions, s as SessionStore, t as MemorySessionStore } from "../sessionManager-
|
|
1
|
+
import { b as AuthPluginOptions, y as AuthHelpers } from "../interface-IJqN3pXK.mjs";
|
|
2
|
+
import { t as PermissionCheck } from "../types-BoaZHr-2.mjs";
|
|
3
|
+
import { t as ExternalOpenApiPaths } from "../externalPaths-BQ8QijNH.mjs";
|
|
4
|
+
import { a as SessionManagerOptions, c as createSessionManager, i as SessionData, n as MemorySessionStoreOptions, o as SessionManagerResult, r as SessionCookieOptions, s as SessionStore, t as MemorySessionStore } from "../sessionManager-BkzVU8h2.mjs";
|
|
5
5
|
import { FastifyPluginAsync, FastifyReply as FastifyReply$1, FastifyRequest as FastifyRequest$1 } from "fastify";
|
|
6
6
|
|
|
7
7
|
//#region src/auth/authPlugin.d.ts
|
package/dist/auth/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as normalizeRoles, t as getUserRoles } from "../types-ZUu_h0jp.mjs";
|
|
2
2
|
import { t as ArcError } from "../errors-Cg58SLNi.mjs";
|
|
3
3
|
import { h as requireTeamMembership, l as requireOrgMembership, u as requireOrgRole } from "../permissions-CH4cNwJi.mjs";
|
|
4
|
-
import { n as extractBetterAuthOpenApi } from "../betterAuthOpenApi-
|
|
4
|
+
import { n as extractBetterAuthOpenApi } from "../betterAuthOpenApi-CHCIuA-p.mjs";
|
|
5
5
|
import { createHmac, randomUUID, timingSafeEqual } from "node:crypto";
|
|
6
6
|
import fp from "fastify-plugin";
|
|
7
7
|
//#region src/auth/authPlugin.ts
|
|
@@ -677,7 +677,7 @@ function createBetterAuthAdapter(options) {
|
|
|
677
677
|
if (!fastify.hasDecorator("authenticate")) fastify.decorate("authenticate", authenticate);
|
|
678
678
|
if (!fastify.hasDecorator("optionalAuthenticate")) fastify.decorate("optionalAuthenticate", optionalAuthenticate);
|
|
679
679
|
if (!extractedOpenApi && openapiOpt !== false && auth.api && typeof auth.api === "object") {
|
|
680
|
-
const { extractBetterAuthOpenApi } = await import("../betterAuthOpenApi-
|
|
680
|
+
const { extractBetterAuthOpenApi } = await import("../betterAuthOpenApi-CHCIuA-p.mjs").then((n) => n.t);
|
|
681
681
|
extractedOpenApi = extractBetterAuthOpenApi(auth.api, {
|
|
682
682
|
basePath,
|
|
683
683
|
userFields
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as SessionData, s as SessionStore } from "../sessionManager-
|
|
1
|
+
import { i as SessionData, s as SessionStore } from "../sessionManager-BkzVU8h2.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/auth/redis-session.d.ts
|
|
4
4
|
/** Minimal Redis client interface — compatible with ioredis */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
|
|
2
|
-
import { a as toJsonSchema } from "./schemaConverter-
|
|
2
|
+
import { a as toJsonSchema } from "./schemaConverter-Y5EejTnJ.mjs";
|
|
3
3
|
//#region src/auth/betterAuthOpenApi.ts
|
|
4
4
|
var betterAuthOpenApi_exports = /* @__PURE__ */ __exportAll({ extractBetterAuthOpenApi: () => extractBetterAuthOpenApi });
|
|
5
5
|
/**
|
package/dist/cache/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as CacheStore, n as CacheSetOptions, r as CacheStats, t as CacheLogger } from "../interface-
|
|
2
|
-
import { a as CacheEnvelope, c as QueryCache, i as queryCachePlugin, l as QueryCacheConfig, n as QueryCacheDefaults, o as CacheResult, r as QueryCachePluginOptions, s as CacheStatus, t as CrossResourceRule } from "../queryCachePlugin-
|
|
1
|
+
import { i as CacheStore, n as CacheSetOptions, r as CacheStats, t as CacheLogger } from "../interface-bpoLKKqx.mjs";
|
|
2
|
+
import { a as CacheEnvelope, c as QueryCache, i as queryCachePlugin, l as QueryCacheConfig, n as QueryCacheDefaults, o as CacheResult, r as QueryCachePluginOptions, s as CacheStatus, t as CrossResourceRule } from "../queryCachePlugin-BCFVXnxK.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/cache/keys.d.ts
|
|
5
5
|
/**
|
package/dist/cache/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as versionKey, n as hashParams, r as tagVersionKey, t as buildQueryKey } from "../keys-qcD-TVJl.mjs";
|
|
2
2
|
import { t as MemoryCacheStore } from "../memory-Cp7_cAko.mjs";
|
|
3
|
-
import { r as QueryCache, t as queryCachePlugin } from "../queryCachePlugin-
|
|
3
|
+
import { r as QueryCache, t as queryCachePlugin } from "../queryCachePlugin-D0iIVhW_.mjs";
|
|
4
4
|
//#region src/cache/redis.ts
|
|
5
5
|
/**
|
|
6
6
|
* Redis-backed cache store.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as ResourceRegistry } from "../../ResourceRegistry-
|
|
2
|
-
import { t as buildOpenApiSpec } from "../../openapi-
|
|
1
|
+
import { t as ResourceRegistry } from "../../ResourceRegistry-BOtJuRCs.mjs";
|
|
2
|
+
import { t as buildOpenApiSpec } from "../../openapi-AYLVjqVe.mjs";
|
|
3
3
|
import { dirname, resolve } from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as pluralize } from "../../pluralize-
|
|
1
|
+
import { t as pluralize } from "../../pluralize-BneOJkpi.mjs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
4
|
//#region src/cli/commands/generate.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ResourceRegistry } from "../../ResourceRegistry-
|
|
1
|
+
import { t as ResourceRegistry } from "../../ResourceRegistry-BOtJuRCs.mjs";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
//#region src/cli/commands/introspect.ts
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { At as
|
|
2
|
-
import { A as MutationOperation, C as HOOK_PHASES, D as MAX_REGEX_LENGTH, E as MAX_FILTER_DEPTH, M as SYSTEM_FIELDS, O as MAX_SEARCH_LENGTH, S as HOOK_OPERATIONS, T as HookPhase, _ as DEFAULT_LIMIT, a as getControllerScope, b as DEFAULT_TENANT_FIELD, c as createCrudRouter, d as ActionRouterConfig, f as IdempotencyService, g as DEFAULT_ID_FIELD, h as CrudOperation, i as getControllerContext, j as RESERVED_QUERY_PARAMS, k as MUTATION_OPERATIONS, l as createPermissionMiddleware, m as CRUD_OPERATIONS, n as createFastifyHandler, o as sendControllerResponse, p as createActionRouter, r as createRequestContext, s as defineResourceVariants, t as createCrudHandlers, u as ActionHandler, v as DEFAULT_MAX_LIMIT, w as HookOperation, x as DEFAULT_UPDATE_METHOD, y as DEFAULT_SORT } from "../index-
|
|
1
|
+
import { At as BaseController, Ft as BodySanitizerConfig, It as AccessControl, Jt as defineResource, Lt as AccessControlConfig, Mt as QueryResolver, Nt as QueryResolverConfig, Pt as BodySanitizer, jt as BaseControllerOptions, qt as ResourceDefinition } from "../interface-IJqN3pXK.mjs";
|
|
2
|
+
import { A as MutationOperation, C as HOOK_PHASES, D as MAX_REGEX_LENGTH, E as MAX_FILTER_DEPTH, M as SYSTEM_FIELDS, O as MAX_SEARCH_LENGTH, S as HOOK_OPERATIONS, T as HookPhase, _ as DEFAULT_LIMIT, a as getControllerScope, b as DEFAULT_TENANT_FIELD, c as createCrudRouter, d as ActionRouterConfig, f as IdempotencyService, g as DEFAULT_ID_FIELD, h as CrudOperation, i as getControllerContext, j as RESERVED_QUERY_PARAMS, k as MUTATION_OPERATIONS, l as createPermissionMiddleware, m as CRUD_OPERATIONS, n as createFastifyHandler, o as sendControllerResponse, p as createActionRouter, r as createRequestContext, s as defineResourceVariants, t as createCrudHandlers, u as ActionHandler, v as DEFAULT_MAX_LIMIT, w as HookOperation, x as DEFAULT_UPDATE_METHOD, y as DEFAULT_SORT } from "../index-qct60lnl.mjs";
|
|
3
3
|
export { AccessControl, AccessControlConfig, ActionHandler, ActionRouterConfig, BaseController, BaseControllerOptions, BodySanitizer, BodySanitizerConfig, CRUD_OPERATIONS, CrudOperation, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, HOOK_OPERATIONS, HOOK_PHASES, HookOperation, HookPhase, IdempotencyService, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, MutationOperation, QueryResolver, QueryResolverConfig, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, createActionRouter, createCrudHandlers, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, defineResource, defineResourceVariants, getControllerContext, getControllerScope, sendControllerResponse };
|
package/dist/core/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
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-Cxde4rpC.mjs";
|
|
2
2
|
import { i as AccessControl, n as QueryResolver, r as BodySanitizer, t as BaseController } from "../BaseController-CpMfCXdn.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { c as createCrudHandlers, d as getControllerContext, f as getControllerScope, l as createFastifyHandler, n as defineResource, o as createCrudRouter, p as sendControllerResponse, s as createPermissionMiddleware, t as ResourceDefinition, u as createRequestContext } from "../defineResource-
|
|
3
|
+
import { t as createActionRouter } from "../createActionRouter-CbkIAaGh.mjs";
|
|
4
|
+
import { c as createCrudHandlers, d as getControllerContext, f as getControllerScope, l as createFastifyHandler, n as defineResource, o as createCrudRouter, p as sendControllerResponse, s as createPermissionMiddleware, t as ResourceDefinition, u as createRequestContext } from "../defineResource-CovBXvTB.mjs";
|
|
5
|
+
import { t as defineResourceVariants } from "../core-BfrfxNqO.mjs";
|
|
5
6
|
export { AccessControl, BaseController, BodySanitizer, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, QueryResolver, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, createActionRouter, createCrudHandlers, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, defineResource, defineResourceVariants, getControllerContext, getControllerScope, sendControllerResponse };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { n as defineResource } from "./defineResource-CovBXvTB.mjs";
|
|
2
|
+
//#region src/core/defineResourceVariants.ts
|
|
3
|
+
/**
|
|
4
|
+
* Define multiple resources from a shared base config and per-variant overrides.
|
|
5
|
+
*
|
|
6
|
+
* Each variant is independently passed through `defineResource()` — the
|
|
7
|
+
* returned `ResourceDefinition`s are real, fully-registered resources.
|
|
8
|
+
* Register each one's plugin in your app:
|
|
9
|
+
*
|
|
10
|
+
* ```typescript
|
|
11
|
+
* await app.register(articlePublic.toPlugin());
|
|
12
|
+
* await app.register(articleAdmin.toPlugin());
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param base Shared config — adapter, queryParser, schemaOptions, hooks, etc.
|
|
16
|
+
* Must NOT include `name` or `prefix` (those are per-variant).
|
|
17
|
+
* @param variants Map of variant key → override. Each variant must declare
|
|
18
|
+
* its own `name` and `prefix`. Other fields override the base.
|
|
19
|
+
* @returns A record where each key from `variants` maps to a real
|
|
20
|
+
* `ResourceDefinition` ready for `.toPlugin()` registration.
|
|
21
|
+
*/
|
|
22
|
+
function defineResourceVariants(base, variants) {
|
|
23
|
+
const out = {};
|
|
24
|
+
for (const key of Object.keys(variants)) {
|
|
25
|
+
const override = variants[key];
|
|
26
|
+
out[key] = defineResource({
|
|
27
|
+
...base,
|
|
28
|
+
...override
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { defineResourceVariants as t };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
|
|
1
2
|
import { n as normalizePermissionResult, t as applyPermissionResult } from "./applyPermissionResult-D6GPMsvh.mjs";
|
|
2
|
-
import { n as defineResource } from "./defineResource-DZzyl4a4.mjs";
|
|
3
3
|
//#region src/core/createActionRouter.ts
|
|
4
|
+
var createActionRouter_exports = /* @__PURE__ */ __exportAll({ createActionRouter: () => createActionRouter });
|
|
4
5
|
/**
|
|
5
6
|
* Create action-based state transition endpoint
|
|
6
7
|
*
|
|
@@ -24,9 +25,10 @@ function createActionRouter(fastify, config) {
|
|
|
24
25
|
} };
|
|
25
26
|
Object.entries(actionSchemas).forEach(([actionName, schema]) => {
|
|
26
27
|
if (schema && typeof schema === "object") Object.entries(schema).forEach(([propName, propSchema]) => {
|
|
28
|
+
const schemaObj = propSchema;
|
|
27
29
|
bodyProperties[propName] = {
|
|
28
|
-
...
|
|
29
|
-
description: `${
|
|
30
|
+
...schemaObj,
|
|
31
|
+
description: `${schemaObj.description || ""} (for ${actionName} action)`.trim()
|
|
30
32
|
};
|
|
31
33
|
});
|
|
32
34
|
});
|
|
@@ -178,36 +180,4 @@ function buildActionDescription(actions, actionPermissions) {
|
|
|
178
180
|
return lines.join("\n");
|
|
179
181
|
}
|
|
180
182
|
//#endregion
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Define multiple resources from a shared base config and per-variant overrides.
|
|
184
|
-
*
|
|
185
|
-
* Each variant is independently passed through `defineResource()` — the
|
|
186
|
-
* returned `ResourceDefinition`s are real, fully-registered resources.
|
|
187
|
-
* Register each one's plugin in your app:
|
|
188
|
-
*
|
|
189
|
-
* ```typescript
|
|
190
|
-
* await app.register(articlePublic.toPlugin());
|
|
191
|
-
* await app.register(articleAdmin.toPlugin());
|
|
192
|
-
* ```
|
|
193
|
-
*
|
|
194
|
-
* @param base Shared config — adapter, queryParser, schemaOptions, hooks, etc.
|
|
195
|
-
* Must NOT include `name` or `prefix` (those are per-variant).
|
|
196
|
-
* @param variants Map of variant key → override. Each variant must declare
|
|
197
|
-
* its own `name` and `prefix`. Other fields override the base.
|
|
198
|
-
* @returns A record where each key from `variants` maps to a real
|
|
199
|
-
* `ResourceDefinition` ready for `.toPlugin()` registration.
|
|
200
|
-
*/
|
|
201
|
-
function defineResourceVariants(base, variants) {
|
|
202
|
-
const out = {};
|
|
203
|
-
for (const key of Object.keys(variants)) {
|
|
204
|
-
const override = variants[key];
|
|
205
|
-
out[key] = defineResource({
|
|
206
|
-
...base,
|
|
207
|
-
...override
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
return out;
|
|
211
|
-
}
|
|
212
|
-
//#endregion
|
|
213
|
-
export { createActionRouter as n, defineResourceVariants as t };
|
|
183
|
+
export { createActionRouter_exports as n, createActionRouter as t };
|
|
@@ -207,7 +207,7 @@ async function registerArcCore(fastify, config, trackPlugin) {
|
|
|
207
207
|
await fastify.register(arcCorePlugin, { emitEvents: config.arcPlugins?.emitEvents !== false });
|
|
208
208
|
trackPlugin("arc-core");
|
|
209
209
|
if (config.arcPlugins?.events !== false) {
|
|
210
|
-
const { default: eventPlugin } = await import("./eventPlugin-
|
|
210
|
+
const { default: eventPlugin } = await import("./eventPlugin-x4jo3sG0.mjs").then((n) => n.n);
|
|
211
211
|
const eventOpts = typeof config.arcPlugins?.events === "object" ? config.arcPlugins.events : {};
|
|
212
212
|
await fastify.register(eventPlugin, {
|
|
213
213
|
...eventOpts,
|
|
@@ -243,13 +243,13 @@ async function registerArcPlugins(fastify, config, trackPlugin, modules) {
|
|
|
243
243
|
trackPlugin("arc-graceful-shutdown");
|
|
244
244
|
}
|
|
245
245
|
if (config.arcPlugins?.caching) {
|
|
246
|
-
const { default: cachingPlugin } = await import("./caching-
|
|
246
|
+
const { default: cachingPlugin } = await import("./caching-CHH-iHs3.mjs").then((n) => n.r);
|
|
247
247
|
const opts = config.arcPlugins.caching === true ? {} : config.arcPlugins.caching;
|
|
248
248
|
await fastify.register(cachingPlugin, opts);
|
|
249
249
|
trackPlugin("arc-caching", opts);
|
|
250
250
|
}
|
|
251
251
|
if (config.arcPlugins?.queryCache) {
|
|
252
|
-
const { queryCachePlugin } = await import("./queryCachePlugin-
|
|
252
|
+
const { queryCachePlugin } = await import("./queryCachePlugin-D0iIVhW_.mjs").then((n) => n.n);
|
|
253
253
|
const opts = config.arcPlugins.queryCache === true ? {} : config.arcPlugins.queryCache;
|
|
254
254
|
const store = config.stores?.queryCache ?? new (await (import("./memory-Cp7_cAko.mjs").then((n) => n.n))).MemoryCacheStore();
|
|
255
255
|
await fastify.register(queryCachePlugin, {
|
|
@@ -260,19 +260,19 @@ async function registerArcPlugins(fastify, config, trackPlugin, modules) {
|
|
|
260
260
|
}
|
|
261
261
|
if (config.arcPlugins?.sse) if (config.arcPlugins?.events === false) fastify.log.warn("SSE plugin requires events plugin (arcPlugins.events). SSE disabled.");
|
|
262
262
|
else {
|
|
263
|
-
const { default: ssePlugin } = await import("./sse-
|
|
263
|
+
const { default: ssePlugin } = await import("./sse-CD5Hghpu.mjs").then((n) => n.r);
|
|
264
264
|
const opts = config.arcPlugins.sse === true ? {} : config.arcPlugins.sse;
|
|
265
265
|
await fastify.register(ssePlugin, opts);
|
|
266
266
|
trackPlugin("arc-sse", opts);
|
|
267
267
|
}
|
|
268
268
|
if (config.arcPlugins?.metrics) {
|
|
269
|
-
const { default: metricsPlugin } = await import("./metrics-
|
|
269
|
+
const { default: metricsPlugin } = await import("./metrics-DuhiSEZI.mjs").then((n) => n.r);
|
|
270
270
|
const opts = config.arcPlugins.metrics === true ? {} : config.arcPlugins.metrics;
|
|
271
271
|
await fastify.register(metricsPlugin, opts);
|
|
272
272
|
trackPlugin("arc-metrics", opts);
|
|
273
273
|
}
|
|
274
274
|
if (config.arcPlugins?.versioning) {
|
|
275
|
-
const { default: versioningPlugin } = await import("./versioning-
|
|
275
|
+
const { default: versioningPlugin } = await import("./versioning-CPU_5Xfs.mjs").then((n) => n.r);
|
|
276
276
|
await fastify.register(versioningPlugin, config.arcPlugins.versioning);
|
|
277
277
|
trackPlugin("arc-versioning", config.arcPlugins.versioning);
|
|
278
278
|
}
|
|
@@ -340,7 +340,7 @@ async function registerAuth(fastify, config, trackPlugin) {
|
|
|
340
340
|
*/
|
|
341
341
|
async function registerElevation(fastify, config, trackPlugin) {
|
|
342
342
|
if (!config.elevation) return;
|
|
343
|
-
const { elevationPlugin } = await import("./elevation-
|
|
343
|
+
const { elevationPlugin } = await import("./elevation-BBGFjzIP.mjs").then((n) => n.r);
|
|
344
344
|
await fastify.register(elevationPlugin, config.elevation);
|
|
345
345
|
trackPlugin("arc-elevation", config.elevation);
|
|
346
346
|
fastify.log.debug("Elevation plugin enabled");
|
|
@@ -350,7 +350,7 @@ async function registerElevation(fastify, config, trackPlugin) {
|
|
|
350
350
|
*/
|
|
351
351
|
async function registerErrorHandler(fastify, config, trackPlugin) {
|
|
352
352
|
if (config.errorHandler === false) return;
|
|
353
|
-
const { errorHandlerPlugin } = await import("./errorHandler-
|
|
353
|
+
const { errorHandlerPlugin } = await import("./errorHandler-BW08lEiy.mjs").then((n) => n.n);
|
|
354
354
|
const errorOpts = typeof config.errorHandler === "object" ? config.errorHandler : { includeStack: config.preset !== "production" };
|
|
355
355
|
await fastify.register(errorHandlerPlugin, errorOpts);
|
|
356
356
|
trackPlugin("arc-error-handler", errorOpts);
|
|
@@ -667,7 +667,7 @@ function validateDistributedRuntime(options) {
|
|
|
667
667
|
*/
|
|
668
668
|
async function createApp(options) {
|
|
669
669
|
if (options.debug !== void 0 && options.debug !== false) {
|
|
670
|
-
const { configureArcLogger } = await import("./logger-
|
|
670
|
+
const { configureArcLogger } = await import("./logger-CDjpjySd.mjs").then((n) => n.r);
|
|
671
671
|
configureArcLogger({ debug: options.debug });
|
|
672
672
|
}
|
|
673
673
|
validateAuthOptions(options);
|
|
@@ -720,7 +720,7 @@ async function createApp(options) {
|
|
|
720
720
|
await registerErrorHandler(fastify, config, trackPlugin);
|
|
721
721
|
await registerResources(fastify, config);
|
|
722
722
|
if (config.replyHelpers) {
|
|
723
|
-
const { replyHelpersPlugin } = await import("./replyHelpers-
|
|
723
|
+
const { replyHelpersPlugin } = await import("./replyHelpers-CXtJDAZ0.mjs").then((n) => n.n);
|
|
724
724
|
await fastify.register(replyHelpersPlugin);
|
|
725
725
|
}
|
|
726
726
|
if (config.serializeBigInt) fastify.addHook("preSerialization", async (_request, _reply, payload) => {
|
|
@@ -7,7 +7,7 @@ import { n as normalizePermissionResult, t as applyPermissionResult } from "./ap
|
|
|
7
7
|
import { t as requestContext } from "./requestContext-xHIKedG6.mjs";
|
|
8
8
|
import { i as getDefaultCrudSchemas } from "./utils-B-l6410F.mjs";
|
|
9
9
|
import { r as ForbiddenError } from "./errors-Cg58SLNi.mjs";
|
|
10
|
-
import { n as convertRouteSchema, t as convertOpenApiSchemas } from "./schemaConverter-
|
|
10
|
+
import { n as convertRouteSchema, t as convertOpenApiSchemas } from "./schemaConverter-Y5EejTnJ.mjs";
|
|
11
11
|
import { t as hasEvents } from "./typeGuards-CcFZXgU7.mjs";
|
|
12
12
|
import { r as getAvailablePresets, t as applyPresets } from "./presets-BFrGvvjL.mjs";
|
|
13
13
|
//#region src/pipeline/pipe.ts
|
|
@@ -869,11 +869,6 @@ function assertValidConfig(config, options) {
|
|
|
869
869
|
const errorMsg = formatValidationErrors(config.name ?? "unknown", result);
|
|
870
870
|
throw new Error(errorMsg);
|
|
871
871
|
}
|
|
872
|
-
if (result.warnings.length > 0 && process.env.NODE_ENV !== "production") console.warn(formatValidationErrors(config.name ?? "unknown", {
|
|
873
|
-
valid: true,
|
|
874
|
-
errors: [],
|
|
875
|
-
warnings: result.warnings
|
|
876
|
-
}));
|
|
877
872
|
}
|
|
878
873
|
//#endregion
|
|
879
874
|
//#region src/core/defineResource.ts
|
|
@@ -893,6 +888,25 @@ function defineResource(config) {
|
|
|
893
888
|
if (typeof route.permissions !== "function") throw new Error(`[Arc] Resource '${config.name}' route ${route.method} ${route.path}: permissions is required and must be a PermissionCheck function.\nUse allowPublic() or requireAuth() from @classytic/arc/permissions.`);
|
|
894
889
|
if (typeof route.wrapHandler !== "boolean") throw new Error(`[Arc] Resource '${config.name}' route ${route.method} ${route.path}: wrapHandler is required.\nSet true for ControllerHandler (context object) or false for FastifyHandler (req, reply).`);
|
|
895
890
|
}
|
|
891
|
+
if (config.routes && config.additionalRoutes) throw new Error(`[Arc] Resource '${config.name}': Cannot use both 'routes' and 'additionalRoutes'.\nUse 'routes' (v2.8) — it replaces 'additionalRoutes'.`);
|
|
892
|
+
for (const route of config.routes ?? []) if (typeof route.permissions !== "function") throw new Error(`[Arc] Resource '${config.name}' route ${route.method} ${route.path}: permissions is required and must be a PermissionCheck function.`);
|
|
893
|
+
if (config.actions) {
|
|
894
|
+
const CRUD_OPS = new Set([
|
|
895
|
+
"create",
|
|
896
|
+
"update",
|
|
897
|
+
"delete",
|
|
898
|
+
"list",
|
|
899
|
+
"get"
|
|
900
|
+
]);
|
|
901
|
+
for (const [name, entry] of Object.entries(config.actions)) {
|
|
902
|
+
if (CRUD_OPS.has(name)) throw new Error(`[Arc] Resource '${config.name}': action '${name}' conflicts with CRUD operation.\nUse a different name (e.g., '${name}_item', 'do_${name}').`);
|
|
903
|
+
if (typeof entry !== "function") {
|
|
904
|
+
const def = entry;
|
|
905
|
+
if (typeof def.handler !== "function") throw new Error(`[Arc] Resource '${config.name}': actions.${name}.handler must be a function.`);
|
|
906
|
+
if (def.permissions !== void 0 && typeof def.permissions !== "function") throw new Error(`[Arc] Resource '${config.name}': actions.${name}.permissions must be a PermissionCheck function.`);
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
}
|
|
896
910
|
}
|
|
897
911
|
const repository = config.adapter?.repository;
|
|
898
912
|
if (config.idField === void 0 && repository) {
|
|
@@ -1076,6 +1090,8 @@ var ResourceDefinition = class {
|
|
|
1076
1090
|
middlewares;
|
|
1077
1091
|
disableDefaultRoutes;
|
|
1078
1092
|
disabledRoutes;
|
|
1093
|
+
actions;
|
|
1094
|
+
actionPermissions;
|
|
1079
1095
|
events;
|
|
1080
1096
|
rateLimit;
|
|
1081
1097
|
audit;
|
|
@@ -1101,10 +1117,12 @@ var ResourceDefinition = class {
|
|
|
1101
1117
|
this.schemaOptions = config.schemaOptions ?? {};
|
|
1102
1118
|
this.customSchemas = config.customSchemas ?? {};
|
|
1103
1119
|
this.permissions = config.permissions ?? {};
|
|
1104
|
-
this.additionalRoutes = config.additionalRoutes ?? [];
|
|
1120
|
+
this.additionalRoutes = config.routes ? convertRoutesToAdditionalRoutes(config.routes) : config.additionalRoutes ?? [];
|
|
1105
1121
|
this.middlewares = config.middlewares ?? {};
|
|
1106
1122
|
this.disableDefaultRoutes = config.disableDefaultRoutes ?? false;
|
|
1107
1123
|
this.disabledRoutes = config.disabledRoutes ?? [];
|
|
1124
|
+
this.actions = config.actions;
|
|
1125
|
+
this.actionPermissions = config.actionPermissions;
|
|
1108
1126
|
this.events = config.events ?? {};
|
|
1109
1127
|
this.rateLimit = config.rateLimit;
|
|
1110
1128
|
this.audit = config.audit;
|
|
@@ -1172,10 +1190,10 @@ var ResourceDefinition = class {
|
|
|
1172
1190
|
pattern,
|
|
1173
1191
|
tags
|
|
1174
1192
|
});
|
|
1175
|
-
const onRegister = self._onRegister;
|
|
1176
|
-
if (onRegister) await onRegister(fastify);
|
|
1177
1193
|
await fastify.register(async (instance) => {
|
|
1178
1194
|
const typedInstance = instance;
|
|
1195
|
+
const onRegister = self._onRegister;
|
|
1196
|
+
if (onRegister) await onRegister(instance);
|
|
1179
1197
|
let schemas = null;
|
|
1180
1198
|
const openApi = self._registryMeta?.openApiSchemas;
|
|
1181
1199
|
if (openApi && (!self.customSchemas || Object.keys(self.customSchemas).length === 0)) {
|
|
@@ -1264,6 +1282,10 @@ var ResourceDefinition = class {
|
|
|
1264
1282
|
pipe: self.pipe,
|
|
1265
1283
|
fields: self.fields
|
|
1266
1284
|
});
|
|
1285
|
+
if (self.actions && Object.keys(self.actions).length > 0) {
|
|
1286
|
+
const { createActionRouter } = await import("./createActionRouter-CbkIAaGh.mjs").then((n) => n.n);
|
|
1287
|
+
createActionRouter(instance, normalizeActionsToRouterConfig(self.actions, self.actionPermissions, self.tag));
|
|
1288
|
+
}
|
|
1267
1289
|
if (self.events && Object.keys(self.events).length > 0) typedInstance.log?.debug?.(`Resource '${self.name}' defined ${Object.keys(self.events).length} events`);
|
|
1268
1290
|
}, { prefix: self.prefix });
|
|
1269
1291
|
if (hasEvents(fastify)) try {
|
|
@@ -1317,5 +1339,49 @@ function capitalize(str) {
|
|
|
1317
1339
|
if (!str) return "";
|
|
1318
1340
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1319
1341
|
}
|
|
1342
|
+
/**
|
|
1343
|
+
* Convert v2.8 RouteDefinition[] to internal AdditionalRoute[] format.
|
|
1344
|
+
* The internal format is what createCrudRouter understands.
|
|
1345
|
+
*/
|
|
1346
|
+
function convertRoutesToAdditionalRoutes(routes) {
|
|
1347
|
+
return routes.map((route) => ({
|
|
1348
|
+
method: route.method,
|
|
1349
|
+
path: route.path,
|
|
1350
|
+
handler: route.handler,
|
|
1351
|
+
permissions: route.permissions,
|
|
1352
|
+
wrapHandler: !route.raw,
|
|
1353
|
+
operation: route.operation,
|
|
1354
|
+
summary: route.summary,
|
|
1355
|
+
description: route.description,
|
|
1356
|
+
tags: route.tags,
|
|
1357
|
+
preHandler: route.preHandler,
|
|
1358
|
+
preAuth: route.preAuth,
|
|
1359
|
+
streamResponse: route.streamResponse,
|
|
1360
|
+
schema: route.schema,
|
|
1361
|
+
mcpHandler: route.mcpHandler
|
|
1362
|
+
}));
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1365
|
+
* Normalize ActionsMap into the ActionRouterConfig shape that createActionRouter expects.
|
|
1366
|
+
*/
|
|
1367
|
+
function normalizeActionsToRouterConfig(actions, globalAuth, tag) {
|
|
1368
|
+
const handlers = {};
|
|
1369
|
+
const permissions = {};
|
|
1370
|
+
const schemas = {};
|
|
1371
|
+
for (const [name, entry] of Object.entries(actions)) if (typeof entry === "function") handlers[name] = entry;
|
|
1372
|
+
else {
|
|
1373
|
+
const def = entry;
|
|
1374
|
+
handlers[name] = def.handler;
|
|
1375
|
+
if (def.permissions) permissions[name] = def.permissions;
|
|
1376
|
+
if (def.schema) schemas[name] = def.schema;
|
|
1377
|
+
}
|
|
1378
|
+
return {
|
|
1379
|
+
tag,
|
|
1380
|
+
actions: handlers,
|
|
1381
|
+
actionPermissions: permissions,
|
|
1382
|
+
actionSchemas: schemas,
|
|
1383
|
+
globalAuth
|
|
1384
|
+
};
|
|
1385
|
+
}
|
|
1320
1386
|
//#endregion
|
|
1321
1387
|
export { validateResourceConfig as a, createCrudHandlers as c, getControllerContext as d, getControllerScope as f, formatValidationErrors as i, createFastifyHandler as l, pipe as m, defineResource as n, createCrudRouter as o, sendControllerResponse as p, assertValidConfig as r, createPermissionMiddleware as s, ResourceDefinition as t, createRequestContext as u };
|
package/dist/docs/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as ExternalOpenApiPaths } from "../externalPaths-
|
|
1
|
+
import { it as RegistryEntry } from "../interface-IJqN3pXK.mjs";
|
|
2
|
+
import { t as ExternalOpenApiPaths } from "../externalPaths-BQ8QijNH.mjs";
|
|
3
3
|
import { FastifyPluginAsync } from "fastify";
|
|
4
4
|
|
|
5
5
|
//#region src/docs/openapi.d.ts
|
package/dist/docs/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as getUserRoles } from "../types-ZUu_h0jp.mjs";
|
|
2
|
-
import { n as openApiPlugin, r as openapi_default, t as buildOpenApiSpec } from "../openapi-
|
|
2
|
+
import { n as openApiPlugin, r as openapi_default, t as buildOpenApiSpec } from "../openapi-AYLVjqVe.mjs";
|
|
3
3
|
import fp from "fastify-plugin";
|
|
4
4
|
//#region src/docs/scalar.ts
|
|
5
5
|
const scalarPlugin = async (fastify, opts = {}) => {
|
package/dist/dynamic/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as PermissionCheck } from "../types-
|
|
1
|
+
import { qt as ResourceDefinition, r as DataAdapter } from "../interface-IJqN3pXK.mjs";
|
|
2
|
+
import { t as PermissionCheck } from "../types-BoaZHr-2.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/dynamic/ArcDynamicLoader.d.ts
|
|
5
5
|
interface ArcArchitectureSchema {
|
package/dist/dynamic/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as ArcQueryParser } from "../queryParser-CgCtsjti.mjs";
|
|
2
|
-
import { n as defineResource } from "../defineResource-
|
|
2
|
+
import { n as defineResource } from "../defineResource-CovBXvTB.mjs";
|
|
3
3
|
import { C as publicRead, T as readOnly, b as fullPublic, v as adminOnly, w as publicReadAdminWrite, x as ownerWithAdminBypass, y as authenticated } from "../permissions-CH4cNwJi.mjs";
|
|
4
4
|
//#region src/dynamic/ArcDynamicLoader.ts
|
|
5
5
|
const VALID_FIELD_TYPES = new Set([
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
|
|
2
2
|
import { t as getUserRoles } from "./types-ZUu_h0jp.mjs";
|
|
3
|
-
import { t as arcLog } from "./logger-
|
|
3
|
+
import { t as arcLog } from "./logger-CDjpjySd.mjs";
|
|
4
4
|
import fp from "fastify-plugin";
|
|
5
5
|
//#region src/scope/elevation.ts
|
|
6
6
|
var elevation_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as EventTransport, n as EventHandler, r as EventLogger, t as DomainEvent } from "./EventTransport-
|
|
1
|
+
import { i as EventTransport, n as EventHandler, r as EventLogger, t as DomainEvent } from "./EventTransport-n1KBxC_N.mjs";
|
|
2
2
|
import { FastifyPluginAsync } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region src/events/defineEvent.d.ts
|
package/dist/events/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as MemoryEventTransport, i as EventTransport, n as EventHandler, o as MemoryEventTransportOptions, r as EventLogger, s as createEvent, t as DomainEvent } from "../EventTransport-
|
|
2
|
-
import { a as withRetry, c as EventDefinitionOutput, d as EventSchema, f as ValidationResult, i as createDeadLetterPublisher, l as EventRegistry, m as defineEvent, n as eventPlugin, o as CustomValidator, p as createEventRegistry, r as RetryOptions, s as EventDefinitionInput, t as EventPluginOptions, u as EventRegistryOptions } from "../eventPlugin-
|
|
1
|
+
import { a as MemoryEventTransport, i as EventTransport, n as EventHandler, o as MemoryEventTransportOptions, r as EventLogger, s as createEvent, t as DomainEvent } from "../EventTransport-n1KBxC_N.mjs";
|
|
2
|
+
import { a as withRetry, c as EventDefinitionOutput, d as EventSchema, f as ValidationResult, i as createDeadLetterPublisher, l as EventRegistry, m as defineEvent, n as eventPlugin, o as CustomValidator, p as createEventRegistry, r as RetryOptions, s as EventDefinitionInput, t as EventPluginOptions, u as EventRegistryOptions } from "../eventPlugin-CAOWMQS8.mjs";
|
|
3
3
|
import { RedisEventTransportOptions, RedisLike } from "./transports/redis.mjs";
|
|
4
|
-
import { r as RedisStreamTransportOptions, t as RedisStreamLike } from "../redis-stream-
|
|
4
|
+
import { r as RedisStreamTransportOptions, t as RedisStreamLike } from "../redis-stream-CF1lrKVk.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/events/eventTypes.d.ts
|
|
7
7
|
/**
|
package/dist/events/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as MemoryEventTransport, i as withRetry, o as createEvent, r as createDeadLetterPublisher, t as eventPlugin } from "../eventPlugin-
|
|
1
|
+
import { a as MemoryEventTransport, i as withRetry, o as createEvent, r as createDeadLetterPublisher, t as eventPlugin } from "../eventPlugin-x4jo3sG0.mjs";
|
|
2
2
|
//#region src/events/defineEvent.ts
|
|
3
3
|
/**
|
|
4
4
|
* defineEvent — Typed Event Definitions with Optional Schema Validation
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as RedisStreamTransport, r as RedisStreamTransportOptions, t as RedisStreamLike } from "../../redis-stream-
|
|
1
|
+
import { n as RedisStreamTransport, r as RedisStreamTransportOptions, t as RedisStreamLike } from "../../redis-stream-CF1lrKVk.mjs";
|
|
2
2
|
export { type RedisStreamLike, RedisStreamTransport, type RedisStreamTransportOptions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as EventTransport, n as EventHandler, r as EventLogger, t as DomainEvent } from "../../EventTransport-
|
|
1
|
+
import { i as EventTransport, n as EventHandler, r as EventLogger, t as DomainEvent } from "../../EventTransport-n1KBxC_N.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/events/transports/redis.d.ts
|
|
4
4
|
interface RedisLike {
|
package/dist/factory/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CustomPluginAuthOption, c as RawBodyOptions, d as ResourceLike, f as loadResources, i as CustomAuthenticatorOption, l as UnderPressureOptions, n as BetterAuthOption, o as JwtAuthOption, r as CreateAppOptions, s as MultipartOptions, t as AuthOption, u as LoadResourcesOptions } from "../types-
|
|
1
|
+
import { a as CustomPluginAuthOption, c as RawBodyOptions, d as ResourceLike, f as loadResources, i as CustomAuthenticatorOption, l as UnderPressureOptions, n as BetterAuthOption, o as JwtAuthOption, r as CreateAppOptions, s as MultipartOptions, t as AuthOption, u as LoadResourcesOptions } from "../types-gUxAIZHp.mjs";
|
|
2
2
|
import { FastifyInstance } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region src/factory/createApp.d.ts
|