hysteria-orm 12.0.0 → 12.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.cts CHANGED
@@ -143,63 +143,6 @@ type DateTimeOptions = {
143
143
  */
144
144
  type DatabaseTableOptions = MysqlTableOptions | PostgresTableOptions | SqliteTableOptions | MssqlTableOptions | MysqlAdvancedTableOptions;
145
145
 
146
- declare abstract class QueryNode {
147
- /**
148
- * Sql keyword to use for the query e.g. "select"
149
- */
150
- keyword: string;
151
- /**
152
- * The current parameter index to use for the query
153
- */
154
- currParamIndex: number;
155
- /**
156
- * Whether the query node is a raw value and should not be parsed by the interpreter
157
- */
158
- isRawValue: boolean;
159
- /**
160
- * Whether the keyword can be seen multiple times in the query, e.g. "join" can be seen multiple times in a query
161
- */
162
- abstract canKeywordBeSeenMultipleTimes: boolean;
163
- /**
164
- * The string to use to chain the keyword with the next keyword
165
- */
166
- abstract chainsWith: string;
167
- /**
168
- * The folder to use for the query node, e.g. "select" is in the "select" folder inside the interpreter map
169
- */
170
- abstract folder: string;
171
- /**
172
- * The file to use for the query node, e.g. "select" is in the "select" file inside the interpreter map
173
- */
174
- abstract file: string;
175
- constructor(keyword: string, isRawValue?: boolean);
176
- }
177
-
178
- declare class RawNode extends QueryNode {
179
- rawValue: string;
180
- canKeywordBeSeenMultipleTimes: boolean;
181
- chainsWith: string;
182
- currParamIndex: number;
183
- isRawValue: boolean;
184
- folder: string;
185
- file: string;
186
- constructor(value: string);
187
- }
188
-
189
- type BaseValues$2 = string | number | boolean | undefined | null | RawNode;
190
- type BinaryOperatorType$2 = "=" | "!=" | "<>" | ">" | "<" | ">=" | "<=" | "is" | "is not" | "like" | "not like" | "is null" | "is not null" | "ilike" | "in" | "not in" | "between" | "not between" | "regexp" | "not regexp" | "not ilike" | (string & {});
191
- declare class WhereNode extends QueryNode {
192
- column: string;
193
- isNegated: boolean;
194
- operator: BinaryOperatorType$2;
195
- value: BaseValues$2 | BaseValues$2[];
196
- chainsWith: "and" | "or";
197
- canKeywordBeSeenMultipleTimes: boolean;
198
- folder: string;
199
- file: string;
200
- constructor(column: string, chainsWith: "and" | "or", isNegated: boolean | undefined, operator: BinaryOperatorType$2, value: BaseValues$2 | BaseValues$2[], isRawValue?: boolean);
201
- }
202
-
203
146
  /**
204
147
  * @description AdminJS plugin types - All AdminJS imports are done at runtime via dynamic import()
205
148
  * @description This ensures the plugin is completely optional
@@ -733,6 +676,49 @@ interface NotNullableSqliteDataSourceInput extends SqliteDataSourceInput {
733
676
  */
734
677
  type DataSourceInput = MssqlDataSourceInput | MysqlSqlDataSourceInput | SqliteDataSourceInput | PostgresSqlDataSourceInput | MongoDataSourceInput$1;
735
678
 
679
+ declare abstract class QueryNode {
680
+ /**
681
+ * Sql keyword to use for the query e.g. "select"
682
+ */
683
+ keyword: string;
684
+ /**
685
+ * The current parameter index to use for the query
686
+ */
687
+ currParamIndex: number;
688
+ /**
689
+ * Whether the query node is a raw value and should not be parsed by the interpreter
690
+ */
691
+ isRawValue: boolean;
692
+ /**
693
+ * Whether the keyword can be seen multiple times in the query, e.g. "join" can be seen multiple times in a query
694
+ */
695
+ abstract canKeywordBeSeenMultipleTimes: boolean;
696
+ /**
697
+ * The string to use to chain the keyword with the next keyword
698
+ */
699
+ abstract chainsWith: string;
700
+ /**
701
+ * The folder to use for the query node, e.g. "select" is in the "select" folder inside the interpreter map
702
+ */
703
+ abstract folder: string;
704
+ /**
705
+ * The file to use for the query node, e.g. "select" is in the "select" file inside the interpreter map
706
+ */
707
+ abstract file: string;
708
+ constructor(keyword: string, isRawValue?: boolean);
709
+ }
710
+
711
+ declare class RawNode extends QueryNode {
712
+ rawValue: string;
713
+ canKeywordBeSeenMultipleTimes: boolean;
714
+ chainsWith: string;
715
+ currParamIndex: number;
716
+ isRawValue: boolean;
717
+ folder: string;
718
+ file: string;
719
+ constructor(value: string);
720
+ }
721
+
736
722
  /**
737
723
  * Simplifies complex return types like SelectedModel to make it more readable and strips out whatever is passed as the second type parameter (e.g. SELECT_BRAND) to avoid showing it in the IDE autocomplete.
738
724
  */
@@ -740,9 +726,23 @@ type Simplify<T, Strip> = T extends infer U ? {
740
726
  [K in keyof U as K extends Strip ? never : K]: U[K];
741
727
  } : never;
742
728
 
743
- type BaseValues$1 = string | number | boolean | null;
744
- type BinaryOperatorType$1 = "=" | "!=" | "<>" | ">" | "<" | ">=" | "<=" | "like" | "ilike" | "in";
729
+ type BaseValues$2 = string | number | boolean | null | SqlFuncNode;
730
+ type BinaryOperatorType$2 = "=" | "!=" | "<>" | ">" | "<" | ">=" | "<=" | "like" | "ilike" | "in";
745
731
  declare class HavingNode extends QueryNode {
732
+ column: string;
733
+ isNegated: boolean;
734
+ operator: BinaryOperatorType$2;
735
+ value: BaseValues$2 | BaseValues$2[];
736
+ chainsWith: "and" | "or";
737
+ canKeywordBeSeenMultipleTimes: boolean;
738
+ folder: string;
739
+ file: string;
740
+ constructor(column: string, chainsWith: "and" | "or", isNegated: boolean | undefined, operator: BinaryOperatorType$2, value: BaseValues$2 | BaseValues$2[], isRawValue?: boolean);
741
+ }
742
+
743
+ type BaseValues$1 = string | number | boolean | undefined | null | RawNode | SqlFuncNode;
744
+ type BinaryOperatorType$1 = "=" | "!=" | "<>" | ">" | "<" | ">=" | "<=" | "is" | "is not" | "like" | "not like" | "is null" | "is not null" | "ilike" | "in" | "not in" | "between" | "not between" | "regexp" | "not regexp" | "not ilike" | (string & {});
745
+ declare class WhereNode extends QueryNode {
746
746
  column: string;
747
747
  isNegated: boolean;
748
748
  operator: BinaryOperatorType$1;
@@ -856,25 +856,6 @@ declare class ColumnTypeNode extends QueryNode {
856
856
  });
857
857
  }
