@classytic/arc 2.11.4 → 2.13.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/README.md +16 -12
- package/dist/{BaseController-swXruJ2_.mjs → BaseController-DX_T-bDB.mjs} +388 -423
- package/dist/EventTransport-CT_52aWU.d.mts +34 -0
- package/dist/EventTransport-DLWoUMHy.mjs +103 -0
- package/dist/{ResourceRegistry-DkAeAuTX.mjs → ResourceRegistry-CTERg_2x.mjs} +139 -66
- package/dist/audit/index.d.mts +2 -2
- package/dist/audit/index.mjs +1 -1
- package/dist/auth/audit.d.mts +199 -0
- package/dist/auth/audit.mjs +288 -0
- package/dist/auth/index.d.mts +3 -3
- package/dist/auth/index.mjs +117 -191
- package/dist/{betterAuthOpenApi-DwxtK3uG.mjs → betterAuthOpenApi--M_i87dQ.mjs} +1 -1
- package/dist/buildHandler-olo-gt94.mjs +610 -0
- package/dist/cache/index.mjs +3 -3
- package/dist/cli/commands/describe.d.mts +89 -13
- package/dist/cli/commands/describe.mjs +56 -2
- package/dist/cli/commands/docs.mjs +2 -2
- package/dist/cli/commands/generate.mjs +147 -48
- package/dist/cli/commands/init.d.mts +13 -0
- package/dist/cli/commands/init.mjs +130 -87
- package/dist/cli/commands/introspect.mjs +8 -1
- package/dist/context/index.mjs +1 -1
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.mjs +5 -5
- package/dist/core-D72ia0EH.mjs +1399 -0
- package/dist/{createActionRouter-CIKOcNA7.mjs → createActionRouter-CEvzKcy8.mjs} +7 -20
- package/dist/createAggregationRouter-CyecOxnO.mjs +114 -0
- package/dist/{createApp-C9bRrqlX.mjs → createApp-XX2-N0Yd.mjs} +28 -22
- package/dist/{defineEvent-D1Ky9M1D.mjs → defineEvent-D5h7EvAx.mjs} +1 -1
- package/dist/docs/index.d.mts +1 -1
- package/dist/docs/index.mjs +2 -2
- package/dist/{elevation-DOFoxoDs.mjs → elevation-DgoeTyfX.mjs} +1 -1
- package/dist/errorHandler-Bk-AGhkU.mjs +174 -0
- package/dist/errorHandler-DFr45ZG4.d.mts +45 -0
- package/dist/errors-j4aJm1Wg.mjs +184 -0
- package/dist/{eventPlugin-Cts2-Tfj.mjs → eventPlugin-CaKTYkYM.mjs} +28 -4
- package/dist/{eventPlugin-DDJoNEPL.d.mts → eventPlugin-qXpqTebY.d.mts} +24 -1
- package/dist/events/index.d.mts +6 -6
- package/dist/events/index.mjs +11 -35
- package/dist/events/transports/redis-stream-entry.d.mts +1 -1
- package/dist/events/transports/redis.d.mts +1 -1
- package/dist/factory/index.d.mts +2 -2
- package/dist/factory/index.mjs +2 -2
- package/dist/{fields-BRjxOAFp.d.mts → fields-COhcH3fk.d.mts} +23 -2
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/idempotency/index.d.mts +1 -1
- package/dist/idempotency/index.mjs +1 -20
- package/dist/idempotency/redis.mjs +1 -1
- package/dist/{index-rHjXmJar.d.mts → index-BTqLEvhu.d.mts} +163 -3
- package/dist/{index-CXXRbnf8.d.mts → index-BtW7qYwa.d.mts} +660 -326
- package/dist/{index-m8mOOlFW.d.mts → index-Ds61mrJE.d.mts} +50 -4
- package/dist/{index-D9t1KNaB.d.mts → index-Dz5IKsrE.d.mts} +360 -219
- package/dist/index.d.mts +6 -7
- package/dist/index.mjs +9 -10
- package/dist/integrations/event-gateway.d.mts +1 -1
- package/dist/integrations/event-gateway.mjs +1 -1
- package/dist/integrations/index.d.mts +1 -1
- package/dist/integrations/mcp/index.d.mts +2 -2
- package/dist/integrations/mcp/index.mjs +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 +60 -11
- package/dist/integrations/streamline.mjs +75 -85
- package/dist/integrations/websocket.mjs +2 -8
- package/dist/middleware/index.d.mts +1 -1
- package/dist/middleware/index.mjs +2 -2
- package/dist/migrations/index.d.mts +23 -3
- package/dist/migrations/index.mjs +0 -7
- package/dist/{multipartBody-CvTR1Un6.mjs → multipartBody-BOvVSVCD.mjs} +11 -8
- package/dist/{openapi-D7G1V7ex.mjs → openapi-CiOMVW1p.mjs} +143 -13
- package/dist/org/index.d.mts +2 -2
- package/dist/org/index.mjs +1 -1
- package/dist/permissions/index.d.mts +3 -3
- package/dist/permissions/index.mjs +3 -3
- package/dist/{permissions-gd_aUWrR.mjs → permissions-ohQyv50e.mjs} +404 -176
- package/dist/{pipe-DVoIheVC.mjs → pipe-Zr0KXjQe.mjs} +1 -1
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/pipeline/index.mjs +1 -1
- package/dist/plugins/index.d.mts +16 -31
- package/dist/plugins/index.mjs +33 -13
- package/dist/plugins/response-cache.mjs +1 -1
- package/dist/plugins/tracing-entry.mjs +1 -1
- package/dist/presets/filesUpload.d.mts +4 -4
- package/dist/presets/filesUpload.mjs +6 -9
- 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 +2 -2
- package/dist/presets/search.d.mts +2 -2
- package/dist/presets/search.mjs +6 -8
- package/dist/{presets-Z7P5w4gF.mjs → presets-BbkjdPeH.mjs} +6 -28
- package/dist/{queryCachePlugin-Bq6bO6vc.mjs → queryCachePlugin-m1XsgAIJ.mjs} +3 -3
- package/dist/{redis-stream-xTGxB2bm.d.mts → redis-stream-D6HzR1Z_.d.mts} +1 -1
- package/dist/registry/index.d.mts +1 -1
- package/dist/registry/index.mjs +2 -2
- package/dist/{replyHelpers-ByllIXXV.mjs → replyHelpers-CK-FNO8E.mjs} +3 -21
- package/dist/{resourceToTools-CxNmI6xF.mjs → resourceToTools-C5coh64w.mjs} +224 -71
- package/dist/{routerShared-BqLRb5l7.mjs → routerShared-D6_fEGHh.mjs} +40 -36
- package/dist/{schemaIR-Dy2p4MxS.mjs → schemaIR-7Vl611Qs.mjs} +1 -1
- package/dist/schemas/index.d.mts +100 -30
- package/dist/schemas/index.mjs +86 -29
- package/dist/scim/index.d.mts +264 -0
- package/dist/scim/index.mjs +963 -0
- package/dist/scope/index.d.mts +3 -3
- package/dist/scope/index.mjs +4 -4
- package/dist/{sse-V7aXc3bW.mjs → sse-Bz-5ZeTt.mjs} +1 -1
- package/dist/{store-helpers-Cp4uKC1U.mjs → store-helpers-BkIN9-vu.mjs} +1 -1
- package/dist/testing/index.d.mts +2 -8
- package/dist/testing/index.mjs +16 -24
- package/dist/types/index.d.mts +4 -4
- package/dist/{types-D7KpfiL1.d.mts → types-BvqwCCSx.d.mts} +73 -25
- package/dist/{types-DDyTPc6y.d.mts → types-CTYvcwHe.d.mts} +195 -1
- package/dist/{types-AOD8fxIw.mjs → types-C_s5moIu.mjs} +117 -1
- package/dist/{types-BQ9TJQNy.d.mts → types-DQHFc8PM.d.mts} +1 -1
- package/dist/utils/index.d.mts +2 -2
- package/dist/utils/index.mjs +5 -5
- package/dist/{utils-CcYTj09l.mjs → utils-_h9B3c57.mjs} +1269 -1334
- package/dist/{versioning-DsglKfM_.d.mts → versioning-DTTvc80y.d.mts} +1 -1
- package/package.json +24 -34
- package/skills/arc/SKILL.md +147 -51
- package/skills/arc/references/agent-auth.md +238 -0
- package/skills/arc/references/api-reference.md +187 -0
- package/skills/arc/references/auth.md +354 -7
- package/skills/arc/references/enterprise-auth.md +94 -0
- package/skills/arc/references/events.md +8 -6
- package/skills/arc/references/mcp.md +2 -2
- package/skills/arc/references/multi-tenancy.md +11 -2
- package/skills/arc/references/production.md +10 -9
- package/skills/arc/references/scim.md +247 -0
- package/skills/arc/references/testing.md +1 -1
- package/skills/arc-code-review/SKILL.md +141 -0
- package/skills/arc-code-review/references/anti-patterns.md +911 -0
- package/skills/arc-code-review/references/arc-cheatsheet.md +380 -0
- package/skills/arc-code-review/references/migration-recipes.md +700 -0
- package/skills/arc-code-review/references/mongokit-migration.md +386 -0
- package/skills/arc-code-review/references/scaffolding.md +230 -0
- package/skills/arc-code-review/references/severity.md +127 -0
- package/dist/EventTransport-BFQjw9pB.mjs +0 -133
- package/dist/EventTransport-CYNUXdCJ.d.mts +0 -293
- package/dist/adapters/index.d.mts +0 -3
- package/dist/adapters/index.mjs +0 -2
- package/dist/adapters-DUUiiimH.mjs +0 -964
- package/dist/auth/mongoose.d.mts +0 -191
- package/dist/auth/mongoose.mjs +0 -73
- package/dist/core-CbcQRIch.mjs +0 -1054
- package/dist/errorHandler-BQm8ZxTK.mjs +0 -173
- package/dist/errorHandler-DEWmGWPz.d.mts +0 -114
- package/dist/errors-D5c-5BJL.mjs +0 -232
- package/dist/index-Rg8axYPz.d.mts +0 -370
- /package/dist/{HookSystem-CGsMd6oK.mjs → HookSystem-Iiebom92.mjs} +0 -0
- /package/dist/{actionPermissions-sUUKDhtP.mjs → actionPermissions-CyUkQu6O.mjs} +0 -0
- /package/dist/{caching-CheW3m-S.mjs → caching-SM8gghN6.mjs} +0 -0
- /package/dist/{constants-BhY1OHoH.mjs → constants-Cxde4rpC.mjs} +0 -0
- /package/dist/{elevation-BQQXZ_VR.d.mts → elevation-BXOWoGCF.d.mts} +0 -0
- /package/dist/{keys-CARyUjiR.mjs → keys-CGcCbNyu.mjs} +0 -0
- /package/dist/{loadResources-CPpkyKfM.mjs → loadResources-DBMQg_Aj.mjs} +0 -0
- /package/dist/{memory-DikHSvWa.mjs → memory-UBydS5ku.mjs} +0 -0
- /package/dist/{metrics-Csh4nsvv.mjs → metrics-Qnvwc-LQ.mjs} +0 -0
- /package/dist/{pluralize-CWP6MB39.mjs → pluralize-DQgqgifU.mjs} +0 -0
- /package/dist/{registry-D63ee7fl.mjs → registry-I-ogLgL9.mjs} +0 -0
- /package/dist/{requestContext-C5XeK3VA.mjs → requestContext-SSaaTgW8.mjs} +0 -0
- /package/dist/{schemaConverter-B0oKLuqI.mjs → schemaConverter-De34B1ZG.mjs} +0 -0
- /package/dist/{typeGuards-CcFZXgU7.mjs → typeGuards-BzkXkvVv.mjs} +0 -0
- /package/dist/{types-DV9WDfeg.mjs → types-D57iXYb8.mjs} +0 -0
- /package/dist/{versioning-CGPjkqAg.mjs → versioning-BUrT5aP4.mjs} +0 -0
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
import { $ as OpenApiSchemas, Dn as AdapterRepositoryInput, Mn as RepositoryLike, Nn as SchemaMetadata, On as AdapterSchemaContext, Pn as ValidationResult, S as QueryParserInterface, b as ParsedQuery, ft as RouteSchemaOptions, kn as DataAdapter } from "./index-CXXRbnf8.mjs";
|
|
2
|
-
import { StandardRepo } from "@classytic/repo-core/repository";
|
|
3
|
-
import { Model } from "mongoose";
|
|
4
|
-
|
|
5
|
-
//#region src/adapters/drizzle.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Minimum shape arc needs from a Drizzle column. Every SQLite, PG, and MySQL
|
|
8
|
-
* column in `drizzle-orm` exposes these via `getTableColumns(table)`. Held
|
|
9
|
-
* structurally so arc doesn't depend on `drizzle-orm` types.
|
|
10
|
-
*/
|
|
11
|
-
interface DrizzleColumnLike {
|
|
12
|
-
columnType?: string;
|
|
13
|
-
dataType?: "number" | "string" | "date" | "boolean" | "json" | "buffer" | "bigint" | "custom";
|
|
14
|
-
notNull?: boolean;
|
|
15
|
-
hasDefault?: boolean;
|
|
16
|
-
primary?: boolean;
|
|
17
|
-
enumValues?: readonly string[];
|
|
18
|
-
length?: number;
|
|
19
|
-
name?: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Structural Drizzle table — only requires `[Symbol.for('drizzle:Columns')]`,
|
|
23
|
-
* which every Drizzle table exposes. Matches `drizzle-orm`'s `Table` at
|
|
24
|
-
* runtime without importing it at compile time.
|
|
25
|
-
*/
|
|
26
|
-
type DrizzleTableLike = Record<symbol, Record<string, DrizzleColumnLike>> & {
|
|
27
|
-
[key: string]: unknown;
|
|
28
|
-
};
|
|
29
|
-
interface DrizzleAdapterOptions<TDoc = unknown> {
|
|
30
|
-
/** Drizzle table — used for schema introspection. */
|
|
31
|
-
table: DrizzleTableLike;
|
|
32
|
-
/** Repository implementing the repo-core contract. */
|
|
33
|
-
repository: RepositoryLike<TDoc>;
|
|
34
|
-
/**
|
|
35
|
-
* External schema generator. When provided, replaces the built-in
|
|
36
|
-
* type-only conversion. Wire it to your kit's `buildCrudSchemasFromTable`
|
|
37
|
-
* (sqlitekit, pgkit, ...) to get the full CRUD schemas — strict
|
|
38
|
-
* additional-property control, field-rule application, param-type
|
|
39
|
-
* narrowing from primary-key columns, etc.
|
|
40
|
-
*/
|
|
41
|
-
schemaGenerator?: (table: DrizzleTableLike, options?: RouteSchemaOptions, context?: AdapterSchemaContext) => OpenApiSchemas | Record<string, unknown>;
|
|
42
|
-
/** Optional name — defaults to "DrizzleAdapter". */
|
|
43
|
-
name?: string;
|
|
44
|
-
}
|
|
45
|
-
declare class DrizzleAdapter<TDoc = unknown> implements DataAdapter<TDoc> {
|
|
46
|
-
readonly type: "drizzle";
|
|
47
|
-
readonly name: string;
|
|
48
|
-
readonly table: DrizzleTableLike;
|
|
49
|
-
readonly repository: RepositoryLike<TDoc>;
|
|
50
|
-
private readonly schemaGenerator?;
|
|
51
|
-
constructor(options: DrizzleAdapterOptions<TDoc>);
|
|
52
|
-
/**
|
|
53
|
-
* Introspect Drizzle columns into arc's schema metadata shape.
|
|
54
|
-
*/
|
|
55
|
-
getSchemaMetadata(): SchemaMetadata;
|
|
56
|
-
/**
|
|
57
|
-
* Generate OpenAPI schemas. Delegates to the user-provided
|
|
58
|
-
* `schemaGenerator` when available (strongly recommended — that's where
|
|
59
|
-
* field rules, omit lists, and param-type narrowing live). The built-in
|
|
60
|
-
* fallback emits a permissive entity + CRUD body shape so routes still
|
|
61
|
-
* register when no generator is provided.
|
|
62
|
-
*
|
|
63
|
-
* After the kit generator runs, arc merges constraint-style field rules
|
|
64
|
-
* (`minLength`, `maxLength`, `min`, `max`, `pattern`, `enum`, `description`)
|
|
65
|
-
* into the resulting property schemas so sqlitekit / pgkit behave
|
|
66
|
-
* identically to mongoose here — rule-driven AJV constraints apply
|
|
67
|
-
* regardless of backend.
|
|
68
|
-
*/
|
|
69
|
-
generateSchemas(schemaOptions?: RouteSchemaOptions, context?: AdapterSchemaContext): OpenApiSchemas | Record<string, unknown> | null;
|
|
70
|
-
healthCheck(): Promise<boolean>;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Factory — preferred construction style for symmetry with
|
|
74
|
-
* `createMongooseAdapter` / `createPrismaAdapter`.
|
|
75
|
-
*/
|
|
76
|
-
declare function createDrizzleAdapter<TDoc = unknown>(options: DrizzleAdapterOptions<TDoc>): DrizzleAdapter<TDoc>;
|
|
77
|
-
//#endregion
|
|
78
|
-
//#region src/adapters/mongoose.d.ts
|
|
79
|
-
/**
|
|
80
|
-
* Options for creating a Mongoose adapter.
|
|
81
|
-
* TDoc is auto-inferred from the Mongoose model — no explicit type needed.
|
|
82
|
-
*
|
|
83
|
-
* @typeParam TDoc - Inferred from `model: Model<TDoc>`
|
|
84
|
-
*/
|
|
85
|
-
interface MongooseAdapterOptions<TDoc = unknown> {
|
|
86
|
-
/** Mongoose model instance — preserves document type for type safety */
|
|
87
|
-
model: Model<TDoc>;
|
|
88
|
-
/**
|
|
89
|
-
* Repository implementing CRUD operations.
|
|
90
|
-
*
|
|
91
|
-
* Typed as `AdapterRepositoryInput<TDoc>` (permissive structural shape)
|
|
92
|
-
* so kit-native repositories like mongokit's `Repository<TDoc>` plug in
|
|
93
|
-
* directly. See `AdapterRepositoryInput` JSDoc for why the wider input
|
|
94
|
-
* exists at the boundary while arc internals keep the strict
|
|
95
|
-
* `RepositoryLike` view.
|
|
96
|
-
*/
|
|
97
|
-
repository: AdapterRepositoryInput<TDoc>;
|
|
98
|
-
/**
|
|
99
|
-
* External schema generator plugin for OpenAPI docs.
|
|
100
|
-
* When provided, replaces the built-in basic type conversion.
|
|
101
|
-
* Receives the Mongoose model and schema options, must return OpenApiSchemas.
|
|
102
|
-
*
|
|
103
|
-
* **Model type is intentionally `Model<unknown>`, not `Model<TDoc>`**:
|
|
104
|
-
* schema generators introspect `.schema.paths` — they read metadata, not
|
|
105
|
-
* document types. Typing as `Model<TDoc>` forced every mongokit host to
|
|
106
|
-
* cast `m as unknown as Model<unknown>` when handing the model to
|
|
107
|
-
* `buildCrudSchemasFromModel` (which is typed `Model<unknown>`), because
|
|
108
|
-
* `Model<T>` is invariant in T. Widening here at the callback boundary
|
|
109
|
-
* trades one documented internal cast for zero host-side casts.
|
|
110
|
-
*
|
|
111
|
-
* @example MongoKit integration — direct pass-through, no casts
|
|
112
|
-
* ```typescript
|
|
113
|
-
* import { buildCrudSchemasFromModel } from '@classytic/mongokit';
|
|
114
|
-
*
|
|
115
|
-
* createMongooseAdapter({
|
|
116
|
-
* model: JobModel,
|
|
117
|
-
* repository: jobRepository,
|
|
118
|
-
* schemaGenerator: buildCrudSchemasFromModel,
|
|
119
|
-
* });
|
|
120
|
-
* ```
|
|
121
|
-
*/
|
|
122
|
-
schemaGenerator?: (model: Model<unknown>, options?: RouteSchemaOptions, context?: AdapterSchemaContext) => OpenApiSchemas | Record<string, unknown>;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Mongoose data adapter with proper type safety
|
|
126
|
-
*
|
|
127
|
-
* @typeParam TDoc - The document type
|
|
128
|
-
*/
|
|
129
|
-
declare class MongooseAdapter<TDoc = unknown> implements DataAdapter<TDoc> {
|
|
130
|
-
readonly type: "mongoose";
|
|
131
|
-
readonly name: string;
|
|
132
|
-
readonly model: Model<TDoc>;
|
|
133
|
-
readonly repository: RepositoryLike<TDoc>;
|
|
134
|
-
private readonly schemaGenerator?;
|
|
135
|
-
constructor(options: MongooseAdapterOptions<TDoc>);
|
|
136
|
-
/**
|
|
137
|
-
* Get schema metadata from Mongoose model
|
|
138
|
-
*/
|
|
139
|
-
getSchemaMetadata(): SchemaMetadata;
|
|
140
|
-
/**
|
|
141
|
-
* Generate OpenAPI schemas from Mongoose model.
|
|
142
|
-
*
|
|
143
|
-
* If a `schemaGenerator` plugin was provided (e.g. MongoKit's buildCrudSchemasFromModel),
|
|
144
|
-
* it is used instead of the built-in basic conversion.
|
|
145
|
-
*/
|
|
146
|
-
generateSchemas(schemaOptions?: RouteSchemaOptions, context?: AdapterSchemaContext): OpenApiSchemas | Record<string, unknown> | null;
|
|
147
|
-
/**
|
|
148
|
-
* Extract relation metadata
|
|
149
|
-
*/
|
|
150
|
-
private extractRelations;
|
|
151
|
-
/**
|
|
152
|
-
* Convert Mongoose type to OpenAPI type
|
|
153
|
-
*/
|
|
154
|
-
private mongooseTypeToOpenApi;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Create Mongoose adapter with flexible type acceptance.
|
|
158
|
-
* Accepts any repository with CRUD methods — no `as any` needed.
|
|
159
|
-
*
|
|
160
|
-
* **Type parameter (v2.11):** `TDoc` is UNCONSTRAINED. An earlier v2.11
|
|
161
|
-
* revision added `TDoc extends AnyRecord` to surface errors at the
|
|
162
|
-
* adapter call site, but Mongoose's own document types
|
|
163
|
-
* (`HydratedDocument<T>`, `T & Document`) don't carry an index signature
|
|
164
|
-
* — so the constraint fired on the exact Mongoose idioms this factory
|
|
165
|
-
* is designed to accept. Hosts were casting with
|
|
166
|
-
* `as RepositoryLike<Record<string, unknown>>` at every call just to
|
|
167
|
-
* silence it. The constraint now lives exclusively on `BaseController`
|
|
168
|
-
* where it's load-bearing for mixin composition; `defineResource`
|
|
169
|
-
* widens once internally so every other layer stays permissive.
|
|
170
|
-
*
|
|
171
|
-
* @example
|
|
172
|
-
* ```typescript
|
|
173
|
-
* // Object form (explicit)
|
|
174
|
-
* const adapter = createMongooseAdapter({
|
|
175
|
-
* model: ProductModel,
|
|
176
|
-
* repository: productRepository,
|
|
177
|
-
* });
|
|
178
|
-
*
|
|
179
|
-
* // Shorthand form (2-arg) — most common path
|
|
180
|
-
* const adapter = createMongooseAdapter(ProductModel, productRepository);
|
|
181
|
-
* ```
|
|
182
|
-
*/
|
|
183
|
-
declare function createMongooseAdapter<TDoc = unknown>(model: Model<TDoc>, repository: AdapterRepositoryInput<TDoc>): DataAdapter<TDoc>;
|
|
184
|
-
declare function createMongooseAdapter<TDoc = unknown>(options: MongooseAdapterOptions<TDoc>): DataAdapter<TDoc>;
|
|
185
|
-
//#endregion
|
|
186
|
-
//#region src/adapters/prisma.d.ts
|
|
187
|
-
/** Prisma DMMF field shape */
|
|
188
|
-
interface DmmfField {
|
|
189
|
-
name: string;
|
|
190
|
-
type: string;
|
|
191
|
-
kind: string;
|
|
192
|
-
isList: boolean;
|
|
193
|
-
isRequired: boolean;
|
|
194
|
-
isUnique?: boolean;
|
|
195
|
-
isId?: boolean;
|
|
196
|
-
isGenerated?: boolean;
|
|
197
|
-
hasDefaultValue?: boolean;
|
|
198
|
-
default?: unknown;
|
|
199
|
-
documentation?: string;
|
|
200
|
-
relationName?: string;
|
|
201
|
-
}
|
|
202
|
-
/** Prisma DMMF enum value */
|
|
203
|
-
interface DmmfEnumValue {
|
|
204
|
-
name: string;
|
|
205
|
-
}
|
|
206
|
-
/** Prisma DMMF enum */
|
|
207
|
-
interface DmmfEnum {
|
|
208
|
-
name: string;
|
|
209
|
-
values: DmmfEnumValue[];
|
|
210
|
-
}
|
|
211
|
-
/** Prisma DMMF model shape */
|
|
212
|
-
interface DmmfModel {
|
|
213
|
-
name: string;
|
|
214
|
-
fields: DmmfField[];
|
|
215
|
-
uniqueIndexes?: Array<{
|
|
216
|
-
fields: string[];
|
|
217
|
-
}>;
|
|
218
|
-
}
|
|
219
|
-
/** Prisma DMMF datamodel */
|
|
220
|
-
interface DmmfDatamodel {
|
|
221
|
-
models: DmmfModel[];
|
|
222
|
-
enums?: DmmfEnum[];
|
|
223
|
-
}
|
|
224
|
-
/** Prisma DMMF root shape */
|
|
225
|
-
interface PrismaDmmf {
|
|
226
|
-
datamodel?: DmmfDatamodel;
|
|
227
|
-
}
|
|
228
|
-
/** Prisma client shape */
|
|
229
|
-
interface PrismaClientLike {
|
|
230
|
-
$disconnect(): Promise<void>;
|
|
231
|
-
[key: string]: unknown;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Options for PrismaQueryParser
|
|
235
|
-
*/
|
|
236
|
-
interface PrismaQueryParserOptions {
|
|
237
|
-
/** Maximum allowed limit value (default: 1000) */
|
|
238
|
-
maxLimit?: number;
|
|
239
|
-
/** Default limit for pagination (default: 20) */
|
|
240
|
-
defaultLimit?: number;
|
|
241
|
-
/** Enable soft delete filtering by default (default: true) */
|
|
242
|
-
softDeleteEnabled?: boolean;
|
|
243
|
-
/** Field name for soft delete (default: 'deletedAt') */
|
|
244
|
-
softDeleteField?: string;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Prisma Query Parser - Converts URL parameters to Prisma query format
|
|
248
|
-
*
|
|
249
|
-
* Translates Arc's query format to Prisma's where/orderBy/take/skip structure.
|
|
250
|
-
*
|
|
251
|
-
* @example
|
|
252
|
-
* ```typescript
|
|
253
|
-
* const parser = new PrismaQueryParser();
|
|
254
|
-
*
|
|
255
|
-
* // URL: ?status=active&price[gte]=100&sort=-createdAt&page=2&limit=10
|
|
256
|
-
* const prismaQuery = parser.toPrismaQuery(parsedQuery);
|
|
257
|
-
* // Returns:
|
|
258
|
-
* // {
|
|
259
|
-
* // where: { status: 'active', price: { gte: 100 }, deletedAt: null },
|
|
260
|
-
* // orderBy: { createdAt: 'desc' },
|
|
261
|
-
* // take: 10,
|
|
262
|
-
* // skip: 10,
|
|
263
|
-
* // }
|
|
264
|
-
* ```
|
|
265
|
-
*/
|
|
266
|
-
declare class PrismaQueryParser implements QueryParserInterface {
|
|
267
|
-
private readonly maxLimit;
|
|
268
|
-
private readonly defaultLimit;
|
|
269
|
-
private readonly softDeleteEnabled;
|
|
270
|
-
private readonly softDeleteField;
|
|
271
|
-
/** Map Arc operators to Prisma operators */
|
|
272
|
-
private readonly operatorMap;
|
|
273
|
-
constructor(options?: PrismaQueryParserOptions);
|
|
274
|
-
/**
|
|
275
|
-
* Parse URL query parameters (delegates to ArcQueryParser format)
|
|
276
|
-
*/
|
|
277
|
-
parse(query: Record<string, unknown> | null | undefined): ParsedQuery;
|
|
278
|
-
/**
|
|
279
|
-
* Convert ParsedQuery to Prisma query options
|
|
280
|
-
*/
|
|
281
|
-
toPrismaQuery(parsed: ParsedQuery, policyFilters?: Record<string, unknown>): PrismaQueryOptions;
|
|
282
|
-
/**
|
|
283
|
-
* Translate Arc/MongoDB-style filters to Prisma where clause
|
|
284
|
-
*/
|
|
285
|
-
private translateFilters;
|
|
286
|
-
private parseNumber;
|
|
287
|
-
private parseSort;
|
|
288
|
-
private parseSelect;
|
|
289
|
-
private parseFilters;
|
|
290
|
-
private coerceValue;
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Prisma query options returned by toPrismaQuery
|
|
294
|
-
*/
|
|
295
|
-
interface PrismaQueryOptions {
|
|
296
|
-
where?: Record<string, unknown>;
|
|
297
|
-
orderBy?: Array<Record<string, "asc" | "desc">>;
|
|
298
|
-
take?: number;
|
|
299
|
-
skip?: number;
|
|
300
|
-
select?: Record<string, boolean>;
|
|
301
|
-
include?: Record<string, boolean>;
|
|
302
|
-
}
|
|
303
|
-
interface PrismaAdapterOptions<TModel> {
|
|
304
|
-
/** Prisma client instance */
|
|
305
|
-
client: PrismaClientLike;
|
|
306
|
-
/** Model name (e.g., 'user', 'product') */
|
|
307
|
-
modelName: string;
|
|
308
|
-
/** Repository instance implementing CRUD operations */
|
|
309
|
-
repository: StandardRepo<TModel>;
|
|
310
|
-
/** Optional: Prisma DMMF (Data Model Meta Format) for schema extraction */
|
|
311
|
-
dmmf?: PrismaDmmf;
|
|
312
|
-
/** Optional: Custom query parser (default: PrismaQueryParser) */
|
|
313
|
-
queryParser?: PrismaQueryParser;
|
|
314
|
-
/** Enable soft delete filtering (default: true) */
|
|
315
|
-
softDeleteEnabled?: boolean;
|
|
316
|
-
/** Field name for soft delete (default: 'deletedAt') */
|
|
317
|
-
softDeleteField?: string;
|
|
318
|
-
}
|
|
319
|
-
declare class PrismaAdapter<TModel = unknown> implements DataAdapter<TModel> {
|
|
320
|
-
readonly type: "prisma";
|
|
321
|
-
readonly name: string;
|
|
322
|
-
readonly repository: StandardRepo<TModel>;
|
|
323
|
-
readonly queryParser: PrismaQueryParser;
|
|
324
|
-
private client;
|
|
325
|
-
private modelName;
|
|
326
|
-
private dmmf?;
|
|
327
|
-
private softDeleteEnabled;
|
|
328
|
-
private softDeleteField;
|
|
329
|
-
constructor(options: PrismaAdapterOptions<TModel>);
|
|
330
|
-
/**
|
|
331
|
-
* Parse URL query parameters and convert to Prisma query options
|
|
332
|
-
*/
|
|
333
|
-
parseQuery(query: Record<string, unknown>, policyFilters?: Record<string, unknown>): PrismaQueryOptions;
|
|
334
|
-
/**
|
|
335
|
-
* Apply policy filters to existing Prisma where clause
|
|
336
|
-
* Used for multi-tenant, ownership, and other security filters
|
|
337
|
-
*/
|
|
338
|
-
applyPolicyFilters(where: Record<string, unknown>, policyFilters: Record<string, unknown>): Record<string, unknown>;
|
|
339
|
-
generateSchemas(options?: RouteSchemaOptions): OpenApiSchemas | null;
|
|
340
|
-
getSchemaMetadata(): SchemaMetadata | null;
|
|
341
|
-
validate(data: unknown): Promise<ValidationResult>;
|
|
342
|
-
healthCheck(): Promise<boolean>;
|
|
343
|
-
close(): Promise<void>;
|
|
344
|
-
private buildEntitySchema;
|
|
345
|
-
private buildCreateSchema;
|
|
346
|
-
private buildUpdateSchema;
|
|
347
|
-
private shouldSkipField;
|
|
348
|
-
private convertPrismaFieldToJsonSchema;
|
|
349
|
-
private convertPrismaFieldToMetadata;
|
|
350
|
-
private mapPrismaTypeToMetadataType;
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* Factory function to create Prisma adapter
|
|
354
|
-
*
|
|
355
|
-
* @example
|
|
356
|
-
* import { PrismaClient } from '@prisma/client';
|
|
357
|
-
* import { createPrismaAdapter } from '@classytic/arc';
|
|
358
|
-
*
|
|
359
|
-
* const prisma = new PrismaClient();
|
|
360
|
-
*
|
|
361
|
-
* const userAdapter = createPrismaAdapter({
|
|
362
|
-
* client: prisma,
|
|
363
|
-
* modelName: 'user',
|
|
364
|
-
* repository: userRepository,
|
|
365
|
-
* dmmf: Prisma.dmmf, // Optional: for schema generation
|
|
366
|
-
* });
|
|
367
|
-
*/
|
|
368
|
-
declare function createPrismaAdapter<TModel>(options: PrismaAdapterOptions<TModel>): PrismaAdapter<TModel>;
|
|
369
|
-
//#endregion
|
|
370
|
-
export { PrismaQueryParserOptions as a, MongooseAdapterOptions as c, DrizzleAdapterOptions as d, createDrizzleAdapter as f, PrismaQueryParser as i, createMongooseAdapter as l, PrismaAdapterOptions as n, createPrismaAdapter as o, PrismaQueryOptions as r, MongooseAdapter as s, PrismaAdapter as t, DrizzleAdapter as u };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|