@classytic/arc 2.7.1 → 2.7.7
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/{HookSystem-D7lfx--K.mjs → HookSystem-BNYKnrXF.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-EkPaMWNM.mjs} +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/core/index.mjs +2 -2
- package/dist/{core-BWekSEju.mjs → core-B_zEeA2b.mjs} +1 -1
- package/dist/{createApp-B_nvKNAQ.mjs → createApp-D7e77m8C.mjs} +18 -7
- package/dist/{defineResource-DZzyl4a4.mjs → defineResource-BW2dMCu9.mjs} +1 -6
- 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/{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 +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-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 +3 -3
- 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/streamline.d.mts +39 -7
- package/dist/integrations/streamline.mjs +106 -4
- 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/{openapi-C5UhIeWu.mjs → openapi-D7Z7VODz.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 +52 -5
- package/dist/plugins/index.mjs +6 -5
- 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/{schemaConverter-0TyONAwM.mjs → schemaConverter-Y5EejTnJ.mjs} +1 -4
- 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-DPsC0taJ.d.mts → types-B4BNthET.d.mts} +1 -1
- package/dist/{types-ClmkMDK1.d.mts → types-C5g2oRC7.d.mts} +18 -2
- package/dist/{types-D0qf0Mf4.d.mts → types-CKB47kiu.d.mts} +48 -9
- package/dist/utils/index.d.mts +3 -3
- package/dist/utils/index.mjs +1 -1
- package/package.json +9 -5
- 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/{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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as RequestScope } from "./types
|
|
2
|
-
import { n as FieldPermissionMap } from "./fields-
|
|
3
|
-
import { i as UserBase, t as PermissionCheck } from "./types-
|
|
1
|
+
import { r as RequestScope } from "./types--D3vvfdt.mjs";
|
|
2
|
+
import { n as FieldPermissionMap } from "./fields-D4nMDqnK.mjs";
|
|
3
|
+
import { i as UserBase, t as PermissionCheck } from "./types-B4BNthET.mjs";
|
|
4
4
|
import { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest, RouteHandlerMethod, RouteHandlerMethod as RouteHandlerMethod$1 } from "fastify";
|
|
5
5
|
|
|
6
6
|
//#region src/hooks/HookSystem.d.ts
|
|
@@ -795,7 +795,7 @@ type ControllerHandler<TResponse = unknown, TBody = unknown, TParams extends Rec
|
|
|
795
795
|
* }]
|
|
796
796
|
* ```
|
|
797
797
|
*/
|
|
798
|
-
type FastifyHandler = (request: FastifyRequest
|
|
798
|
+
type FastifyHandler<RouteGeneric extends Record<string, unknown> = Record<string, unknown>> = (request: FastifyRequest<RouteGeneric>, reply: FastifyReply) => Promise<unknown> | unknown;
|
|
799
799
|
/**
|
|
800
800
|
* Union type for route handlers
|
|
801
801
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as getUserRoles } from "./types-ZUu_h0jp.mjs";
|
|
2
|
-
import { n as convertRouteSchema } from "./schemaConverter-
|
|
2
|
+
import { n as convertRouteSchema } from "./schemaConverter-Y5EejTnJ.mjs";
|
|
3
3
|
import fp from "fastify-plugin";
|
|
4
4
|
//#region src/docs/openapi.ts
|
|
5
5
|
const openApiPlugin = async (fastify, opts = {}) => {
|
package/dist/org/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Rt as RouteHandler } from "../interface-
|
|
2
|
-
import { i as UserBase } from "../types-
|
|
1
|
+
import { Rt as RouteHandler } from "../interface-B91alUzq.mjs";
|
|
2
|
+
import { i as UserBase } from "../types-B4BNthET.mjs";
|
|
3
3
|
import { InvitationAdapter, InvitationDoc, MemberDoc, OrgAdapter, OrgDoc, OrgPermissionStatement, OrgRole, OrganizationPluginOptions } from "./types.mjs";
|
|
4
4
|
import { FastifyPluginAsync, RouteHandlerMethod } from "fastify";
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as applyFieldWritePermissions, i as applyFieldReadPermissions, n as FieldPermissionMap, o as fields, r as FieldPermissionType, s as resolveEffectiveRoles, t as FieldPermission } from "../fields-
|
|
2
|
-
import { a as getUserRoles, i as UserBase, n as PermissionContext, o as normalizeRoles, r as PermissionResult, t as PermissionCheck } from "../types-
|
|
3
|
-
import { A as RoleHierarchy, C as authenticated, D as publicRead, E as presets_d_exports, M as applyPermissionResult, N as normalizePermissionResult, O as publicReadAdminWrite, S as adminOnly, T as ownerWithAdminBypass, _ as requireScopeContext, a as allOf, b as roles, c as createDynamicPermissionMatrix, d as requireAuth, f as requireOrgInScope, g as requireRoles, h as requireOwnership, i as PermissionEventBus, j as createRoleHierarchy, k as readOnly, l as createOrgPermissions, m as requireOrgRole, n as DynamicPermissionMatrix, o as allowPublic, p as requireOrgMembership, r as DynamicPermissionMatrixConfig, s as anyOf, t as ConnectEventsOptions, u as denyAll, v as requireServiceScope, w as fullPublic, x as when, y as requireTeamMembership } from "../index-
|
|
1
|
+
import { a as applyFieldWritePermissions, i as applyFieldReadPermissions, n as FieldPermissionMap, o as fields, r as FieldPermissionType, s as resolveEffectiveRoles, t as FieldPermission } from "../fields-D4nMDqnK.mjs";
|
|
2
|
+
import { a as getUserRoles, i as UserBase, n as PermissionContext, o as normalizeRoles, r as PermissionResult, t as PermissionCheck } from "../types-B4BNthET.mjs";
|
|
3
|
+
import { A as RoleHierarchy, C as authenticated, D as publicRead, E as presets_d_exports, M as applyPermissionResult, N as normalizePermissionResult, O as publicReadAdminWrite, S as adminOnly, T as ownerWithAdminBypass, _ as requireScopeContext, a as allOf, b as roles, c as createDynamicPermissionMatrix, d as requireAuth, f as requireOrgInScope, g as requireRoles, h as requireOwnership, i as PermissionEventBus, j as createRoleHierarchy, k as readOnly, l as createOrgPermissions, m as requireOrgRole, n as DynamicPermissionMatrix, o as allowPublic, p as requireOrgMembership, r as DynamicPermissionMatrixConfig, s as anyOf, t as ConnectEventsOptions, u as denyAll, v as requireServiceScope, w as fullPublic, x as when, y as requireTeamMembership } from "../index-B0extFr4.mjs";
|
|
4
4
|
export { ConnectEventsOptions, DynamicPermissionMatrix, DynamicPermissionMatrixConfig, FieldPermission, FieldPermissionMap, FieldPermissionType, PermissionCheck, PermissionContext, PermissionEventBus, PermissionResult, RoleHierarchy, UserBase, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, applyPermissionResult, authenticated, createDynamicPermissionMatrix, createOrgPermissions, createRoleHierarchy, denyAll, fields, fullPublic, getUserRoles, normalizePermissionResult, normalizeRoles, ownerWithAdminBypass, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, resolveEffectiveRoles, roles, when };
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Bt as ResourceRegistry, H as MiddlewareConfig, X as PresetHook, cn as HookSystem, ft as RouteSchemaOptions, l as AdditionalRoute, u as AnyRecord } from "../interface-
|
|
2
|
-
import { t as ExternalOpenApiPaths } from "../externalPaths-
|
|
3
|
-
import { _ as cachingPlugin, a as versioningPlugin, c as MetricsOptions, d as SSEOptions, f as _default$6, g as _default$1, h as CachingRule, i as _default$7, l as _default$4, m as CachingOptions, n as errorHandlerPlugin, o as MetricEntry, p as ssePlugin, r as VersioningOptions, s as MetricsCollector, t as ErrorHandlerOptions, u as metricsPlugin } from "../errorHandler-
|
|
4
|
-
import { t as TracingOptions } from "../tracing-
|
|
1
|
+
import { Bt as ResourceRegistry, H as MiddlewareConfig, X as PresetHook, cn as HookSystem, ft as RouteSchemaOptions, l as AdditionalRoute, u as AnyRecord } from "../interface-B91alUzq.mjs";
|
|
2
|
+
import { t as ExternalOpenApiPaths } from "../externalPaths-iba7jD3d.mjs";
|
|
3
|
+
import { _ as cachingPlugin, a as versioningPlugin, c as MetricsOptions, d as SSEOptions, f as _default$6, g as _default$1, h as CachingRule, i as _default$7, l as _default$4, m as CachingOptions, n as errorHandlerPlugin, o as MetricEntry, p as ssePlugin, r as VersioningOptions, s as MetricsCollector, t as ErrorHandlerOptions, u as metricsPlugin } from "../errorHandler-pCpEtNd7.mjs";
|
|
4
|
+
import { t as TracingOptions } from "../tracing-DEqdGkr-.mjs";
|
|
5
5
|
import { FastifyInstance, FastifyPluginAsync } from "fastify";
|
|
6
|
+
import * as _$node_stream0 from "node:stream";
|
|
6
7
|
|
|
7
8
|
//#region src/core/arcCorePlugin.d.ts
|
|
8
9
|
interface ArcCorePluginOptions {
|
|
@@ -148,6 +149,52 @@ interface HealthOptions {
|
|
|
148
149
|
declare const healthPlugin: FastifyPluginAsync<HealthOptions>;
|
|
149
150
|
declare const _default$3: FastifyPluginAsync<HealthOptions>;
|
|
150
151
|
//#endregion
|
|
152
|
+
//#region src/plugins/replyHelpers.d.ts
|
|
153
|
+
declare module "fastify" {
|
|
154
|
+
interface FastifyReply {
|
|
155
|
+
/** Send a success response with data */
|
|
156
|
+
ok<T>(data: T, statusCode?: number): FastifyReply;
|
|
157
|
+
/** Send an error response */
|
|
158
|
+
fail(error: string | string[], statusCode?: number): FastifyReply;
|
|
159
|
+
/** Send a paginated list response */
|
|
160
|
+
paginated<T>(result: {
|
|
161
|
+
docs: T[];
|
|
162
|
+
total: number;
|
|
163
|
+
page: number;
|
|
164
|
+
limit: number;
|
|
165
|
+
[key: string]: unknown;
|
|
166
|
+
}): FastifyReply;
|
|
167
|
+
/**
|
|
168
|
+
* Stream a readable source as a file download or raw stream.
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* // CSV export
|
|
173
|
+
* return reply.stream(csvReadableStream, {
|
|
174
|
+
* contentType: 'text/csv',
|
|
175
|
+
* filename: 'export.csv',
|
|
176
|
+
* });
|
|
177
|
+
*
|
|
178
|
+
* // PDF download
|
|
179
|
+
* return reply.stream(pdfBuffer, {
|
|
180
|
+
* contentType: 'application/pdf',
|
|
181
|
+
* filename: 'report.pdf',
|
|
182
|
+
* });
|
|
183
|
+
*
|
|
184
|
+
* // Raw stream (no Content-Disposition)
|
|
185
|
+
* return reply.stream(dataStream, { contentType: 'application/octet-stream' });
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
stream(source: _$node_stream0.Readable | Buffer | AsyncIterable<unknown>, options: {
|
|
189
|
+
contentType: string;
|
|
190
|
+
filename?: string;
|
|
191
|
+
statusCode?: number;
|
|
192
|
+
}): FastifyReply;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
declare function replyHelpersPluginFn(fastify: FastifyInstance): Promise<void>;
|
|
196
|
+
declare const replyHelpersPlugin: typeof replyHelpersPluginFn;
|
|
197
|
+
//#endregion
|
|
151
198
|
//#region src/plugins/requestId.d.ts
|
|
152
199
|
interface RequestIdOptions {
|
|
153
200
|
/** Header name to read/write request ID (default: 'x-request-id') */
|
|
@@ -166,4 +213,4 @@ declare module "fastify" {
|
|
|
166
213
|
declare const requestIdPlugin: FastifyPluginAsync<RequestIdOptions>;
|
|
167
214
|
declare const _default$5: FastifyPluginAsync<RequestIdOptions>;
|
|
168
215
|
//#endregion
|
|
169
|
-
export { type ArcCore, type ArcCorePluginOptions, type ArcPlugin, type CachingOptions, type CachingRule, type CreatePluginDefinition, type ErrorHandlerOptions, type GracefulShutdownOptions, type HealthCheck, type HealthOptions, type MetricEntry, type MetricsCollector, type MetricsOptions, type PluginMeta, type PluginResourceResult, type RequestIdOptions, type SSEOptions, type TracingOptions, type VersioningOptions, _default as arcCorePlugin, arcCorePlugin as arcCorePluginFn, _default$1 as cachingPlugin, cachingPlugin as cachingPluginFn, createPlugin, errorHandlerPlugin, errorHandlerPlugin as errorHandlerPluginFn, _default$2 as gracefulShutdownPlugin, gracefulShutdownPlugin as gracefulShutdownPluginFn, _default$3 as healthPlugin, healthPlugin as healthPluginFn, _default$4 as metricsPlugin, metricsPlugin as metricsPluginFn, _default$5 as requestIdPlugin, requestIdPlugin as requestIdPluginFn, _default$6 as ssePlugin, ssePlugin as ssePluginFn, _default$7 as versioningPlugin, versioningPlugin as versioningPluginFn };
|
|
216
|
+
export { type ArcCore, type ArcCorePluginOptions, type ArcPlugin, type CachingOptions, type CachingRule, type CreatePluginDefinition, type ErrorHandlerOptions, type GracefulShutdownOptions, type HealthCheck, type HealthOptions, type MetricEntry, type MetricsCollector, type MetricsOptions, type PluginMeta, type PluginResourceResult, type RequestIdOptions, type SSEOptions, type TracingOptions, type VersioningOptions, _default as arcCorePlugin, arcCorePlugin as arcCorePluginFn, _default$1 as cachingPlugin, cachingPlugin as cachingPluginFn, createPlugin, errorHandlerPlugin, errorHandlerPlugin as errorHandlerPluginFn, _default$2 as gracefulShutdownPlugin, gracefulShutdownPlugin as gracefulShutdownPluginFn, _default$3 as healthPlugin, healthPlugin as healthPluginFn, _default$4 as metricsPlugin, metricsPlugin as metricsPluginFn, replyHelpersPlugin, _default$5 as requestIdPlugin, requestIdPlugin as requestIdPluginFn, _default$6 as ssePlugin, ssePlugin as ssePluginFn, _default$7 as versioningPlugin, versioningPlugin as versioningPluginFn };
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -2,13 +2,14 @@ import { p as MUTATION_OPERATIONS } from "../constants-Cxde4rpC.mjs";
|
|
|
2
2
|
import { o as getOrgId } from "../types-AOD8fxIw.mjs";
|
|
3
3
|
import { t as requestContext } from "../requestContext-xHIKedG6.mjs";
|
|
4
4
|
import { t as hasEvents } from "../typeGuards-CcFZXgU7.mjs";
|
|
5
|
-
import { t as HookSystem } from "../HookSystem-
|
|
5
|
+
import { t as HookSystem } from "../HookSystem-BNYKnrXF.mjs";
|
|
6
6
|
import { t as ResourceRegistry } from "../ResourceRegistry-DsHiG9cL.mjs";
|
|
7
7
|
import { n as caching_default, t as cachingPlugin } from "../caching-5DtLwIqb.mjs";
|
|
8
|
-
import { t as errorHandlerPlugin } from "../errorHandler-
|
|
8
|
+
import { t as errorHandlerPlugin } from "../errorHandler-CH8wk1eD.mjs";
|
|
9
9
|
import { n as metrics_default, t as metricsPlugin } from "../metrics-Qnvwc-LQ.mjs";
|
|
10
|
-
import {
|
|
11
|
-
import { n as
|
|
10
|
+
import { t as replyHelpersPlugin } from "../replyHelpers-uDUIYh7u.mjs";
|
|
11
|
+
import { n as sse_default, t as ssePlugin } from "../sse-6W0hjVS_.mjs";
|
|
12
|
+
import { n as versioning_default, t as versioningPlugin } from "../versioning-CdBbFefk.mjs";
|
|
12
13
|
import { randomUUID } from "node:crypto";
|
|
13
14
|
import fp from "fastify-plugin";
|
|
14
15
|
//#region src/core/arcCorePlugin.ts
|
|
@@ -409,4 +410,4 @@ var requestId_default = fp(requestIdPlugin, {
|
|
|
409
410
|
fastify: "5.x"
|
|
410
411
|
});
|
|
411
412
|
//#endregion
|
|
412
|
-
export { arcCorePlugin_default as arcCorePlugin, arcCorePlugin as arcCorePluginFn, caching_default as cachingPlugin, cachingPlugin as cachingPluginFn, createPlugin, errorHandlerPlugin, errorHandlerPlugin as errorHandlerPluginFn, gracefulShutdown_default as gracefulShutdownPlugin, gracefulShutdownPlugin as gracefulShutdownPluginFn, health_default as healthPlugin, healthPlugin as healthPluginFn, metrics_default as metricsPlugin, metricsPlugin as metricsPluginFn, requestId_default as requestIdPlugin, requestIdPlugin as requestIdPluginFn, sse_default as ssePlugin, ssePlugin as ssePluginFn, versioning_default as versioningPlugin, versioningPlugin as versioningPluginFn };
|
|
413
|
+
export { arcCorePlugin_default as arcCorePlugin, arcCorePlugin as arcCorePluginFn, caching_default as cachingPlugin, cachingPlugin as cachingPluginFn, createPlugin, errorHandlerPlugin, errorHandlerPlugin as errorHandlerPluginFn, gracefulShutdown_default as gracefulShutdownPlugin, gracefulShutdownPlugin as gracefulShutdownPluginFn, health_default as healthPlugin, healthPlugin as healthPluginFn, metrics_default as metricsPlugin, metricsPlugin as metricsPluginFn, replyHelpersPlugin, requestId_default as requestIdPlugin, requestIdPlugin as requestIdPluginFn, sse_default as ssePlugin, ssePlugin as ssePluginFn, versioning_default as versioningPlugin, versioningPlugin as versioningPluginFn };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as traced, i as isTracingAvailable, n as _default, r as createSpan, t as TracingOptions } from "../tracing-
|
|
1
|
+
import { a as traced, i as isTracingAvailable, n as _default, r as createSpan, t as TracingOptions } from "../tracing-DEqdGkr-.mjs";
|
|
2
2
|
export { type TracingOptions, createSpan, isTracingAvailable, traced, _default as tracingPlugin };
|
|
@@ -44,7 +44,7 @@ try {
|
|
|
44
44
|
function createTracerProvider(options) {
|
|
45
45
|
if (!isAvailable) return null;
|
|
46
46
|
const { serviceName = "@classytic/arc", serviceVersion, exporterUrl = "http://localhost:4318/v1/traces" } = options;
|
|
47
|
-
const resolvedVersion = serviceVersion ?? "2.7.
|
|
47
|
+
const resolvedVersion = serviceVersion ?? "2.7.7";
|
|
48
48
|
const exporter = new OTLPTraceExporter({ url: exporterUrl });
|
|
49
49
|
const provider = new NodeTracerProvider({ resource: { attributes: {
|
|
50
50
|
"service.name": serviceName,
|
package/dist/presets/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Gt as PaginatedResult, It as IControllerResponse, Lt as IRequestContext, Z as PresetResult, ot as ResourceConfig, u as AnyRecord } from "../interface-
|
|
1
|
+
import { Gt as PaginatedResult, It as IControllerResponse, Lt as IRequestContext, Z as PresetResult, ot as ResourceConfig, u as AnyRecord } from "../interface-B91alUzq.mjs";
|
|
2
2
|
import { MultiTenantOptions, TenantFieldSpec, multiTenantPreset } from "./multiTenant.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/presets/ownedByUser.d.ts
|
|
@@ -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-stream.d.ts
|
|
4
4
|
interface RedisStreamLike {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bt as ResourceRegistry, R as IntrospectionPluginOptions, zt as RegisterOptions } from "../interface-
|
|
1
|
+
import { Bt as ResourceRegistry, R as IntrospectionPluginOptions, zt as RegisterOptions } from "../interface-B91alUzq.mjs";
|
|
2
2
|
import { FastifyPluginAsync } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region src/registry/introspectionPlugin.d.ts
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
|
|
2
|
+
import fp from "fastify-plugin";
|
|
3
|
+
//#region src/plugins/replyHelpers.ts
|
|
4
|
+
var replyHelpers_exports = /* @__PURE__ */ __exportAll({ replyHelpersPlugin: () => replyHelpersPlugin });
|
|
5
|
+
async function replyHelpersPluginFn(fastify) {
|
|
6
|
+
fastify.decorateReply("ok", function(data, statusCode = 200) {
|
|
7
|
+
return this.code(statusCode).send({
|
|
8
|
+
success: true,
|
|
9
|
+
data
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
fastify.decorateReply("fail", function(error, statusCode = 400) {
|
|
13
|
+
if (Array.isArray(error)) return this.code(statusCode).send({
|
|
14
|
+
success: false,
|
|
15
|
+
errors: error
|
|
16
|
+
});
|
|
17
|
+
return this.code(statusCode).send({
|
|
18
|
+
success: false,
|
|
19
|
+
error
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
fastify.decorateReply("paginated", function(result) {
|
|
23
|
+
return this.code(200).send({
|
|
24
|
+
success: true,
|
|
25
|
+
...result
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
fastify.decorateReply("stream", function(source, options) {
|
|
29
|
+
this.code(options.statusCode ?? 200);
|
|
30
|
+
this.header("content-type", options.contentType);
|
|
31
|
+
if (options.filename) this.header("content-disposition", `attachment; filename="${options.filename}"`);
|
|
32
|
+
return this.send(source);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const replyHelpersPlugin = fp(replyHelpersPluginFn, {
|
|
36
|
+
name: "arc-reply-helpers",
|
|
37
|
+
fastify: "5.x"
|
|
38
|
+
});
|
|
39
|
+
//#endregion
|
|
40
|
+
export { replyHelpers_exports as n, replyHelpersPlugin as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as BaseController } from "./BaseController-CpMfCXdn.mjs";
|
|
2
2
|
import { n as normalizePermissionResult } from "./applyPermissionResult-D6GPMsvh.mjs";
|
|
3
|
-
import { t as pluralize } from "./pluralize-
|
|
3
|
+
import { t as pluralize } from "./pluralize-Dckfq6US.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
//#region src/integrations/mcp/createMcpServer.ts
|
|
6
6
|
/**
|
|
@@ -228,7 +228,7 @@ function buildRequestContext(input, auth, operation, policyFilters, scopeOverrid
|
|
|
228
228
|
const sessionScope = buildScope(auth);
|
|
229
229
|
const scope = scopeOverride && sessionScope.kind === "public" ? scopeOverride : sessionScope;
|
|
230
230
|
const base = {
|
|
231
|
-
user: auth ? {
|
|
231
|
+
user: auth?.userId ? {
|
|
232
232
|
id: auth.userId,
|
|
233
233
|
_id: auth.userId,
|
|
234
234
|
...auth
|
|
@@ -344,17 +344,23 @@ function expandOperatorKeys(input) {
|
|
|
344
344
|
}
|
|
345
345
|
function buildScope(auth) {
|
|
346
346
|
if (!auth) return { kind: "public" };
|
|
347
|
+
if (auth.clientId && auth.organizationId) return {
|
|
348
|
+
kind: "service",
|
|
349
|
+
clientId: auth.clientId,
|
|
350
|
+
organizationId: auth.organizationId,
|
|
351
|
+
scopes: auth.scopes
|
|
352
|
+
};
|
|
347
353
|
if (auth.organizationId) return {
|
|
348
354
|
kind: "member",
|
|
349
355
|
userId: auth.userId,
|
|
350
|
-
userRoles: [],
|
|
356
|
+
userRoles: auth.roles ?? [],
|
|
351
357
|
organizationId: auth.organizationId,
|
|
352
|
-
orgRoles: []
|
|
358
|
+
orgRoles: auth.orgRoles ?? []
|
|
353
359
|
};
|
|
354
360
|
return {
|
|
355
361
|
kind: "authenticated",
|
|
356
362
|
userId: auth.userId,
|
|
357
|
-
userRoles: []
|
|
363
|
+
userRoles: auth.roles ?? []
|
|
358
364
|
};
|
|
359
365
|
}
|
|
360
366
|
//#endregion
|
package/dist/rpc/index.d.mts
CHANGED
|
@@ -34,10 +34,7 @@ function toJsonSchema(input) {
|
|
|
34
34
|
if (typeof input !== "object") return void 0;
|
|
35
35
|
if (isJsonSchema(input)) return input;
|
|
36
36
|
if (isZodSchema(input)) {
|
|
37
|
-
if (!_toJSONSchema)
|
|
38
|
-
console.warn("[Arc] Zod schema detected but zod is not installed. Install zod v4: npm install zod");
|
|
39
|
-
return input;
|
|
40
|
-
}
|
|
37
|
+
if (!_toJSONSchema) return input;
|
|
41
38
|
try {
|
|
42
39
|
return _toJSONSchema(input, { target: "openapi-3.0" });
|
|
43
40
|
} catch {
|
package/dist/scope/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as isAuthenticated, a as getClientId, b as isOrgInScope, c as getOrgRoles, d as getScopeContextMap, f as getServiceScopes, g as hasOrgAccess, h as getUserRoles, i as getAncestorOrgIds, l as getRequestScope, m as getUserId, n as PUBLIC_SCOPE, o as getOrgContext, p as getTeamId, r as RequestScope, s as getOrgId, t as AUTHENTICATED_SCOPE, u as getScopeContext, v as isElevated, x as isService, y as isMember } from "../types
|
|
2
|
-
import { i as elevationPlugin, n as ElevationOptions, r as _default, t as ElevationEvent } from "../elevation-
|
|
1
|
+
import { _ as isAuthenticated, a as getClientId, b as isOrgInScope, c as getOrgRoles, d as getScopeContextMap, f as getServiceScopes, g as hasOrgAccess, h as getUserRoles, i as getAncestorOrgIds, l as getRequestScope, m as getUserId, n as PUBLIC_SCOPE, o as getOrgContext, p as getTeamId, r as RequestScope, s as getOrgId, t as AUTHENTICATED_SCOPE, u as getScopeContext, v as isElevated, x as isService, y as isMember } from "../types--D3vvfdt.mjs";
|
|
2
|
+
import { i as elevationPlugin, n as ElevationOptions, r as _default, t as ElevationEvent } from "../elevation-D7WK0RXq.mjs";
|
|
3
3
|
import { FastifyReply, FastifyRequest } from "fastify";
|
|
4
4
|
|
|
5
5
|
//#region src/scope/rateLimitKey.d.ts
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Ut as CrudRepository, Vt as ResourceDefinition, u as AnyRecord } from "../interface-
|
|
2
|
-
import { d as ResourceLike, r as CreateAppOptions } from "../types-
|
|
1
|
+
import { Ut as CrudRepository, Vt as ResourceDefinition, u as AnyRecord } from "../interface-B91alUzq.mjs";
|
|
2
|
+
import { d as ResourceLike, r as CreateAppOptions } from "../types-CKB47kiu.mjs";
|
|
3
3
|
import Fastify, { FastifyInstance, FastifyServerOptions } from "fastify";
|
|
4
4
|
import { Connection } from "mongoose";
|
|
5
5
|
import { Mock } from "vitest";
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1796,7 +1796,7 @@ function runEventTests(resourceName, displayName, events) {
|
|
|
1796
1796
|
* ```
|
|
1797
1797
|
*/
|
|
1798
1798
|
async function createTestApp(options = {}) {
|
|
1799
|
-
const { createApp } = await import("../createApp-
|
|
1799
|
+
const { createApp } = await import("../createApp-D7e77m8C.mjs").then((n) => n.r);
|
|
1800
1800
|
const { useInMemoryDb = true, mongoUri: providedMongoUri, ...appOptions } = options;
|
|
1801
1801
|
const defaultAuth = {
|
|
1802
1802
|
type: "jwt",
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as isAuthenticated, c as getOrgRoles, g as hasOrgAccess, n as PUBLIC_SCOPE, p as getTeamId, r as RequestScope, s as getOrgId, t as AUTHENTICATED_SCOPE, v as isElevated, y as isMember } from "../types
|
|
2
|
-
import { $ as RateLimitConfig, A as FieldRule, B as JwtContext, C as CrudRouterOptions, Ct as getUserId, D as FastifyRequestExtras, E as EventsDecorator, F as InferDocType, Ft as IController, G as OpenApiSchemas, Gt as PaginatedResult, H as MiddlewareConfig, I as InferResourceDoc, It as IControllerResponse, J as PopulateOption, K as OwnershipCheck, Kt as PaginationParams, L as IntrospectionData, Lt as IRequestContext, M as HealthCheck, Mt as ControllerHandler, N as HealthOptions, Nt as ControllerLike, O as FastifyWithAuth, P as InferAdapterDoc, Pt as FastifyHandler, Q as QueryParserInterface, R as IntrospectionPluginOptions, Rt as RouteHandler, S as CrudRouteKey, St as envelope, T as EventDefinition, Tt as BaseControllerOptions, U as MiddlewareHandler, Ut as CrudRepository, V as LookupOption, W as ObjectId, Wt as InferDoc, X as PresetHook, Y as PresetFunction, Z as PresetResult, _ as Authenticator, _t as TypedResourceConfig, at as ResourceCacheConfig, b as ControllerQueryOptions, bt as ValidateOptions, ct as ResourceHooks, d as ApiResponse, dt as RouteHandlerMethod, et as RegistryEntry, f as ArcDecorator, ft as RouteSchemaOptions, g as AuthPluginOptions, gt as TypedRepository, h as AuthHelpers, ht as TypedController, it as RequestWithExtras, j as GracefulShutdownOptions, k as FastifyWithDecorators, l as AdditionalRoute, lt as ResourceMetadata, m as ArcRequest, mt as TokenPair, nt as RequestContext, ot as ResourceConfig, p as ArcInternalMetadata, pt as ServiceContext, q as ParsedQuery, qt as QueryOptions, rt as RequestIdOptions, st as ResourceHookContext, tt as RegistryStats, u as AnyRecord, ut as ResourcePermissions, v as AuthenticatorContext, vt as UserLike, w as CrudSchemas, x as CrudController, xt as ValidationResult, y as ConfigError, yt as UserOrganization, z as JWTPayload } from "../interface-
|
|
3
|
-
import { i as UserBase, n as PermissionContext, r as PermissionResult, t as PermissionCheck } from "../types-
|
|
4
|
-
import { n as ElevationOptions, t as ElevationEvent } from "../elevation-
|
|
1
|
+
import { _ as isAuthenticated, c as getOrgRoles, g as hasOrgAccess, n as PUBLIC_SCOPE, p as getTeamId, r as RequestScope, s as getOrgId, t as AUTHENTICATED_SCOPE, v as isElevated, y as isMember } from "../types--D3vvfdt.mjs";
|
|
2
|
+
import { $ as RateLimitConfig, A as FieldRule, B as JwtContext, C as CrudRouterOptions, Ct as getUserId, D as FastifyRequestExtras, E as EventsDecorator, F as InferDocType, Ft as IController, G as OpenApiSchemas, Gt as PaginatedResult, H as MiddlewareConfig, I as InferResourceDoc, It as IControllerResponse, J as PopulateOption, K as OwnershipCheck, Kt as PaginationParams, L as IntrospectionData, Lt as IRequestContext, M as HealthCheck, Mt as ControllerHandler, N as HealthOptions, Nt as ControllerLike, O as FastifyWithAuth, P as InferAdapterDoc, Pt as FastifyHandler, Q as QueryParserInterface, R as IntrospectionPluginOptions, Rt as RouteHandler, S as CrudRouteKey, St as envelope, T as EventDefinition, Tt as BaseControllerOptions, U as MiddlewareHandler, Ut as CrudRepository, V as LookupOption, W as ObjectId, Wt as InferDoc, X as PresetHook, Y as PresetFunction, Z as PresetResult, _ as Authenticator, _t as TypedResourceConfig, at as ResourceCacheConfig, b as ControllerQueryOptions, bt as ValidateOptions, ct as ResourceHooks, d as ApiResponse, dt as RouteHandlerMethod, et as RegistryEntry, f as ArcDecorator, ft as RouteSchemaOptions, g as AuthPluginOptions, gt as TypedRepository, h as AuthHelpers, ht as TypedController, it as RequestWithExtras, j as GracefulShutdownOptions, k as FastifyWithDecorators, l as AdditionalRoute, lt as ResourceMetadata, m as ArcRequest, mt as TokenPair, nt as RequestContext, ot as ResourceConfig, p as ArcInternalMetadata, pt as ServiceContext, q as ParsedQuery, qt as QueryOptions, rt as RequestIdOptions, st as ResourceHookContext, tt as RegistryStats, u as AnyRecord, ut as ResourcePermissions, v as AuthenticatorContext, vt as UserLike, w as CrudSchemas, x as CrudController, xt as ValidationResult, y as ConfigError, yt as UserOrganization, z as JWTPayload } from "../interface-B91alUzq.mjs";
|
|
3
|
+
import { i as UserBase, n as PermissionContext, r as PermissionResult, t as PermissionCheck } from "../types-B4BNthET.mjs";
|
|
4
|
+
import { n as ElevationOptions, t as ElevationEvent } from "../elevation-D7WK0RXq.mjs";
|
|
5
5
|
export { AUTHENTICATED_SCOPE, AdditionalRoute, AnyRecord, ApiResponse, ArcDecorator, ArcInternalMetadata, ArcRequest, AuthHelpers, AuthPluginOptions, Authenticator, AuthenticatorContext, BaseControllerOptions, ConfigError, ControllerHandler, ControllerLike, ControllerQueryOptions, CrudController, CrudRepository, CrudRouteKey, CrudRouterOptions, CrudSchemas, ElevationEvent, ElevationOptions, EventDefinition, EventsDecorator, FastifyHandler, FastifyRequestExtras, FastifyWithAuth, FastifyWithDecorators, FieldRule, GracefulShutdownOptions, HealthCheck, HealthOptions, IController, IControllerResponse, IRequestContext, InferAdapterDoc, InferDoc, InferDocType, InferResourceDoc, IntrospectionData, IntrospectionPluginOptions, JWTPayload, JwtContext, LookupOption, MiddlewareConfig, MiddlewareHandler, ObjectId, OpenApiSchemas, OwnershipCheck, PUBLIC_SCOPE, PaginatedResult, PaginationParams, ParsedQuery, PermissionCheck, PermissionContext, PermissionResult, PopulateOption, PresetFunction, PresetHook, PresetResult, QueryOptions, QueryParserInterface, RateLimitConfig, RegistryEntry, RegistryStats, RequestContext, RequestIdOptions, RequestScope, RequestWithExtras, ResourceCacheConfig, ResourceConfig, ResourceHookContext, ResourceHooks, ResourceMetadata, ResourcePermissions, RouteHandler, RouteHandlerMethod, RouteSchemaOptions, ServiceContext, TokenPair, TypedController, TypedRepository, TypedResourceConfig, UserBase, UserLike, UserOrganization, ValidateOptions, ValidationResult, envelope, getOrgId, getOrgRoles, getTeamId, getUserId, hasOrgAccess, isAuthenticated, isElevated, isMember };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Vt as ResourceDefinition } from "./interface-
|
|
1
|
+
import { Vt as ResourceDefinition } from "./interface-B91alUzq.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/integrations/mcp/types.d.ts
|
|
@@ -220,12 +220,28 @@ interface McpSession {
|
|
|
220
220
|
}
|
|
221
221
|
/** Resolved auth identity for a single MCP request */
|
|
222
222
|
interface McpAuthResult {
|
|
223
|
-
|
|
223
|
+
/**
|
|
224
|
+
* Human user ID. Optional for service/machine principals — when `clientId`
|
|
225
|
+
* is set and `userId` is omitted, the principal is purely machine-identity
|
|
226
|
+
* and `ctx.user` will be `null` (not a synthetic user object).
|
|
227
|
+
*/
|
|
228
|
+
userId?: string;
|
|
224
229
|
organizationId?: string;
|
|
225
230
|
/** User roles (global) — used by guard helpers like requireRole() */
|
|
226
231
|
roles?: string[];
|
|
227
232
|
/** Org-level roles — used by guard helpers */
|
|
228
233
|
orgRoles?: string[];
|
|
234
|
+
/**
|
|
235
|
+
* OAuth client ID — set this to enable `kind: "service"` scope.
|
|
236
|
+
* When present, buildRequestContext produces a service scope instead
|
|
237
|
+
* of member/authenticated, enabling `requireServiceScope()` checks.
|
|
238
|
+
*/
|
|
239
|
+
clientId?: string;
|
|
240
|
+
/**
|
|
241
|
+
* OAuth scopes (e.g. `['read:products', 'write:orders']`).
|
|
242
|
+
* Carried on the `service` RequestScope for fine-grained permission checks.
|
|
243
|
+
*/
|
|
244
|
+
scopes?: readonly string[];
|
|
229
245
|
/** Any extra metadata from the auth resolver */
|
|
230
246
|
[key: string]: unknown;
|
|
231
247
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { _ as Authenticator } from "./interface-
|
|
2
|
-
import { n as ElevationOptions } from "./elevation-
|
|
3
|
-
import { t as ExternalOpenApiPaths } from "./externalPaths-
|
|
4
|
-
import { i as CacheStore } from "./interface-
|
|
5
|
-
import { r as QueryCachePluginOptions } from "./queryCachePlugin-
|
|
6
|
-
import { i as EventTransport } from "./EventTransport-
|
|
7
|
-
import { t as EventPluginOptions } from "./eventPlugin-
|
|
8
|
-
import { c as MetricsOptions, d as SSEOptions, m as CachingOptions, r as VersioningOptions, t as ErrorHandlerOptions } from "./errorHandler-
|
|
9
|
-
import { r as IdempotencyStore } from "./interface-
|
|
1
|
+
import { _ as Authenticator } from "./interface-B91alUzq.mjs";
|
|
2
|
+
import { n as ElevationOptions } from "./elevation-D7WK0RXq.mjs";
|
|
3
|
+
import { t as ExternalOpenApiPaths } from "./externalPaths-iba7jD3d.mjs";
|
|
4
|
+
import { i as CacheStore } from "./interface-CG7oRZjX.mjs";
|
|
5
|
+
import { r as QueryCachePluginOptions } from "./queryCachePlugin-Ckl71mkc.mjs";
|
|
6
|
+
import { i as EventTransport } from "./EventTransport-C4VheKeC.mjs";
|
|
7
|
+
import { t as EventPluginOptions } from "./eventPlugin-CdvUoUna.mjs";
|
|
8
|
+
import { c as MetricsOptions, d as SSEOptions, m as CachingOptions, r as VersioningOptions, t as ErrorHandlerOptions } from "./errorHandler-pCpEtNd7.mjs";
|
|
9
|
+
import { r as IdempotencyStore } from "./interface-CSbZdv_3.mjs";
|
|
10
10
|
import { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest, FastifyServerOptions } from "fastify";
|
|
11
11
|
|
|
12
12
|
//#region src/factory/loadResources.d.ts
|
|
@@ -107,6 +107,10 @@ interface LoadResourcesOptions {
|
|
|
107
107
|
* @default false
|
|
108
108
|
*/
|
|
109
109
|
silent?: boolean;
|
|
110
|
+
/** Optional logger for diagnostics. No output when omitted (silent by default). */
|
|
111
|
+
logger?: {
|
|
112
|
+
warn: (msg: string) => void;
|
|
113
|
+
};
|
|
110
114
|
}
|
|
111
115
|
/**
|
|
112
116
|
* Scan a directory for resource files and import their default exports.
|
|
@@ -598,6 +602,41 @@ interface CreateAppOptions {
|
|
|
598
602
|
ajv?: {
|
|
599
603
|
keywords?: string[];
|
|
600
604
|
};
|
|
605
|
+
/**
|
|
606
|
+
* Enable `reply.ok()`, `reply.fail()`, `reply.paginated()` response helpers.
|
|
607
|
+
*
|
|
608
|
+
* Default: `false` (opt-in).
|
|
609
|
+
*
|
|
610
|
+
* @example
|
|
611
|
+
* ```typescript
|
|
612
|
+
* const app = await createApp({ replyHelpers: true });
|
|
613
|
+
*
|
|
614
|
+
* // Then in any handler:
|
|
615
|
+
* return reply.ok({ name: 'MacBook' }); // → 200 { success: true, data: { ... } }
|
|
616
|
+
* return reply.ok(product, 201); // → 201 { success: true, data: { ... } }
|
|
617
|
+
* return reply.fail('Not found', 404); // → 404 { success: false, error: '...' }
|
|
618
|
+
* return reply.fail(['err1', 'err2'], 422); // → 422 { success: false, errors: [...] }
|
|
619
|
+
* return reply.paginated({ docs, total, page, limit });
|
|
620
|
+
* ```
|
|
621
|
+
*/
|
|
622
|
+
replyHelpers?: boolean;
|
|
623
|
+
/**
|
|
624
|
+
* Auto-convert BigInt values to Number in all JSON responses.
|
|
625
|
+
*
|
|
626
|
+
* When `true`, Arc adds a `preSerialization` hook that converts BigInt values
|
|
627
|
+
* to Number before JSON serialization. Without this, `JSON.stringify` throws
|
|
628
|
+
* on BigInt values (e.g., from financial libraries like fin-io).
|
|
629
|
+
*
|
|
630
|
+
* Default: `false` (opt-in — most apps don't use BigInt).
|
|
631
|
+
*
|
|
632
|
+
* @example
|
|
633
|
+
* ```typescript
|
|
634
|
+
* const app = await createApp({
|
|
635
|
+
* serializeBigInt: true,
|
|
636
|
+
* });
|
|
637
|
+
* ```
|
|
638
|
+
*/
|
|
639
|
+
serializeBigInt?: boolean;
|
|
601
640
|
/**
|
|
602
641
|
* Resources to register automatically.
|
|
603
642
|
* Each resource's `.toPlugin()` is called and registered for you.
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { G as OpenApiSchemas, Q as QueryParserInterface, q as ParsedQuery, u as AnyRecord } from "../interface-
|
|
2
|
-
import { a as NotFoundError, c as RateLimitError, d as ValidationError, i as ForbiddenError, l as ServiceUnavailableError, m as isArcError, n as ConflictError, o as OrgAccessDeniedError, p as createError, r as ErrorDetails, s as OrgRequiredError, t as ArcError, u as UnauthorizedError } from "../errors-
|
|
3
|
-
import { a as CircuitBreakerStats, c as createCircuitBreakerRegistry, i as CircuitBreakerRegistry, n as CircuitBreakerError, o as CircuitState, r as CircuitBreakerOptions, s as createCircuitBreaker, t as CircuitBreaker } from "../circuitBreaker-
|
|
1
|
+
import { G as OpenApiSchemas, Q as QueryParserInterface, q as ParsedQuery, u as AnyRecord } from "../interface-B91alUzq.mjs";
|
|
2
|
+
import { a as NotFoundError, c as RateLimitError, d as ValidationError, i as ForbiddenError, l as ServiceUnavailableError, m as isArcError, n as ConflictError, o as OrgAccessDeniedError, p as createError, r as ErrorDetails, s as OrgRequiredError, t as ArcError, u as UnauthorizedError } from "../errors-BS6lZvWy.mjs";
|
|
3
|
+
import { a as CircuitBreakerStats, c as createCircuitBreakerRegistry, i as CircuitBreakerRegistry, n as CircuitBreakerError, o as CircuitState, r as CircuitBreakerOptions, s as createCircuitBreaker, t as CircuitBreaker } from "../circuitBreaker-BBPDt-J_.mjs";
|
|
4
4
|
import { FastifyInstance } from "fastify";
|
|
5
5
|
|
|
6
6
|
//#region src/utils/compensation.d.ts
|
package/dist/utils/index.mjs
CHANGED
|
@@ -2,6 +2,6 @@ import { n as createQueryParser, t as ArcQueryParser } from "../queryParser-CgCt
|
|
|
2
2
|
import { a as createCircuitBreaker, i as CircuitState, n as CircuitBreakerError, o as createCircuitBreakerRegistry, r as CircuitBreakerRegistry, t as CircuitBreaker } from "../circuitBreaker-l18oRgL5.mjs";
|
|
3
3
|
import { _ as defineCompensation, a as getListQueryParams, c as listResponse, d as paginateWrapper, f as paginationSchema, g as wrapResponse, h as successResponseSchema, i as getDefaultCrudSchemas, l as messageWrapper, m as responses, n as deleteResponse, o as itemResponse, p as queryParams, r as errorResponseSchema, s as itemWrapper, t as createStateMachine, u as mutationResponse, v as withCompensation } from "../utils-B-l6410F.mjs";
|
|
4
4
|
import { a as OrgAccessDeniedError, c as ServiceUnavailableError, f as createError, i as NotFoundError, l as UnauthorizedError, n as ConflictError, o as OrgRequiredError, p as isArcError, r as ForbiddenError, s as RateLimitError, t as ArcError, u as ValidationError } from "../errors-Cg58SLNi.mjs";
|
|
5
|
-
import { a as toJsonSchema, i as isZodSchema, n as convertRouteSchema, r as isJsonSchema, t as convertOpenApiSchemas } from "../schemaConverter-
|
|
5
|
+
import { a as toJsonSchema, i as isZodSchema, n as convertRouteSchema, r as isJsonSchema, t as convertOpenApiSchemas } from "../schemaConverter-Y5EejTnJ.mjs";
|
|
6
6
|
import { t as hasEvents } from "../typeGuards-CcFZXgU7.mjs";
|
|
7
7
|
export { ArcError, ArcQueryParser, CircuitBreaker, CircuitBreakerError, CircuitBreakerRegistry, CircuitState, ConflictError, ForbiddenError, NotFoundError, OrgAccessDeniedError, OrgRequiredError, RateLimitError, ServiceUnavailableError, UnauthorizedError, ValidationError, convertOpenApiSchemas, convertRouteSchema, createCircuitBreaker, createCircuitBreakerRegistry, createError, createQueryParser, createStateMachine, defineCompensation, deleteResponse, errorResponseSchema, getDefaultCrudSchemas, getListQueryParams, hasEvents, isArcError, isJsonSchema, isZodSchema, itemResponse, itemWrapper, listResponse, messageWrapper, mutationResponse, paginateWrapper, paginationSchema, queryParams, responses, successResponseSchema, toJsonSchema, withCompensation, wrapResponse };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classytic/arc",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.7",
|
|
4
4
|
"description": "Resource-oriented backend framework for Fastify — clean, minimal, powerful, tree-shakable",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -212,20 +212,23 @@
|
|
|
212
212
|
"lint:fix": "biome check --fix src/",
|
|
213
213
|
"lint:all": "biome check src/ tests/",
|
|
214
214
|
"test": "vitest run",
|
|
215
|
+
"test:main": "vitest run",
|
|
216
|
+
"test:perf": "node --expose-gc ./node_modules/vitest/vitest.mjs run --config vitest.perf.config.ts",
|
|
217
|
+
"test:ci": "npm run test:main && npm run test:perf",
|
|
215
218
|
"test:watch": "vitest",
|
|
216
219
|
"test:ui": "vitest --ui",
|
|
217
220
|
"test:coverage": "vitest run --coverage",
|
|
218
221
|
"test:e2e": "vitest run tests/e2e",
|
|
219
222
|
"test:unit": "vitest run tests/core tests/hooks tests/utils tests/plugins",
|
|
220
223
|
"smoke": "node scripts/smoke-test.mjs",
|
|
221
|
-
"prepublishOnly": "npm run typecheck && npm
|
|
224
|
+
"prepublishOnly": "npm run typecheck && npm run lint && npm run build && npm run test:ci && npm run smoke"
|
|
222
225
|
},
|
|
223
226
|
"engines": {
|
|
224
227
|
"node": ">=22"
|
|
225
228
|
},
|
|
226
229
|
"peerDependencies": {
|
|
227
|
-
"@classytic/mongokit": ">=3.5.
|
|
228
|
-
"@classytic/streamline": ">=2.
|
|
230
|
+
"@classytic/mongokit": ">=3.5.6",
|
|
231
|
+
"@classytic/streamline": ">=2.1.0",
|
|
229
232
|
"@fastify/cors": ">=11.0.0",
|
|
230
233
|
"@fastify/helmet": ">=13.0.0",
|
|
231
234
|
"@fastify/jwt": ">=10.0.0",
|
|
@@ -343,7 +346,8 @@
|
|
|
343
346
|
"devDependencies": {
|
|
344
347
|
"@better-auth/mongo-adapter": "^1.6.0",
|
|
345
348
|
"@biomejs/biome": "^2.4.10",
|
|
346
|
-
"@classytic/mongokit": "
|
|
349
|
+
"@classytic/mongokit": "3.5.6",
|
|
350
|
+
"@classytic/streamline": "^2.1.0",
|
|
347
351
|
"@fastify/cors": "^11.2.0",
|
|
348
352
|
"@fastify/helmet": "^13.0.2",
|
|
349
353
|
"@fastify/jwt": "^10.0.0",
|