858
858
 
859
- /**
860
- * @description Expression node for the global `sqlFunc` token namespace.
861
- * @internal
862
- */
863
- declare class SqlFuncNode extends QueryNode {
864
- fn: string;
865
- args: (string | number | SqlFuncNode | RawNode)[];
866
- chainsWith: string;
867
- canKeywordBeSeenMultipleTimes: boolean;
868
- folder: string;
869
- file: string;
870
- constructor(fn: string, args?: (string | number | SqlFuncNode | RawNode)[]);
871
- }
872
- declare const sqlFunc: {
873
- uuid: () => SqlFuncNode;
874
- now: () => SqlFuncNode;
875
- currentTimestamp: () => SqlFuncNode;
876
- };
877
-
878
859
  declare class ConstraintBuilder extends BaseBuilder {
879
860
  private readonly columnNode;
880
861
  private readonly tableName?;
@@ -952,6 +933,12 @@ declare class ConstraintBuilder extends BaseBuilder {
952
933
  collate(collation: CommonMysqlCollations): this;
953
934
  collate(collation: string): this;
954
935
  private handleSqliteAutoIncrement;
936
+ /**
937
+ * @description Whether the sqlite column interpreter emits the primary key
938
+ * inline (see sqlite/column/column_type.ts), in which case a separate
939
+ * table-level constraint would be a second primary key.
940
+ */
941
+ private isInlineSqlitePrimaryKey;
955
942
  }
956
943
 
957
944
  declare class CreateTableBuilder extends BaseBuilder {
@@ -1799,6 +1786,7 @@ declare class InterpreterUtils {
1799
1786
  private readonly model;
1800
1787
  private readonly modelColumnsMap;
1801
1788
  private readonly jsInsertColumns;
1789
+ private readonly autoUpdateColumns;
1802
1790
  constructor(model: typeof Model);
1803
1791
  formatStringColumn(dbType: SqlDataSourceType, column: string): string;
1804
1792
  /**
@@ -4304,60 +4292,60 @@ declare class JoinOnQueryBuilder {
4304
4292
  /**
4305
4293
  * @description Adds a WHERE condition to the query.
4306
4294
  */
4307
- where(column: SelectableColumn$1<string>, operator: BinaryOperatorType$2, value: BaseValues$2): this;
4295
+ where(column: SelectableColumn$1<string>, operator: BinaryOperatorType$1, value: BaseValues$1): this;
4308
4296
  where(cb: (queryBuilder: JoinOnQueryBuilder) => void): this;
4309
- where(column: SelectableColumn$1<string>, value: BaseValues$2): this;
4297
+ where(column: SelectableColumn$1<string>, value: BaseValues$1): this;
4310
4298
  /**
4311
4299
  * @description Adds an AND WHERE condition to the query.
4312
4300
  */
4313
- andWhere(column: SelectableColumn$1<string>, operator: BinaryOperatorType$2, value: BaseValues$2): this;
4314
- andWhere(column: SelectableColumn$1<string>, value: BaseValues$2): this;
4301
+ andWhere(column: SelectableColumn$1<string>, operator: BinaryOperatorType$1, value: BaseValues$1): this;
4302
+ andWhere(column: SelectableColumn$1<string>, value: BaseValues$1): this;
4315
4303
  andWhere(cb: (queryBuilder: JoinOnQueryBuilder) => void): this;
4316
4304
  /**
4317
4305
  * @description Adds an OR WHERE condition to the query.
4318
4306
  */
4319
- orWhere(column: SelectableColumn$1<string>, operator: BinaryOperatorType$2, value: BaseValues$2): this;
4320
- orWhere(column: SelectableColumn$1<string>, value: BaseValues$2): this;
4307
+ orWhere(column: SelectableColumn$1<string>, operator: BinaryOperatorType$1, value: BaseValues$1): this;
4308
+ orWhere(column: SelectableColumn$1<string>, value: BaseValues$1): this;
4321
4309
  orWhere(cb: (queryBuilder: JoinOnQueryBuilder) => void): this;
4322
4310
  /**
4323
4311
  * @description Adds a negated WHERE condition to the query.
4324
4312
  */
4325
- whereNot(column: SelectableColumn$1<string>, operator: BinaryOperatorType$2, value: BaseValues$2): this;
4326
- whereNot(column: SelectableColumn$1<string>, value: BaseValues$2): this;
4313
+ whereNot(column: SelectableColumn$1<string>, operator: BinaryOperatorType$1, value: BaseValues$1): this;
4314
+ whereNot(column: SelectableColumn$1<string>, value: BaseValues$1): this;
4327
4315
  /**
4328
4316
  * @description Adds a negated AND WHERE condition to the query.
4329
4317
  */
4330
- andWhereNot(column: SelectableColumn$1<string>, operator: BinaryOperatorType$2, value: BaseValues$2): this;
4331
- andWhereNot(column: SelectableColumn$1<string>, value: BaseValues$2): this;
4318
+ andWhereNot(column: SelectableColumn$1<string>, operator: BinaryOperatorType$1, value: BaseValues$1): this;
4319
+ andWhereNot(column: SelectableColumn$1<string>, value: BaseValues$1): this;
4332
4320
  /**
4333
4321
  * @description Adds a negated OR WHERE condition to the query.
4334
4322
  */
4335
- orWhereNot(column: SelectableColumn$1<string>, operator: BinaryOperatorType$2, value: BaseValues$2): this;
4336
- orWhereNot(column: SelectableColumn$1<string>, value: BaseValues$2): this;
4323
+ orWhereNot(column: SelectableColumn$1<string>, operator: BinaryOperatorType$1, value: BaseValues$1): this;
4324
+ orWhereNot(column: SelectableColumn$1<string>, value: BaseValues$1): this;
4337
4325
  /**
4338
4326
  * @description Adds a WHERE BETWEEN condition to the query.
4339
4327
  */
4340
- whereBetween(column: SelectableColumn$1<string>, min: BaseValues$2, max: BaseValues$2): this;
4328
+ whereBetween(column: SelectableColumn$1<string>, min: BaseValues$1, max: BaseValues$1): this;
4341
4329
  /**
4342
4330
  * @description Adds an AND WHERE BETWEEN condition to the query.
4343
4331
  */
4344
- andWhereBetween(column: SelectableColumn$1<string>, min: BaseValues$2, max: BaseValues$2): this;
4332
+ andWhereBetween(column: SelectableColumn$1<string>, min: BaseValues$1, max: BaseValues$1): this;
4345
4333
  /**
4346
4334
  * @description Adds an OR WHERE BETWEEN condition to the query.
4347
4335
  */
4348
- orWhereBetween(column: SelectableColumn$1<string>, min: BaseValues$2, max: BaseValues$2): this;
4336
+ orWhereBetween(column: SelectableColumn$1<string>, min: BaseValues$1, max: BaseValues$1): this;
4349
4337
  /**
4350
4338
  * @description Adds a WHERE NOT BETWEEN condition to the query.
4351
4339
  */
4352
- whereNotBetween(column: SelectableColumn$1<string>, min: BaseValues$2, max: BaseValues$2): this;
4340
+ whereNotBetween(column: SelectableColumn$1<string>, min: BaseValues$1, max: BaseValues$1): this;
4353
4341
  /**
4354
4342
  * @description Adds an AND WHERE NOT BETWEEN condition to the query.
4355
4343
  */
4356
- andWhereNotBetween(column: SelectableColumn$1<string>, min: BaseValues$2, max: BaseValues$2): this;
4344
+ andWhereNotBetween(column: SelectableColumn$1<string>, min: BaseValues$1, max: BaseValues$1): this;
4357
4345
  /**
4358
4346
  * @description Adds an OR WHERE NOT BETWEEN condition to the query.
4359
4347
  */
4360
- orWhereNotBetween(column: SelectableColumn$1<string>, min: BaseValues$2, max: BaseValues$2): this;
4348
+ orWhereNotBetween(column: SelectableColumn$1<string>, min: BaseValues$1, max: BaseValues$1): this;
4361
4349
  /**
4362
4350
  * @description Adds a WHERE LIKE condition to the query.
4363
4351
  */
@@ -4409,27 +4397,27 @@ declare class JoinOnQueryBuilder {
4409
4397
  /**
4410
4398
  * @description Adds a WHERE IN condition to the query.
4411
4399
  */
4412
- whereIn(column: SelectableColumn$1<string>, values: BaseValues$2[]): this;
4400
+ whereIn(column: SelectableColumn$1<string>, values: BaseValues$1[]): this;
4413
4401
  /**
4414
4402
  * @description Adds an AND WHERE IN condition to the query.
4415
4403
  */
4416
- andWhereIn(column: SelectableColumn$1<string>, values: BaseValues$2[]): this;
4404
+ andWhereIn(column: SelectableColumn$1<string>, values: BaseValues$1[]): this;
4417
4405
  /**
4418
4406
  * @description Adds an OR WHERE IN condition to the query.
4419
4407
  */
4420
- orWhereIn(column: SelectableColumn$1<string>, values: BaseValues$2[]): this;
4408
+ orWhereIn(column: SelectableColumn$1<string>, values: BaseValues$1[]): this;
4421
4409
  /**
4422
4410
  * @description Adds a WHERE NOT IN condition to the query.
4423
4411
  */
4424
- whereNotIn(column: SelectableColumn$1<string>, values: BaseValues$2[]): this;
4412
+ whereNotIn(column: SelectableColumn$1<string>, values: BaseValues$1[]): this;
4425
4413
  /**
4426
4414
  * @description Adds an AND WHERE NOT IN condition to the query.
4427
4415
  */
4428
- andWhereNotIn(column: SelectableColumn$1<string>, values: BaseValues$2[]): this;
4416
+ andWhereNotIn(column: SelectableColumn$1<string>, values: BaseValues$1[]): this;
4429
4417
  /**
4430
4418
  * @description Adds an OR WHERE NOT IN condition to the query.
4431
4419
  */
4432
- orWhereNotIn(column: SelectableColumn$1<string>, values: BaseValues$2[]): this;
4420
+ orWhereNotIn(column: SelectableColumn$1<string>, values: BaseValues$1[]): this;
4433
4421
  /**
4434
4422
  * @description Adds a WHERE NULL condition to the query.
4435
4423
  */
@@ -4493,15 +4481,15 @@ declare class JoinOnQueryBuilder {
4493
4481
  /**
4494
4482
  * @description Adds a raw WHERE condition to the query.
4495
4483
  */
4496
- whereRaw(sql: string, bindings?: BaseValues$2[]): this;
4484
+ whereRaw(sql: string, bindings?: BaseValues$1[]): this;
4497
4485
  /**
4498
4486
  * @description Adds an AND raw WHERE condition to the query.
4499
4487
  */
4500
- andWhereRaw(sql: string, bindings?: BaseValues$2[]): this;
4488
+ andWhereRaw(sql: string, bindings?: BaseValues$1[]): this;
4501
4489
  /**
4502
4490
  * @description Adds an OR raw WHERE condition to the query.
4503
4491
  */
4504
- orWhereRaw(sql: string, bindings?: BaseValues$2[]): this;
4492
+ orWhereRaw(sql: string, bindings?: BaseValues$1[]): this;
4505
4493
  }
4506
4494
 
4507
4495
  /**
@@ -4546,13 +4534,13 @@ declare abstract class JoinQueryBuilder<T extends Model, S extends Record<string
4546
4534
  * @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`
4547
4535
  * @param operator - The comparison operator to use in the ON clause (default: "=")
4548
4536
  */
4549
- innerJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$2): this;
4550
- innerJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType$2): this;
4551
- innerJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator?: BinaryOperatorType$2): this;
4552
- innerJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn?: ModelKey<T>, operator?: BinaryOperatorType$2): this;
4553
- innerJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator: BinaryOperatorType$2, callback: JoinOnCallback): this;
4537
+ innerJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$1): this;
4538
+ innerJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType$1): this;
4539
+ innerJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator?: BinaryOperatorType$1): this;
4540
+ innerJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn?: ModelKey<T>, operator?: BinaryOperatorType$1): this;
4541
+ innerJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator: BinaryOperatorType$1, callback: JoinOnCallback): this;
4554
4542
  innerJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, callback: JoinOnCallback): this;
