@classytic/arc 2.10.8 → 2.11.1
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-DVNKvoX4.mjs → BaseController-JNV08qOT.mjs} +480 -442
- package/dist/{queryCachePlugin-Dumka73q.d.mts → QueryCache-DOBNHBE0.d.mts} +2 -32
- package/dist/adapters/index.d.mts +2 -2
- package/dist/adapters/index.mjs +1 -1
- package/dist/{adapters-BXY4i-hw.mjs → adapters-D0tT2Tyo.mjs} +54 -0
- package/dist/audit/index.d.mts +1 -1
- package/dist/auth/index.d.mts +1 -1
- package/dist/auth/index.mjs +5 -5
- package/dist/{betterAuthOpenApi--rdY15Ld.mjs → betterAuthOpenApi-DwxtK3uG.mjs} +1 -1
- package/dist/cache/index.d.mts +3 -2
- package/dist/cache/index.mjs +3 -3
- package/dist/cli/commands/docs.mjs +2 -2
- package/dist/cli/commands/generate.mjs +37 -27
- package/dist/cli/commands/init.mjs +46 -33
- package/dist/cli/commands/introspect.mjs +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.mjs +4 -3
- package/dist/core-DXdSSFW-.mjs +1037 -0
- package/dist/createActionRouter-BwaSM0No.mjs +166 -0
- package/dist/{createApp-BwnEAO2h.mjs → createApp-P1d6rjPy.mjs} +75 -27
- package/dist/docs/index.d.mts +1 -1
- package/dist/docs/index.mjs +2 -2
- package/dist/{elevation-Dci0AYLT.mjs → elevation-DOFoxoDs.mjs} +1 -1
- package/dist/{errorHandler-CSxe7KIM.mjs → errorHandler-BQm8ZxTK.mjs} +1 -1
- package/dist/{eventPlugin-ByU4Cv0e.mjs → eventPlugin--5HIkdPU.mjs} +1 -1
- package/dist/events/index.d.mts +3 -3
- package/dist/events/index.mjs +2 -2
- package/dist/events/transports/redis-stream-entry.d.mts +1 -1
- package/dist/factory/index.d.mts +2 -2
- package/dist/factory/index.mjs +2 -2
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/idempotency/index.d.mts +3 -3
- package/dist/idempotency/index.mjs +1 -1
- package/dist/idempotency/redis.d.mts +1 -1
- package/dist/{index-C_Noptz-.d.mts → index-BYCqHCVu.d.mts} +2 -2
- package/dist/{index-BGbpGVyM.d.mts → index-C_bgx9o4.d.mts} +712 -500
- package/dist/{index-BziRPS4H.d.mts → index-CvM1e09j.d.mts} +29 -10
- package/dist/{index-EqQN6p0W.d.mts → index-pUczGjO0.d.mts} +11 -8
- package/dist/index-smCAoA5W.d.mts +1179 -0
- package/dist/index.d.mts +6 -38
- package/dist/index.mjs +9 -9
- package/dist/integrations/event-gateway.d.mts +1 -1
- package/dist/integrations/event-gateway.mjs +1 -1
- package/dist/integrations/index.d.mts +2 -2
- 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 +46 -5
- package/dist/integrations/streamline.mjs +50 -21
- package/dist/integrations/websocket-redis.d.mts +1 -1
- package/dist/integrations/websocket.d.mts +2 -154
- package/dist/integrations/websocket.mjs +292 -224
- package/dist/{keys-nWQGUTu1.mjs → keys-CARyUjiR.mjs} +2 -0
- package/dist/{loadResources-Bksk8ydA.mjs → loadResources-CPpkyKfM.mjs} +32 -8
- package/dist/middleware/index.d.mts +1 -1
- package/dist/middleware/index.mjs +1 -1
- package/dist/{openapi-DpNpqBmo.mjs → openapi-C0L9ar7m.mjs} +4 -4
- package/dist/org/index.d.mts +1 -1
- package/dist/permissions/index.d.mts +1 -1
- package/dist/permissions/index.mjs +2 -4
- package/dist/{permissions-wkqRwicB.mjs → permissions-B4vU9L0Q.mjs} +221 -3
- package/dist/{pipe-CGJxqDGx.mjs → pipe-DVoIheVC.mjs} +1 -1
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/pipeline/index.mjs +1 -1
- package/dist/plugins/index.d.mts +4 -4
- package/dist/plugins/index.mjs +10 -10
- package/dist/plugins/response-cache.mjs +1 -1
- package/dist/plugins/tracing-entry.d.mts +1 -1
- package/dist/plugins/tracing-entry.mjs +42 -24
- package/dist/presets/filesUpload.d.mts +1 -1
- package/dist/presets/filesUpload.mjs +3 -3
- package/dist/presets/index.d.mts +1 -1
- package/dist/presets/index.mjs +1 -1
- package/dist/presets/multiTenant.d.mts +1 -1
- package/dist/presets/multiTenant.mjs +6 -0
- package/dist/presets/search.d.mts +1 -1
- package/dist/presets/search.mjs +1 -1
- package/dist/{presets-CrwOvuXI.mjs → presets-k604Lj99.mjs} +1 -1
- package/dist/queryCachePlugin-BUXBSm4F.d.mts +34 -0
- package/dist/{queryCachePlugin-ChLNZvFT.mjs → queryCachePlugin-Bq6bO6vc.mjs} +3 -3
- package/dist/{redis-MXLp1oOf.d.mts → redis-Cm1gnRDf.d.mts} +1 -1
- package/dist/registry/index.d.mts +1 -1
- package/dist/registry/index.mjs +2 -2
- package/dist/{resourceToTools-BhF3JV5p.mjs → resourceToTools--okX6QBr.mjs} +534 -420
- package/dist/routerShared-DeESFp4a.mjs +515 -0
- package/dist/schemaIR-BlG9bY7v.mjs +137 -0
- package/dist/scope/index.mjs +2 -2
- package/dist/testing/index.d.mts +367 -711
- package/dist/testing/index.mjs +637 -1434
- package/dist/{tracing-xqXzWeaf.d.mts → tracing-DokiEsuz.d.mts} +9 -4
- package/dist/types/index.d.mts +3 -3
- package/dist/types/index.mjs +1 -3
- package/dist/{types-CVdgPXBW.d.mts → types-BdA4uMBV.d.mts} +191 -28
- package/dist/{types-CVKBssX5.d.mts → types-Bh_gEJBi.d.mts} +1 -1
- package/dist/utils/index.d.mts +2 -968
- package/dist/utils/index.mjs +5 -6
- package/dist/utils-D3Yxnrwr.mjs +1639 -0
- package/dist/websocket-CyJ1VIFI.d.mts +186 -0
- package/package.json +7 -5
- package/skills/arc/SKILL.md +124 -39
- package/skills/arc/references/testing.md +212 -183
- package/dist/applyPermissionResult-QhV1Pa-g.mjs +0 -37
- package/dist/core-3MWJosCH.mjs +0 -1459
- package/dist/createActionRouter-C8UUB3Px.mjs +0 -249
- package/dist/errors-BI8kEKsO.d.mts +0 -140
- package/dist/fields-CTMWOUDt.mjs +0 -126
- package/dist/queryParser-NR__Qiju.mjs +0 -419
- package/dist/types-CDnTEpga.mjs +0 -27
- package/dist/utils-LMwVidKy.mjs +0 -947
- /package/dist/{HookSystem-BjFu7zf1.mjs → HookSystem-CGsMd6oK.mjs} +0 -0
- /package/dist/{ResourceRegistry-CcN2LVrc.mjs → ResourceRegistry-DkAeAuTX.mjs} +0 -0
- /package/dist/{actionPermissions-TUVR3uiZ.mjs → actionPermissions-C8YYU92K.mjs} +0 -0
- /package/dist/{caching-3h93rkJM.mjs → caching-CheW3m-S.mjs} +0 -0
- /package/dist/{errorHandler-2ii4RIYr.d.mts → errorHandler-Co3lnVmJ.d.mts} +0 -0
- /package/dist/{errors-BqdUDja_.mjs → errors-D5c-5BJL.mjs} +0 -0
- /package/dist/{eventPlugin-D1ThQ1Pp.d.mts → eventPlugin-CUNjYYRY.d.mts} +0 -0
- /package/dist/{interface-B-pe8fhj.d.mts → interface-CkkWm5uR.d.mts} +0 -0
- /package/dist/{interface-yhyb_pLY.d.mts → interface-Da0r7Lna.d.mts} +0 -0
- /package/dist/{memory-DqI-449b.mjs → memory-DikHSvWa.mjs} +0 -0
- /package/dist/{metrics-TuOmguhi.mjs → metrics-Csh4nsvv.mjs} +0 -0
- /package/dist/{multipartBody-CUQGVlM_.mjs → multipartBody-CvTR1Un6.mjs} +0 -0
- /package/dist/{pluralize-CWP6MB39.mjs → pluralize-BneOJkpi.mjs} +0 -0
- /package/dist/{redis-stream-bkO88VHx.d.mts → redis-stream-CM8TXTix.d.mts} +0 -0
- /package/dist/{registry-B0Wl7uVV.mjs → registry-D63ee7fl.mjs} +0 -0
- /package/dist/{replyHelpers-BLojtuvR.mjs → replyHelpers-ByllIXXV.mjs} +0 -0
- /package/dist/{requestContext-C38GskNt.mjs → requestContext-CfRkaxwf.mjs} +0 -0
- /package/dist/{schemaConverter-BxFDdtXu.mjs → schemaConverter-B0oKLuqI.mjs} +0 -0
- /package/dist/{sse-D8UeDwis.mjs → sse-V7aXc3bW.mjs} +0 -0
- /package/dist/{store-helpers-DYYUQbQN.mjs → store-helpers-BhrzxvyQ.mjs} +0 -0
- /package/dist/{typeGuards-Cj5Rgvlg.mjs → typeGuards-CcFZXgU7.mjs} +0 -0
- /package/dist/{types-D57iXYb8.mjs → types-DV9WDfeg.mjs} +0 -0
- /package/dist/{versioning-B6mimogM.mjs → versioning-CGPjkqAg.mjs} +0 -0
- /package/dist/{versioning-CeUXHfjw.d.mts → versioning-M9lNLhO8.d.mts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Model } from "mongoose";
|
|
1
|
+
import { $ as OpenApiSchemas, Dn as AdapterSchemaContext, Mn as SchemaMetadata, Nn as ValidationResult, On as DataAdapter, S as QueryParserInterface, b as ParsedQuery, ft as RouteSchemaOptions, jn as RepositoryLike } from "./index-C_bgx9o4.mjs";
|
|
3
2
|
import { StandardRepo } from "@classytic/repo-core/repository";
|
|
3
|
+
import { Model } from "mongoose";
|
|
4
4
|
|
|
5
5
|
//#region src/adapters/drizzle.d.ts
|
|
6
6
|
/**
|
|
@@ -30,7 +30,7 @@ interface DrizzleAdapterOptions<TDoc = unknown> {
|
|
|
30
30
|
/** Drizzle table — used for schema introspection. */
|
|
31
31
|
table: DrizzleTableLike;
|
|
32
32
|
/** Repository implementing the repo-core contract. */
|
|
33
|
-
repository:
|
|
33
|
+
repository: RepositoryLike<TDoc>;
|
|
34
34
|
/**
|
|
35
35
|
* External schema generator. When provided, replaces the built-in
|
|
36
36
|
* type-only conversion. Wire it to your kit's `buildCrudSchemasFromTable`
|
|
@@ -46,7 +46,7 @@ declare class DrizzleAdapter<TDoc = unknown> implements DataAdapter<TDoc> {
|
|
|
46
46
|
readonly type: "drizzle";
|
|
47
47
|
readonly name: string;
|
|
48
48
|
readonly table: DrizzleTableLike;
|
|
49
|
-
readonly repository:
|
|
49
|
+
readonly repository: RepositoryLike<TDoc>;
|
|
50
50
|
private readonly schemaGenerator?;
|
|
51
51
|
constructor(options: DrizzleAdapterOptions<TDoc>);
|
|
52
52
|
/**
|
|
@@ -86,24 +86,32 @@ interface MongooseAdapterOptions<TDoc = unknown> {
|
|
|
86
86
|
/** Mongoose model instance — preserves document type for type safety */
|
|
87
87
|
model: Model<TDoc>;
|
|
88
88
|
/** Repository implementing CRUD operations - accepts any repository-like object */
|
|
89
|
-
repository:
|
|
89
|
+
repository: RepositoryLike<TDoc>;
|
|
90
90
|
/**
|
|
91
91
|
* External schema generator plugin for OpenAPI docs.
|
|
92
92
|
* When provided, replaces the built-in basic type conversion.
|
|
93
93
|
* Receives the Mongoose model and schema options, must return OpenApiSchemas.
|
|
94
94
|
*
|
|
95
|
-
*
|
|
95
|
+
* **Model type is intentionally `Model<unknown>`, not `Model<TDoc>`**:
|
|
96
|
+
* schema generators introspect `.schema.paths` — they read metadata, not
|
|
97
|
+
* document types. Typing as `Model<TDoc>` forced every mongokit host to
|
|
98
|
+
* cast `m as unknown as Model<unknown>` when handing the model to
|
|
99
|
+
* `buildCrudSchemasFromModel` (which is typed `Model<unknown>`), because
|
|
100
|
+
* `Model<T>` is invariant in T. Widening here at the callback boundary
|
|
101
|
+
* trades one documented internal cast for zero host-side casts.
|
|
102
|
+
*
|
|
103
|
+
* @example MongoKit integration — direct pass-through, no casts
|
|
96
104
|
* ```typescript
|
|
97
105
|
* import { buildCrudSchemasFromModel } from '@classytic/mongokit';
|
|
98
106
|
*
|
|
99
107
|
* createMongooseAdapter({
|
|
100
108
|
* model: JobModel,
|
|
101
109
|
* repository: jobRepository,
|
|
102
|
-
* schemaGenerator:
|
|
110
|
+
* schemaGenerator: buildCrudSchemasFromModel,
|
|
103
111
|
* });
|
|
104
112
|
* ```
|
|
105
113
|
*/
|
|
106
|
-
schemaGenerator?: (model: Model<
|
|
114
|
+
schemaGenerator?: (model: Model<unknown>, options?: RouteSchemaOptions, context?: AdapterSchemaContext) => OpenApiSchemas | Record<string, unknown>;
|
|
107
115
|
}
|
|
108
116
|
/**
|
|
109
117
|
* Mongoose data adapter with proper type safety
|
|
@@ -114,7 +122,7 @@ declare class MongooseAdapter<TDoc = unknown> implements DataAdapter<TDoc> {
|
|
|
114
122
|
readonly type: "mongoose";
|
|
115
123
|
readonly name: string;
|
|
116
124
|
readonly model: Model<TDoc>;
|
|
117
|
-
readonly repository:
|
|
125
|
+
readonly repository: RepositoryLike<TDoc>;
|
|
118
126
|
private readonly schemaGenerator?;
|
|
119
127
|
constructor(options: MongooseAdapterOptions<TDoc>);
|
|
120
128
|
/**
|
|
@@ -141,6 +149,17 @@ declare class MongooseAdapter<TDoc = unknown> implements DataAdapter<TDoc> {
|
|
|
141
149
|
* Create Mongoose adapter with flexible type acceptance.
|
|
142
150
|
* Accepts any repository with CRUD methods — no `as any` needed.
|
|
143
151
|
*
|
|
152
|
+
* **Type parameter (v2.11):** `TDoc` is UNCONSTRAINED. An earlier v2.11
|
|
153
|
+
* revision added `TDoc extends AnyRecord` to surface errors at the
|
|
154
|
+
* adapter call site, but Mongoose's own document types
|
|
155
|
+
* (`HydratedDocument<T>`, `T & Document`) don't carry an index signature
|
|
156
|
+
* — so the constraint fired on the exact Mongoose idioms this factory
|
|
157
|
+
* is designed to accept. Hosts were casting with
|
|
158
|
+
* `as RepositoryLike<Record<string, unknown>>` at every call just to
|
|
159
|
+
* silence it. The constraint now lives exclusively on `BaseController`
|
|
160
|
+
* where it's load-bearing for mixin composition; `defineResource`
|
|
161
|
+
* widens once internally so every other layer stays permissive.
|
|
162
|
+
*
|
|
144
163
|
* @example
|
|
145
164
|
* ```typescript
|
|
146
165
|
* // Object form (explicit)
|
|
@@ -153,7 +172,7 @@ declare class MongooseAdapter<TDoc = unknown> implements DataAdapter<TDoc> {
|
|
|
153
172
|
* const adapter = createMongooseAdapter(ProductModel, productRepository);
|
|
154
173
|
* ```
|
|
155
174
|
*/
|
|
156
|
-
declare function createMongooseAdapter<TDoc = unknown>(model: Model<TDoc>, repository:
|
|
175
|
+
declare function createMongooseAdapter<TDoc = unknown>(model: Model<TDoc>, repository: RepositoryLike<TDoc>): DataAdapter<TDoc>;
|
|
157
176
|
declare function createMongooseAdapter<TDoc = unknown>(options: MongooseAdapterOptions<TDoc>): DataAdapter<TDoc>;
|
|
158
177
|
//#endregion
|
|
159
178
|
//#region src/adapters/prisma.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as ResourceDefinition, C as RequestContext, F as FastifyWithDecorators,
|
|
1
|
+
import { B as ResourceDefinition, C as RequestContext, F as FastifyWithDecorators, Pt as AnyRecord, T as CrudRouterOptions, _t as IControllerResponse, at as ResourceConfig, gt as IController, q as CrudController, vt as IRequestContext } from "./index-C_bgx9o4.mjs";
|
|
2
2
|
import { r as RequestScope } from "./types-tgR4Pt8F.mjs";
|
|
3
3
|
import { c as PermissionCheck } from "./fields-C8Y0XLAu.mjs";
|
|
4
4
|
import { FastifyReply, FastifyRequest, RouteHandlerMethod } from "fastify";
|
|
@@ -54,16 +54,19 @@ declare const RESERVED_QUERY_PARAMS: Readonly<Set<string>>;
|
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region src/core/createCrudRouter.d.ts
|
|
56
56
|
/**
|
|
57
|
-
* Create CRUD routes for a controller
|
|
57
|
+
* Create CRUD routes for a controller.
|
|
58
58
|
*
|
|
59
|
-
* @param fastify
|
|
60
|
-
* @param controller - CRUD controller with handler methods
|
|
61
|
-
*
|
|
59
|
+
* @param fastify - Fastify instance with Arc decorators
|
|
60
|
+
* @param controller - CRUD controller with handler methods (optional when
|
|
61
|
+
* `disableDefaultRoutes: true` and only custom `routes`
|
|
62
|
+
* are being registered)
|
|
63
|
+
* @param options - Router configuration
|
|
62
64
|
*/
|
|
63
65
|
declare function createCrudRouter<TDoc = unknown>(fastify: FastifyWithDecorators, controller: CrudController<TDoc> | undefined, options?: CrudRouterOptions): void;
|
|
64
66
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
+
* Build a permission middleware from a PermissionCheck — useful when hosts
|
|
68
|
+
* register their own routes outside the resource system but still want to
|
|
69
|
+
* evaluate permissions through the shared applicator.
|
|
67
70
|
*/
|
|
68
71
|
declare function createPermissionMiddleware(permission: PermissionCheck, resourceName: string, action: string): RouteHandlerMethod | null;
|
|
69
72
|
//#endregion
|
|
@@ -108,7 +111,7 @@ type VariantsResult<TDoc, V extends VariantsMap<TDoc>> = { [K in keyof V]: Resou
|
|
|
108
111
|
* @returns A record where each key from `variants` maps to a real
|
|
109
112
|
* `ResourceDefinition` ready for `.toPlugin()` registration.
|
|
110
113
|
*/
|
|
111
|
-
declare function defineResourceVariants<TDoc = AnyRecord, V extends VariantsMap<TDoc> = VariantsMap<TDoc>>(base: Omit<ResourceConfig<TDoc>, "name" | "prefix">, variants: V): VariantsResult<TDoc, V>;
|
|
114
|
+
declare function defineResourceVariants<TDoc extends AnyRecord = AnyRecord, V extends VariantsMap<TDoc> = VariantsMap<TDoc>>(base: Omit<ResourceConfig<TDoc>, "name" | "prefix">, variants: V): VariantsResult<TDoc, V>;
|
|
112
115
|
//#endregion
|
|
113
116
|
//#region src/core/fastifyAdapter.d.ts
|
|
114
117
|
/**
|