@classytic/arc 2.4.2 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BaseController-CkM5dUh_.mjs → BaseController-CNwMYpDW.mjs} +1 -1
- package/dist/adapters/index.d.mts +2 -2
- package/dist/auth/index.d.mts +1 -1
- package/dist/auth/index.mjs +2 -2
- package/dist/cache/index.mjs +2 -2
- package/dist/cli/commands/describe.d.mts +1 -1
- package/dist/cli/commands/describe.mjs +1 -1
- package/dist/cli/commands/generate.d.mts +1 -1
- package/dist/cli/commands/generate.mjs +1 -1
- package/dist/cli/commands/init.d.mts +1 -1
- package/dist/cli/commands/init.mjs +1 -1
- package/dist/cli/commands/introspect.d.mts +1 -1
- package/dist/cli/commands/introspect.mjs +1 -1
- package/dist/cli/index.d.mts +4 -4
- package/dist/cli/index.mjs +4 -4
- package/dist/core/index.d.mts +2 -2
- package/dist/core/index.mjs +2 -2
- package/dist/{createApp-ByWNRsZj.mjs → createApp-oic3-ieX.mjs} +5 -5
- package/dist/{defineResource-D9aY5Cy6.mjs → defineResource-BYm3CIoe.mjs} +85 -10
- package/dist/discovery/index.d.mts +1 -1
- package/dist/discovery/index.mjs +1 -1
- package/dist/docs/index.d.mts +1 -1
- package/dist/dynamic/index.d.mts +1 -1
- package/dist/dynamic/index.mjs +2 -2
- package/dist/{elevation-Ca_yveIO.d.mts → elevation-C_taLQrM.d.mts} +27 -1
- package/dist/{errorHandler--zp54tGc.mjs → errorHandler-r2595m8T.mjs} +5 -5
- package/dist/{errors-CPpvPHT0.d.mts → errors-CcVbl1-T.d.mts} +17 -1
- package/dist/{errors-rxhfP7Hf.mjs → errors-NoQKsbAT.mjs} +23 -1
- package/dist/events/transports/redis.d.mts +1 -1
- package/dist/events/transports/redis.mjs +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/{index-BL8CaQih.d.mts → index-TG7-pXDC.d.mts} +2 -2
- package/dist/{index-yhxyjqNb.d.mts → index-bX8T5bmn.d.mts} +4 -8
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +7 -6
- package/dist/integrations/event-gateway.d.mts +1 -1
- package/dist/integrations/event-gateway.mjs +2 -2
- package/dist/integrations/index.d.mts +1 -1
- package/dist/integrations/jobs.d.mts +1 -1
- package/dist/integrations/jobs.mjs +1 -1
- package/dist/integrations/mcp/index.d.mts +2 -2
- package/dist/integrations/mcp/index.mjs +1 -1
- package/dist/integrations/mcp/testing.d.mts +1 -1
- package/dist/integrations/mcp/testing.mjs +1 -1
- package/dist/integrations/streamline.d.mts +1 -1
- package/dist/integrations/streamline.mjs +1 -1
- package/dist/integrations/websocket-redis.d.mts +1 -1
- package/dist/integrations/websocket-redis.mjs +1 -1
- package/dist/integrations/websocket.d.mts +1 -1
- package/dist/integrations/websocket.mjs +1 -1
- package/dist/{interface-DGmPxakH.d.mts → interface-BnNjdl33.d.mts} +170 -8
- package/dist/{memory-Cb_7iy9e.mjs → memory-BFAYkf8H.mjs} +1 -4
- package/dist/org/index.d.mts +1 -1
- package/dist/org/index.mjs +1 -1
- package/dist/permissions/index.mjs +1 -1
- package/dist/{permissions-CA5zg0yK.mjs → permissions-D9_AAtvz.mjs} +2 -2
- package/dist/plugins/index.d.mts +1 -1
- package/dist/plugins/index.mjs +3 -3
- package/dist/plugins/response-cache.d.mts +1 -1
- package/dist/plugins/response-cache.mjs +1 -1
- package/dist/plugins/tracing-entry.mjs +1 -1
- package/dist/presets/index.d.mts +2 -2
- package/dist/presets/index.mjs +2 -2
- package/dist/presets/multiTenant.d.mts +2 -2
- package/dist/presets/multiTenant.mjs +2 -2
- package/dist/{presets-C9QXJV1u.mjs → presets-CD3e6M7c.mjs} +3 -3
- package/dist/{queryCachePlugin-ClosZdNS.mjs → queryCachePlugin-XtFplYO9.mjs} +1 -1
- package/dist/registry/index.d.mts +1 -1
- package/dist/{resourceToTools-PMFE8HIv.mjs → resourceToTools-CN0lwJrL.mjs} +1 -1
- package/dist/scope/index.d.mts +2 -2
- package/dist/scope/index.mjs +2 -2
- package/dist/{sse-BkViJPlT.mjs → sse-BF7GR7IB.mjs} +1 -1
- package/dist/testing/index.d.mts +2 -2
- package/dist/testing/index.mjs +1 -1
- package/dist/types/index.d.mts +3 -3
- package/dist/types/index.mjs +23 -2
- package/dist/{types-C6TQjtdi.mjs → types-BhtYdxZU.mjs} +26 -1
- package/dist/{types-BJmgxNbF.d.mts → types-ByCPlfZ1.d.mts} +1 -1
- package/dist/{types-Dt0-AI6E.d.mts → types-Guk83PDz.d.mts} +2 -2
- package/dist/utils/index.d.mts +2 -2
- package/dist/utils/index.mjs +1 -1
- package/package.json +5 -4
- package/skills/arc/SKILL.md +64 -6
- package/skills/arc/references/mcp.md +135 -0
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { a as DEFAULT_SORT, c as HOOK_OPERATIONS, d as MAX_REGEX_LENGTH, f as MAX_SEARCH_LENGTH, h as SYSTEM_FIELDS, i as DEFAULT_MAX_LIMIT, l as HOOK_PHASES, m as RESERVED_QUERY_PARAMS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MUTATION_OPERATIONS, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as MAX_FILTER_DEPTH } from "./constants-Cxde4rpC.mjs";
|
|
2
2
|
import { a as createMongooseAdapter, i as MongooseAdapter, r as createPrismaAdapter, t as PrismaAdapter } from "./adapters-DTC4Ug66.mjs";
|
|
3
|
-
import { t as BaseController } from "./BaseController-
|
|
3
|
+
import { t as BaseController } from "./BaseController-CNwMYpDW.mjs";
|
|
4
|
+
import { envelope } from "./types/index.mjs";
|
|
4
5
|
import { n as applyFieldWritePermissions, r as fields, t as applyFieldReadPermissions } from "./fields-ipsbIRPK.mjs";
|
|
5
6
|
import { t as requestContext } from "./requestContext-DYtmNpm5.mjs";
|
|
6
|
-
import { i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-
|
|
7
|
-
import { a as validateResourceConfig, f as getControllerScope, i as formatValidationErrors, m as pipe, n as defineResource, r as assertValidConfig, t as ResourceDefinition } from "./defineResource-
|
|
8
|
-
import { _ as ownerWithAdminBypass, a as createOrgPermissions, b as publicReadAdminWrite, c as requireOrgMembership, d as requireRoles, f as requireTeamMembership, g as fullPublic, h as authenticated, i as createDynamicPermissionMatrix, l as requireOrgRole, m as adminOnly, n as allowPublic, o as denyAll, p as when, r as anyOf, s as requireAuth, t as allOf, u as requireOwnership, v as presets_exports, x as readOnly, y as publicRead } from "./permissions-
|
|
7
|
+
import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-NoQKsbAT.mjs";
|
|
8
|
+
import { a as validateResourceConfig, f as getControllerScope, i as formatValidationErrors, m as pipe, n as defineResource, r as assertValidConfig, t as ResourceDefinition } from "./defineResource-BYm3CIoe.mjs";
|
|
9
|
+
import { _ as ownerWithAdminBypass, a as createOrgPermissions, b as publicReadAdminWrite, c as requireOrgMembership, d as requireRoles, f as requireTeamMembership, g as fullPublic, h as authenticated, i as createDynamicPermissionMatrix, l as requireOrgRole, m as adminOnly, n as allowPublic, o as denyAll, p as when, r as anyOf, s as requireAuth, t as allOf, u as requireOwnership, v as presets_exports, x as readOnly, y as publicRead } from "./permissions-D9_AAtvz.mjs";
|
|
9
10
|
import { n as configureArcLogger, t as arcLog } from "./logger-Dz3j1ItV.mjs";
|
|
10
11
|
//#region src/middleware/middleware.ts
|
|
11
12
|
/**
|
|
@@ -126,6 +127,6 @@ function transform(name, handlerOrOptions) {
|
|
|
126
127
|
}
|
|
127
128
|
//#endregion
|
|
128
129
|
//#region src/index.ts
|
|
129
|
-
const version = "2.
|
|
130
|
+
const version = "2.5.0";
|
|
130
131
|
//#endregion
|
|
131
|
-
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, createDynamicPermissionMatrix, createMongooseAdapter, createOrgPermissions, createPrismaAdapter, defineResource, denyAll, fields, formatValidationErrors, fullPublic, getControllerScope, guard, intercept, middleware, ownerWithAdminBypass, presets_exports as permissions, pipe, publicRead, publicReadAdminWrite, readOnly, requestContext, requireAuth, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireTeamMembership, sortMiddlewares, transform, validateResourceConfig, version, when };
|
|
132
|
+
export { ArcError, BaseController, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, ForbiddenError, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, MongooseAdapter, NotFoundError, PrismaAdapter, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, UnauthorizedError, ValidationError, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, arcLog, assertValidConfig, authenticated, configureArcLogger, createDomainError, createDynamicPermissionMatrix, createMongooseAdapter, createOrgPermissions, createPrismaAdapter, defineResource, denyAll, envelope, fields, formatValidationErrors, fullPublic, getControllerScope, guard, intercept, middleware, ownerWithAdminBypass, presets_exports as permissions, pipe, publicRead, publicReadAdminWrite, readOnly, requestContext, requireAuth, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireTeamMembership, sortMiddlewares, transform, validateResourceConfig, version, when };
|
|
@@ -43,4 +43,4 @@ interface EventGatewayOptions {
|
|
|
43
43
|
}
|
|
44
44
|
declare const eventGatewayPlugin: FastifyPluginAsync<EventGatewayOptions>;
|
|
45
45
|
//#endregion
|
|
46
|
-
export { EventGatewayOptions, eventGatewayPlugin
|
|
46
|
+
export { EventGatewayOptions, eventGatewayPlugin };
|
|
@@ -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-BF7GR7IB.mjs").then((n) => n.r);
|
|
8
8
|
await fastify.register(ssePlugin, {
|
|
9
9
|
path: opts.sse?.path ?? "/events/stream",
|
|
10
10
|
requireAuth: auth,
|
|
@@ -44,4 +44,4 @@ const eventGatewayPlugin = fp(eventGatewayPluginImpl, {
|
|
|
44
44
|
fastify: "5.x"
|
|
45
45
|
});
|
|
46
46
|
//#endregion
|
|
47
|
-
export { eventGatewayPlugin
|
|
47
|
+
export { eventGatewayPlugin };
|
|
@@ -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-ByCPlfZ1.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 };
|
|
@@ -100,4 +100,4 @@ declare function defineJob<TData = unknown, TResult = unknown>(definition: JobDe
|
|
|
100
100
|
/** Pluggable BullMQ job queue integration for Arc */
|
|
101
101
|
declare const jobsPlugin: FastifyPluginAsync<JobsPluginOptions>;
|
|
102
102
|
//#endregion
|
|
103
|
-
export { JobDefinition, JobDispatchOptions, JobDispatcher, JobMeta, JobsPluginOptions, QueueStats,
|
|
103
|
+
export { JobDefinition, JobDispatchOptions, JobDispatcher, JobMeta, JobsPluginOptions, QueueStats, defineJob, jobsPlugin };
|
|
@@ -169,4 +169,4 @@ const jobsPluginImpl = async (fastify, options) => {
|
|
|
169
169
|
/** Pluggable BullMQ job queue integration for Arc */
|
|
170
170
|
const jobsPlugin = jobsPluginImpl;
|
|
171
171
|
//#endregion
|
|
172
|
-
export {
|
|
172
|
+
export { defineJob, jobsPlugin };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as McpAuthResolver, c as McpResourceConfig, d as SessionEntry, f as ToolAnnotations, i as CrudOperation, l as PromptDefinition, m as ToolDefinition, n as CallToolResult, o as McpAuthResult, p as ToolContext, r as CreateMcpServerConfig, s as McpPluginOptions, t as BetterAuthHandler, u as PromptResult } from "../../types-
|
|
1
|
+
import { Bt as ResourceDefinition } from "../../interface-BnNjdl33.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-ByCPlfZ1.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-CN0lwJrL.mjs";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import fp from "fastify-plugin";
|
|
4
4
|
//#region src/integrations/mcp/definePrompt.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as createMcpServer, t as resourceToTools } from "../../resourceToTools-
|
|
1
|
+
import { r as createMcpServer, t as resourceToTools } from "../../resourceToTools-CN0lwJrL.mjs";
|
|
2
2
|
//#region src/integrations/mcp/testing.ts
|
|
3
3
|
/**
|
|
4
4
|
* @classytic/arc/mcp/testing — MCP Test Utilities
|
|
@@ -57,4 +57,4 @@ interface StreamlinePluginOptions {
|
|
|
57
57
|
/** Pluggable streamline integration for Arc */
|
|
58
58
|
declare const streamlinePlugin: FastifyPluginAsync<StreamlinePluginOptions>;
|
|
59
59
|
//#endregion
|
|
60
|
-
export { StreamlinePluginOptions, WorkflowLike, WorkflowRunLike, streamlinePlugin
|
|
60
|
+
export { StreamlinePluginOptions, WorkflowLike, WorkflowRunLike, streamlinePlugin };
|
|
@@ -142,4 +142,4 @@ const streamlinePluginImpl = async (fastify, options) => {
|
|
|
142
142
|
/** Pluggable streamline integration for Arc */
|
|
143
143
|
const streamlinePlugin = streamlinePluginImpl;
|
|
144
144
|
//#endregion
|
|
145
|
-
export { streamlinePlugin
|
|
145
|
+
export { streamlinePlugin };
|
|
@@ -43,4 +43,4 @@ declare class RedisWebSocketAdapter implements WebSocketAdapter {
|
|
|
43
43
|
close(): Promise<void>;
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
|
-
export { RedisLike, RedisWebSocketAdapter,
|
|
46
|
+
export { RedisLike, RedisWebSocketAdapter, RedisWebSocketAdapterOptions };
|
|
@@ -145,4 +145,4 @@ declare class RoomManager {
|
|
|
145
145
|
/** Pluggable WebSocket integration for Arc */
|
|
146
146
|
declare const websocketPlugin: FastifyPluginAsync<WebSocketPluginOptions>;
|
|
147
147
|
//#endregion
|
|
148
|
-
export { LocalWebSocketAdapter, RoomManager, WebSocketAdapter, WebSocketClient, WebSocketMessage, WebSocketPluginOptions, websocketPlugin
|
|
148
|
+
export { LocalWebSocketAdapter, RoomManager, WebSocketAdapter, WebSocketClient, WebSocketMessage, WebSocketPluginOptions, websocketPlugin };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as RequestScope } from "./elevation-
|
|
1
|
+
import { s as RequestScope } from "./elevation-C_taLQrM.mjs";
|
|
2
2
|
import { n as FieldPermissionMap } from "./fields-DFwdaWCq.mjs";
|
|
3
3
|
import { i as UserBase, t as PermissionCheck } from "./types-BNUccdcf.mjs";
|
|
4
4
|
import { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest, RouteHandlerMethod, RouteHandlerMethod as RouteHandlerMethod$1 } from "fastify";
|
|
@@ -1073,6 +1073,46 @@ declare module 'fastify' {
|
|
|
1073
1073
|
_ownershipCheck?: Record<string, unknown>;
|
|
1074
1074
|
}
|
|
1075
1075
|
}
|
|
1076
|
+
/**
|
|
1077
|
+
* Typed Fastify request with Arc decorations.
|
|
1078
|
+
*
|
|
1079
|
+
* Use this in `wrapHandler: false` handlers instead of `(req as any).user`.
|
|
1080
|
+
*
|
|
1081
|
+
* @example
|
|
1082
|
+
* ```typescript
|
|
1083
|
+
* import type { ArcRequest } from '@classytic/arc';
|
|
1084
|
+
*
|
|
1085
|
+
* handler: async (req: ArcRequest, reply: FastifyReply) => {
|
|
1086
|
+
* req.user?.id; // typed
|
|
1087
|
+
* req.scope.organizationId; // typed (when member)
|
|
1088
|
+
* req.signal; // AbortSignal (Fastify 5)
|
|
1089
|
+
* }
|
|
1090
|
+
* ```
|
|
1091
|
+
*/
|
|
1092
|
+
type ArcRequest = FastifyRequest & {
|
|
1093
|
+
scope: RequestScope;
|
|
1094
|
+
user: Record<string, unknown> | undefined;
|
|
1095
|
+
signal: AbortSignal;
|
|
1096
|
+
};
|
|
1097
|
+
/**
|
|
1098
|
+
* Response envelope helper — wraps data in Arc's standard `{ success, data }` format.
|
|
1099
|
+
*
|
|
1100
|
+
* @example
|
|
1101
|
+
* ```typescript
|
|
1102
|
+
* import { envelope } from '@classytic/arc';
|
|
1103
|
+
*
|
|
1104
|
+
* handler: async (req, reply) => {
|
|
1105
|
+
* const data = await getResults();
|
|
1106
|
+
* return envelope(data);
|
|
1107
|
+
* // → { success: true, data }
|
|
1108
|
+
* }
|
|
1109
|
+
* ```
|
|
1110
|
+
*/
|
|
1111
|
+
declare function envelope<T>(data: T, meta?: Record<string, unknown>): {
|
|
1112
|
+
success: true;
|
|
1113
|
+
data: T;
|
|
1114
|
+
[key: string]: unknown;
|
|
1115
|
+
};
|
|
1076
1116
|
type AnyRecord = Record<string, unknown>;
|
|
1077
1117
|
/** MongoDB ObjectId — accepts string or any object with a `toString()` (e.g. mongoose ObjectId). */
|
|
1078
1118
|
type ObjectId = string | {
|
|
@@ -1475,6 +1515,22 @@ interface ResourceConfig<TDoc = AnyRecord> {
|
|
|
1475
1515
|
skipValidation?: boolean;
|
|
1476
1516
|
skipRegistry?: boolean;
|
|
1477
1517
|
_appliedPresets?: string[];
|
|
1518
|
+
/**
|
|
1519
|
+
* Called during plugin registration with the scoped Fastify instance.
|
|
1520
|
+
* Use for wiring singletons, reading decorators, or setting up resource-specific
|
|
1521
|
+
* services that need access to the Fastify instance.
|
|
1522
|
+
*
|
|
1523
|
+
* @example
|
|
1524
|
+
* ```typescript
|
|
1525
|
+
* defineResource({
|
|
1526
|
+
* name: 'notification',
|
|
1527
|
+
* onRegister: (fastify) => {
|
|
1528
|
+
* setSseManager(fastify.sseManager);
|
|
1529
|
+
* },
|
|
1530
|
+
* })
|
|
1531
|
+
* ```
|
|
1532
|
+
*/
|
|
1533
|
+
onRegister?: (fastify: FastifyInstance) => void | Promise<void>;
|
|
1478
1534
|
/** HTTP method for update routes. Default: 'PATCH' */
|
|
1479
1535
|
updateMethod?: 'PUT' | 'PATCH' | 'both';
|
|
1480
1536
|
/**
|
|
@@ -1501,13 +1557,53 @@ interface ResourcePermissions {
|
|
|
1501
1557
|
update?: PermissionCheck;
|
|
1502
1558
|
delete?: PermissionCheck;
|
|
1503
1559
|
}
|
|
1560
|
+
/**
|
|
1561
|
+
* Hook context passed to resource-level hook handlers.
|
|
1562
|
+
* Mirrors HookSystem's HookContext but with a simpler API for inline use.
|
|
1563
|
+
*/
|
|
1564
|
+
interface ResourceHookContext {
|
|
1565
|
+
/** The document data (create/update body, or existing doc for delete) */
|
|
1566
|
+
data: AnyRecord;
|
|
1567
|
+
/** Authenticated user or null */
|
|
1568
|
+
user?: UserBase;
|
|
1569
|
+
/** Additional metadata (e.g. `{ id, existing }` for update/delete) */
|
|
1570
|
+
meta?: AnyRecord;
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* Inline lifecycle hooks on a resource definition.
|
|
1574
|
+
* These are wired into the HookSystem automatically — same pipeline as presets and app-level hooks.
|
|
1575
|
+
*
|
|
1576
|
+
* @example
|
|
1577
|
+
* ```typescript
|
|
1578
|
+
* defineResource({
|
|
1579
|
+
* name: 'chat',
|
|
1580
|
+
* hooks: {
|
|
1581
|
+
* afterCreate: async (ctx) => {
|
|
1582
|
+
* analytics.track('chat.created', { chatId: ctx.data._id, userId: ctx.user?.id });
|
|
1583
|
+
* },
|
|
1584
|
+
* beforeDelete: async (ctx) => {
|
|
1585
|
+
* if (ctx.data.isProtected) throw new Error('Cannot delete protected chat');
|
|
1586
|
+
* },
|
|
1587
|
+
* afterDelete: async (ctx) => {
|
|
1588
|
+
* await notificationService.send('chat.deleted', { id: ctx.meta?.id });
|
|
1589
|
+
* },
|
|
1590
|
+
* },
|
|
1591
|
+
* });
|
|
1592
|
+
* ```
|
|
1593
|
+
*/
|
|
1504
1594
|
interface ResourceHooks {
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1595
|
+
/** Runs before create — can modify data by returning a new object */
|
|
1596
|
+
beforeCreate?: (ctx: ResourceHookContext) => Promise<AnyRecord | void> | AnyRecord | void;
|
|
1597
|
+
/** Runs after create — receives the created document */
|
|
1598
|
+
afterCreate?: (ctx: ResourceHookContext) => Promise<void> | void;
|
|
1599
|
+
/** Runs before update — ctx.meta.id has the resource ID, ctx.meta.existing has the current doc */
|
|
1600
|
+
beforeUpdate?: (ctx: ResourceHookContext) => Promise<AnyRecord | void> | AnyRecord | void;
|
|
1601
|
+
/** Runs after update — receives the updated document */
|
|
1602
|
+
afterUpdate?: (ctx: ResourceHookContext) => Promise<void> | void;
|
|
1603
|
+
/** Runs before delete — ctx.data is the existing doc, ctx.meta.id has the resource ID */
|
|
1604
|
+
beforeDelete?: (ctx: ResourceHookContext) => Promise<void> | void;
|
|
1605
|
+
/** Runs after delete — ctx.data is the deleted doc, ctx.meta.id has the resource ID */
|
|
1606
|
+
afterDelete?: (ctx: ResourceHookContext) => Promise<void> | void;
|
|
1511
1607
|
}
|
|
1512
1608
|
/**
|
|
1513
1609
|
* Additional route definition for custom endpoints
|
|
@@ -1556,6 +1652,41 @@ interface AdditionalRoute {
|
|
|
1556
1652
|
* preHandler: (fastify) => [fastify.customerContext({ required: true })]
|
|
1557
1653
|
*/
|
|
1558
1654
|
preHandler?: RouteHandlerMethod[] | ((fastify: FastifyInstance) => RouteHandlerMethod[]);
|
|
1655
|
+
/**
|
|
1656
|
+
* Pre-auth handlers — run BEFORE authentication middleware.
|
|
1657
|
+
* Use for promoting query params to headers (e.g., EventSource ?token= → Authorization).
|
|
1658
|
+
*
|
|
1659
|
+
* @example
|
|
1660
|
+
* ```typescript
|
|
1661
|
+
* preAuth: [(req) => {
|
|
1662
|
+
* const token = (req.query as Record<string, string>)?.token;
|
|
1663
|
+
* if (token) req.headers.authorization = `Bearer ${token}`;
|
|
1664
|
+
* }]
|
|
1665
|
+
* ```
|
|
1666
|
+
*/
|
|
1667
|
+
preAuth?: RouteHandlerMethod[];
|
|
1668
|
+
/**
|
|
1669
|
+
* Streaming response mode — designed for SSE and AI streaming routes.
|
|
1670
|
+
* When `true`:
|
|
1671
|
+
* - Forces `wrapHandler: false` (no `{ success, data }` wrapper)
|
|
1672
|
+
* - Sets SSE headers: `Content-Type: text/event-stream`, `Cache-Control: no-cache`, `Connection: keep-alive`
|
|
1673
|
+
* - `request.signal` (Fastify 5 built-in) is available for abort-on-disconnect
|
|
1674
|
+
*
|
|
1675
|
+
* @example
|
|
1676
|
+
* ```typescript
|
|
1677
|
+
* {
|
|
1678
|
+
* method: 'POST',
|
|
1679
|
+
* path: '/stream',
|
|
1680
|
+
* streamResponse: true,
|
|
1681
|
+
* permissions: requireAuth(),
|
|
1682
|
+
* handler: async (request, reply) => {
|
|
1683
|
+
* const { stream } = await generateStream({ abortSignal: request.signal });
|
|
1684
|
+
* return reply.send(stream);
|
|
1685
|
+
* },
|
|
1686
|
+
* }
|
|
1687
|
+
* ```
|
|
1688
|
+
*/
|
|
1689
|
+
streamResponse?: boolean;
|
|
1559
1690
|
/** Fastify route schema */
|
|
1560
1691
|
schema?: Record<string, unknown>;
|
|
1561
1692
|
/**
|
|
@@ -2126,12 +2257,43 @@ type TypedRepository<TDoc> = CrudRepository<TDoc>;
|
|
|
2126
2257
|
*
|
|
2127
2258
|
* CrudRepository<TDoc> and MongoKit Repository both satisfy this interface.
|
|
2128
2259
|
*/
|
|
2260
|
+
/**
|
|
2261
|
+
* Minimal repository interface for flexible adapter compatibility.
|
|
2262
|
+
* Any repository with these method signatures is accepted.
|
|
2263
|
+
*
|
|
2264
|
+
* **Required** — core CRUD (every resource needs these):
|
|
2265
|
+
* getAll, getById, create, update, delete
|
|
2266
|
+
*
|
|
2267
|
+
* **Recommended** — used by AccessControl for compound queries:
|
|
2268
|
+
* getOne
|
|
2269
|
+
*
|
|
2270
|
+
* **Optional** — enabled by presets, checked at runtime:
|
|
2271
|
+
* getBySlug — slugLookup preset
|
|
2272
|
+
* getDeleted — softDelete preset (list soft-deleted)
|
|
2273
|
+
* restore — softDelete preset (restore soft-deleted)
|
|
2274
|
+
* getTree — tree preset (hierarchical queries)
|
|
2275
|
+
* getChildren — tree preset (child nodes)
|
|
2276
|
+
* createMany — bulk preset (batch create)
|
|
2277
|
+
* updateMany — bulk preset (batch update by filter)
|
|
2278
|
+
* deleteMany — bulk preset (batch delete by filter)
|
|
2279
|
+
*/
|
|
2129
2280
|
interface RepositoryLike {
|
|
2130
2281
|
getAll(params?: unknown): Promise<unknown>;
|
|
2131
2282
|
getById(id: string, options?: unknown): Promise<unknown>;
|
|
2132
2283
|
create(data: unknown, options?: unknown): Promise<unknown>;
|
|
2133
2284
|
update(id: string, data: unknown, options?: unknown): Promise<unknown>;
|
|
2134
2285
|
delete(id: string, options?: unknown): Promise<unknown>;
|
|
2286
|
+
/** Find single doc by compound filter — used by AccessControl for idField + org/policy scoping.
|
|
2287
|
+
* Without this, Arc falls back to getById + post-fetch security checks. */
|
|
2288
|
+
getOne?(filter: Record<string, unknown>, options?: unknown): Promise<unknown>;
|
|
2289
|
+
getBySlug?(slug: string, options?: unknown): Promise<unknown>;
|
|
2290
|
+
getDeleted?(options?: unknown): Promise<unknown>;
|
|
2291
|
+
restore?(id: string): Promise<unknown>;
|
|
2292
|
+
getTree?(options?: unknown): Promise<unknown>;
|
|
2293
|
+
getChildren?(parentId: string, options?: unknown): Promise<unknown>;
|
|
2294
|
+
createMany?(items: unknown[], options?: unknown): Promise<unknown>;
|
|
2295
|
+
updateMany?(filter: Record<string, unknown>, data: unknown): Promise<unknown>;
|
|
2296
|
+
deleteMany?(filter: Record<string, unknown>): Promise<unknown>;
|
|
2135
2297
|
[key: string]: unknown;
|
|
2136
2298
|
}
|
|
2137
2299
|
interface DataAdapter<TDoc = unknown> {
|
|
@@ -2210,4 +2372,4 @@ interface ValidationResult {
|
|
|
2210
2372
|
}
|
|
2211
2373
|
type AdapterFactory<TDoc> = (config: unknown) => DataAdapter<TDoc>;
|
|
2212
2374
|
//#endregion
|
|
2213
|
-
export {
|
|
2375
|
+
export { RegistryEntry as $, PipelineStep as $t, GracefulShutdownOptions as A, AccessControlConfig as At, LookupOption as B, ResourceDefinition as Bt, CrudSchemas as C, BaseController as Ct, FastifyWithAuth as D, BodySanitizer as Dt, FastifyRequestExtras as E, QueryResolverConfig as Et, InferResourceDoc as F, IControllerResponse as Ft, OwnershipCheck as G, PaginationParams as Gt, MiddlewareHandler as H, CrudRepository as Ht, IntrospectionData as I, IRequestContext as It, PresetFunction as J, Interceptor as Jt, ParsedQuery as K, QueryOptions as Kt, IntrospectionPluginOptions as L, RouteHandler as Lt, HealthOptions as M, ControllerLike as Mt, InferAdapterDoc as N, FastifyHandler as Nt, FastifyWithDecorators as O, BodySanitizerConfig as Ot, InferDocType as P, IController as Pt, RateLimitConfig as Q, PipelineContext as Qt, JWTPayload as R, RegisterOptions as Rt, CrudRouterOptions as S, getUserId as St, EventsDecorator as T, QueryResolver as Tt, ObjectId as U, InferDoc as Ut, MiddlewareConfig as V, defineResource as Vt, OpenApiSchemas as W, PaginatedResult as Wt, PresetResult as X, OperationFilter as Xt, PresetHook as Y, NextFunction as Yt, QueryParserInterface as Z, PipelineConfig as Zt, AuthenticatorContext as _, UserLike as _t, RepositoryLike as a, HookPhase as an, ResourceConfig as at, CrudController as b, ValidationResult$1 as bt, AdditionalRoute as c, HookSystemOptions as cn, ResourceMetadata as ct, ArcDecorator as d, afterUpdate as dn, RouteSchemaOptions as dt, Transform as en, RegistryStats as et, ArcInternalMetadata as f, beforeCreate as fn, ServiceContext as ft, Authenticator as g, defineHook as gn, TypedResourceConfig as gt, AuthPluginOptions as h, createHookSystem as hn, TypedRepository as ht, RelationMetadata as i, HookOperation as in, ResourceCacheConfig as it, HealthCheck as j, ControllerHandler as jt, FieldRule as k, AccessControl as kt, AnyRecord as l, afterCreate as ln, ResourcePermissions as lt, AuthHelpers as m, beforeUpdate as mn, TypedController as mt, DataAdapter as n, HookContext as nn, RequestIdOptions as nt, SchemaMetadata as o, HookRegistration as on, ResourceHookContext as ot, ArcRequest as p, beforeDelete as pn, TokenPair as pt, PopulateOption as q, Guard as qt, FieldMetadata as r, HookHandler as rn, RequestWithExtras as rt, ValidationResult as s, HookSystem as sn, ResourceHooks as st, AdapterFactory as t, DefineHookOptions as tn, RequestContext as tt, ApiResponse as u, afterDelete as un, RouteHandlerMethod$1 as ut, ConfigError as v, UserOrganization as vt, EventDefinition as w, BaseControllerOptions as wt, CrudRouteKey as x, envelope as xt, ControllerQueryOptions as y, ValidateOptions as yt, JwtContext as z, ResourceRegistry as zt };
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
|
|
2
2
|
//#region src/cache/memory.ts
|
|
3
|
-
var memory_exports = /* @__PURE__ */ __exportAll({
|
|
4
|
-
MemoryCacheStore: () => MemoryCacheStore,
|
|
5
|
-
default: () => MemoryCacheStore
|
|
6
|
-
});
|
|
3
|
+
var memory_exports = /* @__PURE__ */ __exportAll({ MemoryCacheStore: () => MemoryCacheStore });
|
|
7
4
|
/**
|
|
8
5
|
* In-memory LRU+TTL cache store with hard entry cap and memory budget.
|
|
9
6
|
* - LRU eviction when `maxEntries` or `maxMemoryBytes` is reached
|
package/dist/org/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Lt as RouteHandler } from "../interface-BnNjdl33.mjs";
|
|
2
2
|
import { i as UserBase } from "../types-BNUccdcf.mjs";
|
|
3
3
|
import { InvitationAdapter, InvitationDoc, MemberDoc, OrgAdapter, OrgDoc, OrgPermissionStatement, OrgRole, OrganizationPluginOptions } from "./types.mjs";
|
|
4
4
|
import { FastifyPluginAsync, RouteHandlerMethod } from "fastify";
|
package/dist/org/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as getOrgRoles, d as isElevated, f as isMember, l as hasOrgAccess, n as PUBLIC_SCOPE } from "../types-BhtYdxZU.mjs";
|
|
2
2
|
import fp from "fastify-plugin";
|
|
3
3
|
//#region src/org/organizationPlugin.ts
|
|
4
4
|
const DEFAULT_ROLES = [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { i as resolveEffectiveRoles, n as applyFieldWritePermissions, r as fields, t as applyFieldReadPermissions } from "../fields-ipsbIRPK.mjs";
|
|
2
2
|
import { n as normalizeRoles, t as getUserRoles } from "../types-ZUu_h0jp.mjs";
|
|
3
|
-
import { S as createRoleHierarchy, _ as ownerWithAdminBypass, a as createOrgPermissions, b as publicReadAdminWrite, c as requireOrgMembership, d as requireRoles, f as requireTeamMembership, g as fullPublic, h as authenticated, i as createDynamicPermissionMatrix, l as requireOrgRole, m as adminOnly, n as allowPublic, o as denyAll, p as when, r as anyOf, s as requireAuth, t as allOf, u as requireOwnership, v as presets_exports, x as readOnly, y as publicRead } from "../permissions-
|
|
3
|
+
import { S as createRoleHierarchy, _ as ownerWithAdminBypass, a as createOrgPermissions, b as publicReadAdminWrite, c as requireOrgMembership, d as requireRoles, f as requireTeamMembership, g as fullPublic, h as authenticated, i as createDynamicPermissionMatrix, l as requireOrgRole, m as adminOnly, n as allowPublic, o as denyAll, p as when, r as anyOf, s as requireAuth, t as allOf, u as requireOwnership, v as presets_exports, x as readOnly, y as publicRead } from "../permissions-D9_AAtvz.mjs";
|
|
4
4
|
export { adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDynamicPermissionMatrix, createOrgPermissions, createRoleHierarchy, denyAll, fields, fullPublic, getUserRoles, normalizeRoles, ownerWithAdminBypass, presets_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireTeamMembership, resolveEffectiveRoles, when };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { d as isElevated, f as isMember, n as PUBLIC_SCOPE, o as getTeamId, s as getUserId } from "./types-BhtYdxZU.mjs";
|
|
3
3
|
import { t as getUserRoles } from "./types-ZUu_h0jp.mjs";
|
|
4
|
-
import { t as MemoryCacheStore } from "./memory-
|
|
4
|
+
import { t as MemoryCacheStore } from "./memory-BFAYkf8H.mjs";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
6
|
//#region src/permissions/roleHierarchy.ts
|
|
7
7
|
/**
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { V as MiddlewareConfig, Y as PresetHook, c as AdditionalRoute, dt as RouteSchemaOptions, l as AnyRecord, sn as HookSystem, zt as ResourceRegistry } from "../interface-BnNjdl33.mjs";
|
|
2
2
|
import { t as ExternalOpenApiPaths } from "../externalPaths-DpO-s7r8.mjs";
|
|
3
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-Do4vVQ1f.mjs";
|
|
4
4
|
import { t as TracingOptions } from "../tracing-bz_U4EM1.mjs";
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { p as MUTATION_OPERATIONS } from "../constants-Cxde4rpC.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { i as getOrgId } from "../types-BhtYdxZU.mjs";
|
|
3
3
|
import { t as requestContext } from "../requestContext-DYtmNpm5.mjs";
|
|
4
4
|
import { t as hasEvents } from "../typeGuards-Cj5Rgvlg.mjs";
|
|
5
5
|
import { t as HookSystem } from "../HookSystem-COkyWztM.mjs";
|
|
6
6
|
import { t as ResourceRegistry } from "../ResourceRegistry-DeCIFlix.mjs";
|
|
7
7
|
import { n as caching_default, t as cachingPlugin } from "../caching-BSXB-Xr7.mjs";
|
|
8
|
-
import { t as errorHandlerPlugin } from "../errorHandler
|
|
8
|
+
import { t as errorHandlerPlugin } from "../errorHandler-r2595m8T.mjs";
|
|
9
9
|
import { n as metrics_default, t as metricsPlugin } from "../metrics-Csh4nsvv.mjs";
|
|
10
|
-
import { n as sse_default, t as ssePlugin } from "../sse-
|
|
10
|
+
import { n as sse_default, t as ssePlugin } from "../sse-BF7GR7IB.mjs";
|
|
11
11
|
import { n as versioning_default, t as versioningPlugin } from "../versioning-BzfeHmhj.mjs";
|
|
12
12
|
import { randomUUID } from "node:crypto";
|
|
13
13
|
import fp from "fastify-plugin";
|
|
@@ -84,4 +84,4 @@ declare module "fastify" {
|
|
|
84
84
|
}
|
|
85
85
|
declare const responseCachePlugin: FastifyPluginAsync<ResponseCacheOptions>;
|
|
86
86
|
//#endregion
|
|
87
|
-
export { ResponseCacheOptions, ResponseCacheRule, ResponseCacheStats, responseCachePlugin
|
|
87
|
+
export { ResponseCacheOptions, ResponseCacheRule, ResponseCacheStats, responseCachePlugin };
|
|
@@ -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.
|
|
47
|
+
const resolvedVersion = serviceVersion ?? "2.5.0";
|
|
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,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { Ft as IControllerResponse, It as IRequestContext, Wt as PaginatedResult, X as PresetResult, at as ResourceConfig, l as AnyRecord } from "../interface-BnNjdl33.mjs";
|
|
2
|
+
import { MultiTenantOptions, multiTenantPreset } from "./multiTenant.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/presets/ownedByUser.d.ts
|
|
5
5
|
interface OwnedByUserOptions {
|
package/dist/presets/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import multiTenantPreset from "./multiTenant.mjs";
|
|
2
|
-
import { a as registerPreset, c as auditedPreset, d as ownedByUserPreset, i as getPreset, l as softDeletePreset, n as flexibleMultiTenantPreset, o as treePreset, r as getAvailablePresets, s as bulkPreset, t as applyPresets, u as slugLookupPreset } from "../presets-
|
|
1
|
+
import { multiTenantPreset } from "./multiTenant.mjs";
|
|
2
|
+
import { a as registerPreset, c as auditedPreset, d as ownedByUserPreset, i as getPreset, l as softDeletePreset, n as flexibleMultiTenantPreset, o as treePreset, r as getAvailablePresets, s as bulkPreset, t as applyPresets, u as slugLookupPreset } from "../presets-CD3e6M7c.mjs";
|
|
3
3
|
export { applyPresets, auditedPreset, bulkPreset, flexibleMultiTenantPreset, getAvailablePresets, getPreset, multiTenantPreset, ownedByUserPreset, registerPreset, slugLookupPreset, softDeletePreset, treePreset };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { X as PresetResult, x as CrudRouteKey } from "../interface-BnNjdl33.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/presets/multiTenant.d.ts
|
|
4
4
|
interface MultiTenantOptions {
|
|
@@ -18,4 +18,4 @@ interface MultiTenantOptions {
|
|
|
18
18
|
}
|
|
19
19
|
declare function multiTenantPreset(options?: MultiTenantOptions): PresetResult;
|
|
20
20
|
//#endregion
|
|
21
|
-
export { MultiTenantOptions, multiTenantPreset
|
|
21
|
+
export { MultiTenantOptions, multiTenantPreset };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as DEFAULT_TENANT_FIELD } from "../constants-Cxde4rpC.mjs";
|
|
2
|
-
import { d as
|
|
2
|
+
import { d as isElevated, f as isMember, i as getOrgId, n as PUBLIC_SCOPE } from "../types-BhtYdxZU.mjs";
|
|
3
3
|
//#region src/presets/multiTenant.ts
|
|
4
4
|
/** Read request.scope safely */
|
|
5
5
|
function getScope(request) {
|
|
@@ -108,4 +108,4 @@ function multiTenantPreset(options = {}) {
|
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
110
|
//#endregion
|
|
111
|
-
export { multiTenantPreset
|
|
111
|
+
export { multiTenantPreset };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import multiTenantPreset from "./presets/multiTenant.mjs";
|
|
3
|
-
import { d as requireRoles, n as allowPublic, s as requireAuth } from "./permissions-
|
|
1
|
+
import { d as isElevated, n as PUBLIC_SCOPE } from "./types-BhtYdxZU.mjs";
|
|
2
|
+
import { multiTenantPreset } from "./presets/multiTenant.mjs";
|
|
3
|
+
import { d as requireRoles, n as allowPublic, s as requireAuth } from "./permissions-D9_AAtvz.mjs";
|
|
4
4
|
//#region src/presets/ownedByUser.ts
|
|
5
5
|
/**
|
|
6
6
|
* Create ownership check middleware.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
|
|
2
2
|
import { i as versionKey, r as tagVersionKey } from "./keys-qcD-TVJl.mjs";
|
|
3
3
|
import { t as hasEvents } from "./typeGuards-Cj5Rgvlg.mjs";
|
|
4
|
-
import { t as MemoryCacheStore } from "./memory-
|
|
4
|
+
import { t as MemoryCacheStore } from "./memory-BFAYkf8H.mjs";
|
|
5
5
|
import fp from "fastify-plugin";
|
|
6
6
|
//#region src/cache/QueryCache.ts
|
|
7
7
|
var QueryCache = class {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as IntrospectionPluginOptions, Rt as RegisterOptions, zt as ResourceRegistry } from "../interface-BnNjdl33.mjs";
|
|
2
2
|
import { FastifyPluginAsync } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region src/registry/introspectionPlugin.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as BaseController } from "./BaseController-
|
|
1
|
+
import { t as BaseController } from "./BaseController-CNwMYpDW.mjs";
|
|
2
2
|
import { t as pluralize } from "./pluralize-CcT6qF0a.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/integrations/mcp/createMcpServer.ts
|
package/dist/scope/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AUTHENTICATED_SCOPE, c as
|
|
1
|
+
import { _ as isMember, a as AUTHENTICATED_SCOPE, c as getOrgContext, d as getTeamId, f as getUserId, g as isElevated, h as isAuthenticated, i as elevationPlugin, l as getOrgId, m as hasOrgAccess, n as ElevationOptions, o as PUBLIC_SCOPE, p as getUserRoles, r as _default, s as RequestScope, t as ElevationEvent, u as getOrgRoles } from "../elevation-C_taLQrM.mjs";
|
|
2
2
|
import { FastifyReply, FastifyRequest } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region src/scope/rateLimitKey.d.ts
|
|
@@ -29,4 +29,4 @@ interface ResolveOrgFromHeaderOptions {
|
|
|
29
29
|
*/
|
|
30
30
|
declare function resolveOrgFromHeader(options: ResolveOrgFromHeaderOptions): (request: FastifyRequest, reply: FastifyReply) => Promise<void>;
|
|
31
31
|
//#endregion
|
|
32
|
-
export { AUTHENTICATED_SCOPE, type ElevationEvent, type ElevationOptions, PUBLIC_SCOPE, type RateLimitKeyContext, type RequestScope, type ResolveOrgFromHeaderOptions, type TenantKeyGeneratorOptions, createTenantKeyGenerator, _default as elevationPlugin, elevationPlugin as elevationPluginFn, getOrgId, getOrgRoles, getTeamId, getUserId, getUserRoles, hasOrgAccess, isAuthenticated, isElevated, isMember, resolveOrgFromHeader };
|
|
32
|
+
export { AUTHENTICATED_SCOPE, type ElevationEvent, type ElevationOptions, PUBLIC_SCOPE, type RateLimitKeyContext, type RequestScope, type ResolveOrgFromHeaderOptions, type TenantKeyGeneratorOptions, createTenantKeyGenerator, _default as elevationPlugin, elevationPlugin as elevationPluginFn, getOrgContext, getOrgId, getOrgRoles, getTeamId, getUserId, getUserRoles, hasOrgAccess, isAuthenticated, isElevated, isMember, resolveOrgFromHeader };
|
package/dist/scope/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as getOrgRoles, c as getUserRoles, d as isElevated, f as isMember, i as getOrgId, l as hasOrgAccess, n as PUBLIC_SCOPE, o as getTeamId, r as getOrgContext, s as getUserId, t as AUTHENTICATED_SCOPE, u as isAuthenticated } from "../types-BhtYdxZU.mjs";
|
|
2
2
|
import { n as normalizeRoles } from "../types-ZUu_h0jp.mjs";
|
|
3
3
|
import { n as elevation_default, t as elevationPlugin } from "../elevation-BEdACOLB.mjs";
|
|
4
4
|
//#region src/scope/rateLimitKey.ts
|
|
@@ -75,4 +75,4 @@ function resolveOrgFromHeader(options) {
|
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
//#endregion
|
|
78
|
-
export { AUTHENTICATED_SCOPE, PUBLIC_SCOPE, createTenantKeyGenerator, elevation_default as elevationPlugin, elevationPlugin as elevationPluginFn, getOrgId, getOrgRoles, getTeamId, getUserId, getUserRoles, hasOrgAccess, isAuthenticated, isElevated, isMember, resolveOrgFromHeader };
|
|
78
|
+
export { AUTHENTICATED_SCOPE, PUBLIC_SCOPE, createTenantKeyGenerator, elevation_default as elevationPlugin, elevationPlugin as elevationPluginFn, getOrgContext, getOrgId, getOrgRoles, getTeamId, getUserId, getUserRoles, hasOrgAccess, isAuthenticated, isElevated, isMember, resolveOrgFromHeader };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { i as getOrgId, n as PUBLIC_SCOPE } from "./types-BhtYdxZU.mjs";
|
|
3
3
|
import { t as arcLog } from "./logger-Dz3j1ItV.mjs";
|
|
4
4
|
import fp from "fastify-plugin";
|
|
5
5
|
//#region src/plugins/sse.ts
|