4555
- innerJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator: BinaryOperatorType$2, callback: JoinOnCallback): this;
4543
+ innerJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator: BinaryOperatorType$1, callback: JoinOnCallback): this;
4556
4544
  innerJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, callback: JoinOnCallback): this;
4557
4545
  /**
4558
4546
  * @description Join a table with the current model
@@ -4561,13 +4549,13 @@ declare abstract class JoinQueryBuilder<T extends Model, S extends Record<string
4561
4549
  * @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`
4562
4550
  * @param operator - The comparison operator to use in the ON clause (default: "=")
4563
4551
  */
4564
- join(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$2): this;
4565
- join(relationTable: string, referencingColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType$2): this;
4566
- join<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator?: BinaryOperatorType$2): this;
4567
- join<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn?: ModelKey<T>, operator?: BinaryOperatorType$2): this;
4568
- join(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator: BinaryOperatorType$2, callback: JoinOnCallback): this;
4552
+ join(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$1): this;
4553
+ join(relationTable: string, referencingColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType$1): this;
4554
+ join<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator?: BinaryOperatorType$1): this;
4555
+ join<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn?: ModelKey<T>, operator?: BinaryOperatorType$1): this;
4556
+ join(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator: BinaryOperatorType$1, callback: JoinOnCallback): this;
4569
4557
  join(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, callback: JoinOnCallback): this;
