arkormx 1.3.4 → 2.0.0-next.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/index.d.cts CHANGED
@@ -1,19 +1,275 @@
1
+ import { Kysely, Transaction } from "kysely";
1
2
  import { PrismaClient } from "@prisma/client";
2
3
  import { Collection } from "@h3ravel/collect.js";
3
4
  import { Command } from "@h3ravel/musket";
4
5
 
5
- //#region src/Attribute.d.ts
6
- interface AttributeOptions<TGet = unknown, TSet = unknown> {
7
- get?: (value: unknown) => TGet;
8
- set?: (value: TSet) => unknown;
6
+ //#region src/types/core.d.ts
7
+ type CastType = 'string' | 'number' | 'boolean' | 'date' | 'json' | 'array';
8
+ interface CastHandler<T = unknown> {
9
+ get: (value: unknown) => T;
10
+ set: (value: unknown) => unknown;
9
11
  }
10
- declare class Attribute<TGet = unknown, TSet = unknown> {
11
- readonly get?: (value: unknown) => TGet;
12
- readonly set?: (value: TSet) => unknown;
13
- constructor(options?: AttributeOptions<TGet, TSet>);
14
- static make<TGet = unknown, TSet = unknown>(options: AttributeOptions<TGet, TSet>): Attribute<TGet, TSet>;
15
- static isAttribute(value: unknown): value is Attribute;
12
+ type CastDefinition = CastType | CastHandler;
13
+ type CastMap = Record<string, CastDefinition>;
14
+ type PrismaClientLike = PrismaClient | Record<string, unknown>;
15
+ interface PrismaTransactionOptions {
16
+ maxWait?: number;
17
+ timeout?: number;
18
+ isolationLevel?: string;
19
+ }
20
+ type PrismaTransactionCallback<TResult = unknown> = (client: PrismaClientLike) => TResult | Promise<TResult>;
21
+ interface PrismaTransactionCapableClient {
22
+ $transaction: <TResult>(callback: PrismaTransactionCallback<TResult>, options?: PrismaTransactionOptions) => Promise<TResult>;
23
+ }
24
+ type ClientResolver = PrismaClientLike | (() => PrismaClientLike);
25
+ interface ArkormConfig {
26
+ /**
27
+ * @property prisma A Prisma client instance or a function that returns a Prisma client instance.
28
+ */
29
+ prisma: ClientResolver;
30
+ /**
31
+ * @property pagination Configuration options related to pagination behavior and URL generation.
32
+ */
33
+ pagination?: {
34
+ urlDriver?: PaginationURLDriverFactory;
35
+ resolveCurrentPage?: PaginationCurrentPageResolver;
36
+ };
37
+ /**
38
+ * @property paths Optional custom paths for various generated files.
39
+ */
40
+ paths?: {
41
+ /**
42
+ * @property stubs Optional custom path for stub files used in code generation.
43
+ */
44
+ stubs?: string;
45
+ /**
46
+ * @property seeders Optional custom path for seeder files.
47
+ */
48
+ seeders?: string;
49
+ /**
50
+ * @property models Optional custom path for model files.
51
+ */
52
+ models?: string;
53
+ /**
54
+ * @property migrations Optional custom path for migration files.
55
+ */
56
+ migrations?: string;
57
+ /**
58
+ * @property factories Optional custom path for factory files.
59
+ */
60
+ factories?: string;
61
+ /**
62
+ * @property buildOutput Optional custom path for the development output directory.
63
+ */
64
+ buildOutput?: string;
65
+ };
66
+ /**
67
+ * @property outputExt Optional file extension for generated files, either 'ts' or 'js'.
68
+ */
69
+ outputExt?: 'ts' | 'js';
70
+ }
71
+ interface GetUserConfig {
72
+ /**
73
+ * Get the user-provided ArkORM configuration.
74
+ */
75
+ (): Partial<ArkormConfig>;
76
+ /**
77
+ * Get a specific user configuration value
78
+ * @param key Optional specific configuration key to retrieve
79
+ */
80
+ <K extends keyof ArkormConfig>(key: K): Partial<ArkormConfig>[K];
81
+ }
82
+ interface PaginationMeta {
83
+ total: number;
84
+ perPage: number;
85
+ currentPage: number;
86
+ lastPage: number;
87
+ from: number | null;
88
+ to: number | null;
89
+ }
90
+ interface SimplePaginationMeta {
91
+ perPage: number;
92
+ currentPage: number;
93
+ from: number | null;
94
+ to: number | null;
95
+ hasMorePages: boolean;
16
96
  }
97
+ interface PaginationOptions {
98
+ path?: string;
99
+ query?: Record<string, string | number | boolean | null | undefined>;
100
+ fragment?: string;
101
+ pageName?: string;
102
+ }
103
+ type PaginationCurrentPageResolver = (pageName: string, options: PaginationOptions) => number | undefined;
104
+ interface PaginationURLDriver {
105
+ getPageName: () => string;
106
+ url: (page: number) => string;
107
+ }
108
+ type PaginationURLDriverFactory = (options: PaginationOptions) => PaginationURLDriver;
109
+ interface PrismaFindManyArgsLike {
110
+ where?: unknown;
111
+ include?: unknown;
112
+ orderBy?: unknown;
113
+ select?: unknown;
114
+ skip?: number;
115
+ take?: number;
116
+ }
117
+ type PrismaLikeSortOrder = 'asc' | 'desc';
118
+ interface PrismaLikeScalarFilter {
119
+ equals?: unknown;
120
+ not?: unknown | PrismaLikeScalarFilter;
121
+ in?: unknown[];
122
+ notIn?: unknown[];
123
+ lt?: unknown;
124
+ lte?: unknown;
125
+ gt?: unknown;
126
+ gte?: unknown;
127
+ contains?: string;
128
+ startsWith?: string;
129
+ endsWith?: string;
130
+ }
131
+ interface PrismaLikeWhereInput {
132
+ AND?: PrismaLikeWhereInput[];
133
+ OR?: PrismaLikeWhereInput[];
134
+ NOT?: PrismaLikeWhereInput | PrismaLikeWhereInput[];
135
+ [key: string]: unknown;
136
+ }
137
+ type PrismaLikeOrderBy = Record<string, PrismaLikeSortOrder> | Record<string, PrismaLikeSortOrder>[];
138
+ interface PrismaLikeSelect {
139
+ [key: string]: boolean | {
140
+ select?: PrismaLikeSelect;
141
+ include?: PrismaLikeInclude;
142
+ };
143
+ }
144
+ interface PrismaLikeInclude {
145
+ [key: string]: boolean | {
146
+ where?: PrismaLikeWhereInput;
147
+ orderBy?: PrismaLikeOrderBy;
148
+ select?: PrismaLikeSelect;
149
+ include?: PrismaLikeInclude;
150
+ skip?: number;
151
+ take?: number;
152
+ };
153
+ }
154
+ type EagerLoadConstraint = (query: unknown) => unknown;
155
+ type EagerLoadMap = Record<string, EagerLoadConstraint | undefined>;
156
+ interface SoftDeleteConfig {
157
+ enabled: boolean;
158
+ column: string;
159
+ }
160
+ interface PrismaDelegateLike {
161
+ findMany: (args?: any) => Promise<unknown[]>;
162
+ findFirst: (args?: any) => Promise<unknown | null>;
163
+ create: (args: any) => Promise<unknown>;
164
+ update: (args: any) => Promise<unknown>;
165
+ delete: (args: any) => Promise<unknown>;
166
+ count: (args?: any) => Promise<number>;
167
+ }
168
+ type FallbackIfUnknownOrNever<TValue, TFallback> = [TValue] extends [never] ? TFallback : unknown extends TValue ? TFallback : TValue;
169
+ type DelegateFindManyArgs<TDelegate extends PrismaDelegateLike> = FallbackIfUnknownOrNever<NonNullable<Parameters<TDelegate['findMany']>[0]>, PrismaFindManyArgsLike>;
170
+ type DelegateWhere<TDelegate extends PrismaDelegateLike> = DelegateFindManyArgs<TDelegate> extends {
171
+ where?: infer TWhere;
172
+ } ? FallbackIfUnknownOrNever<TWhere, PrismaLikeWhereInput> : PrismaLikeWhereInput;
173
+ type DelegateInclude<TDelegate extends PrismaDelegateLike> = DelegateFindManyArgs<TDelegate> extends {
174
+ include?: infer TInclude;
175
+ } ? FallbackIfUnknownOrNever<TInclude, PrismaLikeInclude> : PrismaLikeInclude;
176
+ type DelegateOrderBy<TDelegate extends PrismaDelegateLike> = DelegateFindManyArgs<TDelegate> extends {
177
+ orderBy?: infer TOrderBy;
178
+ } ? FallbackIfUnknownOrNever<TOrderBy, PrismaLikeOrderBy> : PrismaLikeOrderBy;
179
+ type DelegateSelect<TDelegate extends PrismaDelegateLike> = DelegateFindManyArgs<TDelegate> extends {
180
+ select?: infer TSelect;
181
+ } ? FallbackIfUnknownOrNever<TSelect, PrismaLikeSelect> : PrismaLikeSelect;
182
+ type DelegateCreateData<TDelegate extends PrismaDelegateLike> = Parameters<TDelegate['create']>[0] extends {
183
+ data: infer TData;
184
+ } ? TData : Record<string, unknown>;
185
+ type DelegateUpdateArgs<TDelegate extends PrismaDelegateLike> = Parameters<TDelegate['update']>[0];
186
+ type DelegateUpdateData<TDelegate extends PrismaDelegateLike> = DelegateUpdateArgs<TDelegate> extends {
187
+ data: infer TData;
188
+ } ? FallbackIfUnknownOrNever<TData, Record<string, unknown>> : Record<string, unknown>;
189
+ type DelegateUniqueWhere<TDelegate extends PrismaDelegateLike> = DelegateUpdateArgs<TDelegate> extends {
190
+ where: infer TWhere;
191
+ } ? FallbackIfUnknownOrNever<TWhere, Record<string, unknown>> : Record<string, unknown>;
192
+ type DelegateRow<TDelegate extends PrismaDelegateLike> = Exclude<Awaited<ReturnType<TDelegate['findFirst']>>, null>;
193
+ type DelegateRows<TDelegate extends PrismaDelegateLike> = Awaited<ReturnType<TDelegate['findMany']>>;
194
+ type Serializable = Record<string, unknown>;
195
+ //#endregion
196
+ //#region src/types/metadata.d.ts
197
+ type ColumnMap = Record<string, string>;
198
+ interface ModelMetadata {
199
+ table: string;
200
+ primaryKey: string;
201
+ columns: ColumnMap;
202
+ softDelete: SoftDeleteConfig;
203
+ }
204
+ type RelationMetadataType = 'hasOne' | 'hasMany' | 'belongsTo' | 'belongsToMany' | 'hasOneThrough' | 'hasManyThrough' | 'morphOne' | 'morphMany' | 'morphToMany';
205
+ interface BaseRelationMetadata {
206
+ type: RelationMetadataType;
207
+ relatedModel: RelationshipModelStatic;
208
+ }
209
+ interface HasOneRelationMetadata extends BaseRelationMetadata {
210
+ type: 'hasOne';
211
+ foreignKey: string;
212
+ localKey: string;
213
+ }
214
+ interface HasManyRelationMetadata extends BaseRelationMetadata {
215
+ type: 'hasMany';
216
+ foreignKey: string;
217
+ localKey: string;
218
+ }
219
+ interface BelongsToRelationMetadata extends BaseRelationMetadata {
220
+ type: 'belongsTo';
221
+ foreignKey: string;
222
+ ownerKey: string;
223
+ }
224
+ interface BelongsToManyRelationMetadata extends BaseRelationMetadata {
225
+ type: 'belongsToMany';
226
+ throughTable: string;
227
+ foreignPivotKey: string;
228
+ relatedPivotKey: string;
229
+ parentKey: string;
230
+ relatedKey: string;
231
+ }
232
+ interface HasOneThroughRelationMetadata extends BaseRelationMetadata {
233
+ type: 'hasOneThrough';
234
+ throughTable: string;
235
+ firstKey: string;
236
+ secondKey: string;
237
+ localKey: string;
238
+ secondLocalKey: string;
239
+ }
240
+ interface HasManyThroughRelationMetadata extends BaseRelationMetadata {
241
+ type: 'hasManyThrough';
242
+ throughTable: string;
243
+ firstKey: string;
244
+ secondKey: string;
245
+ localKey: string;
246
+ secondLocalKey: string;
247
+ }
248
+ interface MorphOneRelationMetadata extends BaseRelationMetadata {
249
+ type: 'morphOne';
250
+ morphName: string;
251
+ morphIdColumn: string;
252
+ morphTypeColumn: string;
253
+ localKey: string;
254
+ }
255
+ interface MorphManyRelationMetadata extends BaseRelationMetadata {
256
+ type: 'morphMany';
257
+ morphName: string;
258
+ morphIdColumn: string;
259
+ morphTypeColumn: string;
260
+ localKey: string;
261
+ }
262
+ interface MorphToManyRelationMetadata extends BaseRelationMetadata {
263
+ type: 'morphToMany';
264
+ throughTable: string;
265
+ morphName: string;
266
+ morphIdColumn: string;
267
+ morphTypeColumn: string;
268
+ relatedPivotKey: string;
269
+ parentKey: string;
270
+ relatedKey: string;
271
+ }
272
+ type RelationMetadata = HasOneRelationMetadata | HasManyRelationMetadata | BelongsToRelationMetadata | BelongsToManyRelationMetadata | HasOneThroughRelationMetadata | HasManyThroughRelationMetadata | MorphOneRelationMetadata | MorphManyRelationMetadata | MorphToManyRelationMetadata;
17
273
  //#endregion
18
274
  //#region src/types/factories.d.ts
19
275
  type FactoryAttributes = Record<string, unknown>;
@@ -95,6 +351,10 @@ interface PrismaMigrationWorkflowOptions extends PrismaSchemaSyncOptions {
95
351
  migrateMode?: 'dev' | 'deploy';
96
352
  migrationName?: string;
97
353
  }
354
+ type MigrationInstanceLike = {
355
+ up: (...args: any[]) => Promise<void> | void;
356
+ down: (...args: any[]) => Promise<void> | void;
357
+ };
98
358
  interface AppliedMigrationEntry {
99
359
  id: string;
100
360
  file: string;
@@ -112,6 +372,7 @@ interface AppliedMigrationsState {
112
372
  migrations: AppliedMigrationEntry[];
113
373
  runs?: AppliedMigrationRun[];
114
374
  }
375
+ type MigrationClass = new () => MigrationInstanceLike;
115
376
  //#endregion
116
377
  //#region src/Collection.d.ts
117
378
  declare class ArkormCollection<T = any, X = T[]> extends Collection<T, X> {}
@@ -119,6 +380,32 @@ declare class ArkormCollection<T = any, X = T[]> extends Collection<T, X> {}
119
380
  //#region src/types/relationship.d.ts
120
381
  type RelationConstraint<TModel> = (query: QueryBuilder<TModel>) => QueryBuilder<TModel> | void;
121
382
  type RelationDefaultValue<TParent, TRelated> = Partial<ModelAttributes<TRelated>> | TRelated | ((parent: TParent) => Partial<ModelAttributes<TRelated>> | TRelated);
383
+ type RelationDefaultResolver<TParent, TRelated> = (parent: TParent) => Partial<ModelAttributes<TRelated>> | TRelated;
384
+ interface RelationTableLookupSpec {
385
+ table: string;
386
+ where?: QueryCondition;
387
+ columns?: QuerySelectColumn[];
388
+ orderBy?: QueryOrderBy[];
389
+ limit?: number;
390
+ offset?: number;
391
+ }
392
+ interface RelationColumnLookupSpec {
393
+ lookup: RelationTableLookupSpec;
394
+ column: string;
395
+ }
396
+ interface RelationMetadataProvider {
397
+ getMetadata: () => RelationMetadata;
398
+ }
399
+ //#endregion
400
+ //#region src/relationship/RelationTableLoader.d.ts
401
+ declare class RelationTableLoader {
402
+ private readonly adapter;
403
+ constructor(adapter: DatabaseAdapter);
404
+ selectRows(spec: RelationTableLookupSpec): Promise<DatabaseRow[]>;
405
+ selectRow(spec: RelationTableLookupSpec): Promise<DatabaseRow | null>;
406
+ selectColumnValues(spec: RelationColumnLookupSpec): Promise<unknown[]>;
407
+ selectColumnValue(spec: RelationColumnLookupSpec): Promise<unknown | null>;
408
+ }
122
409
  //#endregion
123
410
  //#region src/relationship/Relation.d.ts
124
411
  /**
@@ -129,6 +416,12 @@ type RelationDefaultValue<TParent, TRelated> = Partial<ModelAttributes<TRelated>
129
416
  */
130
417
  declare abstract class Relation<TModel> {
131
418
  protected constraint: RelationConstraint<TModel> | null;
419
+ protected getRelationAdapter(): DatabaseAdapter;
420
+ protected getRelatedModel(): {
421
+ getAdapter: () => DatabaseAdapter | undefined;
422
+ query: () => QueryBuilder<TModel>;
423
+ };
424
+ protected createRelationTableLoader(): RelationTableLoader;
132
425
  /**
133
426
  * Apply a constraint to the relationship query.
134
427
  *
@@ -235,6 +528,7 @@ declare abstract class Relation<TModel> {
235
528
  * @returns The query builder instance with the constraint applied, if any.
236
529
  */
237
530
  protected applyConstraint(query: QueryBuilder<TModel>): QueryBuilder<TModel>;
531
+ abstract getMetadata(): RelationMetadata;
238
532
  /**
239
533
  * Build the underlying query for the relationship.
240
534
  *
@@ -303,6 +597,7 @@ declare class BelongsToManyRelation<TParent, TRelated> extends Relation<TRelated
303
597
  * @returns
304
598
  */
305
599
  getQuery(): Promise<QueryBuilder<TRelated>>;
600
+ getMetadata(): BelongsToManyRelationMetadata;
306
601
  /**
307
602
  * Fetches the related models for this relationship.
308
603
  *
@@ -354,6 +649,7 @@ declare class BelongsToRelation<TParent, TRelated> extends SingleResultRelation<
354
649
  * @returns
355
650
  */
356
651
  getQuery(): Promise<QueryBuilder<TRelated>>;
652
+ getMetadata(): BelongsToRelationMetadata;
357
653
  /**
358
654
  * Fetches the related models for this relationship.
359
655
  *
@@ -383,6 +679,7 @@ declare class HasManyRelation<TParent, TRelated> extends Relation<TRelated> {
383
679
  * @returns
384
680
  */
385
681
  getQuery(): Promise<QueryBuilder<TRelated>>;
682
+ getMetadata(): HasManyRelationMetadata;
386
683
  /**
387
684
  * Fetches the related models for this relationship.
388
685
  *
@@ -416,6 +713,7 @@ declare class HasManyThroughRelation<TParent, TRelated> extends Relation<TRelate
416
713
  * @returns
417
714
  */
418
715
  getQuery(): Promise<QueryBuilder<TRelated>>;
716
+ getMetadata(): HasManyThroughRelationMetadata;
419
717
  /**
420
718
  * Fetches the related models for this relationship.
421
719
  *
@@ -445,6 +743,7 @@ declare class HasOneRelation<TParent, TRelated> extends SingleResultRelation<TPa
445
743
  * @returns
446
744
  */
447
745
  getQuery(): Promise<QueryBuilder<TRelated>>;
746
+ getMetadata(): HasOneRelationMetadata;
448
747
  /**
449
748
  * Fetches the related models for this relationship.
450
749
  *
@@ -478,6 +777,7 @@ declare class HasOneThroughRelation<TParent, TRelated> extends SingleResultRelat
478
777
  * @returns
479
778
  */
480
779
  getQuery(): Promise<QueryBuilder<TRelated>>;
780
+ getMetadata(): HasOneThroughRelationMetadata;
481
781
  /**
482
782
  * Fetches the related models for this relationship.
483
783
  *
@@ -507,6 +807,7 @@ declare class MorphManyRelation<TParent, TRelated> extends Relation<TRelated> {
507
807
  * @returns
508
808
  */
509
809
  getQuery(): Promise<QueryBuilder<TRelated>>;
810
+ getMetadata(): MorphManyRelationMetadata;
510
811
  /**
511
812
  * Fetches the related models for this relationship.
512
813
  *
@@ -536,6 +837,7 @@ declare class MorphOneRelation<TParent, TRelated> extends SingleResultRelation<T
536
837
  * @returns
537
838
  */
538
839
  getQuery(): Promise<QueryBuilder<TRelated>>;
840
+ getMetadata(): MorphOneRelationMetadata;
539
841
  /**
540
842
  * Fetches the related models for this relationship.
541
843
  *
@@ -568,6 +870,7 @@ declare class MorphToManyRelation<TParent, TRelated> extends Relation<TRelated>
568
870
  * @returns
569
871
  */
570
872
  getQuery(): Promise<QueryBuilder<TRelated>>;
873
+ getMetadata(): MorphToManyRelationMetadata;
571
874
  /**
572
875
  * Fetches the related models for this relationship.
573
876
  *
@@ -685,8 +988,12 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
685
988
  private static readonly lifecycleStates;
686
989
  private static eventsSuppressed;
687
990
  protected static factoryClass?: new () => ModelFactory<any, any>;
991
+ protected static adapter?: DatabaseAdapter;
688
992
  protected static client: Record<string, unknown>;
689
993
  protected static delegate: string;
994
+ protected static table?: string;
995
+ protected static primaryKey: string;
996
+ protected static columns: Record<string, string>;
690
997
  protected static softDeletes: boolean;
691
998
  protected static deletedAtColumn: string;
692
999
  protected static globalScopes: Record<string, GlobalScope>;
@@ -707,6 +1014,13 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
707
1014
  * @param client
708
1015
  */
709
1016
  protected static setClient(client: Record<string, unknown>): void;
1017
+ static setAdapter(adapter?: DatabaseAdapter): void;
1018
+ static getTable(): string;
1019
+ static getPrimaryKey(): string;
1020
+ static getColumnMap(): Record<string, string>;
1021
+ static getColumnName(attribute: string): string;
1022
+ static getModelMetadata(): ModelMetadata;
1023
+ static getRelationMetadata(name: string): RelationMetadata | null;
710
1024
  static setFactory<TFactory extends ModelFactory<any, any>>(factoryClass: new () => TFactory): void;
711
1025
  static factory<TFactory extends ModelFactory<any, any>>(count?: number): TFactory;
712
1026
  /**
@@ -797,6 +1111,7 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
797
1111
  * @returns
798
1112
  */
799
1113
  static getDelegate<TDelegate extends PrismaDelegateLike = PrismaDelegateLike>(delegate?: string): TDelegate;
1114
+ static getAdapter(): DatabaseAdapter | undefined;
800
1115
  /**
801
1116
  * Get a new query builder instance for the model.
802
1117
  *
@@ -1273,6 +1588,11 @@ type ModelEventHandler<TModel extends Model = Model> = {
1273
1588
  };
1274
1589
  type ModelEventHandlerConstructor<TModel extends Model = Model> = new () => ModelEventHandler<TModel>;
1275
1590
  type ModelEventDispatcher<TModel extends Model = Model> = ModelEventHandler<TModel> | ModelEventHandlerConstructor<TModel>;
1591
+ type ModelLifecycleState = {
1592
+ booted: boolean;
1593
+ booting: boolean;
1594
+ globalScopesSuppressed: number;
1595
+ };
1276
1596
  //#endregion
1277
1597
  //#region src/Paginator.d.ts
1278
1598
  /**
@@ -1362,9 +1682,15 @@ declare class Paginator<T> {
1362
1682
  * @since 0.1.0
1363
1683
  */
1364
1684
  declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = PrismaDelegateLike> {
1365
- private readonly delegate;
1366
1685
  private readonly model;
1367
- private readonly args;
1686
+ private readonly adapter?;
1687
+ private queryWhere?;
1688
+ private legacyWhere?;
1689
+ private queryRelationLoads?;
1690
+ private queryOrderBy?;
1691
+ private querySelect?;
1692
+ private offsetValue?;
1693
+ private limitValue?;
1368
1694
  private readonly eagerLoads;
1369
1695
  private includeTrashed;
1370
1696
  private onlyTrashedRecords;
@@ -1374,10 +1700,9 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
1374
1700
  /**
1375
1701
  * Creates a new QueryBuilder instance.
1376
1702
  *
1377
- * @param delegate
1378
1703
  * @param model
1379
1704
  */
1380
- constructor(delegate: TDelegate, model: ModelStatic<TModel, TDelegate>);
1705
+ constructor(model: ModelStatic<TModel, TDelegate>, adapter?: DatabaseAdapter | undefined);
1381
1706
  private resolvePaginationPage;
1382
1707
  /**
1383
1708
  * Adds a where clause to the query. Multiple calls to where will combine
@@ -1951,6 +2276,12 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
1951
2276
  * @returns
1952
2277
  */
1953
2278
  delete(): Promise<TModel>;
2279
+ private tryBuildInsertSpec;
2280
+ private tryBuildInsertManySpec;
2281
+ private tryBuildInsertOrIgnoreManySpec;
2282
+ private tryBuildUpdateSpec;
2283
+ private tryBuildUpdateManySpec;
2284
+ private tryBuildDeleteSpec;
1954
2285
  /**
1955
2286
  * Counts the number of records matching the current query constraints.
1956
2287
  *
@@ -2062,6 +2393,34 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
2062
2393
  * @returns
2063
2394
  */
2064
2395
  private normalizeWith;
2396
+ private buildQueryTarget;
2397
+ private hasBaseWhereConstraints;
2398
+ private normalizeQuerySelect;
2399
+ private normalizeQueryOrderBy;
2400
+ private cloneRelationLoads;
2401
+ private normalizeRelationLoadSelect;
2402
+ private normalizeRelationLoadOrderBy;
2403
+ private normalizeRelationLoads;
2404
+ private appendQueryCondition;
2405
+ private toDelegateWhere;
2406
+ private buildSoftDeleteQueryCondition;
2407
+ private buildQueryWhereCondition;
2408
+ private tryBuildQuerySelectColumns;
2409
+ private tryBuildQueryOrderBy;
2410
+ private tryBuildFieldCondition;
2411
+ private tryBuildQueryCondition;
2412
+ private tryBuildSelectSpec;
2413
+ private tryBuildAggregateSpec;
2414
+ private requireAdapter;
2415
+ private executeReadRows;
2416
+ private executeReadRow;
2417
+ private executeReadCount;
2418
+ private executeReadExists;
2419
+ private executeInsertRow;
2420
+ private executeInsertManyRows;
2421
+ private executeUpdateRow;
2422
+ private executeUpdateManyRows;
2423
+ private executeDeleteRow;
2065
2424
  /**
2066
2425
  * Builds the where clause for the query, taking into account soft delete
2067
2426
  * settings if applicable.
@@ -2074,7 +2433,6 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
2074
2433
  *
2075
2434
  * @returns
2076
2435
  */
2077
- private buildFindArgs;
2078
2436
  /**
2079
2437
  * Resolves a unique where clause for update and delete operations.
2080
2438
  *
@@ -2113,188 +2471,266 @@ interface ModelStatic<TModel, TDelegate extends PrismaDelegateLike = PrismaDeleg
2113
2471
  hydrateMany: (attributes: (DelegateRow<TDelegate> extends Record<string, unknown> ? DelegateRow<TDelegate> : Record<string, unknown>)[]) => TModel[];
2114
2472
  hydrateRetrieved: (attributes: DelegateRow<TDelegate> extends Record<string, unknown> ? DelegateRow<TDelegate> : Record<string, unknown>) => Promise<TModel>;
2115
2473
  hydrateManyRetrieved: (attributes: (DelegateRow<TDelegate> extends Record<string, unknown> ? DelegateRow<TDelegate> : Record<string, unknown>)[]) => Promise<TModel[]>;
2474
+ getAdapter: () => DatabaseAdapter | undefined;
2475
+ getColumnMap: () => Record<string, string>;
2476
+ getColumnName: (attribute: string) => string;
2116
2477
  getDelegate: (delegate?: string) => TDelegate;
2478
+ getModelMetadata: () => ModelMetadata;
2479
+ getPrimaryKey: () => string;
2480
+ getRelationMetadata: (name: string) => RelationMetadata | null;
2481
+ setAdapter: (adapter?: DatabaseAdapter) => void;
2117
2482
  getSoftDeleteConfig: () => SoftDeleteConfig;
2483
+ getTable: () => string;
2118
2484
  }
2119
2485
  interface RelationshipModelStatic {
2120
2486
  new (attributes?: Record<string, unknown>): any;
2121
2487
  query: () => QueryBuilder<any, any>;
2122
2488
  hydrate: (attributes: Record<string, unknown>) => any;
2489
+ getAdapter: () => DatabaseAdapter | undefined;
2490
+ getColumnMap: () => Record<string, string>;
2491
+ getColumnName: (attribute: string) => string;
2123
2492
  getDelegate: (delegate?: string) => PrismaDelegateLike;
2493
+ getModelMetadata: () => ModelMetadata;
2494
+ getPrimaryKey: () => string;
2495
+ getRelationMetadata: (name: string) => RelationMetadata | null;
2496
+ getTable: () => string;
2124
2497
  }
2125
2498
  //#endregion
2126
- //#region src/types/core.d.ts
2127
- type CastType = 'string' | 'number' | 'boolean' | 'date' | 'json' | 'array';
2128
- interface CastHandler<T = unknown> {
2129
- get: (value: unknown) => T;
2130
- set: (value: unknown) => unknown;
2499
+ //#region src/types/adapter.d.ts
2500
+ type DatabasePrimitive = string | number | boolean | bigint | Date | null;
2501
+ type DatabaseValue = DatabasePrimitive | DatabaseRow | DatabaseValue[];
2502
+ type DatabaseRow = Record<string, unknown>;
2503
+ type DatabaseRows = DatabaseRow[];
2504
+ type AdapterCapability = 'transactions' | 'returning' | 'insertMany' | 'updateMany' | 'deleteMany' | 'exists' | 'relationLoads' | 'relationAggregates' | 'relationFilters' | 'rawWhere';
2505
+ type AdapterCapabilities = Partial<Record<AdapterCapability, boolean>>;
2506
+ type QueryLogicalOperator = 'and' | 'or';
2507
+ type QueryComparisonOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'in' | 'not-in' | 'contains' | 'starts-with' | 'ends-with' | 'is-null' | 'is-not-null';
2508
+ type SortDirection = 'asc' | 'desc';
2509
+ type AggregateOperation = 'count' | 'exists' | 'sum' | 'avg' | 'min' | 'max';
2510
+ type SoftDeleteQueryMode = 'exclude' | 'include' | 'only';
2511
+ interface QueryTarget<TModel = unknown> {
2512
+ model?: ModelStatic<TModel, any>;
2513
+ modelName?: string;
2514
+ table?: string;
2515
+ primaryKey?: string;
2516
+ columns?: Record<string, string>;
2517
+ softDelete?: SoftDeleteConfig;
2518
+ alias?: string;
2131
2519
  }
2132
- type CastDefinition = CastType | CastHandler;
2133
- type CastMap = Record<string, CastDefinition>;
2134
- type PrismaClientLike = PrismaClient | Record<string, unknown>;
2135
- interface PrismaTransactionOptions {
2136
- maxWait?: number;
2137
- timeout?: number;
2138
- isolationLevel?: string;
2520
+ interface QuerySelectColumn {
2521
+ column: string;
2522
+ alias?: string;
2139
2523
  }
2140
- type PrismaTransactionCallback<TResult = unknown> = (client: PrismaClientLike) => TResult | Promise<TResult>;
2141
- interface PrismaTransactionCapableClient {
2142
- $transaction: <TResult>(callback: PrismaTransactionCallback<TResult>, options?: PrismaTransactionOptions) => Promise<TResult>;
2524
+ interface QueryOrderBy {
2525
+ column: string;
2526
+ direction: SortDirection;
2143
2527
  }
2144
- type ClientResolver = PrismaClientLike | (() => PrismaClientLike);
2145
- interface ArkormConfig {
2146
- /**
2147
- * @property prisma A Prisma client instance or a function that returns a Prisma client instance.
2148
- */
2149
- prisma: ClientResolver;
2150
- /**
2151
- * @property pagination Configuration options related to pagination behavior and URL generation.
2152
- */
2153
- pagination?: {
2154
- urlDriver?: PaginationURLDriverFactory;
2155
- resolveCurrentPage?: PaginationCurrentPageResolver;
2156
- };
2157
- /**
2158
- * @property paths Optional custom paths for various generated files.
2159
- */
2160
- paths?: {
2161
- /**
2162
- * @property stubs Optional custom path for stub files used in code generation.
2163
- */
2164
- stubs?: string;
2165
- /**
2166
- * @property seeders Optional custom path for seeder files.
2167
- */
2168
- seeders?: string;
2169
- /**
2170
- * @property models Optional custom path for model files.
2171
- */
2172
- models?: string;
2173
- /**
2174
- * @property migrations Optional custom path for migration files.
2175
- */
2176
- migrations?: string;
2177
- /**
2178
- * @property factories Optional custom path for factory files.
2179
- */
2180
- factories?: string;
2181
- /**
2182
- * @property buildOutput Optional custom path for the development output directory.
2183
- */
2184
- buildOutput?: string;
2185
- };
2186
- /**
2187
- * @property outputExt Optional file extension for generated files, either 'ts' or 'js'.
2188
- */
2189
- outputExt?: 'ts' | 'js';
2528
+ interface QueryComparisonCondition {
2529
+ type: 'comparison';
2530
+ column: string;
2531
+ operator: QueryComparisonOperator;
2532
+ value?: DatabaseValue | DatabaseValue[];
2190
2533
  }
2191
- interface GetUserConfig {
2192
- /**
2193
- * Get the user-provided ArkORM configuration.
2194
- */
2195
- (): Partial<ArkormConfig>;
2196
- /**
2197
- * Get a specific user configuration value
2198
- * @param key Optional specific configuration key to retrieve
2199
- */
2200
- <K extends keyof ArkormConfig>(key: K): Partial<ArkormConfig>[K];
2534
+ interface QueryGroupCondition {
2535
+ type: 'group';
2536
+ operator: QueryLogicalOperator;
2537
+ conditions: QueryCondition[];
2201
2538
  }
2202
- interface PaginationMeta {
2203
- total: number;
2204
- perPage: number;
2205
- currentPage: number;
2206
- lastPage: number;
2207
- from: number | null;
2208
- to: number | null;
2539
+ interface QueryNotCondition {
2540
+ type: 'not';
2541
+ condition: QueryCondition;
2209
2542
  }
2210
- interface SimplePaginationMeta {
2211
- perPage: number;
2212
- currentPage: number;
2213
- from: number | null;
2214
- to: number | null;
2215
- hasMorePages: boolean;
2543
+ interface QueryRawCondition {
2544
+ type: 'raw';
2545
+ sql: string;
2546
+ bindings?: DatabaseValue[];
2216
2547
  }
2217
- interface PaginationOptions {
2218
- path?: string;
2219
- query?: Record<string, string | number | boolean | null | undefined>;
2220
- fragment?: string;
2221
- pageName?: string;
2548
+ type QueryCondition = QueryComparisonCondition | QueryGroupCondition | QueryNotCondition | QueryRawCondition;
2549
+ interface AggregateSelection {
2550
+ type: AggregateOperation;
2551
+ column?: string;
2552
+ alias?: string;
2222
2553
  }
2223
- type PaginationCurrentPageResolver = (pageName: string, options: PaginationOptions) => number | undefined;
2224
- interface PaginationURLDriver {
2225
- getPageName: () => string;
2226
- url: (page: number) => string;
2554
+ interface RelationAggregateSpec {
2555
+ relation: string;
2556
+ type: AggregateOperation;
2557
+ column?: string;
2558
+ alias?: string;
2559
+ where?: QueryCondition;
2227
2560
  }
2228
- type PaginationURLDriverFactory = (options: PaginationOptions) => PaginationURLDriver;
2229
- interface PrismaFindManyArgsLike {
2230
- where?: unknown;
2231
- include?: unknown;
2232
- orderBy?: unknown;
2233
- select?: unknown;
2234
- skip?: number;
2235
- take?: number;
2561
+ interface RelationFilterSpec {
2562
+ relation: string;
2563
+ operator: '>=' | '>' | '=' | '!=' | '<=' | '<';
2564
+ count: number;
2565
+ boolean?: 'AND' | 'OR';
2566
+ where?: QueryCondition;
2236
2567
  }
2237
- type PrismaLikeSortOrder = 'asc' | 'desc';
2238
- interface PrismaLikeWhereInput {
2239
- AND?: PrismaLikeWhereInput[];
2240
- OR?: PrismaLikeWhereInput[];
2241
- NOT?: PrismaLikeWhereInput | PrismaLikeWhereInput[];
2242
- [key: string]: unknown;
2568
+ interface RelationLoadPlan {
2569
+ relation: string;
2570
+ constraint?: QueryCondition;
2571
+ orderBy?: QueryOrderBy[];
2572
+ limit?: number;
2573
+ offset?: number;
2574
+ columns?: QuerySelectColumn[];
2575
+ relationLoads?: RelationLoadPlan[];
2243
2576
  }
2244
- type PrismaLikeOrderBy = Record<string, PrismaLikeSortOrder> | Record<string, PrismaLikeSortOrder>[];
2245
- interface PrismaLikeSelect {
2246
- [key: string]: boolean | {
2247
- select?: PrismaLikeSelect;
2248
- include?: PrismaLikeInclude;
2249
- };
2577
+ interface SelectSpec<TModel = unknown> {
2578
+ target: QueryTarget<TModel>;
2579
+ columns?: QuerySelectColumn[];
2580
+ where?: QueryCondition;
2581
+ orderBy?: QueryOrderBy[];
2582
+ limit?: number;
2583
+ offset?: number;
2584
+ softDeleteMode?: SoftDeleteQueryMode;
2585
+ relationLoads?: RelationLoadPlan[];
2586
+ relationAggregates?: RelationAggregateSpec[];
2587
+ relationFilters?: RelationFilterSpec[];
2588
+ aggregates?: AggregateSelection[];
2250
2589
  }
2251
- interface PrismaLikeInclude {
2252
- [key: string]: boolean | {
2253
- where?: PrismaLikeWhereInput;
2254
- orderBy?: PrismaLikeOrderBy;
2255
- select?: PrismaLikeSelect;
2256
- include?: PrismaLikeInclude;
2257
- skip?: number;
2258
- take?: number;
2259
- };
2590
+ interface InsertSpec<TModel = unknown> {
2591
+ target: QueryTarget<TModel>;
2592
+ values: DatabaseRow;
2593
+ returning?: QuerySelectColumn[];
2260
2594
  }
2261
- type EagerLoadConstraint = (query: unknown) => unknown;
2262
- type EagerLoadMap = Record<string, EagerLoadConstraint | undefined>;
2263
- interface SoftDeleteConfig {
2264
- enabled: boolean;
2265
- column: string;
2595
+ interface InsertManySpec<TModel = unknown> {
2596
+ target: QueryTarget<TModel>;
2597
+ values: DatabaseRow[];
2598
+ ignoreDuplicates?: boolean;
2266
2599
  }
2267
- interface PrismaDelegateLike {
2268
- findMany: (args?: any) => Promise<unknown[]>;
2269
- findFirst: (args?: any) => Promise<unknown | null>;
2270
- create: (args: any) => Promise<unknown>;
2271
- update: (args: any) => Promise<unknown>;
2272
- delete: (args: any) => Promise<unknown>;
2273
- count: (args?: any) => Promise<number>;
2600
+ interface UpdateSpec<TModel = unknown> {
2601
+ target: QueryTarget<TModel>;
2602
+ where: QueryCondition;
2603
+ values: DatabaseRow;
2604
+ returning?: QuerySelectColumn[];
2605
+ }
2606
+ interface UpdateManySpec<TModel = unknown> {
2607
+ target: QueryTarget<TModel>;
2608
+ where?: QueryCondition;
2609
+ values: DatabaseRow;
2610
+ }
2611
+ interface DeleteSpec<TModel = unknown> {
2612
+ target: QueryTarget<TModel>;
2613
+ where: QueryCondition;
2614
+ returning?: QuerySelectColumn[];
2615
+ }
2616
+ interface DeleteManySpec<TModel = unknown> {
2617
+ target: QueryTarget<TModel>;
2618
+ where?: QueryCondition;
2619
+ }
2620
+ interface AggregateSpec<TModel = unknown> {
2621
+ target: QueryTarget<TModel>;
2622
+ where?: QueryCondition;
2623
+ aggregate: AggregateSelection;
2624
+ softDeleteMode?: SoftDeleteQueryMode;
2625
+ }
2626
+ interface RelationLoadSpec<TModel = unknown> {
2627
+ target: QueryTarget<TModel>;
2628
+ models: TModel[];
2629
+ relations: RelationLoadPlan[];
2630
+ }
2631
+ interface AdapterTransactionContext {
2632
+ isolationLevel?: string;
2633
+ readOnly?: boolean;
2634
+ maxWait?: number;
2635
+ timeout?: number;
2636
+ }
2637
+ interface DatabaseAdapter {
2638
+ readonly capabilities?: AdapterCapabilities;
2639
+ select: <TModel = unknown>(spec: SelectSpec<TModel>) => Promise<DatabaseRows>;
2640
+ selectOne: <TModel = unknown>(spec: SelectSpec<TModel>) => Promise<DatabaseRow | null>;
2641
+ insert: <TModel = unknown>(spec: InsertSpec<TModel>) => Promise<DatabaseRow>;
2642
+ insertMany?: <TModel = unknown>(spec: InsertManySpec<TModel>) => Promise<number>;
2643
+ update: <TModel = unknown>(spec: UpdateSpec<TModel>) => Promise<DatabaseRow | null>;
2644
+ updateMany?: <TModel = unknown>(spec: UpdateManySpec<TModel>) => Promise<number>;
2645
+ delete: <TModel = unknown>(spec: DeleteSpec<TModel>) => Promise<DatabaseRow | null>;
2646
+ deleteMany?: <TModel = unknown>(spec: DeleteManySpec<TModel>) => Promise<number>;
2647
+ count: <TModel = unknown>(spec: AggregateSpec<TModel>) => Promise<number>;
2648
+ exists?: <TModel = unknown>(spec: SelectSpec<TModel>) => Promise<boolean>;
2649
+ loadRelations?: <TModel = unknown>(spec: RelationLoadSpec<TModel>) => Promise<void>;
2650
+ transaction: <TResult = unknown>(callback: (adapter: DatabaseAdapter) => TResult | Promise<TResult>, context?: AdapterTransactionContext) => Promise<TResult>;
2651
+ }
2652
+ //#endregion
2653
+ //#region src/adapters/KyselyDatabaseAdapter.d.ts
2654
+ type KyselyExecutor = Kysely<any> | Transaction<any>;
2655
+ declare class KyselyDatabaseAdapter implements DatabaseAdapter {
2656
+ private readonly db;
2657
+ readonly capabilities: AdapterCapabilities;
2658
+ constructor(db: KyselyExecutor);
2659
+ private resolveTable;
2660
+ private resolvePrimaryKey;
2661
+ private mapColumn;
2662
+ private reverseColumnMap;
2663
+ private mapRow;
2664
+ private mapRows;
2665
+ private mapValues;
2666
+ private buildSelectList;
2667
+ private buildOrderBy;
2668
+ private buildConditionValueList;
2669
+ private buildComparisonCondition;
2670
+ private buildWhereCondition;
2671
+ private buildWhereClause;
2672
+ private buildPaginationClause;
2673
+ private assertNoRelationLoads;
2674
+ select<TModel = unknown>(spec: SelectSpec<TModel>): Promise<DatabaseRow[]>;
2675
+ selectOne<TModel = unknown>(spec: SelectSpec<TModel>): Promise<DatabaseRow | null>;
2676
+ insert<TModel = unknown>(spec: InsertSpec<TModel>): Promise<DatabaseRow>;
2677
+ insertMany<TModel = unknown>(spec: InsertManySpec<TModel>): Promise<number>;
2678
+ update<TModel = unknown>(spec: UpdateSpec<TModel>): Promise<DatabaseRow | null>;
2679
+ updateMany<TModel = unknown>(spec: UpdateManySpec<TModel>): Promise<number>;
2680
+ delete<TModel = unknown>(spec: DeleteSpec<TModel>): Promise<DatabaseRow | null>;
2681
+ deleteMany<TModel = unknown>(spec: DeleteManySpec<TModel>): Promise<number>;
2682
+ count<TModel = unknown>(spec: AggregateSpec<TModel>): Promise<number>;
2683
+ exists<TModel = unknown>(spec: SelectSpec<TModel>): Promise<boolean>;
2684
+ transaction<TResult = unknown>(callback: (adapter: DatabaseAdapter) => TResult | Promise<TResult>, context?: AdapterTransactionContext): Promise<TResult>;
2685
+ }
2686
+ declare const createKyselyAdapter: (db: KyselyExecutor) => KyselyDatabaseAdapter;
2687
+ //#endregion
2688
+ //#region src/adapters/PrismaDatabaseAdapter.d.ts
2689
+ type PrismaDelegateNameMapping = Record<string, string>;
2690
+ declare class PrismaDatabaseAdapter implements DatabaseAdapter {
2691
+ private readonly prisma;
2692
+ private readonly mapping;
2693
+ readonly capabilities: AdapterCapabilities;
2694
+ private readonly delegates;
2695
+ constructor(prisma: PrismaClientLike, mapping?: PrismaDelegateNameMapping);
2696
+ private hasTransactionSupport;
2697
+ private normalizeCandidate;
2698
+ private unique;
2699
+ private toQuerySelect;
2700
+ private toQueryOrderBy;
2701
+ private toComparisonWhere;
2702
+ private toQueryWhere;
2703
+ private buildFindArgs;
2704
+ private toQueryInclude;
2705
+ private resolveDelegate;
2706
+ select<TModel = unknown>(spec: SelectSpec<TModel>): Promise<DatabaseRow[]>;
2707
+ selectOne<TModel = unknown>(spec: SelectSpec<TModel>): Promise<DatabaseRow | null>;
2708
+ insert<TModel = unknown>(spec: InsertSpec<TModel>): Promise<DatabaseRow>;
2709
+ insertMany<TModel = unknown>(spec: InsertManySpec<TModel>): Promise<number>;
2710
+ update<TModel = unknown>(spec: UpdateSpec<TModel>): Promise<DatabaseRow | null>;
2711
+ updateMany<TModel = unknown>(spec: UpdateManySpec<TModel>): Promise<number>;
2712
+ delete<TModel = unknown>(spec: DeleteSpec<TModel>): Promise<DatabaseRow | null>;
2713
+ deleteMany<TModel = unknown>(spec: DeleteManySpec<TModel>): Promise<number>;
2714
+ count<TModel = unknown>(spec: AggregateSpec<TModel>): Promise<number>;
2715
+ exists<TModel = unknown>(spec: SelectSpec<TModel>): Promise<boolean>;
2716
+ loadRelations<TModel = unknown>(_spec: RelationLoadSpec<TModel>): Promise<void>;
2717
+ transaction<TResult = unknown>(callback: (adapter: DatabaseAdapter) => TResult | Promise<TResult>, context?: AdapterTransactionContext): Promise<TResult>;
2718
+ }
2719
+ declare const createPrismaDatabaseAdapter: (prisma: PrismaClientLike, mapping?: PrismaDelegateNameMapping) => PrismaDatabaseAdapter;
2720
+ declare const createPrismaCompatibilityAdapter: (prisma: PrismaClientLike, mapping?: PrismaDelegateNameMapping) => PrismaDatabaseAdapter;
2721
+ //#endregion
2722
+ //#region src/Attribute.d.ts
2723
+ interface AttributeOptions<TGet = unknown, TSet = unknown> {
2724
+ get?: (value: unknown) => TGet;
2725
+ set?: (value: TSet) => unknown;
2726
+ }
2727
+ declare class Attribute<TGet = unknown, TSet = unknown> {
2728
+ readonly get?: (value: unknown) => TGet;
2729
+ readonly set?: (value: TSet) => unknown;
2730
+ constructor(options?: AttributeOptions<TGet, TSet>);
2731
+ static make<TGet = unknown, TSet = unknown>(options: AttributeOptions<TGet, TSet>): Attribute<TGet, TSet>;
2732
+ static isAttribute(value: unknown): value is Attribute;
2274
2733
  }
2275
- type FallbackIfUnknownOrNever<TValue, TFallback> = [TValue] extends [never] ? TFallback : unknown extends TValue ? TFallback : TValue;
2276
- type DelegateFindManyArgs<TDelegate extends PrismaDelegateLike> = FallbackIfUnknownOrNever<NonNullable<Parameters<TDelegate['findMany']>[0]>, PrismaFindManyArgsLike>;
2277
- type DelegateWhere<TDelegate extends PrismaDelegateLike> = DelegateFindManyArgs<TDelegate> extends {
2278
- where?: infer TWhere;
2279
- } ? FallbackIfUnknownOrNever<TWhere, PrismaLikeWhereInput> : PrismaLikeWhereInput;
2280
- type DelegateInclude<TDelegate extends PrismaDelegateLike> = DelegateFindManyArgs<TDelegate> extends {
2281
- include?: infer TInclude;
2282
- } ? FallbackIfUnknownOrNever<TInclude, PrismaLikeInclude> : PrismaLikeInclude;
2283
- type DelegateOrderBy<TDelegate extends PrismaDelegateLike> = DelegateFindManyArgs<TDelegate> extends {
2284
- orderBy?: infer TOrderBy;
2285
- } ? FallbackIfUnknownOrNever<TOrderBy, PrismaLikeOrderBy> : PrismaLikeOrderBy;
2286
- type DelegateSelect<TDelegate extends PrismaDelegateLike> = DelegateFindManyArgs<TDelegate> extends {
2287
- select?: infer TSelect;
2288
- } ? FallbackIfUnknownOrNever<TSelect, PrismaLikeSelect> : PrismaLikeSelect;
2289
- type DelegateCreateData<TDelegate extends PrismaDelegateLike> = Parameters<TDelegate['create']>[0] extends {
2290
- data: infer TData;
2291
- } ? TData : Record<string, unknown>;
2292
- type DelegateUpdateArgs<TDelegate extends PrismaDelegateLike> = Parameters<TDelegate['update']>[0];
2293
- type DelegateUpdateData<TDelegate extends PrismaDelegateLike> = DelegateUpdateArgs<TDelegate> extends {
2294
- data: infer TData;
2295
- } ? FallbackIfUnknownOrNever<TData, Record<string, unknown>> : Record<string, unknown>;
2296
- type DelegateRow<TDelegate extends PrismaDelegateLike> = Exclude<Awaited<ReturnType<TDelegate['findFirst']>>, null>;
2297
- type Serializable = Record<string, unknown>;
2298
2734
  //#endregion
2299
2735
  //#region src/casts.d.ts
2300
2736
  declare function resolveCast(definition: CastDefinition): CastHandler;
@@ -3703,7 +4139,7 @@ declare function createPrismaAdapter(prisma: PrismaClientLike): Record<string, P
3703
4139
  * @param mapping Optional mapping of Arkormˣ delegate names to Prisma delegate names.
3704
4140
  * @returns A delegate map keyed by Arkormˣ delegate names.
3705
4141
  */
3706
- declare function createPrismaDelegateMap(prisma: PrismaClientLike): Record<string, PrismaDelegateLike>;
4142
+ declare function createPrismaDelegateMap(prisma: PrismaClientLike, mapping?: PrismaDelegateNameMapping): Record<string, PrismaDelegateLike>;
3707
4143
  /**
3708
4144
  * Infer the Prisma delegate name for a given model name using a simple convention.
3709
4145
  *
@@ -3735,4 +4171,4 @@ declare class URLDriver {
3735
4171
  url(page: number): string;
3736
4172
  }
3737
4173
  //#endregion
3738
- export { ArkormCollection, ArkormErrorContext, ArkormException, Attribute, AttributeOptions, CliApp, EnumBuilder, ForeignKeyBuilder, InitCommand, InlineFactory, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateRollbackCommand, Migration, MigrationHistoryCommand, MissingDelegateException, Model, ModelFactory, ModelNotFoundException, ModelsSyncCommand, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, Paginator, PrismaDelegateMap, QueryBuilder, QueryConstraintException, RelationResolutionException, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToPrismaSchema, applyMigrationToPrismaSchema, applyOperationsToPrismaSchema, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createMigrationTimestamp, createPrismaAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, removeAppliedMigration, resetArkormRuntimeForTests, resolveCast, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, toMigrationFileSlug, toModelName, writeAppliedMigrationsState };
4174
+ export { AdapterCapabilities, AdapterCapability, AdapterTransactionContext, AggregateOperation, AggregateSelection, AggregateSpec, AppliedMigrationEntry, AppliedMigrationRun, AppliedMigrationsState, ArkormCollection, ArkormConfig, ArkormErrorContext, ArkormException, Attribute, AttributeOptions, BelongsToManyRelationMetadata, BelongsToRelationMetadata, CastDefinition, CastHandler, CastMap, CastType, CliApp, ClientResolver, ColumnMap, DatabaseAdapter, DatabasePrimitive, DatabaseRow, DatabaseRows, DatabaseValue, DelegateCreateData, DelegateFindManyArgs, DelegateForModelSchema, DelegateInclude, DelegateOrderBy, DelegateRow, DelegateRows, DelegateSelect, DelegateUniqueWhere, DelegateUpdateArgs, DelegateUpdateData, DelegateWhere, DeleteManySpec, DeleteSpec, EagerLoadConstraint, EagerLoadMap, EnumBuilder, FactoryAttributes, FactoryDefinition, FactoryModelConstructor, FactoryState, ForeignKeyBuilder, GenerateMigrationOptions, GeneratedMigrationFile, GetUserConfig, GlobalScope, HasManyRelationMetadata, HasManyThroughRelationMetadata, HasOneRelationMetadata, HasOneThroughRelationMetadata, InitCommand, InlineFactory, InsertManySpec, InsertSpec, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateRollbackCommand, Migration, MigrationClass, MigrationHistoryCommand, MigrationInstanceLike, MissingDelegateException, Model, ModelAttributes, ModelAttributesOf, ModelEventDispatcher, ModelEventHandler, ModelEventHandlerConstructor, ModelEventListener, ModelEventName, ModelFactory, ModelLifecycleState, ModelMetadata, ModelNotFoundException, ModelStatic, ModelsSyncCommand, MorphManyRelationMetadata, MorphOneRelationMetadata, MorphToManyRelationMetadata, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, PaginationCurrentPageResolver, PaginationMeta, PaginationOptions, PaginationURLDriver, PaginationURLDriverFactory, Paginator, PrismaClientLike, PrismaDatabaseAdapter, PrismaDelegateLike, PrismaDelegateMap, PrismaDelegateNameMapping, PrismaFindManyArgsLike, PrismaLikeInclude, PrismaLikeOrderBy, PrismaLikeScalarFilter, PrismaLikeSelect, PrismaLikeSortOrder, PrismaLikeWhereInput, PrismaMigrationWorkflowOptions, PrismaSchemaSyncOptions, PrismaTransactionCallback, PrismaTransactionCapableClient, PrismaTransactionOptions, QueryBuilder, QueryComparisonCondition, QueryComparisonOperator, QueryCondition, QueryConstraintException, QueryGroupCondition, QueryLogicalOperator, QueryNotCondition, QueryOrderBy, QueryRawCondition, QuerySelectColumn, QueryTarget, RelatedModelClass, RelationAggregateSpec, RelationColumnLookupSpec, RelationConstraint, RelationDefaultResolver, RelationDefaultValue, RelationFilterSpec, RelationLoadPlan, RelationLoadSpec, RelationMetadata, RelationMetadataProvider, RelationMetadataType, RelationResolutionException, RelationTableLookupSpec, RelationshipModelStatic, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, SchemaColumn, SchemaColumnType, SchemaForeignKey, SchemaForeignKeyAction, SchemaIndex, SchemaOperation, SchemaTableAlterOperation, SchemaTableCreateOperation, SchemaTableDropOperation, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, SelectSpec, Serializable, SimplePaginationMeta, SoftDeleteConfig, SoftDeleteQueryMode, SortDirection, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, UpdateManySpec, UpdateSpec, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToPrismaSchema, applyMigrationToPrismaSchema, applyOperationsToPrismaSchema, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, removeAppliedMigration, resetArkormRuntimeForTests, resolveCast, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, toMigrationFileSlug, toModelName, writeAppliedMigrationsState };