@classytic/arc 2.7.1 → 2.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -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/redis-session.d.mts +1 -1
- package/dist/cache/index.d.mts +2 -2
- package/dist/cli/commands/docs.mjs +1 -1
- package/dist/cli/commands/generate.mjs +1 -1
- package/dist/core/index.d.mts +2 -2
- package/dist/{createApp-B_nvKNAQ.mjs → createApp-D7e77m8C.mjs} +18 -7
- 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/{errorHandler-DXUttWEO.mjs → errorHandler-CH8wk1eD.mjs} +16 -1
- package/dist/{errorHandler-COa51ho_.d.mts → errorHandler-pCpEtNd7.d.mts} +46 -2
- package/dist/{eventPlugin-DsaNNXzZ.mjs → eventPlugin-B6U_nCFU.mjs} +3 -2
- package/dist/{eventPlugin-BgLxJkIB.d.mts → eventPlugin-CdvUoUna.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 +1 -1
- package/dist/hooks/index.d.mts +1 -1
- package/dist/idempotency/index.d.mts +3 -3
- package/dist/idempotency/mongodb.d.mts +1 -1
- package/dist/idempotency/redis.d.mts +1 -1
- package/dist/{index-BYpRGXif.d.mts → index-B0extFr4.d.mts} +3 -3
- package/dist/{index-KXM8_JmQ.d.mts → index-BjShrzoj.d.mts} +3 -3
- package/dist/{index-StgFaQKD.d.mts → index-C9eYNjGR.d.mts} +1 -1
- package/dist/index.d.mts +8 -7
- package/dist/index.mjs +1 -1
- 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 +8 -5
- package/dist/integrations/mcp/testing.d.mts +1 -1
- package/dist/integrations/mcp/testing.mjs +1 -1
- package/dist/integrations/webhooks.d.mts +58 -1
- package/dist/integrations/webhooks.mjs +78 -7
- package/dist/integrations/websocket.d.mts +7 -1
- package/dist/integrations/websocket.mjs +7 -1
- package/dist/{interface-Dwzqt4mn.d.mts → interface-B91alUzq.d.mts} +4 -4
- package/dist/{mongodb-Bq90j-Uj.d.mts → mongodb-B7zupyck.d.mts} +1 -1
- package/dist/{mongodb-DdyYlIXg.d.mts → mongodb-Cgu9F1Nd.d.mts} +1 -1
- package/dist/org/index.d.mts +2 -2
- package/dist/permissions/index.d.mts +3 -3
- package/dist/plugins/index.d.mts +52 -5
- package/dist/plugins/index.mjs +5 -4
- 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-Bw8XyJpX.d.mts → queryCachePlugin-Ckl71mkc.d.mts} +1 -1
- package/dist/{redis-CyCntzTO.d.mts → redis-3TQxm2VZ.d.mts} +1 -1
- package/dist/{redis-stream-We_Ucl9-.d.mts → redis-stream-Dag5LFa9.d.mts} +1 -1
- package/dist/registry/index.d.mts +1 -1
- package/dist/replyHelpers-uDUIYh7u.mjs +40 -0
- package/dist/{resourceToTools-CkVSSzKg.mjs → resourceToTools-BJkoQoUP.mjs} +11 -5
- package/dist/rpc/index.d.mts +1 -1
- package/dist/scope/index.d.mts +2 -2
- package/dist/testing/index.d.mts +2 -2
- package/dist/testing/index.mjs +1 -1
- package/dist/types/index.d.mts +4 -4
- package/dist/{types-D0qf0Mf4.d.mts → types-2FlNl0mL.d.mts} +44 -9
- package/dist/{types-DPsC0taJ.d.mts → types-B4BNthET.d.mts} +1 -1
- package/dist/{types-ClmkMDK1.d.mts → types-C5g2oRC7.d.mts} +18 -2
- package/dist/utils/index.d.mts +3 -3
- package/package.json +5 -2
- package/skills/arc/SKILL.md +62 -1
- package/skills/arc/references/integrations.md +32 -7
- package/skills/arc/references/mcp.md +31 -7
- package/skills/arc/references/production.md +69 -0
- /package/dist/{EventTransport-CUpRK_Lg.d.mts → EventTransport-C4VheKeC.d.mts} +0 -0
- /package/dist/{circuitBreaker-DwxrljLB.d.mts → circuitBreaker-BBPDt-J_.d.mts} +0 -0
- /package/dist/{elevation-Dm-HTBCt.d.mts → elevation-D7WK0RXq.d.mts} +0 -0
- /package/dist/{errors-CCSsMpXE.d.mts → errors-BS6lZvWy.d.mts} +0 -0
- /package/dist/{externalPaths-Dg7OLsKo.d.mts → externalPaths-iba7jD3d.d.mts} +0 -0
- /package/dist/{fields-CYuLMJPD.d.mts → fields-D4nMDqnK.d.mts} +0 -0
- /package/dist/{interface-CnluRL4_.d.mts → interface-CG7oRZjX.d.mts} +0 -0
- /package/dist/{interface-B9rHWPxD.d.mts → interface-CSbZdv_3.d.mts} +0 -0
- /package/dist/{mongodb-mlgxkYI3.mjs → mongodb-B7X7P1P8.mjs} +0 -0
- /package/dist/{openapi-C5UhIeWu.mjs → openapi-BBSTVcMm.mjs} +0 -0
- /package/dist/{pluralize-COpOVar8.mjs → pluralize-Dckfq6US.mjs} +0 -0
- /package/dist/{sessionManager-IW4sbIea.d.mts → sessionManager-CEo9jwPI.d.mts} +0 -0
- /package/dist/{sse-Bp3dabF1.mjs → sse-6W0hjVS_.mjs} +0 -0
- /package/dist/{tracing-65B51Dw3.d.mts → tracing-DEqdGkr-.d.mts} +0 -0
- /package/dist/{types-CNEbix8T.d.mts → types--D3vvfdt.d.mts} +0 -0
- /package/dist/{versioning-aUUVziBY.mjs → versioning-CdBbFefk.mjs} +0 -0
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @classytic/arc
|
|
2
2
|
|
|
3
|
-
Database-agnostic resource framework for Fastify. Define resources, get CRUD routes, permissions, presets, caching, events, and
|
|
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
|
-
**
|
|
5
|
+
**v2.7.3** | Fastify 5+ | Node.js 22+ | ESM only | 260+ test files, 3523+ tests
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -690,9 +690,21 @@ npx @classytic/arc doctor # Health check
|
|
|
690
690
|
| `@classytic/arc/integrations/websocket` | WebSocket |
|
|
691
691
|
| `@classytic/arc/integrations/event-gateway` | Unified SSE + WebSocket gateway |
|
|
692
692
|
| `@classytic/arc/integrations/streamline` | Workflow orchestration |
|
|
693
|
+
| `@classytic/arc/mcp` | MCP tools for AI agents |
|
|
693
694
|
| `@classytic/arc/docs` | OpenAPI generation |
|
|
694
695
|
| `@classytic/arc/cli` | CLI commands (programmatic) |
|
|
695
696
|
|
|
697
|
+
## v2.7.3 Highlights
|
|
698
|
+
|
|
699
|
+
- **MCP Integration** — expose resources as AI agent tools (stateless by default, service scope, multi-tenancy)
|
|
700
|
+
- **Reply Helpers** — `reply.ok()`, `reply.fail()`, `reply.paginated()`, `reply.stream()` (opt-in)
|
|
701
|
+
- **Error Mappers** — class-based `instanceof` domain error → HTTP response mapping
|
|
702
|
+
- **Multipart Body** — `multipartBody()` middleware for file upload in CRUD routes
|
|
703
|
+
- **Service Scope** — `kind: "service"` RequestScope for machine-to-machine auth (MCP + WebSocket)
|
|
704
|
+
- **BigInt Serialization** — `serializeBigInt: true` auto-converts BigInt → Number
|
|
705
|
+
- **Event WAL** — skips internal `arc.*` events to prevent startup timeout with durable stores
|
|
706
|
+
- **Security** — `auth: false` produces null `ctx.user` (prevents anonymous bypass of `!!ctx.user` guards)
|
|
707
|
+
|
|
696
708
|
## License
|
|
697
709
|
|
|
698
710
|
MIT
|
|
@@ -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-B91alUzq.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-C9eYNjGR.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-Cgu9F1Nd.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-Cgu9F1Nd.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-B7X7P1P8.mjs";
|
|
2
2
|
export { MongoAuditStore };
|
package/dist/auth/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as AuthPluginOptions, h as AuthHelpers } from "../interface-
|
|
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 { g as AuthPluginOptions, h as AuthHelpers } from "../interface-B91alUzq.mjs";
|
|
2
|
+
import { t as PermissionCheck } from "../types-B4BNthET.mjs";
|
|
3
|
+
import { t as ExternalOpenApiPaths } from "../externalPaths-iba7jD3d.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-CEo9jwPI.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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as SessionData, s as SessionStore } from "../sessionManager-
|
|
1
|
+
import { i as SessionData, s as SessionStore } from "../sessionManager-CEo9jwPI.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/auth/redis-session.d.ts
|
|
4
4
|
/** Minimal Redis client interface — compatible with ioredis */
|
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-CG7oRZjX.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-Ckl71mkc.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/cache/keys.d.ts
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as ResourceRegistry } from "../../ResourceRegistry-DsHiG9cL.mjs";
|
|
2
|
-
import { t as buildOpenApiSpec } from "../../openapi-
|
|
2
|
+
import { t as buildOpenApiSpec } from "../../openapi-BBSTVcMm.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-Dckfq6US.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
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { At as AccessControl, Dt as QueryResolverConfig, Et as QueryResolver, Ht as defineResource, Ot as BodySanitizer, Tt as BaseControllerOptions, Vt as ResourceDefinition, jt as AccessControlConfig, kt as BodySanitizerConfig, wt as BaseController } from "../interface-
|
|
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 AccessControl, Dt as QueryResolverConfig, Et as QueryResolver, Ht as defineResource, Ot as BodySanitizer, Tt as BaseControllerOptions, Vt as ResourceDefinition, jt as AccessControlConfig, kt as BodySanitizerConfig, wt as BaseController } from "../interface-B91alUzq.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-BjShrzoj.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 };
|
|
@@ -73,9 +73,8 @@ const productionPreset = {
|
|
|
73
73
|
*/
|
|
74
74
|
function devLoggerConfig() {
|
|
75
75
|
try {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
req.resolve("pino-pretty");
|
|
76
|
+
if (typeof import.meta?.resolve === "function") {
|
|
77
|
+
import.meta.resolve("pino-pretty");
|
|
79
78
|
return {
|
|
80
79
|
level: "debug",
|
|
81
80
|
transport: {
|
|
@@ -208,7 +207,7 @@ async function registerArcCore(fastify, config, trackPlugin) {
|
|
|
208
207
|
await fastify.register(arcCorePlugin, { emitEvents: config.arcPlugins?.emitEvents !== false });
|
|
209
208
|
trackPlugin("arc-core");
|
|
210
209
|
if (config.arcPlugins?.events !== false) {
|
|
211
|
-
const { default: eventPlugin } = await import("./eventPlugin-
|
|
210
|
+
const { default: eventPlugin } = await import("./eventPlugin-B6U_nCFU.mjs").then((n) => n.n);
|
|
212
211
|
const eventOpts = typeof config.arcPlugins?.events === "object" ? config.arcPlugins.events : {};
|
|
213
212
|
await fastify.register(eventPlugin, {
|
|
214
213
|
...eventOpts,
|
|
@@ -261,7 +260,7 @@ async function registerArcPlugins(fastify, config, trackPlugin, modules) {
|
|
|
261
260
|
}
|
|
262
261
|
if (config.arcPlugins?.sse) if (config.arcPlugins?.events === false) fastify.log.warn("SSE plugin requires events plugin (arcPlugins.events). SSE disabled.");
|
|
263
262
|
else {
|
|
264
|
-
const { default: ssePlugin } = await import("./sse-
|
|
263
|
+
const { default: ssePlugin } = await import("./sse-6W0hjVS_.mjs").then((n) => n.r);
|
|
265
264
|
const opts = config.arcPlugins.sse === true ? {} : config.arcPlugins.sse;
|
|
266
265
|
await fastify.register(ssePlugin, opts);
|
|
267
266
|
trackPlugin("arc-sse", opts);
|
|
@@ -273,7 +272,7 @@ async function registerArcPlugins(fastify, config, trackPlugin, modules) {
|
|
|
273
272
|
trackPlugin("arc-metrics", opts);
|
|
274
273
|
}
|
|
275
274
|
if (config.arcPlugins?.versioning) {
|
|
276
|
-
const { default: versioningPlugin } = await import("./versioning-
|
|
275
|
+
const { default: versioningPlugin } = await import("./versioning-CdBbFefk.mjs").then((n) => n.r);
|
|
277
276
|
await fastify.register(versioningPlugin, config.arcPlugins.versioning);
|
|
278
277
|
trackPlugin("arc-versioning", config.arcPlugins.versioning);
|
|
279
278
|
}
|
|
@@ -351,7 +350,7 @@ async function registerElevation(fastify, config, trackPlugin) {
|
|
|
351
350
|
*/
|
|
352
351
|
async function registerErrorHandler(fastify, config, trackPlugin) {
|
|
353
352
|
if (config.errorHandler === false) return;
|
|
354
|
-
const { errorHandlerPlugin } = await import("./errorHandler-
|
|
353
|
+
const { errorHandlerPlugin } = await import("./errorHandler-CH8wk1eD.mjs").then((n) => n.n);
|
|
355
354
|
const errorOpts = typeof config.errorHandler === "object" ? config.errorHandler : { includeStack: config.preset !== "production" };
|
|
356
355
|
await fastify.register(errorHandlerPlugin, errorOpts);
|
|
357
356
|
trackPlugin("arc-error-handler", errorOpts);
|
|
@@ -720,6 +719,18 @@ async function createApp(options) {
|
|
|
720
719
|
await registerElevation(fastify, config, trackPlugin);
|
|
721
720
|
await registerErrorHandler(fastify, config, trackPlugin);
|
|
722
721
|
await registerResources(fastify, config);
|
|
722
|
+
if (config.replyHelpers) {
|
|
723
|
+
const { replyHelpersPlugin } = await import("./replyHelpers-uDUIYh7u.mjs").then((n) => n.n);
|
|
724
|
+
await fastify.register(replyHelpersPlugin);
|
|
725
|
+
}
|
|
726
|
+
if (config.serializeBigInt) fastify.addHook("preSerialization", async (_request, _reply, payload) => {
|
|
727
|
+
if (payload === null || payload === void 0) return payload;
|
|
728
|
+
try {
|
|
729
|
+
return JSON.parse(JSON.stringify(payload, (_key, value) => typeof value === "bigint" ? Number(value) : value));
|
|
730
|
+
} catch {
|
|
731
|
+
return payload;
|
|
732
|
+
}
|
|
733
|
+
});
|
|
723
734
|
const authMode = config.auth === false ? "none" : config.auth ? config.auth.type : "none";
|
|
724
735
|
fastify.log.info({
|
|
725
736
|
preset: config.preset ?? "custom",
|
package/dist/docs/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { et as RegistryEntry } from "../interface-
|
|
2
|
-
import { t as ExternalOpenApiPaths } from "../externalPaths-
|
|
1
|
+
import { et as RegistryEntry } from "../interface-B91alUzq.mjs";
|
|
2
|
+
import { t as ExternalOpenApiPaths } from "../externalPaths-iba7jD3d.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-BBSTVcMm.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 { Vt as ResourceDefinition, r as DataAdapter } from "../interface-
|
|
2
|
-
import { t as PermissionCheck } from "../types-
|
|
1
|
+
import { Vt as ResourceDefinition, r as DataAdapter } from "../interface-B91alUzq.mjs";
|
|
2
|
+
import { t as PermissionCheck } from "../types-B4BNthET.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/dynamic/ArcDynamicLoader.d.ts
|
|
5
5
|
interface ArcArchitectureSchema {
|
|
@@ -5,7 +5,7 @@ import fp from "fastify-plugin";
|
|
|
5
5
|
var errorHandler_exports = /* @__PURE__ */ __exportAll({ errorHandlerPlugin: () => errorHandlerPlugin });
|
|
6
6
|
async function errorHandlerPluginFn(fastify, options = {}) {
|
|
7
7
|
const isProduction = process.env.NODE_ENV === "production";
|
|
8
|
-
const { includeStack = !isProduction, onError, errorMap = {} } = options;
|
|
8
|
+
const { includeStack = !isProduction, onError, errorMap = {}, errorMappers = [] } = options;
|
|
9
9
|
fastify.setErrorHandler(async (error, request, reply) => {
|
|
10
10
|
if (onError) try {
|
|
11
11
|
await onError(error, request);
|
|
@@ -13,6 +13,21 @@ async function errorHandlerPluginFn(fastify, options = {}) {
|
|
|
13
13
|
request.log.error({ err: callbackError }, "Error in onError callback");
|
|
14
14
|
}
|
|
15
15
|
const requestId = request.id;
|
|
16
|
+
if (errorMappers.length > 0) {
|
|
17
|
+
for (const mapper of errorMappers) if (error instanceof mapper.type) {
|
|
18
|
+
const mapped = mapper.toResponse(error);
|
|
19
|
+
const response = {
|
|
20
|
+
success: false,
|
|
21
|
+
error: mapped.message ?? error.message,
|
|
22
|
+
code: mapped.code ?? "DOMAIN_ERROR",
|
|
23
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
24
|
+
...requestId && { requestId },
|
|
25
|
+
...mapped.details && { details: mapped.details },
|
|
26
|
+
...includeStack && error.stack ? { stack: error.stack } : {}
|
|
27
|
+
};
|
|
28
|
+
return reply.code(mapped.status).send(response);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
16
31
|
const response = {
|
|
17
32
|
success: false,
|
|
18
33
|
error: error.message || "Internal Server Error",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as DomainEvent } from "./EventTransport-
|
|
1
|
+
import { t as DomainEvent } from "./EventTransport-C4VheKeC.mjs";
|
|
2
2
|
import { FastifyInstance, FastifyPluginAsync, FastifyRequest } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/caching.d.ts
|
|
@@ -115,6 +115,18 @@ declare const versioningPlugin: FastifyPluginAsync<VersioningOptions>;
|
|
|
115
115
|
declare const _default: FastifyPluginAsync<VersioningOptions>;
|
|
116
116
|
//#endregion
|
|
117
117
|
//#region src/plugins/errorHandler.d.ts
|
|
118
|
+
/** Class-based error mapper — maps thrown error instances to HTTP responses */
|
|
119
|
+
interface ErrorMapper<T extends Error = Error> {
|
|
120
|
+
/** Error class to match (uses instanceof) */
|
|
121
|
+
type: new (...args: unknown[]) => T;
|
|
122
|
+
/** Convert the error to an HTTP response shape */
|
|
123
|
+
toResponse: (error: T) => {
|
|
124
|
+
status: number;
|
|
125
|
+
code?: string;
|
|
126
|
+
message?: string;
|
|
127
|
+
details?: Record<string, unknown>;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
118
130
|
interface ErrorHandlerOptions {
|
|
119
131
|
/**
|
|
120
132
|
* Include stack trace in error responses (default: false in production)
|
|
@@ -125,13 +137,45 @@ interface ErrorHandlerOptions {
|
|
|
125
137
|
*/
|
|
126
138
|
onError?: (error: Error, request: FastifyRequest) => void | Promise<void>;
|
|
127
139
|
/**
|
|
128
|
-
* Map specific error types to custom responses
|
|
140
|
+
* Map specific error types to custom responses (by error.name string)
|
|
129
141
|
*/
|
|
130
142
|
errorMap?: Record<string, {
|
|
131
143
|
statusCode: number;
|
|
132
144
|
code: string;
|
|
133
145
|
message?: string;
|
|
134
146
|
}>;
|
|
147
|
+
/**
|
|
148
|
+
* Class-based error mappers — checked via `instanceof`, highest priority.
|
|
149
|
+
*
|
|
150
|
+
* Register your domain error classes once; Arc auto-catches and maps them
|
|
151
|
+
* in every handler. Handlers just `throw` — no try/catch needed.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* class AccountingError extends Error {
|
|
156
|
+
* constructor(message: string, public status: number, public code: string) {
|
|
157
|
+
* super(message);
|
|
158
|
+
* }
|
|
159
|
+
* }
|
|
160
|
+
*
|
|
161
|
+
* const app = await createApp({
|
|
162
|
+
* errorHandler: {
|
|
163
|
+
* errorMappers: [
|
|
164
|
+
* {
|
|
165
|
+
* type: AccountingError,
|
|
166
|
+
* toResponse: (err) => ({ status: err.status, code: err.code, message: err.message }),
|
|
167
|
+
* },
|
|
168
|
+
* ],
|
|
169
|
+
* },
|
|
170
|
+
* });
|
|
171
|
+
*
|
|
172
|
+
* // Now handlers just throw:
|
|
173
|
+
* handler: async (req) => {
|
|
174
|
+
* await ledger.post(id); // throws AccountingError → Arc maps to proper HTTP response
|
|
175
|
+
* }
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
errorMappers?: ErrorMapper[];
|
|
135
179
|
}
|
|
136
180
|
declare function errorHandlerPluginFn(fastify: FastifyInstance, options?: ErrorHandlerOptions): Promise<void>;
|
|
137
181
|
declare const errorHandlerPlugin: typeof errorHandlerPluginFn;
|
|
@@ -165,9 +165,10 @@ const eventPlugin = async (fastify, opts = {}) => {
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
try {
|
|
168
|
-
|
|
168
|
+
const isInternalEvent = type.startsWith("arc.");
|
|
169
|
+
if (wal && !isInternalEvent) await wal.save(event);
|
|
169
170
|
await transport.publish(event);
|
|
170
|
-
if (wal?.acknowledge) await wal.acknowledge(event.meta.id);
|
|
171
|
+
if (wal?.acknowledge && !isInternalEvent) await wal.acknowledge(event.meta.id);
|
|
171
172
|
onPublish?.(event);
|
|
172
173
|
} catch (error) {
|
|
173
174
|
fastify.log?.error?.({
|
|
@@ -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-C4VheKeC.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-C4VheKeC.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-CdvUoUna.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-Dag5LFa9.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-B6U_nCFU.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-Dag5LFa9.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-C4VheKeC.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-2FlNl0mL.mjs";
|
|
2
2
|
import { FastifyInstance } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region src/factory/createApp.d.ts
|
package/dist/factory/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as edgePreset, c as testingPreset, i as developmentPreset, n as createApp, o as getPreset, s as productionPreset, t as ArcFactory } from "../createApp-
|
|
1
|
+
import { a as edgePreset, c as testingPreset, i as developmentPreset, n as createApp, o as getPreset, s as productionPreset, t as ArcFactory } from "../createApp-D7e77m8C.mjs";
|
|
2
2
|
import { readdir } from "node:fs/promises";
|
|
3
3
|
import { dirname, join, resolve } from "node:path";
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _n as defineHook, an as HookOperation, cn as HookSystem, dn as afterDelete, fn as afterUpdate, gn as createHookSystem, hn as beforeUpdate, in as HookHandler, ln as HookSystemOptions, mn as beforeDelete, nn as DefineHookOptions, on as HookPhase, pn as beforeCreate, rn as HookContext, sn as HookRegistration, un as afterCreate } from "../interface-
|
|
1
|
+
import { _n as defineHook, an as HookOperation, cn as HookSystem, dn as afterDelete, fn as afterUpdate, gn as createHookSystem, hn as beforeUpdate, in as HookHandler, ln as HookSystemOptions, mn as beforeDelete, nn as DefineHookOptions, on as HookPhase, pn as beforeCreate, rn as HookContext, sn as HookRegistration, un as afterCreate } from "../interface-B91alUzq.mjs";
|
|
2
2
|
export { type DefineHookOptions, type HookContext, type HookHandler, type HookOperation, type HookPhase, type HookRegistration, HookSystem, type HookSystemOptions, afterCreate, afterDelete, afterUpdate, beforeCreate, beforeDelete, beforeUpdate, createHookSystem, defineHook };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as createIdempotencyResult, n as IdempotencyResult, r as IdempotencyStore, t as IdempotencyLock } from "../interface-
|
|
2
|
-
import { n as MongoIdempotencyStoreOptions } from "../mongodb-
|
|
3
|
-
import { r as RedisIdempotencyStoreOptions, t as RedisClient } from "../redis-
|
|
1
|
+
import { i as createIdempotencyResult, n as IdempotencyResult, r as IdempotencyStore, t as IdempotencyLock } from "../interface-CSbZdv_3.mjs";
|
|
2
|
+
import { n as MongoIdempotencyStoreOptions } from "../mongodb-B7zupyck.mjs";
|
|
3
|
+
import { r as RedisIdempotencyStoreOptions, t as RedisClient } from "../redis-3TQxm2VZ.mjs";
|
|
4
4
|
import { FastifyPluginAsync } from "fastify";
|
|
5
5
|
|
|
6
6
|
//#region src/idempotency/idempotencyPlugin.d.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as MongoIdempotencyStoreOptions, t as MongoIdempotencyStore } from "../mongodb-
|
|
1
|
+
import { n as MongoIdempotencyStoreOptions, t as MongoIdempotencyStore } from "../mongodb-B7zupyck.mjs";
|
|
2
2
|
export { MongoIdempotencyStore, type MongoIdempotencyStoreOptions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as RedisIdempotencyStore, r as RedisIdempotencyStoreOptions, t as RedisClient } from "../redis-
|
|
1
|
+
import { n as RedisIdempotencyStore, r as RedisIdempotencyStoreOptions, t as RedisClient } from "../redis-3TQxm2VZ.mjs";
|
|
2
2
|
export { type RedisClient, RedisIdempotencyStore, type RedisIdempotencyStoreOptions };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as RequestScope } from "./types
|
|
2
|
-
import { n as PermissionContext, r as PermissionResult, t as PermissionCheck } from "./types-
|
|
3
|
-
import { i as CacheStore, t as CacheLogger } from "./interface-
|
|
1
|
+
import { r as RequestScope } from "./types--D3vvfdt.mjs";
|
|
2
|
+
import { n as PermissionContext, r as PermissionResult, t as PermissionCheck } from "./types-B4BNthET.mjs";
|
|
3
|
+
import { i as CacheStore, t as CacheLogger } from "./interface-CG7oRZjX.mjs";
|
|
4
4
|
import { FastifyRequest } from "fastify";
|
|
5
5
|
|
|
6
6
|
//#region src/permissions/applyPermissionResult.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as RequestScope } from "./types
|
|
2
|
-
import { C as CrudRouterOptions, Ft as IController, It as IControllerResponse, Lt as IRequestContext, Vt as ResourceDefinition, it as RequestWithExtras, k as FastifyWithDecorators, nt as RequestContext, ot as ResourceConfig, u as AnyRecord, x as CrudController } from "./interface-
|
|
3
|
-
import { t as PermissionCheck } from "./types-
|
|
1
|
+
import { r as RequestScope } from "./types--D3vvfdt.mjs";
|
|
2
|
+
import { C as CrudRouterOptions, Ft as IController, It as IControllerResponse, Lt as IRequestContext, Vt as ResourceDefinition, it as RequestWithExtras, k as FastifyWithDecorators, nt as RequestContext, ot as ResourceConfig, u as AnyRecord, x as CrudController } from "./interface-B91alUzq.mjs";
|
|
3
|
+
import { t as PermissionCheck } from "./types-B4BNthET.mjs";
|
|
4
4
|
import { FastifyInstance, FastifyReply, FastifyRequest, RouteHandlerMethod } from "fastify";
|
|
5
5
|
|
|
6
6
|
//#region src/constants.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as OpenApiSchemas, Q as QueryParserInterface, Ut as CrudRepository, c as ValidationResult, ft as RouteSchemaOptions, n as AdapterSchemaContext, o as RepositoryLike, q as ParsedQuery, r as DataAdapter, s as SchemaMetadata } from "./interface-
|
|
1
|
+
import { G as OpenApiSchemas, Q as QueryParserInterface, Ut as CrudRepository, c as ValidationResult, ft as RouteSchemaOptions, n as AdapterSchemaContext, o as RepositoryLike, q as ParsedQuery, r as DataAdapter, s as SchemaMetadata } from "./interface-B91alUzq.mjs";
|
|
2
2
|
import { Model } from "mongoose";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/mongoose.d.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { $ as RateLimitConfig, $t as PipelineContext, A as FieldRule, C as CrudRouterOptions, D as FastifyRequestExtras, F as InferDocType, Ft as IController, Gt as PaginatedResult, H as MiddlewareConfig, Ht as defineResource, I as InferResourceDoc, It as IControllerResponse, Jt as Guard, K as OwnershipCheck, L as IntrospectionData, Lt as IRequestContext, M as HealthCheck, N as HealthOptions, Nt as ControllerLike, O as FastifyWithAuth, P as InferAdapterDoc, Qt as PipelineConfig, R as IntrospectionPluginOptions, Rt as RouteHandler, S as CrudRouteKey, St as envelope, T as EventDefinition, Tt as BaseControllerOptions, U as MiddlewareHandler, Ut as CrudRepository, Vt as ResourceDefinition, Xt as NextFunction, Y as PresetFunction, Yt as Interceptor, Z as PresetResult, Zt as OperationFilter, _t as TypedResourceConfig, a as RelationMetadata, bt as ValidateOptions, c as ValidationResult, d as ApiResponse, dt as RouteHandlerMethod, en as PipelineStep, et as RegistryEntry, ft as RouteSchemaOptions, g as AuthPluginOptions, gt as TypedRepository, ht as TypedController, i as FieldMetadata, it as RequestWithExtras, j as GracefulShutdownOptions, k as FastifyWithDecorators, l as AdditionalRoute, lt as ResourceMetadata, m as ArcRequest, nt as RequestContext, o as RepositoryLike, ot as ResourceConfig, p as ArcInternalMetadata, pt as ServiceContext, qt as QueryOptions, r as DataAdapter, rt as RequestIdOptions, s as SchemaMetadata, tn as Transform, tt as RegistryStats, u as AnyRecord, w as CrudSchemas, wt as BaseController, x as CrudController, xt as ValidationResult$1, y as ConfigError, yt as UserOrganization, z as JWTPayload } from "./interface-
|
|
2
|
-
import { a as applyFieldWritePermissions, i as applyFieldReadPermissions, n as FieldPermissionMap, o as fields, t as FieldPermission } from "./fields-
|
|
3
|
-
import { i as UserBase, n as PermissionContext, r as PermissionResult, t as PermissionCheck } from "./types-
|
|
4
|
-
import { l as createMongooseAdapter, o as createPrismaAdapter, s as MongooseAdapter, t as PrismaAdapter } from "./index-
|
|
5
|
-
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, g as DEFAULT_ID_FIELD, h as CrudOperation, j as RESERVED_QUERY_PARAMS, k as MUTATION_OPERATIONS, m as CRUD_OPERATIONS, s as defineResourceVariants, v as DEFAULT_MAX_LIMIT, w as HookOperation, x as DEFAULT_UPDATE_METHOD, y as DEFAULT_SORT } from "./index-
|
|
6
|
-
import { C as authenticated, D as publicRead, E as presets_d_exports, O as publicReadAdminWrite, S as adminOnly, T as ownerWithAdminBypass, _ as requireScopeContext, a as allOf, c as createDynamicPermissionMatrix, d as requireAuth, f as requireOrgInScope, g as requireRoles, h as requireOwnership, k as readOnly, l as createOrgPermissions, m as requireOrgRole, n as DynamicPermissionMatrix, o as allowPublic, p as requireOrgMembership, r as DynamicPermissionMatrixConfig, s as anyOf, u as denyAll, v as requireServiceScope, w as fullPublic, x as when, y as requireTeamMembership } from "./index-
|
|
7
|
-
import { a as NotFoundError, d as ValidationError, f as createDomainError, i as ForbiddenError, t as ArcError, u as UnauthorizedError } from "./errors-
|
|
1
|
+
import { $ as RateLimitConfig, $t as PipelineContext, A as FieldRule, C as CrudRouterOptions, D as FastifyRequestExtras, F as InferDocType, Ft as IController, Gt as PaginatedResult, H as MiddlewareConfig, Ht as defineResource, I as InferResourceDoc, It as IControllerResponse, Jt as Guard, K as OwnershipCheck, L as IntrospectionData, Lt as IRequestContext, M as HealthCheck, N as HealthOptions, Nt as ControllerLike, O as FastifyWithAuth, P as InferAdapterDoc, Qt as PipelineConfig, R as IntrospectionPluginOptions, Rt as RouteHandler, S as CrudRouteKey, St as envelope, T as EventDefinition, Tt as BaseControllerOptions, U as MiddlewareHandler, Ut as CrudRepository, Vt as ResourceDefinition, Xt as NextFunction, Y as PresetFunction, Yt as Interceptor, Z as PresetResult, Zt as OperationFilter, _t as TypedResourceConfig, a as RelationMetadata, bt as ValidateOptions, c as ValidationResult, d as ApiResponse, dt as RouteHandlerMethod, en as PipelineStep, et as RegistryEntry, ft as RouteSchemaOptions, g as AuthPluginOptions, gt as TypedRepository, ht as TypedController, i as FieldMetadata, it as RequestWithExtras, j as GracefulShutdownOptions, k as FastifyWithDecorators, l as AdditionalRoute, lt as ResourceMetadata, m as ArcRequest, nt as RequestContext, o as RepositoryLike, ot as ResourceConfig, p as ArcInternalMetadata, pt as ServiceContext, qt as QueryOptions, r as DataAdapter, rt as RequestIdOptions, s as SchemaMetadata, tn as Transform, tt as RegistryStats, u as AnyRecord, w as CrudSchemas, wt as BaseController, x as CrudController, xt as ValidationResult$1, y as ConfigError, yt as UserOrganization, z as JWTPayload } from "./interface-B91alUzq.mjs";
|
|
2
|
+
import { a as applyFieldWritePermissions, i as applyFieldReadPermissions, n as FieldPermissionMap, o as fields, t as FieldPermission } from "./fields-D4nMDqnK.mjs";
|
|
3
|
+
import { i as UserBase, n as PermissionContext, r as PermissionResult, t as PermissionCheck } from "./types-B4BNthET.mjs";
|
|
4
|
+
import { l as createMongooseAdapter, o as createPrismaAdapter, s as MongooseAdapter, t as PrismaAdapter } from "./index-C9eYNjGR.mjs";
|
|
5
|
+
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, g as DEFAULT_ID_FIELD, h as CrudOperation, j as RESERVED_QUERY_PARAMS, k as MUTATION_OPERATIONS, m as CRUD_OPERATIONS, s as defineResourceVariants, v as DEFAULT_MAX_LIMIT, w as HookOperation, x as DEFAULT_UPDATE_METHOD, y as DEFAULT_SORT } from "./index-BjShrzoj.mjs";
|
|
6
|
+
import { C as authenticated, D as publicRead, E as presets_d_exports, O as publicReadAdminWrite, S as adminOnly, T as ownerWithAdminBypass, _ as requireScopeContext, a as allOf, c as createDynamicPermissionMatrix, d as requireAuth, f as requireOrgInScope, g as requireRoles, h as requireOwnership, k as readOnly, l as createOrgPermissions, m as requireOrgRole, n as DynamicPermissionMatrix, o as allowPublic, p as requireOrgMembership, r as DynamicPermissionMatrixConfig, s as anyOf, u as denyAll, v as requireServiceScope, w as fullPublic, x as when, y as requireTeamMembership } from "./index-B0extFr4.mjs";
|
|
7
|
+
import { a as NotFoundError, d as ValidationError, f as createDomainError, i as ForbiddenError, t as ArcError, u as UnauthorizedError } from "./errors-BS6lZvWy.mjs";
|
|
8
8
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
9
|
+
import { RouteHandlerMethod as RouteHandlerMethod$1 } from "fastify";
|
|
9
10
|
|
|
10
11
|
//#region src/context/requestContext.d.ts
|
|
11
12
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -128,6 +128,6 @@ function transform(name, handlerOrOptions) {
|
|
|
128
128
|
}
|
|
129
129
|
//#endregion
|
|
130
130
|
//#region src/index.ts
|
|
131
|
-
const version = "2.7.
|
|
131
|
+
const version = "2.7.3";
|
|
132
132
|
//#endregion
|
|
133
133
|
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, arcLog, assertValidConfig, authenticated, configureArcLogger, createDomainError, createDynamicPermissionMatrix, createMongooseAdapter, createOrgPermissions, createPrismaAdapter, defineResource, defineResourceVariants, denyAll, envelope, fields, formatValidationErrors, fullPublic, getControllerScope, guard, intercept, middleware, ownerWithAdminBypass, presets_exports as permissions, pipe, publicRead, publicReadAdminWrite, readOnly, requestContext, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, sortMiddlewares, transform, validateResourceConfig, version, when };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as DomainEvent } from "../EventTransport-
|
|
1
|
+
import { t as DomainEvent } from "../EventTransport-C4VheKeC.mjs";
|
|
2
2
|
import { WebSocketClient, WebSocketMessage } from "./websocket.mjs";
|
|
3
3
|
import { FastifyPluginAsync, FastifyRequest } from "fastify";
|
|
4
4
|
|
|
@@ -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-6W0hjVS_.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
1
|
import { WebSocketClient, WebSocketMessage, WebSocketPluginOptions } from "./websocket.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-C5g2oRC7.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 { Vt as ResourceDefinition } from "../../interface-
|
|
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 { Vt as ResourceDefinition } from "../../interface-B91alUzq.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-C5g2oRC7.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-BJkoQoUP.mjs";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import fp from "fastify-plugin";
|
|
4
4
|
//#region src/integrations/mcp/definePrompt.ts
|
|
@@ -150,7 +150,7 @@ function isBetterAuth(auth) {
|
|
|
150
150
|
* @param authCache - Optional short-lived cache to avoid redundant auth lookups
|
|
151
151
|
*/
|
|
152
152
|
async function resolveMcpAuth(headers, auth, authCache) {
|
|
153
|
-
if (auth === false) return
|
|
153
|
+
if (auth === false) return null;
|
|
154
154
|
const cacheKey = authCache ? extractAuthCacheKey(headers) : null;
|
|
155
155
|
if (cacheKey && authCache) {
|
|
156
156
|
const cached = authCache.get(cacheKey);
|
|
@@ -167,7 +167,9 @@ async function resolveMcpAuth(headers, auth, authCache) {
|
|
|
167
167
|
if (!session?.userId) result = null;
|
|
168
168
|
else result = {
|
|
169
169
|
userId: session.userId,
|
|
170
|
-
organizationId: session.activeOrganizationId
|
|
170
|
+
organizationId: session.activeOrganizationId,
|
|
171
|
+
...session.clientId ? { clientId: session.clientId } : {},
|
|
172
|
+
...session.scopes ? { scopes: session.scopes.split(" ") } : {}
|
|
171
173
|
};
|
|
172
174
|
} catch {
|
|
173
175
|
result = null;
|
|
@@ -494,10 +496,11 @@ function registerStatelessRoutes(fastify, prefix, options, createServer, Transpo
|
|
|
494
496
|
});
|
|
495
497
|
}
|
|
496
498
|
function registerStatefulRoutes(fastify, prefix, options, cache, createServer, Transport) {
|
|
497
|
-
/** Check if the requesting
|
|
499
|
+
/** Check if the requesting principal owns the session */
|
|
498
500
|
function isSessionOwner(entry, authResult) {
|
|
499
501
|
if (!options.auth || !entry.auth || !authResult) return true;
|
|
500
|
-
|
|
502
|
+
const prev = entry.auth;
|
|
503
|
+
return prev.userId === authResult.userId && prev.organizationId === authResult.organizationId && prev.clientId === authResult.clientId;
|
|
501
504
|
}
|
|
502
505
|
fastify.post(prefix, async (request, reply) => {
|
|
503
506
|
const authResult = await resolveMcpAuth(request.headers, options.auth ?? false);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as createMcpServer, t as resourceToTools } from "../../resourceToTools-
|
|
1
|
+
import { r as createMcpServer, t as resourceToTools } from "../../resourceToTools-BJkoQoUP.mjs";
|
|
2
2
|
//#region src/integrations/mcp/testing.ts
|
|
3
3
|
/**
|
|
4
4
|
* @classytic/arc/mcp/testing — MCP Test Utilities
|