4570
- join<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator: BinaryOperatorType$2, callback: JoinOnCallback): this;
4558
+ join<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator: BinaryOperatorType$1, callback: JoinOnCallback): this;
4571
4559
  join<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, callback: JoinOnCallback): this;
4572
4560
  /**
4573
4561
  * @description Join a table with the current model
@@ -4576,13 +4564,13 @@ declare abstract class JoinQueryBuilder<T extends Model, S extends Record<string
4576
4564
  * @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`
4577
4565
  * @param operator - The comparison operator to use in the ON clause (default: "=")
4578
4566
  */
4579
- leftJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$2): this;
4580
- leftJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType$2): this;
4581
- leftJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator?: BinaryOperatorType$2): this;
4582
- leftJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn?: ModelKey<T>, operator?: BinaryOperatorType$2): this;
4583
- leftJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator: BinaryOperatorType$2, callback: JoinOnCallback): this;
4567
+ leftJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$1): this;
4568
+ leftJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType$1): this;
4569
+ leftJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator?: BinaryOperatorType$1): this;
4570
+ leftJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn?: ModelKey<T>, operator?: BinaryOperatorType$1): this;
4571
+ leftJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, operator: BinaryOperatorType$1, callback: JoinOnCallback): this;
4584
4572
  leftJoin(relationTable: string, referencingColumn: JoinableColumn, primaryColumn: JoinableColumn, callback: JoinOnCallback): this;
4585
- leftJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator: BinaryOperatorType$2, callback: JoinOnCallback): this;
4573
+ leftJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, operator: BinaryOperatorType$1, callback: JoinOnCallback): this;
4586
4574
  leftJoin<R extends AnyModelConstructor>(relationModel: R, referencingColumn: ModelKey<InstanceType<R>>, primaryColumn: ModelKey<T>, callback: JoinOnCallback): this;
4587
4575
  /**
4588
4576
  * @description Join a table with the current model
@@ -4591,10 +4579,10 @@ declare abstract class JoinQueryBuilder<T extends Model, S extends Record<string
4591
4579
  * @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
4592
4580
  * @param operator - The comparison operator to use in the ON clause (default: "=")
4593
4581
  */
4594
- rightJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$2): this;
4595
- rightJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType$2): this;
4596
- rightJoin<R extends AnyModelConstructor>(relationTable: string | R, referencingColumnOrPrimaryColumn: ModelKey<InstanceType<R>> | JoinableColumn | ModelKey<T>, primaryColumn?: JoinableColumn | ModelKey<T>, operator?: BinaryOperatorType$2): this;
4597
- rightJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, operator: BinaryOperatorType$2, callback: JoinOnCallback): this;
4582
+ rightJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$1): this;
4583
+ rightJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType$1): this;
4584
+ rightJoin<R extends AnyModelConstructor>(relationTable: string | R, referencingColumnOrPrimaryColumn: ModelKey<InstanceType<R>> | JoinableColumn | ModelKey<T>, primaryColumn?: JoinableColumn | ModelKey<T>, operator?: BinaryOperatorType$1): this;
4585
+ rightJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, operator: BinaryOperatorType$1, callback: JoinOnCallback): this;
4598
4586
  rightJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, callback: JoinOnCallback): this;
4599
4587
  /**
4600
4588
  * @description Perform a FULL OUTER JOIN with another table
@@ -4603,10 +4591,10 @@ declare abstract class JoinQueryBuilder<T extends Model, S extends Record<string
4603
4591
  * @param primaryColumn - The primary column of the current model
4604
4592
  * @param operator - The comparison operator to use in the ON clause (default: "=")
4605
4593
  */
4606
- fullJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$2): this;
4607
- fullJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType$2): this;
4608
- fullJoin<R extends AnyModelConstructor>(relationTable: string | R, referencingColumnOrPrimaryColumn: ModelKey<InstanceType<R>> | JoinableColumn | ModelKey<T>, primaryColumn?: JoinableColumn | ModelKey<T>, operator?: BinaryOperatorType$2): this;
4609
- fullJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, operator: BinaryOperatorType$2, callback: JoinOnCallback): this;
4594
+ fullJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, operator?: BinaryOperatorType$1): this;
4595
+ fullJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn?: JoinableColumn, operator?: BinaryOperatorType$1): this;
4596
+ fullJoin<R extends AnyModelConstructor>(relationTable: string | R, referencingColumnOrPrimaryColumn: ModelKey<InstanceType<R>> | JoinableColumn | ModelKey<T>, primaryColumn?: JoinableColumn | ModelKey<T>, operator?: BinaryOperatorType$1): this;
4597
+ fullJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, operator: BinaryOperatorType$1, callback: JoinOnCallback): this;
4610
4598
  fullJoin(relationTable: string, referencingColumnOrPrimaryColumn: JoinableColumn, primaryColumn: JoinableColumn, callback: JoinOnCallback): this;
4611
4599
  }
4612
4600
 
@@ -4761,9 +4749,9 @@ declare abstract class WhereQueryBuilder<T extends Model, S extends Record<strin
4761
4749
  where(cb: (queryBuilder: WhereOnlyQueryBuilder<T>) => void): this;
4762
4750
  where(column: string, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
4763
4751
  where(column: string, operator: SubqueryOperatorType, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
4764
- where<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$2, value: WhereColumnValue<T, K>): this;
4752
+ where<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$1, value: WhereColumnValue<T, K>): this;
4765
4753
  where<K extends ModelKey<T>>(column: K, value: WhereColumnValue<T, K>): this;
4766
- where<K extends `${string}.${string}`>(column: K, operator: BinaryOperatorType$2, value: ResolveWhereValue<T, K>): this;
4754
+ where<K extends `${string}.${string}`>(column: K, operator: BinaryOperatorType$1, value: ResolveWhereValue<T, K>): this;
4767
4755
  where<K extends `${string}.${string}`>(column: K, value: ResolveWhereValue<T, K>): this;
