@classytic/arc 1.1.0 → 2.1.2
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 +247 -794
- package/bin/arc.js +91 -52
- package/dist/EventTransport-BD2U0BTc.d.mts +100 -0
- package/dist/EventTransport-BD2U0BTc.d.mts.map +1 -0
- package/dist/HookSystem-BsGV-j2l.mjs +405 -0
- package/dist/HookSystem-BsGV-j2l.mjs.map +1 -0
- package/dist/ResourceRegistry-DsN4KJjV.mjs +250 -0
- package/dist/ResourceRegistry-DsN4KJjV.mjs.map +1 -0
- package/dist/adapters/index.d.mts +5 -0
- package/dist/adapters/index.mjs +3 -0
- package/dist/audit/index.d.mts +82 -0
- package/dist/audit/index.d.mts.map +1 -0
- package/dist/audit/index.mjs +276 -0
- package/dist/audit/index.mjs.map +1 -0
- package/dist/audit/mongodb.d.mts +5 -0
- package/dist/audit/mongodb.mjs +3 -0
- package/dist/audited-C3T5DTUx.mjs +141 -0
- package/dist/audited-C3T5DTUx.mjs.map +1 -0
- package/dist/auth/index.d.mts +189 -0
- package/dist/auth/index.d.mts.map +1 -0
- package/dist/auth/index.mjs +1102 -0
- package/dist/auth/index.mjs.map +1 -0
- package/dist/auth/redis-session.d.mts +44 -0
- package/dist/auth/redis-session.d.mts.map +1 -0
- package/dist/auth/redis-session.mjs +76 -0
- package/dist/auth/redis-session.mjs.map +1 -0
- package/dist/betterAuthOpenApi-BrHKeSAx.mjs +250 -0
- package/dist/betterAuthOpenApi-BrHKeSAx.mjs.map +1 -0
- package/dist/cache/index.d.mts +146 -0
- package/dist/cache/index.d.mts.map +1 -0
- package/dist/cache/index.mjs +92 -0
- package/dist/cache/index.mjs.map +1 -0
- package/dist/caching-Bl28lYsR.mjs +94 -0
- package/dist/caching-Bl28lYsR.mjs.map +1 -0
- package/dist/chunk-C7Uep-_p.mjs +20 -0
- package/dist/circuitBreaker-DeY4FCjs.mjs +1097 -0
- package/dist/circuitBreaker-DeY4FCjs.mjs.map +1 -0
- package/dist/cli/commands/describe.d.mts +19 -0
- package/dist/cli/commands/describe.d.mts.map +1 -0
- package/dist/cli/commands/describe.mjs +239 -0
- package/dist/cli/commands/describe.mjs.map +1 -0
- package/dist/cli/commands/docs.d.mts +14 -0
- package/dist/cli/commands/docs.d.mts.map +1 -0
- package/dist/cli/commands/docs.mjs +53 -0
- package/dist/cli/commands/docs.mjs.map +1 -0
- package/dist/cli/commands/{generate.d.ts → generate.d.mts} +3 -1
- package/dist/cli/commands/generate.d.mts.map +1 -0
- package/dist/cli/commands/generate.mjs +358 -0
- package/dist/cli/commands/generate.mjs.map +1 -0
- package/dist/cli/commands/{init.d.ts → init.d.mts} +12 -8
- package/dist/cli/commands/init.d.mts.map +1 -0
- package/dist/cli/commands/{init.js → init.mjs} +807 -616
- package/dist/cli/commands/init.mjs.map +1 -0
- package/dist/cli/commands/introspect.d.mts +11 -0
- package/dist/cli/commands/introspect.d.mts.map +1 -0
- package/dist/cli/commands/introspect.mjs +76 -0
- package/dist/cli/commands/introspect.mjs.map +1 -0
- package/dist/cli/index.d.mts +17 -0
- package/dist/cli/index.d.mts.map +1 -0
- package/dist/cli/index.mjs +157 -0
- package/dist/cli/index.mjs.map +1 -0
- package/dist/constants-DdXFXQtN.mjs +85 -0
- package/dist/constants-DdXFXQtN.mjs.map +1 -0
- package/dist/core/index.d.mts +5 -0
- package/dist/core/index.mjs +4 -0
- package/dist/createApp-CUgNqegw.mjs +560 -0
- package/dist/createApp-CUgNqegw.mjs.map +1 -0
- package/dist/defineResource-k0_BDn8v.mjs +2197 -0
- package/dist/defineResource-k0_BDn8v.mjs.map +1 -0
- package/dist/discovery/index.d.mts +47 -0
- package/dist/discovery/index.d.mts.map +1 -0
- package/dist/discovery/index.mjs +110 -0
- package/dist/discovery/index.mjs.map +1 -0
- package/dist/docs/index.d.mts +163 -0
- package/dist/docs/index.d.mts.map +1 -0
- package/dist/docs/index.mjs +73 -0
- package/dist/docs/index.mjs.map +1 -0
- package/dist/elevation-BRy3yFWT.mjs +113 -0
- package/dist/elevation-BRy3yFWT.mjs.map +1 -0
- package/dist/elevation-B_2dRLVP.d.mts +88 -0
- package/dist/elevation-B_2dRLVP.d.mts.map +1 -0
- package/dist/errorHandler-BbcgBmIH.d.mts +73 -0
- package/dist/errorHandler-BbcgBmIH.d.mts.map +1 -0
- package/dist/errorHandler-C1okiriz.mjs +109 -0
- package/dist/errorHandler-C1okiriz.mjs.map +1 -0
- package/dist/errors-B9bZok84.mjs +212 -0
- package/dist/errors-B9bZok84.mjs.map +1 -0
- package/dist/errors-ChKiFz62.d.mts +125 -0
- package/dist/errors-ChKiFz62.d.mts.map +1 -0
- package/dist/eventPlugin-CTrLH3mt.d.mts +125 -0
- package/dist/eventPlugin-CTrLH3mt.d.mts.map +1 -0
- package/dist/eventPlugin-DGR_B2on.mjs +230 -0
- package/dist/eventPlugin-DGR_B2on.mjs.map +1 -0
- package/dist/events/index.d.mts +54 -0
- package/dist/events/index.d.mts.map +1 -0
- package/dist/events/index.mjs +52 -0
- package/dist/events/index.mjs.map +1 -0
- package/dist/events/transports/redis-stream-entry.d.mts +2 -0
- package/dist/events/transports/redis-stream-entry.mjs +178 -0
- package/dist/events/transports/redis-stream-entry.mjs.map +1 -0
- package/dist/events/transports/redis.d.mts +77 -0
- package/dist/events/transports/redis.d.mts.map +1 -0
- package/dist/events/transports/redis.mjs +125 -0
- package/dist/events/transports/redis.mjs.map +1 -0
- package/dist/externalPaths-DlINfKbP.d.mts +51 -0
- package/dist/externalPaths-DlINfKbP.d.mts.map +1 -0
- package/dist/factory/index.d.mts +64 -0
- package/dist/factory/index.d.mts.map +1 -0
- package/dist/factory/index.mjs +3 -0
- package/dist/fastifyAdapter-BkrGrlFi.d.mts +217 -0
- package/dist/fastifyAdapter-BkrGrlFi.d.mts.map +1 -0
- package/dist/fields-DyaDVX4J.d.mts +110 -0
- package/dist/fields-DyaDVX4J.d.mts.map +1 -0
- package/dist/fields-iagOozy0.mjs +115 -0
- package/dist/fields-iagOozy0.mjs.map +1 -0
- package/dist/hooks/index.d.mts +4 -0
- package/dist/hooks/index.mjs +3 -0
- package/dist/idempotency/index.d.mts +97 -0
- package/dist/idempotency/index.d.mts.map +1 -0
- package/dist/idempotency/index.mjs +320 -0
- package/dist/idempotency/index.mjs.map +1 -0
- package/dist/idempotency/mongodb.d.mts +2 -0
- package/dist/idempotency/mongodb.mjs +115 -0
- package/dist/idempotency/mongodb.mjs.map +1 -0
- package/dist/idempotency/redis.d.mts +2 -0
- package/dist/idempotency/redis.mjs +104 -0
- package/dist/idempotency/redis.mjs.map +1 -0
- package/dist/index.d.mts +261 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +105 -0
- package/dist/index.mjs.map +1 -0
- package/dist/integrations/event-gateway.d.mts +47 -0
- package/dist/integrations/event-gateway.d.mts.map +1 -0
- package/dist/integrations/event-gateway.mjs +44 -0
- package/dist/integrations/event-gateway.mjs.map +1 -0
- package/dist/integrations/index.d.mts +5 -0
- package/dist/integrations/index.mjs +1 -0
- package/dist/integrations/jobs.d.mts +104 -0
- package/dist/integrations/jobs.d.mts.map +1 -0
- package/dist/integrations/jobs.mjs +124 -0
- package/dist/integrations/jobs.mjs.map +1 -0
- package/dist/integrations/streamline.d.mts +61 -0
- package/dist/integrations/streamline.d.mts.map +1 -0
- package/dist/integrations/streamline.mjs +126 -0
- package/dist/integrations/streamline.mjs.map +1 -0
- package/dist/integrations/websocket.d.mts +83 -0
- package/dist/integrations/websocket.d.mts.map +1 -0
- package/dist/integrations/websocket.mjs +289 -0
- package/dist/integrations/websocket.mjs.map +1 -0
- package/dist/interface-B01JvPVc.d.mts +78 -0
- package/dist/interface-B01JvPVc.d.mts.map +1 -0
- package/dist/interface-CZe8IkMf.d.mts +55 -0
- package/dist/interface-CZe8IkMf.d.mts.map +1 -0
- package/dist/interface-Ch8HU9uM.d.mts +1098 -0
- package/dist/interface-Ch8HU9uM.d.mts.map +1 -0
- package/dist/introspectionPlugin-rFdO8ZUa.mjs +54 -0
- package/dist/introspectionPlugin-rFdO8ZUa.mjs.map +1 -0
- package/dist/keys-BqNejWup.mjs +43 -0
- package/dist/keys-BqNejWup.mjs.map +1 -0
- package/dist/logger-Df2O2WsW.mjs +79 -0
- package/dist/logger-Df2O2WsW.mjs.map +1 -0
- package/dist/memory-cQgelFOj.mjs +144 -0
- package/dist/memory-cQgelFOj.mjs.map +1 -0
- package/dist/migrations/index.d.mts +157 -0
- package/dist/migrations/index.d.mts.map +1 -0
- package/dist/migrations/index.mjs +261 -0
- package/dist/migrations/index.mjs.map +1 -0
- package/dist/mongodb-BfJVlUJH.mjs +94 -0
- package/dist/mongodb-BfJVlUJH.mjs.map +1 -0
- package/dist/mongodb-CGzRbfAK.d.mts +119 -0
- package/dist/mongodb-CGzRbfAK.d.mts.map +1 -0
- package/dist/mongodb-JN-9JA7K.d.mts +72 -0
- package/dist/mongodb-JN-9JA7K.d.mts.map +1 -0
- package/dist/openapi-G3Cw7XuM.mjs +524 -0
- package/dist/openapi-G3Cw7XuM.mjs.map +1 -0
- package/dist/org/index.d.mts +69 -0
- package/dist/org/index.d.mts.map +1 -0
- package/dist/org/index.mjs +514 -0
- package/dist/org/index.mjs.map +1 -0
- package/dist/org/types.d.mts +83 -0
- package/dist/org/types.d.mts.map +1 -0
- package/dist/org/types.mjs +1 -0
- package/dist/permissions/index.d.mts +279 -0
- package/dist/permissions/index.d.mts.map +1 -0
- package/dist/permissions/index.mjs +579 -0
- package/dist/permissions/index.mjs.map +1 -0
- package/dist/plugins/index.d.mts +173 -0
- package/dist/plugins/index.d.mts.map +1 -0
- package/dist/plugins/index.mjs +523 -0
- package/dist/plugins/index.mjs.map +1 -0
- package/dist/plugins/response-cache.d.mts +88 -0
- package/dist/plugins/response-cache.d.mts.map +1 -0
- package/dist/plugins/response-cache.mjs +284 -0
- package/dist/plugins/response-cache.mjs.map +1 -0
- package/dist/plugins/tracing-entry.d.mts +2 -0
- package/dist/plugins/tracing-entry.mjs +186 -0
- package/dist/plugins/tracing-entry.mjs.map +1 -0
- package/dist/pluralize-CEweyOEm.mjs +87 -0
- package/dist/pluralize-CEweyOEm.mjs.map +1 -0
- package/dist/policies/{index.d.ts → index.d.mts} +204 -169
- package/dist/policies/index.d.mts.map +1 -0
- package/dist/policies/index.mjs +322 -0
- package/dist/policies/index.mjs.map +1 -0
- package/dist/presets/{index.d.ts → index.d.mts} +63 -131
- package/dist/presets/index.d.mts.map +1 -0
- package/dist/presets/index.mjs +144 -0
- package/dist/presets/index.mjs.map +1 -0
- package/dist/presets/multiTenant.d.mts +25 -0
- package/dist/presets/multiTenant.d.mts.map +1 -0
- package/dist/presets/multiTenant.mjs +114 -0
- package/dist/presets/multiTenant.mjs.map +1 -0
- package/dist/presets-BITljm96.mjs +120 -0
- package/dist/presets-BITljm96.mjs.map +1 -0
- package/dist/presets-DzSMwlKj.d.mts +58 -0
- package/dist/presets-DzSMwlKj.d.mts.map +1 -0
- package/dist/prisma-DJbMt3yf.mjs +628 -0
- package/dist/prisma-DJbMt3yf.mjs.map +1 -0
- package/dist/prisma-Dg9GoVdj.d.mts +275 -0
- package/dist/prisma-Dg9GoVdj.d.mts.map +1 -0
- package/dist/queryCachePlugin-7THaI5mt.d.mts +72 -0
- package/dist/queryCachePlugin-7THaI5mt.d.mts.map +1 -0
- package/dist/queryCachePlugin-DMBnp2Q0.mjs +139 -0
- package/dist/queryCachePlugin-DMBnp2Q0.mjs.map +1 -0
- package/dist/redis-D-JAeLtm.d.mts +50 -0
- package/dist/redis-D-JAeLtm.d.mts.map +1 -0
- package/dist/redis-stream-Bdh_vUU8.d.mts +104 -0
- package/dist/redis-stream-Bdh_vUU8.d.mts.map +1 -0
- package/dist/registry/index.d.mts +12 -0
- package/dist/registry/index.d.mts.map +1 -0
- package/dist/registry/index.mjs +4 -0
- package/dist/requestContext-QQD6ROJc.mjs +56 -0
- package/dist/requestContext-QQD6ROJc.mjs.map +1 -0
- package/dist/schemaConverter-BwrmWroW.mjs +99 -0
- package/dist/schemaConverter-BwrmWroW.mjs.map +1 -0
- package/dist/schemas/index.d.mts +64 -0
- package/dist/schemas/index.d.mts.map +1 -0
- package/dist/schemas/index.mjs +83 -0
- package/dist/schemas/index.mjs.map +1 -0
- package/dist/scope/index.d.mts +22 -0
- package/dist/scope/index.d.mts.map +1 -0
- package/dist/scope/index.mjs +66 -0
- package/dist/scope/index.mjs.map +1 -0
- package/dist/sessionManager-jPKLbHE0.d.mts +187 -0
- package/dist/sessionManager-jPKLbHE0.d.mts.map +1 -0
- package/dist/sse-B3c3_yZp.mjs +124 -0
- package/dist/sse-B3c3_yZp.mjs.map +1 -0
- package/dist/testing/index.d.mts +908 -0
- package/dist/testing/index.d.mts.map +1 -0
- package/dist/testing/index.mjs +1977 -0
- package/dist/testing/index.mjs.map +1 -0
- package/dist/tracing-Cc7vVQPp.d.mts +71 -0
- package/dist/tracing-Cc7vVQPp.d.mts.map +1 -0
- package/dist/typeGuards-DhMNLuvU.mjs +10 -0
- package/dist/typeGuards-DhMNLuvU.mjs.map +1 -0
- package/dist/types/index.d.mts +947 -0
- package/dist/types/index.d.mts.map +1 -0
- package/dist/types/index.mjs +15 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/types-Beqn1Un7.mjs +39 -0
- package/dist/types-Beqn1Un7.mjs.map +1 -0
- package/dist/types-CIgB7UUl.d.mts +446 -0
- package/dist/types-CIgB7UUl.d.mts.map +1 -0
- package/dist/types-aYB4V7uN.d.mts +87 -0
- package/dist/types-aYB4V7uN.d.mts.map +1 -0
- package/dist/utils/index.d.mts +748 -0
- package/dist/utils/index.d.mts.map +1 -0
- package/dist/utils/index.mjs +6 -0
- package/package.json +194 -68
- package/dist/BaseController-DVAiHxEQ.d.ts +0 -233
- package/dist/adapters/index.d.ts +0 -237
- package/dist/adapters/index.js +0 -668
- package/dist/arcCorePlugin-CsShQdyP.d.ts +0 -273
- package/dist/audit/index.d.ts +0 -195
- package/dist/audit/index.js +0 -319
- package/dist/auth/index.d.ts +0 -47
- package/dist/auth/index.js +0 -174
- package/dist/cli/commands/docs.d.ts +0 -11
- package/dist/cli/commands/docs.js +0 -474
- package/dist/cli/commands/generate.js +0 -334
- package/dist/cli/commands/introspect.d.ts +0 -8
- package/dist/cli/commands/introspect.js +0 -338
- package/dist/cli/index.d.ts +0 -4
- package/dist/cli/index.js +0 -3269
- package/dist/core/index.d.ts +0 -220
- package/dist/core/index.js +0 -2786
- package/dist/createApp-Ce9wl8W9.d.ts +0 -77
- package/dist/docs/index.d.ts +0 -166
- package/dist/docs/index.js +0 -658
- package/dist/errors-8WIxGS_6.d.ts +0 -122
- package/dist/events/index.d.ts +0 -117
- package/dist/events/index.js +0 -89
- package/dist/factory/index.d.ts +0 -38
- package/dist/factory/index.js +0 -1652
- package/dist/hooks/index.d.ts +0 -4
- package/dist/hooks/index.js +0 -199
- package/dist/idempotency/index.d.ts +0 -323
- package/dist/idempotency/index.js +0 -500
- package/dist/index-B4t03KQ0.d.ts +0 -1366
- package/dist/index.d.ts +0 -135
- package/dist/index.js +0 -4756
- package/dist/migrations/index.d.ts +0 -185
- package/dist/migrations/index.js +0 -274
- package/dist/org/index.d.ts +0 -129
- package/dist/org/index.js +0 -220
- package/dist/permissions/index.d.ts +0 -144
- package/dist/permissions/index.js +0 -103
- package/dist/plugins/index.d.ts +0 -46
- package/dist/plugins/index.js +0 -1069
- package/dist/policies/index.js +0 -196
- package/dist/presets/index.js +0 -384
- package/dist/presets/multiTenant.d.ts +0 -39
- package/dist/presets/multiTenant.js +0 -112
- package/dist/registry/index.d.ts +0 -16
- package/dist/registry/index.js +0 -253
- package/dist/testing/index.d.ts +0 -618
- package/dist/testing/index.js +0 -48020
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.js +0 -8
- package/dist/types-B99TBmFV.d.ts +0 -76
- package/dist/types-BvckRbs2.d.ts +0 -143
- package/dist/utils/index.d.ts +0 -679
- package/dist/utils/index.js +0 -931
package/dist/types/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { K as AdditionalRoute, A as AnyRecord, s as ApiResponse, al as ArcDecorator, g as AuthHelpers, h as AuthPluginOptions, as as Authenticator, ar as AuthenticatorContext, av as BaseControllerOptions, a4 as ConfigError, ay as ControllerHandler, t as ControllerLike, C as ControllerQueryOptions, B as CrudController, y as CrudRepository, e as CrudRouteKey, _ as CrudRouterOptions, G as CrudSchemas, N as EventDefinition, am as EventsDecorator, az as FastifyHandler, u as FastifyRequestExtras, v as FastifyWithAuth, w as FastifyWithDecorators, E as FieldRule, a9 as GracefulShutdownOptions, a7 as HealthCheck, a8 as HealthOptions, I as IController, c as IControllerResponse, a as IRequestContext, ax as InferDoc, $ as InferDocType, a0 as InferResourceDoc, Y as IntrospectionData, i as IntrospectionPluginOptions, J as JWTPayload, aq as JwtContext, M as MiddlewareConfig, ap as MiddlewareHandler, ah as ObjectId, af as OpenApiSchemas, Z as OrgScopeOptions, O as OwnershipCheck, P as PaginatedResult, aw as PaginationParams, ae as ParsedQuery, ak as PopulateOption, L as PresetFunction, au as PresetHook, f as PresetResult, x as QueryOptions, Q as QueryParserInterface, W as RegistryEntry, X as RegistryStats, b as RequestContext, aa as RequestIdOptions, d as RequestWithExtras, l as ResourceConfig, ao as ResourceHooks, T as ResourceMetadata, an as ResourcePermissions, z as RouteHandler, R as RouteSchemaOptions, S as ServiceContext, at as TokenPair, a2 as TypedController, a3 as TypedRepository, a1 as TypedResourceConfig, ai as UserLike, U as UserOrganization, a6 as ValidateOptions, a5 as ValidationResult, aj as getUserId } from '../index-B4t03KQ0.js';
|
|
2
|
-
export { RouteHandlerMethod } from 'fastify';
|
|
3
|
-
export { Document, Model } from 'mongoose';
|
|
4
|
-
export { P as PermissionCheck, a as PermissionContext, b as PermissionResult, U as UserBase } from '../types-B99TBmFV.js';
|
package/dist/types/index.js
DELETED
package/dist/types-B99TBmFV.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { FastifyRequest } from 'fastify';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Permission Types - Core Type Definitions
|
|
5
|
-
*
|
|
6
|
-
* PermissionCheck is THE ONLY way to define permissions in Arc.
|
|
7
|
-
* No string arrays, no alternative patterns.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* User base interface - minimal shape Arc expects
|
|
12
|
-
* Your actual User can have any additional fields
|
|
13
|
-
*/
|
|
14
|
-
interface UserBase {
|
|
15
|
-
id?: string;
|
|
16
|
-
_id?: string;
|
|
17
|
-
roles?: string[];
|
|
18
|
-
[key: string]: unknown;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Context passed to permission check functions
|
|
22
|
-
*/
|
|
23
|
-
interface PermissionContext {
|
|
24
|
-
/** Authenticated user or null if unauthenticated */
|
|
25
|
-
user: UserBase | null;
|
|
26
|
-
/** Fastify request object */
|
|
27
|
-
request: FastifyRequest;
|
|
28
|
-
/** Resource name being accessed */
|
|
29
|
-
resource: string;
|
|
30
|
-
/** Action being performed (list, get, create, update, delete) */
|
|
31
|
-
action: string;
|
|
32
|
-
/** Resource ID for single-resource operations */
|
|
33
|
-
resourceId?: string;
|
|
34
|
-
/** Organization context for multi-tenant apps */
|
|
35
|
-
organizationId?: string;
|
|
36
|
-
/** Request body data */
|
|
37
|
-
data?: Record<string, unknown>;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Result from permission check
|
|
41
|
-
*/
|
|
42
|
-
interface PermissionResult {
|
|
43
|
-
/** Whether access is granted */
|
|
44
|
-
granted: boolean;
|
|
45
|
-
/** Reason for denial (for error messages) */
|
|
46
|
-
reason?: string;
|
|
47
|
-
/** Query filters to apply (for ownership patterns) */
|
|
48
|
-
filters?: Record<string, unknown>;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Permission Check Function
|
|
52
|
-
*
|
|
53
|
-
* THE ONLY way to define permissions in Arc.
|
|
54
|
-
* Returns boolean, PermissionResult, or Promise of either.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```typescript
|
|
58
|
-
* // Simple boolean return
|
|
59
|
-
* const isAdmin: PermissionCheck = (ctx) => ctx.user?.roles?.includes('admin') ?? false;
|
|
60
|
-
*
|
|
61
|
-
* // With filters for ownership
|
|
62
|
-
* const ownedByUser: PermissionCheck = (ctx) => ({
|
|
63
|
-
* granted: true,
|
|
64
|
-
* filters: { userId: ctx.user?.id }
|
|
65
|
-
* });
|
|
66
|
-
*
|
|
67
|
-
* // Async check
|
|
68
|
-
* const canAccessOrg: PermissionCheck = async (ctx) => {
|
|
69
|
-
* const isMember = await checkMembership(ctx.user?.id, ctx.organizationId);
|
|
70
|
-
* return { granted: isMember, reason: isMember ? undefined : 'Not a member' };
|
|
71
|
-
* };
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
type PermissionCheck = (context: PermissionContext) => boolean | PermissionResult | Promise<boolean | PermissionResult>;
|
|
75
|
-
|
|
76
|
-
export type { PermissionCheck as P, UserBase as U, PermissionContext as a, PermissionResult as b };
|
package/dist/types-BvckRbs2.d.ts
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { FastifyServerOptions } from 'fastify';
|
|
2
|
-
import { FastifyCorsOptions } from '@fastify/cors';
|
|
3
|
-
import { FastifyHelmetOptions } from '@fastify/helmet';
|
|
4
|
-
import { RateLimitOptions } from '@fastify/rate-limit';
|
|
5
|
-
import { h as AuthPluginOptions } from './index-B4t03KQ0.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Types for createApp factory
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* CreateApp Options
|
|
13
|
-
*
|
|
14
|
-
* Configuration for creating an Arc application.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* // Minimal setup
|
|
19
|
-
* const app = await createApp({
|
|
20
|
-
* preset: 'development',
|
|
21
|
-
* auth: {
|
|
22
|
-
* jwt: { secret: process.env.JWT_SECRET },
|
|
23
|
-
* },
|
|
24
|
-
* });
|
|
25
|
-
*
|
|
26
|
-
* // With custom authenticator
|
|
27
|
-
* const app = await createApp({
|
|
28
|
-
* preset: 'production',
|
|
29
|
-
* auth: {
|
|
30
|
-
* jwt: { secret: process.env.JWT_SECRET },
|
|
31
|
-
* authenticate: async (request, { jwt }) => {
|
|
32
|
-
* // Check API key first
|
|
33
|
-
* const apiKey = request.headers['x-api-key'];
|
|
34
|
-
* if (apiKey) {
|
|
35
|
-
* const result = await apiKeyService.verify(apiKey);
|
|
36
|
-
* if (result) return { _id: result.userId, isApiKey: true };
|
|
37
|
-
* }
|
|
38
|
-
* // Then check JWT
|
|
39
|
-
* const token = request.headers.authorization?.split(' ')[1];
|
|
40
|
-
* if (token) {
|
|
41
|
-
* const decoded = jwt.verify(token);
|
|
42
|
-
* return userRepo.findById(decoded.id);
|
|
43
|
-
* }
|
|
44
|
-
* return null;
|
|
45
|
-
* },
|
|
46
|
-
* },
|
|
47
|
-
* });
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
interface CreateAppOptions {
|
|
51
|
-
/** Environment preset: 'production', 'development', or 'testing' */
|
|
52
|
-
preset?: 'production' | 'development' | 'testing';
|
|
53
|
-
/** Fastify logger configuration */
|
|
54
|
-
logger?: FastifyServerOptions['logger'];
|
|
55
|
-
/** Trust proxy headers (X-Forwarded-For, etc.) */
|
|
56
|
-
trustProxy?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Auth configuration
|
|
59
|
-
*
|
|
60
|
-
* Set to false to disable authentication entirely.
|
|
61
|
-
* Provide AuthPluginOptions for full control.
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```typescript
|
|
65
|
-
* // Disable auth
|
|
66
|
-
* auth: false,
|
|
67
|
-
*
|
|
68
|
-
* // Simple JWT (uses default jwtVerify)
|
|
69
|
-
* auth: {
|
|
70
|
-
* jwt: { secret: process.env.JWT_SECRET },
|
|
71
|
-
* },
|
|
72
|
-
*
|
|
73
|
-
* // Custom authenticator
|
|
74
|
-
* auth: {
|
|
75
|
-
* jwt: { secret: process.env.JWT_SECRET },
|
|
76
|
-
* authenticate: async (request, { jwt }) => {
|
|
77
|
-
* const token = request.headers.authorization?.split(' ')[1];
|
|
78
|
-
* if (!token) return null;
|
|
79
|
-
* const decoded = jwt.verify(token);
|
|
80
|
-
* return userRepo.findById(decoded.id);
|
|
81
|
-
* },
|
|
82
|
-
* },
|
|
83
|
-
*
|
|
84
|
-
* // Completely custom auth plugin
|
|
85
|
-
* auth: {
|
|
86
|
-
* plugin: async (fastify) => {
|
|
87
|
-
* // Your custom auth setup
|
|
88
|
-
* },
|
|
89
|
-
* },
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
auth?: false | AuthPluginOptions | {
|
|
93
|
-
/** Replace Arc auth with your own plugin */
|
|
94
|
-
plugin?: (fastify: any) => Promise<void>;
|
|
95
|
-
};
|
|
96
|
-
/** Helmet security headers. Set to false to disable. */
|
|
97
|
-
helmet?: FastifyHelmetOptions | false;
|
|
98
|
-
/** CORS configuration. Set to false to disable. */
|
|
99
|
-
cors?: FastifyCorsOptions | false;
|
|
100
|
-
/** Rate limiting. Set to false to disable. */
|
|
101
|
-
rateLimit?: RateLimitOptions | false;
|
|
102
|
-
/** Under pressure health monitoring. Set to false to disable. */
|
|
103
|
-
underPressure?: UnderPressureOptions | false;
|
|
104
|
-
/** @fastify/sensible (HTTP helpers). Set to false to disable. */
|
|
105
|
-
sensible?: boolean | false;
|
|
106
|
-
/** @fastify/multipart (file uploads). Set to false to disable. */
|
|
107
|
-
multipart?: MultipartOptions | false;
|
|
108
|
-
/** Raw body parsing (for webhooks). Set to false to disable. */
|
|
109
|
-
rawBody?: RawBodyOptions | false;
|
|
110
|
-
/** Enable Arc plugins (requestId, health, gracefulShutdown) */
|
|
111
|
-
arcPlugins?: {
|
|
112
|
-
/** Request ID tracking (default: true) */
|
|
113
|
-
requestId?: boolean;
|
|
114
|
-
/** Health endpoints (default: true) */
|
|
115
|
-
health?: boolean;
|
|
116
|
-
/** Graceful shutdown handling (default: true) */
|
|
117
|
-
gracefulShutdown?: boolean;
|
|
118
|
-
/** Emit events for CRUD operations (default: true) */
|
|
119
|
-
emitEvents?: boolean;
|
|
120
|
-
};
|
|
121
|
-
/** Custom plugin registration function */
|
|
122
|
-
plugins?: (fastify: any) => Promise<void>;
|
|
123
|
-
}
|
|
124
|
-
interface UnderPressureOptions {
|
|
125
|
-
exposeStatusRoute?: boolean;
|
|
126
|
-
maxEventLoopDelay?: number;
|
|
127
|
-
maxHeapUsedBytes?: number;
|
|
128
|
-
maxRssBytes?: number;
|
|
129
|
-
}
|
|
130
|
-
interface MultipartOptions {
|
|
131
|
-
limits?: {
|
|
132
|
-
fileSize?: number;
|
|
133
|
-
files?: number;
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
interface RawBodyOptions {
|
|
137
|
-
field?: string;
|
|
138
|
-
global?: boolean;
|
|
139
|
-
encoding?: string;
|
|
140
|
-
runFirst?: boolean;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export type { CreateAppOptions as C, MultipartOptions as M, RawBodyOptions as R, UnderPressureOptions as U };
|