arkormx 2.0.0-next.9 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cli.mjs +946 -227
- package/dist/index.cjs +5275 -3989
- package/dist/index.d.cts +640 -110
- package/dist/index.d.mts +641 -111
- package/dist/index.mjs +5266 -3990
- package/package.json +4 -4
- package/stubs/model.js.stub +1 -1
- package/stubs/model.stub +2 -2
- package/stubs/pivot-model.stub +4 -0
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
|
|
122
|
-
interface
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
307
|
-
type
|
|
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
|
|
372
|
+
type QuerySchemaInclude<TSchema extends ModelQuerySchemaLike> = QuerySchemaFindManyArgs<TSchema> extends {
|
|
311
373
|
include?: infer TInclude;
|
|
312
374
|
} ? FallbackIfUnknownOrNever<TInclude, PrismaLikeInclude> : PrismaLikeInclude;
|
|
313
|
-
type
|
|
375
|
+
type QuerySchemaOrderBy<TSchema extends ModelQuerySchemaLike> = QuerySchemaFindManyArgs<TSchema> extends {
|
|
314
376
|
orderBy?: infer TOrderBy;
|
|
315
377
|
} ? FallbackIfUnknownOrNever<TOrderBy, PrismaLikeOrderBy> : PrismaLikeOrderBy;
|
|
316
|
-
type
|
|
378
|
+
type QuerySchemaSelect<TSchema extends ModelQuerySchemaLike> = QuerySchemaFindManyArgs<TSchema> extends {
|
|
317
379
|
select?: infer TSelect;
|
|
318
380
|
} ? FallbackIfUnknownOrNever<TSelect, PrismaLikeSelect> : PrismaLikeSelect;
|
|
319
|
-
type
|
|
381
|
+
type QuerySchemaCreateData<TSchema extends ModelQuerySchemaLike> = Parameters<TSchema['create']>[0] extends {
|
|
320
382
|
data: infer TData;
|
|
321
383
|
} ? TData : Record<string, unknown>;
|
|
322
|
-
type
|
|
323
|
-
type
|
|
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
|
|
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
|
|
330
|
-
type
|
|
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';
|
|
@@ -519,6 +635,30 @@ declare abstract class Relation<TModel> {
|
|
|
519
635
|
* @returns
|
|
520
636
|
*/
|
|
521
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;
|
|
522
662
|
/**
|
|
523
663
|
* Add an order by clause to the relationship query.
|
|
524
664
|
*
|
|
@@ -650,14 +790,208 @@ declare abstract class Relation<TModel> {
|
|
|
650
790
|
declare class BelongsToManyRelation<TParent, TRelated> extends Relation<TRelated> {
|
|
651
791
|
private readonly parent;
|
|
652
792
|
private readonly related;
|
|
653
|
-
private readonly
|
|
793
|
+
private readonly throughTable;
|
|
654
794
|
private readonly foreignPivotKey;
|
|
655
795
|
private readonly relatedPivotKey;
|
|
656
796
|
private readonly parentKey;
|
|
657
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;
|
|
658
806
|
constructor(parent: TParent & {
|
|
659
807
|
getAttribute: (key: string) => unknown;
|
|
660
|
-
}, related: RelationshipModelStatic,
|
|
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;
|
|
661
995
|
/**
|
|
662
996
|
* Build the relationship query.
|
|
663
997
|
*
|
|
@@ -766,14 +1100,14 @@ declare class HasManyRelation<TParent, TRelated> extends Relation<TRelated> {
|
|
|
766
1100
|
declare class HasManyThroughRelation<TParent, TRelated> extends Relation<TRelated> {
|
|
767
1101
|
private readonly parent;
|
|
768
1102
|
private readonly related;
|
|
769
|
-
private readonly
|
|
1103
|
+
private readonly throughTable;
|
|
770
1104
|
private readonly firstKey;
|
|
771
1105
|
private readonly secondKey;
|
|
772
1106
|
private readonly localKey;
|
|
773
1107
|
private readonly secondLocalKey;
|
|
774
1108
|
constructor(parent: TParent & {
|
|
775
1109
|
getAttribute: (key: string) => unknown;
|
|
776
|
-
}, related: RelationshipModelStatic,
|
|
1110
|
+
}, related: RelationshipModelStatic, throughTable: string, firstKey: string, secondKey: string, localKey: string, secondLocalKey: string);
|
|
777
1111
|
/**
|
|
778
1112
|
* Build the relationship query.
|
|
779
1113
|
*
|
|
@@ -830,14 +1164,14 @@ declare class HasOneRelation<TParent, TRelated> extends SingleResultRelation<TPa
|
|
|
830
1164
|
declare class HasOneThroughRelation<TParent, TRelated> extends SingleResultRelation<TParent & {
|
|
831
1165
|
getAttribute: (key: string) => unknown;
|
|
832
1166
|
}, TRelated> {
|
|
833
|
-
private readonly
|
|
1167
|
+
private readonly throughTable;
|
|
834
1168
|
private readonly firstKey;
|
|
835
1169
|
private readonly secondKey;
|
|
836
1170
|
private readonly localKey;
|
|
837
1171
|
private readonly secondLocalKey;
|
|
838
1172
|
constructor(parent: TParent & {
|
|
839
1173
|
getAttribute: (key: string) => unknown;
|
|
840
|
-
}, related: RelatedModelClass<TRelated>,
|
|
1174
|
+
}, related: RelatedModelClass<TRelated>, throughTable: string, firstKey: string, secondKey: string, localKey: string, secondLocalKey: string);
|
|
841
1175
|
/**
|
|
842
1176
|
* Build the relationship query.
|
|
843
1177
|
*
|
|
@@ -923,14 +1257,14 @@ declare class MorphOneRelation<TParent, TRelated> extends SingleResultRelation<T
|
|
|
923
1257
|
declare class MorphToManyRelation<TParent, TRelated> extends Relation<TRelated> {
|
|
924
1258
|
private readonly parent;
|
|
925
1259
|
private readonly related;
|
|
926
|
-
private readonly
|
|
1260
|
+
private readonly throughTable;
|
|
927
1261
|
private readonly morphName;
|
|
928
1262
|
private readonly relatedPivotKey;
|
|
929
1263
|
private readonly parentKey;
|
|
930
1264
|
private readonly relatedKey;
|
|
931
1265
|
constructor(parent: TParent & {
|
|
932
1266
|
getAttribute: (key: string) => unknown;
|
|
933
|
-
}, related: RelationshipModelStatic,
|
|
1267
|
+
}, related: RelationshipModelStatic, throughTable: string, morphName: string, relatedPivotKey: string, parentKey: string, relatedKey: string);
|
|
934
1268
|
/**
|
|
935
1269
|
* Build the relationship query.
|
|
936
1270
|
*
|
|
@@ -1051,13 +1385,20 @@ declare const defineFactory: <TModel, TAttributes extends FactoryAttributes = Pa
|
|
|
1051
1385
|
* @author Legacy (3m1n3nc3)
|
|
1052
1386
|
* @since 0.1.0
|
|
1053
1387
|
*/
|
|
1054
|
-
declare abstract class Model<TSchema extends
|
|
1388
|
+
declare abstract class Model<TSchema extends ModelQuerySchemaLike | Record<string, unknown> | string = Record<string, any>, TAttributes extends Record<string, unknown> = ModelAttributesOf<TSchema>> {
|
|
1055
1389
|
private static readonly lifecycleStates;
|
|
1056
1390
|
private static readonly emittedDeprecationWarnings;
|
|
1057
1391
|
private static eventsSuppressed;
|
|
1058
1392
|
protected static factoryClass?: new () => ModelFactory<any, any>;
|
|
1059
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
|
+
*/
|
|
1060
1398
|
protected static client: Record<string, unknown>;
|
|
1399
|
+
/**
|
|
1400
|
+
* @deprecated Use `table` instead. This remains as a compatibility alias during the transition.
|
|
1401
|
+
*/
|
|
1061
1402
|
protected static delegate: string;
|
|
1062
1403
|
protected static table?: string;
|
|
1063
1404
|
protected static primaryKey: string;
|
|
@@ -1078,7 +1419,8 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
1078
1419
|
constructor(attributes?: Record<string, unknown>);
|
|
1079
1420
|
private static emitDeprecationWarning;
|
|
1080
1421
|
/**
|
|
1081
|
-
|
|
1422
|
+
* Compatibility-only runtime API retained for the 2.x transition window.
|
|
1423
|
+
* This is no longer part of the supported runtime bootstrap path.
|
|
1082
1424
|
*
|
|
1083
1425
|
* @deprecated Use Model.setAdapter(createPrismaDatabaseAdapter(...)) or another
|
|
1084
1426
|
* adapter-first bootstrap path instead.
|
|
@@ -1086,6 +1428,9 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
1086
1428
|
* @param client
|
|
1087
1429
|
*/
|
|
1088
1430
|
protected static setClient(client: Record<string, unknown>): void;
|
|
1431
|
+
/**
|
|
1432
|
+
* Primary runtime API: bind an adapter directly to the model class.
|
|
1433
|
+
*/
|
|
1089
1434
|
static setAdapter(adapter?: DatabaseAdapter): void;
|
|
1090
1435
|
static getTable(): string;
|
|
1091
1436
|
static getPrimaryKey(): string;
|
|
@@ -1172,17 +1517,19 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
1172
1517
|
* @param options
|
|
1173
1518
|
* @returns
|
|
1174
1519
|
*/
|
|
1175
|
-
static transaction<T>(callback: (
|
|
1520
|
+
static transaction<T>(callback: (context: TransactionContext) => T | Promise<T>, options?: TransactionOptions): Promise<Awaited<T>>;
|
|
1176
1521
|
/**
|
|
1177
|
-
*
|
|
1522
|
+
* Compatibility-only runtime API retained for 2.x migration support.
|
|
1523
|
+
* New runtime code should prefer `getAdapter()` and adapter-backed execution.
|
|
1524
|
+
*
|
|
1178
1525
|
* If a delegate name is provided, it will attempt to resolve that delegate.
|
|
1179
|
-
* Otherwise, it will attempt to resolve a
|
|
1526
|
+
* Otherwise, it will attempt to resolve a compatibility schema based on the model's name or
|
|
1180
1527
|
* the static `delegate` property.
|
|
1181
1528
|
*
|
|
1182
1529
|
* @param delegate
|
|
1183
1530
|
* @returns
|
|
1184
1531
|
*/
|
|
1185
|
-
static getDelegate<TDelegate extends
|
|
1532
|
+
static getDelegate<TDelegate extends ModelQuerySchemaLike = ModelQuerySchemaLike>(delegate?: string): TDelegate;
|
|
1186
1533
|
static getAdapter(): DatabaseAdapter | undefined;
|
|
1187
1534
|
/**
|
|
1188
1535
|
* Get a new query builder instance for the model.
|
|
@@ -1190,7 +1537,7 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
1190
1537
|
* @param this
|
|
1191
1538
|
* @returns
|
|
1192
1539
|
*/
|
|
1193
|
-
static query<TThis extends abstract new (attributes?: Record<string, unknown>) => Model<any
|
|
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>;
|
|
1194
1541
|
/**
|
|
1195
1542
|
* Boot hook for subclasses to register scopes or perform one-time setup.
|
|
1196
1543
|
*/
|
|
@@ -1205,14 +1552,14 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
1205
1552
|
* @param this
|
|
1206
1553
|
* @returns
|
|
1207
1554
|
*/
|
|
1208
|
-
static withTrashed<TThis extends abstract new (attributes?: Record<string, unknown>) => Model<any
|
|
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>;
|
|
1209
1556
|
/**
|
|
1210
1557
|
* Get a query builder instance that only includes soft-deleted records.
|
|
1211
1558
|
*
|
|
1212
1559
|
* @param this
|
|
1213
1560
|
* @returns
|
|
1214
1561
|
*/
|
|
1215
|
-
static onlyTrashed<TThis extends abstract new (attributes?: Record<string, unknown>) => Model<any
|
|
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>;
|
|
1216
1563
|
/**
|
|
1217
1564
|
* Get a query builder instance that excludes soft-deleted records.
|
|
1218
1565
|
* This is the default behavior of the query builder, but this method can be used
|
|
@@ -1223,7 +1570,7 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
1223
1570
|
* @param args
|
|
1224
1571
|
* @returns
|
|
1225
1572
|
*/
|
|
1226
|
-
static scope<TThis extends abstract new (attributes?: Record<string, unknown>) => Model<any
|
|
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>;
|
|
1227
1574
|
/**
|
|
1228
1575
|
* Get the soft delete configuration for the model, including whether
|
|
1229
1576
|
* soft deletes are enabled and the name of the deleted at column.
|
|
@@ -1254,7 +1601,7 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
1254
1601
|
* @param attributes
|
|
1255
1602
|
* @returns
|
|
1256
1603
|
*/
|
|
1257
|
-
static hydrateRetrieved<TModel>(this: ModelStatic<TModel,
|
|
1604
|
+
static hydrateRetrieved<TModel>(this: ModelStatic<TModel, ModelQuerySchemaLike>, attributes: Record<string, unknown>): Promise<TModel>;
|
|
1258
1605
|
/**
|
|
1259
1606
|
* Hydrate multiple model instances and dispatch the retrieved lifecycle event for each.
|
|
1260
1607
|
*
|
|
@@ -1262,7 +1609,7 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
1262
1609
|
* @param attributes
|
|
1263
1610
|
* @returns
|
|
1264
1611
|
*/
|
|
1265
|
-
static hydrateManyRetrieved<TModel>(this: ModelStatic<TModel,
|
|
1612
|
+
static hydrateManyRetrieved<TModel>(this: ModelStatic<TModel, ModelQuerySchemaLike>, attributes: Record<string, unknown>[]): Promise<TModel[]>;
|
|
1266
1613
|
/**
|
|
1267
1614
|
* Fill the model's attributes from a plain object, using the
|
|
1268
1615
|
* setAttribute method to ensure that mutators and casts are applied.
|
|
@@ -1278,7 +1625,7 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
1278
1625
|
* @param key
|
|
1279
1626
|
* @returns
|
|
1280
1627
|
*/
|
|
1281
|
-
getAttribute<
|
|
1628
|
+
getAttribute<TSelf extends this, TKey extends string>(this: TSelf, key: TKey): ModelAttributeValue<TSelf, TAttributes, TKey>;
|
|
1282
1629
|
getAttribute(key: string): unknown;
|
|
1283
1630
|
/**
|
|
1284
1631
|
* Set the value of an attribute, applying any set mutators or casts if defined.
|
|
@@ -1287,7 +1634,7 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
1287
1634
|
* @param value
|
|
1288
1635
|
* @returns
|
|
1289
1636
|
*/
|
|
1290
|
-
setAttribute<
|
|
1637
|
+
setAttribute<TSelf extends this, TKey extends string>(this: TSelf, key: TKey, value: ModelAttributeValue<TSelf, TAttributes, TKey>): this;
|
|
1291
1638
|
setAttribute(key: string, value: unknown): this;
|
|
1292
1639
|
/**
|
|
1293
1640
|
* Save the model to the database.
|
|
@@ -1460,38 +1807,38 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
1460
1807
|
* Define a belongs to many relationship.
|
|
1461
1808
|
*
|
|
1462
1809
|
* @param related
|
|
1463
|
-
|
|
1810
|
+
* @param throughTable
|
|
1464
1811
|
* @param foreignPivotKey
|
|
1465
1812
|
* @param relatedPivotKey
|
|
1466
1813
|
* @param parentKey
|
|
1467
1814
|
* @param relatedKey
|
|
1468
1815
|
* @returns
|
|
1469
1816
|
*/
|
|
1470
|
-
protected belongsToMany<TRelatedClass extends RelatedModelClass>(related: TRelatedClass,
|
|
1817
|
+
protected belongsToMany<TRelatedClass extends RelatedModelClass>(related: TRelatedClass, throughTable: string, foreignPivotKey: string, relatedPivotKey: string, parentKey?: string, relatedKey?: string): BelongsToManyRelation<this, InstanceType<TRelatedClass>>;
|
|
1471
1818
|
/**
|
|
1472
1819
|
* Define a has one through relationship.
|
|
1473
1820
|
*
|
|
1474
1821
|
* @param related
|
|
1475
|
-
|
|
1822
|
+
* @param throughTable
|
|
1476
1823
|
* @param firstKey
|
|
1477
1824
|
* @param secondKey
|
|
1478
1825
|
* @param localKey
|
|
1479
1826
|
* @param secondLocalKey
|
|
1480
1827
|
* @returns
|
|
1481
1828
|
*/
|
|
1482
|
-
protected hasOneThrough<TRelatedClass extends RelatedModelClass>(related: TRelatedClass,
|
|
1829
|
+
protected hasOneThrough<TRelatedClass extends RelatedModelClass>(related: TRelatedClass, throughTable: string, firstKey: string, secondKey: string, localKey?: string, secondLocalKey?: string): HasOneThroughRelation<this, InstanceType<TRelatedClass>>;
|
|
1483
1830
|
/**
|
|
1484
1831
|
* Define a has many through relationship.
|
|
1485
1832
|
*
|
|
1486
1833
|
* @param related
|
|
1487
|
-
|
|
1834
|
+
* @param throughTable
|
|
1488
1835
|
* @param firstKey
|
|
1489
1836
|
* @param secondKey
|
|
1490
1837
|
* @param localKey
|
|
1491
1838
|
* @param secondLocalKey
|
|
1492
1839
|
* @returns
|
|
1493
1840
|
*/
|
|
1494
|
-
protected hasManyThrough<TRelatedClass extends RelatedModelClass>(related: TRelatedClass,
|
|
1841
|
+
protected hasManyThrough<TRelatedClass extends RelatedModelClass>(related: TRelatedClass, throughTable: string, firstKey: string, secondKey: string, localKey?: string, secondLocalKey?: string): HasManyThroughRelation<this, InstanceType<TRelatedClass>>;
|
|
1495
1842
|
/**
|
|
1496
1843
|
* Define a polymorphic one to one relationship.
|
|
1497
1844
|
*
|
|
@@ -1514,14 +1861,14 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
|
|
|
1514
1861
|
* Define a polymorphic many to many relationship.
|
|
1515
1862
|
*
|
|
1516
1863
|
* @param related
|
|
1517
|
-
|
|
1864
|
+
* @param throughTable
|
|
1518
1865
|
* @param morphName
|
|
1519
1866
|
* @param relatedPivotKey
|
|
1520
1867
|
* @param parentKey
|
|
1521
1868
|
* @param relatedKey
|
|
1522
1869
|
* @returns
|
|
1523
1870
|
*/
|
|
1524
|
-
protected morphToMany<TRelatedClass extends RelatedModelClass>(related: TRelatedClass,
|
|
1871
|
+
protected morphToMany<TRelatedClass extends RelatedModelClass>(related: TRelatedClass, throughTable: string, morphName: string, relatedPivotKey: string, parentKey?: string, relatedKey?: string): MorphToManyRelation<this, InstanceType<TRelatedClass>>;
|
|
1525
1872
|
/**
|
|
1526
1873
|
* Resolve a get mutator method for a given attribute key, if it exists.
|
|
1527
1874
|
*
|
|
@@ -1649,7 +1996,7 @@ type Simplify<TValue> = { [TKey in keyof TValue]: TValue[TKey] } & {};
|
|
|
1649
1996
|
type ConventionalAutoManagedKeys = 'id' | 'createdAt' | 'updatedAt' | 'deletedAt';
|
|
1650
1997
|
type SingularKey<T extends string> = LowercaseString<T> extends `${infer Base}s` ? Base : LowercaseString<T>;
|
|
1651
1998
|
type PluralKey<T extends string> = `${SingularKey<T>}s`;
|
|
1652
|
-
type PrismaClientDelegates = { [TKey in keyof PrismaClient as PrismaClient[TKey] extends
|
|
1999
|
+
type PrismaClientDelegates = { [TKey in keyof PrismaClient as PrismaClient[TKey] extends ModelQuerySchemaLike ? TKey : never]: PrismaClient[TKey] };
|
|
1653
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;
|
|
1654
2001
|
type AttributeScalarFilter<TValue> = Omit<PrismaLikeScalarFilter, 'equals' | 'not' | 'in' | 'notIn' | 'lt' | 'lte' | 'gt' | 'gte' | 'contains' | 'startsWith' | 'endsWith'> & {
|
|
1655
2002
|
equals?: TValue;
|
|
@@ -1675,7 +2022,7 @@ type RequiredCreateKeys<TAttributes extends Record<string, unknown>> = Exclude<{
|
|
|
1675
2022
|
type AtLeastOne<TValue extends Record<string, unknown>> = { [TKey in keyof TValue]-?: Required<Pick<TValue, TKey>> & Partial<Omit<TValue, TKey>> }[keyof TValue];
|
|
1676
2023
|
type AttributeCreateInput<TAttributes extends Record<string, unknown>> = Simplify<Pick<TAttributes, RequiredCreateKeys<TAttributes>> & Partial<Omit<TAttributes, RequiredCreateKeys<TAttributes>>>>;
|
|
1677
2024
|
type AttributeUpdateInput<TAttributes extends Record<string, unknown>> = AtLeastOne<Partial<TAttributes>>;
|
|
1678
|
-
interface
|
|
2025
|
+
interface AttributeQuerySchema<TAttributes extends Record<string, unknown>> extends ModelQuerySchemaLike {
|
|
1679
2026
|
findMany: (args?: {
|
|
1680
2027
|
where?: AttributeWhereInput<TAttributes>;
|
|
1681
2028
|
include?: PrismaLikeInclude;
|
|
@@ -1709,11 +2056,27 @@ interface AttributeSchemaDelegate<TAttributes extends Record<string, unknown>> e
|
|
|
1709
2056
|
where?: AttributeWhereInput<TAttributes>;
|
|
1710
2057
|
}) => Promise<number>;
|
|
1711
2058
|
}
|
|
1712
|
-
type
|
|
1713
|
-
|
|
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>;
|
|
1714
2069
|
type ModelAttributes<TModel> = TModel extends Model<any, infer TAttributes> ? TAttributes : Record<string, any>;
|
|
1715
|
-
type
|
|
1716
|
-
type
|
|
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>;
|
|
1717
2080
|
type RelatedModelClass<TInstance = unknown> = (abstract new (attributes?: Record<string, unknown>) => TInstance) & RelationshipModelStatic;
|
|
1718
2081
|
type GlobalScope = (query: QueryBuilder<any, any>) => QueryBuilder<any, any> | void;
|
|
1719
2082
|
type ModelEventName = 'retrieved' | 'saving' | 'saved' | 'creating' | 'created' | 'updating' | 'updated' | 'deleting' | 'deleted' | 'restoring' | 'restored' | 'forceDeleting' | 'forceDeleted';
|
|
@@ -1816,7 +2179,7 @@ declare class Paginator<T> {
|
|
|
1816
2179
|
* @author Legacy (3m1n3nc3)
|
|
1817
2180
|
* @since 0.1.0
|
|
1818
2181
|
*/
|
|
1819
|
-
declare class QueryBuilder<TModel, TDelegate extends
|
|
2182
|
+
declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = ModelQuerySchemaLike> {
|
|
1820
2183
|
private readonly model;
|
|
1821
2184
|
private readonly adapter?;
|
|
1822
2185
|
private queryWhere?;
|
|
@@ -1846,28 +2209,28 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
|
|
|
1846
2209
|
* @param where
|
|
1847
2210
|
* @returns
|
|
1848
2211
|
*/
|
|
1849
|
-
where(where:
|
|
2212
|
+
where(where: QuerySchemaWhere<TDelegate>): this;
|
|
1850
2213
|
/**
|
|
1851
2214
|
* Adds an OR where clause to the query.
|
|
1852
2215
|
*
|
|
1853
2216
|
* @param where
|
|
1854
2217
|
* @returns
|
|
1855
2218
|
*/
|
|
1856
|
-
orWhere(where:
|
|
2219
|
+
orWhere(where: QuerySchemaWhere<TDelegate>): this;
|
|
1857
2220
|
/**
|
|
1858
2221
|
* Adds a NOT where clause to the query.
|
|
1859
2222
|
*
|
|
1860
2223
|
* @param where
|
|
1861
2224
|
* @returns
|
|
1862
2225
|
*/
|
|
1863
|
-
whereNot(where:
|
|
2226
|
+
whereNot(where: QuerySchemaWhere<TDelegate>): this;
|
|
1864
2227
|
/**
|
|
1865
2228
|
* Adds an OR NOT where clause to the query.
|
|
1866
2229
|
*
|
|
1867
2230
|
* @param where
|
|
1868
2231
|
* @returns
|
|
1869
2232
|
*/
|
|
1870
|
-
orWhereNot(where:
|
|
2233
|
+
orWhereNot(where: QuerySchemaWhere<TDelegate>): this;
|
|
1871
2234
|
/**
|
|
1872
2235
|
* Adds a null check for a key.
|
|
1873
2236
|
*
|
|
@@ -1939,6 +2302,30 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
|
|
|
1939
2302
|
* @returns
|
|
1940
2303
|
*/
|
|
1941
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;
|
|
1942
2329
|
/**
|
|
1943
2330
|
* Adds a strongly-typed OR NOT IN where clause for a single attribute key.
|
|
1944
2331
|
*
|
|
@@ -1989,7 +2376,7 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
|
|
|
1989
2376
|
* @param orderBy
|
|
1990
2377
|
* @returns
|
|
1991
2378
|
*/
|
|
1992
|
-
orderBy(orderBy:
|
|
2379
|
+
orderBy(orderBy: QuerySchemaOrderBy<TDelegate>): this;
|
|
1993
2380
|
/**
|
|
1994
2381
|
* Puts the query results in random order.
|
|
1995
2382
|
*
|
|
@@ -2024,7 +2411,7 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
|
|
|
2024
2411
|
* @param include
|
|
2025
2412
|
* @returns
|
|
2026
2413
|
*/
|
|
2027
|
-
include(include:
|
|
2414
|
+
include(include: QuerySchemaInclude<TDelegate>): this;
|
|
2028
2415
|
/**
|
|
2029
2416
|
* Adds eager loading for the specified relations.
|
|
2030
2417
|
* This will merge with any existing include clause.
|
|
@@ -2221,7 +2608,7 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
|
|
|
2221
2608
|
* @param select
|
|
2222
2609
|
* @returns
|
|
2223
2610
|
*/
|
|
2224
|
-
select(select:
|
|
2611
|
+
select(select: QuerySchemaSelect<TDelegate>): this;
|
|
2225
2612
|
/**
|
|
2226
2613
|
* Adds a skip clause to the query for pagination.
|
|
2227
2614
|
* This will overwrite any existing skip clause.
|
|
@@ -2251,6 +2638,13 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
|
|
|
2251
2638
|
* @returns
|
|
2252
2639
|
*/
|
|
2253
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;
|
|
2254
2648
|
/**
|
|
2255
2649
|
* Sets offset/limit for a 1-based page.
|
|
2256
2650
|
*
|
|
@@ -2395,6 +2789,7 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
|
|
|
2395
2789
|
* @returns
|
|
2396
2790
|
*/
|
|
2397
2791
|
updateOrInsert(attributes: Record<string, unknown>, values?: Record<string, unknown> | ((exists: boolean) => Record<string, unknown> | Promise<Record<string, unknown>>)): Promise<boolean>;
|
|
2792
|
+
private shouldFallbackUpdateOrInsertUpsert;
|
|
2398
2793
|
/**
|
|
2399
2794
|
* Insert new records or update existing records by one or more unique keys.
|
|
2400
2795
|
*
|
|
@@ -2405,12 +2800,19 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
|
|
|
2405
2800
|
*/
|
|
2406
2801
|
upsert(values: Array<Record<string, unknown>>, uniqueBy: string | string[], update?: string[] | null): Promise<number>;
|
|
2407
2802
|
/**
|
|
2408
|
-
* Deletes
|
|
2409
|
-
*
|
|
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.
|
|
2410
2812
|
*
|
|
2411
2813
|
* @returns
|
|
2412
2814
|
*/
|
|
2413
|
-
|
|
2815
|
+
deleteOrFail(): Promise<TModel>;
|
|
2414
2816
|
private tryBuildInsertSpec;
|
|
2415
2817
|
private tryBuildInsertManySpec;
|
|
2416
2818
|
private tryBuildUpsertSpec;
|
|
@@ -2535,12 +2937,23 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
|
|
|
2535
2937
|
private normalizeQuerySelect;
|
|
2536
2938
|
private normalizeQueryOrderBy;
|
|
2537
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;
|
|
2538
2951
|
private eagerLoadModels;
|
|
2539
2952
|
private normalizeRelationLoadSelect;
|
|
2540
2953
|
private normalizeRelationLoadOrderBy;
|
|
2541
2954
|
private normalizeRelationLoads;
|
|
2542
2955
|
private appendQueryCondition;
|
|
2543
|
-
private
|
|
2956
|
+
private toQuerySchemaWhere;
|
|
2544
2957
|
private buildSoftDeleteQueryCondition;
|
|
2545
2958
|
private buildQueryWhereCondition;
|
|
2546
2959
|
private tryBuildQuerySelectColumns;
|
|
@@ -2594,6 +3007,9 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
|
|
|
2594
3007
|
private canExecuteRelationFiltersInAdapter;
|
|
2595
3008
|
private canExecuteRelationAggregatesInAdapter;
|
|
2596
3009
|
private canExecuteRelationFeaturesInAdapter;
|
|
3010
|
+
private shouldUseCompatibilityRelationFallback;
|
|
3011
|
+
private hasUncompilableSqlRelationFilters;
|
|
3012
|
+
private hasUncompilableSqlRelationAggregates;
|
|
2597
3013
|
private tryBuildRelationFilterSpecs;
|
|
2598
3014
|
private tryBuildRelationAggregateSpecs;
|
|
2599
3015
|
private tryBuildRelationConstraintWhere;
|
|
@@ -2610,17 +3026,16 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
|
|
|
2610
3026
|
}
|
|
2611
3027
|
//#endregion
|
|
2612
3028
|
//#region src/types/ModelStatic.d.ts
|
|
2613
|
-
interface ModelStatic<TModel, TDelegate extends
|
|
2614
|
-
new (attributes?:
|
|
3029
|
+
interface ModelStatic<TModel, TDelegate extends ModelQuerySchemaLike = ModelQuerySchemaLike> {
|
|
3030
|
+
new (attributes?: QuerySchemaRow<TDelegate> extends Record<string, unknown> ? QuerySchemaRow<TDelegate> : Record<string, unknown>): TModel;
|
|
2615
3031
|
query: () => QueryBuilder<TModel, TDelegate>;
|
|
2616
|
-
hydrate: (attributes:
|
|
2617
|
-
hydrateMany: (attributes: (
|
|
2618
|
-
hydrateRetrieved: (attributes:
|
|
2619
|
-
hydrateManyRetrieved: (attributes: (
|
|
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[]>;
|
|
2620
3036
|
getAdapter: () => DatabaseAdapter | undefined;
|
|
2621
3037
|
getColumnMap: () => Record<string, string>;
|
|
2622
3038
|
getColumnName: (attribute: string) => string;
|
|
2623
|
-
getDelegate: (delegate?: string) => TDelegate;
|
|
2624
3039
|
getModelMetadata: () => ModelMetadata;
|
|
2625
3040
|
getPrimaryKey: () => string;
|
|
2626
3041
|
getRelationMetadata: (name: string) => RelationMetadata | null;
|
|
@@ -2635,7 +3050,6 @@ interface RelationshipModelStatic {
|
|
|
2635
3050
|
getAdapter: () => DatabaseAdapter | undefined;
|
|
2636
3051
|
getColumnMap: () => Record<string, string>;
|
|
2637
3052
|
getColumnName: (attribute: string) => string;
|
|
2638
|
-
getDelegate: (delegate?: string) => PrismaDelegateLike;
|
|
2639
3053
|
getModelMetadata: () => ModelMetadata;
|
|
2640
3054
|
getPrimaryKey: () => string;
|
|
2641
3055
|
getRelationMetadata: (name: string) => RelationMetadata | null;
|
|
@@ -2716,6 +3130,7 @@ interface RelationFilterSpec {
|
|
|
2716
3130
|
interface RelationLoadPlan {
|
|
2717
3131
|
relation: string;
|
|
2718
3132
|
constraint?: QueryCondition;
|
|
3133
|
+
softDeleteMode?: SoftDeleteQueryMode;
|
|
2719
3134
|
orderBy?: QueryOrderBy[];
|
|
2720
3135
|
limit?: number;
|
|
2721
3136
|
offset?: number;
|
|
@@ -2783,6 +3198,47 @@ interface RelationLoadSpec<TModel = unknown> {
|
|
|
2783
3198
|
models: TModel[];
|
|
2784
3199
|
relations: RelationLoadPlan[];
|
|
2785
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
|
+
};
|
|
2786
3242
|
interface AdapterTransactionContext {
|
|
2787
3243
|
isolationLevel?: string;
|
|
2788
3244
|
readOnly?: boolean;
|
|
@@ -2818,6 +3274,7 @@ interface DatabaseAdapter {
|
|
|
2818
3274
|
count: <TModel = unknown>(spec: AggregateSpec<TModel>) => Promise<number>;
|
|
2819
3275
|
exists?: <TModel = unknown>(spec: SelectSpec<TModel>) => Promise<boolean>;
|
|
2820
3276
|
loadRelations?: <TModel = unknown>(spec: RelationLoadSpec<TModel>) => Promise<void>;
|
|
3277
|
+
inspectQuery?: <TModel = unknown>(request: AdapterInspectionRequest<TModel>) => AdapterQueryInspection | null;
|
|
2821
3278
|
introspectModels?: (options?: AdapterModelIntrospectionOptions) => Promise<AdapterModelStructure[]>;
|
|
2822
3279
|
executeSchemaOperations?: (operations: SchemaOperation[]) => Promise<void>;
|
|
2823
3280
|
resetDatabase?: () => Promise<void>;
|
|
@@ -2849,6 +3306,7 @@ declare class KyselyDatabaseAdapter implements DatabaseAdapter {
|
|
|
2849
3306
|
private resolveSchemaColumnName;
|
|
2850
3307
|
private resolveSchemaIndexName;
|
|
2851
3308
|
private resolveSchemaForeignKeyName;
|
|
3309
|
+
private resolveSchemaEnumName;
|
|
2852
3310
|
private resolveSchemaColumnType;
|
|
2853
3311
|
private resolveSchemaColumnDefault;
|
|
2854
3312
|
private shouldUseIdentity;
|
|
@@ -2875,6 +3333,7 @@ declare class KyselyDatabaseAdapter implements DatabaseAdapter {
|
|
|
2875
3333
|
private buildOrderBy;
|
|
2876
3334
|
private buildConditionValueList;
|
|
2877
3335
|
private buildComparisonCondition;
|
|
3336
|
+
private buildRawWhereCondition;
|
|
2878
3337
|
private buildWhereCondition;
|
|
2879
3338
|
private buildWhereClause;
|
|
2880
3339
|
private buildPaginationClause;
|
|
@@ -2891,7 +3350,17 @@ declare class KyselyDatabaseAdapter implements DatabaseAdapter {
|
|
|
2891
3350
|
private buildRelationAggregateSelectList;
|
|
2892
3351
|
private buildCombinedWhereClause;
|
|
2893
3352
|
private buildSingleRowTargetCte;
|
|
2894
|
-
private
|
|
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;
|
|
2895
3364
|
/**
|
|
2896
3365
|
* Selects records from the database matching the specified criteria and returns
|
|
2897
3366
|
* them as an array of database rows.
|
|
@@ -2987,6 +3456,13 @@ declare class KyselyDatabaseAdapter implements DatabaseAdapter {
|
|
|
2987
3456
|
* @returns A promise that resolves to a boolean indicating whether any records match the criteria.
|
|
2988
3457
|
*/
|
|
2989
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>;
|
|
2990
3466
|
introspectModels(options?: AdapterModelIntrospectionOptions): Promise<AdapterModelStructure[]>;
|
|
2991
3467
|
executeSchemaOperations(operations: SchemaOperation[]): Promise<void>;
|
|
2992
3468
|
resetDatabase(): Promise<void>;
|
|
@@ -3038,13 +3514,18 @@ declare class PrismaDatabaseAdapter implements DatabaseAdapter {
|
|
|
3038
3514
|
private toComparisonWhere;
|
|
3039
3515
|
private toQueryWhere;
|
|
3040
3516
|
private buildFindArgs;
|
|
3517
|
+
private emitDebugQuery;
|
|
3518
|
+
private wrapExecutionError;
|
|
3519
|
+
private runWithDebug;
|
|
3520
|
+
inspectQuery<TModel = unknown>(_request: AdapterInspectionRequest<TModel>): AdapterQueryInspection | null;
|
|
3041
3521
|
private toQueryInclude;
|
|
3042
3522
|
introspectModels(options?: AdapterModelIntrospectionOptions): Promise<AdapterModelStructure[]>;
|
|
3043
3523
|
private resolveDelegate;
|
|
3044
3524
|
/**
|
|
3045
|
-
*
|
|
3046
|
-
*
|
|
3047
|
-
*
|
|
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.
|
|
3048
3529
|
*
|
|
3049
3530
|
* @param spec
|
|
3050
3531
|
* @returns
|
|
@@ -3190,6 +3671,7 @@ declare class CliApp {
|
|
|
3190
3671
|
* @returns The entire configuration object or the value of the specified key
|
|
3191
3672
|
*/
|
|
3192
3673
|
getConfig: GetUserConfig;
|
|
3674
|
+
private isUsingPrismaAdapter;
|
|
3193
3675
|
/**
|
|
3194
3676
|
* Utility to ensure directory exists
|
|
3195
3677
|
*
|
|
@@ -3304,13 +3786,14 @@ declare class CliApp {
|
|
|
3304
3786
|
factory?: boolean;
|
|
3305
3787
|
seeder?: boolean;
|
|
3306
3788
|
migration?: boolean;
|
|
3789
|
+
pivot?: boolean;
|
|
3307
3790
|
all?: boolean;
|
|
3308
3791
|
}): {
|
|
3309
3792
|
model: {
|
|
3310
3793
|
name: string;
|
|
3311
3794
|
path: string;
|
|
3312
3795
|
};
|
|
3313
|
-
prisma
|
|
3796
|
+
prisma?: {
|
|
3314
3797
|
path: string;
|
|
3315
3798
|
updated: boolean;
|
|
3316
3799
|
};
|
|
@@ -3329,11 +3812,11 @@ declare class CliApp {
|
|
|
3329
3812
|
};
|
|
3330
3813
|
/**
|
|
3331
3814
|
* Ensure that the Prisma schema has a model entry for the given model
|
|
3332
|
-
* and
|
|
3815
|
+
* and table names.
|
|
3333
3816
|
* If the entry does not exist, it will be created with a default `id` field.
|
|
3334
3817
|
*
|
|
3335
3818
|
* @param modelName The name of the model to ensure in the Prisma schema.
|
|
3336
|
-
* @param
|
|
3819
|
+
* @param tableName The table name to ensure in the Prisma schema.
|
|
3337
3820
|
*/
|
|
3338
3821
|
private ensurePrismaModelEntry;
|
|
3339
3822
|
/**
|
|
@@ -4131,8 +4614,8 @@ declare class DB {
|
|
|
4131
4614
|
static setAdapter(adapter?: DatabaseAdapter): void;
|
|
4132
4615
|
static getAdapter(): DatabaseAdapter | undefined;
|
|
4133
4616
|
getAdapter(): DatabaseAdapter | undefined;
|
|
4134
|
-
static table<TRow extends Record<string, unknown> = Record<string, unknown>>(table: string, options?: DatabaseTableOptions): QueryBuilder<TRow,
|
|
4135
|
-
table<TRow extends Record<string, unknown> = Record<string, unknown>>(table: string, options?: DatabaseTableOptions): QueryBuilder<TRow,
|
|
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>;
|
|
4136
4619
|
static transaction<TResult>(callback: (db: DB) => TResult | Promise<TResult>, context?: AdapterTransactionContext): Promise<TResult>;
|
|
4137
4620
|
transaction<TResult>(callback: (db: DB) => TResult | Promise<TResult>, context?: AdapterTransactionContext): Promise<TResult>;
|
|
4138
4621
|
private static createTableModel;
|
|
@@ -4196,6 +4679,16 @@ declare class QueryConstraintException extends ArkormException {
|
|
|
4196
4679
|
constructor(message: string, context?: ArkormErrorContext);
|
|
4197
4680
|
}
|
|
4198
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
|
|
4199
4692
|
//#region src/Exceptions/RelationResolutionException.d.ts
|
|
4200
4693
|
declare class RelationResolutionException extends ArkormException {
|
|
4201
4694
|
constructor(message: string, context?: ArkormErrorContext);
|
|
@@ -4608,21 +5101,29 @@ declare class PrimaryKeyGenerationPlanner {
|
|
|
4608
5101
|
* @returns The same configuration object.
|
|
4609
5102
|
*/
|
|
4610
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
|
+
*/
|
|
4611
5111
|
declare const bindAdapterToModels: (adapter: DatabaseAdapter, models: AdapterBindableModel[]) => DatabaseAdapter;
|
|
4612
5112
|
/**
|
|
4613
5113
|
* Get the user-provided ArkORM configuration.
|
|
4614
5114
|
*
|
|
5115
|
+
* @param key Optional specific configuration key to retrieve. If omitted, the entire configuration object is returned.
|
|
4615
5116
|
* @returns The user-provided ArkORM configuration object.
|
|
4616
5117
|
*/
|
|
4617
5118
|
declare const getUserConfig: GetUserConfig;
|
|
4618
5119
|
/**
|
|
4619
|
-
* Configure the ArkORM runtime with the provided
|
|
4620
|
-
*
|
|
5120
|
+
* Configure the ArkORM runtime with the provided runtime client resolver and
|
|
5121
|
+
* adapter-first options.
|
|
4621
5122
|
*
|
|
4622
|
-
* @param
|
|
4623
|
-
* @param
|
|
5123
|
+
* @param client
|
|
5124
|
+
* @param options
|
|
4624
5125
|
*/
|
|
4625
|
-
declare const configureArkormRuntime: (
|
|
5126
|
+
declare const configureArkormRuntime: (client?: ClientResolver, options?: Omit<ArkormConfig, "prisma">) => void;
|
|
4626
5127
|
/**
|
|
4627
5128
|
* Reset the ArkORM runtime configuration.
|
|
4628
5129
|
* This is primarily intended for testing purposes.
|
|
@@ -4644,17 +5145,22 @@ declare const loadArkormConfig: () => Promise<void>;
|
|
|
4644
5145
|
declare const ensureArkormConfigLoading: () => void;
|
|
4645
5146
|
declare const getDefaultStubsPath: () => string;
|
|
4646
5147
|
/**
|
|
4647
|
-
* Get the runtime
|
|
5148
|
+
* Get the runtime compatibility client.
|
|
4648
5149
|
* This function will trigger the loading of the ArkORM configuration if
|
|
4649
5150
|
* it hasn't already been loaded.
|
|
4650
5151
|
*
|
|
4651
5152
|
* @returns
|
|
4652
5153
|
*/
|
|
4653
|
-
declare const
|
|
5154
|
+
declare const getRuntimeClient: () => RuntimeClientLike | undefined;
|
|
5155
|
+
/**
|
|
5156
|
+
* @deprecated Use getRuntimeClient instead.
|
|
5157
|
+
*/
|
|
5158
|
+
declare const getRuntimePrismaClient: () => RuntimeClientLike | undefined;
|
|
4654
5159
|
declare const getRuntimeAdapter: () => DatabaseAdapter | undefined;
|
|
4655
|
-
declare const getActiveTransactionClient: () =>
|
|
4656
|
-
declare const
|
|
4657
|
-
declare const
|
|
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>;
|
|
4658
5164
|
/**
|
|
4659
5165
|
* Get the configured pagination URL driver factory from runtime config.
|
|
4660
5166
|
*
|
|
@@ -4667,39 +5173,45 @@ declare const getRuntimePaginationURLDriverFactory: () => PaginationURLDriverFac
|
|
|
4667
5173
|
* @returns
|
|
4668
5174
|
*/
|
|
4669
5175
|
declare const getRuntimePaginationCurrentPageResolver: () => PaginationCurrentPageResolver | undefined;
|
|
5176
|
+
declare const getRuntimeDebugHandler: () => ArkormDebugHandler | undefined;
|
|
5177
|
+
declare const emitRuntimeDebugEvent: (event: ArkormDebugEvent) => void;
|
|
4670
5178
|
/**
|
|
4671
|
-
* Check if a given value
|
|
5179
|
+
* Check if a given value matches Arkorm's query-schema contract
|
|
4672
5180
|
* by verifying the presence of common delegate methods.
|
|
4673
5181
|
*
|
|
4674
5182
|
* @param value The value to check.
|
|
4675
|
-
* @returns True if the value
|
|
5183
|
+
* @returns True if the value matches the query-schema contract, false otherwise.
|
|
4676
5184
|
*/
|
|
4677
|
-
declare const
|
|
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;
|
|
4678
5190
|
//#endregion
|
|
4679
5191
|
//#region src/helpers/prisma.d.ts
|
|
4680
|
-
type PrismaDelegateMap<TClient extends
|
|
5192
|
+
type PrismaDelegateMap<TClient extends RuntimeClientLike> = { [K in keyof TClient as TClient[K] extends ModelQuerySchemaLike ? K : never]: TClient[K] extends ModelQuerySchemaLike ? TClient[K] : never };
|
|
4681
5193
|
/**
|
|
4682
|
-
*
|
|
4683
|
-
*
|
|
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.
|
|
4684
5196
|
*
|
|
4685
5197
|
* @deprecated Prefer createPrismaDatabaseAdapter(prisma) for runtime usage.
|
|
4686
5198
|
*
|
|
4687
5199
|
* @param prisma The Prisma client instance to adapt.
|
|
4688
5200
|
* @param mapping An optional mapping of Prisma delegate names to ArkORM delegate names.
|
|
4689
|
-
* @returns A record of adapted Prisma
|
|
5201
|
+
* @returns A record of adapted Prisma compatibility query schemas.
|
|
4690
5202
|
*/
|
|
4691
|
-
declare function createPrismaAdapter(prisma:
|
|
5203
|
+
declare function createPrismaAdapter(prisma: RuntimeClientLike): Record<string, ModelQuerySchemaLike>;
|
|
4692
5204
|
/**
|
|
4693
|
-
*
|
|
5205
|
+
* Compatibility-only helper for legacy delegate-map bootstrapping during migration.
|
|
4694
5206
|
*
|
|
4695
|
-
* @deprecated Prefer createPrismaDatabaseAdapter(prisma, mapping)
|
|
4696
|
-
*
|
|
5207
|
+
* @deprecated Prefer createPrismaDatabaseAdapter(prisma, mapping). Direct delegate-map
|
|
5208
|
+
* bootstrapping is no longer part of the supported runtime path.
|
|
4697
5209
|
*
|
|
4698
5210
|
* @param prisma The Prisma client instance.
|
|
4699
5211
|
* @param mapping Optional mapping of Arkormˣ delegate names to Prisma delegate names.
|
|
4700
|
-
* @returns A
|
|
5212
|
+
* @returns A compatibility map keyed by Arkormˣ query-schema names.
|
|
4701
5213
|
*/
|
|
4702
|
-
declare function createPrismaDelegateMap(prisma:
|
|
5214
|
+
declare function createPrismaDelegateMap(prisma: RuntimeClientLike, mapping?: PrismaDelegateNameMapping): Record<string, ModelQuerySchemaLike>;
|
|
4703
5215
|
/**
|
|
4704
5216
|
* Infer the Prisma delegate name for a given model name using a simple convention.
|
|
4705
5217
|
*
|
|
@@ -4708,10 +5220,28 @@ declare function createPrismaDelegateMap(prisma: PrismaClientLike, mapping?: Pri
|
|
|
4708
5220
|
*/
|
|
4709
5221
|
declare function inferDelegateName(modelName: string): string;
|
|
4710
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
|
|
4711
5228
|
//#region src/helpers/runtime-module-loader.d.ts
|
|
4712
5229
|
declare class RuntimeModuleLoader {
|
|
4713
5230
|
static load<T = unknown>(filePath: string): Promise<T>;
|
|
4714
|
-
|
|
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>);
|
|
4715
5245
|
}
|
|
4716
5246
|
//#endregion
|
|
4717
5247
|
//#region src/URLDriver.d.ts
|
|
@@ -4732,4 +5262,4 @@ declare class URLDriver {
|
|
|
4732
5262
|
url(page: number): string;
|
|
4733
5263
|
}
|
|
4734
5264
|
//#endregion
|
|
4735
|
-
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, 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, 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 };
|