4768
4756
  /**
4769
4757
  * @description Adds an AND WHERE condition to the query.
@@ -4771,9 +4759,9 @@ declare abstract class WhereQueryBuilder<T extends Model, S extends Record<strin
4771
4759
  andWhere(cb: (queryBuilder: WhereOnlyQueryBuilder<T>) => void): this;
4772
4760
  andWhere(column: string, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
4773
4761
  andWhere(column: string, operator: SubqueryOperatorType, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
4774
- andWhere<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$2, value: WhereColumnValue<T, K>): this;
4762
+ andWhere<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$1, value: WhereColumnValue<T, K>): this;
4775
4763
  andWhere<K extends ModelKey<T>>(column: K, value: WhereColumnValue<T, K>): this;
4776
- andWhere<K extends `${string}.${string}`>(column: K, operator: BinaryOperatorType$2, value: ResolveWhereValue<T, K>): this;
4764
+ andWhere<K extends `${string}.${string}`>(column: K, operator: BinaryOperatorType$1, value: ResolveWhereValue<T, K>): this;
4777
4765
  andWhere<K extends `${string}.${string}`>(column: K, value: ResolveWhereValue<T, K>): this;
4778
4766
  /**
4779
4767
  * @description Adds an OR WHERE condition to the query.
@@ -4781,57 +4769,57 @@ declare abstract class WhereQueryBuilder<T extends Model, S extends Record<strin
4781
4769
  orWhere(cb: (queryBuilder: WhereOnlyQueryBuilder<T>) => void): this;
4782
4770
  orWhere(column: string, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
4783
4771
  orWhere(column: string, operator: SubqueryOperatorType, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
4784
- orWhere<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$2, value: WhereColumnValue<T, K>): this;
4772
+ orWhere<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$1, value: WhereColumnValue<T, K>): this;
4785
4773
  orWhere<K extends ModelKey<T>>(column: K, value: WhereColumnValue<T, K>): this;
4786
- orWhere<K extends `${string}.${string}`>(column: K, operator: BinaryOperatorType$2, value: ResolveWhereValue<T, K>): this;
4774
+ orWhere<K extends `${string}.${string}`>(column: K, operator: BinaryOperatorType$1, value: ResolveWhereValue<T, K>): this;
4787
4775
  orWhere<K extends `${string}.${string}`>(column: K, value: ResolveWhereValue<T, K>): this;
4788
4776
  /**
4789
4777
  * @description Adds a WHERE condition comparing two columns.
4790
4778
  */
4791
4779
  whereColumn<K extends ModelKey<T>>(column: K, referenceColumn: ModelKey<T>): this;
4792
- whereColumn<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$2, referenceColumn: ModelKey<T>): this;
4780
+ whereColumn<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$1, referenceColumn: ModelKey<T>): this;
4793
4781
  whereColumn(column: `${string}.${string}`, referenceColumn: `${string}.${string}`): this;
4794
- whereColumn(column: `${string}.${string}`, operator: BinaryOperatorType$2, referenceColumn: `${string}.${string}`): this;
4782
+ whereColumn(column: `${string}.${string}`, operator: BinaryOperatorType$1, referenceColumn: `${string}.${string}`): this;
4795
4783
  /**
4796
4784
  * @description Adds an AND WHERE condition comparing two columns.
4797
4785
  */
4798
4786
  andWhereColumn<K extends ModelKey<T>>(column: K, referenceColumn: ModelKey<T>): this;
4799
- andWhereColumn<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$2, referenceColumn: ModelKey<T>): this;
4787
+ andWhereColumn<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$1, referenceColumn: ModelKey<T>): this;
4800
4788
  andWhereColumn(column: `${string}.${string}`, referenceColumn: `${string}.${string}`): this;
4801
- andWhereColumn(column: `${string}.${string}`, operator: BinaryOperatorType$2, referenceColumn: `${string}.${string}`): this;
4789
+ andWhereColumn(column: `${string}.${string}`, operator: BinaryOperatorType$1, referenceColumn: `${string}.${string}`): this;
4802
4790
  /**
4803
4791
  * @description Adds an OR WHERE condition comparing two columns.
4804
4792
  */
4805
4793
  orWhereColumn<K extends ModelKey<T>>(column: K, referenceColumn: ModelKey<T>): this;
4806
- orWhereColumn<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$2, referenceColumn: ModelKey<T>): this;
4794
+ orWhereColumn<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$1, referenceColumn: ModelKey<T>): this;
4807
4795
  orWhereColumn(column: `${string}.${string}`, referenceColumn: `${string}.${string}`): this;
4808
- orWhereColumn(column: `${string}.${string}`, operator: BinaryOperatorType$2, referenceColumn: `${string}.${string}`): this;
4796
+ orWhereColumn(column: `${string}.${string}`, operator: BinaryOperatorType$1, referenceColumn: `${string}.${string}`): this;
4809
4797
  /**
4810
4798
  * @description Adds a negated WHERE condition to the query.
4811
4799
  */
4812
4800
  whereNot(column: string, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
4813
4801
  whereNot(column: string, operator: SubqueryOperatorType, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
4814
- whereNot<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$2, value: WhereColumnValue<T, K>): this;
4802
+ whereNot<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$1, value: WhereColumnValue<T, K>): this;
4815
4803
  whereNot<K extends ModelKey<T>>(column: K, value: WhereColumnValue<T, K>): this;
4816
- whereNot<K extends `${string}.${string}`>(column: K, operator: BinaryOperatorType$2, value: ResolveWhereValue<T, K>): this;
4804
+ whereNot<K extends `${string}.${string}`>(column: K, operator: BinaryOperatorType$1, value: ResolveWhereValue<T, K>): this;
4817
4805
  whereNot<K extends `${string}.${string}`>(column: K, value: ResolveWhereValue<T, K>): this;
4818
4806
  /**
4819
4807
  * @description Adds a negated AND WHERE condition to the query.
4820
4808
  */
4821
4809
  andWhereNot(column: string, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
4822
4810
  andWhereNot(column: string, operator: SubqueryOperatorType, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
4823
- andWhereNot<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$2, value: WhereColumnValue<T, K>): this;
4811
+ andWhereNot<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$1, value: WhereColumnValue<T, K>): this;
4824
4812
  andWhereNot<K extends ModelKey<T>>(column: K, value: WhereColumnValue<T, K>): this;
4825
- andWhereNot<K extends `${string}.${string}`>(column: K, operator: BinaryOperatorType$2, value: ResolveWhereValue<T, K>): this;
4813
+ andWhereNot<K extends `${string}.${string}`>(column: K, operator: BinaryOperatorType$1, value: ResolveWhereValue<T, K>): this;
4826
4814
  andWhereNot<K extends `${string}.${string}`>(column: K, value: ResolveWhereValue<T, K>): this;
