hysteria-orm 12.3.0 → 12.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli.js +36 -36
- package/lib/cli.js.map +1 -1
- package/lib/index.cjs +26 -26
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +593 -107
- package/lib/index.d.ts +593 -107
- package/lib/index.js +26 -26
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.cts
CHANGED
|
@@ -733,12 +733,14 @@ declare class WhereNode extends QueryNode {
|
|
|
733
733
|
column: string;
|
|
734
734
|
isNegated: boolean;
|
|
735
735
|
operator: BinaryOperatorType$2;
|
|
736
|
-
value: BaseValues$2 | BaseValues$2[];
|
|
736
|
+
value: BaseValues$2 | BaseValues$2[] | BaseValues$2[][];
|
|
737
|
+
/** Set for a row-value `(a, b) in ((1, 2), ...)` predicate, where `value` is a list of tuples. */
|
|
738
|
+
tupleColumns?: string[];
|
|
737
739
|
chainsWith: "and" | "or";
|
|
738
740
|
canKeywordBeSeenMultipleTimes: boolean;
|
|
739
741
|
folder: string;
|
|
740
742
|
file: string;
|
|
741
|
-
constructor(column: string, chainsWith: "and" | "or", isNegated: boolean | undefined, operator: BinaryOperatorType$2, value: BaseValues$2 | BaseValues$2[], isRawValue?: boolean);
|
|
743
|
+
constructor(column: string, chainsWith: "and" | "or", isNegated: boolean | undefined, operator: BinaryOperatorType$2, value: BaseValues$2 | BaseValues$2[] | BaseValues$2[][], isRawValue?: boolean);
|
|
742
744
|
}
|
|
743
745
|
|
|
744
746
|
type SubqueryOperatorType = "in" | "not in" | "exists" | "not exists" | "between" | "not between" | ">" | "<" | ">=" | "<=" | (string & {});
|
|
@@ -756,10 +758,11 @@ declare class WhereSubqueryNode extends QueryNode {
|
|
|
756
758
|
declare class WhereGroupNode extends QueryNode {
|
|
757
759
|
nodes: (WhereNode | WhereGroupNode | WhereSubqueryNode)[];
|
|
758
760
|
chainsWith: "and" | "or";
|
|
761
|
+
isNegated: boolean;
|
|
759
762
|
canKeywordBeSeenMultipleTimes: boolean;
|
|
760
763
|
folder: string;
|
|
761
764
|
file: string;
|
|
762
|
-
constructor(nodes: (WhereNode | WhereGroupNode | WhereSubqueryNode)[], chainsWith?: "and" | "or");
|
|
765
|
+
constructor(nodes: (WhereNode | WhereGroupNode | WhereSubqueryNode)[], chainsWith?: "and" | "or", isNegated?: boolean);
|
|
763
766
|
}
|
|
764
767
|
|
|
765
768
|
type BaseValues$1 = string | number | boolean | null | SqlFuncNode;
|
|
@@ -922,6 +925,8 @@ declare class UnionNode extends QueryNode {
|
|
|
922
925
|
isAll: boolean;
|
|
923
926
|
type: SetOperationType;
|
|
924
927
|
bindings?: any[];
|
|
928
|
+
/** Wraps this branch in parentheses, needed when it carries its own ORDER BY or LIMIT. */
|
|
929
|
+
wrap?: boolean;
|
|
925
930
|
chainsWith: string;
|
|
926
931
|
canKeywordBeSeenMultipleTimes: boolean;
|
|
927
932
|
folder: string;
|
|
@@ -1833,6 +1838,8 @@ declare class FromNode extends QueryNode {
|
|
|
1833
1838
|
alias?: string;
|
|
1834
1839
|
/** Schema applied to the table reference (e.g. `public.users`). */
|
|
1835
1840
|
schema?: string;
|
|
1841
|
+
/** PostgreSQL `FROM ONLY`, which skips rows of inheriting tables. */
|
|
1842
|
+
only?: boolean;
|
|
1836
1843
|
constructor(table: string | QueryNode | QueryNode[], alias?: string);
|
|
1837
1844
|
}
|
|
1838
1845
|
|
|
@@ -1931,6 +1938,12 @@ declare class InterpreterUtils {
|
|
|
1931
1938
|
* @description Formats the from node for write operations removing the "from" keyword
|
|
1932
1939
|
*/
|
|
1933
1940
|
getFromForWriteOperations(dbType: SqlDataSourceType, fromNode: FromNode): string;
|
|
1941
|
+
/**
|
|
1942
|
+
* @description Renders the auxiliary source of a write (`update ... from`,
|
|
1943
|
+
* `delete ... using`). Unlike the main write table it keeps its alias, since the
|
|
1944
|
+
* clause is unreadable without one.
|
|
1945
|
+
*/
|
|
1946
|
+
getWriteSource(dbType: SqlDataSourceType, fromNode: FromNode, startIndex: number): ReturnType<typeof AstParser.prototype.parse>;
|
|
1934
1947
|
/**
|
|
1935
1948
|
* @description Renders CTE nodes as a leading `with ...` clause. Used by writes
|
|
1936
1949
|
* whose dialect places the CTE inside the statement body (INSERT) rather than
|
|
@@ -1985,6 +1998,12 @@ type InsertConflictConfig = {
|
|
|
1985
1998
|
conflictColumns: string[];
|
|
1986
1999
|
mode: InsertConflictMode;
|
|
1987
2000
|
columnsToUpdate: string[];
|
|
2001
|
+
/** Raw conflict target, e.g. `(lower(email)) where deleted_at is null`. */
|
|
2002
|
+
conflictTargetRaw?: string;
|
|
2003
|
+
/** Named unique constraint to conflict on. */
|
|
2004
|
+
conflictConstraint?: string;
|
|
2005
|
+
/** Builds the `WHERE` of a `do update` clause. */
|
|
2006
|
+
mergeWhere?: (qb: WhereOnlyQueryBuilder<any>) => void;
|
|
1988
2007
|
};
|
|
1989
2008
|
/**
|
|
1990
2009
|
* @description A WriteOperation for inserts that can be given a conflict action
|
|
@@ -1993,12 +2012,15 @@ type InsertConflictConfig = {
|
|
|
1993
2012
|
declare class InsertWriteOperation<T, K extends string = string> extends WriteOperation<T> {
|
|
1994
2013
|
private conflictState;
|
|
1995
2014
|
private conflictColumns;
|
|
2015
|
+
private conflictTargetRaw;
|
|
2016
|
+
private conflictConstraint;
|
|
1996
2017
|
private readonly commit;
|
|
1997
2018
|
private readonly insertColumns;
|
|
1998
2019
|
private readonly caller;
|
|
1999
2020
|
constructor(unWrapFn: () => ReturnType<typeof AstParser.prototype.parse>, toSqlFn: () => ReturnType<typeof AstParser.prototype.parse>, toQueryFn: () => string, executor: () => Promise<T>, commit: (config: InsertConflictConfig) => void, insertColumns: readonly string[], caller: string);
|
|
2000
2021
|
/**
|
|
2001
|
-
* @description Sets the column(s)
|
|
2022
|
+
* @description Sets the conflict target: column(s), a raw expression such as an
|
|
2023
|
+
* index predicate, or a named constraint
|
|
2002
2024
|
* @description With no arguments the conflict has no explicit target, which is
|
|
2003
2025
|
* only valid with `ignore()`
|
|
2004
2026
|
* @description Must be followed by `merge()` or `ignore()`
|
|
@@ -2006,13 +2028,23 @@ declare class InsertWriteOperation<T, K extends string = string> extends WriteOp
|
|
|
2006
2028
|
onConflict(): this;
|
|
2007
2029
|
onConflict(column: K): this;
|
|
2008
2030
|
onConflict(columns: K[]): this;
|
|
2031
|
+
onConflict(target: RawNode): this;
|
|
2032
|
+
onConflict(options: {
|
|
2033
|
+
constraint: string;
|
|
2034
|
+
}): this;
|
|
2009
2035
|
/**
|
|
2010
2036
|
* @description Updates the inserted columns when the conflict target already exists
|
|
2011
2037
|
* @description Without arguments every inserted column except the conflict target is updated
|
|
2038
|
+
* @description Pass `{ where }` to guard the update, PostgreSQL and SQLite only
|
|
2039
|
+
* @throws HysteriaError if nothing is left to update, use `ignore()` instead
|
|
2012
2040
|
*/
|
|
2013
2041
|
merge(): this;
|
|
2014
2042
|
merge(column: K): this;
|
|
2015
2043
|
merge(columns: K[]): this;
|
|
2044
|
+
merge(options: {
|
|
2045
|
+
columns?: K[];
|
|
2046
|
+
where?: (qb: WhereOnlyQueryBuilder<any>) => void;
|
|
2047
|
+
}): this;
|
|
2016
2048
|
/**
|
|
2017
2049
|
* @description Leaves the existing row untouched when the conflict target already exists
|
|
2018
2050
|
* @description Works with or without an explicit conflict target
|
|
@@ -2102,6 +2134,8 @@ declare class Transaction {
|
|
|
2102
2134
|
rollback(options?: TransactionExecutionOptions): Promise<void>;
|
|
2103
2135
|
/**
|
|
2104
2136
|
* @description Release the connection, does nothing if the connection is already released
|
|
2137
|
+
* @param failure The COMMIT/ROLLBACK error, forwarded to the adapter so it can
|
|
2138
|
+
* discard the connection instead of returning an unknown-state session to the pool
|
|
2105
2139
|
*/
|
|
2106
2140
|
private releaseConnection;
|
|
2107
2141
|
private getIsolationLevelQuery;
|
|
@@ -2206,6 +2240,10 @@ type RawModelOptions = {
|
|
|
2206
2240
|
* Alias for the table
|
|
2207
2241
|
*/
|
|
2208
2242
|
alias?: string;
|
|
2243
|
+
/**
|
|
2244
|
+
* @description PostgreSQL only. Renders `from only <table>`, skipping rows of tables that inherit from it
|
|
2245
|
+
*/
|
|
2246
|
+
only?: boolean;
|
|
2209
2247
|
/**
|
|
2210
2248
|
* @description Convert the column casing before making a Database query, by default preserves what is provided
|
|
2211
2249
|
*/
|
|
@@ -2308,7 +2346,36 @@ declare class ModelManager<T extends Model> {
|
|
|
2308
2346
|
*/
|
|
2309
2347
|
private handleMysqlInsert;
|
|
2310
2348
|
private handleWhereCondition;
|
|
2311
|
-
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
declare class JoinNode extends QueryNode {
|
|
2352
|
+
table: string;
|
|
2353
|
+
left: string;
|
|
2354
|
+
right: string;
|
|
2355
|
+
on?: {
|
|
2356
|
+
left?: string;
|
|
2357
|
+
right?: string;
|
|
2358
|
+
operator: string;
|
|
2359
|
+
};
|
|
2360
|
+
chainsWith: string;
|
|
2361
|
+
canKeywordBeSeenMultipleTimes: boolean;
|
|
2362
|
+
folder: string;
|
|
2363
|
+
file: string;
|
|
2364
|
+
type: "inner" | "left" | "right" | "full" | "cross" | "natural";
|
|
2365
|
+
additionalConditions?: (WhereNode | WhereGroupNode | WhereSubqueryNode)[];
|
|
2366
|
+
/** When set, renders `using (cols)` instead of an `on` condition. */
|
|
2367
|
+
using?: string[];
|
|
2368
|
+
/** Schema applied to the joined table reference. */
|
|
2369
|
+
schema?: string;
|
|
2370
|
+
/** Values for the `?` placeholders of a raw join fragment. */
|
|
2371
|
+
bindings?: any[];
|
|
2372
|
+
/** When set, `table` holds the derived table's alias and this holds its body. */
|
|
2373
|
+
subquery?: QueryNode[];
|
|
2374
|
+
constructor(table: string, left: string, right: string, type: "inner" | "left" | "right" | "full" | "cross" | "natural" | undefined, on: {
|
|
2375
|
+
left?: string;
|
|
2376
|
+
right?: string;
|
|
2377
|
+
operator: string;
|
|
2378
|
+
}, isRawValue?: boolean, additionalConditions?: (WhereNode | WhereGroupNode | WhereSubqueryNode)[]);
|
|
2312
2379
|
}
|
|
2313
2380
|
|
|
2314
2381
|
declare class DeleteNode extends QueryNode {
|
|
@@ -2317,6 +2384,10 @@ declare class DeleteNode extends QueryNode {
|
|
|
2317
2384
|
canKeywordBeSeenMultipleTimes: boolean;
|
|
2318
2385
|
folder: string;
|
|
2319
2386
|
file: string;
|
|
2387
|
+
/** Joins rendered after the table, so MySQL can delete from a join. */
|
|
2388
|
+
joinNodes?: JoinNode[];
|
|
2389
|
+
/** `delete ... using <source>`, rendered by the dialects that accept it. */
|
|
2390
|
+
usingNode?: FromNode;
|
|
2320
2391
|
constructor(fromNode: FromNode, isRawValue?: boolean);
|
|
2321
2392
|
}
|
|
2322
2393
|
|
|
@@ -2397,6 +2468,12 @@ declare class OnDuplicateNode extends QueryNode {
|
|
|
2397
2468
|
canKeywordBeSeenMultipleTimes: boolean;
|
|
2398
2469
|
folder: string;
|
|
2399
2470
|
file: string;
|
|
2471
|
+
/** Raw conflict target, rendered in place of the column list. */
|
|
2472
|
+
conflictTargetRaw?: string;
|
|
2473
|
+
/** Named unique constraint to conflict on. */
|
|
2474
|
+
conflictConstraint?: string;
|
|
2475
|
+
/** Guards the `do update` clause; PostgreSQL and SQLite only. */
|
|
2476
|
+
whereNodes?: (WhereNode | WhereGroupNode)[];
|
|
2400
2477
|
constructor(table: string, conflictColumns: string[], columnsToUpdate: string[], mode?: "update" | "ignore", returning?: string[], isRawValue?: boolean);
|
|
2401
2478
|
}
|
|
2402
2479
|
|
|
@@ -2441,9 +2518,51 @@ declare class UpdateNode extends QueryNode {
|
|
|
2441
2518
|
canKeywordBeSeenMultipleTimes: boolean;
|
|
2442
2519
|
folder: string;
|
|
2443
2520
|
file: string;
|
|
2521
|
+
/** Joins rendered between the table and SET, so MySQL can update from a join. */
|
|
2522
|
+
joinNodes?: JoinNode[];
|
|
2523
|
+
/** `update ... from <source>`, rendered by the dialects that accept it. */
|
|
2524
|
+
fromSourceNode?: FromNode;
|
|
2444
2525
|
constructor(fromNode: FromNode, columns?: string[], values?: (any | RawNode | SqlFuncNode)[], isRawValue?: boolean);
|
|
2445
2526
|
}
|
|
2446
2527
|
|
|
2528
|
+
type Operation = "SELECT" | "INSERT" | "UPDATE" | "DELETE" | "OTHER";
|
|
2529
|
+
interface QueryContext {
|
|
2530
|
+
id: string;
|
|
2531
|
+
sql: string;
|
|
2532
|
+
params: any[];
|
|
2533
|
+
model?: any;
|
|
2534
|
+
operation?: string;
|
|
2535
|
+
timestamp: number;
|
|
2536
|
+
/** Anything else attached by the caller through `.queryContext()` */
|
|
2537
|
+
[key: string]: any;
|
|
2538
|
+
}
|
|
2539
|
+
/**
|
|
2540
|
+
* Query context extended with execution metadata.
|
|
2541
|
+
* @property duration - Query execution time in milliseconds (ms)
|
|
2542
|
+
*/
|
|
2543
|
+
type QueryContextWithDuration = QueryContext & {
|
|
2544
|
+
duration: number;
|
|
2545
|
+
result?: any;
|
|
2546
|
+
};
|
|
2547
|
+
interface QueryObserver {
|
|
2548
|
+
onBeforeQuery?(ctx: QueryContext): Promise<void> | void;
|
|
2549
|
+
onAfterQuery?(ctx: QueryContextWithDuration): Promise<void> | void;
|
|
2550
|
+
onQueryError?(ctx: QueryContext & {
|
|
2551
|
+
error: Error;
|
|
2552
|
+
}): Promise<void> | void;
|
|
2553
|
+
}
|
|
2554
|
+
declare class ObserverChain {
|
|
2555
|
+
private observers;
|
|
2556
|
+
constructor(observers?: QueryObserver[]);
|
|
2557
|
+
add(observer: QueryObserver): void;
|
|
2558
|
+
notifyBefore(ctx: QueryContext): Promise<void>;
|
|
2559
|
+
notifyAfter(ctx: QueryContextWithDuration, result?: any): Promise<void>;
|
|
2560
|
+
notifyError(ctx: QueryContext & {
|
|
2561
|
+
error: Error;
|
|
2562
|
+
}): Promise<void>;
|
|
2563
|
+
}
|
|
2564
|
+
declare const deriveOperationFromQuery: (sql: string) => string;
|
|
2565
|
+
|
|
2447
2566
|
/**
|
|
2448
2567
|
* PostgreSQL / CockroachDB: `-- line` or `/* block *\/`.
|
|
2449
2568
|
*/
|
|
@@ -2998,6 +3117,12 @@ type SoftDeleteOptions<T> = {
|
|
|
2998
3117
|
interface SubQueryable {
|
|
2999
3118
|
extractQueryNodes(): QueryNode[];
|
|
3000
3119
|
}
|
|
3120
|
+
/**
|
|
3121
|
+
* @description Which otherwise-select-only clauses a write operation tolerates.
|
|
3122
|
+
*/
|
|
3123
|
+
interface WriteClauseAllowances {
|
|
3124
|
+
allowCte?: boolean;
|
|
3125
|
+
}
|
|
3001
3126
|
declare class QueryBuilder<T extends Model = any, S extends Record<string, any> = Record<string, any>, D extends SqlDataSourceType = SqlDataSourceType> extends JsonQueryBuilder<T, S> implements SubQueryable {
|
|
3002
3127
|
model: typeof Model;
|
|
3003
3128
|
protected astParser: AstParser;
|
|
@@ -3014,7 +3139,9 @@ declare class QueryBuilder<T extends Model = any, S extends Record<string, any>
|
|
|
3014
3139
|
protected onDuplicateNode: OnDuplicateNode | null;
|
|
3015
3140
|
protected insertConflictConfig: InsertConflictConfig | null;
|
|
3016
3141
|
protected updateNode: UpdateNode | null;
|
|
3142
|
+
protected updateFromNode: FromNode | null;
|
|
3017
3143
|
protected deleteNode: DeleteNode | null;
|
|
3144
|
+
protected deleteUsingNode: FromNode | null;
|
|
3018
3145
|
protected returningNode: ReturningNode | null;
|
|
3019
3146
|
protected truncateNode: TruncateNode | null;
|
|
3020
3147
|
protected replicationMode: ReplicationType | null;
|
|
@@ -3023,6 +3150,8 @@ declare class QueryBuilder<T extends Model = any, S extends Record<string, any>
|
|
|
3023
3150
|
ms: number;
|
|
3024
3151
|
cancel: boolean;
|
|
3025
3152
|
};
|
|
3153
|
+
protected queryContextOptions?: Partial<QueryContext>;
|
|
3154
|
+
protected shouldLogQuery?: boolean;
|
|
3026
3155
|
constructor(model: typeof Model, sqlDataSource: SqlDataSource);
|
|
3027
3156
|
/**
|
|
3028
3157
|
* @description Sets the replication mode for the query builder
|
|
@@ -3132,6 +3261,11 @@ declare class QueryBuilder<T extends Model = any, S extends Record<string, any>
|
|
|
3132
3261
|
* @param key - The column to retrieve from the results, must be a Model Column
|
|
3133
3262
|
*/
|
|
3134
3263
|
pluck<K extends RawModelKey<T>>(key: K): Promise<PluckReturnType<T, K>>;
|
|
3264
|
+
/**
|
|
3265
|
+
* @description Executes the query and retrieves a single column from the first result, or undefined when there is none.
|
|
3266
|
+
* @param key - A selected column, or any Model column when the query selects everything
|
|
3267
|
+
*/
|
|
3268
|
+
value<K extends ValueKey<T, S>>(key: K): Promise<PluckReturnType<T, K & RawModelKey<T>>[number] | undefined>;
|
|
3135
3269
|
/**
|
|
3136
3270
|
* @description Executes the query and retrieves a single result.
|
|
3137
3271
|
*/
|
|
@@ -3236,6 +3370,16 @@ declare class QueryBuilder<T extends Model = any, S extends Record<string, any>
|
|
|
3236
3370
|
timeout(ms: number, options?: {
|
|
3237
3371
|
cancel?: boolean;
|
|
3238
3372
|
}): this;
|
|
3373
|
+
/**
|
|
3374
|
+
* @description Attaches extra fields to the query context handed to observers.
|
|
3375
|
+
* `sql`, `params`, `id`, `operation` and `timestamp` are always filled in by the runner.
|
|
3376
|
+
*/
|
|
3377
|
+
queryContext(ctx: Partial<QueryContext>): this;
|
|
3378
|
+
/**
|
|
3379
|
+
* @description Logs this query regardless of the data source setting, or silences it
|
|
3380
|
+
* with `false`. Without an argument it turns logging on.
|
|
3381
|
+
*/
|
|
3382
|
+
debug(enable?: boolean): this;
|
|
3239
3383
|
/**
|
|
3240
3384
|
* @description Prepends a native SQL comment to the select statement, in the
|
|
3241
3385
|
* syntax of the active dialect (e.g. `-- line`, `/* block *\/`; MySQL adds
|
|
@@ -3267,27 +3411,32 @@ declare class QueryBuilder<T extends Model = any, S extends Record<string, any>
|
|
|
3267
3411
|
* because the driver reads it as a bind placeholder even inside a comment.
|
|
3268
3412
|
*/
|
|
3269
3413
|
private assertValidSqlComment;
|
|
3414
|
+
private resolveSetOperationOptions;
|
|
3270
3415
|
/**
|
|
3271
3416
|
* @description Adds a UNION to the query.
|
|
3417
|
+
* @param options.wrap - Wraps the branch in parentheses
|
|
3272
3418
|
*/
|
|
3273
|
-
union(query: string, bindings?: any[]): this;
|
|
3274
|
-
union(cb: UnionCallBack<T
|
|
3419
|
+
union(query: string, bindings?: any[], options?: SetOperationOptions): this;
|
|
3420
|
+
union(cb: UnionCallBack<T>, options?: SetOperationOptions): this;
|
|
3275
3421
|
/**
|
|
3276
3422
|
* @description Adds a UNION ALL to the query.
|
|
3423
|
+
* @param options.wrap - Wraps the branch in parentheses
|
|
3277
3424
|
*/
|
|
3278
|
-
unionAll(query: string, bindings?: any[]): this;
|
|
3279
|
-
unionAll(cb: UnionCallBack<T
|
|
3280
|
-
unionAll(queryBuilder: QueryBuilder<any
|
|
3425
|
+
unionAll(query: string, bindings?: any[], options?: SetOperationOptions): this;
|
|
3426
|
+
unionAll(cb: UnionCallBack<T>, options?: SetOperationOptions): this;
|
|
3427
|
+
unionAll(queryBuilder: QueryBuilder<any>, options?: SetOperationOptions): this;
|
|
3281
3428
|
/**
|
|
3282
3429
|
* @description Adds an INTERSECT to the query (keeps only rows present in both queries).
|
|
3430
|
+
* @param options.wrap - Wraps the branch in parentheses
|
|
3283
3431
|
*/
|
|
3284
|
-
intersect(query: string, bindings?: any[]): this;
|
|
3285
|
-
intersect(cb: UnionCallBack<T
|
|
3432
|
+
intersect(query: string, bindings?: any[], options?: SetOperationOptions): this;
|
|
3433
|
+
intersect(cb: UnionCallBack<T>, options?: SetOperationOptions): this;
|
|
3286
3434
|
/**
|
|
3287
3435
|
* @description Adds an EXCEPT to the query (keeps rows from the first query not present in the second).
|
|
3436
|
+
* @param options.wrap - Wraps the branch in parentheses
|
|
3288
3437
|
*/
|
|
3289
|
-
except(query: string, bindings?: any[]): this;
|
|
3290
|
-
except(cb: UnionCallBack<T
|
|
3438
|
+
except(query: string, bindings?: any[], options?: SetOperationOptions): this;
|
|
3439
|
+
except(cb: UnionCallBack<T>, options?: SetOperationOptions): this;
|
|
3291
3440
|
private resolveSetOperationNodes;
|
|
3292
3441
|
/**
|
|
3293
3442
|
* @description Increments the value of a column by a given amount
|
|
@@ -3366,6 +3515,11 @@ declare class QueryBuilder<T extends Model = any, S extends Record<string, any>
|
|
|
3366
3515
|
* rewritten to the dialect's placeholders, in order with the rest of the query.
|
|
3367
3516
|
*/
|
|
3368
3517
|
fromRaw(raw: string, bindings?: any[]): this;
|
|
3518
|
+
/**
|
|
3519
|
+
* @description Renders the FROM clause as `from only <table>`, skipping rows of
|
|
3520
|
+
* tables that inherit from it. PostgreSQL only.
|
|
3521
|
+
*/
|
|
3522
|
+
fromOnly(enable?: boolean): this;
|
|
3369
3523
|
/**
|
|
3370
3524
|
* @description Adds a CTE to the query using a callback to build the subquery.
|
|
3371
3525
|
* @param columns - Optional explicit column list for the CTE (`with t (a, b) as (...)`)
|
|
@@ -3379,14 +3533,14 @@ declare class QueryBuilder<T extends Model = any, S extends Record<string, any>
|
|
|
3379
3533
|
withRecursive(alias: string, cb: (qb: QueryBuilder<T>) => void | SubQueryable): this;
|
|
3380
3534
|
/**
|
|
3381
3535
|
* @description Adds a materialized CTE to the query using a callback to build the subquery.
|
|
3382
|
-
* @postgres only
|
|
3383
|
-
* @throws HysteriaError if the
|
|
3536
|
+
* @postgres/cockroachdb/sqlite only
|
|
3537
|
+
* @throws HysteriaError if the dialect has no `as materialized`
|
|
3384
3538
|
*/
|
|
3385
3539
|
withMaterialized(alias: string, cb: (qb: QueryBuilder<T>) => void | SubQueryable): this;
|
|
3386
3540
|
/**
|
|
3387
3541
|
* @description Adds a non-materialized CTE to the query using a callback to build the subquery.
|
|
3388
|
-
* @postgres only
|
|
3389
|
-
* @throws HysteriaError if the
|
|
3542
|
+
* @postgres/cockroachdb only
|
|
3543
|
+
* @throws HysteriaError if the dialect has no `as not materialized`
|
|
3390
3544
|
*/
|
|
3391
3545
|
withNotMaterialized(alias: string, cb: (qb: QueryBuilder<T>) => void | SubQueryable): this;
|
|
3392
3546
|
/**
|
|
@@ -3403,6 +3557,18 @@ declare class QueryBuilder<T extends Model = any, S extends Record<string, any>
|
|
|
3403
3557
|
*/
|
|
3404
3558
|
insertMany(data: Record<string, WriteQueryParam>[], returning: string[]): InsertWriteOperation<T[]>;
|
|
3405
3559
|
insertMany(data: Record<string, WriteQueryParam>[]): InsertWriteOperation<void>;
|
|
3560
|
+
/**
|
|
3561
|
+
* @description Inserts rows in chunks of `chunkSize`, one statement per chunk, for
|
|
3562
|
+
* when a single `insertMany` would exceed the driver's parameter limit
|
|
3563
|
+
* @description The chunks are not wrapped in a transaction; wrap the call in
|
|
3564
|
+
* `sql.transaction(...)` when the whole batch has to be atomic
|
|
3565
|
+
* @returns The rows read back per chunk, empty without `returning`
|
|
3566
|
+
*/
|
|
3567
|
+
batchInsert(data: Record<string, WriteQueryParam>[], options?: {
|
|
3568
|
+
chunkSize?: number;
|
|
3569
|
+
returning?: string[];
|
|
3570
|
+
}): Promise<T[]>;
|
|
3571
|
+
protected resolveBatchSize(chunkSize?: number): number;
|
|
3406
3572
|
/**
|
|
3407
3573
|
* @description Updates or creates a new record using upsert functionality
|
|
3408
3574
|
* @param data The data to insert or update
|
|
@@ -3436,14 +3602,36 @@ declare class QueryBuilder<T extends Model = any, S extends Record<string, any>
|
|
|
3436
3602
|
* @description Executes a MERGE statement for MSSQL upsert operations (raw query builder)
|
|
3437
3603
|
*/
|
|
3438
3604
|
private executeMssqlMergeRaw;
|
|
3605
|
+
/**
|
|
3606
|
+
* @description Sets the source of an `update ... from <table>` statement, so the
|
|
3607
|
+
* update can read from another table. Pass a table name, or a callback to build a
|
|
3608
|
+
* subquery with its alias.
|
|
3609
|
+
* @postgres/cockroachdb/mssql only
|
|
3610
|
+
*/
|
|
3611
|
+
updateFrom<X extends string>(table: TableFormat<X>, maybeAlias?: string): this;
|
|
3612
|
+
updateFrom(cb: (qb: QueryBuilder<T>) => void | SubQueryable, alias: string): this;
|
|
3613
|
+
/**
|
|
3614
|
+
* @description Sets the source of a `delete ... using <table>` statement, so the
|
|
3615
|
+
* delete can match rows against another table.
|
|
3616
|
+
* @postgres/cockroachdb only
|
|
3617
|
+
*/
|
|
3618
|
+
deleteUsing<X extends string>(table: TableFormat<X>, maybeAlias?: string): this;
|
|
3619
|
+
deleteUsing(cb: (qb: QueryBuilder<T>) => void | SubQueryable, alias: string): this;
|
|
3620
|
+
/**
|
|
3621
|
+
* @description Builds a from node outside of the main FROM slot, for the auxiliary
|
|
3622
|
+
* sources a write statement can take (`update ... from`, `delete ... using`).
|
|
3623
|
+
*/
|
|
3624
|
+
private buildFromSource;
|
|
3439
3625
|
/**
|
|
3440
3626
|
* @description Updates records from a table, you can use raw statements in the data object for literal references to other columns
|
|
3441
|
-
* @param data - Object with column-value pairs to update
|
|
3627
|
+
* @param data - Object with column-value pairs to update, or a single column name
|
|
3628
|
+
* @param value - The value when updating a single column
|
|
3442
3629
|
* @param returning - Optional array of column names to return from the updated rows.
|
|
3443
3630
|
* **Note:** The `returning` parameter is only supported on PostgreSQL, CockroachDB, SQLite, and MSSQL.
|
|
3444
3631
|
* For MySQL and MariaDB, do not pass `returning` — the method will return the number of affected rows instead.
|
|
3445
3632
|
* @returns WriteOperation that resolves to the number of affected rows, or the specified columns if `returning` is provided
|
|
3446
3633
|
*/
|
|
3634
|
+
update(column: string, value: WriteQueryParam, returning?: string[]): WriteOperation<any>;
|
|
3447
3635
|
update(data: Record<string, WriteQueryParam>, returning?: string[]): WriteOperation<any>;
|
|
3448
3636
|
/**
|
|
3449
3637
|
* @description Builds a returning clause for update/delete where the dialect has one.
|
|
@@ -3517,9 +3705,8 @@ declare class QueryBuilder<T extends Model = any, S extends Record<string, any>
|
|
|
3517
3705
|
/**
|
|
3518
3706
|
* @description Rejects clause state that would otherwise be silently dropped on a
|
|
3519
3707
|
* write. Thrown at call time so the failure points at the builder call.
|
|
3520
|
-
* @param allowOrderByLimit - MySQL/MariaDB accept ORDER BY / LIMIT on UPDATE and DELETE
|
|
3521
3708
|
*/
|
|
3522
|
-
protected assertWriteClausesSupported(method: string,
|
|
3709
|
+
protected assertWriteClausesSupported(method: string, { allowCte }?: WriteClauseAllowances): void;
|
|
3523
3710
|
/**
|
|
3524
3711
|
* @description Single source of truth for a write statement's node list. Preview
|
|
3525
3712
|
* (`extractQueryNodes`) and execution both go through it so they cannot diverge.
|
|
@@ -3559,42 +3746,6 @@ type SqlLiteOptions<T extends Model> = {
|
|
|
3559
3746
|
customConnection?: GetConnectionReturnType<"sqlite">;
|
|
3560
3747
|
};
|
|
3561
3748
|
|
|
3562
|
-
type Operation = "SELECT" | "INSERT" | "UPDATE" | "DELETE" | "OTHER";
|
|
3563
|
-
interface QueryContext {
|
|
3564
|
-
id: string;
|
|
3565
|
-
sql: string;
|
|
3566
|
-
params: any[];
|
|
3567
|
-
model?: any;
|
|
3568
|
-
operation?: string;
|
|
3569
|
-
timestamp: number;
|
|
3570
|
-
}
|
|
3571
|
-
/**
|
|
3572
|
-
* Query context extended with execution metadata.
|
|
3573
|
-
* @property duration - Query execution time in milliseconds (ms)
|
|
3574
|
-
*/
|
|
3575
|
-
type QueryContextWithDuration = QueryContext & {
|
|
3576
|
-
duration: number;
|
|
3577
|
-
result?: any;
|
|
3578
|
-
};
|
|
3579
|
-
interface QueryObserver {
|
|
3580
|
-
onBeforeQuery?(ctx: QueryContext): Promise<void> | void;
|
|
3581
|
-
onAfterQuery?(ctx: QueryContextWithDuration): Promise<void> | void;
|
|
3582
|
-
onQueryError?(ctx: QueryContext & {
|
|
3583
|
-
error: Error;
|
|
3584
|
-
}): Promise<void> | void;
|
|
3585
|
-
}
|
|
3586
|
-
declare class ObserverChain {
|
|
3587
|
-
private observers;
|
|
3588
|
-
constructor(observers?: QueryObserver[]);
|
|
3589
|
-
add(observer: QueryObserver): void;
|
|
3590
|
-
notifyBefore(ctx: QueryContext): Promise<void>;
|
|
3591
|
-
notifyAfter(ctx: QueryContextWithDuration, result?: any): Promise<void>;
|
|
3592
|
-
notifyError(ctx: QueryContext & {
|
|
3593
|
-
error: Error;
|
|
3594
|
-
}): Promise<void>;
|
|
3595
|
-
}
|
|
3596
|
-
declare const deriveOperationFromQuery: (sql: string) => string;
|
|
3597
|
-
|
|
3598
3749
|
declare const SQL_DATA_SOURCE_SYMBOL: unique symbol;
|
|
3599
3750
|
/**
|
|
3600
3751
|
* @description The SqlDataSource class is the main class for interacting with the database, it's used to create connections, execute queries, and manage transactions
|
|
@@ -3751,6 +3902,19 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
|
|
|
3751
3902
|
private onSlaveServerFailure?;
|
|
3752
3903
|
private lazyLoad;
|
|
3753
3904
|
private connecting;
|
|
3905
|
+
/**
|
|
3906
|
+
* @description Clones made from this instance. Used to notice a manual
|
|
3907
|
+
* transaction that is still holding one of their connections, so cache writes
|
|
3908
|
+
* raised on the original can be recognised as happening inside a transaction.
|
|
3909
|
+
*/
|
|
3910
|
+
private cloneRegistry;
|
|
3911
|
+
/**
|
|
3912
|
+
* @description Set on a clone to the instance it came from, so it can take itself
|
|
3913
|
+
* out of that instance's clone registry when it disconnects. Clones are short-lived
|
|
3914
|
+
* and a registry that only pruned itself on cache use would retain every clone a
|
|
3915
|
+
* caller that never caches had ever made.
|
|
3916
|
+
*/
|
|
3917
|
+
private clonedFrom;
|
|
3754
3918
|
/**
|
|
3755
3919
|
* @description Returns the configured slave failure callback
|
|
3756
3920
|
*/
|
|
@@ -3815,6 +3979,16 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
|
|
|
3815
3979
|
* ```
|
|
3816
3980
|
*/
|
|
3817
3981
|
connect(): Promise<void>;
|
|
3982
|
+
/**
|
|
3983
|
+
* @description Builds the pool. Shared by `connect()` and `ensureConnected()` so both
|
|
3984
|
+
* go through the same in-flight promise rather than racing each other.
|
|
3985
|
+
*/
|
|
3986
|
+
private openConnection;
|
|
3987
|
+
/**
|
|
3988
|
+
* @description Closes this instance's pool if there is one, without letting a hang or a
|
|
3989
|
+
* driver error mask the failure that is already in flight.
|
|
3990
|
+
*/
|
|
3991
|
+
private closePoolOnFailure;
|
|
3818
3992
|
/**
|
|
3819
3993
|
* @description Returns true if the connection is established
|
|
3820
3994
|
*/
|
|
@@ -3835,6 +4009,8 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
|
|
|
3835
4009
|
get models(): ModelsProxy<T, D>;
|
|
3836
4010
|
/**
|
|
3837
4011
|
* @description Selects a slave from the pool using the configured algorithm
|
|
4012
|
+
* @description Returns null for a data source holding a pinned connection, such
|
|
4013
|
+
* as a transaction clone, which has to read through that connection.
|
|
3838
4014
|
* @returns A slave SqlDataSource instance or null if no slaves are available
|
|
3839
4015
|
*/
|
|
3840
4016
|
getSlave(): SqlDataSource<D, T, C, E> | null;
|
|
@@ -3843,8 +4019,18 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
|
|
|
3843
4019
|
* respecting (in order): explicit global transaction, ALS transaction, then self.
|
|
3844
4020
|
*/
|
|
3845
4021
|
getTransactionBoundSqlDataSource(): SqlDataSource | null;
|
|
4022
|
+
/**
|
|
4023
|
+
* @description True while this instance has a transaction in flight: the ALS or
|
|
4024
|
+
* global transaction bound to it, or a manual transaction still holding a
|
|
4025
|
+
* connection on one of its clones.
|
|
4026
|
+
*/
|
|
4027
|
+
private hasOpenTransaction;
|
|
3846
4028
|
/**
|
|
3847
4029
|
* @description Uses the cache adapter to get a value from the cache
|
|
4030
|
+
* @description A miss inside a transaction is not written back: the value was
|
|
4031
|
+
* computed from that transaction's view of the data, which may include rows it
|
|
4032
|
+
* has not committed, so it does not belong in a cache shared with everyone else.
|
|
4033
|
+
* Reads still hit the cache, so a value cached before the transaction is served.
|
|
3848
4034
|
* @param key The key to get the value from
|
|
3849
4035
|
* @param args The arguments to pass to the key handler
|
|
3850
4036
|
*/
|
|
@@ -3953,9 +4139,10 @@ declare class SqlDataSource<D extends SqlDataSourceType = SqlDataSourceType, T e
|
|
|
3953
4139
|
* @param cb if a callback is provided, it will execute the callback and commit or rollback the transaction based on the callback's success or failure
|
|
3954
4140
|
* @param options.isolationLevel The isolation level to use for the transaction
|
|
3955
4141
|
* @sqlite ignores the isolation level
|
|
3956
|
-
* @warning SQLite `:memory:`
|
|
3957
|
-
*
|
|
3958
|
-
*
|
|
4142
|
+
* @warning A SQLite `:memory:` database is private to its connection, and a
|
|
4143
|
+
* transaction runs on its own, so it sees an empty database rather than the
|
|
4144
|
+
* tables created on the main connection. Pass `file::memory:?cache=shared`, or
|
|
4145
|
+
* use a file database, when transactions need to read that data.
|
|
3959
4146
|
*/
|
|
3960
4147
|
transaction(options?: StartTransactionOptions): Promise<Transaction>;
|
|
3961
4148
|
transaction<T>(cb: (trx: Transaction) => Promise<T>, options?: StartTransactionOptions): Promise<T>;
|
|
@@ -4230,32 +4417,6 @@ declare class SelectNode extends QueryNode {
|
|
|
4230
4417
|
constructor(column: string | QueryNode | QueryNode[], alias?: string, sqlFunction?: string, isRaw?: boolean, distinct?: boolean);
|
|
4231
4418
|
}
|
|
4232
4419
|
|
|
4233
|
-
declare class JoinNode extends QueryNode {
|
|
4234
|
-
table: string;
|
|
4235
|
-
left: string;
|
|
4236
|
-
right: string;
|
|
4237
|
-
on?: {
|
|
4238
|
-
left?: string;
|
|
4239
|
-
right?: string;
|
|
4240
|
-
operator: string;
|
|
4241
|
-
};
|
|
4242
|
-
chainsWith: string;
|
|
4243
|
-
canKeywordBeSeenMultipleTimes: boolean;
|
|
4244
|
-
folder: string;
|
|
4245
|
-
file: string;
|
|
4246
|
-
type: "inner" | "left" | "right" | "full" | "cross" | "natural";
|
|
4247
|
-
additionalConditions?: (WhereNode | WhereGroupNode | WhereSubqueryNode)[];
|
|
4248
|
-
/** When set, renders `using (cols)` instead of an `on` condition. */
|
|
4249
|
-
using?: string[];
|
|
4250
|
-
/** Schema applied to the joined table reference. */
|
|
4251
|
-
schema?: string;
|
|
4252
|
-
constructor(table: string, left: string, right: string, type: "inner" | "left" | "right" | "full" | "cross" | "natural" | undefined, on: {
|
|
4253
|
-
left?: string;
|
|
4254
|
-
right?: string;
|
|
4255
|
-
operator: string;
|
|
4256
|
-
}, isRawValue?: boolean, additionalConditions?: (WhereNode | WhereGroupNode | WhereSubqueryNode)[]);
|
|
4257
|
-
}
|
|
4258
|
-
|
|
4259
4420
|
declare class GroupByNode extends QueryNode {
|
|
4260
4421
|
column: string;
|
|
4261
4422
|
chainsWith: string;
|
|
@@ -4267,6 +4428,8 @@ declare class GroupByNode extends QueryNode {
|
|
|
4267
4428
|
|
|
4268
4429
|
declare class LimitNode extends QueryNode {
|
|
4269
4430
|
limit: number;
|
|
4431
|
+
/** Inlines the value instead of binding it, so later parameter indexes do not shift. */
|
|
4432
|
+
skipBinding?: boolean;
|
|
4270
4433
|
chainsWith: string;
|
|
4271
4434
|
canKeywordBeSeenMultipleTimes: boolean;
|
|
4272
4435
|
folder: string;
|
|
@@ -4276,6 +4439,8 @@ declare class LimitNode extends QueryNode {
|
|
|
4276
4439
|
|
|
4277
4440
|
declare class OffsetNode extends QueryNode {
|
|
4278
4441
|
offset: number;
|
|
4442
|
+
/** Inlines the value instead of binding it, so later parameter indexes do not shift. */
|
|
4443
|
+
skipBinding?: boolean;
|
|
4279
4444
|
chainsWith: string;
|
|
4280
4445
|
canKeywordBeSeenMultipleTimes: boolean;
|
|
4281
4446
|
folder: string;
|
|
@@ -4286,6 +4451,8 @@ declare class OffsetNode extends QueryNode {
|
|
|
4286
4451
|
declare class OrderByNode extends QueryNode {
|
|
4287
4452
|
column: string;
|
|
4288
4453
|
direction: "asc" | "desc";
|
|
4454
|
+
/** Explicit null placement, emulated by the dialects that cannot spell it out. */
|
|
4455
|
+
nulls?: "first" | "last";
|
|
4289
4456
|
chainsWith: string;
|
|
4290
4457
|
canKeywordBeSeenMultipleTimes: boolean;
|
|
4291
4458
|
folder: string;
|
|
@@ -4639,27 +4806,34 @@ declare abstract class FooterQueryBuilder<T extends Model, S extends Record<stri
|
|
|
4639
4806
|
/**
|
|
4640
4807
|
* @description Adds an order by query
|
|
4641
4808
|
*/
|
|
4642
|
-
orderBy(column: ModelKey<T>, order:
|
|
4643
|
-
orderBy<S extends string>(column: SelectableColumn$1<S>, order:
|
|
4809
|
+
orderBy(column: ModelKey<T>, order: OrderByClause): this;
|
|
4810
|
+
orderBy<S extends string>(column: SelectableColumn$1<S>, order: OrderByClause): this;
|
|
4644
4811
|
/**
|
|
4645
4812
|
* @description Adds a raw order by query, ORDER BY clause is not necessary and will be added automatically
|
|
4646
4813
|
*/
|
|
4647
4814
|
orderByRaw(query: string): this;
|
|
4648
4815
|
/**
|
|
4649
4816
|
* @description Adds a limit query
|
|
4817
|
+
* @param options.skipBinding - Inlines the value in the SQL instead of binding it
|
|
4650
4818
|
*/
|
|
4651
|
-
limit(limit: number
|
|
4819
|
+
limit(limit: number, options?: {
|
|
4820
|
+
skipBinding?: boolean;
|
|
4821
|
+
}): this;
|
|
4652
4822
|
/**
|
|
4653
4823
|
* @description Adds an offset query
|
|
4824
|
+
* @param options.skipBinding - Inlines the value in the SQL instead of binding it
|
|
4654
4825
|
*/
|
|
4655
|
-
offset(offset: number
|
|
4826
|
+
offset(offset: number, options?: {
|
|
4827
|
+
skipBinding?: boolean;
|
|
4828
|
+
}): this;
|
|
4656
4829
|
}
|
|
4657
4830
|
|
|
4658
4831
|
declare class JoinOnQueryBuilder {
|
|
4832
|
+
protected model: typeof Model;
|
|
4659
4833
|
protected sqlDataSource: SqlDataSource;
|
|
4660
4834
|
protected whereNodes: (WhereNode | WhereGroupNode | WhereSubqueryNode)[];
|
|
4661
4835
|
protected isNestedCondition: boolean;
|
|
4662
|
-
constructor(sqlDataSource: SqlDataSource, isNestedCondition?: boolean);
|
|
4836
|
+
constructor(model: typeof Model, sqlDataSource: SqlDataSource, isNestedCondition?: boolean);
|
|
4663
4837
|
/**
|
|
4664
4838
|
* @description Get the where conditions for the join
|
|
4665
4839
|
*/
|
|
@@ -4697,6 +4871,34 @@ declare class JoinOnQueryBuilder {
|
|
|
4697
4871
|
*/
|
|
4698
4872
|
orWhereNot(column: SelectableColumn$1<string>, operator: BinaryOperatorType$2, value: BaseValues$2): this;
|
|
4699
4873
|
orWhereNot(column: SelectableColumn$1<string>, value: BaseValues$2): this;
|
|
4874
|
+
/**
|
|
4875
|
+
* @description Adds a condition comparing two columns (`on a.x = b.y`).
|
|
4876
|
+
* @description Both sides need the table prefix when either belongs to an aliased or derived
|
|
4877
|
+
* join target, since there is no model to resolve them against.
|
|
4878
|
+
*/
|
|
4879
|
+
whereColumn(column: SelectableColumn$1<string>, operatorOrRef: BinaryOperatorType$2 | SelectableColumn$1<string>, referenceColumn?: SelectableColumn$1<string>): this;
|
|
4880
|
+
/**
|
|
4881
|
+
* @description Adds an AND condition comparing two columns.
|
|
4882
|
+
*/
|
|
4883
|
+
andWhereColumn(column: SelectableColumn$1<string>, operatorOrRef: BinaryOperatorType$2 | SelectableColumn$1<string>, referenceColumn?: SelectableColumn$1<string>): this;
|
|
4884
|
+
/**
|
|
4885
|
+
* @description Adds an OR condition comparing two columns.
|
|
4886
|
+
*/
|
|
4887
|
+
orWhereColumn(column: SelectableColumn$1<string>, operatorOrRef: BinaryOperatorType$2 | SelectableColumn$1<string>, referenceColumn?: SelectableColumn$1<string>): this;
|
|
4888
|
+
/**
|
|
4889
|
+
* @description Adds a negated condition comparing two columns (`a != b`, or `not (a op b)`
|
|
4890
|
+
* when an explicit operator is given).
|
|
4891
|
+
*/
|
|
4892
|
+
whereNotColumn(column: SelectableColumn$1<string>, operatorOrRef: BinaryOperatorType$2 | SelectableColumn$1<string>, referenceColumn?: SelectableColumn$1<string>): this;
|
|
4893
|
+
/**
|
|
4894
|
+
* @description Adds a negated AND condition comparing two columns.
|
|
4895
|
+
*/
|
|
4896
|
+
andWhereNotColumn(column: SelectableColumn$1<string>, operatorOrRef: BinaryOperatorType$2 | SelectableColumn$1<string>, referenceColumn?: SelectableColumn$1<string>): this;
|
|
4897
|
+
/**
|
|
4898
|
+
* @description Adds a negated OR condition comparing two columns.
|
|
4899
|
+
*/
|
|
4900
|
+
orWhereNotColumn(column: SelectableColumn$1<string>, operatorOrRef: BinaryOperatorType$2 | SelectableColumn$1<string>, referenceColumn?: SelectableColumn$1<string>): this;
|
|
4901
|
+
private pushColumnWhere;
|
|
4700
4902
|
/**
|
|
4701
4903
|
* @description Adds a WHERE BETWEEN condition to the query.
|
|
4702
4904
|
*/
|
|
@@ -4865,12 +5067,160 @@ declare class JoinOnQueryBuilder {
|
|
|
4865
5067
|
* @description Adds an OR raw WHERE condition to the query.
|
|
4866
5068
|
*/
|
|
4867
5069
|
orWhereRaw(sql: string, bindings?: BaseValues$2[]): this;
|
|
5070
|
+
/**
|
|
5071
|
+
* @description Adds an EXISTS condition to the join ON clause. The nested query defaults to the
|
|
5072
|
+
* joined model's table; use `from` inside the callback to point it elsewhere.
|
|
5073
|
+
*/
|
|
5074
|
+
whereExists(cbOrQueryBuilder: (qb: QueryBuilder) => void | QueryBuilder): this;
|
|
5075
|
+
/**
|
|
5076
|
+
* @description Adds an AND EXISTS condition to the join ON clause.
|
|
5077
|
+
*/
|
|
5078
|
+
andWhereExists(cbOrQueryBuilder: (qb: QueryBuilder) => void | QueryBuilder): this;
|
|
5079
|
+
/**
|
|
5080
|
+
* @description Adds an OR EXISTS condition to the join ON clause.
|
|
5081
|
+
*/
|
|
5082
|
+
orWhereExists(cbOrQueryBuilder: (qb: QueryBuilder) => void | QueryBuilder): this;
|
|
5083
|
+
/**
|
|
5084
|
+
* @description Adds a NOT EXISTS condition to the join ON clause.
|
|
5085
|
+
*/
|
|
5086
|
+
whereNotExists(cbOrQueryBuilder: (qb: QueryBuilder) => void | QueryBuilder): this;
|
|
5087
|
+
/**
|
|
5088
|
+
* @description Adds an AND NOT EXISTS condition to the join ON clause.
|
|
5089
|
+
*/
|
|
5090
|
+
andWhereNotExists(cbOrQueryBuilder: (qb: QueryBuilder) => void | QueryBuilder): this;
|
|
5091
|
+
/**
|
|
5092
|
+
* @description Adds an OR NOT EXISTS condition to the join ON clause.
|
|
5093
|
+
*/
|
|
5094
|
+
orWhereNotExists(cbOrQueryBuilder: (qb: QueryBuilder) => void | QueryBuilder): this;
|
|
5095
|
+
private pushExists;
|
|
5096
|
+
/**
|
|
5097
|
+
* @description JSON predicate: the column's document contains the value (superset). Covers the
|
|
5098
|
+
* `whereJsonContains` and `whereJsonSupersetOf` spellings of the where builder.
|
|
5099
|
+
* @mssql Only exact matches work.
|
|
5100
|
+
*/
|
|
5101
|
+
whereJson(column: SelectableColumn$1<string>, value: Record<string, any> | any[]): this;
|
|
5102
|
+
/**
|
|
5103
|
+
* @description JSON predicate: the column's document contains the value (AND).
|
|
5104
|
+
*/
|
|
5105
|
+
andWhereJson(column: SelectableColumn$1<string>, value: Record<string, any> | any[]): this;
|
|
5106
|
+
/**
|
|
5107
|
+
* @description JSON predicate: the column's document contains the value (OR).
|
|
5108
|
+
*/
|
|
5109
|
+
orWhereJson(column: SelectableColumn$1<string>, value: Record<string, any> | any[]): this;
|
|
5110
|
+
/**
|
|
5111
|
+
* @description JSON predicate: the column's document does not contain the value. Covers the
|
|
5112
|
+
* `whereJsonNotContains` and `whereJsonNotSupersetOf` spellings of the where builder.
|
|
5113
|
+
* @mssql Not supported.
|
|
5114
|
+
*/
|
|
5115
|
+
whereNotJson(column: SelectableColumn$1<string>, value: Record<string, any> | any[]): this;
|
|
5116
|
+
/**
|
|
5117
|
+
* @description JSON predicate: the column's document does not contain the value (AND).
|
|
5118
|
+
*/
|
|
5119
|
+
andWhereNotJson(column: SelectableColumn$1<string>, value: Record<string, any> | any[]): this;
|
|
5120
|
+
/**
|
|
5121
|
+
* @description JSON predicate: the column's document does not contain the value (OR).
|
|
5122
|
+
*/
|
|
5123
|
+
orWhereNotJson(column: SelectableColumn$1<string>, value: Record<string, any> | any[]): this;
|
|
5124
|
+
/**
|
|
5125
|
+
* @description JSON predicate: the column equals an exact JSON object value.
|
|
5126
|
+
*/
|
|
5127
|
+
whereJsonObject(column: SelectableColumn$1<string>, value: Record<string, any> | any[]): this;
|
|
5128
|
+
/**
|
|
5129
|
+
* @description JSON predicate: the column equals an exact JSON object value (AND).
|
|
5130
|
+
*/
|
|
5131
|
+
andWhereJsonObject(column: SelectableColumn$1<string>, value: Record<string, any> | any[]): this;
|
|
5132
|
+
/**
|
|
5133
|
+
* @description JSON predicate: the column equals an exact JSON object value (OR).
|
|
5134
|
+
*/
|
|
5135
|
+
orWhereJsonObject(column: SelectableColumn$1<string>, value: Record<string, any> | any[]): this;
|
|
5136
|
+
/**
|
|
5137
|
+
* @description JSON predicate: the column does not equal an exact JSON object value.
|
|
5138
|
+
*/
|
|
5139
|
+
whereNotJsonObject(column: SelectableColumn$1<string>, value: Record<string, any> | any[]): this;
|
|
5140
|
+
/**
|
|
5141
|
+
* @description JSON predicate: the column does not equal an exact JSON object value (AND).
|
|
5142
|
+
*/
|
|
5143
|
+
andWhereNotJsonObject(column: SelectableColumn$1<string>, value: Record<string, any> | any[]): this;
|
|
5144
|
+
/**
|
|
5145
|
+
* @description JSON predicate: the column does not equal an exact JSON object value (OR).
|
|
5146
|
+
*/
|
|
5147
|
+
orWhereNotJsonObject(column: SelectableColumn$1<string>, value: Record<string, any> | any[]): this;
|
|
5148
|
+
/**
|
|
5149
|
+
* @description JSON predicate: compares the value at a JSON path. This is the ON-clause form of
|
|
5150
|
+
* Knex's `onJsonPathEquals`, and of `whereJsonPath` in the where builder.
|
|
5151
|
+
*/
|
|
5152
|
+
whereJsonPath(column: SelectableColumn$1<string>, path: JsonPathInput, operator: BinaryOperatorType$2, value: any): this;
|
|
5153
|
+
/**
|
|
5154
|
+
* @description JSON predicate: compares the value at a JSON path (AND).
|
|
5155
|
+
*/
|
|
5156
|
+
andWhereJsonPath(column: SelectableColumn$1<string>, path: JsonPathInput, operator: BinaryOperatorType$2, value: any): this;
|
|
5157
|
+
/**
|
|
5158
|
+
* @description JSON predicate: compares the value at a JSON path (OR).
|
|
5159
|
+
*/
|
|
5160
|
+
orWhereJsonPath(column: SelectableColumn$1<string>, path: JsonPathInput, operator: BinaryOperatorType$2, value: any): this;
|
|
5161
|
+
/**
|
|
5162
|
+
* @description JSON predicate: the column's document is a subset of the value.
|
|
5163
|
+
* @postgres/cockroachdb/mysql/mariadb only
|
|
5164
|
+
*/
|
|
5165
|
+
whereJsonSubsetOf(column: SelectableColumn$1<string>, value: Record<string, any> | any[]): this;
|
|
5166
|
+
/**
|
|
5167
|
+
* @description JSON predicate: the column's document is a subset of the value (AND).
|
|
5168
|
+
*/
|
|
5169
|
+
andWhereJsonSubsetOf(column: SelectableColumn$1<string>, value: Record<string, any> | any[]): this;
|
|
5170
|
+
/**
|
|
5171
|
+
* @description JSON predicate: the column's document is a subset of the value (OR).
|
|
5172
|
+
*/
|
|
5173
|
+
orWhereJsonSubsetOf(column: SelectableColumn$1<string>, value: Record<string, any> | any[]): this;
|
|
5174
|
+
/**
|
|
5175
|
+
* @description JSON predicate: the column's document is not a subset of the value.
|
|
5176
|
+
* @postgres/cockroachdb/mysql/mariadb only
|
|
5177
|
+
*/
|
|
5178
|
+
whereJsonNotSubsetOf(column: SelectableColumn$1<string>, value: Record<string, any> | any[]): this;
|
|
5179
|
+
/**
|
|
5180
|
+
* @description JSON predicate: the column's document is not a subset of the value (AND).
|
|
5181
|
+
*/
|
|
5182
|
+
andWhereJsonNotSubsetOf(column: SelectableColumn$1<string>, value: Record<string, any> | any[]): this;
|
|
5183
|
+
/**
|
|
5184
|
+
* @description JSON predicate: the column's document is not a subset of the value (OR).
|
|
5185
|
+
*/
|
|
5186
|
+
orWhereJsonNotSubsetOf(column: SelectableColumn$1<string>, value: Record<string, any> | any[]): this;
|
|
5187
|
+
/**
|
|
5188
|
+
* @description JSON predicate: the column has none of the given keys.
|
|
5189
|
+
* @postgres/cockroachdb only
|
|
5190
|
+
*/
|
|
5191
|
+
whereJsonHasNone(column: SelectableColumn$1<string>, keys: string[]): this;
|
|
5192
|
+
/**
|
|
5193
|
+
* @description JSON predicate: the column has none of the given keys (AND).
|
|
5194
|
+
*/
|
|
5195
|
+
andWhereJsonHasNone(column: SelectableColumn$1<string>, keys: string[]): this;
|
|
5196
|
+
/**
|
|
5197
|
+
* @description JSON predicate: the column has none of the given keys (OR).
|
|
5198
|
+
*/
|
|
5199
|
+
orWhereJsonHasNone(column: SelectableColumn$1<string>, keys: string[]): this;
|
|
5200
|
+
/**
|
|
5201
|
+
* @description Adds a raw JSON predicate to the join ON clause.
|
|
5202
|
+
*/
|
|
5203
|
+
whereJsonRaw(sql: string, bindings?: BaseValues$2[]): this;
|
|
5204
|
+
/**
|
|
5205
|
+
* @description Adds an AND raw JSON predicate to the join ON clause.
|
|
5206
|
+
*/
|
|
5207
|
+
andWhereJsonRaw(sql: string, bindings?: BaseValues$2[]): this;
|
|
5208
|
+
/**
|
|
5209
|
+
* @description Adds an OR raw JSON predicate to the join ON clause.
|
|
5210
|
+
*/
|
|
5211
|
+
orWhereJsonRaw(sql: string, bindings?: BaseValues$2[]): this;
|
|
5212
|
+
private pushJson;
|
|
4868
5213
|
}
|
|
4869
5214
|
|
|
4870
5215
|
/**
|
|
4871
5216
|
* @description Callback type for join conditions
|
|
4872
5217
|
*/
|
|
4873
5218
|
type JoinOnCallback = (query: JoinOnQueryBuilder) => void;
|
|
5219
|
+
/**
|
|
5220
|
+
* @description Callback building the derived table a join reads from. The joined
|
|
5221
|
+
* alias is required, since every dialect needs one for a derived table.
|
|
5222
|
+
*/
|
|
5223
|
+
type JoinSubqueryCallback<T extends Model = Model> = (qb: QueryBuilder<T>) => void | SubQueryable;
|
|
4874
5224
|
declare abstract class JoinQueryBuilder<T extends Model, S extends Record<string, any> = Record<string, any>> extends FooterQueryBuilder<T, S> {
|
|
4875
5225
|
protected joinNodes: JoinNode[];
|
|
4876
5226
|
protected constructor(model: typeof Model, sqlDataSource: SqlDataSource);
|
|
@@ -4881,26 +5231,27 @@ declare abstract class JoinQueryBuilder<T extends Model, S extends Record<string
|
|
|
4881
5231
|
/**
|
|
4882
5232
|
* @description Join a table with the current model, join clause is not necessary and will be added automatically
|
|
4883
5233
|
*/
|
|
4884
|
-
joinRaw(query: string): this;
|
|
5234
|
+
joinRaw(query: string, bindings?: any[]): this;
|
|
4885
5235
|
/**
|
|
4886
5236
|
* @description Join a table with the current model, join clause is not necessary and will be added automatically
|
|
4887
5237
|
*/
|
|
4888
|
-
leftJoinRaw(query: string): this;
|
|
5238
|
+
leftJoinRaw(query: string, bindings?: any[]): this;
|
|
4889
5239
|
/**
|
|
4890
5240
|
* @description Join a table with the current model, join clause is not necessary and will be added automatically
|
|
4891
5241
|
*/
|
|
4892
|
-
rightJoinRaw(query: string): this;
|
|
5242
|
+
rightJoinRaw(query: string, bindings?: any[]): this;
|
|
4893
5243
|
/**
|
|
4894
5244
|
* @description Join a table with the current model, join clause is not necessary and will be added automatically
|
|
4895
5245
|
*/
|
|
4896
|
-
fullJoinRaw(query: string): this;
|
|
5246
|
+
fullJoinRaw(query: string, bindings?: any[]): this;
|
|
4897
5247
|
/**
|
|
4898
5248
|
* @description Join a table with the current model, join clause is not necessary and will be added automatically
|
|
4899
5249
|
*/
|
|
4900
|
-
crossJoinRaw(query: string): this;
|
|
5250
|
+
crossJoinRaw(query: string, bindings?: any[]): this;
|
|
4901
5251
|
/**
|
|
4902
5252
|
* @description Performs a CROSS JOIN against a table (non-raw).
|
|
4903
5253
|
*/
|
|
5254
|
+
crossJoin(cb: JoinSubqueryCallback<T>, alias: string): this;
|
|
4904
5255
|
crossJoin(relationTable: string, alias?: string): this;
|
|
4905
5256
|
crossJoin<R extends AnyModelConstructor>(relationModel: R): this;
|
|
4906
5257
|
/**
|
|
@@ -4912,7 +5263,7 @@ declare abstract class JoinQueryBuilder<T extends Model, S extends Record<string
|
|
|
4912
5263
|
/**
|
|
4913
5264
|
* @description Join a table with the current model, join clause is not necessary and will be added automatically
|
|
4914
5265
|
*/
|
|
4915
|
-
naturalJoinRaw(query: string): this;
|
|
5266
|
+
naturalJoinRaw(query: string, bindings?: any[]): this;
|
|
4916
5267
|
/**
|
|
4917
5268
|
* @alias join
|
|
4918
5269
|
* @param relationTable - The table to join
|
|
@@ -4920,6 +5271,7 @@ declare abstract class JoinQueryBuilder<T extends Model, S extends Record<string
|
|
|
4920
5271
|
* @param primaryColumn - The primary column of the current model, default is caller model primary key if using a Model, if using a Raw Query Builder you must provide the key for the primary table, must be in the format of `table.column`
|
|
4921
5272
|
* @param operator - The comparison operator to use in the ON clause (default: "=")
|
|
4922
5273
|
*/
|
|
5274
|
+
innerJoin(cb: JoinSubqueryCallback<T>, alias: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$2): this;
|
|
4923
5275
|
innerJoin(relationTable: string): this;
|
|
4924
5276
|
innerJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$2): this;
|
|
4925
5277
|
innerJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType$2): this;
|
|
@@ -4936,6 +5288,7 @@ declare abstract class JoinQueryBuilder<T extends Model, S extends Record<string
|
|
|
4936
5288
|
* @param primaryColumn - The primary column of the current model, default is caller model primary key if using a Model, if using a Raw Query Builder you must provide the key for the primary table, must be in the format of `table.column`
|
|
4937
5289
|
* @param operator - The comparison operator to use in the ON clause (default: "=")
|
|
4938
5290
|
*/
|
|
5291
|
+
join(cb: JoinSubqueryCallback<T>, alias: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$2): this;
|
|
4939
5292
|
join(relationTable: string): this;
|
|
4940
5293
|
join(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$2): this;
|
|
4941
5294
|
join(relationTable: string, referencingColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType$2): this;
|
|
@@ -4952,6 +5305,7 @@ declare abstract class JoinQueryBuilder<T extends Model, S extends Record<string
|
|
|
4952
5305
|
* @param primaryColumn - The primary column of the current model, default is caller model primary key if using a Model, if using a Raw Query Builder you must provide the key for the primary table, must be in the format of `table.column`
|
|
4953
5306
|
* @param operator - The comparison operator to use in the ON clause (default: "=")
|
|
4954
5307
|
*/
|
|
5308
|
+
leftJoin(cb: JoinSubqueryCallback<T>, alias: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$2): this;
|
|
4955
5309
|
leftJoin(relationTable: string): this;
|
|
4956
5310
|
leftJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$2): this;
|
|
4957
5311
|
leftJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType$2): this;
|
|
@@ -4968,6 +5322,7 @@ declare abstract class JoinQueryBuilder<T extends Model, S extends Record<string
|
|
|
4968
5322
|
* @param primaryColumn - The primary column of the current model, default is caller model primary key if using A Model, if using a Raw Query Builder you must provide the key for the primary table
|
|
4969
5323
|
* @param operator - The comparison operator to use in the ON clause (default: "=")
|
|
4970
5324
|
*/
|
|
5325
|
+
rightJoin(cb: JoinSubqueryCallback<T>, alias: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$2): this;
|
|
4971
5326
|
rightJoin(relationTable: string): this;
|
|
4972
5327
|
rightJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$2): this;
|
|
4973
5328
|
rightJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType$2): this;
|
|
@@ -4981,11 +5336,26 @@ declare abstract class JoinQueryBuilder<T extends Model, S extends Record<string
|
|
|
4981
5336
|
* @param primaryColumn - The primary column of the current model
|
|
4982
5337
|
* @param operator - The comparison operator to use in the ON clause (default: "=")
|
|
4983
5338
|
*/
|
|
5339
|
+
fullJoin(cb: JoinSubqueryCallback<T>, alias: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$2): this;
|
|
4984
5340
|
fullJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$2): this;
|
|
4985
5341
|
fullJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType$2): this;
|
|
4986
5342
|
fullJoin<R extends AnyModelConstructor>(relationTable: string | R, referencingColumnOrPrimaryColumn: ModelKey<InstanceType<R>> | JoinableColumn | ModelKey<T>, primaryColumn?: JoinableColumn | ModelKey<T>, operator?: BinaryOperatorType$2): this;
|
|
4987
5343
|
fullJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, operator: BinaryOperatorType$2, callback: JoinOnCallback): this;
|
|
4988
5344
|
fullJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, callback: JoinOnCallback): this;
|
|
5345
|
+
/**
|
|
5346
|
+
* @description Adds a join whose source is a derived table built by `cb`. The
|
|
5347
|
+
* join node carries the alias as its table, so an unqualified ON column on either
|
|
5348
|
+
* side still resolves against the derived table and the caller's model.
|
|
5349
|
+
*/
|
|
5350
|
+
private derivedJoin;
|
|
5351
|
+
/**
|
|
5352
|
+
* @description Aliases for the three outer joins, spelled the way the SQL standard
|
|
5353
|
+
* writes them. Parameters are widened on purpose: `Parameters<>` on an overloaded
|
|
5354
|
+
* method resolves to its last overload only, which rejects the shorter call shapes.
|
|
5355
|
+
*/
|
|
5356
|
+
leftOuterJoin(relationTable: string | AnyModelConstructor | JoinSubqueryCallback<T>, referencingColumn?: string, primaryColumn?: string, operatorOrCallback?: BinaryOperatorType$2 | JoinOnCallback, callback?: JoinOnCallback): this;
|
|
5357
|
+
rightOuterJoin(relationTable: string | AnyModelConstructor | JoinSubqueryCallback<T>, referencingColumn?: string, primaryColumn?: string, operatorOrCallback?: BinaryOperatorType$2 | JoinOnCallback, callback?: JoinOnCallback): this;
|
|
5358
|
+
fullOuterJoin(relationTable: string | AnyModelConstructor | JoinSubqueryCallback<T>, referencingColumn?: string, primaryColumn?: string, operatorOrCallback?: BinaryOperatorType$2 | JoinOnCallback, callback?: JoinOnCallback): this;
|
|
4989
5359
|
}
|
|
4990
5360
|
|
|
4991
5361
|
declare class SelectQueryBuilder<T extends Model, S extends Record<string, any> = Record<string, any>> extends JoinQueryBuilder<T, S> {
|
|
@@ -5152,6 +5522,14 @@ declare class SelectQueryBuilder<T extends Model, S extends Record<string, any>
|
|
|
5152
5522
|
selectJsonRaw<A extends string>(raw: string, alias: A): this;
|
|
5153
5523
|
}
|
|
5154
5524
|
|
|
5525
|
+
/**
|
|
5526
|
+
* @description The `{ column: value }` / `{ column: { op, value } }` shorthand, with
|
|
5527
|
+
* `$and` and `$or` keys for grouping. Shared by `find()` and the builder's `where()`.
|
|
5528
|
+
* @description Typed against the model's columns; a raw table builder passes `any`,
|
|
5529
|
+
* which accepts every key and value.
|
|
5530
|
+
*/
|
|
5531
|
+
type ObjectWhereCondition<T = any> = WhereType<T>;
|
|
5532
|
+
|
|
5155
5533
|
declare abstract class WhereQueryBuilder<T extends Model, S extends Record<string, any> = Record<string, any>> extends SelectQueryBuilder<T, S> {
|
|
5156
5534
|
protected whereNodes: (WhereNode | WhereGroupNode | WhereSubqueryNode)[];
|
|
5157
5535
|
protected havingNodes: HavingNode[];
|
|
@@ -5169,10 +5547,15 @@ declare abstract class WhereQueryBuilder<T extends Model, S extends Record<strin
|
|
|
5169
5547
|
* @warning The value is checked for truthiness, so false, 0, "", etc. will be considered falsy. Use strictWhen for null or undefined only cases.
|
|
5170
5548
|
*/
|
|
5171
5549
|
when(value: any, cb: (query: this) => void): this;
|
|
5550
|
+
/**
|
|
5551
|
+
* @description Applies a reusable query scope, forwarding any extra arguments to it.
|
|
5552
|
+
*/
|
|
5553
|
+
modify<A extends any[]>(cb: (query: this, ...args: A) => void, ...args: A): this;
|
|
5172
5554
|
/**
|
|
5173
5555
|
* @description Adds a WHERE condition to the query.
|
|
5174
5556
|
*/
|
|
5175
5557
|
where(cb: (queryBuilder: WhereOnlyQueryBuilder<T>) => void): this;
|
|
5558
|
+
where(conditions: ObjectWhereCondition<T>): this;
|
|
5176
5559
|
where(column: string, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
|
|
5177
5560
|
where(column: string, operator: SubqueryOperatorType, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
|
|
5178
5561
|
where<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$2, value: WhereColumnValue<T, K>): this;
|
|
@@ -5183,6 +5566,7 @@ declare abstract class WhereQueryBuilder<T extends Model, S extends Record<strin
|
|
|
5183
5566
|
* @description Adds an AND WHERE condition to the query.
|
|
5184
5567
|
*/
|
|
5185
5568
|
andWhere(cb: (queryBuilder: WhereOnlyQueryBuilder<T>) => void): this;
|
|
5569
|
+
andWhere(conditions: ObjectWhereCondition<T>): this;
|
|
5186
5570
|
andWhere(column: string, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
|
|
5187
5571
|
andWhere(column: string, operator: SubqueryOperatorType, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
|
|
5188
5572
|
andWhere<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$2, value: WhereColumnValue<T, K>): this;
|
|
@@ -5193,6 +5577,7 @@ declare abstract class WhereQueryBuilder<T extends Model, S extends Record<strin
|
|
|
5193
5577
|
* @description Adds an OR WHERE condition to the query.
|
|
5194
5578
|
*/
|
|
5195
5579
|
orWhere(cb: (queryBuilder: WhereOnlyQueryBuilder<T>) => void): this;
|
|
5580
|
+
orWhere(conditions: ObjectWhereCondition<T>): this;
|
|
5196
5581
|
orWhere(column: string, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
|
|
5197
5582
|
orWhere(column: string, operator: SubqueryOperatorType, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
|
|
5198
5583
|
orWhere<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$2, value: WhereColumnValue<T, K>): this;
|
|
@@ -5245,7 +5630,9 @@ declare abstract class WhereQueryBuilder<T extends Model, S extends Record<strin
|
|
|
5245
5630
|
private pushNotColumnWhere;
|
|
5246
5631
|
/**
|
|
5247
5632
|
* @description Adds a negated WHERE condition to the query.
|
|
5633
|
+
* @description With a single callback the whole group is negated: `not (a or b)`
|
|
5248
5634
|
*/
|
|
5635
|
+
whereNot(cb: (queryBuilder: WhereOnlyQueryBuilder<T>) => void): this;
|
|
5249
5636
|
whereNot(column: string, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
|
|
5250
5637
|
whereNot(column: string, operator: SubqueryOperatorType, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
|
|
5251
5638
|
whereNot<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$2, value: WhereColumnValue<T, K>): this;
|
|
@@ -5364,6 +5751,7 @@ declare abstract class WhereQueryBuilder<T extends Model, S extends Record<strin
|
|
|
5364
5751
|
* @description Adds a WHERE IN condition to the query.
|
|
5365
5752
|
* @warning If the array is empty, it will add an impossible condition.
|
|
5366
5753
|
*/
|
|
5754
|
+
whereIn(columns: string[], values: any[][]): this;
|
|
5367
5755
|
whereIn(column: string, values: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
|
|
5368
5756
|
whereIn<K extends ModelKey<T>>(column: K, values: T[StripTablePrefix<K & string> & keyof T][]): this;
|
|
5369
5757
|
whereIn<K extends `${string}.${string}`>(column: K, values: ResolveWhereValue<T, K>[]): this;
|
|
@@ -5371,6 +5759,7 @@ declare abstract class WhereQueryBuilder<T extends Model, S extends Record<strin
|
|
|
5371
5759
|
* @description Adds an AND WHERE IN condition to the query.
|
|
5372
5760
|
* @warning If the array is empty, it will add an impossible condition.
|
|
5373
5761
|
*/
|
|
5762
|
+
andWhereIn(columns: string[], values: any[][]): this;
|
|
5374
5763
|
andWhereIn(column: string, values: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
|
|
5375
5764
|
andWhereIn<K extends ModelKey<T>>(column: K, values: T[StripTablePrefix<K & string> & keyof T][]): this;
|
|
5376
5765
|
andWhereIn<K extends `${string}.${string}`>(column: K, values: ResolveWhereValue<T, K>[]): this;
|
|
@@ -5378,6 +5767,7 @@ declare abstract class WhereQueryBuilder<T extends Model, S extends Record<strin
|
|
|
5378
5767
|
* @description Adds an OR WHERE IN condition to the query.
|
|
5379
5768
|
* @warning If the array is empty, it will add an impossible condition.
|
|
5380
5769
|
*/
|
|
5770
|
+
orWhereIn(columns: string[], values: any[][]): this;
|
|
5381
5771
|
orWhereIn(column: string, values: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
|
|
5382
5772
|
orWhereIn<K extends ModelKey<T>>(column: K, values: T[StripTablePrefix<K & string> & keyof T][]): this;
|
|
5383
5773
|
orWhereIn<K extends `${string}.${string}`>(column: K, values: ResolveWhereValue<T, K>[]): this;
|
|
@@ -5385,6 +5775,7 @@ declare abstract class WhereQueryBuilder<T extends Model, S extends Record<strin
|
|
|
5385
5775
|
* @description Adds a WHERE NOT IN condition to the query.
|
|
5386
5776
|
* @warning If the array is empty, it will add an obvious condition to make it true.
|
|
5387
5777
|
*/
|
|
5778
|
+
whereNotIn(columns: string[], values: any[][]): this;
|
|
5388
5779
|
whereNotIn(column: string, values: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
|
|
5389
5780
|
whereNotIn<K extends ModelKey<T>>(column: K, values: T[StripTablePrefix<K & string> & keyof T][]): this;
|
|
5390
5781
|
whereNotIn<K extends `${string}.${string}`>(column: K, values: ResolveWhereValue<T, K>[]): this;
|
|
@@ -5392,6 +5783,7 @@ declare abstract class WhereQueryBuilder<T extends Model, S extends Record<strin
|
|
|
5392
5783
|
* @description Adds an OR WHERE NOT IN condition to the query.
|
|
5393
5784
|
* @warning If the array is empty, it will add an obvious condition to make it true.
|
|
5394
5785
|
*/
|
|
5786
|
+
andWhereNotIn(columns: string[], values: any[][]): this;
|
|
5395
5787
|
andWhereNotIn(column: string, values: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
|
|
5396
5788
|
andWhereNotIn<K extends ModelKey<T>>(column: K, values: T[StripTablePrefix<K & string> & keyof T][]): this;
|
|
5397
5789
|
andWhereNotIn<K extends `${string}.${string}`>(column: K, values: ResolveWhereValue<T, K>[]): this;
|
|
@@ -5399,6 +5791,7 @@ declare abstract class WhereQueryBuilder<T extends Model, S extends Record<strin
|
|
|
5399
5791
|
* @description Adds an OR WHERE NOT IN condition to the query.
|
|
5400
5792
|
* @warning If the array is empty, it will add an obvious condition to make it true.
|
|
5401
5793
|
*/
|
|
5794
|
+
orWhereNotIn(columns: string[], values: any[][]): this;
|
|
5402
5795
|
orWhereNotIn(column: string, values: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
|
|
5403
5796
|
orWhereNotIn<K extends ModelKey<T>>(column: K, values: T[StripTablePrefix<K & string> & keyof T][]): this;
|
|
5404
5797
|
orWhereNotIn<K extends `${string}.${string}`>(column: K, values: ResolveWhereValue<T, K>[]): this;
|
|
@@ -5604,6 +5997,11 @@ declare abstract class WhereQueryBuilder<T extends Model, S extends Record<strin
|
|
|
5604
5997
|
private buildSubQuery;
|
|
5605
5998
|
private andWhereSubQuery;
|
|
5606
5999
|
private orWhereSubQuery;
|
|
6000
|
+
/**
|
|
6001
|
+
* @description Row-value `in`/`not in`: `(a, b) in ((1, 2), (3, 4))`, which the
|
|
6002
|
+
* dialects that support it evaluate as a tuple comparison.
|
|
6003
|
+
*/
|
|
6004
|
+
private pushTupleIn;
|
|
5607
6005
|
private andWhereGroup;
|
|
5608
6006
|
private orWhereGroup;
|
|
5609
6007
|
}
|
|
@@ -5759,6 +6157,12 @@ declare class JsonQueryBuilder<T extends Model, S extends Record<string, any> =
|
|
|
5759
6157
|
}
|
|
5760
6158
|
|
|
5761
6159
|
type PluckReturnType<T extends Model, K extends RawModelKey<T>> = T[StripTablePrefix<K & string> & keyof T] extends infer U ? U[] : never;
|
|
6160
|
+
/**
|
|
6161
|
+
* Key accepted by `value()`. A narrowed selection leaves only its own columns
|
|
6162
|
+
* readable, which is what `select()` already returned as the result shape.
|
|
6163
|
+
* An untyped result falls back to every model column.
|
|
6164
|
+
*/
|
|
6165
|
+
type ValueKey<T extends Model, S extends Record<string, any>> = string extends keyof S ? RawModelKey<T> : keyof S & string;
|
|
5762
6166
|
/**
|
|
5763
6167
|
* Common SQL functions with intellisense support.
|
|
5764
6168
|
* Provides autocomplete for standard SQL aggregate and scalar functions,
|
|
@@ -5876,6 +6280,13 @@ type HasRawStarOrEmpty<Columns extends readonly Selectable[]> = Columns["length"
|
|
|
5876
6280
|
type BuildRawSelectType<Columns extends readonly Selectable[]> = HasRawStarOrEmpty<Columns> extends true ? Record<string, any> : UnionToIntersection$1<{
|
|
5877
6281
|
[K in keyof Columns]: BuildRawSingleSelectType<Columns[K]>;
|
|
5878
6282
|
}[number]> extends infer Result ? Result extends Record<string, any> ? keyof Result extends never ? Record<string, any> : Result & RawSelectBrand : Record<string, any> : Record<string, any>;
|
|
6283
|
+
/**
|
|
6284
|
+
* Options for the set operations (`union`, `unionAll`, `intersect`, `except`).
|
|
6285
|
+
*/
|
|
6286
|
+
type SetOperationOptions = {
|
|
6287
|
+
/** Parenthesizes that branch, so its own `ORDER BY` or `LIMIT` stays scoped to it. */
|
|
6288
|
+
wrap?: boolean;
|
|
6289
|
+
};
|
|
5879
6290
|
/**
|
|
5880
6291
|
* Composes a new selection with the existing selection state for raw queries.
|
|
5881
6292
|
*
|
|
@@ -6004,7 +6415,14 @@ interface DriverAdapter<D extends SqlDataSourceType = SqlDataSourceType, M exten
|
|
|
6004
6415
|
createPool(): Promise<void> | void;
|
|
6005
6416
|
closePool(): Promise<void>;
|
|
6006
6417
|
reserveConnection(): Promise<GetConnectionReturnType<D>> | GetConnectionReturnType<D>;
|
|
6007
|
-
|
|
6418
|
+
/**
|
|
6419
|
+
* @description Returns a reserved connection to the pool. When `error` is
|
|
6420
|
+
* given the caller is reporting why the connection is being given up (a failed
|
|
6421
|
+
* COMMIT or ROLLBACK), and the adapter should discard it rather than pool it:
|
|
6422
|
+
* the session state after that failure is unknown, so the next query must not
|
|
6423
|
+
* inherit it. Adapters whose connection cannot be discarded may ignore it.
|
|
6424
|
+
*/
|
|
6425
|
+
releaseConnection(connection?: GetConnectionReturnType<D>, error?: unknown): Promise<void> | void;
|
|
6008
6426
|
beginTransaction(connection: GetConnectionReturnType<D>, options: BeginTransactionOptions<D>): Promise<void>;
|
|
6009
6427
|
commitTransaction(connection: GetConnectionReturnType<D>, options: EndTransactionOptions<D>): Promise<void>;
|
|
6010
6428
|
rollbackTransaction(connection: GetConnectionReturnType<D>, options: EndTransactionOptions<D>): Promise<void>;
|
|
@@ -6208,6 +6626,15 @@ type SlaveContext = {
|
|
|
6208
6626
|
password: string;
|
|
6209
6627
|
database: string;
|
|
6210
6628
|
};
|
|
6629
|
+
/**
|
|
6630
|
+
* @description Context passed to `onPoolError` describing the pool that reported a failure.
|
|
6631
|
+
*/
|
|
6632
|
+
type PoolErrorContext = {
|
|
6633
|
+
type: SqlDataSourceType;
|
|
6634
|
+
host: string;
|
|
6635
|
+
port: number;
|
|
6636
|
+
database: string;
|
|
6637
|
+
};
|
|
6211
6638
|
/**
|
|
6212
6639
|
* @description The input type for the SqlDataSource constructor
|
|
6213
6640
|
* @description The connectionPolicies object is used to configure the connection policies for the sql data source
|
|
@@ -6258,6 +6685,18 @@ type SqlDataSourceInputShape<D extends SqlDataSourceType, T extends Record<strin
|
|
|
6258
6685
|
* against strings must switch to a numeric comparison.
|
|
6259
6686
|
*/
|
|
6260
6687
|
coerceNumericTypes?: boolean;
|
|
6688
|
+
/**
|
|
6689
|
+
* @description Called when a pooled connection fails while it sits idle.
|
|
6690
|
+
* @description The driver has already removed the client from the pool by the
|
|
6691
|
+
* time this fires, so the handler reports the failure; it cannot rescue the
|
|
6692
|
+
* connection. A handler that throws is caught and logged rather than reaching
|
|
6693
|
+
* the process.
|
|
6694
|
+
* @description Only the node `pg` driver (postgres, cockroachdb) surfaces
|
|
6695
|
+
* pool-level errors. The other drivers report connection failures on the
|
|
6696
|
+
* query that hit them, so this is never called there.
|
|
6697
|
+
* @default the error is logged and the pool keeps serving other clients
|
|
6698
|
+
*/
|
|
6699
|
+
onPoolError?: (error: Error, context: PoolErrorContext) => void | Promise<void>;
|
|
6261
6700
|
/**
|
|
6262
6701
|
* @description The replication configuration for the sql data source, it's used to configure the replication for the sql data source
|
|
6263
6702
|
*/
|
|
@@ -6543,10 +6982,17 @@ type WhereColumnValue<T extends Model, K extends ModelKey<T>> = T[StripTablePref
|
|
|
6543
6982
|
type ResolveWhereValue<T extends Model, K extends string> = K extends ModelKey<T> ? T[StripTablePrefix<K> & keyof T] | null | SqlFuncNode : BaseValues$2;
|
|
6544
6983
|
type ModelRelation<T extends Model> = OnlyRelations<T>;
|
|
6545
6984
|
type OrderByChoices = "asc" | "desc";
|
|
6985
|
+
/**
|
|
6986
|
+
* @description Either a bare direction, or a direction with an explicit null placement.
|
|
6987
|
+
*/
|
|
6988
|
+
type OrderByClause = OrderByChoices | {
|
|
6989
|
+
direction: OrderByChoices;
|
|
6990
|
+
nulls?: "first" | "last";
|
|
6991
|
+
};
|
|
6546
6992
|
type OrderByType<T extends Model> = {
|
|
6547
|
-
[K in keyof T as K extends "__tableName" ? never : K]?:
|
|
6993
|
+
[K in keyof T as K extends "__tableName" ? never : K]?: OrderByClause;
|
|
6548
6994
|
} & {
|
|
6549
|
-
[K in string]?:
|
|
6995
|
+
[K in string]?: OrderByClause;
|
|
6550
6996
|
};
|
|
6551
6997
|
type FindOneType<T extends Model, S extends ModelKey<T>[] = any[], R extends ModelRelation<T>[] = never[]> = {
|
|
6552
6998
|
select?: S;
|
|
@@ -6985,8 +7431,31 @@ type UpdateOptions = {};
|
|
|
6985
7431
|
/**
|
|
6986
7432
|
* @description Due to query limitations some query builder methods may not be available in a RelationQueryBuilder
|
|
6987
7433
|
*/
|
|
6988
|
-
type RelationQueryBuilderType<T extends Model, A extends Record<string, any> = {}, R extends Record<string, any> = {}> = Omit<ModelQueryBuilder<T, A, R>, "increment" | "decrement" | "paginate" | "pluck" | "truncate" | "many" | "one" | "oneOrFail" | "insert" | "insertMany" | "update" | "delete" | "softDelete" | "getSum" | "getAvg" | "getMin" | "getMax" | "getCount" | "getMin" | "getMax" | "getCount">;
|
|
7434
|
+
type RelationQueryBuilderType<T extends Model, A extends Record<string, any> = {}, R extends Record<string, any> = {}> = Omit<ModelQueryBuilder<T, A, R>, "increment" | "decrement" | "paginate" | "pluck" | "value" | "truncate" | "many" | "one" | "oneOrFail" | "insert" | "insertMany" | "batchInsert" | "update" | "delete" | "softDelete" | "getSum" | "getAvg" | "getMin" | "getMax" | "getCount" | "getMin" | "getMax" | "getCount">;
|
|
6989
7435
|
|
|
7436
|
+
/**
|
|
7437
|
+
* @description Thenable returned by model query terminals. Execution is deferred until
|
|
7438
|
+
* the result is consumed, so `pojo()` can pick the non-serialized path.
|
|
7439
|
+
*/
|
|
7440
|
+
declare class ModelQueryResultPromise<T> implements Promise<T> {
|
|
7441
|
+
private readonly execute;
|
|
7442
|
+
private readonly executePojo;
|
|
7443
|
+
readonly [Symbol.toStringTag] = "ModelQueryResultPromise";
|
|
7444
|
+
private executed?;
|
|
7445
|
+
constructor(execute: () => Promise<T>, executePojo: () => Promise<unknown>);
|
|
7446
|
+
/**
|
|
7447
|
+
* @description Resolves to plain driver rows, skipping model serialization, column
|
|
7448
|
+
* serializers, computed columns, and relation loading. Keys are database column names.
|
|
7449
|
+
* The generic defaults to the model result type; the model shape is a best-effort
|
|
7450
|
+
* description of raw rows, so pass an explicit type when the two differ.
|
|
7451
|
+
* Use only when query performance is mission critical.
|
|
7452
|
+
*/
|
|
7453
|
+
pojo<U = T>(): Promise<U>;
|
|
7454
|
+
private run;
|
|
7455
|
+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
7456
|
+
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
7457
|
+
finally(onfinally?: (() => void) | null): Promise<T>;
|
|
7458
|
+
}
|
|
6990
7459
|
declare class ModelQueryBuilder<T extends Model, S extends Record<string, any> = ModelWithoutRelations<T>, R extends Record<string, any> = {}, D extends SqlDataSourceType = SqlDataSourceType> extends QueryBuilder<T, Record<string, any>, D> {
|
|
6991
7460
|
relation: Relation;
|
|
6992
7461
|
protected sqlModelManagerUtils: SqlModelManagerUtils<T>;
|
|
@@ -7015,11 +7484,13 @@ declare class ModelQueryBuilder<T extends Model, S extends Record<string, any> =
|
|
|
7015
7484
|
* @description Creates a new ModelQueryBuilder instance from a model. Requires either a connection or transaction option.
|
|
7016
7485
|
*/
|
|
7017
7486
|
static from(model: typeof Model, options?: BaseModelMethodOptions): ModelQueryBuilder<InstanceType<typeof model>>;
|
|
7018
|
-
one():
|
|
7487
|
+
one(): ModelQueryResultPromise<SelectedModel<T, S, R> | null>;
|
|
7019
7488
|
oneOrFail(options?: {
|
|
7020
7489
|
customError?: Error;
|
|
7021
|
-
}):
|
|
7022
|
-
many():
|
|
7490
|
+
}): ModelQueryResultPromise<SelectedModel<T, S, R>>;
|
|
7491
|
+
many(): ModelQueryResultPromise<SelectedModel<T, S, R>[]>;
|
|
7492
|
+
private executeOne;
|
|
7493
|
+
private executeMany;
|
|
7023
7494
|
then<TResult1 = SelectedModel<T, S, R>[], TResult2 = never>(onfulfilled?: ((value: SelectedModel<T, S, R>[]) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
|
|
7024
7495
|
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined): Promise<SelectedModel<T, S, R>[] | TResult>;
|
|
7025
7496
|
finally(onfinally?: (() => void) | null | undefined): Promise<SelectedModel<T, S, R>[]>;
|
|
@@ -7040,6 +7511,17 @@ declare class ModelQueryBuilder<T extends Model, S extends Record<string, any> =
|
|
|
7040
7511
|
returning?: Ret;
|
|
7041
7512
|
trx?: Transaction;
|
|
7042
7513
|
}): InsertWriteOperation<ReturningResultMany<T, Ret>, Extract<ModelKey<T>, string>>;
|
|
7514
|
+
/**
|
|
7515
|
+
* @description Inserts rows in chunks of `chunkSize`, one statement per chunk.
|
|
7516
|
+
* @description The chunks are not wrapped in a transaction; wrap the call in
|
|
7517
|
+
* `sql.transaction(...)` when the whole batch has to be atomic.
|
|
7518
|
+
* @returns The returned columns, or the number of inserted rows without `returning`
|
|
7519
|
+
*/
|
|
7520
|
+
batchInsert<const Ret extends readonly (RawModelKey<T> | "*")[] = never[]>(modelsData: ModelWriteData<T>[], options?: {
|
|
7521
|
+
chunkSize?: number;
|
|
7522
|
+
returning?: Ret;
|
|
7523
|
+
trx?: Transaction;
|
|
7524
|
+
}): Promise<[Ret] extends [never[]] ? number : ReturningResultMany<T, Ret>>;
|
|
7043
7525
|
/**
|
|
7044
7526
|
* @description Inserts the rows produced by a SELECT (or a CTE feeding one) into the table.
|
|
7045
7527
|
* @param targetColumns - Optional destination model columns; positional when omitted
|
|
@@ -7156,6 +7638,9 @@ declare class ModelQueryBuilder<T extends Model, S extends Record<string, any> =
|
|
|
7156
7638
|
* @param options.returning - Columns to return from updated rows. Only supported on PostgreSQL, CockroachDB, SQLite, and MSSQL. Not available on MySQL or MariaDB.
|
|
7157
7639
|
* @returns WriteOperation resolving to the number of affected rows, or the returned columns if `returning` is specified (supported databases only).
|
|
7158
7640
|
*/
|
|
7641
|
+
update<const Ret extends ReturningParam<T, D> = never[]>(column: ModelKey<T> & string, value: WriteQueryParam, options?: UpdateOptions & {
|
|
7642
|
+
returning?: Ret;
|
|
7643
|
+
}): WriteOperation<MutationReturningResult<T, Ret>>;
|
|
7159
7644
|
update<const Ret extends ReturningParam<T, D> = never[]>(data: ModelWriteData<T>, options?: UpdateOptions & {
|
|
7160
7645
|
returning?: Ret;
|
|
7161
7646
|
}): WriteOperation<MutationReturningResult<T, Ret>>;
|
|
@@ -8569,7 +9054,7 @@ declare class InMemoryAdapter implements CacheAdapter {
|
|
|
8569
9054
|
}
|
|
8570
9055
|
|
|
8571
9056
|
declare class RedisCacheAdapter implements CacheAdapter {
|
|
8572
|
-
redisInstance: Redis;
|
|
9057
|
+
redisInstance: Redis | undefined;
|
|
8573
9058
|
private ioRedisOptions;
|
|
8574
9059
|
constructor(ioRedisOptions: RedisOptions);
|
|
8575
9060
|
private getClient;
|
|
@@ -9166,6 +9651,7 @@ declare class Schema {
|
|
|
9166
9651
|
dropIndex(indexName: string, table?: string): void;
|
|
9167
9652
|
/**
|
|
9168
9653
|
* @description Adds a primary key to a table
|
|
9654
|
+
* @throws HysteriaError if sqlite database, which cannot add a primary key to an existing table
|
|
9169
9655
|
*/
|
|
9170
9656
|
addPrimaryKey(table: string, columns: string[]): void;
|
|
9171
9657
|
/**
|
|
@@ -9292,7 +9778,7 @@ declare abstract class BaseSeeder {
|
|
|
9292
9778
|
abstract run(): Promise<void>;
|
|
9293
9779
|
}
|
|
9294
9780
|
|
|
9295
|
-
type HysteriaErrorCode = "VALIDATION_ERROR" | "CONNECTION_ALREADY_ESTABLISHED" | `UNSUPPORTED_ISOLATION_LEVEL_${string}` | "ROW_NOT_FOUND" | `UNSUPPORTED_DATABASE_TYPE_${string}` | `RELATION_TYPE_NOT_SUPPORTED_${string}` | `NOT_SUPPORTED_IN_${string}` | `RELATION_NOT_FOUND_IN_MODEL_${string}` | `UNKNOWN_RELATION_TYPE_${string}` | `DISTINCT_ON_NOT_SUPPORTED_IN_${string}` | `CONFLICT_COLUMNS_NOT_PRESENT_IN_DATA` | `CONFLICT_COLUMNS_NOT_PRESENT_IN_DATA_${string}` | `FOREIGN_KEY_VALUES_MISSING_FOR_HAS_ONE_RELATION_${string}` | `FOREIGN_KEY_VALUES_MISSING_FOR_BELONGS_TO_RELATION_${string}` | `PRIMARY_KEY_VALUES_MISSING_FOR_HAS_MANY_RELATION_${string}` | `MANY_TO_MANY_RELATION_NOT_FOUND_FOR_RELATED_MODEL_${string}` | `PRIMARY_KEY_VALUES_MISSING_FOR_MANY_TO_MANY_RELATION_${string}` | `RELATED_MODEL_DOES_NOT_HAVE_A_PRIMARY_KEY_${string}` | `FOR_SHARE_NOT_SUPPORTED_IN_${string}` | `SKIP_LOCKED_NOT_SUPPORTED_IN_${string}` | `LOCK_STRENGTH_NOT_SUPPORTED_IN_${string}` | "QUERY_TIMEOUT" | `LOCK_FOR_UPDATE_NOT_SUPPORTED_${string}` | `KEY_${string}_HAS_NO_HANDLER_IN_CACHE_KEYS_CONFIG` | `CACHE_ADAPTER_NOT_CONFIGURED` | `SQLITE_NOT_SUPPORTED` | `COCKROACHDB_NOT_SUPPORTED` | `RELATION_NOT_FOUND` | `POSTGRES_TABLE_REQUIRED` | `MODEL_HAS_NO_PRIMARY_KEY_VALUE` | `RELATION_NOT_MANY_TO_MANY` | "MATERIALIZED_CTE_NOT_SUPPORTED" | "NOT_MATERIALIZED_CTE_NOT_SUPPORTED" | "USING_REQUIRES_JOIN" | "USING_NOT_SUPPORTED_IN_MSSQL" | "DUPLICATE_MODEL_KEYS_WHILE_INSTANTIATING_MODELS" | "INVALID_ONE_PARAMETER_WHERE_CONDITION" | "INVALID_PAGINATION_PARAMETERS" | "MISSING_ALIAS_FOR_SUBQUERY" | "MODEL_HAS_NO_PRIMARY_KEY" | "PRIMARY_KEY_NOT_FOUND" | "ORDER_BY_REQUIRED" | "ORDER_BY_RAW_NOT_SUPPORTED" | "INVALID_SQL_COMMENT" | "SQLITE_ONLY_SUPPORTS_SERIALIZABLE_ISOLATION_LEVEL" | "MUST_CALL_BUILD_CTE_AT_LEAST_ONCE" | "REGEXP_NOT_SUPPORTED_IN_SQLITE" | "MANY_TO_MANY_RELATION_MUST_HAVE_A_THROUGH_MODEL" | "INSERT_FAILED" | "MULTIPLE_PRIMARY_KEYS_NOT_ALLOWED" | "FILE_NOT_A_SQL_OR_TXT_FILE" | "CONNECTION_NOT_ESTABLISHED" | "TRANSACTION_NOT_ACTIVE" | "DEVELOPMENT_ERROR" | "MIGRATION_MODULE_NOT_FOUND" | "DRIVER_NOT_FOUND" | "FILE_NOT_FOUND_OR_NOT_ACCESSIBLE" | "ENV_NOT_SET" | "REQUIRED_VALUE_NOT_SET" | "SET_FAILED" | "GET_FAILED" | "REFERENCES_OPTION_REQUIRED" | "DELETE_FAILED" | "INVALID_DEFAULT_VALUE" | "DISCONNECT_FAILED" | "FLUSH_FAILED" | "LEFT_COLUMN_NOT_PROVIDED_FOR_JOIN" | "RIGHT_COLUMN_NOT_PROVIDED_FOR_JOIN" | "MODEL_HAS_NO_PRIMARY_KEY" | "GLOBAL_TRANSACTION_ALREADY_STARTED" | "GLOBAL_TRANSACTION_NOT_STARTED" | "MYSQL_REQUIRES_TABLE_NAME_FOR_INDEX_DROP" | "INVALID_DATE_OBJECT" | "INVALID_DATE_STRING" | "FAILED_TO_PARSE_DATE" | "MIGRATION_MODULE_REQUIRES_TS_NODE" | "FAILED_TO_ENCRYPT_SYMMETRICALLY" | "FAILED_TO_DECRYPT_SYMMETRICALLY" | "FAILED_TO_ENCRYPT_ASYMMETRICALLY" | "FAILED_TO_DECRYPT_ASYMMETRICALLY" | "UNSUPPORTED_RELATION_TYPE" | "LPUSH_FAILED" | "RPUSH_FAILED" | "LPOP_FAILED" | "RPOP_FAILED" | "LRANGE_FAILED" | "LLEN_FAILED" | "HSET_FAILED" | "HMSET_FAILED" | "HGET_FAILED" | "HGETALL_FAILED" | "HMGET_FAILED" | "HDEL_FAILED" | "HEXISTS_FAILED" | "HKEYS_FAILED" | "HLEN_FAILED" | "SADD_FAILED" | "SMEMBERS_FAILED" | "SREM_FAILED" | "SISMEMBER_FAILED" | "SCARD_FAILED" | "SINTER_FAILED" | "SUNION_FAILED" | "SDIFF_FAILED" | "ZADD_FAILED" | "ZRANGE_FAILED" | "ZREVRANGE_FAILED" | "ZREM_FAILED" | "ZSCORE_FAILED" | "ZCARD_FAILED" | "SUBSCRIBE_FAILED" | "UNSUBSCRIBE_FAILED" | "PUBLISH_FAILED" | "PSUBSCRIBE_FAILED" | "PUNSUBSCRIBE_FAILED" | "EXISTS_FAILED" | "EXPIRE_FAILED" | "EXPIREAT_FAILED" | "PEXPIRE_FAILED" | "TTL_FAILED" | "PTTL_FAILED" | "PERSIST_FAILED" | "KEYS_FAILED" | "RENAME_FAILED" | "TYPE_FAILED" | "SCAN_FAILED" | "ADMINJS_NOT_ENABLED" | "ADMINJS_INITIALIZATION_FAILED" | "ADMINJS_NO_MODELS_PROVIDED" | `BETTER_AUTH_MISSING_ID_${string}` | `BETTER_AUTH_INVALID_INCREMENT_${string}` | "ZOD_ENGINE_NOT_LOADED" | "ATOMIC_DATASOURCE_RESOLUTION_FAILED" | "ATOMIC_INVALID_METHOD" | "ATOMIC_CLS_DISABLED" | `SCOPE_NOT_FOUND_${string}` | "ON_CONFLICT_REQUIRES_MERGE_OR_IGNORE" | "MERGE_REQUIRES_ON_CONFLICT" | "ON_CONFLICT_COLUMNS_REQUIRED" | "JOIN_NOT_SUPPORTED_ON_WRITE" | "ORDER_BY_LIMIT_NOT_SUPPORTED_ON_WRITE" | "SELECT_ONLY_CLAUSE_ON_WRITE" | "CTE_NOT_SUPPORTED_ON_INSERT" | "CTE_NOT_SUPPORTED_ON_TRUNCATE" | "CTE_NOT_SUPPORTED_ON_WRITE" | "TRUNCATE_OPTION_NOT_SUPPORTED" | "UPDATE_REQUIRES_COLUMNS";
|
|
9781
|
+
type HysteriaErrorCode = "VALIDATION_ERROR" | "CONNECTION_ALREADY_ESTABLISHED" | `UNSUPPORTED_ISOLATION_LEVEL_${string}` | "ROW_NOT_FOUND" | `UNSUPPORTED_DATABASE_TYPE_${string}` | `RELATION_TYPE_NOT_SUPPORTED_${string}` | `NOT_SUPPORTED_IN_${string}` | `RELATION_NOT_FOUND_IN_MODEL_${string}` | `UNKNOWN_RELATION_TYPE_${string}` | `DISTINCT_ON_NOT_SUPPORTED_IN_${string}` | `CONFLICT_COLUMNS_NOT_PRESENT_IN_DATA` | `CONFLICT_COLUMNS_NOT_PRESENT_IN_DATA_${string}` | `FOREIGN_KEY_VALUES_MISSING_FOR_HAS_ONE_RELATION_${string}` | `FOREIGN_KEY_VALUES_MISSING_FOR_BELONGS_TO_RELATION_${string}` | `PRIMARY_KEY_VALUES_MISSING_FOR_HAS_MANY_RELATION_${string}` | `MANY_TO_MANY_RELATION_NOT_FOUND_FOR_RELATED_MODEL_${string}` | `PRIMARY_KEY_VALUES_MISSING_FOR_MANY_TO_MANY_RELATION_${string}` | `RELATED_MODEL_DOES_NOT_HAVE_A_PRIMARY_KEY_${string}` | `FOR_SHARE_NOT_SUPPORTED_IN_${string}` | `SKIP_LOCKED_NOT_SUPPORTED_IN_${string}` | `LOCK_STRENGTH_NOT_SUPPORTED_IN_${string}` | "QUERY_TIMEOUT" | `LOCK_FOR_UPDATE_NOT_SUPPORTED_${string}` | `KEY_${string}_HAS_NO_HANDLER_IN_CACHE_KEYS_CONFIG` | `CACHE_ADAPTER_NOT_CONFIGURED` | `SQLITE_NOT_SUPPORTED` | `COCKROACHDB_NOT_SUPPORTED` | `RELATION_NOT_FOUND` | `POSTGRES_TABLE_REQUIRED` | `MODEL_HAS_NO_PRIMARY_KEY_VALUE` | `RELATION_NOT_MANY_TO_MANY` | "MATERIALIZED_CTE_NOT_SUPPORTED" | "NOT_MATERIALIZED_CTE_NOT_SUPPORTED" | "ONLY_NOT_SUPPORTED" | "USING_REQUIRES_JOIN" | "USING_CONFLICTS_WITH_ON_CONDITIONS" | "USING_NOT_SUPPORTED_IN_MSSQL" | "DUPLICATE_MODEL_KEYS_WHILE_INSTANTIATING_MODELS" | "INVALID_ONE_PARAMETER_WHERE_CONDITION" | "INVALID_PAGINATION_PARAMETERS" | "MISSING_ALIAS_FOR_SUBQUERY" | "MODEL_HAS_NO_PRIMARY_KEY" | "PRIMARY_KEY_NOT_FOUND" | "ORDER_BY_REQUIRED" | "ORDER_BY_RAW_NOT_SUPPORTED" | "INVALID_SQL_COMMENT" | "SQLITE_ONLY_SUPPORTS_SERIALIZABLE_ISOLATION_LEVEL" | "MUST_CALL_BUILD_CTE_AT_LEAST_ONCE" | "REGEXP_NOT_SUPPORTED_IN_SQLITE" | "MANY_TO_MANY_RELATION_MUST_HAVE_A_THROUGH_MODEL" | "INSERT_FAILED" | "MULTIPLE_PRIMARY_KEYS_NOT_ALLOWED" | "FILE_NOT_A_SQL_OR_TXT_FILE" | "CONNECTION_NOT_ESTABLISHED" | "TRANSACTION_NOT_ACTIVE" | "DEVELOPMENT_ERROR" | "MIGRATION_MODULE_NOT_FOUND" | "DRIVER_NOT_FOUND" | "FILE_NOT_FOUND_OR_NOT_ACCESSIBLE" | "ENV_NOT_SET" | "REQUIRED_VALUE_NOT_SET" | "SET_FAILED" | "GET_FAILED" | "REFERENCES_OPTION_REQUIRED" | "DELETE_FAILED" | "INVALID_DEFAULT_VALUE" | "DISCONNECT_FAILED" | "FLUSH_FAILED" | "LEFT_COLUMN_NOT_PROVIDED_FOR_JOIN" | "RIGHT_COLUMN_NOT_PROVIDED_FOR_JOIN" | "MODEL_HAS_NO_PRIMARY_KEY" | "GLOBAL_TRANSACTION_ALREADY_STARTED" | "GLOBAL_TRANSACTION_NOT_STARTED" | "MYSQL_REQUIRES_TABLE_NAME_FOR_INDEX_DROP" | "INVALID_DATE_OBJECT" | "INVALID_DATE_STRING" | "FAILED_TO_PARSE_DATE" | "MIGRATION_MODULE_REQUIRES_TS_NODE" | "FAILED_TO_ENCRYPT_SYMMETRICALLY" | "FAILED_TO_DECRYPT_SYMMETRICALLY" | "FAILED_TO_ENCRYPT_ASYMMETRICALLY" | "FAILED_TO_DECRYPT_ASYMMETRICALLY" | "UNSUPPORTED_RELATION_TYPE" | "LPUSH_FAILED" | "RPUSH_FAILED" | "LPOP_FAILED" | "RPOP_FAILED" | "LRANGE_FAILED" | "LLEN_FAILED" | "HSET_FAILED" | "HMSET_FAILED" | "HGET_FAILED" | "HGETALL_FAILED" | "HMGET_FAILED" | "HDEL_FAILED" | "HEXISTS_FAILED" | "HKEYS_FAILED" | "HLEN_FAILED" | "SADD_FAILED" | "SMEMBERS_FAILED" | "SREM_FAILED" | "SISMEMBER_FAILED" | "SCARD_FAILED" | "SINTER_FAILED" | "SUNION_FAILED" | "SDIFF_FAILED" | "ZADD_FAILED" | "ZRANGE_FAILED" | "ZREVRANGE_FAILED" | "ZREM_FAILED" | "ZSCORE_FAILED" | "ZCARD_FAILED" | "SUBSCRIBE_FAILED" | "UNSUBSCRIBE_FAILED" | "PUBLISH_FAILED" | "PSUBSCRIBE_FAILED" | "PUNSUBSCRIBE_FAILED" | "EXISTS_FAILED" | "EXPIRE_FAILED" | "EXPIREAT_FAILED" | "PEXPIRE_FAILED" | "TTL_FAILED" | "PTTL_FAILED" | "PERSIST_FAILED" | "KEYS_FAILED" | "RENAME_FAILED" | "TYPE_FAILED" | "SCAN_FAILED" | "ADMINJS_NOT_ENABLED" | "ADMINJS_INITIALIZATION_FAILED" | "ADMINJS_NO_MODELS_PROVIDED" | `BETTER_AUTH_MISSING_ID_${string}` | `BETTER_AUTH_INVALID_INCREMENT_${string}` | "ZOD_ENGINE_NOT_LOADED" | "ATOMIC_DATASOURCE_RESOLUTION_FAILED" | "ATOMIC_INVALID_METHOD" | "ATOMIC_CLS_DISABLED" | `SCOPE_NOT_FOUND_${string}` | "ON_CONFLICT_REQUIRES_MERGE_OR_IGNORE" | "MERGE_REQUIRES_ON_CONFLICT" | "MERGE_REQUIRES_COLUMNS" | "ON_CONFLICT_COLUMNS_REQUIRED" | "JOIN_NOT_SUPPORTED_ON_WRITE" | "ORDER_BY_LIMIT_NOT_SUPPORTED_ON_WRITE" | "SELECT_ONLY_CLAUSE_ON_WRITE" | "CTE_NOT_SUPPORTED_ON_INSERT" | "CTE_NOT_SUPPORTED_ON_TRUNCATE" | "CTE_NOT_SUPPORTED_ON_WRITE" | "TRUNCATE_OPTION_NOT_SUPPORTED" | "UPDATE_REQUIRES_COLUMNS" | "UPDATE_FROM_NOT_SUPPORTED" | "DELETE_USING_NOT_SUPPORTED" | "MERGE_WHERE_NOT_SUPPORTED" | "INVALID_BATCH_SIZE" | "ORDER_BY_NULLS_WITH_CURSOR_NOT_SUPPORTED" | "WHERE_TUPLE_COLUMNS_REQUIRED";
|
|
9296
9782
|
|
|
9297
9783
|
declare class HysteriaError extends Error {
|
|
9298
9784
|
code: HysteriaErrorCode;
|
|
@@ -9455,4 +9941,4 @@ type BetterAuthAdapterConfig = Partial<Pick<AdapterFactoryConfig, "usePlural" |
|
|
|
9455
9941
|
*/
|
|
9456
9942
|
declare function betterAuthAdapter(sql: SqlDataSource, config?: BetterAuthAdapterConfig): (options: BetterAuthOptions) => DBAdapter;
|
|
9457
9943
|
|
|
9458
|
-
export { type AdminJsActionOptions, type AdminJsAssets, type AdminJsBranding, type AdminJsInstance, type AdminJsLocale, type AdminJsOptions, type AdminJsPage, type AdminJsPropertyOptions, type AdminJsResourceOptions, type AdminJsSettings, type AllowedDrivers, type AnyModelConstructor, type AnySqlDataSourceInput, type AtomicOptions, type BaseModelMethodOptions, BaseSeeder, type BeginTransactionOptions, type BetterAuthAdapterConfig, type BuildSelectType, type BuildSingleSelectType, type BuiltinDriverName, type CacheAdapter, type CacheKeys, ClientMigrator, type ColCharOptions, type ColComputedOptions, type ColJsonbOptions, type ColMediumIntOptions, type ColSmallIntOptions, type ColTinyIntOptions, type ColVarbinaryOptions, Collection, type CollectionDefinition, type ColumnDef, type CommonDataSourceInput, type ComposeBuildSelect, type ComposeSelect, type ComputedColumnDef, type ConnectionPolicies, type CreateSchemaResult, type CustomLogger, type DataSourceInput, type DataSourceType, type DateAutoHook, type DefinedCollection, type DefinedModel, type DefinedView, type DriverAdapter, type DriverAdapterFactory, type DriverAdapterFactoryContext, type EndTransactionOptions, type ExcludeMethods, type ExecuteOptions, type ExtractColumnName, type ExtractSourceColumn, type FindReturnType, type GetColumnType, type GetConnectionReturnType, HysteriaError, type HysteriaErrorCode, InMemoryAdapter, type InferPK, type InsertConflictConfig, type InsertConflictMode, InsertWriteOperation, type IntrospectedColumn, type IntrospectedForeignKey, type IntrospectedSchema, type IntrospectedTable, type JsEnvironmentValue, type JsonMutationFor, type JsonPathInput, type JsonPaths, type LoadOptions, type LoggerConfig, Migration, type MigrationConfig, type MigrationConfigBase, type MigrationLockConfig, type ModelColumns, type ModelDataProperties, type ModelInstanceType, type ModelKey, ModelQueryBuilder, type ModelQueryResult, type ModelRelation, type ModelSelectTuple, type ModelSelectableInput, type ModelStream, type ModelWithoutRelations, type ModelWriteData, type ModelsProxy, MongoDataSource, type MongoDataSourceInput$1 as MongoDataSourceInput, type MssqlComment, type MssqlConnectionInstance, type MssqlDataSourceInput, type MssqlPoolInstance, type MutationReturningResult, type MySqlComment, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullableOracleMssqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NullableColumn, type NumberModelKey, ObserverChain, ObserverChainWrapper, type Operation, type PgComment, type PgPoolClientInstance, type PingResult, type PlatformAdapter, type PlatformFs, type PlatformPath, PlatformUnsupportedError, type PostgresSqlDataSourceInput, type PrimaryColumnDef, type PropNamespace, type PropertyDef, QueryBuilder, type QueryContext, type QueryContextWithDuration, type QueryObserver, type RawModelKey, type RawModelOptions, RawNode, type RawQueryOptions, RedisCacheAdapter, type RedisFetchable, type RedisStorable, type RelatedInstance, type RelationDef, type RelationDefinitions, type RelationHelpers, type RelationLoadStrategy, type RelationQueryBuilderType, type ReplicationType, type ResolveColumnType, type ResolveJsonPathType, type ResolvedJsEnvironment, type ReturningColumns, type ReturningKey, type ReturningParam, type ReturningResult, type ReturningResultMany, type ReturningSupported, Schema, SchemaBuilder, type SchemaLookup, type SchemaRelDef, type SeederConfig, type SelectBrand, type SelectableColumn, type SelectedModel, type SlaveAlgorithm, type SlaveContext, type SqlCloneOptions, type SqlComment, SqlDataSource, type SqlDataSourceInput, type SqlDataSourceModel, type SqlDataSourceType, type SqlDriverSpecificOptions, SqlFuncNode, type SqlFuncRenderer, type SqlHint, type SqlPoolType, type Sqlite3ConnectionOptions, type SqliteComment, type SqliteConnectionInstance, type SqliteDataSourceInput, type StartTransactionOptions, type StripTablePrefix, type SubQueryable, type TableFormat, Transaction, type TransactionExecutionOptions, type TypedDefault, type TypedJsonPathInput, type TypedPrepare, type TypedSerialize, type UseCacheReturnType, type UseConnectionInput, type ValidationContext, ValidationError, type ValidationResult, type Validator, type ViewDefinition, WriteOperation, type WriteReturnType, atomic, betterAuthAdapter, col, createSchema, defineCollection, defineMigrator, defineModel, defineModelFactory, defineRelations, defineView, deriveOperationFromQuery, email, enumValidator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, type getPoolReturnType, loadPlatform, HysteriaLogger as logger, max, maxLength, min, minLength, pattern, prop, RedisDataSource as redis, registerDriverAdapter, registerSqlFuncRenderer, required, sqlFunc, url };
|
|
9944
|
+
export { type AdminJsActionOptions, type AdminJsAssets, type AdminJsBranding, type AdminJsInstance, type AdminJsLocale, type AdminJsOptions, type AdminJsPage, type AdminJsPropertyOptions, type AdminJsResourceOptions, type AdminJsSettings, type AllowedDrivers, type AnyModelConstructor, type AnySqlDataSourceInput, type AtomicOptions, type BaseModelMethodOptions, BaseSeeder, type BeginTransactionOptions, type BetterAuthAdapterConfig, type BuildSelectType, type BuildSingleSelectType, type BuiltinDriverName, type CacheAdapter, type CacheKeys, ClientMigrator, type ColCharOptions, type ColComputedOptions, type ColJsonbOptions, type ColMediumIntOptions, type ColSmallIntOptions, type ColTinyIntOptions, type ColVarbinaryOptions, Collection, type CollectionDefinition, type ColumnDef, type CommonDataSourceInput, type ComposeBuildSelect, type ComposeSelect, type ComputedColumnDef, type ConnectionPolicies, type CreateSchemaResult, type CustomLogger, type DataSourceInput, type DataSourceType, type DateAutoHook, type DefinedCollection, type DefinedModel, type DefinedView, type DriverAdapter, type DriverAdapterFactory, type DriverAdapterFactoryContext, type EndTransactionOptions, type ExcludeMethods, type ExecuteOptions, type ExtractColumnName, type ExtractSourceColumn, type FindReturnType, type GetColumnType, type GetConnectionReturnType, HysteriaError, type HysteriaErrorCode, InMemoryAdapter, type InferPK, type InsertConflictConfig, type InsertConflictMode, InsertWriteOperation, type IntrospectedColumn, type IntrospectedForeignKey, type IntrospectedSchema, type IntrospectedTable, type JsEnvironmentValue, type JsonMutationFor, type JsonPathInput, type JsonPaths, type LoadOptions, type LoggerConfig, Migration, type MigrationConfig, type MigrationConfigBase, type MigrationLockConfig, type ModelColumns, type ModelDataProperties, type ModelInstanceType, type ModelKey, ModelQueryBuilder, type ModelQueryResult, ModelQueryResultPromise, type ModelRelation, type ModelSelectTuple, type ModelSelectableInput, type ModelStream, type ModelWithoutRelations, type ModelWriteData, type ModelsProxy, MongoDataSource, type MongoDataSourceInput$1 as MongoDataSourceInput, type MssqlComment, type MssqlConnectionInstance, type MssqlDataSourceInput, type MssqlPoolInstance, type MutationReturningResult, type MySqlComment, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullableOracleMssqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NullableColumn, type NumberModelKey, ObserverChain, ObserverChainWrapper, type Operation, type PgComment, type PgPoolClientInstance, type PingResult, type PlatformAdapter, type PlatformFs, type PlatformPath, PlatformUnsupportedError, type PoolErrorContext, type PostgresSqlDataSourceInput, type PrimaryColumnDef, type PropNamespace, type PropertyDef, QueryBuilder, type QueryContext, type QueryContextWithDuration, type QueryObserver, type RawModelKey, type RawModelOptions, RawNode, type RawQueryOptions, RedisCacheAdapter, type RedisFetchable, type RedisStorable, type RelatedInstance, type RelationDef, type RelationDefinitions, type RelationHelpers, type RelationLoadStrategy, type RelationQueryBuilderType, type ReplicationType, type ResolveColumnType, type ResolveJsonPathType, type ResolvedJsEnvironment, type ReturningColumns, type ReturningKey, type ReturningParam, type ReturningResult, type ReturningResultMany, type ReturningSupported, Schema, SchemaBuilder, type SchemaLookup, type SchemaRelDef, type SeederConfig, type SelectBrand, type SelectableColumn, type SelectedModel, type SlaveAlgorithm, type SlaveContext, type SqlCloneOptions, type SqlComment, SqlDataSource, type SqlDataSourceInput, type SqlDataSourceModel, type SqlDataSourceType, type SqlDriverSpecificOptions, SqlFuncNode, type SqlFuncRenderer, type SqlHint, type SqlPoolType, type Sqlite3ConnectionOptions, type SqliteComment, type SqliteConnectionInstance, type SqliteDataSourceInput, type StartTransactionOptions, type StripTablePrefix, type SubQueryable, type TableFormat, Transaction, type TransactionExecutionOptions, type TypedDefault, type TypedJsonPathInput, type TypedPrepare, type TypedSerialize, type UseCacheReturnType, type UseConnectionInput, type ValidationContext, ValidationError, type ValidationResult, type Validator, type ViewDefinition, WriteOperation, type WriteReturnType, atomic, betterAuthAdapter, col, createSchema, defineCollection, defineMigrator, defineModel, defineModelFactory, defineRelations, defineView, deriveOperationFromQuery, email, enumValidator, generateOpenApiModel, generateOpenApiModelSchema, generateOpenApiModelWithMetadata, type getPoolReturnType, loadPlatform, HysteriaLogger as logger, max, maxLength, min, minLength, pattern, prop, RedisDataSource as redis, registerDriverAdapter, registerSqlFuncRenderer, required, sqlFunc, url };
|