@classytic/arc 2.19.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/arc.js +37 -0
- package/dist/{BaseController-Dy6EQHjM.mjs → BaseController-BnLYgE9A.mjs} +4 -4
- package/dist/{EventTransport-IEn7Tn-Q.d.mts → EventTransport-QmY7A258.d.mts} +0 -1
- package/dist/{QueryCache-TRfXau3W.d.mts → QueryCache-Z1B38koh.d.mts} +0 -1
- package/dist/{ResourceRegistry-5fKZwhK_.mjs → ResourceRegistry-7RnrEWNP.mjs} +1 -1
- package/dist/{actionPermissions-D7NGwcAR.mjs → actionPermissions-ze70xXJi.mjs} +1 -1
- package/dist/audit/index.d.mts +9 -5
- package/dist/audit/index.mjs +1 -1
- package/dist/auth/audit.d.mts +7 -4
- package/dist/auth/audit.mjs +5 -0
- package/dist/auth/index.d.mts +7 -14
- package/dist/auth/index.mjs +7 -5
- package/dist/auth/redis-session.d.mts +1 -2
- package/dist/{buildHandler-B0qvAguf.mjs → buildHandler-D_2ULWxZ.mjs} +3 -3
- package/dist/cache/index.d.mts +2 -3
- package/dist/cache/index.mjs +2 -2
- package/dist/cli/commands/describe.d.mts +1 -2
- package/dist/cli/commands/describe.mjs +2 -2
- package/dist/cli/commands/docs.mjs +2 -2
- package/dist/cli/commands/generate.mjs +1 -1
- package/dist/cli/commands/init.mjs +1 -1
- package/dist/cli/commands/introspect.mjs +4 -13
- package/dist/cli/index.mjs +2 -2
- package/dist/{constants-gaEeMlz-.mjs → constants-DNre0wRg.mjs} +1 -1
- package/dist/context/index.d.mts +2 -2
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.mjs +5 -5
- package/dist/{core-Ba-6Sue6.mjs → core-DZ6Xe1jR.mjs} +182 -55
- package/dist/{createActionRouter-B_WzBFyf.mjs → createActionRouter-BWMDW-dL.mjs} +4 -4
- package/dist/{createAggregationRouter-B_G_nIjm.mjs → createAggregationRouter-l5mNdYrZ.mjs} +5 -4
- package/dist/{createApp--703hQE1.mjs → createApp-Bi61XxqU.mjs} +229 -24
- package/dist/discovery/index.d.mts +0 -1
- package/dist/docs/index.d.mts +1 -2
- package/dist/docs/index.mjs +1 -1
- package/dist/{elevation-xGUBq6p_.d.mts → elevation-C9s5hFP_.d.mts} +0 -1
- package/dist/encryption/index.d.mts +2 -144
- package/dist/{errorHandler-BtUUDPEa.d.mts → errorHandler-B0e-bq-O.d.mts} +0 -1
- package/dist/{errors-DOHkjQlD.d.mts → errors-DHcHVAgk.d.mts} +0 -1
- package/dist/{eventPlugin-DbBFd3x_.d.mts → eventPlugin-A6EbthXR.d.mts} +10 -6
- package/dist/events/index.d.mts +9 -6
- package/dist/events/index.mjs +9 -6
- package/dist/events/transports/redis-stream-entry.d.mts +1 -1
- package/dist/events/transports/redis.d.mts +1 -2
- package/dist/factory/index.d.mts +5 -4
- package/dist/factory/index.mjs +3 -3
- package/dist/{fastify-augmentation-D-5_yQJi.d.mts → fastify-augmentation-DafigGQp.d.mts} +12 -2
- package/dist/{fields-C7ahdGYf.d.mts → fields-BGqrAa_u.d.mts} +1 -2
- package/dist/{generate-Brans3fW.mjs → generate-usRSdQmP.mjs} +4 -3
- package/dist/hooks/index.d.mts +1 -1
- package/dist/idempotency/index.d.mts +4 -3
- package/dist/idempotency/index.mjs +1 -1
- package/dist/idempotency/redis.d.mts +1 -1
- package/dist/{index-CP6A1Ffj.d.mts → index-B5N-NaHs.d.mts} +88 -7
- package/dist/{index-CRKiiP5o.d.mts → index-B5PoNbfu.d.mts} +41 -7
- package/dist/{index-CUTG2Cuo.d.mts → index-Dtrj6XZk.d.mts} +90 -29
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +7 -7
- package/dist/{init-Bqpt1Hxf.mjs → init-0YhHkXGk.mjs} +239 -140
- package/dist/integrations/event-gateway.d.mts +2 -3
- package/dist/integrations/index.d.mts +2 -2
- package/dist/integrations/jobs.d.mts +0 -1
- package/dist/integrations/mcp/index.d.mts +6 -7
- package/dist/integrations/mcp/index.mjs +1 -1
- package/dist/integrations/mcp/testing.d.mts +1 -2
- package/dist/integrations/mcp/testing.mjs +1 -1
- package/dist/integrations/streamline.d.mts +19 -7
- package/dist/integrations/streamline.mjs +9 -5
- package/dist/integrations/webhooks.d.mts +0 -1
- package/dist/integrations/websocket-pushref-redis.d.mts +1 -2
- package/dist/integrations/websocket-redis.d.mts +1 -2
- package/dist/integrations/websocket.d.mts +2 -2
- package/dist/{loadResources-B8UmpITt.mjs → loadResources-DpU8pfjV.mjs} +4 -3
- package/dist/{loadResourcesFromEntry-BTlFEx05.mjs → loadResourcesFromEntry-OMCvIEE7.mjs} +1 -1
- package/dist/{mcpPlugin-C088Nd-G.mjs → mcpPlugin-B9XjjNVG.mjs} +148 -49
- package/dist/middleware/index.d.mts +1 -2
- package/dist/middleware/index.mjs +1 -1
- package/dist/module-WeuU5jfd.d.mts +429 -0
- package/dist/{openapi-DZ-5a5Op.mjs → openapi-Kyod_di6.mjs} +3 -3
- package/dist/permissions/index.d.mts +3 -3
- package/dist/permissions/index.mjs +2 -2
- package/dist/{permissions-BPB1xqGf.mjs → permissions-BJMuKMl7.mjs} +43 -3
- package/dist/pipeline/index.d.mts +1 -2
- package/dist/plugins/index.d.mts +87 -10
- package/dist/plugins/index.mjs +91 -4
- package/dist/plugins/response-cache.d.mts +5 -3
- package/dist/plugins/tracing-entry.d.mts +1 -1
- package/dist/plugins/tracing-entry.mjs +1 -1
- package/dist/{pluralize-DccFV9R7.mjs → pluralize-BhrgwZb9.mjs} +3 -3
- package/dist/presets/filesUpload.d.mts +4 -5
- package/dist/presets/filesUpload.mjs +1 -1
- package/dist/presets/index.d.mts +16 -3
- package/dist/presets/index.mjs +1 -1
- package/dist/presets/multiTenant.d.mts +1 -2
- package/dist/presets/multiTenant.mjs +1 -1
- package/dist/presets/search.d.mts +2 -3
- package/dist/presets/search.mjs +3 -2
- package/dist/{presets-BtyFwTO4.mjs → presets-gw0ciIUD.mjs} +1 -1
- package/dist/{pushref-registry-DnCqL3aa.d.mts → pushref-registry-BbcnpNTm.d.mts} +4 -2
- package/dist/{queryCachePlugin-xzFyKAjT.d.mts → queryCachePlugin-CfYWq-Ak.d.mts} +1 -2
- package/dist/{queryCachePlugin-emHb0CuX.mjs → queryCachePlugin-DzqLN904.mjs} +2 -2
- package/dist/{redis-C3W0qbz8.d.mts → redis-UDtLaNj6.d.mts} +0 -1
- package/dist/{redis-stream-DsP1vqZB.d.mts → redis-stream-iVR2l7aS.d.mts} +1 -2
- package/dist/{registerRoute-BdV8DDwU.mjs → registerRoute-oGAl0oA8.mjs} +1 -1
- package/dist/registry/index.d.mts +2 -2
- package/dist/registry/index.mjs +2 -2
- package/dist/{registry-Bm9LjWKs.mjs → registry-vcOCtPij.mjs} +1 -1
- package/dist/{schemaIR-D1MJwqmp.mjs → schemaIR-ajetw3Fv.mjs} +1 -42
- package/dist/schemas/index.d.mts +0 -1
- package/dist/scim/index.d.mts +0 -1
- package/dist/scim/index.mjs +2 -2
- package/dist/scope/index.d.mts +2 -3
- package/dist/{sessionManager-BXG-HGwG.d.mts → sessionManager-BHOM3N_0.d.mts} +10 -6
- package/dist/{storage-Co_PQpeQ.d.mts → storage-DLUZ04kK.d.mts} +8 -4
- package/dist/sync/changelog.d.mts +2 -0
- package/dist/sync/changelog.mjs +2 -0
- package/dist/testing/index.d.mts +2 -3
- package/dist/testing/index.mjs +6 -3
- package/dist/testing/storageContract.d.mts +1 -2
- package/dist/{tracing-D8jlGXP7.d.mts → tracing-CsGKQJGg.d.mts} +0 -1
- package/dist/types/index.d.mts +4 -4
- package/dist/types/storage.d.mts +1 -1
- package/dist/types-Cc91nXuA.d.mts +132 -0
- package/dist/{types-LNebCoJx.d.mts → types-DH0GupI7.d.mts} +8 -4
- package/dist/{types-DpvSF5Hh.d.mts → types-DRj-Ut4n.d.mts} +1 -2
- package/dist/{types-9_wtNPsI.d.mts → types-DpxoNX5v.d.mts} +112 -214
- package/dist/utils/index.d.mts +182 -128
- package/dist/utils/index.mjs +2 -2
- package/dist/{utils-C6QQ9-hd.mjs → utils-CO8a3B_1.mjs} +1435 -1391
- package/dist/{validate-CRcaWzp2.mjs → validate-C2mGgSXg.mjs} +3 -3
- package/dist/{versioning-D_eBCfNr.d.mts → versioning-DQ4mCvg0.d.mts} +1 -2
- package/dist/{websocket-MlYlrYq0.d.mts → websocket-uuWqM6UY.d.mts} +5 -4
- package/package.json +18 -13
- package/skills/arc/SKILL.md +10 -0
- package/skills/arc/references/mcp.md +2 -0
- package/skills/arc-module-publishing/SKILL.md +242 -0
- package/skills/arc-module-publishing/references/authoring-modules.md +272 -0
- package/skills/arc-module-publishing/references/package-manifest.md +155 -0
- package/skills/arc-module-publishing/references/publishing-workflow.md +182 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { FastifyPluginAsync, FastifyReply, FastifyRequest } from "fastify";
|
|
2
|
-
|
|
3
2
|
//#region src/auth/sessionManager.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Session data stored in the session store.
|
|
@@ -81,13 +80,18 @@ declare module "fastify" {
|
|
|
81
80
|
authenticate: (request: FastifyRequest, reply: FastifyReply) => Promise<void>;
|
|
82
81
|
/** Session management helpers */
|
|
83
82
|
sessionManager: {
|
|
84
|
-
/** Create a new session for a user */
|
|
83
|
+
/** Create a new session for a user */
|
|
84
|
+
createSession: (userId: string, metadata?: Record<string, unknown>) => Promise<{
|
|
85
85
|
sessionId: string;
|
|
86
86
|
cookie: string;
|
|
87
|
-
}>;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
}>;
|
|
88
|
+
/** Revoke a specific session */
|
|
89
|
+
revokeSession: (sessionId: string) => Promise<void>;
|
|
90
|
+
/** Revoke all sessions for a user */
|
|
91
|
+
revokeAllSessions: (userId: string) => Promise<void>;
|
|
92
|
+
/** Revoke all sessions except the current one */
|
|
93
|
+
revokeOtherSessions: (userId: string, currentSessionId: string) => Promise<void>;
|
|
94
|
+
/** Refresh a session (reset updatedAt, extend expiry if needed) */
|
|
91
95
|
refreshSession: (sessionId: string) => Promise<SessionData | null>;
|
|
92
96
|
};
|
|
93
97
|
}
|
|
@@ -98,14 +98,18 @@ interface StorageReadRange {
|
|
|
98
98
|
type StorageReadResult = {
|
|
99
99
|
kind: "stream";
|
|
100
100
|
stream: NodeJS.ReadableStream;
|
|
101
|
-
contentType: string;
|
|
102
|
-
|
|
101
|
+
contentType: string;
|
|
102
|
+
/** Total size of the full object (NOT the ranged slice). Required for `Content-Range`. */
|
|
103
|
+
bytes?: number;
|
|
104
|
+
/** Actual byte range returned when the caller passed `range`. */
|
|
103
105
|
range?: StorageReadRange;
|
|
104
106
|
} | {
|
|
105
107
|
kind: "buffer";
|
|
106
108
|
buffer: Buffer;
|
|
107
|
-
contentType: string;
|
|
108
|
-
|
|
109
|
+
contentType: string;
|
|
110
|
+
/** Total size of the full object. Used for `Content-Range` on partial reads. */
|
|
111
|
+
totalBytes?: number;
|
|
112
|
+
/** Actual byte range returned when the caller passed `range`. */
|
|
109
113
|
range?: StorageReadRange;
|
|
110
114
|
};
|
|
111
115
|
/**
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ChangeEntry, ChangeLogAppendOptions, ChangeLogStore, ChangeOp, ChangesPage, ChangesSinceOptions, CursorExpiredError, MemoryChangeLogStore, PushMutation, PushVerdict, PushVerdictStatus } from "@classytic/repo-core/sync";
|
|
2
|
+
export { type ChangeEntry, type ChangeLogAppendOptions, type ChangeLogStore, type ChangeOp, type ChangesPage, type ChangesSinceOptions, CursorExpiredError, MemoryChangeLogStore, type PushMutation, type PushVerdict, type PushVerdictStatus };
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { V as ResourceDefinition, qt as AnyRecord } from "../index-
|
|
2
|
-
import { d as preloadResourcesAsync, r as CreateAppOptions, u as preloadResources } from "../types-
|
|
1
|
+
import { V as ResourceDefinition, qt as AnyRecord } from "../index-Dtrj6XZk.mjs";
|
|
2
|
+
import { d as preloadResourcesAsync, r as CreateAppOptions, u as preloadResources } from "../types-DpxoNX5v.mjs";
|
|
3
3
|
import { StorageContractSetup, StorageContractSetupResult, runStorageContract } from "./storageContract.mjs";
|
|
4
4
|
import { FastifyInstance, FastifyServerOptions } from "fastify";
|
|
5
5
|
import { Mock } from "vitest";
|
|
6
6
|
import { StandardRepo } from "@classytic/repo-core/repository";
|
|
7
|
-
|
|
8
7
|
//#region src/testing/assertions.d.ts
|
|
9
8
|
/**
|
|
10
9
|
* expectArc — Arc-specific response assertions
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as CRUD_OPERATIONS } from "../constants-
|
|
1
|
+
import { t as CRUD_OPERATIONS } from "../constants-DNre0wRg.mjs";
|
|
2
2
|
import { n as preloadResourcesAsync, t as preloadResources } from "../preloadResources-CHw3_oA_.mjs";
|
|
3
3
|
import { runStorageContract } from "./storageContract.mjs";
|
|
4
4
|
import Fastify from "fastify";
|
|
@@ -210,7 +210,10 @@ function createJwtAuthProvider(app, opts = {}) {
|
|
|
210
210
|
if (!config.user) throw new Error(`[jwt] role '${role}' has neither 'user' nor 'token'`);
|
|
211
211
|
const jwt = app.jwt;
|
|
212
212
|
if (!jwt?.sign) throw new Error(`[jwt] app.jwt.sign() is unavailable — register @fastify/jwt before calling createJwtAuthProvider.`);
|
|
213
|
-
return jwt.sign(
|
|
213
|
+
return jwt.sign({
|
|
214
|
+
type: "access",
|
|
215
|
+
...config.user
|
|
216
|
+
});
|
|
214
217
|
}
|
|
215
218
|
});
|
|
216
219
|
}
|
|
@@ -1046,7 +1049,7 @@ function pickDefaultAuth(authMode, callerAuth) {
|
|
|
1046
1049
|
};
|
|
1047
1050
|
}
|
|
1048
1051
|
async function createTestApp(options = {}) {
|
|
1049
|
-
const { createApp } = await import("../createApp
|
|
1052
|
+
const { createApp } = await import("../createApp-Bi61XxqU.mjs").then((n) => n.r);
|
|
1050
1053
|
const { resources = [], db = "in-memory", connectMongoose = false, authMode = "jwt", defaultOrgId, plugins, auth: callerAuth, ...appOptions } = options;
|
|
1051
1054
|
let dbHandle;
|
|
1052
1055
|
let dbUri;
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as OnTenantDeleteConfig, $t as UserOrganization, A as RequestIdOptions, C as RequestContext, D as HealthCheck, E as GracefulShutdownOptions, F as FastifyWithDecorators, Fn as BaseControllerOptions, G as ActionsMap, Gt as JwtContext, H as ActionDefinition, Ht as AuthPluginOptions, I as MiddlewareHandler, J as CrudRouteKey, Jt as ApiResponse, K as ArcFieldRule, Kt as TokenPair, L as RequestWithExtras, M as EventsDecorator, N as FastifyRequestExtras, O as HealthOptions, P as FastifyWithAuth, Q as MiddlewareConfig, Qt as UserLike, S as QueryParserInterface, St as RouteHandler, T as CrudRouterOptions, U as ActionEntry, Ut as Authenticator, Vt as AuthHelpers, W as ActionHandlerFn, Wt as AuthenticatorContext, X as EventDefinition, Xt as JWTPayload, Y as CrudSchemas, Yt as ArcRequest, Z as FieldRule, Zt as ObjectId, _ as ControllerQueryOptions, _t as ControllerLike, a as InferAdapterDoc, at as ResolvedTenantPurge, b as ParsedQuery, bt as IControllerResponse, c as TypedController, ct as ResourceExtensions, d as PaginationResult, dt as ResourcePermissions, et as OpenApiSchemas, f as IntrospectionData, ft as RouteDefinition, g as ArcInternalMetadata, gt as ControllerHandler, h as ResourceMetadata, ht as RouteSchemaOptions, i as ValidationResult, it as RateLimitConfig, j as ArcDecorator, k as IntrospectionPluginOptions, l as TypedRepository, lt as ResourceHookContext, m as RegistryStats, mt as RouteMethod, n as ConfigError, nt as PresetHook, o as InferDocType, ot as ResourceCacheConfig, p as RegistryEntry, pt as RouteMcpConfig, q as CrudController, qt as AnyRecord, r as ValidateOptions, rt as PresetResult, s as InferResourceDoc, st as ResourceConfig, t as RouteHandlerMethod, tt as PresetFunction, u as TypedResourceConfig, ut as ResourceHooks, v as LookupOption, vt as FastifyHandler, w as ServiceContext, x as PopulateOption, xt as IRequestContext, y as OwnershipCheck, yt as IController } from "../index-
|
|
2
|
-
import { i as RequestScope } from "../types-
|
|
3
|
-
import { c as PermissionCheck, d as UserBase, l as PermissionContext, u as PermissionResult } from "../fields-
|
|
4
|
-
import { n as ElevationOptions, t as ElevationEvent } from "../elevation-
|
|
1
|
+
import { $ as OnTenantDeleteConfig, $t as UserOrganization, A as RequestIdOptions, C as RequestContext, D as HealthCheck, E as GracefulShutdownOptions, F as FastifyWithDecorators, Fn as BaseControllerOptions, G as ActionsMap, Gt as JwtContext, H as ActionDefinition, Ht as AuthPluginOptions, I as MiddlewareHandler, J as CrudRouteKey, Jt as ApiResponse, K as ArcFieldRule, Kt as TokenPair, L as RequestWithExtras, M as EventsDecorator, N as FastifyRequestExtras, O as HealthOptions, P as FastifyWithAuth, Q as MiddlewareConfig, Qt as UserLike, S as QueryParserInterface, St as RouteHandler, T as CrudRouterOptions, U as ActionEntry, Ut as Authenticator, Vt as AuthHelpers, W as ActionHandlerFn, Wt as AuthenticatorContext, X as EventDefinition, Xt as JWTPayload, Y as CrudSchemas, Yt as ArcRequest, Z as FieldRule, Zt as ObjectId, _ as ControllerQueryOptions, _t as ControllerLike, a as InferAdapterDoc, at as ResolvedTenantPurge, b as ParsedQuery, bt as IControllerResponse, c as TypedController, ct as ResourceExtensions, d as PaginationResult, dt as ResourcePermissions, et as OpenApiSchemas, f as IntrospectionData, ft as RouteDefinition, g as ArcInternalMetadata, gt as ControllerHandler, h as ResourceMetadata, ht as RouteSchemaOptions, i as ValidationResult, it as RateLimitConfig, j as ArcDecorator, k as IntrospectionPluginOptions, l as TypedRepository, lt as ResourceHookContext, m as RegistryStats, mt as RouteMethod, n as ConfigError, nt as PresetHook, o as InferDocType, ot as ResourceCacheConfig, p as RegistryEntry, pt as RouteMcpConfig, q as CrudController, qt as AnyRecord, r as ValidateOptions, rt as PresetResult, s as InferResourceDoc, st as ResourceConfig, t as RouteHandlerMethod, tt as PresetFunction, u as TypedResourceConfig, ut as ResourceHooks, v as LookupOption, vt as FastifyHandler, w as ServiceContext, x as PopulateOption, xt as IRequestContext, y as OwnershipCheck, yt as IController } from "../index-Dtrj6XZk.mjs";
|
|
2
|
+
import { i as RequestScope } from "../types-DH0GupI7.mjs";
|
|
3
|
+
import { c as PermissionCheck, d as UserBase, l as PermissionContext, u as PermissionResult } from "../fields-BGqrAa_u.mjs";
|
|
4
|
+
import { n as ElevationOptions, t as ElevationEvent } from "../elevation-C9s5hFP_.mjs";
|
|
5
5
|
export type { ActionDefinition, ActionEntry, ActionHandlerFn, ActionsMap, AnyRecord, ApiResponse, ArcDecorator, ArcFieldRule, ArcInternalMetadata, ArcRequest, AuthHelpers, AuthPluginOptions, Authenticator, AuthenticatorContext, BaseControllerOptions, ConfigError, ControllerHandler, ControllerLike, ControllerQueryOptions, CrudController, CrudRouteKey, CrudRouterOptions, CrudSchemas, ElevationEvent, ElevationOptions, EventDefinition, EventsDecorator, FastifyHandler, FastifyRequestExtras, FastifyWithAuth, FastifyWithDecorators, FieldRule, GracefulShutdownOptions, HealthCheck, HealthOptions, IController, IControllerResponse, IRequestContext, InferAdapterDoc, InferDocType, InferResourceDoc, IntrospectionData, IntrospectionPluginOptions, JWTPayload, JwtContext, LookupOption, MiddlewareConfig, MiddlewareHandler, ObjectId, OnTenantDeleteConfig, OpenApiSchemas, OwnershipCheck, PaginationResult, ParsedQuery, PermissionCheck, PermissionContext, PermissionResult, PopulateOption, PresetFunction, PresetHook, PresetResult, QueryParserInterface, RateLimitConfig, RegistryEntry, RegistryStats, RequestContext, RequestIdOptions, RequestScope, RequestWithExtras, ResolvedTenantPurge, ResourceCacheConfig, ResourceConfig, ResourceExtensions, ResourceHookContext, ResourceHooks, ResourceMetadata, ResourcePermissions, RouteDefinition, RouteHandler, RouteHandlerMethod, RouteMcpConfig, RouteMethod, RouteSchemaOptions, ServiceContext, TokenPair, TypedController, TypedRepository, TypedResourceConfig, UserBase, UserLike, UserOrganization, ValidateOptions, ValidationResult };
|
package/dist/types/storage.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as StorageReadResult, i as StorageReadRange, n as StorageContext, o as StorageUploadInput, r as StorageFile, t as Storage } from "../storage-
|
|
1
|
+
import { a as StorageReadResult, i as StorageReadRange, n as StorageContext, o as StorageUploadInput, r as StorageFile, t as Storage } from "../storage-DLUZ04kK.mjs";
|
|
2
2
|
export { Storage, StorageContext, StorageFile, StorageReadRange, StorageReadResult, StorageUploadInput };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { FastifyRequest } from "fastify";
|
|
2
|
+
//#region src/encryption/types.d.ts
|
|
3
|
+
/** JWE key-management algorithm — the protected-header `alg`. */
|
|
4
|
+
type JweAlg = "RSA-OAEP-256" | "RSA-OAEP-384" | "RSA-OAEP-512" | "ECDH-ES" | "ECDH-ES+A256KW" | "A256GCMKW" | "dir";
|
|
5
|
+
/** JWE content-encryption algorithm — the protected-header `enc`. AEAD only. */
|
|
6
|
+
type JweEnc = "A128GCM" | "A192GCM" | "A256GCM";
|
|
7
|
+
/** Encryption strategy for a route's response. */
|
|
8
|
+
type EncryptionMode = "jwe" | "fields";
|
|
9
|
+
/**
|
|
10
|
+
* Opaque key material. For `jwe` mode this is a `jose` `KeyLike` /
|
|
11
|
+
* `CryptoKey` / `Uint8Array`; for `fields` mode a 32-byte secret
|
|
12
|
+
* (`Buffer` / `Uint8Array`). Kept `unknown` at the contract layer so the
|
|
13
|
+
* `KeyProvider` interface carries no hard `jose` type dependency — hosts
|
|
14
|
+
* without `jose` installed can still implement field-mode providers.
|
|
15
|
+
*/
|
|
16
|
+
type KeyMaterial = unknown;
|
|
17
|
+
/** A key paired with its identifier — what encrypt operations consume. */
|
|
18
|
+
interface ActiveKey {
|
|
19
|
+
/** Key id, stamped into the JWE `kid` header / field envelope for rotation. */
|
|
20
|
+
readonly kid: string;
|
|
21
|
+
/** The key material (public key for JWE, 32-byte secret for fields). */
|
|
22
|
+
readonly key: KeyMaterial;
|
|
23
|
+
/** Optional per-key `alg` override (else the plugin default applies). */
|
|
24
|
+
readonly alg?: JweAlg;
|
|
25
|
+
}
|
|
26
|
+
/** Context handed to the key provider so resolution can be request-scoped. */
|
|
27
|
+
interface KeyContext {
|
|
28
|
+
readonly request: FastifyRequest;
|
|
29
|
+
}
|
|
30
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
31
|
+
/**
|
|
32
|
+
* Pluggable key resolution. Arc owns the request-time plumbing — `kid` →
|
|
33
|
+
* key, algorithm allowlist enforcement; the host owns the trust store —
|
|
34
|
+
* which keys are valid and where they live (file / env / AWS KMS / GCP KMS
|
|
35
|
+
* / Vault). Encryption and decryption are deliberately separate operations
|
|
36
|
+
* because they often use DIFFERENT keys (JWE: a public key encrypts the
|
|
37
|
+
* outbound response, a private key by `kid` decrypts the inbound request —
|
|
38
|
+
* exactly Visa's two-key-pair model).
|
|
39
|
+
*
|
|
40
|
+
* Rotation mirrors `@fastify/secure-session`: the active key encrypts; any
|
|
41
|
+
* key resolvable by `kid` can decrypt, so you can roll keys without dropping
|
|
42
|
+
* in-flight traffic.
|
|
43
|
+
*/
|
|
44
|
+
interface KeyProvider {
|
|
45
|
+
/** Active key for encrypting OUTBOUND responses. */
|
|
46
|
+
encryptionKey(ctx: KeyContext): MaybePromise<ActiveKey>;
|
|
47
|
+
/** Resolve a DECRYPTION key by the inbound message's `kid`. */
|
|
48
|
+
decryptionKey(kid: string, ctx: KeyContext): MaybePromise<KeyMaterial | undefined>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Per-resource encryption directive — the typed slice plugins register on
|
|
52
|
+
* `ResourceExtensions`. Declared on a resource via
|
|
53
|
+
* `defineResource({ extensions: { encryption: { … } } })`; arc threads it
|
|
54
|
+
* to request time on `request.routeOptions.config.arcExtensions.encryption`.
|
|
55
|
+
*/
|
|
56
|
+
interface EncryptionDirective {
|
|
57
|
+
/** Strategy. Defaults to the plugin-level `mode` (default `'jwe'`). */
|
|
58
|
+
readonly mode?: EncryptionMode;
|
|
59
|
+
/**
|
|
60
|
+
* For `mode: 'fields'` — dot-paths of fields to encrypt, resolved against
|
|
61
|
+
* the serialized response body (e.g. `'cardNumber'`, `'account.iban'`).
|
|
62
|
+
* Ignored for `mode: 'jwe'` (the whole body is encrypted).
|
|
63
|
+
*/
|
|
64
|
+
readonly fields?: readonly string[];
|
|
65
|
+
/**
|
|
66
|
+
* Explicit opt-out — set `false` to disable encryption for this resource
|
|
67
|
+
* even when a plugin-level default (`routes`) would otherwise apply.
|
|
68
|
+
*/
|
|
69
|
+
readonly enabled?: boolean;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Plugin-level options. `keyProvider` is the only required field; everything
|
|
73
|
+
* else has a secure default.
|
|
74
|
+
*/
|
|
75
|
+
interface EncryptionOptions {
|
|
76
|
+
/**
|
|
77
|
+
* Master on/off. Default `true`. Set `false` to register the plugin as a
|
|
78
|
+
* typed no-op (config-gated environments) — same pattern as
|
|
79
|
+
* `idempotencyPlugin`.
|
|
80
|
+
*/
|
|
81
|
+
readonly enabled?: boolean;
|
|
82
|
+
/** Key provider — resolves `kid` → key for encrypt/decrypt. Required. */
|
|
83
|
+
readonly keyProvider: KeyProvider;
|
|
84
|
+
/** Default mode when a route opts in without naming one. Default `'jwe'`. */
|
|
85
|
+
readonly mode?: EncryptionMode;
|
|
86
|
+
/** JWE key-management algorithm. Default `'RSA-OAEP-256'`. */
|
|
87
|
+
readonly alg?: JweAlg;
|
|
88
|
+
/** JWE content-encryption algorithm. Default `'A256GCM'`. */
|
|
89
|
+
readonly enc?: JweEnc;
|
|
90
|
+
/**
|
|
91
|
+
* Inbound-decryption algorithm allowlists — block algorithm-substitution
|
|
92
|
+
* downgrade attacks. Default `[alg]` / `[enc]`. Set explicitly only when a
|
|
93
|
+
* client legitimately uses more than one algorithm.
|
|
94
|
+
*/
|
|
95
|
+
readonly allowedAlgs?: readonly JweAlg[];
|
|
96
|
+
readonly allowedEncs?: readonly JweEnc[];
|
|
97
|
+
/**
|
|
98
|
+
* Fallback opt-in for routes that don't declare
|
|
99
|
+
* `extensions.encryption`. Return a directive (or `true` for the default
|
|
100
|
+
* mode) to encrypt, `false`/`undefined` to skip. The per-resource
|
|
101
|
+
* `extensions.encryption` ALWAYS wins when present. Use this to scope ALE
|
|
102
|
+
* to sensitive prefixes without touching every resource.
|
|
103
|
+
*
|
|
104
|
+
* @example confine ALE to `/payments` and `/accounts`
|
|
105
|
+
* ```ts
|
|
106
|
+
* routes: (req) => /^\/(payments|accounts)\b/.test(req.url)
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
readonly routes?: (request: FastifyRequest) => EncryptionDirective | boolean | undefined;
|
|
110
|
+
/** Decrypt inbound `application/jose` request bodies. Default `true`. */
|
|
111
|
+
readonly decryptRequests?: boolean;
|
|
112
|
+
/** Media type that signals an encrypted REQUEST body. Default `'application/jose'`. */
|
|
113
|
+
readonly contentType?: string;
|
|
114
|
+
/** Content-Type set on full-body JWE RESPONSES. Default `'application/jose'`. */
|
|
115
|
+
readonly responseContentType?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Response header advertising that the body is encrypted, so generic
|
|
118
|
+
* client SDKs know to decrypt. Default `'x-encrypted'`; set `false` to omit.
|
|
119
|
+
*/
|
|
120
|
+
readonly flagHeader?: string | false;
|
|
121
|
+
}
|
|
122
|
+
/** Request decorations added by the plugin. */
|
|
123
|
+
declare module "fastify" {
|
|
124
|
+
interface FastifyRequest {
|
|
125
|
+
/** `true` when the inbound body was decrypted from a JWE by this plugin. */
|
|
126
|
+
requestDecrypted?: boolean;
|
|
127
|
+
/** `true` when the outbound body was encrypted by this plugin. */
|
|
128
|
+
responseEncrypted?: boolean;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
export { JweAlg as a, KeyMaterial as c, EncryptionOptions as i, KeyProvider as l, EncryptionDirective as n, JweEnc as o, EncryptionMode as r, KeyContext as s, ActiveKey as t };
|
|
@@ -168,8 +168,10 @@ type RequestScope = {
|
|
|
168
168
|
kind: "service";
|
|
169
169
|
clientId: string;
|
|
170
170
|
organizationId: string;
|
|
171
|
-
scopes?: readonly string[];
|
|
172
|
-
|
|
171
|
+
scopes?: readonly string[];
|
|
172
|
+
/** App-defined scope dimensions — see `member.context` for details. */
|
|
173
|
+
context?: Readonly<Record<string, string>>;
|
|
174
|
+
/** Parent organizations — see `member.ancestorOrgIds` for details. */
|
|
173
175
|
ancestorOrgIds?: readonly string[];
|
|
174
176
|
/**
|
|
175
177
|
* Capability mandate — narrows what the caller may do beyond OAuth `scopes`.
|
|
@@ -207,8 +209,10 @@ type RequestScope = {
|
|
|
207
209
|
kind: "elevated";
|
|
208
210
|
userId?: string;
|
|
209
211
|
organizationId?: string;
|
|
210
|
-
elevatedBy: string;
|
|
211
|
-
|
|
212
|
+
elevatedBy: string;
|
|
213
|
+
/** App-defined scope dimensions — see `member.context` for details. */
|
|
214
|
+
context?: Readonly<Record<string, string>>;
|
|
215
|
+
/** Parent organizations — see `member.ancestorOrgIds` for details. */
|
|
212
216
|
ancestorOrgIds?: readonly string[];
|
|
213
217
|
};
|
|
214
218
|
/** Check if scope is `member` kind */
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { V as ResourceDefinition } from "./index-
|
|
1
|
+
import { V as ResourceDefinition } from "./index-Dtrj6XZk.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
|
|
4
3
|
//#region src/integrations/mcp/types.d.ts
|
|
5
4
|
/** Behavioral hints for MCP clients (tool annotations per MCP spec) */
|
|
6
5
|
interface ToolAnnotations {
|