arkormx 2.0.0-next.0 → 2.0.0-next.2

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
@@ -22,11 +22,26 @@ interface PrismaTransactionCapableClient {
22
22
  $transaction: <TResult>(callback: PrismaTransactionCallback<TResult>, options?: PrismaTransactionOptions) => Promise<TResult>;
23
23
  }
24
24
  type ClientResolver = PrismaClientLike | (() => PrismaClientLike);
25
+ interface AdapterBindableModel {
26
+ setAdapter: (adapter?: DatabaseAdapter) => void;
27
+ }
28
+ interface ArkormBootContext {
29
+ prisma?: PrismaClientLike;
30
+ bindAdapter: (adapter: DatabaseAdapter, models: AdapterBindableModel[]) => DatabaseAdapter;
31
+ }
25
32
  interface ArkormConfig {
26
33
  /**
27
- * @property prisma A Prisma client instance or a function that returns a Prisma client instance.
34
+ * @property prisma Optional Prisma client instance or resolver used for compatibility, CLI flows, and Prisma-backed transactions.
35
+ */
36
+ prisma?: ClientResolver;
37
+ /**
38
+ * @property adapter Optional global adapter applied automatically to models that do not define a model-specific adapter.
28
39
  */
29
- prisma: ClientResolver;
40
+ adapter?: DatabaseAdapter;
41
+ /**
42
+ * @property boot Optional synchronous runtime boot hook for central adapter binding.
43
+ */
44
+ boot?: (context: ArkormBootContext) => void;
30
45
  /**
31
46
  * @property pagination Configuration options related to pagination behavior and URL generation.
32
47
  */
@@ -115,6 +130,19 @@ interface PrismaFindManyArgsLike {
115
130
  take?: number;
116
131
  }
117
132
  type PrismaLikeSortOrder = 'asc' | 'desc';
133
+ interface PrismaLikeScalarFilter {
134
+ equals?: unknown;
135
+ not?: unknown | PrismaLikeScalarFilter;
136
+ in?: unknown[];
137
+ notIn?: unknown[];
138
+ lt?: unknown;
139
+ lte?: unknown;
140
+ gt?: unknown;
141
+ gte?: unknown;
142
+ contains?: string;
143
+ startsWith?: string;
144
+ endsWith?: string;
145
+ }
118
146
  interface PrismaLikeWhereInput {
119
147
  AND?: PrismaLikeWhereInput[];
120
148
  OR?: PrismaLikeWhereInput[];
@@ -173,7 +201,11 @@ type DelegateUpdateArgs<TDelegate extends PrismaDelegateLike> = Parameters<TDele
173
201
  type DelegateUpdateData<TDelegate extends PrismaDelegateLike> = DelegateUpdateArgs<TDelegate> extends {
174
202
  data: infer TData;
175
203
  } ? FallbackIfUnknownOrNever<TData, Record<string, unknown>> : Record<string, unknown>;
204
+ type DelegateUniqueWhere<TDelegate extends PrismaDelegateLike> = DelegateUpdateArgs<TDelegate> extends {
205
+ where: infer TWhere;
206
+ } ? FallbackIfUnknownOrNever<TWhere, Record<string, unknown>> : Record<string, unknown>;
176
207
  type DelegateRow<TDelegate extends PrismaDelegateLike> = Exclude<Awaited<ReturnType<TDelegate['findFirst']>>, null>;
208
+ type DelegateRows<TDelegate extends PrismaDelegateLike> = Awaited<ReturnType<TDelegate['findMany']>>;
177
209
  type Serializable = Record<string, unknown>;
178
210
  //#endregion
179
211
  //#region src/types/metadata.d.ts
@@ -334,6 +366,10 @@ interface PrismaMigrationWorkflowOptions extends PrismaSchemaSyncOptions {
334
366
  migrateMode?: 'dev' | 'deploy';
335
367
  migrationName?: string;
336
368
  }
369
+ type MigrationInstanceLike = {
370
+ up: (...args: any[]) => Promise<void> | void;
371
+ down: (...args: any[]) => Promise<void> | void;
372
+ };
337
373
  interface AppliedMigrationEntry {
338
374
  id: string;
339
375
  file: string;
@@ -351,6 +387,7 @@ interface AppliedMigrationsState {
351
387
  migrations: AppliedMigrationEntry[];
352
388
  runs?: AppliedMigrationRun[];
353
389
  }
390
+ type MigrationClass = new () => MigrationInstanceLike;
354
391
  //#endregion
355
392
  //#region src/Collection.d.ts
356
393
  declare class ArkormCollection<T = any, X = T[]> extends Collection<T, X> {}
@@ -358,6 +395,7 @@ declare class ArkormCollection<T = any, X = T[]> extends Collection<T, X> {}
358
395
  //#region src/types/relationship.d.ts
359
396
  type RelationConstraint<TModel> = (query: QueryBuilder<TModel>) => QueryBuilder<TModel> | void;
360
397
  type RelationDefaultValue<TParent, TRelated> = Partial<ModelAttributes<TRelated>> | TRelated | ((parent: TParent) => Partial<ModelAttributes<TRelated>> | TRelated);
398
+ type RelationDefaultResolver<TParent, TRelated> = (parent: TParent) => Partial<ModelAttributes<TRelated>> | TRelated;
361
399
  interface RelationTableLookupSpec {
362
400
  table: string;
363
401
  where?: QueryCondition;
@@ -370,8 +408,18 @@ interface RelationColumnLookupSpec {
370
408
  lookup: RelationTableLookupSpec;
371
409
  column: string;
372
410
  }
411
+ interface RelationMetadataProvider {
412
+ getMetadata: () => RelationMetadata;
413
+ }
373
414
  //#endregion
374
415
  //#region src/relationship/RelationTableLoader.d.ts
416
+ /**
417
+ * Utility class responsible for loading data from relation tables, which are used to
418
+ * manage relationships between models in Arkorm.
419
+ *
420
+ * @author Legacy (3m1n3nc3)
421
+ * @since 2.0.0-next.0
422
+ */
375
423
  declare class RelationTableLoader {
376
424
  private readonly adapter;
377
425
  constructor(adapter: DatabaseAdapter);
@@ -960,6 +1008,7 @@ declare const defineFactory: <TModel, TAttributes extends FactoryAttributes = Pa
960
1008
  */
961
1009
  declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string, unknown> | string = Record<string, any>, TAttributes extends Record<string, unknown> = ModelAttributesOf<TSchema>> {
962
1010
  private static readonly lifecycleStates;
1011
+ private static readonly emittedDeprecationWarnings;
963
1012
  private static eventsSuppressed;
964
1013
  protected static factoryClass?: new () => ModelFactory<any, any>;
965
1014
  protected static adapter?: DatabaseAdapter;
@@ -982,9 +1031,13 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
982
1031
  protected changes: Record<string, unknown>;
983
1032
  protected readonly touchedAttributes: Set<string>;
984
1033
  constructor(attributes?: Record<string, unknown>);
1034
+ private static emitDeprecationWarning;
985
1035
  /**
986
1036
  * Set the Prisma client delegates for all models.
987
1037
  *
1038
+ * @deprecated Use Model.setAdapter(createPrismaDatabaseAdapter(...)) or another
1039
+ * adapter-first bootstrap path instead.
1040
+ *
988
1041
  * @param client
989
1042
  */
990
1043
  protected static setClient(client: Record<string, unknown>): void;
@@ -1092,7 +1145,7 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1092
1145
  * @param this
1093
1146
  * @returns
1094
1147
  */
1095
- 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> ? TSchema : Record<string, any>>>(this: TThis): QueryBuilder<TModel, TDelegate>;
1148
+ 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>;
1096
1149
  /**
1097
1150
  * Boot hook for subclasses to register scopes or perform one-time setup.
1098
1151
  */
@@ -1107,14 +1160,14 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1107
1160
  * @param this
1108
1161
  * @returns
1109
1162
  */
1110
- 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> ? TSchema : Record<string, any>>>(this: TThis): QueryBuilder<TModel, TDelegate>;
1163
+ 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>;
1111
1164
  /**
1112
1165
  * Get a query builder instance that only includes soft-deleted records.
1113
1166
  *
1114
1167
  * @param this
1115
1168
  * @returns
1116
1169
  */
1117
- 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> ? TSchema : Record<string, any>>>(this: TThis): QueryBuilder<TModel, TDelegate>;
1170
+ 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>;
1118
1171
  /**
1119
1172
  * Get a query builder instance that excludes soft-deleted records.
1120
1173
  * This is the default behavior of the query builder, but this method can be used
@@ -1125,7 +1178,7 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1125
1178
  * @param args
1126
1179
  * @returns
1127
1180
  */
1128
- 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> ? TSchema : Record<string, any>>>(this: TThis, name: string, ...args: unknown[]): QueryBuilder<TModel, TDelegate>;
1181
+ 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>;
1129
1182
  /**
1130
1183
  * Get the soft delete configuration for the model, including whether
1131
1184
  * soft deletes are enabled and the name of the deleted at column.
@@ -1252,6 +1305,7 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1252
1305
  * @returns
1253
1306
  */
1254
1307
  load(relations: string | string[] | EagerLoadMap): Promise<this>;
1308
+ setLoadedRelation(name: string, value: unknown): this;
1255
1309
  /**
1256
1310
  * Get the raw attributes of the model without applying any mutators or casts.
1257
1311
  *
@@ -1546,13 +1600,75 @@ declare abstract class Model<TSchema extends PrismaDelegateLike | Record<string,
1546
1600
  //#endregion
1547
1601
  //#region src/types/model.d.ts
1548
1602
  type LowercaseString<T extends string> = Lowercase<T>;
1603
+ type Simplify<TValue> = { [TKey in keyof TValue]: TValue[TKey] } & {};
1604
+ type ConventionalAutoManagedKeys = 'id' | 'createdAt' | 'updatedAt' | 'deletedAt';
1549
1605
  type SingularKey<T extends string> = LowercaseString<T> extends `${infer Base}s` ? Base : LowercaseString<T>;
1550
1606
  type PluralKey<T extends string> = `${SingularKey<T>}s`;
1551
1607
  type PrismaClientDelegates = { [TKey in keyof PrismaClient as PrismaClient[TKey] extends PrismaDelegateLike ? TKey : never]: PrismaClient[TKey] };
1552
1608
  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;
1553
- type DelegateForModelSchema<TSchema extends PrismaDelegateLike | Record<string, unknown> | string> = TSchema extends PrismaDelegateLike ? TSchema : TSchema extends string ? DelegateFromPrismaClient<TSchema> extends PrismaDelegateLike ? DelegateFromPrismaClient<TSchema> : PrismaDelegateLike : PrismaDelegateLike;
1609
+ type AttributeScalarFilter<TValue> = Omit<PrismaLikeScalarFilter, 'equals' | 'not' | 'in' | 'notIn' | 'lt' | 'lte' | 'gt' | 'gte' | 'contains' | 'startsWith' | 'endsWith'> & {
1610
+ equals?: TValue;
1611
+ not?: TValue | AttributeScalarFilter<TValue>;
1612
+ in?: TValue[];
1613
+ notIn?: TValue[];
1614
+ lt?: TValue;
1615
+ lte?: TValue;
1616
+ gt?: TValue;
1617
+ gte?: TValue;
1618
+ contains?: Extract<TValue, string>;
1619
+ startsWith?: Extract<TValue, string>;
1620
+ endsWith?: Extract<TValue, string>;
1621
+ };
1622
+ type AttributeWhereInput<TAttributes extends Record<string, unknown>> = {
1623
+ AND?: AttributeWhereInput<TAttributes>[];
1624
+ OR?: AttributeWhereInput<TAttributes>[];
1625
+ NOT?: AttributeWhereInput<TAttributes> | AttributeWhereInput<TAttributes>[];
1626
+ } & { [TKey in keyof TAttributes]?: TAttributes[TKey] | AttributeScalarFilter<NonNullable<TAttributes[TKey]>> | null };
1627
+ type AttributeOrderBy<TAttributes extends Record<string, unknown>> = Partial<Record<keyof TAttributes & string, PrismaLikeSortOrder>> | Array<Partial<Record<keyof TAttributes & string, PrismaLikeSortOrder>>>;
1628
+ type AttributeSelect<TAttributes extends Record<string, unknown>> = { [TKey in keyof TAttributes]?: boolean };
1629
+ type RequiredCreateKeys<TAttributes extends Record<string, unknown>> = Exclude<{ [TKey in keyof TAttributes]-?: undefined extends TAttributes[TKey] ? never : null extends TAttributes[TKey] ? never : TKey }[keyof TAttributes], ConventionalAutoManagedKeys>;
1630
+ type AtLeastOne<TValue extends Record<string, unknown>> = { [TKey in keyof TValue]-?: Required<Pick<TValue, TKey>> & Partial<Omit<TValue, TKey>> }[keyof TValue];
1631
+ type AttributeCreateInput<TAttributes extends Record<string, unknown>> = Simplify<Pick<TAttributes, RequiredCreateKeys<TAttributes>> & Partial<Omit<TAttributes, RequiredCreateKeys<TAttributes>>>>;
1632
+ type AttributeUpdateInput<TAttributes extends Record<string, unknown>> = AtLeastOne<Partial<TAttributes>>;
1633
+ interface AttributeSchemaDelegate<TAttributes extends Record<string, unknown>> extends PrismaDelegateLike {
1634
+ findMany: (args?: {
1635
+ where?: AttributeWhereInput<TAttributes>;
1636
+ include?: PrismaLikeInclude;
1637
+ orderBy?: AttributeOrderBy<TAttributes>;
1638
+ select?: AttributeSelect<TAttributes>;
1639
+ skip?: number;
1640
+ take?: number;
1641
+ }) => Promise<TAttributes[]>;
1642
+ findFirst: (args?: {
1643
+ where?: AttributeWhereInput<TAttributes>;
1644
+ include?: PrismaLikeInclude;
1645
+ orderBy?: AttributeOrderBy<TAttributes>;
1646
+ select?: AttributeSelect<TAttributes>;
1647
+ skip?: number;
1648
+ take?: number;
1649
+ }) => Promise<TAttributes | null>;
1650
+ create: (args: {
1651
+ data: AttributeCreateInput<TAttributes>;
1652
+ select?: PrismaLikeSelect;
1653
+ }) => Promise<TAttributes>;
1654
+ update: (args: {
1655
+ where: Partial<TAttributes>;
1656
+ data: AttributeUpdateInput<TAttributes>;
1657
+ select?: PrismaLikeSelect;
1658
+ }) => Promise<TAttributes>;
1659
+ delete: (args: {
1660
+ where: Partial<TAttributes>;
1661
+ select?: PrismaLikeSelect;
1662
+ }) => Promise<TAttributes>;
1663
+ count: (args?: {
1664
+ where?: AttributeWhereInput<TAttributes>;
1665
+ }) => Promise<number>;
1666
+ }
1667
+ 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>;
1554
1668
  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>;
1555
- type ModelAttributes<TModel> = TModel extends Model<infer TSchema> ? ModelAttributesOf<TSchema> : Record<string, any>;
1669
+ type ModelAttributes<TModel> = TModel extends Model<any, infer TAttributes> ? TAttributes : Record<string, any>;
1670
+ type ModelCreateData<TModel, TDelegate extends PrismaDelegateLike> = TModel extends Model<any, infer TAttributes> ? TDelegate extends AttributeSchemaDelegate<TAttributes> ? AttributeCreateInput<TAttributes> : DelegateCreateData<TDelegate> : DelegateCreateData<TDelegate>;
1671
+ type ModelUpdateData<TModel, TDelegate extends PrismaDelegateLike> = TModel extends Model<any, infer TAttributes> ? TDelegate extends AttributeSchemaDelegate<TAttributes> ? AttributeUpdateInput<TAttributes> : DelegateUpdateData<TDelegate> : DelegateUpdateData<TDelegate>;
1556
1672
  type RelatedModelClass<TInstance = unknown> = (abstract new (attributes?: Record<string, unknown>) => TInstance) & RelationshipModelStatic;
1557
1673
  type GlobalScope = (query: QueryBuilder<any, any>) => QueryBuilder<any, any> | void;
1558
1674
  type ModelEventName = 'retrieved' | 'saving' | 'saved' | 'creating' | 'created' | 'updating' | 'updated' | 'deleting' | 'deleted' | 'restoring' | 'restored' | 'forceDeleting' | 'forceDeleted';
@@ -1562,6 +1678,11 @@ type ModelEventHandler<TModel extends Model = Model> = {
1562
1678
  };
1563
1679
  type ModelEventHandlerConstructor<TModel extends Model = Model> = new () => ModelEventHandler<TModel>;
1564
1680
  type ModelEventDispatcher<TModel extends Model = Model> = ModelEventHandler<TModel> | ModelEventHandlerConstructor<TModel>;
1681
+ type ModelLifecycleState = {
1682
+ booted: boolean;
1683
+ booting: boolean;
1684
+ globalScopesSuppressed: number;
1685
+ };
1565
1686
  //#endregion
1566
1687
  //#region src/Paginator.d.ts
1567
1688
  /**
@@ -2160,28 +2281,28 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
2160
2281
  * @param data
2161
2282
  * @returns
2162
2283
  */
2163
- create(data: DelegateCreateData<TDelegate>): Promise<TModel>;
2284
+ create(data: ModelCreateData<TModel, TDelegate>): Promise<TModel>;
2164
2285
  /**
2165
2286
  * Creates multiple records and returns hydrated model instances.
2166
2287
  *
2167
2288
  * @param values
2168
2289
  * @returns
2169
2290
  */
2170
- createMany(values: DelegateCreateData<TDelegate>[]): Promise<TModel[]>;
2291
+ createMany(values: ModelCreateData<TModel, TDelegate>[]): Promise<TModel[]>;
2171
2292
  /**
2172
2293
  * Insert one or more records.
2173
2294
  *
2174
2295
  * @param values
2175
2296
  * @returns
2176
2297
  */
2177
- insert(values: DelegateCreateData<TDelegate> | DelegateCreateData<TDelegate>[]): Promise<boolean>;
2298
+ insert(values: ModelCreateData<TModel, TDelegate> | ModelCreateData<TModel, TDelegate>[]): Promise<boolean>;
2178
2299
  /**
2179
2300
  * Insert one or more records while ignoring insertion errors.
2180
2301
  *
2181
2302
  * @param values
2182
2303
  * @returns
2183
2304
  */
2184
- insertOrIgnore(values: DelegateCreateData<TDelegate> | DelegateCreateData<TDelegate>[]): Promise<number>;
2305
+ insertOrIgnore(values: ModelCreateData<TModel, TDelegate> | ModelCreateData<TModel, TDelegate>[]): Promise<number>;
2185
2306
  /**
2186
2307
  * Insert a record and return its primary key value.
2187
2308
  *
@@ -2189,7 +2310,7 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
2189
2310
  * @param sequence
2190
2311
  * @returns
2191
2312
  */
2192
- insertGetId(values: DelegateCreateData<TDelegate>, sequence?: string | null): Promise<unknown>;
2313
+ insertGetId(values: ModelCreateData<TModel, TDelegate>, sequence?: string | null): Promise<unknown>;
2193
2314
  /**
2194
2315
  * Insert records using values produced by another query/source.
2195
2316
  *
@@ -2213,14 +2334,14 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
2213
2334
  * @param data
2214
2335
  * @returns
2215
2336
  */
2216
- update(data: DelegateUpdateData<TDelegate>): Promise<TModel>;
2337
+ update(data: ModelUpdateData<TModel, TDelegate>): Promise<TModel>;
2217
2338
  /**
2218
2339
  * Update records using update-many semantics when available.
2219
2340
  *
2220
2341
  * @param data
2221
2342
  * @returns
2222
2343
  */
2223
- updateFrom(data: DelegateUpdateData<TDelegate>): Promise<number>;
2344
+ updateFrom(data: ModelUpdateData<TModel, TDelegate>): Promise<number>;
2224
2345
  /**
2225
2346
  * Insert a record when no match exists, otherwise update the matching record.
2226
2347
  *
@@ -2247,6 +2368,7 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
2247
2368
  delete(): Promise<TModel>;
2248
2369
  private tryBuildInsertSpec;
2249
2370
  private tryBuildInsertManySpec;
2371
+ private tryBuildUpsertSpec;
2250
2372
  private tryBuildInsertOrIgnoreManySpec;
2251
2373
  private tryBuildUpdateSpec;
2252
2374
  private tryBuildUpdateManySpec;
@@ -2367,6 +2489,7 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
2367
2489
  private normalizeQuerySelect;
2368
2490
  private normalizeQueryOrderBy;
2369
2491
  private cloneRelationLoads;
2492
+ private eagerLoadModels;
2370
2493
  private normalizeRelationLoadSelect;
2371
2494
  private normalizeRelationLoadOrderBy;
2372
2495
  private normalizeRelationLoads;
@@ -2387,6 +2510,7 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
2387
2510
  private executeReadExists;
2388
2511
  private executeInsertRow;
2389
2512
  private executeInsertManyRows;
2513
+ private executeUpsertRows;
2390
2514
  private executeUpdateRow;
2391
2515
  private executeUpdateManyRows;
2392
2516
  private executeDeleteRow;
@@ -2421,6 +2545,13 @@ declare class QueryBuilder<TModel, TDelegate extends PrismaDelegateLike = Prisma
2421
2545
  private hasRelationFilters;
2422
2546
  private hasOrRelationFilters;
2423
2547
  private hasRelationAggregates;
2548
+ private canExecuteRelationFiltersInAdapter;
2549
+ private canExecuteRelationAggregatesInAdapter;
2550
+ private canExecuteRelationFeaturesInAdapter;
2551
+ private tryBuildRelationFilterSpecs;
2552
+ private tryBuildRelationAggregateSpecs;
2553
+ private tryBuildRelationConstraintWhere;
2554
+ private isSqlRelationFeatureMetadata;
2424
2555
  private filterModelsByRelationConstraints;
2425
2556
  private getModelId;
2426
2557
  private buildSoftDeleteOnlyWhere;
@@ -2470,7 +2601,7 @@ type DatabasePrimitive = string | number | boolean | bigint | Date | null;
2470
2601
  type DatabaseValue = DatabasePrimitive | DatabaseRow | DatabaseValue[];
2471
2602
  type DatabaseRow = Record<string, unknown>;
2472
2603
  type DatabaseRows = DatabaseRow[];
2473
- type AdapterCapability = 'transactions' | 'returning' | 'insertMany' | 'updateMany' | 'deleteMany' | 'exists' | 'relationLoads' | 'relationAggregates' | 'relationFilters' | 'rawWhere';
2604
+ type AdapterCapability = 'transactions' | 'returning' | 'insertMany' | 'upsert' | 'updateMany' | 'deleteMany' | 'exists' | 'relationLoads' | 'relationAggregates' | 'relationFilters' | 'rawWhere';
2474
2605
  type AdapterCapabilities = Partial<Record<AdapterCapability, boolean>>;
2475
2606
  type QueryLogicalOperator = 'and' | 'or';
2476
2607
  type QueryComparisonOperator = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'in' | 'not-in' | 'contains' | 'starts-with' | 'ends-with' | 'is-null' | 'is-not-null';
@@ -2566,6 +2697,12 @@ interface InsertManySpec<TModel = unknown> {
2566
2697
  values: DatabaseRow[];
2567
2698
  ignoreDuplicates?: boolean;
2568
2699
  }
2700
+ interface UpsertSpec<TModel = unknown> {
2701
+ target: QueryTarget<TModel>;
2702
+ values: DatabaseRow[];
2703
+ uniqueBy: string[];
2704
+ updateColumns?: string[];
2705
+ }
2569
2706
  interface UpdateSpec<TModel = unknown> {
2570
2707
  target: QueryTarget<TModel>;
2571
2708
  where: QueryCondition;
@@ -2589,6 +2726,7 @@ interface DeleteManySpec<TModel = unknown> {
2589
2726
  interface AggregateSpec<TModel = unknown> {
2590
2727
  target: QueryTarget<TModel>;
2591
2728
  where?: QueryCondition;
2729
+ relationFilters?: RelationFilterSpec[];
2592
2730
  aggregate: AggregateSelection;
2593
2731
  softDeleteMode?: SoftDeleteQueryMode;
2594
2732
  }
@@ -2603,28 +2741,55 @@ interface AdapterTransactionContext {
2603
2741
  maxWait?: number;
2604
2742
  timeout?: number;
2605
2743
  }
2744
+ interface AdapterModelFieldStructure {
2745
+ name: string;
2746
+ type: string;
2747
+ nullable: boolean;
2748
+ }
2749
+ interface AdapterModelStructure {
2750
+ name?: string;
2751
+ table: string;
2752
+ fields: AdapterModelFieldStructure[];
2753
+ }
2754
+ interface AdapterModelIntrospectionOptions {
2755
+ tables?: string[];
2756
+ }
2606
2757
  interface DatabaseAdapter {
2607
2758
  readonly capabilities?: AdapterCapabilities;
2608
2759
  select: <TModel = unknown>(spec: SelectSpec<TModel>) => Promise<DatabaseRows>;
2609
2760
  selectOne: <TModel = unknown>(spec: SelectSpec<TModel>) => Promise<DatabaseRow | null>;
2610
2761
  insert: <TModel = unknown>(spec: InsertSpec<TModel>) => Promise<DatabaseRow>;
2611
2762
  insertMany?: <TModel = unknown>(spec: InsertManySpec<TModel>) => Promise<number>;
2763
+ upsert?: <TModel = unknown>(spec: UpsertSpec<TModel>) => Promise<number>;
2612
2764
  update: <TModel = unknown>(spec: UpdateSpec<TModel>) => Promise<DatabaseRow | null>;
2765
+ updateFirst?: <TModel = unknown>(spec: UpdateSpec<TModel>) => Promise<DatabaseRow | null>;
2613
2766
  updateMany?: <TModel = unknown>(spec: UpdateManySpec<TModel>) => Promise<number>;
2614
2767
  delete: <TModel = unknown>(spec: DeleteSpec<TModel>) => Promise<DatabaseRow | null>;
2768
+ deleteFirst?: <TModel = unknown>(spec: DeleteSpec<TModel>) => Promise<DatabaseRow | null>;
2615
2769
  deleteMany?: <TModel = unknown>(spec: DeleteManySpec<TModel>) => Promise<number>;
2616
2770
  count: <TModel = unknown>(spec: AggregateSpec<TModel>) => Promise<number>;
2617
2771
  exists?: <TModel = unknown>(spec: SelectSpec<TModel>) => Promise<boolean>;
2618
2772
  loadRelations?: <TModel = unknown>(spec: RelationLoadSpec<TModel>) => Promise<void>;
2773
+ introspectModels?: (options?: AdapterModelIntrospectionOptions) => Promise<AdapterModelStructure[]>;
2619
2774
  transaction: <TResult = unknown>(callback: (adapter: DatabaseAdapter) => TResult | Promise<TResult>, context?: AdapterTransactionContext) => Promise<TResult>;
2620
2775
  }
2621
2776
  //#endregion
2622
2777
  //#region src/adapters/KyselyDatabaseAdapter.d.ts
2623
2778
  type KyselyExecutor = Kysely<any> | Transaction<any>;
2779
+ type KyselyTableMapping = Record<string, string>;
2780
+ /**
2781
+ * Database adapter implementation for Kysely, allowing Arkorm to execute queries using Kysely
2782
+ * as the underlying query builder and executor.
2783
+ *
2784
+ * @author Legacy (3m1n3nc3)
2785
+ * @since 2.0.0-next.0
2786
+ */
2624
2787
  declare class KyselyDatabaseAdapter implements DatabaseAdapter {
2625
2788
  private readonly db;
2789
+ private readonly mapping;
2626
2790
  readonly capabilities: AdapterCapabilities;
2627
- constructor(db: KyselyExecutor);
2791
+ constructor(db: KyselyExecutor, mapping?: KyselyTableMapping);
2792
+ private introspectionTypeToTs;
2628
2793
  private resolveTable;
2629
2794
  private resolvePrimaryKey;
2630
2795
  private mapColumn;
@@ -2639,23 +2804,146 @@ declare class KyselyDatabaseAdapter implements DatabaseAdapter {
2639
2804
  private buildWhereCondition;
2640
2805
  private buildWhereClause;
2641
2806
  private buildPaginationClause;
2807
+ private buildColumnReference;
2808
+ private buildRelatedTargetFromRelation;
2809
+ private resolveMappedTable;
2810
+ private buildBelongsToManyJoinSource;
2811
+ private buildThroughJoinSource;
2812
+ private buildRelatedJoinCondition;
2813
+ private combineConditions;
2814
+ private buildRelationFilterExpression;
2815
+ private buildRelationFilterCondition;
2816
+ private buildQueryFilterCondition;
2817
+ private buildRelationAggregateSelectList;
2818
+ private buildCombinedWhereClause;
2819
+ private buildSingleRowTargetCte;
2642
2820
  private assertNoRelationLoads;
2821
+ /**
2822
+ * Selects records from the database matching the specified criteria and returns
2823
+ * them as an array of database rows.
2824
+ *
2825
+ * @param spec The specification defining the selection criteria.
2826
+ * @returns A promise that resolves to an array of database rows.
2827
+ */
2643
2828
  select<TModel = unknown>(spec: SelectSpec<TModel>): Promise<DatabaseRow[]>;
2829
+ /**
2830
+ * Selects a single record from the database matching the specified criteria and returns it as
2831
+ * a database row. If multiple records match the criteria, only the first one is returned.
2832
+ * If no records match, null is returned.
2833
+ *
2834
+ * @param spec The specification defining the selection criteria.
2835
+ * @returns A promise that resolves to a database row or null if no records match.
2836
+ */
2644
2837
  selectOne<TModel = unknown>(spec: SelectSpec<TModel>): Promise<DatabaseRow | null>;
2838
+ /**
2839
+ * Inserts a new record into the database with the specified values and returns the
2840
+ * inserted record as a database row.
2841
+ *
2842
+ * @param spec
2843
+ * @returns
2844
+ */
2645
2845
  insert<TModel = unknown>(spec: InsertSpec<TModel>): Promise<DatabaseRow>;
2846
+ /**
2847
+ * Inserts multiple records into the database with the specified values and returns the number
2848
+ * of records successfully inserted.
2849
+ *
2850
+ * @param spec The specification defining the values to be inserted.
2851
+ * @returns A promise that resolves to the number of records successfully inserted.
2852
+ */
2646
2853
  insertMany<TModel = unknown>(spec: InsertManySpec<TModel>): Promise<number>;
2854
+ upsert<TModel = unknown>(spec: UpsertSpec<TModel>): Promise<number>;
2855
+ /**
2856
+ * Updates records in the database matching the specified criteria with the given values
2857
+ * and returns the updated record as a database row.
2858
+ *
2859
+ * @param spec The specification defining the update criteria and values.
2860
+ * @returns A promise that resolves to the updated record as a database row, or null if no records match the criteria.
2861
+ */
2647
2862
  update<TModel = unknown>(spec: UpdateSpec<TModel>): Promise<DatabaseRow | null>;
2863
+ /**
2864
+ * Updates a single record in the database matching the specified criteria with the given values.
2865
+ *
2866
+ * @param spec
2867
+ * @returns
2868
+ */
2869
+ updateFirst<TModel = unknown>(spec: UpdateSpec<TModel>): Promise<DatabaseRow | null>;
2870
+ /**
2871
+ * Updates multiple records in the database matching the specified criteria with the
2872
+ * given values and returns the number of records successfully updated.
2873
+ *
2874
+ * @param spec The specification defining the update criteria and values.
2875
+ * @returns A promise that resolves to the number of records successfully updated.
2876
+ */
2648
2877
  updateMany<TModel = unknown>(spec: UpdateManySpec<TModel>): Promise<number>;
2878
+ /**
2879
+ * Deletes records from the database matching the specified criteria and returns the
2880
+ * deleted record as a database row.
2881
+ *
2882
+ * @param spec The specification defining the delete criteria.
2883
+ * @returns A promise that resolves to the deleted record as a database row, or null if no records match the criteria.
2884
+ */
2649
2885
  delete<TModel = unknown>(spec: DeleteSpec<TModel>): Promise<DatabaseRow | null>;
2886
+ /**
2887
+ * Deletes a single record from the database matching the specified criteria and returns it as a database row.
2888
+ *
2889
+ * @param spec
2890
+ * @returns
2891
+ */
2892
+ deleteFirst<TModel = unknown>(spec: DeleteSpec<TModel>): Promise<DatabaseRow | null>;
2893
+ /**
2894
+ * Deletes multiple records from the database matching the specified criteria and
2895
+ * returns the number of records successfully deleted.
2896
+ *
2897
+ * @param spec The specification defining the delete criteria.
2898
+ * @returns A promise that resolves to the number of records successfully deleted.
2899
+ */
2650
2900
  deleteMany<TModel = unknown>(spec: DeleteManySpec<TModel>): Promise<number>;
2901
+ /**
2902
+ * Counts the number of records in the database matching the specified criteria and returns
2903
+ * the count as a number.
2904
+ *
2905
+ * @param spec The specification defining the count criteria.
2906
+ * @returns A promise that resolves to the number of records matching the criteria.
2907
+ */
2651
2908
  count<TModel = unknown>(spec: AggregateSpec<TModel>): Promise<number>;
2909
+ /**
2910
+ * Checks for the existence of records matching the specified criteria.
2911
+ *
2912
+ * @param spec The specification defining the existence criteria.
2913
+ * @returns A promise that resolves to a boolean indicating whether any records match the criteria.
2914
+ */
2652
2915
  exists<TModel = unknown>(spec: SelectSpec<TModel>): Promise<boolean>;
2916
+ introspectModels(options?: AdapterModelIntrospectionOptions): Promise<AdapterModelStructure[]>;
2917
+ /**
2918
+ * Executes a series of database operations within a transaction.
2919
+ * The provided callback function is called with a new instance of the
2920
+ * KyselyDatabaseAdapter that is bound to the transaction context.
2921
+ *
2922
+ * @param callback The callback function containing the database operations to be executed within the transaction.
2923
+ * @param context The transaction context specifying options such as read-only mode and isolation level.
2924
+ * @returns A promise that resolves to the result of the callback function.
2925
+ */
2653
2926
  transaction<TResult = unknown>(callback: (adapter: DatabaseAdapter) => TResult | Promise<TResult>, context?: AdapterTransactionContext): Promise<TResult>;
2654
2927
  }
2655
- declare const createKyselyAdapter: (db: KyselyExecutor) => KyselyDatabaseAdapter;
2928
+ /**
2929
+ * Factory function to create a KyselyDatabaseAdapter instance with the given Kysely executor
2930
+ * and optional table name mapping.
2931
+ *
2932
+ * @param db The Kysely executor to be used by the adapter.
2933
+ * @param mapping Optional table name mapping for the adapter.
2934
+ * @returns A new instance of KyselyDatabaseAdapter.
2935
+ */
2936
+ declare const createKyselyAdapter: (db: KyselyExecutor, mapping?: KyselyTableMapping) => KyselyDatabaseAdapter;
2656
2937
  //#endregion
2657
2938
  //#region src/adapters/PrismaDatabaseAdapter.d.ts
2658
2939
  type PrismaDelegateNameMapping = Record<string, string>;
2940
+ /**
2941
+ * Database adapter implementation for Prisma, allowing Arkorm to execute queries using Prisma
2942
+ * as the underlying query builder and executor.
2943
+ *
2944
+ * @author Legacy (3m1n3nc3)
2945
+ * @since 2.0.0-next.0
2946
+ */
2659
2947
  declare class PrismaDatabaseAdapter implements DatabaseAdapter {
2660
2948
  private readonly prisma;
2661
2949
  private readonly mapping;
@@ -2665,27 +2953,121 @@ declare class PrismaDatabaseAdapter implements DatabaseAdapter {
2665
2953
  private hasTransactionSupport;
2666
2954
  private normalizeCandidate;
2667
2955
  private unique;
2956
+ private runtimeModelTypeToTs;
2957
+ private getRuntimeDataModel;
2668
2958
  private toQuerySelect;
2669
2959
  private toQueryOrderBy;
2670
2960
  private toComparisonWhere;
2671
2961
  private toQueryWhere;
2672
2962
  private buildFindArgs;
2673
2963
  private toQueryInclude;
2964
+ introspectModels(options?: AdapterModelIntrospectionOptions): Promise<AdapterModelStructure[]>;
2674
2965
  private resolveDelegate;
2966
+ /**
2967
+ * @todo Implement relationLoads by performing separate queries and merging results
2968
+ * in-memory, since Prisma does not support nested reads with constraints, ordering, or
2969
+ * pagination on related models as of now.
2970
+ *
2971
+ * @param spec
2972
+ * @returns
2973
+ */
2675
2974
  select<TModel = unknown>(spec: SelectSpec<TModel>): Promise<DatabaseRow[]>;
2975
+ /**
2976
+ * Selects a single record matching the specified criteria.
2977
+ *
2978
+ * @param spec
2979
+ * @returns
2980
+ */
2676
2981
  selectOne<TModel = unknown>(spec: SelectSpec<TModel>): Promise<DatabaseRow | null>;
2982
+ /**
2983
+ * Inserts a single record into the database and returns the created record.
2984
+ *
2985
+ * @param spec
2986
+ * @returns
2987
+ */
2677
2988
  insert<TModel = unknown>(spec: InsertSpec<TModel>): Promise<DatabaseRow>;
2989
+ /**
2990
+ * Inserts multiple records into the database.
2991
+ *
2992
+ * @param spec
2993
+ * @returns
2994
+ */
2678
2995
  insertMany<TModel = unknown>(spec: InsertManySpec<TModel>): Promise<number>;
2996
+ /**
2997
+ * Updates a single record matching the specified criteria and returns the updated record.
2998
+ *
2999
+ * @param spec
3000
+ * @returns
3001
+ */
2679
3002
  update<TModel = unknown>(spec: UpdateSpec<TModel>): Promise<DatabaseRow | null>;
3003
+ /**
3004
+ * Updates multiple records matching the specified criteria.
3005
+ *
3006
+ * @param spec
3007
+ * @returns
3008
+ */
2680
3009
  updateMany<TModel = unknown>(spec: UpdateManySpec<TModel>): Promise<number>;
3010
+ /**
3011
+ * Deletes a single record matching the specified criteria and returns the deleted record.
3012
+ *
3013
+ * @param spec
3014
+ * @returns
3015
+ */
2681
3016
  delete<TModel = unknown>(spec: DeleteSpec<TModel>): Promise<DatabaseRow | null>;
3017
+ /**
3018
+ * Deletes multiple records matching the specified criteria.
3019
+ *
3020
+ * @param spec
3021
+ * @returns
3022
+ */
2682
3023
  deleteMany<TModel = unknown>(spec: DeleteManySpec<TModel>): Promise<number>;
3024
+ /**
3025
+ * Counts the number of records matching the specified criteria.
3026
+ *
3027
+ * @param spec
3028
+ * @returns
3029
+ */
2683
3030
  count<TModel = unknown>(spec: AggregateSpec<TModel>): Promise<number>;
3031
+ /**
3032
+ * Checks for the existence of records matching the specified criteria.
3033
+ *
3034
+ * @param spec
3035
+ * @returns
3036
+ */
2684
3037
  exists<TModel = unknown>(spec: SelectSpec<TModel>): Promise<boolean>;
3038
+ /**
3039
+ * Loads related models for a batch of parent records based on the specified relation load plans.
3040
+ *
3041
+ * @param _spec
3042
+ */
2685
3043
  loadRelations<TModel = unknown>(_spec: RelationLoadSpec<TModel>): Promise<void>;
3044
+ /**
3045
+ * Executes a series of database operations within a transaction.
3046
+ * If the underlying Prisma client does not support transactions, an exception is thrown.
3047
+ *
3048
+ * @param callback
3049
+ * @param context
3050
+ * @returns
3051
+ */
2686
3052
  transaction<TResult = unknown>(callback: (adapter: DatabaseAdapter) => TResult | Promise<TResult>, context?: AdapterTransactionContext): Promise<TResult>;
2687
3053
  }
3054
+ /**
3055
+ * Factory function to create a PrismaDatabaseAdapter instance with the given
3056
+ * Prisma client and optional delegate name mapping.
3057
+ *
3058
+ * @param prisma The Prisma client instance to be used by the adapter.
3059
+ * @param mapping Optional mapping of delegate names.
3060
+ * @returns A new instance of PrismaDatabaseAdapter.
3061
+ */
2688
3062
  declare const createPrismaDatabaseAdapter: (prisma: PrismaClientLike, mapping?: PrismaDelegateNameMapping) => PrismaDatabaseAdapter;
3063
+ /**
3064
+ * Alias for createPrismaDatabaseAdapter to maintain backward compatibility with
3065
+ * previous versions of Arkorm that exported the adapter factory under a different name.
3066
+ *
3067
+ * @param prisma The Prisma client instance to be used by the adapter.
3068
+ * @param mapping Optional mapping of delegate names.
3069
+ * @returns A new instance of PrismaDatabaseAdapter.
3070
+ */
2689
3071
  declare const createPrismaCompatibilityAdapter: (prisma: PrismaClientLike, mapping?: PrismaDelegateNameMapping) => PrismaDatabaseAdapter;
2690
3072
  //#endregion
2691
3073
  //#region src/Attribute.d.ts
@@ -2705,6 +3087,14 @@ declare class Attribute<TGet = unknown, TSet = unknown> {
2705
3087
  declare function resolveCast(definition: CastDefinition): CastHandler;
2706
3088
  //#endregion
2707
3089
  //#region src/cli/CliApp.d.ts
3090
+ type SyncedModelsResult = {
3091
+ source: 'adapter' | 'prisma';
3092
+ schemaPath?: string;
3093
+ modelsDir: string;
3094
+ total: number;
3095
+ updated: string[];
3096
+ skipped: string[];
3097
+ };
2708
3098
  /**
2709
3099
  * Main application class for the Arkormˣ CLI.
2710
3100
  *
@@ -2887,6 +3277,8 @@ declare class CliApp {
2887
3277
  private collectEnumReferencesFromNode;
2888
3278
  private collectEnumReferences;
2889
3279
  private syncPrismaEnumImports;
3280
+ private parseModelSyncSource;
3281
+ private syncModelFiles;
2890
3282
  /**
2891
3283
  * Parse Prisma enum definitions from a schema and return their member names.
2892
3284
  *
@@ -2922,6 +3314,10 @@ declare class CliApp {
2922
3314
  * @returns An object containing the updated content and a flag indicating if it was updated.
2923
3315
  */
2924
3316
  private syncModelDeclarations;
3317
+ syncModels(options?: {
3318
+ schemaPath?: string;
3319
+ modelsDir?: string;
3320
+ }): Promise<SyncedModelsResult>;
2925
3321
  /**
2926
3322
  * Sync model attribute declarations in model files based on the Prisma schema.
2927
3323
  * This method reads the Prisma schema to extract model definitions and their
@@ -4024,6 +4420,7 @@ declare const runMigrationWithPrisma: (migration: Migration | (new () => Migrati
4024
4420
  * @returns The same configuration object.
4025
4421
  */
4026
4422
  declare const defineConfig: (config: ArkormConfig) => ArkormConfig;
4423
+ declare const bindAdapterToModels: (adapter: DatabaseAdapter, models: AdapterBindableModel[]) => DatabaseAdapter;
4027
4424
  /**
4028
4425
  * Get the user-provided ArkORM configuration.
4029
4426
  *
@@ -4037,7 +4434,7 @@ declare const getUserConfig: GetUserConfig;
4037
4434
  * @param prisma
4038
4435
  * @param mapping
4039
4436
  */
4040
- declare const configureArkormRuntime: (prisma: ClientResolver, options?: Omit<ArkormConfig, "prisma">) => void;
4437
+ declare const configureArkormRuntime: (prisma?: ClientResolver, options?: Omit<ArkormConfig, "prisma">) => void;
4041
4438
  /**
4042
4439
  * Reset the ArkORM runtime configuration.
4043
4440
  * This is primarily intended for testing purposes.
@@ -4066,6 +4463,7 @@ declare const getDefaultStubsPath: () => string;
4066
4463
  * @returns
4067
4464
  */
4068
4465
  declare const getRuntimePrismaClient: () => PrismaClientLike | undefined;
4466
+ declare const getRuntimeAdapter: () => DatabaseAdapter | undefined;
4069
4467
  declare const getActiveTransactionClient: () => PrismaClientLike | undefined;
4070
4468
  declare const isTransactionCapableClient: (value: unknown) => value is PrismaTransactionCapableClient;
4071
4469
  declare const runArkormTransaction: <TResult>(callback: PrismaTransactionCallback<TResult>, options?: PrismaTransactionOptions) => Promise<TResult>;
@@ -4096,6 +4494,8 @@ type PrismaDelegateMap<TClient extends PrismaClientLike> = { [K in keyof TClient
4096
4494
  * Create an adapter to convert a Prisma client instance into a format
4097
4495
  * compatible with ArkORM's expectations.
4098
4496
  *
4497
+ * @deprecated Prefer createPrismaDatabaseAdapter(prisma) for runtime usage.
4498
+ *
4099
4499
  * @param prisma The Prisma client instance to adapt.
4100
4500
  * @param mapping An optional mapping of Prisma delegate names to ArkORM delegate names.
4101
4501
  * @returns A record of adapted Prisma delegates compatible with ArkORM.
@@ -4104,6 +4504,9 @@ declare function createPrismaAdapter(prisma: PrismaClientLike): Record<string, P
4104
4504
  /**
4105
4505
  * Create a delegate mapping record for Model.setClient() from a Prisma client.
4106
4506
  *
4507
+ * @deprecated Prefer createPrismaDatabaseAdapter(prisma, mapping) and bind the
4508
+ * resulting adapter with Model.setAdapter(...).
4509
+ *
4107
4510
  * @param prisma The Prisma client instance.
4108
4511
  * @param mapping Optional mapping of Arkormˣ delegate names to Prisma delegate names.
4109
4512
  * @returns A delegate map keyed by Arkormˣ delegate names.
@@ -4140,4 +4543,4 @@ declare class URLDriver {
4140
4543
  url(page: number): string;
4141
4544
  }
4142
4545
  //#endregion
4143
- export { ArkormCollection, ArkormErrorContext, ArkormException, Attribute, AttributeOptions, CliApp, EnumBuilder, ForeignKeyBuilder, InitCommand, InlineFactory, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateRollbackCommand, Migration, MigrationHistoryCommand, MissingDelegateException, Model, ModelFactory, ModelNotFoundException, ModelsSyncCommand, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, Paginator, PrismaDatabaseAdapter, PrismaDelegateMap, PrismaDelegateNameMapping, QueryBuilder, QueryConstraintException, RelationResolutionException, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToPrismaSchema, applyMigrationToPrismaSchema, applyOperationsToPrismaSchema, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, removeAppliedMigration, resetArkormRuntimeForTests, resolveCast, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, toMigrationFileSlug, toModelName, writeAppliedMigrationsState };
4546
+ 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, DatabaseAdapter, DatabasePrimitive, DatabaseRow, DatabaseRows, DatabaseValue, DelegateCreateData, DelegateFindManyArgs, DelegateForModelSchema, DelegateInclude, DelegateOrderBy, DelegateRow, DelegateRows, DelegateSelect, DelegateUniqueWhere, DelegateUpdateArgs, DelegateUpdateData, DelegateWhere, DeleteManySpec, DeleteSpec, EagerLoadConstraint, EagerLoadMap, EnumBuilder, FactoryAttributes, FactoryDefinition, FactoryModelConstructor, FactoryState, ForeignKeyBuilder, GenerateMigrationOptions, GeneratedMigrationFile, GetUserConfig, GlobalScope, HasManyRelationMetadata, HasManyThroughRelationMetadata, HasOneRelationMetadata, HasOneThroughRelationMetadata, InitCommand, InlineFactory, InsertManySpec, InsertSpec, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateRollbackCommand, Migration, MigrationClass, MigrationHistoryCommand, MigrationInstanceLike, MissingDelegateException, Model, ModelAttributes, ModelAttributesOf, 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, PrismaClientLike, PrismaDatabaseAdapter, PrismaDelegateLike, PrismaDelegateMap, PrismaDelegateNameMapping, PrismaFindManyArgsLike, PrismaLikeInclude, PrismaLikeOrderBy, PrismaLikeScalarFilter, PrismaLikeSelect, PrismaLikeSortOrder, PrismaLikeWhereInput, PrismaMigrationWorkflowOptions, PrismaSchemaSyncOptions, PrismaTransactionCallback, PrismaTransactionCapableClient, PrismaTransactionOptions, QueryBuilder, QueryComparisonCondition, QueryComparisonOperator, QueryCondition, QueryConstraintException, QueryGroupCondition, QueryLogicalOperator, QueryNotCondition, QueryOrderBy, QueryRawCondition, QuerySelectColumn, QueryTarget, RelatedModelClass, RelationAggregateSpec, RelationColumnLookupSpec, RelationConstraint, RelationDefaultResolver, RelationDefaultValue, RelationFilterSpec, RelationLoadPlan, RelationLoadSpec, RelationMetadata, RelationMetadataProvider, RelationMetadataType, RelationResolutionException, RelationTableLookupSpec, RelationshipModelStatic, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, SchemaColumn, SchemaColumnType, SchemaForeignKey, SchemaForeignKeyAction, SchemaIndex, SchemaOperation, SchemaTableAlterOperation, SchemaTableCreateOperation, SchemaTableDropOperation, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, SelectSpec, Serializable, SimplePaginationMeta, SoftDeleteConfig, SoftDeleteQueryMode, SortDirection, TableBuilder, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, UpdateManySpec, UpdateSpec, UpsertSpec, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToPrismaSchema, applyMigrationToPrismaSchema, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getRuntimeAdapter, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, removeAppliedMigration, resetArkormRuntimeForTests, resolveCast, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, toMigrationFileSlug, toModelName, writeAppliedMigrationsState };