4827
4815
  /**
4828
4816
  * @description Adds a negated OR WHERE condition to the query.
4829
4817
  */
4830
4818
  orWhereNot(column: string, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
4831
4819
  orWhereNot(column: string, operator: SubqueryOperatorType, subQuery: QueryBuilder<T> | ((subQuery: QueryBuilder<T>) => void | SubQueryable)): this;
4832
- orWhereNot<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$2, value: WhereColumnValue<T, K>): this;
4820
+ orWhereNot<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$1, value: WhereColumnValue<T, K>): this;
4833
4821
  orWhereNot<K extends ModelKey<T>>(column: K, value: WhereColumnValue<T, K>): this;
4834
- orWhereNot<K extends `${string}.${string}`>(column: K, operator: BinaryOperatorType$2, value: ResolveWhereValue<T, K>): this;
4822
+ orWhereNot<K extends `${string}.${string}`>(column: K, operator: BinaryOperatorType$1, value: ResolveWhereValue<T, K>): this;
4835
4823
  orWhereNot<K extends `${string}.${string}`>(column: K, value: ResolveWhereValue<T, K>): this;
4836
4824
  /**
4837
4825
  * @description Adds a WHERE BETWEEN condition to the query.
@@ -5077,24 +5065,24 @@ declare abstract class WhereQueryBuilder<T extends Model, S extends Record<strin
5077
5065
  * @description Adds a HAVING condition to the query.
5078
5066
  */
5079
5067
  having<K extends ModelKey<T>>(column: K, value: WhereColumnValue<T, K>): this;
5080
- having<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$2, value: WhereColumnValue<T, K>): this;
5068
+ having<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$1, value: WhereColumnValue<T, K>): this;
5081
5069
  having<K extends `${string}.${string}`>(column: K, value: ResolveWhereValue<T, K>): this;
5082
- having<K extends `${string}.${string}`>(column: K, operator: BinaryOperatorType$2, value: ResolveWhereValue<T, K>): this;
5070
+ having<K extends `${string}.${string}`>(column: K, operator: BinaryOperatorType$1, value: ResolveWhereValue<T, K>): this;
5083
5071
  /**
5084
5072
  * @description Adds an AND HAVING condition to the query.
5085
5073
  */
5086
5074
  andHaving<K extends ModelKey<T>>(column: K, value: WhereColumnValue<T, K>): this;
5087
- andHaving<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$2, value: WhereColumnValue<T, K>): this;
5075
+ andHaving<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$1, value: WhereColumnValue<T, K>): this;
5088
5076
  andHaving<K extends `${string}.${string}`>(column: K, value: ResolveWhereValue<T, K>): this;
5089
- andHaving<K extends `${string}.${string}`>(column: K, operator: BinaryOperatorType$2, value: ResolveWhereValue<T, K>): this;
5090
- andHaving(column: ModelKey<T>, operator: BinaryOperatorType$2, value: any): this;
5077
+ andHaving<K extends `${string}.${string}`>(column: K, operator: BinaryOperatorType$1, value: ResolveWhereValue<T, K>): this;
5078
+ andHaving(column: ModelKey<T>, operator: BinaryOperatorType$1, value: any): this;
5091
5079
  /**
5092
5080
  * @description Adds an OR HAVING condition to the query.
5093
5081
  */
5094
5082
  orHaving<K extends ModelKey<T>>(column: K, value: WhereColumnValue<T, K>): this;
5095
- orHaving<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$2, value: WhereColumnValue<T, K>): this;
5083
+ orHaving<K extends ModelKey<T>>(column: K, operator: BinaryOperatorType$1, value: WhereColumnValue<T, K>): this;
5096
5084
  orHaving(column: `${string}.${string}`, value: any): this;
5097
- orHaving(column: `${string}.${string}`, operator: BinaryOperatorType$2, value: any): this;
5085
+ orHaving(column: `${string}.${string}`, operator: BinaryOperatorType$1, value: any): this;
5098
5086
  /**
5099
5087
  * @description Adds a raw HAVING condition to the query.
5100
5088
  */
@@ -5380,7 +5368,7 @@ type UpsertOptionsRawBuilder = {
5380
5368
  updateOnConflict?: boolean;
5381
5369
  returning?: readonly string[];
5382
5370
  };
5383
- type WriteQueryParam = string | number | boolean | Date | RawNode | object | null | undefined;
5371
+ type WriteQueryParam = string | number | boolean | Date | RawNode | SqlFuncNode | object | null | undefined;
5384
5372
  /**
5385
5373
  * Simple paginated data type for raw query builders (without Model constraint)
5386
5374
  */
@@ -5677,6 +5665,20 @@ type SqlDataSourceInputShape<D extends SqlDataSourceType, T extends Record<strin
5677
5665
  * @warning For usage with types, you must have driver types installed if the driver handles types in a type package like e.g. `@types/pg`
5678
5666
  */
5679
5667
  driverOptions?: SqlDriverSpecificOptions<D>;
5668
+ /**
5669
+ * @description Parse postgres/cockroachdb `int8` (oid 20) as a JS `bigint`
5670
+ * and `numeric` (oid 1700) as a JS `number`, instead of the driver default
5671
+ * of a decimal string for both.
5672
+ * @description Only honoured on the node `pg` driver; the Bun native SQL
5673
+ * path (`bun-sql`) ignores it.
5674
+ * @default false
5675
+ * @warning Breaking when enabled: any result path that bypasses a model
5676
+ * column's `serialize` — `sql.rawQuery(...)`, the raw `sql.from("table")`
5677
+ * builder, `selectRaw` aliases and generic `col<T>()` columns — now yields
5678
+ * `bigint`/`number` where it previously yielded strings. Consumers comparing
5679
+ * against strings must switch to a numeric comparison.
5680
+ */
5681
+ coerceNumericTypes?: boolean;
5680
5682
  /**
5681
5683
  * @description The replication configuration for the sql data source, it's used to configure the replication for the sql data source
5682
5684
  */
@@ -5719,6 +5721,20 @@ type UseConnectionInput<D extends SqlDataSourceType = SqlDataSourceType, T exten
5719
5721
  readonly logs?: boolean | LoggerConfig;
5720
5722
  readonly models?: T;
5721
5723
  readonly driverOptions?: SqlDriverSpecificOptions<D>;
