arkormx 2.0.0 → 2.0.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/README.md +2 -1
- package/dist/index.cjs +91 -39
- package/dist/index.d.cts +403 -393
- package/dist/index.d.mts +403 -393
- package/dist/index.mjs +91 -39
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -110,332 +110,6 @@ interface AppliedMigrationsState {
|
|
|
110
110
|
}
|
|
111
111
|
type MigrationClass = new () => MigrationInstanceLike;
|
|
112
112
|
//#endregion
|
|
113
|
-
//#region src/types/core.d.ts
|
|
114
|
-
type CastType = 'string' | 'number' | 'boolean' | 'date' | 'json' | 'array';
|
|
115
|
-
interface CastHandler<T = unknown> {
|
|
116
|
-
get: (value: unknown) => T;
|
|
117
|
-
set: (value: unknown) => unknown;
|
|
118
|
-
}
|
|
119
|
-
type CastDefinition = CastType | CastHandler;
|
|
120
|
-
type CastMap = Record<string, CastDefinition>;
|
|
121
|
-
type RuntimeClientLike = PrismaClient | Record<string, unknown>;
|
|
122
|
-
interface TransactionOptions {
|
|
123
|
-
maxWait?: number;
|
|
124
|
-
timeout?: number;
|
|
125
|
-
isolationLevel?: string;
|
|
126
|
-
}
|
|
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>;
|
|
134
|
-
}
|
|
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);
|
|
156
|
-
interface AdapterBindableModel {
|
|
157
|
-
setAdapter: (adapter?: DatabaseAdapter) => void;
|
|
158
|
-
}
|
|
159
|
-
interface ArkormBootContext {
|
|
160
|
-
client?: RuntimeClientLike;
|
|
161
|
-
/**
|
|
162
|
-
* @deprecated Use client instead.
|
|
163
|
-
*/
|
|
164
|
-
prisma?: RuntimeClientLike;
|
|
165
|
-
bindAdapter: (adapter: DatabaseAdapter, models: AdapterBindableModel[]) => DatabaseAdapter;
|
|
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;
|
|
187
|
-
interface ArkormConfig {
|
|
188
|
-
/**
|
|
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.
|
|
195
|
-
*/
|
|
196
|
-
prisma?: ClientResolver;
|
|
197
|
-
/**
|
|
198
|
-
* @property adapter Optional global adapter applied automatically to models that do not define a model-specific adapter.
|
|
199
|
-
*/
|
|
200
|
-
adapter?: DatabaseAdapter;
|
|
201
|
-
/**
|
|
202
|
-
* @property boot Optional synchronous runtime boot hook for central adapter binding.
|
|
203
|
-
*/
|
|
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;
|
|
210
|
-
/**
|
|
211
|
-
* @property pagination Configuration options related to pagination behavior and URL generation.
|
|
212
|
-
*/
|
|
213
|
-
pagination?: {
|
|
214
|
-
urlDriver?: PaginationURLDriverFactory;
|
|
215
|
-
resolveCurrentPage?: PaginationCurrentPageResolver;
|
|
216
|
-
};
|
|
217
|
-
/**
|
|
218
|
-
* @property features Optional feature flags for persisted non-Prisma runtime metadata.
|
|
219
|
-
*/
|
|
220
|
-
features?: {
|
|
221
|
-
/**
|
|
222
|
-
* @property persistedColumnMappings Persist migration-defined column mappings for non-Prisma adapters.
|
|
223
|
-
* Defaults to true.
|
|
224
|
-
*/
|
|
225
|
-
persistedColumnMappings?: boolean;
|
|
226
|
-
/**
|
|
227
|
-
* @property persistedEnums Persist migration-defined enum values for non-Prisma adapters.
|
|
228
|
-
* Defaults to true.
|
|
229
|
-
*/
|
|
230
|
-
persistedEnums?: boolean;
|
|
231
|
-
};
|
|
232
|
-
/**
|
|
233
|
-
* @property paths Optional custom paths for various generated files.
|
|
234
|
-
*/
|
|
235
|
-
paths?: {
|
|
236
|
-
/**
|
|
237
|
-
* @property stubs Optional custom path for stub files used in code generation.
|
|
238
|
-
*/
|
|
239
|
-
stubs?: string;
|
|
240
|
-
/**
|
|
241
|
-
* @property seeders Optional custom path for seeder files.
|
|
242
|
-
*/
|
|
243
|
-
seeders?: string;
|
|
244
|
-
/**
|
|
245
|
-
* @property models Optional custom path for model files.
|
|
246
|
-
*/
|
|
247
|
-
models?: string;
|
|
248
|
-
/**
|
|
249
|
-
* @property migrations Optional custom path for migration files.
|
|
250
|
-
*/
|
|
251
|
-
migrations?: string;
|
|
252
|
-
/**
|
|
253
|
-
* @property factories Optional custom path for factory files.
|
|
254
|
-
*/
|
|
255
|
-
factories?: string;
|
|
256
|
-
/**
|
|
257
|
-
* @property buildOutput Optional custom path for the development output directory.
|
|
258
|
-
*/
|
|
259
|
-
buildOutput?: string;
|
|
260
|
-
};
|
|
261
|
-
/**
|
|
262
|
-
* @property outputExt Optional file extension for generated files, either 'ts' or 'js'.
|
|
263
|
-
*/
|
|
264
|
-
outputExt?: 'ts' | 'js';
|
|
265
|
-
}
|
|
266
|
-
interface GetUserConfig {
|
|
267
|
-
/**
|
|
268
|
-
* Get the user-provided ArkORM configuration.
|
|
269
|
-
*/
|
|
270
|
-
(): Partial<ArkormConfig>;
|
|
271
|
-
/**
|
|
272
|
-
* Get a specific user configuration value
|
|
273
|
-
* @param key Optional specific configuration key to retrieve
|
|
274
|
-
*/
|
|
275
|
-
<K extends keyof ArkormConfig>(key: K): Partial<ArkormConfig>[K];
|
|
276
|
-
}
|
|
277
|
-
interface PaginationMeta {
|
|
278
|
-
total: number;
|
|
279
|
-
perPage: number;
|
|
280
|
-
currentPage: number;
|
|
281
|
-
lastPage: number;
|
|
282
|
-
from: number | null;
|
|
283
|
-
to: number | null;
|
|
284
|
-
}
|
|
285
|
-
interface SimplePaginationMeta {
|
|
286
|
-
perPage: number;
|
|
287
|
-
currentPage: number;
|
|
288
|
-
from: number | null;
|
|
289
|
-
to: number | null;
|
|
290
|
-
hasMorePages: boolean;
|
|
291
|
-
}
|
|
292
|
-
interface PaginationOptions {
|
|
293
|
-
path?: string;
|
|
294
|
-
query?: Record<string, string | number | boolean | null | undefined>;
|
|
295
|
-
fragment?: string;
|
|
296
|
-
pageName?: string;
|
|
297
|
-
}
|
|
298
|
-
type PaginationCurrentPageResolver = (pageName: string, options: PaginationOptions) => number | undefined;
|
|
299
|
-
interface PaginationURLDriver {
|
|
300
|
-
getPageName: () => string;
|
|
301
|
-
url: (page: number) => string;
|
|
302
|
-
}
|
|
303
|
-
type PaginationURLDriverFactory = (options: PaginationOptions) => PaginationURLDriver;
|
|
304
|
-
interface PrismaFindManyArgsLike {
|
|
305
|
-
where?: unknown;
|
|
306
|
-
include?: unknown;
|
|
307
|
-
orderBy?: unknown;
|
|
308
|
-
select?: unknown;
|
|
309
|
-
skip?: number;
|
|
310
|
-
take?: number;
|
|
311
|
-
}
|
|
312
|
-
type PrismaLikeSortOrder = 'asc' | 'desc';
|
|
313
|
-
interface PrismaLikeScalarFilter {
|
|
314
|
-
equals?: unknown;
|
|
315
|
-
not?: unknown | PrismaLikeScalarFilter;
|
|
316
|
-
in?: unknown[];
|
|
317
|
-
notIn?: unknown[];
|
|
318
|
-
lt?: unknown;
|
|
319
|
-
lte?: unknown;
|
|
320
|
-
gt?: unknown;
|
|
321
|
-
gte?: unknown;
|
|
322
|
-
contains?: string;
|
|
323
|
-
startsWith?: string;
|
|
324
|
-
endsWith?: string;
|
|
325
|
-
}
|
|
326
|
-
interface PrismaLikeWhereInput {
|
|
327
|
-
AND?: PrismaLikeWhereInput[];
|
|
328
|
-
OR?: PrismaLikeWhereInput[];
|
|
329
|
-
NOT?: PrismaLikeWhereInput | PrismaLikeWhereInput[];
|
|
330
|
-
[key: string]: unknown;
|
|
331
|
-
}
|
|
332
|
-
type PrismaLikeOrderBy = Record<string, PrismaLikeSortOrder> | Record<string, PrismaLikeSortOrder>[];
|
|
333
|
-
interface PrismaLikeSelect {
|
|
334
|
-
[key: string]: boolean | {
|
|
335
|
-
select?: PrismaLikeSelect;
|
|
336
|
-
include?: PrismaLikeInclude;
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
interface PrismaLikeInclude {
|
|
340
|
-
[key: string]: boolean | {
|
|
341
|
-
where?: PrismaLikeWhereInput;
|
|
342
|
-
orderBy?: PrismaLikeOrderBy;
|
|
343
|
-
select?: PrismaLikeSelect;
|
|
344
|
-
include?: PrismaLikeInclude;
|
|
345
|
-
skip?: number;
|
|
346
|
-
take?: number;
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
type EagerLoadConstraint = (query: unknown) => unknown;
|
|
350
|
-
type EagerLoadMap = Record<string, EagerLoadConstraint | undefined>;
|
|
351
|
-
interface SoftDeleteConfig {
|
|
352
|
-
enabled: boolean;
|
|
353
|
-
column: string;
|
|
354
|
-
}
|
|
355
|
-
interface ModelQuerySchemaLike {
|
|
356
|
-
findMany: (args?: any) => Promise<unknown[]>;
|
|
357
|
-
findFirst: (args?: any) => Promise<unknown | null>;
|
|
358
|
-
create: (args: any) => Promise<unknown>;
|
|
359
|
-
update: (args: any) => Promise<unknown>;
|
|
360
|
-
delete: (args: any) => Promise<unknown>;
|
|
361
|
-
count: (args?: any) => Promise<number>;
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* @deprecated Use ModelQuerySchemaLike instead.
|
|
365
|
-
*/
|
|
366
|
-
type PrismaDelegateLike = ModelQuerySchemaLike;
|
|
367
|
-
type FallbackIfUnknownOrNever<TValue, TFallback> = [TValue] extends [never] ? TFallback : unknown extends TValue ? TFallback : TValue;
|
|
368
|
-
type QuerySchemaFindManyArgs<TSchema extends ModelQuerySchemaLike> = FallbackIfUnknownOrNever<NonNullable<Parameters<TSchema['findMany']>[0]>, PrismaFindManyArgsLike>;
|
|
369
|
-
type QuerySchemaWhere<TSchema extends ModelQuerySchemaLike> = QuerySchemaFindManyArgs<TSchema> extends {
|
|
370
|
-
where?: infer TWhere;
|
|
371
|
-
} ? FallbackIfUnknownOrNever<TWhere, PrismaLikeWhereInput> : PrismaLikeWhereInput;
|
|
372
|
-
type QuerySchemaInclude<TSchema extends ModelQuerySchemaLike> = QuerySchemaFindManyArgs<TSchema> extends {
|
|
373
|
-
include?: infer TInclude;
|
|
374
|
-
} ? FallbackIfUnknownOrNever<TInclude, PrismaLikeInclude> : PrismaLikeInclude;
|
|
375
|
-
type QuerySchemaOrderBy<TSchema extends ModelQuerySchemaLike> = QuerySchemaFindManyArgs<TSchema> extends {
|
|
376
|
-
orderBy?: infer TOrderBy;
|
|
377
|
-
} ? FallbackIfUnknownOrNever<TOrderBy, PrismaLikeOrderBy> : PrismaLikeOrderBy;
|
|
378
|
-
type QuerySchemaSelect<TSchema extends ModelQuerySchemaLike> = QuerySchemaFindManyArgs<TSchema> extends {
|
|
379
|
-
select?: infer TSelect;
|
|
380
|
-
} ? FallbackIfUnknownOrNever<TSelect, PrismaLikeSelect> : PrismaLikeSelect;
|
|
381
|
-
type QuerySchemaCreateData<TSchema extends ModelQuerySchemaLike> = Parameters<TSchema['create']>[0] extends {
|
|
382
|
-
data: infer TData;
|
|
383
|
-
} ? TData : Record<string, unknown>;
|
|
384
|
-
type QuerySchemaUpdateArgs<TSchema extends ModelQuerySchemaLike> = Parameters<TSchema['update']>[0];
|
|
385
|
-
type QuerySchemaUpdateData<TSchema extends ModelQuerySchemaLike> = QuerySchemaUpdateArgs<TSchema> extends {
|
|
386
|
-
data: infer TData;
|
|
387
|
-
} ? FallbackIfUnknownOrNever<TData, Record<string, unknown>> : Record<string, unknown>;
|
|
388
|
-
type QuerySchemaUniqueWhere<TSchema extends ModelQuerySchemaLike> = QuerySchemaUpdateArgs<TSchema> extends {
|
|
389
|
-
where: infer TWhere;
|
|
390
|
-
} ? FallbackIfUnknownOrNever<TWhere, Record<string, unknown>> : Record<string, unknown>;
|
|
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>;
|
|
437
|
-
type Serializable = Record<string, unknown>;
|
|
438
|
-
//#endregion
|
|
439
113
|
//#region src/types/metadata.d.ts
|
|
440
114
|
type ColumnMap = Record<string, string>;
|
|
441
115
|
interface PivotModelStatic {
|
|
@@ -2981,80 +2655,406 @@ declare class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Mode
|
|
|
2981
2655
|
*/
|
|
2982
2656
|
private buildWhere;
|
|
2983
2657
|
/**
|
|
2984
|
-
* Builds the arguments for the findMany delegate method, including the where clause.
|
|
2985
|
-
*
|
|
2986
|
-
* @returns
|
|
2658
|
+
* Builds the arguments for the findMany delegate method, including the where clause.
|
|
2659
|
+
*
|
|
2660
|
+
* @returns
|
|
2661
|
+
*/
|
|
2662
|
+
/**
|
|
2663
|
+
* Resolves a unique where clause for update and delete operations.
|
|
2664
|
+
*
|
|
2665
|
+
* @param where
|
|
2666
|
+
* @returns
|
|
2667
|
+
*/
|
|
2668
|
+
private resolveUniqueWhere;
|
|
2669
|
+
/**
|
|
2670
|
+
* Checks if the provided where clause is already a unique
|
|
2671
|
+
* identifier (i.e., contains only an 'id' field).
|
|
2672
|
+
*
|
|
2673
|
+
* @param where
|
|
2674
|
+
* @returns
|
|
2675
|
+
*/
|
|
2676
|
+
private isUniqueWhere;
|
|
2677
|
+
private shuffleRows;
|
|
2678
|
+
private hasRelationFilters;
|
|
2679
|
+
private hasOrRelationFilters;
|
|
2680
|
+
private hasRelationAggregates;
|
|
2681
|
+
private canExecuteRelationFiltersInAdapter;
|
|
2682
|
+
private canExecuteRelationAggregatesInAdapter;
|
|
2683
|
+
private canExecuteRelationFeaturesInAdapter;
|
|
2684
|
+
private shouldUseCompatibilityRelationFallback;
|
|
2685
|
+
private hasUncompilableSqlRelationFilters;
|
|
2686
|
+
private hasUncompilableSqlRelationAggregates;
|
|
2687
|
+
private tryBuildRelationFilterSpecs;
|
|
2688
|
+
private tryBuildRelationAggregateSpecs;
|
|
2689
|
+
private tryBuildRelationConstraintWhere;
|
|
2690
|
+
private isSqlRelationFeatureMetadata;
|
|
2691
|
+
private filterModelsByRelationConstraints;
|
|
2692
|
+
private getModelId;
|
|
2693
|
+
private buildSoftDeleteOnlyWhere;
|
|
2694
|
+
private applyRelationAggregates;
|
|
2695
|
+
private resolveRelatedCount;
|
|
2696
|
+
private resolveRelatedResults;
|
|
2697
|
+
private compareCount;
|
|
2698
|
+
private buildAggregateAttributeKey;
|
|
2699
|
+
private assignAggregate;
|
|
2700
|
+
}
|
|
2701
|
+
//#endregion
|
|
2702
|
+
//#region src/types/ModelStatic.d.ts
|
|
2703
|
+
interface ModelStatic<TModel, TDelegate extends ModelQuerySchemaLike = ModelQuerySchemaLike> {
|
|
2704
|
+
new (attributes?: QuerySchemaRow<TDelegate> extends Record<string, unknown> ? QuerySchemaRow<TDelegate> : Record<string, unknown>): TModel;
|
|
2705
|
+
query: () => QueryBuilder<TModel, TDelegate>;
|
|
2706
|
+
hydrate: (attributes: QuerySchemaRow<TDelegate> extends Record<string, unknown> ? QuerySchemaRow<TDelegate> : Record<string, unknown>) => TModel;
|
|
2707
|
+
hydrateMany: (attributes: (QuerySchemaRow<TDelegate> extends Record<string, unknown> ? QuerySchemaRow<TDelegate> : Record<string, unknown>)[]) => TModel[];
|
|
2708
|
+
hydrateRetrieved: (attributes: QuerySchemaRow<TDelegate> extends Record<string, unknown> ? QuerySchemaRow<TDelegate> : Record<string, unknown>) => Promise<TModel>;
|
|
2709
|
+
hydrateManyRetrieved: (attributes: (QuerySchemaRow<TDelegate> extends Record<string, unknown> ? QuerySchemaRow<TDelegate> : Record<string, unknown>)[]) => Promise<TModel[]>;
|
|
2710
|
+
getAdapter: () => DatabaseAdapter | undefined;
|
|
2711
|
+
getColumnMap: () => Record<string, string>;
|
|
2712
|
+
getColumnName: (attribute: string) => string;
|
|
2713
|
+
getModelMetadata: () => ModelMetadata;
|
|
2714
|
+
getPrimaryKey: () => string;
|
|
2715
|
+
getRelationMetadata: (name: string) => RelationMetadata | null;
|
|
2716
|
+
setAdapter: (adapter?: DatabaseAdapter) => void;
|
|
2717
|
+
getSoftDeleteConfig: () => SoftDeleteConfig;
|
|
2718
|
+
getTable: () => string;
|
|
2719
|
+
}
|
|
2720
|
+
interface RelationshipModelStatic {
|
|
2721
|
+
new (attributes?: Record<string, unknown>): any;
|
|
2722
|
+
query: () => QueryBuilder<any, any>;
|
|
2723
|
+
hydrate: (attributes: Record<string, unknown>) => any;
|
|
2724
|
+
getAdapter: () => DatabaseAdapter | undefined;
|
|
2725
|
+
getColumnMap: () => Record<string, string>;
|
|
2726
|
+
getColumnName: (attribute: string) => string;
|
|
2727
|
+
getModelMetadata: () => ModelMetadata;
|
|
2728
|
+
getPrimaryKey: () => string;
|
|
2729
|
+
getRelationMetadata: (name: string) => RelationMetadata | null;
|
|
2730
|
+
getTable: () => string;
|
|
2731
|
+
}
|
|
2732
|
+
//#endregion
|
|
2733
|
+
//#region src/types/core.d.ts
|
|
2734
|
+
type CastType = 'string' | 'number' | 'boolean' | 'date' | 'json' | 'array';
|
|
2735
|
+
interface CastHandler<T = unknown> {
|
|
2736
|
+
get: (value: unknown) => T;
|
|
2737
|
+
set: (value: unknown) => unknown;
|
|
2738
|
+
}
|
|
2739
|
+
type CastDefinition = CastType | CastHandler;
|
|
2740
|
+
type CastMap = Record<string, CastDefinition>;
|
|
2741
|
+
type RuntimeClientLike = PrismaClient | Record<string, unknown>;
|
|
2742
|
+
interface TransactionOptions {
|
|
2743
|
+
maxWait?: number;
|
|
2744
|
+
timeout?: number;
|
|
2745
|
+
isolationLevel?: string;
|
|
2746
|
+
}
|
|
2747
|
+
interface TransactionContext {
|
|
2748
|
+
client?: RuntimeClientLike;
|
|
2749
|
+
adapter?: DatabaseAdapter;
|
|
2750
|
+
}
|
|
2751
|
+
type TransactionCallback<TResult = unknown> = (context: TransactionContext) => TResult | Promise<TResult>;
|
|
2752
|
+
interface TransactionCapableClient {
|
|
2753
|
+
$transaction: <TResult>(callback: (client: RuntimeClientLike) => TResult | Promise<TResult>, options?: TransactionOptions) => Promise<TResult>;
|
|
2754
|
+
}
|
|
2755
|
+
/**
|
|
2756
|
+
* @deprecated Use RuntimeClientLike instead.
|
|
2757
|
+
*/
|
|
2758
|
+
type PrismaClientLike = RuntimeClientLike;
|
|
2759
|
+
/**
|
|
2760
|
+
* @deprecated Use TransactionOptions instead.
|
|
2761
|
+
*/
|
|
2762
|
+
type PrismaTransactionOptions = TransactionOptions;
|
|
2763
|
+
/**
|
|
2764
|
+
* @deprecated Use TransactionContext instead.
|
|
2765
|
+
*/
|
|
2766
|
+
type PrismaTransactionContext = TransactionContext;
|
|
2767
|
+
/**
|
|
2768
|
+
* @deprecated Use TransactionCallback instead.
|
|
2769
|
+
*/
|
|
2770
|
+
type PrismaTransactionCallback<TResult = unknown> = TransactionCallback<TResult>;
|
|
2771
|
+
/**
|
|
2772
|
+
* @deprecated Use TransactionCapableClient instead.
|
|
2773
|
+
*/
|
|
2774
|
+
type PrismaTransactionCapableClient = TransactionCapableClient;
|
|
2775
|
+
type ClientResolver = RuntimeClientLike | (() => RuntimeClientLike);
|
|
2776
|
+
interface AdapterBindableModel {
|
|
2777
|
+
setAdapter: (adapter?: DatabaseAdapter) => void;
|
|
2778
|
+
}
|
|
2779
|
+
interface ArkormBootContext {
|
|
2780
|
+
client?: RuntimeClientLike;
|
|
2781
|
+
/**
|
|
2782
|
+
* @deprecated Use client instead.
|
|
2783
|
+
*/
|
|
2784
|
+
prisma?: RuntimeClientLike;
|
|
2785
|
+
bindAdapter: (adapter: DatabaseAdapter, models: AdapterBindableModel[]) => DatabaseAdapter;
|
|
2786
|
+
}
|
|
2787
|
+
interface AdapterQueryInspection {
|
|
2788
|
+
adapter: string;
|
|
2789
|
+
operation: string;
|
|
2790
|
+
target?: string;
|
|
2791
|
+
sql?: string;
|
|
2792
|
+
parameters?: ReadonlyArray<unknown>;
|
|
2793
|
+
detail?: Record<string, unknown>;
|
|
2794
|
+
}
|
|
2795
|
+
interface ArkormDebugEvent {
|
|
2796
|
+
type: 'query';
|
|
2797
|
+
phase: 'before' | 'after' | 'error';
|
|
2798
|
+
adapter: string;
|
|
2799
|
+
operation: string;
|
|
2800
|
+
target?: string;
|
|
2801
|
+
inspection?: AdapterQueryInspection | null;
|
|
2802
|
+
meta?: Record<string, unknown>;
|
|
2803
|
+
durationMs?: number;
|
|
2804
|
+
error?: unknown;
|
|
2805
|
+
}
|
|
2806
|
+
type ArkormDebugHandler = (event: ArkormDebugEvent) => void;
|
|
2807
|
+
interface ArkormConfig {
|
|
2808
|
+
/**
|
|
2809
|
+
* @property client Optional runtime client instance or resolver used for compatibility mode, CLI flows, and client-backed transactions.
|
|
2810
|
+
*/
|
|
2811
|
+
client?: ClientResolver;
|
|
2812
|
+
/**
|
|
2813
|
+
* @deprecated Use client instead.
|
|
2814
|
+
* @property prisma Optional Prisma client instance or resolver used for compatibility mode, CLI flows, and Prisma-backed transactions.
|
|
2815
|
+
*/
|
|
2816
|
+
prisma?: ClientResolver;
|
|
2817
|
+
/**
|
|
2818
|
+
* @property adapter Optional global adapter applied automatically to models that do not define a model-specific adapter.
|
|
2819
|
+
*/
|
|
2820
|
+
adapter?: DatabaseAdapter;
|
|
2821
|
+
/**
|
|
2822
|
+
* @property boot Optional synchronous runtime boot hook for central adapter binding.
|
|
2823
|
+
*/
|
|
2824
|
+
boot?: (context: ArkormBootContext) => void;
|
|
2825
|
+
/**
|
|
2826
|
+
* @property debug Optional runtime query debugging. `true` logs through Arkorm's default logger;
|
|
2827
|
+
* a callback receives structured debug events for custom handling.
|
|
2828
|
+
*/
|
|
2829
|
+
debug?: boolean | ArkormDebugHandler;
|
|
2830
|
+
/**
|
|
2831
|
+
* @property pagination Configuration options related to pagination behavior and URL generation.
|
|
2832
|
+
*/
|
|
2833
|
+
pagination?: {
|
|
2834
|
+
urlDriver?: PaginationURLDriverFactory;
|
|
2835
|
+
resolveCurrentPage?: PaginationCurrentPageResolver;
|
|
2836
|
+
};
|
|
2837
|
+
/**
|
|
2838
|
+
* @property features Optional feature flags for persisted non-Prisma runtime metadata.
|
|
2839
|
+
*/
|
|
2840
|
+
features?: {
|
|
2841
|
+
/**
|
|
2842
|
+
* @property persistedColumnMappings Persist migration-defined column mappings for non-Prisma adapters.
|
|
2843
|
+
* Defaults to true.
|
|
2844
|
+
*/
|
|
2845
|
+
persistedColumnMappings?: boolean;
|
|
2846
|
+
/**
|
|
2847
|
+
* @property persistedEnums Persist migration-defined enum values for non-Prisma adapters.
|
|
2848
|
+
* Defaults to true.
|
|
2849
|
+
*/
|
|
2850
|
+
persistedEnums?: boolean;
|
|
2851
|
+
};
|
|
2852
|
+
/**
|
|
2853
|
+
* @property paths Optional custom paths for various generated files.
|
|
2854
|
+
*/
|
|
2855
|
+
paths?: {
|
|
2856
|
+
/**
|
|
2857
|
+
* @property stubs Optional custom path for stub files used in code generation.
|
|
2858
|
+
*/
|
|
2859
|
+
stubs?: string;
|
|
2860
|
+
/**
|
|
2861
|
+
* @property seeders Optional custom path for seeder files.
|
|
2862
|
+
*/
|
|
2863
|
+
seeders?: string;
|
|
2864
|
+
/**
|
|
2865
|
+
* @property models Optional custom path for model files.
|
|
2866
|
+
*/
|
|
2867
|
+
models?: string;
|
|
2868
|
+
/**
|
|
2869
|
+
* @property migrations Optional custom path for migration files.
|
|
2870
|
+
*/
|
|
2871
|
+
migrations?: string;
|
|
2872
|
+
/**
|
|
2873
|
+
* @property factories Optional custom path for factory files.
|
|
2874
|
+
*/
|
|
2875
|
+
factories?: string;
|
|
2876
|
+
/**
|
|
2877
|
+
* @property buildOutput Optional custom path for the development output directory.
|
|
2878
|
+
*/
|
|
2879
|
+
buildOutput?: string;
|
|
2880
|
+
};
|
|
2881
|
+
/**
|
|
2882
|
+
* @property outputExt Optional file extension for generated files, either 'ts' or 'js'.
|
|
2987
2883
|
*/
|
|
2884
|
+
outputExt?: 'ts' | 'js';
|
|
2885
|
+
}
|
|
2886
|
+
interface GetUserConfig {
|
|
2988
2887
|
/**
|
|
2989
|
-
*
|
|
2990
|
-
*
|
|
2991
|
-
* @param where
|
|
2992
|
-
* @returns
|
|
2888
|
+
* Get the user-provided ArkORM configuration.
|
|
2993
2889
|
*/
|
|
2994
|
-
|
|
2890
|
+
(): Partial<ArkormConfig>;
|
|
2995
2891
|
/**
|
|
2996
|
-
*
|
|
2997
|
-
*
|
|
2998
|
-
*
|
|
2999
|
-
* @param where
|
|
3000
|
-
* @returns
|
|
2892
|
+
* Get a specific user configuration value
|
|
2893
|
+
* @param key Optional specific configuration key to retrieve
|
|
3001
2894
|
*/
|
|
3002
|
-
|
|
3003
|
-
private shuffleRows;
|
|
3004
|
-
private hasRelationFilters;
|
|
3005
|
-
private hasOrRelationFilters;
|
|
3006
|
-
private hasRelationAggregates;
|
|
3007
|
-
private canExecuteRelationFiltersInAdapter;
|
|
3008
|
-
private canExecuteRelationAggregatesInAdapter;
|
|
3009
|
-
private canExecuteRelationFeaturesInAdapter;
|
|
3010
|
-
private shouldUseCompatibilityRelationFallback;
|
|
3011
|
-
private hasUncompilableSqlRelationFilters;
|
|
3012
|
-
private hasUncompilableSqlRelationAggregates;
|
|
3013
|
-
private tryBuildRelationFilterSpecs;
|
|
3014
|
-
private tryBuildRelationAggregateSpecs;
|
|
3015
|
-
private tryBuildRelationConstraintWhere;
|
|
3016
|
-
private isSqlRelationFeatureMetadata;
|
|
3017
|
-
private filterModelsByRelationConstraints;
|
|
3018
|
-
private getModelId;
|
|
3019
|
-
private buildSoftDeleteOnlyWhere;
|
|
3020
|
-
private applyRelationAggregates;
|
|
3021
|
-
private resolveRelatedCount;
|
|
3022
|
-
private resolveRelatedResults;
|
|
3023
|
-
private compareCount;
|
|
3024
|
-
private buildAggregateAttributeKey;
|
|
3025
|
-
private assignAggregate;
|
|
2895
|
+
<K extends keyof ArkormConfig>(key: K): Partial<ArkormConfig>[K];
|
|
3026
2896
|
}
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
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[]>;
|
|
3036
|
-
getAdapter: () => DatabaseAdapter | undefined;
|
|
3037
|
-
getColumnMap: () => Record<string, string>;
|
|
3038
|
-
getColumnName: (attribute: string) => string;
|
|
3039
|
-
getModelMetadata: () => ModelMetadata;
|
|
3040
|
-
getPrimaryKey: () => string;
|
|
3041
|
-
getRelationMetadata: (name: string) => RelationMetadata | null;
|
|
3042
|
-
setAdapter: (adapter?: DatabaseAdapter) => void;
|
|
3043
|
-
getSoftDeleteConfig: () => SoftDeleteConfig;
|
|
3044
|
-
getTable: () => string;
|
|
2897
|
+
interface PaginationMeta {
|
|
2898
|
+
total: number;
|
|
2899
|
+
perPage: number;
|
|
2900
|
+
currentPage: number;
|
|
2901
|
+
lastPage: number;
|
|
2902
|
+
from: number | null;
|
|
2903
|
+
to: number | null;
|
|
3045
2904
|
}
|
|
3046
|
-
interface
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
2905
|
+
interface SimplePaginationMeta {
|
|
2906
|
+
perPage: number;
|
|
2907
|
+
currentPage: number;
|
|
2908
|
+
from: number | null;
|
|
2909
|
+
to: number | null;
|
|
2910
|
+
hasMorePages: boolean;
|
|
2911
|
+
}
|
|
2912
|
+
interface PaginationOptions {
|
|
2913
|
+
path?: string;
|
|
2914
|
+
query?: Record<string, string | number | boolean | null | undefined>;
|
|
2915
|
+
fragment?: string;
|
|
2916
|
+
pageName?: string;
|
|
2917
|
+
}
|
|
2918
|
+
type PaginationCurrentPageResolver = (pageName: string, options: PaginationOptions) => number | undefined;
|
|
2919
|
+
interface PaginationURLDriver {
|
|
2920
|
+
getPageName: () => string;
|
|
2921
|
+
url: (page: number) => string;
|
|
2922
|
+
}
|
|
2923
|
+
type PaginationURLDriverFactory = (options: PaginationOptions) => PaginationURLDriver;
|
|
2924
|
+
interface PrismaFindManyArgsLike {
|
|
2925
|
+
where?: unknown;
|
|
2926
|
+
include?: unknown;
|
|
2927
|
+
orderBy?: unknown;
|
|
2928
|
+
select?: unknown;
|
|
2929
|
+
skip?: number;
|
|
2930
|
+
take?: number;
|
|
2931
|
+
}
|
|
2932
|
+
type PrismaLikeSortOrder = 'asc' | 'desc';
|
|
2933
|
+
interface PrismaLikeScalarFilter {
|
|
2934
|
+
equals?: unknown;
|
|
2935
|
+
not?: unknown | PrismaLikeScalarFilter;
|
|
2936
|
+
in?: unknown[];
|
|
2937
|
+
notIn?: unknown[];
|
|
2938
|
+
lt?: unknown;
|
|
2939
|
+
lte?: unknown;
|
|
2940
|
+
gt?: unknown;
|
|
2941
|
+
gte?: unknown;
|
|
2942
|
+
contains?: string;
|
|
2943
|
+
startsWith?: string;
|
|
2944
|
+
endsWith?: string;
|
|
2945
|
+
}
|
|
2946
|
+
interface PrismaLikeWhereInput {
|
|
2947
|
+
AND?: PrismaLikeWhereInput[];
|
|
2948
|
+
OR?: PrismaLikeWhereInput[];
|
|
2949
|
+
NOT?: PrismaLikeWhereInput | PrismaLikeWhereInput[];
|
|
2950
|
+
[key: string]: unknown;
|
|
2951
|
+
}
|
|
2952
|
+
type PrismaLikeOrderBy = Record<string, PrismaLikeSortOrder> | Record<string, PrismaLikeSortOrder>[];
|
|
2953
|
+
interface PrismaLikeSelect {
|
|
2954
|
+
[key: string]: boolean | {
|
|
2955
|
+
select?: PrismaLikeSelect;
|
|
2956
|
+
include?: PrismaLikeInclude;
|
|
2957
|
+
};
|
|
2958
|
+
}
|
|
2959
|
+
interface PrismaLikeInclude {
|
|
2960
|
+
[key: string]: boolean | {
|
|
2961
|
+
where?: PrismaLikeWhereInput;
|
|
2962
|
+
orderBy?: PrismaLikeOrderBy;
|
|
2963
|
+
select?: PrismaLikeSelect;
|
|
2964
|
+
include?: PrismaLikeInclude;
|
|
2965
|
+
skip?: number;
|
|
2966
|
+
take?: number;
|
|
2967
|
+
};
|
|
2968
|
+
}
|
|
2969
|
+
type EagerLoadConstraint = (query: unknown) => unknown;
|
|
2970
|
+
type EagerLoadMap = Record<string, EagerLoadConstraint | undefined>;
|
|
2971
|
+
interface SoftDeleteConfig {
|
|
2972
|
+
enabled: boolean;
|
|
2973
|
+
column: string;
|
|
2974
|
+
}
|
|
2975
|
+
interface ModelQuerySchemaLike {
|
|
2976
|
+
findMany: (args?: any) => Promise<unknown[]>;
|
|
2977
|
+
findFirst: (args?: any) => Promise<unknown | null>;
|
|
2978
|
+
create: (args: any) => Promise<unknown>;
|
|
2979
|
+
update: (args: any) => Promise<unknown>;
|
|
2980
|
+
delete: (args: any) => Promise<unknown>;
|
|
2981
|
+
count: (args?: any) => Promise<number>;
|
|
3057
2982
|
}
|
|
2983
|
+
/**
|
|
2984
|
+
* @deprecated Use ModelQuerySchemaLike instead.
|
|
2985
|
+
*/
|
|
2986
|
+
type PrismaDelegateLike = ModelQuerySchemaLike;
|
|
2987
|
+
type FallbackIfUnknownOrNever<TValue, TFallback> = [TValue] extends [never] ? TFallback : unknown extends TValue ? TFallback : TValue;
|
|
2988
|
+
type QuerySchemaFindManyArgs<TSchema extends ModelQuerySchemaLike> = FallbackIfUnknownOrNever<NonNullable<Parameters<TSchema['findMany']>[0]>, PrismaFindManyArgsLike>;
|
|
2989
|
+
type QuerySchemaWhere<TSchema extends ModelQuerySchemaLike> = QuerySchemaFindManyArgs<TSchema> extends {
|
|
2990
|
+
where?: infer TWhere;
|
|
2991
|
+
} ? FallbackIfUnknownOrNever<TWhere, PrismaLikeWhereInput> : PrismaLikeWhereInput;
|
|
2992
|
+
type QuerySchemaInclude<TSchema extends ModelQuerySchemaLike> = QuerySchemaFindManyArgs<TSchema> extends {
|
|
2993
|
+
include?: infer TInclude;
|
|
2994
|
+
} ? FallbackIfUnknownOrNever<TInclude, PrismaLikeInclude> : PrismaLikeInclude;
|
|
2995
|
+
type QuerySchemaOrderBy<TSchema extends ModelQuerySchemaLike> = QuerySchemaFindManyArgs<TSchema> extends {
|
|
2996
|
+
orderBy?: infer TOrderBy;
|
|
2997
|
+
} ? FallbackIfUnknownOrNever<TOrderBy, PrismaLikeOrderBy> : PrismaLikeOrderBy;
|
|
2998
|
+
type QuerySchemaSelect<TSchema extends ModelQuerySchemaLike> = QuerySchemaFindManyArgs<TSchema> extends {
|
|
2999
|
+
select?: infer TSelect;
|
|
3000
|
+
} ? FallbackIfUnknownOrNever<TSelect, PrismaLikeSelect> : PrismaLikeSelect;
|
|
3001
|
+
type QuerySchemaCreateData<TSchema extends ModelQuerySchemaLike> = Parameters<TSchema['create']>[0] extends {
|
|
3002
|
+
data: infer TData;
|
|
3003
|
+
} ? TData : Record<string, unknown>;
|
|
3004
|
+
type QuerySchemaUpdateArgs<TSchema extends ModelQuerySchemaLike> = Parameters<TSchema['update']>[0];
|
|
3005
|
+
type QuerySchemaUpdateData<TSchema extends ModelQuerySchemaLike> = QuerySchemaUpdateArgs<TSchema> extends {
|
|
3006
|
+
data: infer TData;
|
|
3007
|
+
} ? FallbackIfUnknownOrNever<TData, Record<string, unknown>> : Record<string, unknown>;
|
|
3008
|
+
type QuerySchemaUniqueWhere<TSchema extends ModelQuerySchemaLike> = QuerySchemaUpdateArgs<TSchema> extends {
|
|
3009
|
+
where: infer TWhere;
|
|
3010
|
+
} ? FallbackIfUnknownOrNever<TWhere, Record<string, unknown>> : Record<string, unknown>;
|
|
3011
|
+
type QuerySchemaRow<TSchema extends ModelQuerySchemaLike> = Exclude<Awaited<ReturnType<TSchema['findFirst']>>, null>;
|
|
3012
|
+
type QuerySchemaRows<TSchema extends ModelQuerySchemaLike> = Awaited<ReturnType<TSchema['findMany']>>;
|
|
3013
|
+
/**
|
|
3014
|
+
* @deprecated Use QuerySchemaFindManyArgs instead.
|
|
3015
|
+
*/
|
|
3016
|
+
type DelegateFindManyArgs<TSchema extends ModelQuerySchemaLike> = QuerySchemaFindManyArgs<TSchema>;
|
|
3017
|
+
/**
|
|
3018
|
+
* @deprecated Use QuerySchemaWhere instead.
|
|
3019
|
+
*/
|
|
3020
|
+
type DelegateWhere<TSchema extends ModelQuerySchemaLike> = QuerySchemaWhere<TSchema>;
|
|
3021
|
+
/**
|
|
3022
|
+
* @deprecated Use QuerySchemaInclude instead.
|
|
3023
|
+
*/
|
|
3024
|
+
type DelegateInclude<TSchema extends ModelQuerySchemaLike> = QuerySchemaInclude<TSchema>;
|
|
3025
|
+
/**
|
|
3026
|
+
* @deprecated Use QuerySchemaOrderBy instead.
|
|
3027
|
+
*/
|
|
3028
|
+
type DelegateOrderBy<TSchema extends ModelQuerySchemaLike> = QuerySchemaOrderBy<TSchema>;
|
|
3029
|
+
/**
|
|
3030
|
+
* @deprecated Use QuerySchemaSelect instead.
|
|
3031
|
+
*/
|
|
3032
|
+
type DelegateSelect<TSchema extends ModelQuerySchemaLike> = QuerySchemaSelect<TSchema>;
|
|
3033
|
+
/**
|
|
3034
|
+
* @deprecated Use QuerySchemaCreateData instead.
|
|
3035
|
+
*/
|
|
3036
|
+
type DelegateCreateData<TSchema extends ModelQuerySchemaLike> = QuerySchemaCreateData<TSchema>;
|
|
3037
|
+
/**
|
|
3038
|
+
* @deprecated Use QuerySchemaUpdateArgs instead.
|
|
3039
|
+
*/
|
|
3040
|
+
type DelegateUpdateArgs<TSchema extends ModelQuerySchemaLike> = QuerySchemaUpdateArgs<TSchema>;
|
|
3041
|
+
/**
|
|
3042
|
+
* @deprecated Use QuerySchemaUpdateData instead.
|
|
3043
|
+
*/
|
|
3044
|
+
type DelegateUpdateData<TSchema extends ModelQuerySchemaLike> = QuerySchemaUpdateData<TSchema>;
|
|
3045
|
+
/**
|
|
3046
|
+
* @deprecated Use QuerySchemaUniqueWhere instead.
|
|
3047
|
+
*/
|
|
3048
|
+
type DelegateUniqueWhere<TSchema extends ModelQuerySchemaLike> = QuerySchemaUniqueWhere<TSchema>;
|
|
3049
|
+
/**
|
|
3050
|
+
* @deprecated Use QuerySchemaRow instead.
|
|
3051
|
+
*/
|
|
3052
|
+
type DelegateRow<TSchema extends ModelQuerySchemaLike> = QuerySchemaRow<TSchema>;
|
|
3053
|
+
/**
|
|
3054
|
+
* @deprecated Use QuerySchemaRows instead.
|
|
3055
|
+
*/
|
|
3056
|
+
type DelegateRows<TSchema extends ModelQuerySchemaLike> = QuerySchemaRows<TSchema>;
|
|
3057
|
+
type Serializable = Record<string, unknown>;
|
|
3058
3058
|
//#endregion
|
|
3059
3059
|
//#region src/types/adapter.d.ts
|
|
3060
3060
|
type DatabasePrimitive = string | number | boolean | bigint | Date | null;
|
|
@@ -3107,6 +3107,10 @@ interface QueryRawCondition {
|
|
|
3107
3107
|
sql: string;
|
|
3108
3108
|
bindings?: DatabaseValue[];
|
|
3109
3109
|
}
|
|
3110
|
+
interface RawQuerySpec {
|
|
3111
|
+
sql: string;
|
|
3112
|
+
bindings?: DatabaseValue[];
|
|
3113
|
+
}
|
|
3110
3114
|
type QueryCondition = QueryComparisonCondition | QueryGroupCondition | QueryNotCondition | QueryRawCondition;
|
|
3111
3115
|
interface AggregateSelection {
|
|
3112
3116
|
type: AggregateOperation;
|
|
@@ -3273,6 +3277,7 @@ interface DatabaseAdapter {
|
|
|
3273
3277
|
deleteMany?: <TModel = unknown>(spec: DeleteManySpec<TModel>) => Promise<number>;
|
|
3274
3278
|
count: <TModel = unknown>(spec: AggregateSpec<TModel>) => Promise<number>;
|
|
3275
3279
|
exists?: <TModel = unknown>(spec: SelectSpec<TModel>) => Promise<boolean>;
|
|
3280
|
+
rawQuery?: <TRow = unknown>(spec: RawQuerySpec) => Promise<DatabaseRows>;
|
|
3276
3281
|
loadRelations?: <TModel = unknown>(spec: RelationLoadSpec<TModel>) => Promise<void>;
|
|
3277
3282
|
inspectQuery?: <TModel = unknown>(request: AdapterInspectionRequest<TModel>) => AdapterQueryInspection | null;
|
|
3278
3283
|
introspectModels?: (options?: AdapterModelIntrospectionOptions) => Promise<AdapterModelStructure[]>;
|
|
@@ -3302,7 +3307,10 @@ declare class KyselyDatabaseAdapter implements DatabaseAdapter {
|
|
|
3302
3307
|
constructor(db: KyselyExecutor, mapping?: KyselyTableMapping);
|
|
3303
3308
|
private quoteIdentifier;
|
|
3304
3309
|
private quoteLiteral;
|
|
3310
|
+
private interpolateRawSql;
|
|
3305
3311
|
private executeRawStatement;
|
|
3312
|
+
rawQuery<_TRow = unknown>(spec: RawQuerySpec): Promise<DatabaseRows>;
|
|
3313
|
+
private tryInspectRawQuery;
|
|
3306
3314
|
private resolveSchemaColumnName;
|
|
3307
3315
|
private resolveSchemaIndexName;
|
|
3308
3316
|
private resolveSchemaForeignKeyName;
|
|
@@ -4616,6 +4624,8 @@ declare class DB {
|
|
|
4616
4624
|
getAdapter(): DatabaseAdapter | undefined;
|
|
4617
4625
|
static table<TRow extends Record<string, unknown> = Record<string, unknown>>(table: string, options?: DatabaseTableOptions): QueryBuilder<TRow, ModelQuerySchemaLike>;
|
|
4618
4626
|
table<TRow extends Record<string, unknown> = Record<string, unknown>>(table: string, options?: DatabaseTableOptions): QueryBuilder<TRow, ModelQuerySchemaLike>;
|
|
4627
|
+
static raw<TRow extends Record<string, unknown> = Record<string, unknown>>(sql: string, bindings?: unknown[]): Promise<ArkormCollection<TRow>>;
|
|
4628
|
+
raw<TRow extends Record<string, unknown> = Record<string, unknown>>(sql: string, bindings?: unknown[]): Promise<ArkormCollection<TRow>>;
|
|
4619
4629
|
static transaction<TResult>(callback: (db: DB) => TResult | Promise<TResult>, context?: AdapterTransactionContext): Promise<TResult>;
|
|
4620
4630
|
transaction<TResult>(callback: (db: DB) => TResult | Promise<TResult>, context?: AdapterTransactionContext): Promise<TResult>;
|
|
4621
4631
|
private static createTableModel;
|
|
@@ -5262,4 +5272,4 @@ declare class URLDriver {
|
|
|
5262
5272
|
url(page: number): string;
|
|
5263
5273
|
}
|
|
5264
5274
|
//#endregion
|
|
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 };
|
|
5275
|
+
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, RawQuerySpec, 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 };
|