arkormx 2.0.0-next.8 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
+ import { Collection } from "@h3ravel/collect.js";
1
2
  import { Kysely, Transaction } from "kysely";
2
3
  import { Command } from "@h3ravel/musket";
3
- import { Collection } from "@h3ravel/collect.js";
4
4
  import { PrismaClient } from "@prisma/client";
5
5
 
6
6
  //#region src/types/migrations.d.ts
@@ -118,27 +118,80 @@ interface CastHandler<T = unknown> {
118
118
  }
119
119
  type CastDefinition = CastType | CastHandler;
120
120
  type CastMap = Record<string, CastDefinition>;
121
- type PrismaClientLike = PrismaClient | Record<string, unknown>;
122
- interface PrismaTransactionOptions {
121
+ type RuntimeClientLike = PrismaClient | Record<string, unknown>;
122
+ interface TransactionOptions {
123
123
  maxWait?: number;
124
124
  timeout?: number;
125
125
  isolationLevel?: string;
126
126
  }
127
- type PrismaTransactionCallback<TResult = unknown> = (client: PrismaClientLike) => TResult | Promise<TResult>;
128
- interface PrismaTransactionCapableClient {
129
- $transaction: <TResult>(callback: PrismaTransactionCallback<TResult>, options?: PrismaTransactionOptions) => Promise<TResult>;
127
+ interface TransactionContext {
128
+ client?: RuntimeClientLike;
129
+ adapter?: DatabaseAdapter;
130
+ }
131
+ type TransactionCallback<TResult = unknown> = (context: TransactionContext) => TResult | Promise<TResult>;
132
+ interface TransactionCapableClient {
133
+ $transaction: <TResult>(callback: (client: RuntimeClientLike) => TResult | Promise<TResult>, options?: TransactionOptions) => Promise<TResult>;
130
134
  }
131
- type ClientResolver = PrismaClientLike | (() => PrismaClientLike);
135
+ /**
136
+ * @deprecated Use RuntimeClientLike instead.
137
+ */
138
+ type PrismaClientLike = RuntimeClientLike;
139
+ /**
140
+ * @deprecated Use TransactionOptions instead.
141
+ */
142
+ type PrismaTransactionOptions = TransactionOptions;
143
+ /**
144
+ * @deprecated Use TransactionContext instead.
145
+ */
146
+ type PrismaTransactionContext = TransactionContext;
147
+ /**
148
+ * @deprecated Use TransactionCallback instead.
149
+ */
150
+ type PrismaTransactionCallback<TResult = unknown> = TransactionCallback<TResult>;
151
+ /**
152
+ * @deprecated Use TransactionCapableClient instead.
153
+ */
154
+ type PrismaTransactionCapableClient = TransactionCapableClient;
155
+ type ClientResolver = RuntimeClientLike | (() => RuntimeClientLike);
132
156
  interface AdapterBindableModel {
133
157
  setAdapter: (adapter?: DatabaseAdapter) => void;
134
158
  }
135
159
  interface ArkormBootContext {
136
- prisma?: PrismaClientLike;
160
+ client?: RuntimeClientLike;
161
+ /**
162
+ * @deprecated Use client instead.
163
+ */
164
+ prisma?: RuntimeClientLike;
137
165
  bindAdapter: (adapter: DatabaseAdapter, models: AdapterBindableModel[]) => DatabaseAdapter;
138
166
  }
167
+ interface AdapterQueryInspection {
168
+ adapter: string;
169
+ operation: string;
170
+ target?: string;
171
+ sql?: string;
172
+ parameters?: ReadonlyArray<unknown>;
173
+ detail?: Record<string, unknown>;
174
+ }
175
+ interface ArkormDebugEvent {
176
+ type: 'query';
177
+ phase: 'before' | 'after' | 'error';
178
+ adapter: string;
179
+ operation: string;
180
+ target?: string;
181
+ inspection?: AdapterQueryInspection | null;
182
+ meta?: Record<string, unknown>;
183
+ durationMs?: number;
184
+ error?: unknown;
185
+ }
186
+ type ArkormDebugHandler = (event: ArkormDebugEvent) => void;
139
187
  interface ArkormConfig {
140
188
  /**
141
- * @property prisma Optional Prisma client instance or resolver used for compatibility, CLI flows, and Prisma-backed transactions.
189
+ * @property client Optional runtime client instance or resolver used for compatibility mode, CLI flows, and client-backed transactions.
190
+ */
191
+ client?: ClientResolver;
192
+ /**
193
+ * @deprecated Use client instead.
194
+ * @property prisma Optional Prisma client instance or resolver used for compatibility mode, CLI flows, and Prisma-backed transactions.
142
195
  */
143
196
  prisma?: ClientResolver;
144
197
  /**
@@ -149,6 +202,11 @@ interface ArkormConfig {
149
202
  * @property boot Optional synchronous runtime boot hook for central adapter binding.
150
203
  */
151
204
  boot?: (context: ArkormBootContext) => void;
205
+ /**
206
+ * @property debug Optional runtime query debugging. `true` logs through Arkorm's default logger;
207
+ * a callback receives structured debug events for custom handling.
208
+ */
209
+ debug?: boolean | ArkormDebugHandler;
152
210
  /**
153
211
  * @property pagination Configuration options related to pagination behavior and URL generation.
154
212
  */
@@ -294,7 +352,7 @@ interface SoftDeleteConfig {
294
352
  enabled: boolean;
295
353
  column: string;
296
354
  }
297
- interface PrismaDelegateLike {
355
+ interface ModelQuerySchemaLike {
298
356
  findMany: (args?: any) => Promise<unknown[]>;
299
357
  findFirst: (args?: any) => Promise<unknown | null>;
300
358
  create: (args: any) => Promise<unknown>;
@@ -302,36 +360,88 @@ interface PrismaDelegateLike {
302
360
  delete: (args: any) => Promise<unknown>;
303
361
  count: (args?: any) => Promise<number>;
304
362
  }
363
+ /**
364
+ * @deprecated Use ModelQuerySchemaLike instead.
365
+ */
366
+ type PrismaDelegateLike = ModelQuerySchemaLike;
305
367
  type FallbackIfUnknownOrNever<TValue, TFallback> = [TValue] extends [never] ? TFallback : unknown extends TValue ? TFallback : TValue;
306
- type DelegateFindManyArgs<TDelegate extends PrismaDelegateLike> = FallbackIfUnknownOrNever<NonNullable<Parameters<TDelegate['findMany']>[0]>, PrismaFindManyArgsLike>;
307
- type DelegateWhere<TDelegate extends PrismaDelegateLike> = DelegateFindManyArgs<TDelegate> extends {
368
+ type QuerySchemaFindManyArgs<TSchema extends ModelQuerySchemaLike> = FallbackIfUnknownOrNever<NonNullable<Parameters<TSchema['findMany']>[0]>, PrismaFindManyArgsLike>;
369
+ type QuerySchemaWhere<TSchema extends ModelQuerySchemaLike> = QuerySchemaFindManyArgs<TSchema> extends {
308
370
  where?: infer TWhere;
309
371
  } ? FallbackIfUnknownOrNever<TWhere, PrismaLikeWhereInput> : PrismaLikeWhereInput;
310
- type DelegateInclude<TDelegate extends PrismaDelegateLike> = DelegateFindManyArgs<TDelegate> extends {
372
+ type QuerySchemaInclude<TSchema extends ModelQuerySchemaLike> = QuerySchemaFindManyArgs<TSchema> extends {
311
373
  include?: infer TInclude;
312
374
  } ? FallbackIfUnknownOrNever<TInclude, PrismaLikeInclude> : PrismaLikeInclude;
313
- type DelegateOrderBy<TDelegate extends PrismaDelegateLike> = DelegateFindManyArgs<TDelegate> extends {
375
+ type QuerySchemaOrderBy<TSchema extends ModelQuerySchemaLike> = QuerySchemaFindManyArgs<TSchema> extends {
314
376
  orderBy?: infer TOrderBy;
315
377
  } ? FallbackIfUnknownOrNever<TOrderBy, PrismaLikeOrderBy> : PrismaLikeOrderBy;
316
- type DelegateSelect<TDelegate extends PrismaDelegateLike> = DelegateFindManyArgs<TDelegate> extends {
378
+ type QuerySchemaSelect<TSchema extends ModelQuerySchemaLike> = QuerySchemaFindManyArgs<TSchema> extends {
317
379
  select?: infer TSelect;
318
380
  } ? FallbackIfUnknownOrNever<TSelect, PrismaLikeSelect> : PrismaLikeSelect;
319
- type DelegateCreateData<TDelegate extends PrismaDelegateLike> = Parameters<TDelegate['create']>[0] extends {
381
+ type QuerySchemaCreateData<TSchema extends ModelQuerySchemaLike> = Parameters<TSchema['create']>[0] extends {
320
382
  data: infer TData;
321
383
  } ? TData : Record<string, unknown>;
322
- type DelegateUpdateArgs<TDelegate extends PrismaDelegateLike> = Parameters<TDelegate['update']>[0];
323
- type DelegateUpdateData<TDelegate extends PrismaDelegateLike> = DelegateUpdateArgs<TDelegate> extends {
384
+ type QuerySchemaUpdateArgs<TSchema extends ModelQuerySchemaLike> = Parameters<TSchema['update']>[0];
385
+ type QuerySchemaUpdateData<TSchema extends ModelQuerySchemaLike> = QuerySchemaUpdateArgs<TSchema> extends {
324
386
  data: infer TData;
325
387
  } ? FallbackIfUnknownOrNever<TData, Record<string, unknown>> : Record<string, unknown>;
326
- type DelegateUniqueWhere<TDelegate extends PrismaDelegateLike> = DelegateUpdateArgs<TDelegate> extends {
388
+ type QuerySchemaUniqueWhere<TSchema extends ModelQuerySchemaLike> = QuerySchemaUpdateArgs<TSchema> extends {
327
389
  where: infer TWhere;
328
390
  } ? FallbackIfUnknownOrNever<TWhere, Record<string, unknown>> : Record<string, unknown>;
329
- type DelegateRow<TDelegate extends PrismaDelegateLike> = Exclude<Awaited<ReturnType<TDelegate['findFirst']>>, null>;
330
- type DelegateRows<TDelegate extends PrismaDelegateLike> = Awaited<ReturnType<TDelegate['findMany']>>;
391
+ type QuerySchemaRow<TSchema extends ModelQuerySchemaLike> = Exclude<Awaited<ReturnType<TSchema['findFirst']>>, null>;
392
+ type QuerySchemaRows<TSchema extends ModelQuerySchemaLike> = Awaited<ReturnType<TSchema['findMany']>>;
393
+ /**
394
+ * @deprecated Use QuerySchemaFindManyArgs instead.
395
+ */
396
+ type DelegateFindManyArgs<TSchema extends ModelQuerySchemaLike> = QuerySchemaFindManyArgs<TSchema>;
397
+ /**
398
+ * @deprecated Use QuerySchemaWhere instead.
399
+ */
400
+ type DelegateWhere<TSchema extends ModelQuerySchemaLike> = QuerySchemaWhere<TSchema>;
401
+ /**
402
+ * @deprecated Use QuerySchemaInclude instead.
403
+ */
404
+ type DelegateInclude<TSchema extends ModelQuerySchemaLike> = QuerySchemaInclude<TSchema>;
405
+ /**
406
+ * @deprecated Use QuerySchemaOrderBy instead.
407
+ */
408
+ type DelegateOrderBy<TSchema extends ModelQuerySchemaLike> = QuerySchemaOrderBy<TSchema>;
409
+ /**
410
+ * @deprecated Use QuerySchemaSelect instead.
411
+ */
412
+ type DelegateSelect<TSchema extends ModelQuerySchemaLike> = QuerySchemaSelect<TSchema>;
413
+ /**
414
+ * @deprecated Use QuerySchemaCreateData instead.
415
+ */
416
+ type DelegateCreateData<TSchema extends ModelQuerySchemaLike> = QuerySchemaCreateData<TSchema>;
417
+ /**
418
+ * @deprecated Use QuerySchemaUpdateArgs instead.
419
+ */
420
+ type DelegateUpdateArgs<TSchema extends ModelQuerySchemaLike> = QuerySchemaUpdateArgs<TSchema>;
421
+ /**
422
+ * @deprecated Use QuerySchemaUpdateData instead.
423
+ */
424
+ type DelegateUpdateData<TSchema extends ModelQuerySchemaLike> = QuerySchemaUpdateData<TSchema>;
425
+ /**
426
+ * @deprecated Use QuerySchemaUniqueWhere instead.
427
+ */
428
+ type DelegateUniqueWhere<TSchema extends ModelQuerySchemaLike> = QuerySchemaUniqueWhere<TSchema>;
429
+ /**
430
+ * @deprecated Use QuerySchemaRow instead.
431
+ */
432
+ type DelegateRow<TSchema extends ModelQuerySchemaLike> = QuerySchemaRow<TSchema>;
433
+ /**
434
+ * @deprecated Use QuerySchemaRows instead.
435
+ */
436
+ type DelegateRows<TSchema extends ModelQuerySchemaLike> = QuerySchemaRows<TSchema>;
331
437
  type Serializable = Record<string, unknown>;
332
438
  //#endregion
333
439
  //#region src/types/metadata.d.ts
334
440
  type ColumnMap = Record<string, string>;
441
+ interface PivotModelStatic {
442
+ new (attributes?: Record<string, unknown>): any;
443
+ hydrate?: (attributes: Record<string, unknown>) => any;
444
+ }
335
445
  interface ModelMetadata {
336
446
  table: string;
337
447
  primaryKey: string;
@@ -367,6 +477,12 @@ interface BelongsToManyRelationMetadata extends BaseRelationMetadata {
367
477
  relatedPivotKey: string;
368
478
  parentKey: string;
369
479
  relatedKey: string;
480
+ pivotAccessor?: string;
481
+ pivotColumns?: string[];
482
+ pivotCreatedAtColumn?: string;
483
+ pivotUpdatedAtColumn?: string;
484
+ pivotWhere?: QueryCondition;
485
+ pivotModel?: PivotModelStatic;
370
486
  }
371
487
  interface HasOneThroughRelationMetadata extends BaseRelationMetadata {
372
488
  type: 'hasOneThrough';
@@ -411,12 +527,18 @@ interface MorphToManyRelationMetadata extends BaseRelationMetadata {
411
527
  type RelationMetadata = HasOneRelationMetadata | HasManyRelationMetadata | BelongsToRelationMetadata | BelongsToManyRelationMetadata | HasOneThroughRelationMetadata | HasManyThroughRelationMetadata | MorphOneRelationMetadata | MorphManyRelationMetadata | MorphToManyRelationMetadata;
412
528
  //#endregion
413
529
  //#region src/types/db.d.ts
530
+ interface DatabaseTablePersistedMetadataOptions {
531
+ cwd?: string;
532
+ configuredPath?: string;
533
+ strict?: boolean;
534
+ }
414
535
  interface DatabaseTableOptions {
415
536
  adapter?: DatabaseAdapter;
416
537
  primaryKey?: string;
417
538
  columns?: Record<string, string>;
418
539
  softDelete?: SoftDeleteConfig;
419
540
  primaryKeyGeneration?: PrimaryKeyGeneration;
541
+ persistedMetadata?: boolean | DatabaseTablePersistedMetadataOptions;
420
542
  timestampColumns?: TimestampColumnBehavior[];
421
543
  }
422
544
  //#endregion
@@ -513,6 +635,30 @@ declare abstract class Relation<TModel> {
513
635
  * @returns
514
636
  */
515
637
  whereIn<TKey extends keyof ModelAttributes<TModel> & string>(key: TKey, values: ModelAttributes<TModel>[TKey][]): this;
638
+ /**
639
+ * Add a string contains clause to the relationship query.
640
+ *
641
+ * @param key
642
+ * @param value
643
+ * @returns
644
+ */
645
+ whereLike<TKey extends keyof ModelAttributes<TModel> & string>(key: TKey, value: Extract<ModelAttributes<TModel>[TKey], string>): this;
646
+ /**
647
+ * Add a string starts-with clause to the relationship query.
648
+ *
649
+ * @param key
650
+ * @param value
651
+ * @returns
652
+ */
653
+ whereStartsWith<TKey extends keyof ModelAttributes<TModel> & string>(key: TKey, value: Extract<ModelAttributes<TModel>[TKey], string>): this;
654
+ /**
655
+ * Add a string ends-with clause to the relationship query.
656
+ *
657
+ * @param key
658
+ * @param value
659
+ * @returns
660
+ */
661
+ whereEndsWith<TKey extends keyof ModelAttributes<TModel> & string>(key: TKey, value: Extract<ModelAttributes<TModel>[TKey], string>): this;
516
662
  /**
517
663
  * Add an order by clause to the relationship query.
518
664
  *
@@ -644,14 +790,208 @@ declare abstract class Relation<TModel> {
644
790
  declare class BelongsToManyRelation<TParent, TRelated> extends Relation<TRelated> {
645
791
  private readonly parent;
646
792
  private readonly related;
647
- private readonly throughDelegate;
793
+ private readonly throughTable;
648
794
  private readonly foreignPivotKey;
649
795
  private readonly relatedPivotKey;
650
796
  private readonly parentKey;
651
797
  private readonly relatedKey;
798
+ private static readonly queryDecorationMarker;
799
+ private pivotColumns;
800
+ private pivotAccessor;
801
+ private pivotCreatedAtColumn;
802
+ private pivotUpdatedAtColumn;
803
+ private pivotWhere;
804
+ private pivotModel;
805
+ private shouldAttachPivot;
652
806
  constructor(parent: TParent & {
653
807
  getAttribute: (key: string) => unknown;
654
- }, related: RelationshipModelStatic, throughDelegate: string, foreignPivotKey: string, relatedPivotKey: string, parentKey: string, relatedKey: string);
808
+ }, related: RelationshipModelStatic, throughTable: string, foreignPivotKey: string, relatedPivotKey: string, parentKey: string, relatedKey: string);
809
+ /**
810
+ * Specifies additional pivot columns to include on the related models.
811
+ *
812
+ * @param columns The pivot columns to include on the related models.
813
+ * @returns
814
+ */
815
+ withPivot(...columns: Array<string | string[]>): this;
816
+ /**
817
+ * Specifies that the pivot table contains timestamp columns and optionally
818
+ * allows customizing the names of those columns.
819
+ *
820
+ * @param createdAtColumn The name of the "created at" timestamp column.
821
+ * @param updatedAtColumn The name of the "updated at" timestamp column.
822
+ * @returns The current instance of the relationship.
823
+ */
824
+ withTimestamps(createdAtColumn?: string, updatedAtColumn?: string): this;
825
+ /**
826
+ * Specifies a custom accessor name for the pivot attributes on the related models.
827
+ * By default, pivot attributes are accessible via the `pivot` property on the
828
+ * related models.
829
+ *
830
+ * @param accessor The custom accessor name for the pivot attributes.
831
+ * @returns The current instance of the relationship.
832
+ */
833
+ as(accessor: string): this;
834
+ /**
835
+ * Specifies a custom pivot model to use for the pivot records. The pivot model can
836
+ * be used to define custom behavior or methods on the pivot records, as well as to
837
+ * specify a custom hydration method for the pivot records.
838
+ *
839
+ * @param pivotModel The custom pivot model to use.
840
+ * @returns The current instance of the relationship.
841
+ */
842
+ using(pivotModel: PivotModelStatic): this;
843
+ /**
844
+ * Adds a "pivot column" condition to the relationship query.
845
+ *
846
+ * @param column The pivot column to apply the condition on.
847
+ * @param value The value to compare the pivot column against.
848
+ */
849
+ wherePivot(column: string, value: unknown): this;
850
+ /**
851
+ * Adds a "pivot column" condition to the relationship query.
852
+ *
853
+ * @param column The pivot column to apply the condition on.
854
+ * @param operator The operator to use for the comparison.
855
+ * @param value The value to compare the pivot column against.
856
+ */
857
+ wherePivot(column: string, operator: QueryComparisonOperator, value: unknown): this;
858
+ /**
859
+ * Adds a "pivot column in" condition to the relationship query.
860
+ *
861
+ * @param column
862
+ * @param values
863
+ * @returns
864
+ */
865
+ wherePivotNotIn(column: string, values: unknown[]): this;
866
+ /**
867
+ * Adds a "pivot column between" condition to the relationship query.
868
+ *
869
+ * @param column
870
+ * @param range
871
+ * @returns
872
+ */
873
+ wherePivotBetween(column: string, range: [unknown, unknown]): this;
874
+ /**
875
+ * Adds a "pivot column not between" condition to the relationship query.
876
+ *
877
+ * @param column
878
+ * @param range
879
+ * @returns
880
+ */
881
+ wherePivotNotBetween(column: string, range: [unknown, unknown]): this;
882
+ /**
883
+ * Adds a "pivot column is null" condition to the relationship query.
884
+ *
885
+ * @param column
886
+ * @returns
887
+ */
888
+ wherePivotNull(column: string): this;
889
+ /**
890
+ * Adds a "pivot column is not null" condition to the relationship query.
891
+ *
892
+ * @param column
893
+ * @returns
894
+ */
895
+ wherePivotNotNull(column: string): this;
896
+ private addPivotWhere;
897
+ private makePivotComparison;
898
+ private buildPivotWhere;
899
+ private buildPivotTarget;
900
+ private buildRelatedPivotCondition;
901
+ private buildPivotMutationWhere;
902
+ private normalizeIdentifierValue;
903
+ private isPlainObject;
904
+ private isModelLike;
905
+ private normalizeRelatedItems;
906
+ private normalizeSyncEntries;
907
+ private resolveParentPivotValue;
908
+ private resolveRelatedPivotValue;
909
+ private buildPivotInsertValues;
910
+ private attachPivotToSingleResult;
911
+ private insertPivotRow;
912
+ private selectPivotRows;
913
+ private deletePivotRows;
914
+ private buildPivotUpdateValues;
915
+ private updatePivotRows;
916
+ /**
917
+ * Creates a new instance of the related model with the given attributes and attaches
918
+ * pivot attributes if pivot attributes should be included.
919
+ *
920
+ * @param attributes The attributes to initialize the related model with.
921
+ * @returns A new instance of the related model.
922
+ */
923
+ make(attributes?: Record<string, unknown>): TRelated;
924
+ /**
925
+ * Creates a new related model record with the given attributes, creates a pivot record
926
+ * with the given pivot attributes, and attaches pivot attributes if pivot attributes
927
+ * should be included.
928
+ *
929
+ * @param attributes The attributes to initialize the related model with.
930
+ * @param pivotAttributes The attributes to initialize the pivot record with.
931
+ * @returns A new instance of the related model with pivot attributes attached.
932
+ */
933
+ create(attributes?: Record<string, unknown>, pivotAttributes?: Record<string, unknown>): Promise<TRelated>;
934
+ /**
935
+ * Saves a related model record, creates a pivot record with the given pivot attributes
936
+ * if the related model was not previously persisted, and attaches pivot attributes if
937
+ * pivot attributes should be included.
938
+ *
939
+ * @param related The related model instance to save.
940
+ * @param pivotAttributes The attributes to initialize the pivot record with.
941
+ * @returns A new instance of the related model with pivot attributes attached.
942
+ */
943
+ save(related: TRelated, pivotAttributes?: Record<string, unknown>): Promise<TRelated>;
944
+ /**
945
+ * Attaches one or more related model records to the parent model by creating pivot
946
+ * records with the given pivot attributes if pivot attributes should be included.
947
+ *
948
+ * @param related The related model instance(s) to attach.
949
+ * @param pivotAttributes The attributes to initialize the pivot record with.
950
+ * @returns The number of related model records attached.
951
+ */
952
+ attach(related: TRelated | unknown | Array<TRelated | unknown>, pivotAttributes?: Record<string, unknown>): Promise<number>;
953
+ /**
954
+ * Detaches one or more related model records from the parent model by deleting
955
+ * matching pivot rows. When no related value is provided, all matching pivot rows
956
+ * for the parent are removed.
957
+ *
958
+ * @param related
959
+ * @returns
960
+ */
961
+ detach(related?: TRelated | unknown | Array<TRelated | unknown>): Promise<number>;
962
+ /**
963
+ * Synchronizes the pivot table so only the provided related values remain attached.
964
+ * Existing matching rows can receive updated pivot attributes during the operation.
965
+ *
966
+ * @param related
967
+ * @param pivotAttributes
968
+ * @returns
969
+ */
970
+ sync(related: TRelated | unknown | Array<TRelated | unknown> | Record<string, Record<string, unknown>>, pivotAttributes?: Record<string, unknown>): Promise<{
971
+ attached: number;
972
+ detached: number;
973
+ updated: number;
974
+ }>;
975
+ private shouldAttachPivotAttributes;
976
+ private getPivotColumnSelection;
977
+ /**
978
+ * Creates a pivot record from a row of data.
979
+ *
980
+ * @param row The row of data containing pivot attributes.
981
+ * @returns The pivot record.
982
+ */
983
+ private createPivotRecord;
984
+ /**
985
+ * Attaches pivot attributes to the related models if pivot attributes should be included.
986
+ *
987
+ * @param results
988
+ * @param pivotRows
989
+ * @returns
990
+ */
991
+ private attachPivotToResults;
992
+ private attachPivotToModel;
993
+ private decorateQueryBuilder;
994
+ private loadPivotRowsForParent;
655
995
  /**
656
996
  * Build the relationship query.
657
997
  *
@@ -760,14 +1100,14 @@ declare class HasManyRelation<TParent, TRelated> extends Relation<TRelated> {
760
1100
  declare class HasManyThroughRelation<TParent, TRelated> extends Relation<TRelated> {
761
1101
  private readonly parent;
762
1102
  private readonly related;
763
- private readonly throughDelegate;
1103
+ private readonly throughTable;
764
1104
  private readonly firstKey;
765
1105
  private readonly secondKey;
766
1106
  private readonly localKey;
767
1107
  private readonly secondLocalKey;
768
1108
  constructor(parent: TParent & {
769
1109
  getAttribute: (key: string) => unknown;
770
- }, related: RelationshipModelStatic, throughDelegate: string, firstKey: string, secondKey: string, localKey: string, secondLocalKey: string);
1110
+ }, related: RelationshipModelStatic, throughTable: string, firstKey: string, secondKey: string, localKey: string, secondLocalKey: string);
771
1111
  /**
772
1112
  * Build the relationship query.
773
1113
  *
@@ -824,14 +1164,14 @@ declare class HasOneRelation<TParent, TRelated> extends SingleResultRelation<TPa
824
1164
  declare class HasOneThroughRelation<TParent, TRelated> extends SingleResultRelation<TParent & {
825
1165
  getAttribute: (key: string) => unknown;
826
1166
  }, TRelated> {
827
- private readonly throughDelegate;
1167
+ private readonly throughTable;
828
1168
  private readonly firstKey;
829
1169
  private readonly secondKey;
830
1170
  private readonly localKey;
831
1171
  private readonly secondLocalKey;
832
1172
  constructor(parent: TParent & {
833
1173
  getAttribute: (key: string) => unknown;
834
- }, related: RelatedModelClass<TRelated>, throughDelegate: string, firstKey: string, secondKey: string, localKey: string, secondLocalKey: string);
1174
+ }, related: RelatedModelClass<TRelated>, throughTable: string, firstKey: string, secondKey: string, localKey: string, secondLocalKey: string);
835
1175
  /**
836
1176
  * Build the relationship query.
837
1177
  *
@@ -917,14 +1257,14 @@ declare class MorphOneRelation<TParent, TRelated> extends SingleResultRelation<T
917
1257
  declare class MorphToManyRelation<TParent, TRelated> extends Relation<TRelated> {
918
1258
  private readonly parent;
919
1259
  private readonly related;
920
- private readonly throughDelegate;
1260
+ private readonly throughTable;
921
1261
  private readonly morphName;
922
1262
  private readonly relatedPivotKey;
923
1263
  private readonly parentKey;
924
1264
  private readonly relatedKey;
925
1265
  constructor(parent: TParent & {
926
1266
  getAttribute: (key: string) => unknown;
927
- }, related: RelationshipModelStatic, throughDelegate: string, morphName: string, relatedPivotKey: string, parentKey: string, relatedKey: string);
1267
+ }, related: RelationshipModelStatic, throughTable: string, morphName: string, relatedPivotKey: string, parentKey: string, relatedKey: string);
928
1268
  /**
929
1269
  * Build the relationship query.
930
1270
  *
@@ -1045,13 +1385,20 @@ declare const defineFactory: <TModel, TAttributes extends FactoryAttributes = Pa
1045
1385
  * @author Legacy (3m1n3nc3)
1046
1386
  * @since 0.1.0
1047
1387
  */
1048
- declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string, unknown> | string = Record<string, any>, TAttributes extends Record<string, unknown> = ModelAttributesOf<TSchema>> {
1388
+ declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<string, unknown> | string = Record<string, any>, TAttributes extends Record<string, unknown> = ModelAttributesOf<TSchema>> {
1049
1389
  private static readonly lifecycleStates;
1050
1390
  private static readonly emittedDeprecationWarnings;
1051
1391
  private static eventsSuppressed;
1052
1392
  protected static factoryClass?: new () => ModelFactory<any, any>;
1053
1393
  protected static adapter?: DatabaseAdapter;
1394
+ /**
1395
+ * Compatibility-only runtime state retained for 2.x transition window.
1396
+ * New setups should use adapter-first setup via `setAdapter(...)` or runtime config.
1397
+ */
1054
1398
  protected static client: Record<string, unknown>;
1399
+ /**
1400
+ * @deprecated Use `table` instead. This remains as a compatibility alias during the transition.
1401
+ */
1055
1402
  protected static delegate: string;
1056
1403
  protected static table?: string;
1057
1404
  protected static primaryKey: string;
@@ -1072,7 +1419,8 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1072
1419
  constructor(attributes?: Record<string, unknown>);
1073
1420
  private static emitDeprecationWarning;
1074
1421
  /**
1075
- * Set the Prisma client delegates for all models.
1422
+ * Compatibility-only runtime API retained for the 2.x transition window.
1423
+ * This is no longer part of the supported runtime bootstrap path.
1076
1424
  *
1077
1425
  * @deprecated Use Model.setAdapter(createPrismaDatabaseAdapter(...)) or another
1078
1426
  * adapter-first bootstrap path instead.
@@ -1080,6 +1428,9 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1080
1428
  * @param client
1081
1429
  */
1082
1430
  protected static setClient(client: Record<string, unknown>): void;
1431
+ /**
1432
+ * Primary runtime API: bind an adapter directly to the model class.
1433
+ */
1083
1434
  static setAdapter(adapter?: DatabaseAdapter): void;
1084
1435
  static getTable(): string;
1085
1436
  static getPrimaryKey(): string;
@@ -1166,17 +1517,19 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1166
1517
  * @param options
1167
1518
  * @returns
1168
1519
  */
1169
- static transaction<T>(callback: (client: PrismaClientLike) => T | Promise<T>, options?: PrismaTransactionOptions): Promise<Awaited<T>>;
1520
+ static transaction<T>(callback: (context: TransactionContext) => T | Promise<T>, options?: TransactionOptions): Promise<Awaited<T>>;
1170
1521
  /**
1171
- * Get the Prisma delegate for the model.
1522
+ * Compatibility-only runtime API retained for 2.x migration support.
1523
+ * New runtime code should prefer `getAdapter()` and adapter-backed execution.
1524
+ *
1172
1525
  * If a delegate name is provided, it will attempt to resolve that delegate.
1173
- * Otherwise, it will attempt to resolve a delegate based on the model's name or
1526
+ * Otherwise, it will attempt to resolve a compatibility schema based on the model's name or
1174
1527
  * the static `delegate` property.
1175
1528
  *
1176
1529
  * @param delegate
1177
1530
  * @returns
1178
1531
  */
1179
- static getDelegate<TDelegate extends PrismaDelegateLike = PrismaDelegateLike>(delegate?: string): TDelegate;
1532
+ static getDelegate<TDelegate extends ModelQuerySchemaLike = ModelQuerySchemaLike>(delegate?: string): TDelegate;
1180
1533
  static getAdapter(): DatabaseAdapter | undefined;
1181
1534
  /**
1182
1535
  * Get a new query builder instance for the model.
@@ -1184,7 +1537,7 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1184
1537
  * @param this
1185
1538
  * @returns
1186
1539
  */
1187
- static query<TThis extends abstract new (attributes?: Record<string, unknown>) => Model<any>, TModel extends InstanceType<TThis> = InstanceType<TThis>, TDelegate extends PrismaDelegateLike = DelegateForModelSchema<TModel extends Model<infer TSchema, any> ? TSchema : Record<string, any>, TModel extends Model<any, infer TAttributes> ? TAttributes : Record<string, any>>>(this: TThis): QueryBuilder<TModel, TDelegate>;
1540
+ static query<TThis extends abstract new (attributes?: Record<string, unknown>) => unknown, TModel extends Model<any, any> = InstanceType<TThis> & Model<any, any>, TDelegate extends ModelQuerySchemaLike = QuerySchemaForModel<TModel extends Model<infer TSchema, any> ? TSchema : Record<string, any>, TModel extends Model<any, infer TAttributes> ? TAttributes : Record<string, any>>>(this: TThis): QueryBuilder<TModel, TDelegate>;
1188
1541
  /**
1189
1542
  * Boot hook for subclasses to register scopes or perform one-time setup.
1190
1543
  */
@@ -1199,14 +1552,14 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1199
1552
  * @param this
1200
1553
  * @returns
1201
1554
  */
1202
- static withTrashed<TThis extends abstract new (attributes?: Record<string, unknown>) => Model<any>, TModel extends InstanceType<TThis> = InstanceType<TThis>, TDelegate extends PrismaDelegateLike = DelegateForModelSchema<TModel extends Model<infer TSchema, any> ? TSchema : Record<string, any>, TModel extends Model<any, infer TAttributes> ? TAttributes : Record<string, any>>>(this: TThis): QueryBuilder<TModel, TDelegate>;
1555
+ static withTrashed<TThis extends abstract new (attributes?: Record<string, unknown>) => unknown, TModel extends Model<any, any> = InstanceType<TThis> & Model<any, any>, TDelegate extends ModelQuerySchemaLike = QuerySchemaForModel<TModel extends Model<infer TSchema, any> ? TSchema : Record<string, any>, TModel extends Model<any, infer TAttributes> ? TAttributes : Record<string, any>>>(this: TThis): QueryBuilder<TModel, TDelegate>;
1203
1556
  /**
1204
1557
  * Get a query builder instance that only includes soft-deleted records.
1205
1558
  *
1206
1559
  * @param this
1207
1560
  * @returns
1208
1561
  */
1209
- static onlyTrashed<TThis extends abstract new (attributes?: Record<string, unknown>) => Model<any>, TModel extends InstanceType<TThis> = InstanceType<TThis>, TDelegate extends PrismaDelegateLike = DelegateForModelSchema<TModel extends Model<infer TSchema, any> ? TSchema : Record<string, any>, TModel extends Model<any, infer TAttributes> ? TAttributes : Record<string, any>>>(this: TThis): QueryBuilder<TModel, TDelegate>;
1562
+ static onlyTrashed<TThis extends abstract new (attributes?: Record<string, unknown>) => unknown, TModel extends Model<any, any> = InstanceType<TThis> & Model<any, any>, TDelegate extends ModelQuerySchemaLike = QuerySchemaForModel<TModel extends Model<infer TSchema, any> ? TSchema : Record<string, any>, TModel extends Model<any, infer TAttributes> ? TAttributes : Record<string, any>>>(this: TThis): QueryBuilder<TModel, TDelegate>;
1210
1563
  /**
1211
1564
  * Get a query builder instance that excludes soft-deleted records.
1212
1565
  * This is the default behavior of the query builder, but this method can be used
@@ -1217,7 +1570,7 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1217
1570
  * @param args
1218
1571
  * @returns
1219
1572
  */
1220
- static scope<TThis extends abstract new (attributes?: Record<string, unknown>) => Model<any>, TModel extends InstanceType<TThis> = InstanceType<TThis>, TDelegate extends PrismaDelegateLike = DelegateForModelSchema<TModel extends Model<infer TSchema, any> ? TSchema : Record<string, any>, TModel extends Model<any, infer TAttributes> ? TAttributes : Record<string, any>>>(this: TThis, name: string, ...args: unknown[]): QueryBuilder<TModel, TDelegate>;
1573
+ static scope<TThis extends abstract new (attributes?: Record<string, unknown>) => unknown, TModel extends Model<any, any> = InstanceType<TThis> & Model<any, any>, TDelegate extends ModelQuerySchemaLike = QuerySchemaForModel<TModel extends Model<infer TSchema, any> ? TSchema : Record<string, any>, TModel extends Model<any, infer TAttributes> ? TAttributes : Record<string, any>>>(this: TThis, name: string, ...args: unknown[]): QueryBuilder<TModel, TDelegate>;
1221
1574
  /**
1222
1575
  * Get the soft delete configuration for the model, including whether
1223
1576
  * soft deletes are enabled and the name of the deleted at column.
@@ -1248,7 +1601,7 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1248
1601
  * @param attributes
1249
1602
  * @returns
1250
1603
  */
1251
- static hydrateRetrieved<TModel>(this: ModelStatic<TModel, PrismaDelegateLike>, attributes: Record<string, unknown>): Promise<TModel>;
1604
+ static hydrateRetrieved<TModel>(this: ModelStatic<TModel, ModelQuerySchemaLike>, attributes: Record<string, unknown>): Promise<TModel>;
1252
1605
  /**
1253
1606
  * Hydrate multiple model instances and dispatch the retrieved lifecycle event for each.
1254
1607
  *
@@ -1256,7 +1609,7 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1256
1609
  * @param attributes
1257
1610
  * @returns
1258
1611
  */
1259
- static hydrateManyRetrieved<TModel>(this: ModelStatic<TModel, PrismaDelegateLike>, attributes: Record<string, unknown>[]): Promise<TModel[]>;
1612
+ static hydrateManyRetrieved<TModel>(this: ModelStatic<TModel, ModelQuerySchemaLike>, attributes: Record<string, unknown>[]): Promise<TModel[]>;
1260
1613
  /**
1261
1614
  * Fill the model's attributes from a plain object, using the
1262
1615
  * setAttribute method to ensure that mutators and casts are applied.
@@ -1272,7 +1625,7 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1272
1625
  * @param key
1273
1626
  * @returns
1274
1627
  */
1275
- getAttribute<TKey extends keyof TAttributes & string>(key: TKey): TAttributes[TKey];
1628
+ getAttribute<TSelf extends this, TKey extends string>(this: TSelf, key: TKey): ModelAttributeValue<TSelf, TAttributes, TKey>;
1276
1629
  getAttribute(key: string): unknown;
1277
1630
  /**
1278
1631
  * Set the value of an attribute, applying any set mutators or casts if defined.
@@ -1281,7 +1634,7 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1281
1634
  * @param value
1282
1635
  * @returns
1283
1636
  */
1284
- setAttribute<TKey extends keyof TAttributes & string>(key: TKey, value: TAttributes[TKey]): this;
1637
+ setAttribute<TSelf extends this, TKey extends string>(this: TSelf, key: TKey, value: ModelAttributeValue<TSelf, TAttributes, TKey>): this;
1285
1638
  setAttribute(key: string, value: unknown): this;
1286
1639
  /**
1287
1640
  * Save the model to the database.
@@ -1454,38 +1807,38 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1454
1807
  * Define a belongs to many relationship.
1455
1808
  *
1456
1809
  * @param related
1457
- * @param throughDelegate
1810
+ * @param throughTable
1458
1811
  * @param foreignPivotKey
1459
1812
  * @param relatedPivotKey
1460
1813
  * @param parentKey
1461
1814
  * @param relatedKey
1462
1815
  * @returns
1463
1816
  */
1464
- protected belongsToMany<TRelatedClass extends RelatedModelClass>(related: TRelatedClass, throughDelegate: string, foreignPivotKey: string, relatedPivotKey: string, parentKey?: string, relatedKey?: string): BelongsToManyRelation<this, InstanceType<TRelatedClass>>;
1817
+ protected belongsToMany<TRelatedClass extends RelatedModelClass>(related: TRelatedClass, throughTable: string, foreignPivotKey: string, relatedPivotKey: string, parentKey?: string, relatedKey?: string): BelongsToManyRelation<this, InstanceType<TRelatedClass>>;
1465
1818
  /**
1466
1819
  * Define a has one through relationship.
1467
1820
  *
1468
1821
  * @param related
1469
- * @param throughDelegate
1822
+ * @param throughTable
1470
1823
  * @param firstKey
1471
1824
  * @param secondKey
1472
1825
  * @param localKey
1473
1826
  * @param secondLocalKey
1474
1827
  * @returns
1475
1828
  */
1476
- protected hasOneThrough<TRelatedClass extends RelatedModelClass>(related: TRelatedClass, throughDelegate: string, firstKey: string, secondKey: string, localKey?: string, secondLocalKey?: string): HasOneThroughRelation<this, InstanceType<TRelatedClass>>;
1829
+ protected hasOneThrough<TRelatedClass extends RelatedModelClass>(related: TRelatedClass, throughTable: string, firstKey: string, secondKey: string, localKey?: string, secondLocalKey?: string): HasOneThroughRelation<this, InstanceType<TRelatedClass>>;
1477
1830
  /**
1478
1831
  * Define a has many through relationship.
1479
1832
  *
1480
1833
  * @param related
1481
- * @param throughDelegate
1834
+ * @param throughTable
1482
1835
  * @param firstKey
1483
1836
  * @param secondKey
1484
1837
  * @param localKey
1485
1838
  * @param secondLocalKey
1486
1839
  * @returns
1487
1840
  */
1488
- protected hasManyThrough<TRelatedClass extends RelatedModelClass>(related: TRelatedClass, throughDelegate: string, firstKey: string, secondKey: string, localKey?: string, secondLocalKey?: string): HasManyThroughRelation<this, InstanceType<TRelatedClass>>;
1841
+ protected hasManyThrough<TRelatedClass extends RelatedModelClass>(related: TRelatedClass, throughTable: string, firstKey: string, secondKey: string, localKey?: string, secondLocalKey?: string): HasManyThroughRelation<this, InstanceType<TRelatedClass>>;
1489
1842
  /**
1490
1843
  * Define a polymorphic one to one relationship.
1491
1844
  *
@@ -1508,14 +1861,14 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1508
1861
  * Define a polymorphic many to many relationship.
1509
1862
  *
1510
1863
  * @param related
1511
- * @param throughDelegate
1864
+ * @param throughTable
1512
1865
  * @param morphName
1513
1866
  * @param relatedPivotKey
1514
1867
  * @param parentKey
1515
1868
  * @param relatedKey
1516
1869
  * @returns
1517
1870
  */
1518
- protected morphToMany<TRelatedClass extends RelatedModelClass>(related: TRelatedClass, throughDelegate: string, morphName: string, relatedPivotKey: string, parentKey?: string, relatedKey?: string): MorphToManyRelation<this, InstanceType<TRelatedClass>>;
1871
+ protected morphToMany<TRelatedClass extends RelatedModelClass>(related: TRelatedClass, throughTable: string, morphName: string, relatedPivotKey: string, parentKey?: string, relatedKey?: string): MorphToManyRelation<this, InstanceType<TRelatedClass>>;
1519
1872
  /**
1520
1873
  * Resolve a get mutator method for a given attribute key, if it exists.
1521
1874
  *
@@ -1643,7 +1996,7 @@ type Simplify<TValue> = { [TKey in keyof TValue]: TValue[TKey] } & {};
1643
1996
  type ConventionalAutoManagedKeys = 'id' | 'createdAt' | 'updatedAt' | 'deletedAt';
1644
1997
  type SingularKey<T extends string> = LowercaseString<T> extends `${infer Base}s` ? Base : LowercaseString<T>;
1645
1998
  type PluralKey<T extends string> = `${SingularKey<T>}s`;
1646
- type PrismaClientDelegates = { [TKey in keyof PrismaClient as PrismaClient[TKey] extends PrismaDelegateLike ? TKey : never]: PrismaClient[TKey] };
1999
+ type PrismaClientDelegates = { [TKey in keyof PrismaClient as PrismaClient[TKey] extends ModelQuerySchemaLike ? TKey : never]: PrismaClient[TKey] };
1647
2000
  type DelegateFromPrismaClient<TKey extends string> = LowercaseString<TKey> extends keyof PrismaClientDelegates ? PrismaClientDelegates[LowercaseString<TKey>] : SingularKey<TKey> extends keyof PrismaClientDelegates ? PrismaClientDelegates[SingularKey<TKey>] : PluralKey<TKey> extends keyof PrismaClientDelegates ? PrismaClientDelegates[PluralKey<TKey>] : never;
1648
2001
  type AttributeScalarFilter<TValue> = Omit<PrismaLikeScalarFilter, 'equals' | 'not' | 'in' | 'notIn' | 'lt' | 'lte' | 'gt' | 'gte' | 'contains' | 'startsWith' | 'endsWith'> & {
1649
2002
  equals?: TValue;
@@ -1669,7 +2022,7 @@ type RequiredCreateKeys<TAttributes extends Record<string, unknown>> = Exclude<{
1669
2022
  type AtLeastOne<TValue extends Record<string, unknown>> = { [TKey in keyof TValue]-?: Required<Pick<TValue, TKey>> & Partial<Omit<TValue, TKey>> }[keyof TValue];
1670
2023
  type AttributeCreateInput<TAttributes extends Record<string, unknown>> = Simplify<Pick<TAttributes, RequiredCreateKeys<TAttributes>> & Partial<Omit<TAttributes, RequiredCreateKeys<TAttributes>>>>;
1671
2024
  type AttributeUpdateInput<TAttributes extends Record<string, unknown>> = AtLeastOne<Partial<TAttributes>>;
1672
- interface AttributeSchemaDelegate<TAttributes extends Record<string, unknown>> extends PrismaDelegateLike {
2025
+ interface AttributeQuerySchema<TAttributes extends Record<string, unknown>> extends ModelQuerySchemaLike {
1673
2026
  findMany: (args?: {
1674
2027
  where?: AttributeWhereInput<TAttributes>;
1675
2028
  include?: PrismaLikeInclude;
@@ -1703,11 +2056,27 @@ interface AttributeSchemaDelegate<TAttributes extends Record<string, unknown>> e
1703
2056
  where?: AttributeWhereInput<TAttributes>;
1704
2057
  }) => Promise<number>;
1705
2058
  }
1706
- type DelegateForModelSchema<TSchema extends PrismaDelegateLike | Record<string, unknown> | string, TAttributes extends Record<string, unknown> = ModelAttributesOf<TSchema>> = TSchema extends PrismaDelegateLike ? TSchema : TSchema extends string ? DelegateFromPrismaClient<TSchema> extends PrismaDelegateLike ? DelegateFromPrismaClient<TSchema> : PrismaDelegateLike : AttributeSchemaDelegate<TAttributes>;
1707
- type ModelAttributesOf<TSchema extends PrismaDelegateLike | Record<string, unknown> | string> = TSchema extends PrismaDelegateLike ? DelegateRow<TSchema> extends Record<string, unknown> ? DelegateRow<TSchema> : Record<string, any> : TSchema extends string ? DelegateFromPrismaClient<TSchema> extends PrismaDelegateLike ? DelegateRow<DelegateFromPrismaClient<TSchema>> extends Record<string, unknown> ? DelegateRow<DelegateFromPrismaClient<TSchema>> : Record<string, any> : Record<string, any> : TSchema extends Record<string, unknown> ? TSchema : Record<string, any>;
2059
+ type QuerySchemaForModel<TSchema extends ModelQuerySchemaLike | Record<string, unknown> | string, TAttributes extends Record<string, unknown> = ModelAttributesOf<TSchema>> = TSchema extends ModelQuerySchemaLike ? TSchema : TSchema extends string ? DelegateFromPrismaClient<TSchema> extends ModelQuerySchemaLike ? DelegateFromPrismaClient<TSchema> : ModelQuerySchemaLike : AttributeQuerySchema<TAttributes>;
2060
+ /**
2061
+ * @deprecated Use AttributeQuerySchema instead.
2062
+ */
2063
+ type AttributeSchemaDelegate<TAttributes extends Record<string, unknown>> = AttributeQuerySchema<TAttributes>;
2064
+ /**
2065
+ * @deprecated Use QuerySchemaForModel instead.
2066
+ */
2067
+ type DelegateForModelSchema<TSchema extends ModelQuerySchemaLike | Record<string, unknown> | string, TAttributes extends Record<string, unknown> = ModelAttributesOf<TSchema>> = QuerySchemaForModel<TSchema, TAttributes>;
2068
+ type ModelAttributesOf<TSchema extends ModelQuerySchemaLike | Record<string, unknown> | string> = TSchema extends ModelQuerySchemaLike ? QuerySchemaRow<TSchema> extends Record<string, unknown> ? QuerySchemaRow<TSchema> : Record<string, any> : TSchema extends string ? DelegateFromPrismaClient<TSchema> extends ModelQuerySchemaLike ? QuerySchemaRow<DelegateFromPrismaClient<TSchema>> extends Record<string, unknown> ? QuerySchemaRow<DelegateFromPrismaClient<TSchema>> : Record<string, any> : Record<string, any> : TSchema extends Record<string, unknown> ? TSchema : Record<string, any>;
1708
2069
  type ModelAttributes<TModel> = TModel extends Model<any, infer TAttributes> ? TAttributes : Record<string, any>;
1709
- type ModelCreateData<TModel, TDelegate extends PrismaDelegateLike> = TModel extends Model<any, infer TAttributes> ? TDelegate extends AttributeSchemaDelegate<TAttributes> ? AttributeCreateInput<TAttributes> : DelegateCreateData<TDelegate> : DelegateCreateData<TDelegate>;
1710
- type ModelUpdateData<TModel, TDelegate extends PrismaDelegateLike> = TModel extends Model<any, infer TAttributes> ? TDelegate extends AttributeSchemaDelegate<TAttributes> ? AttributeUpdateInput<TAttributes> : DelegateUpdateData<TDelegate> : DelegateUpdateData<TDelegate>;
2070
+ type BaseModelInstance = Model<any, any>;
2071
+ type ModelDeclaredAttributeKey<TModel> = { [TKey in keyof TModel & string]: TKey extends keyof BaseModelInstance ? never : TModel[TKey] extends ((...args: any[]) => any) ? never : TKey }[keyof TModel & string];
2072
+ type RelationshipResultProvider<TResult = unknown> = {
2073
+ getResults: (...args: any[]) => Promise<TResult>;
2074
+ };
2075
+ type ModelRelationshipKey<TModel> = { [TKey in keyof TModel & string]: TKey extends keyof BaseModelInstance ? never : TModel[TKey] extends ((...args: any[]) => infer TReturn) ? Parameters<TModel[TKey]> extends [] ? TReturn extends RelationshipResultProvider<any> ? TKey : never : never : never }[keyof TModel & string];
2076
+ type ModelRelationshipResult<TModel, TKey extends ModelRelationshipKey<TModel>> = TModel[TKey] extends ((...args: any[]) => infer TReturn) ? TReturn extends RelationshipResultProvider<infer TResult> ? TResult : never : never;
2077
+ type ModelAttributeValue<TModel, TAttributes extends Record<string, unknown>, TKey extends string> = TKey extends ModelRelationshipKey<TModel> ? ModelRelationshipResult<TModel, TKey> : TKey extends ModelDeclaredAttributeKey<TModel> ? TModel[TKey] : TKey extends keyof TAttributes & string ? TAttributes[TKey] : unknown;
2078
+ type ModelCreateData<TModel, TDelegate extends ModelQuerySchemaLike> = TModel extends Model<any, infer TAttributes> ? TDelegate extends AttributeQuerySchema<TAttributes> ? AttributeCreateInput<TAttributes> : QuerySchemaCreateData<TDelegate> : QuerySchemaCreateData<TDelegate>;
2079
+ type ModelUpdateData<TModel, TDelegate extends ModelQuerySchemaLike> = TModel extends Model<any, infer TAttributes> ? TDelegate extends AttributeQuerySchema<TAttributes> ? AttributeUpdateInput<TAttributes> : QuerySchemaUpdateData<TDelegate> : QuerySchemaUpdateData<TDelegate>;
1711
2080
  type RelatedModelClass<TInstance = unknown> = (abstract new (attributes?: Record<string, unknown>) => TInstance) & RelationshipModelStatic;
1712
2081
  type GlobalScope = (query: QueryBuilder<any, any>) => QueryBuilder<any, any> | void;
1713
2082
  type ModelEventName = 'retrieved' | 'saving' | 'saved' | 'creating' | 'created' | 'updating' | 'updated' | 'deleting' | 'deleted' | 'restoring' | 'restored' | 'forceDeleting' | 'forceDeleted';
@@ -1810,7 +2179,7 @@ declare class Paginator<T> {
1810
2179
  * @author Legacy (3m1n3nc3)
1811
2180
  * @since 0.1.0
1812
2181
  */
1813
- declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = PrismaDelegateLike> {
2182
+ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = ModelQuerySchemaLike> {
1814
2183
  private readonly model;
1815
2184
  private readonly adapter?;
1816
2185
  private queryWhere?;
@@ -1840,28 +2209,28 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
1840
2209
  * @param where
1841
2210
  * @returns
1842
2211
  */
1843
- where(where: DelegateWhere<TDelegate>): this;
2212
+ where(where: QuerySchemaWhere<TDelegate>): this;
1844
2213
  /**
1845
2214
  * Adds an OR where clause to the query.
1846
2215
  *
1847
2216
  * @param where
1848
2217
  * @returns
1849
2218
  */
1850
- orWhere(where: DelegateWhere<TDelegate>): this;
2219
+ orWhere(where: QuerySchemaWhere<TDelegate>): this;
1851
2220
  /**
1852
2221
  * Adds a NOT where clause to the query.
1853
2222
  *
1854
2223
  * @param where
1855
2224
  * @returns
1856
2225
  */
1857
- whereNot(where: DelegateWhere<TDelegate>): this;
2226
+ whereNot(where: QuerySchemaWhere<TDelegate>): this;
1858
2227
  /**
1859
2228
  * Adds an OR NOT where clause to the query.
1860
2229
  *
1861
2230
  * @param where
1862
2231
  * @returns
1863
2232
  */
1864
- orWhereNot(where: DelegateWhere<TDelegate>): this;
2233
+ orWhereNot(where: QuerySchemaWhere<TDelegate>): this;
1865
2234
  /**
1866
2235
  * Adds a null check for a key.
1867
2236
  *
@@ -1933,6 +2302,30 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
1933
2302
  * @returns
1934
2303
  */
1935
2304
  whereNotIn<TKey extends keyof ModelAttributes<TModel> & string>(key: TKey, values: ModelAttributes<TModel>[TKey][]): this;
2305
+ /**
2306
+ * Adds a string contains clause for a single attribute key.
2307
+ *
2308
+ * @param key
2309
+ * @param value
2310
+ * @returns
2311
+ */
2312
+ whereLike<TKey extends keyof ModelAttributes<TModel> & string>(key: TKey, value: Extract<ModelAttributes<TModel>[TKey], string>): this;
2313
+ /**
2314
+ * Adds a string starts-with clause for a single attribute key.
2315
+ *
2316
+ * @param key
2317
+ * @param value
2318
+ * @returns
2319
+ */
2320
+ whereStartsWith<TKey extends keyof ModelAttributes<TModel> & string>(key: TKey, value: Extract<ModelAttributes<TModel>[TKey], string>): this;
2321
+ /**
2322
+ * Adds a string ends-with clause for a single attribute key.
2323
+ *
2324
+ * @param key
2325
+ * @param value
2326
+ * @returns
2327
+ */
2328
+ whereEndsWith<TKey extends keyof ModelAttributes<TModel> & string>(key: TKey, value: Extract<ModelAttributes<TModel>[TKey], string>): this;
1936
2329
  /**
1937
2330
  * Adds a strongly-typed OR NOT IN where clause for a single attribute key.
1938
2331
  *
@@ -1983,7 +2376,7 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
1983
2376
  * @param orderBy
1984
2377
  * @returns
1985
2378
  */
1986
- orderBy(orderBy: DelegateOrderBy<TDelegate>): this;
2379
+ orderBy(orderBy: QuerySchemaOrderBy<TDelegate>): this;
1987
2380
  /**
1988
2381
  * Puts the query results in random order.
1989
2382
  *
@@ -2018,7 +2411,7 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
2018
2411
  * @param include
2019
2412
  * @returns
2020
2413
  */
2021
- include(include: DelegateInclude<TDelegate>): this;
2414
+ include(include: QuerySchemaInclude<TDelegate>): this;
2022
2415
  /**
2023
2416
  * Adds eager loading for the specified relations.
2024
2417
  * This will merge with any existing include clause.
@@ -2215,7 +2608,7 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
2215
2608
  * @param select
2216
2609
  * @returns
2217
2610
  */
2218
- select(select: DelegateSelect<TDelegate>): this;
2611
+ select(select: QuerySchemaSelect<TDelegate>): this;
2219
2612
  /**
2220
2613
  * Adds a skip clause to the query for pagination.
2221
2614
  * This will overwrite any existing skip clause.
@@ -2245,6 +2638,13 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
2245
2638
  * @returns
2246
2639
  */
2247
2640
  limit(value: number): this;
2641
+ /**
2642
+ * Returns a representation of the query that can be used for debugging or logging purposes.
2643
+ *
2644
+ * @param operation
2645
+ * @returns
2646
+ */
2647
+ inspect(operation?: Extract<AdapterQueryOperation, 'select' | 'selectOne' | 'count' | 'exists'>): AdapterQueryInspection | null;
2248
2648
  /**
2249
2649
  * Sets offset/limit for a 1-based page.
2250
2650
  *
@@ -2389,6 +2789,7 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
2389
2789
  * @returns
2390
2790
  */
2391
2791
  updateOrInsert(attributes: Record<string, unknown>, values?: Record<string, unknown> | ((exists: boolean) => Record<string, unknown> | Promise<Record<string, unknown>>)): Promise<boolean>;
2792
+ private shouldFallbackUpdateOrInsertUpsert;
2392
2793
  /**
2393
2794
  * Insert new records or update existing records by one or more unique keys.
2394
2795
  *
@@ -2399,12 +2800,19 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
2399
2800
  */
2400
2801
  upsert(values: Array<Record<string, unknown>>, uniqueBy: string | string[], update?: string[] | null): Promise<number>;
2401
2802
  /**
2402
- * Deletes records matching the current query constraints and returns
2403
- * the deleted record(s) as model instance(s).
2803
+ * Deletes the first record matching the current query constraints and returns
2804
+ * it as a hydrated model instance. Returns null when no record matches.
2805
+ *
2806
+ * @returns
2807
+ */
2808
+ delete(): Promise<TModel | null>;
2809
+ /**
2810
+ * Deletes the first record matching the current query constraints and throws
2811
+ * when no record matches.
2404
2812
  *
2405
2813
  * @returns
2406
2814
  */
2407
- delete(): Promise<TModel>;
2815
+ deleteOrFail(): Promise<TModel>;
2408
2816
  private tryBuildInsertSpec;
2409
2817
  private tryBuildInsertManySpec;
2410
2818
  private tryBuildUpsertSpec;
@@ -2529,12 +2937,23 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
2529
2937
  private normalizeQuerySelect;
2530
2938
  private normalizeQueryOrderBy;
2531
2939
  private cloneRelationLoads;
2940
+ private mergeRelationLoadPlans;
2941
+ private relationLoadPlansToEagerLoadMap;
2942
+ private getRelationLoadSoftDeleteMode;
2943
+ applyRelationLoadPlan(plan: RelationLoadPlan): this;
2944
+ loadIntoModels(models: TModel[]): Promise<void>;
2945
+ /**
2946
+ * Attempts to build relation load plans for the adapter based on the eager loads specified in the query builder.
2947
+ *
2948
+ * @returns an array of RelationLoadPlan if successful, or null if the eager loads contain constraints that cannot be represented in a way compatible with adapter-based loading.
2949
+ */
2950
+ private tryBuildAdapterRelationLoadPlans;
2532
2951
  private eagerLoadModels;
2533
2952
  private normalizeRelationLoadSelect;
2534
2953
  private normalizeRelationLoadOrderBy;
2535
2954
  private normalizeRelationLoads;
2536
2955
  private appendQueryCondition;
2537
- private toDelegateWhere;
2956
+ private toQuerySchemaWhere;
2538
2957
  private buildSoftDeleteQueryCondition;
2539
2958
  private buildQueryWhereCondition;
2540
2959
  private tryBuildQuerySelectColumns;
@@ -2588,6 +3007,9 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
2588
3007
  private canExecuteRelationFiltersInAdapter;
2589
3008
  private canExecuteRelationAggregatesInAdapter;
2590
3009
  private canExecuteRelationFeaturesInAdapter;
3010
+ private shouldUseCompatibilityRelationFallback;
3011
+ private hasUncompilableSqlRelationFilters;
3012
+ private hasUncompilableSqlRelationAggregates;
2591
3013
  private tryBuildRelationFilterSpecs;
2592
3014
  private tryBuildRelationAggregateSpecs;
2593
3015
  private tryBuildRelationConstraintWhere;
@@ -2604,17 +3026,16 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
2604
3026
  }
2605
3027
  //#endregion
2606
3028
  //#region src/types/ModelStatic.d.ts
2607
- interface ModelStatic<TModel, TDelegate extends PrismaDelegateLike = PrismaDelegateLike> {
2608
- new (attributes?: DelegateRow<TDelegate> extends Record<string, unknown> ? DelegateRow<TDelegate> : Record<string, unknown>): TModel;
3029
+ interface ModelStatic<TModel, TDelegate extends ModelQuerySchemaLike = ModelQuerySchemaLike> {
3030
+ new (attributes?: QuerySchemaRow<TDelegate> extends Record<string, unknown> ? QuerySchemaRow<TDelegate> : Record<string, unknown>): TModel;
2609
3031
  query: () => QueryBuilder<TModel, TDelegate>;
2610
- hydrate: (attributes: DelegateRow<TDelegate> extends Record<string, unknown> ? DelegateRow<TDelegate> : Record<string, unknown>) => TModel;
2611
- hydrateMany: (attributes: (DelegateRow<TDelegate> extends Record<string, unknown> ? DelegateRow<TDelegate> : Record<string, unknown>)[]) => TModel[];
2612
- hydrateRetrieved: (attributes: DelegateRow<TDelegate> extends Record<string, unknown> ? DelegateRow<TDelegate> : Record<string, unknown>) => Promise<TModel>;
2613
- hydrateManyRetrieved: (attributes: (DelegateRow<TDelegate> extends Record<string, unknown> ? DelegateRow<TDelegate> : Record<string, unknown>)[]) => Promise<TModel[]>;
3032
+ hydrate: (attributes: QuerySchemaRow<TDelegate> extends Record<string, unknown> ? QuerySchemaRow<TDelegate> : Record<string, unknown>) => TModel;
3033
+ hydrateMany: (attributes: (QuerySchemaRow<TDelegate> extends Record<string, unknown> ? QuerySchemaRow<TDelegate> : Record<string, unknown>)[]) => TModel[];
3034
+ hydrateRetrieved: (attributes: QuerySchemaRow<TDelegate> extends Record<string, unknown> ? QuerySchemaRow<TDelegate> : Record<string, unknown>) => Promise<TModel>;
3035
+ hydrateManyRetrieved: (attributes: (QuerySchemaRow<TDelegate> extends Record<string, unknown> ? QuerySchemaRow<TDelegate> : Record<string, unknown>)[]) => Promise<TModel[]>;
2614
3036
  getAdapter: () => DatabaseAdapter | undefined;
2615
3037
  getColumnMap: () => Record<string, string>;
2616
3038
  getColumnName: (attribute: string) => string;
2617
- getDelegate: (delegate?: string) => TDelegate;
2618
3039
  getModelMetadata: () => ModelMetadata;
2619
3040
  getPrimaryKey: () => string;
2620
3041
  getRelationMetadata: (name: string) => RelationMetadata | null;
@@ -2629,7 +3050,6 @@ interface RelationshipModelStatic {
2629
3050
  getAdapter: () => DatabaseAdapter | undefined;
2630
3051
  getColumnMap: () => Record<string, string>;
2631
3052
  getColumnName: (attribute: string) => string;
2632
- getDelegate: (delegate?: string) => PrismaDelegateLike;
2633
3053
  getModelMetadata: () => ModelMetadata;
2634
3054
  getPrimaryKey: () => string;
2635
3055
  getRelationMetadata: (name: string) => RelationMetadata | null;
@@ -2710,6 +3130,7 @@ interface RelationFilterSpec {
2710
3130
  interface RelationLoadPlan {
2711
3131
  relation: string;
2712
3132
  constraint?: QueryCondition;
3133
+ softDeleteMode?: SoftDeleteQueryMode;
2713
3134
  orderBy?: QueryOrderBy[];
2714
3135
  limit?: number;
2715
3136
  offset?: number;
@@ -2777,6 +3198,47 @@ interface RelationLoadSpec<TModel = unknown> {
2777
3198
  models: TModel[];
2778
3199
  relations: RelationLoadPlan[];
2779
3200
  }
3201
+ type AdapterQueryOperation = 'select' | 'selectOne' | 'count' | 'exists' | 'insert' | 'insertMany' | 'upsert' | 'update' | 'updateFirst' | 'updateMany' | 'delete' | 'deleteFirst' | 'deleteMany';
3202
+ type AdapterInspectionRequest<TModel = unknown> = {
3203
+ operation: 'select';
3204
+ spec: SelectSpec<TModel>;
3205
+ } | {
3206
+ operation: 'selectOne';
3207
+ spec: SelectSpec<TModel>;
3208
+ } | {
3209
+ operation: 'count';
3210
+ spec: AggregateSpec<TModel>;
3211
+ } | {
3212
+ operation: 'exists';
3213
+ spec: SelectSpec<TModel>;
3214
+ } | {
3215
+ operation: 'insert';
3216
+ spec: InsertSpec<TModel>;
3217
+ } | {
3218
+ operation: 'insertMany';
3219
+ spec: InsertManySpec<TModel>;
3220
+ } | {
3221
+ operation: 'upsert';
3222
+ spec: UpsertSpec<TModel>;
3223
+ } | {
3224
+ operation: 'update';
3225
+ spec: UpdateSpec<TModel>;
3226
+ } | {
3227
+ operation: 'updateFirst';
3228
+ spec: UpdateSpec<TModel>;
3229
+ } | {
3230
+ operation: 'updateMany';
3231
+ spec: UpdateManySpec<TModel>;
3232
+ } | {
3233
+ operation: 'delete';
3234
+ spec: DeleteSpec<TModel>;
3235
+ } | {
3236
+ operation: 'deleteFirst';
3237
+ spec: DeleteSpec<TModel>;
3238
+ } | {
3239
+ operation: 'deleteMany';
3240
+ spec: DeleteManySpec<TModel>;
3241
+ };
2780
3242
  interface AdapterTransactionContext {
2781
3243
  isolationLevel?: string;
2782
3244
  readOnly?: boolean;
@@ -2812,6 +3274,7 @@ interface DatabaseAdapter {
2812
3274
  count: <TModel = unknown>(spec: AggregateSpec<TModel>) => Promise<number>;
2813
3275
  exists?: <TModel = unknown>(spec: SelectSpec<TModel>) => Promise<boolean>;
2814
3276
  loadRelations?: <TModel = unknown>(spec: RelationLoadSpec<TModel>) => Promise<void>;
3277
+ inspectQuery?: <TModel = unknown>(request: AdapterInspectionRequest<TModel>) => AdapterQueryInspection | null;
2815
3278
  introspectModels?: (options?: AdapterModelIntrospectionOptions) => Promise<AdapterModelStructure[]>;
2816
3279
  executeSchemaOperations?: (operations: SchemaOperation[]) => Promise<void>;
2817
3280
  resetDatabase?: () => Promise<void>;
@@ -2843,6 +3306,7 @@ declare class KyselyDatabaseAdapter implements DatabaseAdapter {
2843
3306
  private resolveSchemaColumnName;
2844
3307
  private resolveSchemaIndexName;
2845
3308
  private resolveSchemaForeignKeyName;
3309
+ private resolveSchemaEnumName;
2846
3310
  private resolveSchemaColumnType;
2847
3311
  private resolveSchemaColumnDefault;
2848
3312
  private shouldUseIdentity;
@@ -2869,6 +3333,7 @@ declare class KyselyDatabaseAdapter implements DatabaseAdapter {
2869
3333
  private buildOrderBy;
2870
3334
  private buildConditionValueList;
2871
3335
  private buildComparisonCondition;
3336
+ private buildRawWhereCondition;
2872
3337
  private buildWhereCondition;
2873
3338
  private buildWhereClause;
2874
3339
  private buildPaginationClause;
@@ -2885,7 +3350,17 @@ declare class KyselyDatabaseAdapter implements DatabaseAdapter {
2885
3350
  private buildRelationAggregateSelectList;
2886
3351
  private buildCombinedWhereClause;
2887
3352
  private buildSingleRowTargetCte;
2888
- private assertNoRelationLoads;
3353
+ private isEagerLoadableModel;
3354
+ private toEagerLoadConstraint;
3355
+ private toEagerLoadMap;
3356
+ private buildSelectStatement;
3357
+ private buildCountStatement;
3358
+ private buildExistsStatement;
3359
+ private compileInspection;
3360
+ private emitDebugQuery;
3361
+ private wrapExecutionError;
3362
+ private executeWithDebug;
3363
+ inspectQuery<TModel = unknown>(request: AdapterInspectionRequest<TModel>): AdapterQueryInspection | null;
2889
3364
  /**
2890
3365
  * Selects records from the database matching the specified criteria and returns
2891
3366
  * them as an array of database rows.
@@ -2981,6 +3456,13 @@ declare class KyselyDatabaseAdapter implements DatabaseAdapter {
2981
3456
  * @returns A promise that resolves to a boolean indicating whether any records match the criteria.
2982
3457
  */
2983
3458
  exists<TModel = unknown>(spec: SelectSpec<TModel>): Promise<boolean>;
3459
+ /**
3460
+ * Loads relations for the given models based on the specified relation load plans.
3461
+ *
3462
+ * @param spec The specification defining the models and their relations to be loaded.
3463
+ * @returns
3464
+ */
3465
+ loadRelations<TModel = unknown>(spec: RelationLoadSpec<TModel>): Promise<void>;
2984
3466
  introspectModels(options?: AdapterModelIntrospectionOptions): Promise<AdapterModelStructure[]>;
2985
3467
  executeSchemaOperations(operations: SchemaOperation[]): Promise<void>;
2986
3468
  resetDatabase(): Promise<void>;
@@ -3032,13 +3514,18 @@ declare class PrismaDatabaseAdapter implements DatabaseAdapter {
3032
3514
  private toComparisonWhere;
3033
3515
  private toQueryWhere;
3034
3516
  private buildFindArgs;
3517
+ private emitDebugQuery;
3518
+ private wrapExecutionError;
3519
+ private runWithDebug;
3520
+ inspectQuery<TModel = unknown>(_request: AdapterInspectionRequest<TModel>): AdapterQueryInspection | null;
3035
3521
  private toQueryInclude;
3036
3522
  introspectModels(options?: AdapterModelIntrospectionOptions): Promise<AdapterModelStructure[]>;
3037
3523
  private resolveDelegate;
3038
3524
  /**
3039
- * @todo Implement relationLoads by performing separate queries and merging results
3040
- * in-memory, since Prisma does not support nested reads with constraints, ordering, or
3041
- * pagination on related models as of now.
3525
+ * Prisma can translate relation load plans on direct select/selectOne calls into
3526
+ * Prisma include/select arguments, but the adapter does not advertise the
3527
+ * adapter-owned batch relation load seam. QueryBuilder eager loads therefore stay
3528
+ * on Arkorm's generic relation loader on the Prisma compatibility path.
3042
3529
  *
3043
3530
  * @param spec
3044
3531
  * @returns
@@ -3184,6 +3671,7 @@ declare class CliApp {
3184
3671
  * @returns The entire configuration object or the value of the specified key
3185
3672
  */
3186
3673
  getConfig: GetUserConfig;
3674
+ private isUsingPrismaAdapter;
3187
3675
  /**
3188
3676
  * Utility to ensure directory exists
3189
3677
  *
@@ -3298,13 +3786,14 @@ declare class CliApp {
3298
3786
  factory?: boolean;
3299
3787
  seeder?: boolean;
3300
3788
  migration?: boolean;
3789
+ pivot?: boolean;
3301
3790
  all?: boolean;
3302
3791
  }): {
3303
3792
  model: {
3304
3793
  name: string;
3305
3794
  path: string;
3306
3795
  };
3307
- prisma: {
3796
+ prisma?: {
3308
3797
  path: string;
3309
3798
  updated: boolean;
3310
3799
  };
@@ -3323,11 +3812,11 @@ declare class CliApp {
3323
3812
  };
3324
3813
  /**
3325
3814
  * Ensure that the Prisma schema has a model entry for the given model
3326
- * and delegate names.
3815
+ * and table names.
3327
3816
  * If the entry does not exist, it will be created with a default `id` field.
3328
3817
  *
3329
3818
  * @param modelName The name of the model to ensure in the Prisma schema.
3330
- * @param delegateName The name of the delegate (table) to ensure in the Prisma schema.
3819
+ * @param tableName The table name to ensure in the Prisma schema.
3331
3820
  */
3332
3821
  private ensurePrismaModelEntry;
3333
3822
  /**
@@ -4125,11 +4614,12 @@ declare class DB {
4125
4614
  static setAdapter(adapter?: DatabaseAdapter): void;
4126
4615
  static getAdapter(): DatabaseAdapter | undefined;
4127
4616
  getAdapter(): DatabaseAdapter | undefined;
4128
- static table<TRow extends Record<string, unknown> = Record<string, unknown>>(table: string, options?: DatabaseTableOptions): QueryBuilder<TRow, PrismaDelegateLike>;
4129
- table<TRow extends Record<string, unknown> = Record<string, unknown>>(table: string, options?: DatabaseTableOptions): QueryBuilder<TRow, PrismaDelegateLike>;
4617
+ static table<TRow extends Record<string, unknown> = Record<string, unknown>>(table: string, options?: DatabaseTableOptions): QueryBuilder<TRow, ModelQuerySchemaLike>;
4618
+ table<TRow extends Record<string, unknown> = Record<string, unknown>>(table: string, options?: DatabaseTableOptions): QueryBuilder<TRow, ModelQuerySchemaLike>;
4130
4619
  static transaction<TResult>(callback: (db: DB) => TResult | Promise<TResult>, context?: AdapterTransactionContext): Promise<TResult>;
4131
4620
  transaction<TResult>(callback: (db: DB) => TResult | Promise<TResult>, context?: AdapterTransactionContext): Promise<TResult>;
4132
4621
  private static createTableModel;
4622
+ private static resolvePersistedTableMetadata;
4133
4623
  }
4134
4624
  //#endregion
4135
4625
  //#region src/Exceptions/ArkormException.d.ts
@@ -4189,6 +4679,16 @@ declare class QueryConstraintException extends ArkormException {
4189
4679
  constructor(message: string, context?: ArkormErrorContext);
4190
4680
  }
4191
4681
  //#endregion
4682
+ //#region src/Exceptions/QueryExecutionException.d.ts
4683
+ interface QueryExecutionExceptionContext extends ArkormErrorContext {
4684
+ inspection?: AdapterQueryInspection | null;
4685
+ }
4686
+ declare class QueryExecutionException extends ArkormException {
4687
+ readonly inspection?: AdapterQueryInspection | null;
4688
+ constructor(message?: string, context?: QueryExecutionExceptionContext);
4689
+ getInspection(): AdapterQueryInspection | null | undefined;
4690
+ }
4691
+ //#endregion
4192
4692
  //#region src/Exceptions/RelationResolutionException.d.ts
4193
4693
  declare class RelationResolutionException extends ArkormException {
4194
4694
  constructor(message: string, context?: ArkormErrorContext);
@@ -4601,21 +5101,29 @@ declare class PrimaryKeyGenerationPlanner {
4601
5101
  * @returns The same configuration object.
4602
5102
  */
4603
5103
  declare const defineConfig: (config: ArkormConfig) => ArkormConfig;
5104
+ /**
5105
+ * Bind a database adapter instance to an array of models that support adapter binding.
5106
+ *
5107
+ * @param adapter
5108
+ * @param models
5109
+ * @returns
5110
+ */
4604
5111
  declare const bindAdapterToModels: (adapter: DatabaseAdapter, models: AdapterBindableModel[]) => DatabaseAdapter;
4605
5112
  /**
4606
5113
  * Get the user-provided ArkORM configuration.
4607
5114
  *
5115
+ * @param key Optional specific configuration key to retrieve. If omitted, the entire configuration object is returned.
4608
5116
  * @returns The user-provided ArkORM configuration object.
4609
5117
  */
4610
5118
  declare const getUserConfig: GetUserConfig;
4611
5119
  /**
4612
- * Configure the ArkORM runtime with the provided Prisma client resolver and
4613
- * delegate mapping resolver.
5120
+ * Configure the ArkORM runtime with the provided runtime client resolver and
5121
+ * adapter-first options.
4614
5122
  *
4615
- * @param prisma
4616
- * @param mapping
5123
+ * @param client
5124
+ * @param options
4617
5125
  */
4618
- declare const configureArkormRuntime: (prisma?: ClientResolver, options?: Omit<ArkormConfig, "prisma">) => void;
5126
+ declare const configureArkormRuntime: (client?: ClientResolver, options?: Omit<ArkormConfig, "prisma">) => void;
4619
5127
  /**
4620
5128
  * Reset the ArkORM runtime configuration.
4621
5129
  * This is primarily intended for testing purposes.
@@ -4637,17 +5145,22 @@ declare const loadArkormConfig: () => Promise<void>;
4637
5145
  declare const ensureArkormConfigLoading: () => void;
4638
5146
  declare const getDefaultStubsPath: () => string;
4639
5147
  /**
4640
- * Get the runtime Prisma client.
5148
+ * Get the runtime compatibility client.
4641
5149
  * This function will trigger the loading of the ArkORM configuration if
4642
5150
  * it hasn't already been loaded.
4643
5151
  *
4644
5152
  * @returns
4645
5153
  */
4646
- declare const getRuntimePrismaClient: () => PrismaClientLike | undefined;
5154
+ declare const getRuntimeClient: () => RuntimeClientLike | undefined;
5155
+ /**
5156
+ * @deprecated Use getRuntimeClient instead.
5157
+ */
5158
+ declare const getRuntimePrismaClient: () => RuntimeClientLike | undefined;
4647
5159
  declare const getRuntimeAdapter: () => DatabaseAdapter | undefined;
4648
- declare const getActiveTransactionClient: () => PrismaClientLike | undefined;
4649
- declare const isTransactionCapableClient: (value: unknown) => value is PrismaTransactionCapableClient;
4650
- declare const runArkormTransaction: <TResult>(callback: PrismaTransactionCallback<TResult>, options?: PrismaTransactionOptions) => Promise<TResult>;
5160
+ declare const getActiveTransactionClient: () => RuntimeClientLike | undefined;
5161
+ declare const getActiveTransactionAdapter: () => DatabaseAdapter | undefined;
5162
+ declare const isTransactionCapableClient: (value: unknown) => value is TransactionCapableClient;
5163
+ declare const runArkormTransaction: <TResult>(callback: TransactionCallback<TResult>, options?: TransactionOptions, preferredAdapter?: DatabaseAdapter) => Promise<TResult>;
4651
5164
  /**
4652
5165
  * Get the configured pagination URL driver factory from runtime config.
4653
5166
  *
@@ -4660,39 +5173,45 @@ declare const getRuntimePaginationURLDriverFactory: () => PaginationURLDriverFac
4660
5173
  * @returns
4661
5174
  */
4662
5175
  declare const getRuntimePaginationCurrentPageResolver: () => PaginationCurrentPageResolver | undefined;
5176
+ declare const getRuntimeDebugHandler: () => ArkormDebugHandler | undefined;
5177
+ declare const emitRuntimeDebugEvent: (event: ArkormDebugEvent) => void;
4663
5178
  /**
4664
- * Check if a given value is a Prisma delegate-like object
5179
+ * Check if a given value matches Arkorm's query-schema contract
4665
5180
  * by verifying the presence of common delegate methods.
4666
5181
  *
4667
5182
  * @param value The value to check.
4668
- * @returns True if the value is a Prisma delegate-like object, false otherwise.
5183
+ * @returns True if the value matches the query-schema contract, false otherwise.
4669
5184
  */
4670
- declare const isDelegateLike: (value: unknown) => value is PrismaDelegateLike;
5185
+ declare const isQuerySchemaLike: (value: unknown) => value is ModelQuerySchemaLike;
5186
+ /**
5187
+ * @deprecated Use isQuerySchemaLike instead.
5188
+ */
5189
+ declare const isDelegateLike: (value: unknown) => value is ModelQuerySchemaLike;
4671
5190
  //#endregion
4672
5191
  //#region src/helpers/prisma.d.ts
4673
- type PrismaDelegateMap<TClient extends PrismaClientLike> = { [K in keyof TClient as TClient[K] extends PrismaDelegateLike ? K : never]: TClient[K] extends PrismaDelegateLike ? TClient[K] : never };
5192
+ type PrismaDelegateMap<TClient extends RuntimeClientLike> = { [K in keyof TClient as TClient[K] extends ModelQuerySchemaLike ? K : never]: TClient[K] extends ModelQuerySchemaLike ? TClient[K] : never };
4674
5193
  /**
4675
- * Create an adapter to convert a Prisma client instance into a format
4676
- * compatible with ArkORM's expectations.
5194
+ * Compatibility-only helper that exposes Prisma query schemas as a plain object map.
5195
+ * It is retained for migration support and tests, not as a supported runtime bootstrap path.
4677
5196
  *
4678
5197
  * @deprecated Prefer createPrismaDatabaseAdapter(prisma) for runtime usage.
4679
5198
  *
4680
5199
  * @param prisma The Prisma client instance to adapt.
4681
5200
  * @param mapping An optional mapping of Prisma delegate names to ArkORM delegate names.
4682
- * @returns A record of adapted Prisma delegates compatible with ArkORM.
5201
+ * @returns A record of adapted Prisma compatibility query schemas.
4683
5202
  */
4684
- declare function createPrismaAdapter(prisma: PrismaClientLike): Record<string, PrismaDelegateLike>;
5203
+ declare function createPrismaAdapter(prisma: RuntimeClientLike): Record<string, ModelQuerySchemaLike>;
4685
5204
  /**
4686
- * Create a delegate mapping record for Model.setClient() from a Prisma client.
5205
+ * Compatibility-only helper for legacy delegate-map bootstrapping during migration.
4687
5206
  *
4688
- * @deprecated Prefer createPrismaDatabaseAdapter(prisma, mapping) and bind the
4689
- * resulting adapter with Model.setAdapter(...).
5207
+ * @deprecated Prefer createPrismaDatabaseAdapter(prisma, mapping). Direct delegate-map
5208
+ * bootstrapping is no longer part of the supported runtime path.
4690
5209
  *
4691
5210
  * @param prisma The Prisma client instance.
4692
5211
  * @param mapping Optional mapping of Arkormˣ delegate names to Prisma delegate names.
4693
- * @returns A delegate map keyed by Arkormˣ delegate names.
5212
+ * @returns A compatibility map keyed by Arkormˣ query-schema names.
4694
5213
  */
4695
- declare function createPrismaDelegateMap(prisma: PrismaClientLike, mapping?: PrismaDelegateNameMapping): Record<string, PrismaDelegateLike>;
5214
+ declare function createPrismaDelegateMap(prisma: RuntimeClientLike, mapping?: PrismaDelegateNameMapping): Record<string, ModelQuerySchemaLike>;
4696
5215
  /**
4697
5216
  * Infer the Prisma delegate name for a given model name using a simple convention.
4698
5217
  *
@@ -4701,10 +5220,28 @@ declare function createPrismaDelegateMap(prisma: PrismaClientLike, mapping?: Pri
4701
5220
  */
4702
5221
  declare function inferDelegateName(modelName: string): string;
4703
5222
  //#endregion
5223
+ //#region src/helpers/runtime-compatibility.d.ts
5224
+ declare const getRuntimeCompatibilityAdapter: (preferredClient?: RuntimeClientLike) => DatabaseAdapter | undefined;
5225
+ declare const resolveRuntimeCompatibilityQuerySchema: (candidates: string[], preferredClient?: RuntimeClientLike) => ModelQuerySchemaLike | undefined;
5226
+ declare const resolveRuntimeCompatibilityQuerySchemaOrThrow: <TSchema extends ModelQuerySchemaLike = ModelQuerySchemaLike>(key: string, candidates: string[], modelName: string, preferredClient?: RuntimeClientLike) => TSchema;
5227
+ //#endregion
4704
5228
  //#region src/helpers/runtime-module-loader.d.ts
4705
5229
  declare class RuntimeModuleLoader {
4706
5230
  static load<T = unknown>(filePath: string): Promise<T>;
4707
- static loadSync<T = unknown>(filePath: string): T;
5231
+ }
5232
+ //#endregion
5233
+ //#region src/PivotModel.d.ts
5234
+ /**
5235
+ * Base pivot class that all pivot models should extend.
5236
+ *
5237
+ * @template TModel The type of the model extending this base class.
5238
+ *
5239
+ * @author Legacy (3m1n3nc3)
5240
+ * @since 2.0.0-next.18
5241
+ */
5242
+ declare class PivotModel extends Model {
5243
+ protected readonly attributes: Record<string, unknown>;
5244
+ constructor(attributes?: Record<string, unknown>);
4708
5245
  }
4709
5246
  //#endregion
4710
5247
  //#region src/URLDriver.d.ts
@@ -4725,4 +5262,4 @@ declare class URLDriver {
4725
5262
  url(page: number): string;
4726
5263
  }
4727
5264
  //#endregion
4728
- export { AdapterBindableModel, AdapterCapabilities, AdapterCapability, AdapterModelFieldStructure, AdapterModelIntrospectionOptions, AdapterModelStructure, AdapterTransactionContext, AggregateOperation, AggregateSelection, AggregateSpec, AppliedMigrationEntry, AppliedMigrationRun, AppliedMigrationsState, ArkormBootContext, ArkormCollection, ArkormConfig, ArkormErrorContext, ArkormException, Attribute, AttributeCreateInput, AttributeOptions, AttributeOrderBy, AttributeSchemaDelegate, AttributeSelect, AttributeUpdateInput, AttributeWhereInput, BelongsToManyRelationMetadata, BelongsToRelationMetadata, CastDefinition, CastHandler, CastMap, CastType, CliApp, ClientResolver, ColumnMap, DB, DatabaseAdapter, DatabasePrimitive, DatabaseRow, DatabaseRows, DatabaseTableOptions, 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, MigrateFreshCommand, MigrateRollbackCommand, Migration, MigrationClass, MigrationHistoryCommand, MigrationInstanceLike, MissingDelegateException, Model, ModelAttributes, ModelAttributesOf, ModelCreateData, ModelEventDispatcher, ModelEventHandler, ModelEventHandlerConstructor, ModelEventListener, ModelEventName, ModelFactory, ModelLifecycleState, ModelMetadata, ModelNotFoundException, ModelStatic, ModelUpdateData, ModelsSyncCommand, MorphManyRelationMetadata, MorphOneRelationMetadata, MorphToManyRelationMetadata, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, PaginationCurrentPageResolver, PaginationMeta, PaginationOptions, PaginationURLDriver, PaginationURLDriverFactory, Paginator, PersistedColumnMappingsState, PersistedMetadataFeatures, PersistedPrimaryKeyGeneration, PersistedTableMetadata, PersistedTimestampColumn, PrimaryKeyGeneration, PrimaryKeyGenerationPlanner, 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, TimestampColumnBehavior, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, UpdateManySpec, UpdateSpec, UpsertSpec, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToDatabase, applyMigrationRollbackToPrismaSchema, applyMigrationToDatabase, applyMigrationToPrismaSchema, applyOperationsToPersistedColumnMappingsState, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createEmptyAppliedMigrationsState, createEmptyPersistedColumnMappingsState, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deleteAppliedMigrationsStateFromStore, deletePersistedColumnMappingsState, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getPersistedColumnMap, getPersistedEnumMap, getPersistedEnumTsType, getPersistedPrimaryKeyGeneration, getPersistedTableMetadata, getPersistedTimestampColumns, getRuntimeAdapter, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, readAppliedMigrationsStateFromStore, readPersistedColumnMappingsState, rebuildPersistedColumnMappingsState, removeAppliedMigration, resetArkormRuntimeForTests, resetPersistedColumnMappingsCache, resolveCast, resolveColumnMappingsFilePath, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePersistedMetadataFeatures, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, stripPrismaSchemaModelsAndEnums, supportsDatabaseMigrationExecution, supportsDatabaseMigrationState, supportsDatabaseReset, syncPersistedColumnMappingsFromState, toMigrationFileSlug, toModelName, validatePersistedMetadataFeaturesForMigrations, writeAppliedMigrationsState, writeAppliedMigrationsStateToStore, writePersistedColumnMappingsState };
5265
+ export { AdapterBindableModel, AdapterCapabilities, AdapterCapability, AdapterInspectionRequest, AdapterModelFieldStructure, AdapterModelIntrospectionOptions, AdapterModelStructure, AdapterQueryInspection, AdapterQueryOperation, AdapterTransactionContext, AggregateOperation, AggregateSelection, AggregateSpec, AppliedMigrationEntry, AppliedMigrationRun, AppliedMigrationsState, ArkormBootContext, ArkormCollection, ArkormConfig, ArkormDebugEvent, ArkormDebugHandler, ArkormErrorContext, ArkormException, Attribute, AttributeCreateInput, AttributeOptions, AttributeOrderBy, AttributeQuerySchema, AttributeSchemaDelegate, AttributeSelect, AttributeUpdateInput, AttributeWhereInput, BelongsToManyRelationMetadata, BelongsToRelationMetadata, CastDefinition, CastHandler, CastMap, CastType, CliApp, ClientResolver, ColumnMap, DB, DatabaseAdapter, DatabasePrimitive, DatabaseRow, DatabaseRows, DatabaseTableOptions, DatabaseTablePersistedMetadataOptions, 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, MigrateFreshCommand, MigrateRollbackCommand, Migration, MigrationClass, MigrationHistoryCommand, MigrationInstanceLike, MissingDelegateException, Model, ModelAttributeValue, ModelAttributes, ModelAttributesOf, ModelCreateData, ModelDeclaredAttributeKey, ModelEventDispatcher, ModelEventHandler, ModelEventHandlerConstructor, ModelEventListener, ModelEventName, ModelFactory, ModelLifecycleState, ModelMetadata, ModelNotFoundException, ModelQuerySchemaLike, ModelRelationshipKey, ModelRelationshipResult, ModelStatic, ModelUpdateData, ModelsSyncCommand, MorphManyRelationMetadata, MorphOneRelationMetadata, MorphToManyRelationMetadata, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, PaginationCurrentPageResolver, PaginationMeta, PaginationOptions, PaginationURLDriver, PaginationURLDriverFactory, Paginator, PersistedColumnMappingsState, PersistedMetadataFeatures, PersistedPrimaryKeyGeneration, PersistedTableMetadata, PersistedTimestampColumn, PivotModel, PivotModelStatic, PrimaryKeyGeneration, PrimaryKeyGenerationPlanner, PrismaClientLike, PrismaDatabaseAdapter, PrismaDelegateLike, PrismaDelegateMap, PrismaDelegateNameMapping, PrismaFindManyArgsLike, PrismaLikeInclude, PrismaLikeOrderBy, PrismaLikeScalarFilter, PrismaLikeSelect, PrismaLikeSortOrder, PrismaLikeWhereInput, PrismaMigrationWorkflowOptions, PrismaSchemaSyncOptions, PrismaTransactionCallback, PrismaTransactionCapableClient, PrismaTransactionContext, PrismaTransactionOptions, QueryBuilder, QueryComparisonCondition, QueryComparisonOperator, QueryCondition, QueryConstraintException, QueryExecutionException, QueryExecutionExceptionContext, QueryGroupCondition, QueryLogicalOperator, QueryNotCondition, QueryOrderBy, QueryRawCondition, QuerySchemaCreateData, QuerySchemaFindManyArgs, QuerySchemaForModel, QuerySchemaInclude, QuerySchemaOrderBy, QuerySchemaRow, QuerySchemaRows, QuerySchemaSelect, QuerySchemaUniqueWhere, QuerySchemaUpdateArgs, QuerySchemaUpdateData, QuerySchemaWhere, QuerySelectColumn, QueryTarget, RelatedModelClass, RelationAggregateSpec, RelationColumnLookupSpec, RelationConstraint, RelationDefaultResolver, RelationDefaultValue, RelationFilterSpec, RelationLoadPlan, RelationLoadSpec, RelationMetadata, RelationMetadataProvider, RelationMetadataType, RelationResolutionException, RelationTableLookupSpec, RelationshipModelStatic, RuntimeClientLike, 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, TimestampColumnBehavior, TransactionCallback, TransactionCapableClient, TransactionContext, TransactionOptions, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, UpdateManySpec, UpdateSpec, UpsertSpec, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToDatabase, applyMigrationRollbackToPrismaSchema, applyMigrationToDatabase, applyMigrationToPrismaSchema, applyOperationsToPersistedColumnMappingsState, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createEmptyAppliedMigrationsState, createEmptyPersistedColumnMappingsState, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deleteAppliedMigrationsStateFromStore, deletePersistedColumnMappingsState, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, emitRuntimeDebugEvent, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionAdapter, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getPersistedColumnMap, getPersistedEnumMap, getPersistedEnumTsType, getPersistedPrimaryKeyGeneration, getPersistedTableMetadata, getPersistedTimestampColumns, getRuntimeAdapter, getRuntimeClient, getRuntimeCompatibilityAdapter, getRuntimeDebugHandler, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isQuerySchemaLike, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, readAppliedMigrationsStateFromStore, readPersistedColumnMappingsState, rebuildPersistedColumnMappingsState, removeAppliedMigration, resetArkormRuntimeForTests, resetPersistedColumnMappingsCache, resolveCast, resolveColumnMappingsFilePath, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePersistedMetadataFeatures, resolvePrismaType, resolveRuntimeCompatibilityQuerySchema, resolveRuntimeCompatibilityQuerySchemaOrThrow, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, stripPrismaSchemaModelsAndEnums, supportsDatabaseMigrationExecution, supportsDatabaseMigrationState, supportsDatabaseReset, syncPersistedColumnMappingsFromState, toMigrationFileSlug, toModelName, validatePersistedMetadataFeaturesForMigrations, writeAppliedMigrationsState, writeAppliedMigrationsStateToStore, writePersistedColumnMappingsState };