5724
+ /**
5725
+ * @description Parse postgres/cockroachdb `int8` (oid 20) as a JS `bigint`
5726
+ * and `numeric` (oid 1700) as a JS `number`, instead of the driver default
5727
+ * of a decimal string for both.
5728
+ * @description Only honoured on the node `pg` driver; the Bun native SQL
5729
+ * path (`bun-sql`) ignores it.
5730
+ * @default false
5731
+ * @warning Breaking when enabled: any result path that bypasses a model
5732
+ * column's `serialize` — `sql.rawQuery(...)`, the raw `sql.from("table")`
5733
+ * builder, `selectRaw` aliases and generic `col<T>()` columns — now yields
5734
+ * `bigint`/`number` where it previously yielded strings. Consumers comparing
5735
+ * against strings must switch to a numeric comparison.
5736
+ */
5737
+ coerceNumericTypes?: boolean;
5722
5738
  connectionPolicies?: ConnectionPolicies;
5723
5739
  queryFormatOptions?: FormatOptionsWithLanguage;
5724
5740
  cacheStrategy?: {
@@ -5766,6 +5782,42 @@ type PingResult = {
5766
5782
  dialect: SqlDataSourceType;
5767
5783
  };
5768
5784
 
5785
+ /**
5786
+ * @description Expression node for the global `sqlFunc` token namespace.
5787
+ * @internal
5788
+ */
5789
+ declare class SqlFuncNode extends QueryNode {
5790
+ fn: string;
5791
+ args: (string | number | SqlFuncNode | RawNode)[];
5792
+ chainsWith: string;
5793
+ canKeywordBeSeenMultipleTimes: boolean;
5794
+ folder: string;
5795
+ file: string;
5796
+ constructor(fn: string, args?: (string | number | SqlFuncNode | RawNode)[]);
5797
+ }
5798
+ declare const sqlFunc: {
5799
+ uuid: () => SqlFuncNode;
5800
+ now: () => SqlFuncNode;
5801
+ currentTimestamp: () => SqlFuncNode;
5802
+ };
5803
+ /**
5804
+ * @description Renders a `SqlFuncNode` to dialect SQL. Return `undefined` to
5805
+ * fall back to the built-in tokens for the remaining function names.
5806
+ */
5807
+ type SqlFuncRenderer = (node: SqlFuncNode) => string | undefined;
5808
+ /**
5809
+ * @description Registers a custom renderer for a dialect, or for every dialect
5810
+ * via `"*"`. A dialect-specific renderer wins over the `"*"` entry, which wins
5811
+ * over the built-in tokens.
5812
+ * @example
5813
+ * ```ts
5814
+ * registerSqlFuncRenderer("postgres", (node) =>
5815
+ * node.fn === "$tenant" ? "current_setting('app.tenant')" : undefined,
5816
+ * );
5817
+ * ```
5818
+ */
5819
+ declare function registerSqlFuncRenderer(dialect: SqlDataSourceType | "*", renderer: SqlFuncRenderer): void;
5820
+
5769
5821
  type NullableAndUndefinable<T> = T | (T | null) | (T | undefined) | (T | null | undefined);
5770
5822
  type UpsertOptions<T extends Model> = {
5771
5823
  updateOnConflict?: boolean;
@@ -5902,13 +5954,13 @@ type MutationReturningResult<T extends Model, Ret extends readonly any[]> = [Ret
5902
5954
  * Extracts the value type for a model column key, adding `null` for SQL compatibility.
5903
5955
  * Strips any table prefix before indexing into the model type.
5904
5956
  */
5905
- type WhereColumnValue<T extends Model, K extends ModelKey<T>> = T[StripTablePrefix<K & string> & keyof T] | null;
5957
+ type WhereColumnValue<T extends Model, K extends ModelKey<T>> = T[StripTablePrefix<K & string> & keyof T] | null | SqlFuncNode;
5906
5958
  /**
5907
5959
  * Resolves the value type for a column in where clauses.
5908
5960
  * For model columns (ModelKey<T>), returns the specific column type.
5909
5961
  * For arbitrary columns (joins, aliases), falls back to BaseValues.
5910
5962
  */
5911
- type ResolveWhereValue<T extends Model, K extends string> = K extends ModelKey<T> ? T[StripTablePrefix<K> & keyof T] | null : BaseValues$2;
5963
+ type ResolveWhereValue<T extends Model, K extends string> = K extends ModelKey<T> ? T[StripTablePrefix<K> & keyof T] | null | SqlFuncNode : BaseValues$1;
5912
5964
  type ModelRelation<T extends Model> = OnlyRelations<T>;
5913
5965
  type OrderByChoices = "asc" | "desc";
5914
5966
  type OrderByType<T extends Model> = {
@@ -6866,37 +6918,37 @@ declare class ModelQueryBuilder<T extends Model, S extends Record<string, any> =
6866
6918
  * @warning All select statements are ignored, since we're only checking if the relation exists, a "select 1" will be added to the Query
6867
6919
  */
6868
6920
  havingRelated<RelationKey extends ModelRelation<T>>(relation: RelationKey, cb?: (queryBuilder: ModelQueryBuilder<RelatedInstance<T, RelationKey>>) => void): this;
6869
- havingRelated<RelationKey extends ModelRelation<T>>(relation: RelationKey, operatorOrValue?: BinaryOperatorType$2 | BaseValues$2, maybeValue?: BaseValues$2): this;
6921
+ havingRelated<RelationKey extends ModelRelation<T>>(relation: RelationKey, operatorOrValue?: BinaryOperatorType$1 | BaseValues$1, maybeValue?: BaseValues$1): this;
6870
6922
  /**
6871
6923
  * @description Checks if the relation exists in the models and has the given filters, if no callback is provided, it only check if there is at least one record for the relation
6872
6924
  * @warning All select statements are ignored, since we're only checking if the relation exists, a "select 1" will be added to the Query
6873
6925
  */
6874
6926
  andHavingRelated<RelationKey extends ModelRelation<T>>(relation: RelationKey, cb?: (queryBuilder: ModelQueryBuilder<RelatedInstance<T, RelationKey>>) => void): this;
6875
- andHavingRelated<RelationKey extends ModelRelation<T>>(relation: RelationKey, operatorOrValue?: BinaryOperatorType$2 | BaseValues$2, maybeValue?: BaseValues$2): this;
6927
+ andHavingRelated<RelationKey extends ModelRelation<T>>(relation: RelationKey, operatorOrValue?: BinaryOperatorType$1 | BaseValues$1, maybeValue?: BaseValues$1): this;
6876
6928
  /**
6877
6929
  * @description Checks if the relation exists in the models and has the given filters, if no callback is provided, it only check if there is at least one record for the relation,
6878
6930
  * @warning All select statements are ignored, since we're only checking if the relation exists, a "select 1" will be added to the Query
6879
6931
  */
6880
6932
  orHavingRelated<RelationKey extends ModelRelation<T>>(relation: RelationKey, cb?: (queryBuilder: ModelQueryBuilder<RelatedInstance<T, RelationKey>>) => void): this;
6881
- orHavingRelated<RelationKey extends ModelRelation<T>>(relation: RelationKey, operatorOrValue?: BinaryOperatorType$2 | BaseValues$2, maybeValue?: BaseValues$2): this;
6933
+ orHavingRelated<RelationKey extends ModelRelation<T>>(relation: RelationKey, operatorOrValue?: BinaryOperatorType$1 | BaseValues$1, maybeValue?: BaseValues$1): this;
6882
6934
  /**
6883
6935
  * @description Checks if the relation does not exist in the models and has the given filters, if no callback is provided, it only check if there is no record for the Relation
6884
6936
  * @warning All select statements are ignored, since we're only checking if the relation exists, a "select 1" will be added to the Query
6885
6937
  */
6886
6938
  notHavingRelated<RelationKey extends ModelRelation<T>>(relation: RelationKey, cb?: (queryBuilder: ModelQueryBuilder<RelatedInstance<T, RelationKey>>) => void): this;
6887
- notHavingRelated<RelationKey extends ModelRelation<T>>(relation: RelationKey, operatorOrValue?: BinaryOperatorType$2 | BaseValues$2, maybeValue?: BaseValues$2): this;
6939
+ notHavingRelated<RelationKey extends ModelRelation<T>>(relation: RelationKey, operatorOrValue?: BinaryOperatorType$1 | BaseValues$1, maybeValue?: BaseValues$1): this;
6888
6940
  /**
6889
6941
  * @description Checks if the relation does not exist in the models and has the given filters, if no callback is provided, it only check if there is no record for the relation
6890
6942
  * @warning All select statements are ignored, since we're only checking if the relation exists, a "select 1" will be added to the Query
6891
6943
  */
6892
6944
  andNotHavingRelated<RelationKey extends ModelRelation<T>>(relation: RelationKey, cb?: (queryBuilder: ModelQueryBuilder<RelatedInstance<T, RelationKey>>) => void): this;
6893
- andNotHavingRelated<RelationKey extends ModelRelation<T>>(relation: RelationKey, operatorOrValue?: BinaryOperatorType$2 | BaseValues$2, maybeValue?: BaseValues$2): this;
6945
+ andNotHavingRelated<RelationKey extends ModelRelation<T>>(relation: RelationKey, operatorOrValue?: BinaryOperatorType$1 | BaseValues$1, maybeValue?: BaseValues$1): this;
6894
6946
  /**
6895
6947
  * @description Checks if the relation does not exist in the models and has the given filters, if no callback is provided, it only check if there is no record for the Relation
6896
6948
  * @warning All select statements are ignored, since we're only checking if the relation exists, a "select 1" will be added to the Query
6897
6949
  */
6898
6950
  orNotHavingRelated<RelationKey extends ModelRelation<T>>(relation: RelationKey, cb?: (queryBuilder: ModelQueryBuilder<RelatedInstance<T, RelationKey>>) => void): this;
6899
- orNotHavingRelated<RelationKey extends ModelRelation<T>>(relation: RelationKey, operatorOrValue?: BinaryOperatorType$2 | BaseValues$2, maybeValue?: BaseValues$2): this;
6951
+ orNotHavingRelated<RelationKey extends ModelRelation<T>>(relation: RelationKey, operatorOrValue?: BinaryOperatorType$1 | BaseValues$1, maybeValue?: BaseValues$1): this;
6900
6952
  /**
6901
6953
  * @description Returns a copy of the query builder instance.
6902
6954
  */
@@ -6948,7 +7000,7 @@ declare class ModelQueryBuilder<T extends Model, S extends Record<string, any> =
6948
7000
  protected getRelatedModelsForRelation(relationQueryBuilder: ModelQueryBuilder<any>, relation: Relation, models: T[]): Promise<SelectedModel<T, ModelWithoutRelations<T>, R>[]>;
6949
7001
  protected getRelatedModelsQueryForRelation(relationQueryBuilder: ModelQueryBuilder<any>, relation: Relation, models: T[]): ModelQueryBuilder<any, any, any>;
6950
7002
  protected getFilterValuesFromModelsForRelation(relation: Relation, models: T[]): any[];
6951
- protected applyHavingRelatedFilter(relationQueryBuilder: ModelQueryBuilder<any>, relation: Relation, operator?: BinaryOperatorType$2, value?: BaseValues$2): void;
7003
+ protected applyHavingRelatedFilter(relationQueryBuilder: ModelQueryBuilder<any>, relation: Relation, operator?: BinaryOperatorType$1, value?: BaseValues$1): void;
6952
7004
  }
6953
7005
 
6954
7006
  /**
@@ -8795,4 +8847,4 @@ type BetterAuthAdapterConfig = Partial<Pick<AdapterFactoryConfig, "usePlural" |
8795
8847
  */
8796
8848
  declare function betterAuthAdapter(sql: SqlDataSource, config?: BetterAuthAdapterConfig): (options: BetterAuthOptions) => DBAdapter;
8797
8849
 
8798
- 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 IntrospectedColumn, type IntrospectedForeignKey, type IntrospectedSchema, type IntrospectedTable, type JsEnvironmentValue, 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 ModelsProxy, MongoDataSource, type MongoDataSourceInput$1 as MongoDataSourceInput, type MssqlConnectionInstance, type MssqlDataSourceInput, type MssqlPoolInstance, type MutationReturningResult, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullableOracleMssqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NullableColumn, type NumberModelKey, ObserverChain, ObserverChainWrapper, type Operation, 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, SqlDataSource, type SqlDataSourceInput, type SqlDataSourceModel, type SqlDataSourceType, type SqlDriverSpecificOptions, SqlFuncNode, type SqlPoolType, type Sqlite3ConnectionOptions, 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, required, sqlFunc, url };
8850
+ 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 IntrospectedColumn, type IntrospectedForeignKey, type IntrospectedSchema, type IntrospectedTable, type JsEnvironmentValue, 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 ModelsProxy, MongoDataSource, type MongoDataSourceInput$1 as MongoDataSourceInput, type MssqlConnectionInstance, type MssqlDataSourceInput, type MssqlPoolInstance, type MutationReturningResult, type MysqlConnectionInstance, type MysqlSqlDataSourceInput, type NotNullableMysqlSqlDataSourceInput, type NotNullableOracleMssqlDataSourceInput, type NotNullablePostgresSqlDataSourceInput, type NotNullableSqliteDataSourceInput, type NullableColumn, type NumberModelKey, ObserverChain, ObserverChainWrapper, type Operation, 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, SqlDataSource, type SqlDataSourceInput, type SqlDataSourceModel, type SqlDataSourceType, type SqlDriverSpecificOptions, SqlFuncNode, type SqlFuncRenderer, type SqlPoolType, type Sqlite3ConnectionOptions, 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 };