pqb 0.56.4 → 0.56.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -403,7 +403,10 @@ interface QueryData extends QueryDataBase {
403
403
  };
404
404
  /** insert **/
405
405
  columns: string[];
406
- values: InsertQueryDataObjectValues | InsertQueryDataFromValues;
406
+ insertFrom?: Query;
407
+ insertValuesAs?: string;
408
+ queryColumnsCount?: number;
409
+ values: InsertQueryDataObjectValues;
407
410
  onConflict?: {
408
411
  target?: OnConflictTarget;
409
412
  set?: OnConflictSet$1;
@@ -420,10 +423,6 @@ interface QueryData extends QueryDataBase {
420
423
  copy: CopyOptions;
421
424
  }
422
425
  type InsertQueryDataObjectValues = unknown[][];
423
- type InsertQueryDataFromValues = {
424
- from: Query;
425
- values?: unknown[];
426
- };
427
426
  interface UpdateQueryDataObject {
428
427
  [K: string]: Expression | {
429
428
  op: string;
@@ -1238,9 +1237,9 @@ declare class Join {
1238
1237
  }): JoinLateralResult<T, Table, Meta, Result, false>;
1239
1238
  /**
1240
1239
  * This method may be useful
1241
- * for combining with [createManyFrom](/guide/create-update-delete.html#createmanyfrom-insertmanyfrom).
1240
+ * for combining with [createForEachFrom](/guide/create-update-delete.html#createForEachFrom-insertForEachFrom).
1242
1241
  *
1243
- * `createManyFrom` creates multiple record based on a selecting query:
1242
+ * `createForEachFrom` creates multiple record based on a selecting query:
1244
1243
  *
1245
1244
  * ```sql
1246
1245
  * INSERT INTO t1(c1, c2)
@@ -1254,7 +1253,7 @@ declare class Join {
1254
1253
  * ```ts
1255
1254
  * const data = [{ column2: 'one' }, { column2: 'two' }, { column2: 'three' }];
1256
1255
  *
1257
- * await db.table.createManyFrom(
1256
+ * await db.table.createForEachFrom(
1258
1257
  * db.otherTable
1259
1258
  * .joinData('data', (t) => ({ column2: t.text() }), data)
1260
1259
  * .select('otherTable.column1', 'data.column2'),
@@ -1513,6 +1512,8 @@ interface OperatorsJson extends Base<unknown> {
1513
1512
  * ```ts
1514
1513
  * await db.table.find(id).update({
1515
1514
  * data: (q) => q.get('data').jsonSet(['path', 'to', 'value'], 'new value'),
1515
+ * // supports sql for the value
1516
+ * data: (q) => q.get('data').jsonSet(['path', 'to', 'value'], sql`'new value'`),
1516
1517
  * });
1517
1518
  * ```
1518
1519
  *
@@ -1531,6 +1532,9 @@ interface OperatorsJson extends Base<unknown> {
1531
1532
  * await db.table.find(id).update({
1532
1533
  * // data.path.to.value will be updated only if it already was defined
1533
1534
  * data: (q) => q.get('data').jsonReplace(['path', 'to', 'value'], 'new value'),
1535
+ * // supports sql for the value
1536
+ * data: (q) =>
1537
+ * q.get('data').jsonReplace(['path', 'to', 'value'], sql`'new value'`),
1534
1538
  * });
1535
1539
  * ```
1536
1540
  *
@@ -1557,6 +1561,8 @@ interface OperatorsJson extends Base<unknown> {
1557
1561
  * // update the record with data { tags: ['two'] } to have data { tags: ['one', 'two'] }
1558
1562
  * await db.table.find(id).update({
1559
1563
  * data: (q) => q.get('data').jsonInsert(['tags', 0], 'one'),
1564
+ * // supports sql for the value
1565
+ * data: (q) => q.get('data').jsonInsert(['tags', 0], sql`'one'`),
1560
1566
  * });
1561
1567
  *
1562
1568
  * // add 'three' after 'two'
@@ -2657,7 +2663,6 @@ declare namespace TableData {
2657
2663
  }
2658
2664
  export interface ColumnIndex {
2659
2665
  options: Index.ColumnArg & Index.Options;
2660
- name?: string;
2661
2666
  }
2662
2667
  export interface ColumnExclude extends ColumnIndex {
2663
2668
  with: string;
@@ -2665,12 +2670,10 @@ declare namespace TableData {
2665
2670
  export interface Index {
2666
2671
  columns: Index.ColumnOrExpressionOptions[];
2667
2672
  options: Index.Options;
2668
- name?: string;
2669
2673
  }
2670
2674
  export interface Exclude {
2671
2675
  columns: Exclude.ColumnOrExpressionOptions[];
2672
2676
  options: Exclude.Options;
2673
- name?: string;
2674
2677
  }
2675
2678
  export interface Constraint {
2676
2679
  name?: string;
@@ -2710,7 +2713,8 @@ declare namespace TableData {
2710
2713
  order?: string;
2711
2714
  weight?: SearchWeight;
2712
2715
  }
2713
- export interface UniqueOptionsArg {
2716
+ export interface UniqueOptionsArg<Name extends string = string> {
2717
+ name?: Name;
2714
2718
  nullsNotDistinct?: boolean;
2715
2719
  using?: string;
2716
2720
  include?: MaybeArray<string>;
@@ -2725,7 +2729,7 @@ declare namespace TableData {
2725
2729
  export interface TsVectorArg extends OptionsArg, TsVectorOptions {
2726
2730
  }
2727
2731
  export type Options = TsVectorArg;
2728
- export interface UniqueColumnArg extends ColumnOptions, UniqueOptionsArg {
2732
+ export interface UniqueColumnArg<Name extends string = string> extends ColumnOptions, UniqueOptionsArg<Name> {
2729
2733
  expression?: string;
2730
2734
  }
2731
2735
  export interface ColumnArg extends UniqueColumnArg {
@@ -2749,6 +2753,7 @@ declare namespace TableData {
2749
2753
  }
2750
2754
  export namespace Exclude {
2751
2755
  export interface Options {
2756
+ name?: string;
2752
2757
  using?: string;
2753
2758
  include?: MaybeArray<string>;
2754
2759
  with?: string;
@@ -2830,15 +2835,15 @@ interface TableDataMethods<Key extends PropertyKey> {
2830
2835
  unique<Columns extends [
2831
2836
  Key | TableData.Index.ColumnOrExpressionOptions<Key>,
2832
2837
  ...(Key | TableData.Index.ColumnOrExpressionOptions<Key>)[]
2833
- ], Name extends string>(columns: Columns, ...args: [options?: TableData.Index.UniqueOptionsArg] | [name?: Name, options?: TableData.Index.UniqueOptionsArg]): {
2838
+ ], Name extends string>(columns: Columns, options?: TableData.Index.UniqueOptionsArg<Name>): {
2834
2839
  tableDataItem: true;
2835
2840
  columns: Columns extends (Key | TableData.Index.ColumnOptionsForColumn<Key>)[] ? {
2836
2841
  [I in keyof Columns]: 'column' extends keyof Columns[I] ? Columns[I]['column'] : Columns[I];
2837
2842
  } : never;
2838
2843
  name: string extends Name ? never : Name;
2839
2844
  };
2840
- index(columns: (Key | TableData.Index.ColumnOrExpressionOptions<Key>)[], ...args: [options?: TableData.Index.OptionsArg] | [name?: string, options?: TableData.Index.OptionsArg]): NonUniqDataItem;
2841
- searchIndex(columns: (Key | TableData.Index.ColumnOrExpressionOptions<Key>)[], ...args: [options?: TableData.Index.TsVectorArg] | [name?: string, options?: TableData.Index.TsVectorArg]): NonUniqDataItem;
2845
+ index(columns: (Key | TableData.Index.ColumnOrExpressionOptions<Key>)[], options?: TableData.Index.OptionsArg): NonUniqDataItem;
2846
+ searchIndex(columns: (Key | TableData.Index.ColumnOrExpressionOptions<Key>)[], options?: TableData.Index.TsVectorArg): NonUniqDataItem;
2842
2847
  /**
2843
2848
  * Defines an `EXCLUDE` constraint for multiple columns.
2844
2849
  *
@@ -2908,7 +2913,7 @@ interface TableDataMethods<Key extends PropertyKey> {
2908
2913
  * });
2909
2914
  * ```
2910
2915
  */
2911
- exclude(columns: TableData.Exclude.ColumnOrExpressionOptions<Key>[], ...args: [options?: TableData.Exclude.Options] | [name?: string, options?: TableData.Exclude.Options]): NonUniqDataItem;
2916
+ exclude(columns: TableData.Exclude.ColumnOrExpressionOptions<Key>[], options?: TableData.Exclude.Options): NonUniqDataItem;
2912
2917
  foreignKey<ForeignTable extends (() => ForeignKeyTable) | string, ForeignColumns extends ForeignTable extends () => ForeignKeyTable ? [
2913
2918
  ColumnNameOfTable<ReturnType<ForeignTable>>,
2914
2919
  ...ColumnNameOfTable<ReturnType<ForeignTable>>[]
@@ -3566,7 +3571,9 @@ declare class Db<Table extends string | undefined = undefined, Shape extends Que
3566
3571
  queryArrays<R extends any[] = any[]>(...args: SQLQueryArgs): Promise<QueryArraysResult<R>>;
3567
3572
  }
3568
3573
  interface DbTableConstructor<ColumnTypes> {
3569
- <Table extends string, Shape extends QueryColumnsInit, Data extends MaybeArray<TableDataItem>, Options extends DbTableOptions<ColumnTypes, Table, Shape>>(table: Table, shape?: ((t: ColumnTypes) => Shape) | Shape, tableData?: TableDataFn<Shape, Data>, options?: Options): Db<Table, Shape, keyof ShapeColumnPrimaryKeys<Shape> extends never ? never : ShapeColumnPrimaryKeys<Shape>, ShapeUniqueColumns<Shape> | TableDataItemsUniqueColumns<Shape, Data>, TableDataItemsUniqueColumnTuples<Shape, Data>, UniqueConstraints<Shape> | TableDataItemsUniqueConstraints<Data>, ColumnTypes, Shape & ComputedColumnsFromOptions<Options['computed']>, MapTableScopesOption<Options>>;
3574
+ <Table extends string, Shape extends QueryColumnsInit, Data extends MaybeArray<TableDataItem>, Options extends DbTableOptions<ColumnTypes, Table, Shape>>(table: Table, shape?: ((t: ColumnTypes) => Shape) | Shape, tableData?: TableDataFn<Shape, Data>, options?: Options): Db<Table, Shape, keyof ShapeColumnPrimaryKeys<Shape> extends never ? never : ShapeColumnPrimaryKeys<Shape>, ShapeUniqueColumns<Shape> | TableDataItemsUniqueColumns<Shape, Data>, TableDataItemsUniqueColumnTuples<Shape, Data>, UniqueConstraints<Shape> | TableDataItemsUniqueConstraints<Data>, ColumnTypes, Shape & ComputedColumnsFromOptions<Options['computed']>, MapTableScopesOption<Options>> & {
3575
+ ko: Shape;
3576
+ };
3570
3577
  }
3571
3578
  type MapTableScopesOption<T> = T extends {
3572
3579
  scopes: RecordUnknown;
@@ -4223,6 +4230,179 @@ declare class Clear {
4223
4230
  clear<T>(this: T, ...clears: ClearStatement[]): T;
4224
4231
  }
4225
4232
 
4233
+ type CreateFromMethodNames = 'createOneFrom' | 'insertOneFrom' | CreateManyFromMethodNames;
4234
+ type CreateManyFromMethodNames = 'createManyFrom' | 'insertManyFrom' | 'createForEachFrom' | 'insertForEachFrom';
4235
+ interface QueryReturningOne extends IsQuery {
4236
+ result: QueryColumns;
4237
+ returnType: 'one' | 'oneOrThrow';
4238
+ }
4239
+ type CreateRawOrFromResult<T extends CreateSelf> = T extends {
4240
+ isCount: true;
4241
+ } ? SetQueryKind<T, 'create'> : T['returnType'] extends undefined | 'all' ? SetQueryReturnsOneKind<T, 'create'> : T['returnType'] extends 'pluck' ? SetQueryReturnsColumnKind<T, 'create'> : SetQueryKind<T, 'create'>;
4242
+ type InsertRawOrFromResult<T extends CreateSelf> = T['meta']['hasSelect'] extends true ? T['returnType'] extends undefined | 'all' ? SetQueryReturnsOneKind<T, 'create'> : T['returnType'] extends 'pluck' ? SetQueryReturnsColumnKind<T, 'create'> : SetQueryKind<T, 'create'> : SetQueryReturnsRowCount<T, 'create'>;
4243
+ type CreateManyFromResult<T extends CreateSelf> = T extends {
4244
+ isCount: true;
4245
+ } ? SetQueryKind<T, 'create'> : T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAllKind<T, 'create'> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetQueryReturnsPluckColumnKind<T, 'create'> : SetQueryKind<T, 'create'>;
4246
+ type InsertManyFromResult<T extends CreateSelf> = T['meta']['hasSelect'] extends true ? T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAllKind<T, 'create'> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetQueryReturnsPluckColumnKind<T, 'create'> : SetQueryKind<T, 'create'> : SetQueryReturnsRowCountMany<T, 'create'>;
4247
+ declare const _queryCreateOneFrom: <T extends CreateSelf, Q extends QueryReturningOne>(q: T, query: Q, data?: Omit<CreateData<T, CreateBelongsToData<T>>, keyof Q['result']>) => CreateRawOrFromResult<T>;
4248
+ declare const _queryInsertOneFrom: <T extends CreateSelf, Q extends QueryReturningOne>(q: T, query: Q, data?: Omit<CreateData<T, CreateBelongsToData<T>>, keyof Q['result']>) => InsertRawOrFromResult<T>;
4249
+ declare const _queryCreateManyFrom: <T extends CreateSelf, Q extends QueryReturningOne>(q: T, query: Q, data: Omit<CreateData<T, CreateBelongsToData<T>>, keyof Q['result']>[]) => CreateManyFromResult<T>;
4250
+ declare const _queryInsertManyFrom: <T extends CreateSelf, Q extends QueryReturningOne>(q: T, query: Q, data: Omit<CreateData<T, CreateBelongsToData<T>>, keyof Q['result']>[]) => InsertManyFromResult<T>;
4251
+ declare const _queryCreateForEachFrom: <T extends CreateSelf>(q: T, query: IsQuery) => CreateManyFromResult<T>;
4252
+ declare const _queryInsertForEachFrom: <T extends CreateSelf>(q: T, query: IsQuery) => InsertManyFromResult<T>;
4253
+ declare class QueryCreateFrom {
4254
+ /**
4255
+ * Inserts a single record based on a query that selects a single record.
4256
+ *
4257
+ * Performs a single SQL query based on `INSERT ... SELECT ... FROM`.
4258
+ *
4259
+ * See {@link createManyFrom} to insert multiple records based on a single record query,
4260
+ * and {@link createForEachFrom} to insert a record per every one found by the query.
4261
+ *
4262
+ * The first argument is a query of a **single** record, it should have `find`, `take`, or similar.
4263
+ *
4264
+ * The second optional argument is a data which will be merged with columns returned by the query.
4265
+ *
4266
+ * The data for the second argument is the same as in {@link create}.
4267
+ *
4268
+ * Columns with runtime defaults (defined with a callback) are supported here.
4269
+ * The value for such a column will be injected unless selected from a related table or provided in a data object.
4270
+ *
4271
+ * ```ts
4272
+ * const oneRecord = await db.table.createOneFrom(
4273
+ * db.relatedTable
4274
+ * // use select to map columns from one table to another
4275
+ * .select({
4276
+ * // relatedTable's id will be inserted as "relatedId"
4277
+ * relatedId: 'id',
4278
+ * })
4279
+ * .findBy({ key: 'value' }),
4280
+ * // optional argument:
4281
+ * {
4282
+ * key: 'value',
4283
+ * // supports sql, nested select, create, update, delete queries
4284
+ * fromSql: () => sql`custom sql`,
4285
+ * fromQuery: () => db.otherTable.find(id).update(data).get('column'),
4286
+ * fromRelated: (q) => q.relatedTable.create(data).get('column'),
4287
+ * },
4288
+ * );
4289
+ * ```
4290
+ *
4291
+ * The query above will produce such a SQL (omitting `from*` values):
4292
+ *
4293
+ * ```sql
4294
+ * INSERT INTO "table"("relatedId", "key")
4295
+ * SELECT "relatedTable"."id" AS "relatedId", 'value'
4296
+ * FROM "relatedTable"
4297
+ * WHERE "relatedTable"."key" = 'value'
4298
+ * LIMIT 1
4299
+ * RETURNING *
4300
+ * ```
4301
+ *
4302
+ * @param query - query to create new records from
4303
+ * @param data - additionally you can set some columns
4304
+ */
4305
+ createOneFrom<T extends CreateSelf, Q extends QueryReturningOne>(this: T, query: Q, data?: Omit<CreateData<T, CreateBelongsToData<T>>, keyof Q['result']>): CreateRawOrFromResult<T>;
4306
+ /**
4307
+ * Works exactly as {@link createOneFrom}, except that it returns inserted row count by default.
4308
+ *
4309
+ * @param query - query to create new records from
4310
+ * @param data - additionally you can set some columns
4311
+ */
4312
+ insertOneFrom<T extends CreateSelf, Q extends QueryReturningOne>(this: T, query: Q, data?: Omit<CreateData<T, CreateBelongsToData<T>>, keyof Q['result']>): InsertRawOrFromResult<T>;
4313
+ /**
4314
+ * Inserts multiple records based on a query that selects a single record.
4315
+ *
4316
+ * Performs a single SQL query based on `INSERT ... SELECT ... FROM`.
4317
+ *
4318
+ * See {@link createOneFrom} to insert a single record based on a single record query,
4319
+ * and {@link createForEachFrom} to insert a record per every one found by the query.
4320
+ *
4321
+ * The first argument is a query of a **single** record, it should have `find`, `take`, or similar.
4322
+ *
4323
+ * The second argument is array of objects to be merged with columns returned by the query.
4324
+ *
4325
+ * The data for the second argument is the same as in {@link createMany}.
4326
+ *
4327
+ * Columns with runtime defaults (defined with a callback) are supported here.
4328
+ * The value for such a column will be injected unless selected from a related table or provided in a data object.
4329
+ *
4330
+ * ```ts
4331
+ * const twoRecords = await db.table.createManyFrom(
4332
+ * db.relatedTable
4333
+ * // use select to map columns from one table to another
4334
+ * .select({
4335
+ * // relatedTable's id will be inserted as "relatedId"
4336
+ * relatedId: 'id',
4337
+ * })
4338
+ * .findBy({ key: 'value' }),
4339
+ * [
4340
+ * {
4341
+ * key: 'value 1',
4342
+ * // supports sql, nested select, create, update, delete queries
4343
+ * fromSql: () => sql`custom sql`,
4344
+ * fromQuery: () => db.otherTable.find(id).update(data).get('column'),
4345
+ * fromRelated: (q) => q.relatedTable.create(data).get('column'),
4346
+ * },
4347
+ * {
4348
+ * key: 'value 2',
4349
+ * },
4350
+ * ],
4351
+ * );
4352
+ * ```
4353
+ *
4354
+ * The query above will produce such a SQL (omitting `from*` values):
4355
+ *
4356
+ * ```sql
4357
+ * WITH "relatedTable" AS (
4358
+ * SELECT "relatedTable"."id" AS "relatedId", 'value'
4359
+ * FROM "relatedTable"
4360
+ * WHERE "relatedTable"."key" = 'value'
4361
+ * LIMIT 1
4362
+ * )
4363
+ * INSERT INTO "table"("relatedId", "key")
4364
+ * SELECT "relatedTable".*, v."key"::text
4365
+ * FROM "relatedTable", (VALUES ('value1'), ('value2')) v("key")
4366
+ * RETURNING *
4367
+ * ```
4368
+ *
4369
+ * @param query - query to create new records from
4370
+ * @param data - array of records to create
4371
+ */
4372
+ createManyFrom<T extends CreateSelf, Q extends QueryReturningOne>(this: T, query: Q, data: Omit<CreateData<T, CreateBelongsToData<T>>, keyof Q['result']>[]): CreateManyFromResult<T>;
4373
+ /**
4374
+ * Works exactly as {@link createManyFrom}, except that it returns inserted row count by default.
4375
+ *
4376
+ * @param query - query to create new records from
4377
+ * @param data - array of records to create
4378
+ */
4379
+ insertManyFrom<T extends CreateSelf, Q extends QueryReturningOne>(this: T, query: Q, data: Omit<CreateData<T, CreateBelongsToData<T>>, keyof Q['result']>[]): InsertManyFromResult<T>;
4380
+ /**
4381
+ * Inserts a single record per every record found in a given query.
4382
+ *
4383
+ * Performs a single SQL query based on `INSERT ... SELECT ... FROM`.
4384
+ *
4385
+ * Unlike {@link createOneFrom}, it doesn't accept second argument with data.
4386
+ *
4387
+ * Runtime defaults cannot work with it.
4388
+ *
4389
+ * ```ts
4390
+ * const manyRecords = await db.table.createForEachFrom(
4391
+ * RelatedTable.select({ relatedId: 'id' }).where({ key: 'value' }),
4392
+ * );
4393
+ * ```
4394
+ *
4395
+ * @param query - query to create new records from
4396
+ */
4397
+ createForEachFrom<T extends CreateSelf>(this: T, query: IsQuery): CreateManyFromResult<T>;
4398
+ /**
4399
+ * Works exactly as {@link createForEachFrom}, except that it returns inserted row count by default.
4400
+ *
4401
+ * @param query - query to create new records from
4402
+ */
4403
+ insertForEachFrom<T extends CreateSelf>(this: T, query: IsQuery): InsertManyFromResult<T>;
4404
+ }
4405
+
4226
4406
  interface CreateSelf extends IsQuery, PickQueryMetaResultRelationsWithDataReturnTypeShape, PickQueryUniqueProperties {
4227
4407
  inputType: RecordUnknown;
4228
4408
  }
@@ -4252,19 +4432,11 @@ type CreateRelationsDataOmittingFKeys<T extends CreateSelf, Union> = (Union exte
4252
4432
  type CreateResult<T extends CreateSelf, BT> = T extends {
4253
4433
  isCount: true;
4254
4434
  } ? SetQueryKind<T, 'create'> : T['returnType'] extends undefined | 'all' ? SetQueryReturnsOneKindResult<T, 'create', NarrowCreateResult<T, BT>> : T['returnType'] extends 'pluck' ? SetQueryReturnsColumnKindResult<T, 'create', NarrowCreateResult<T, BT>> : SetQueryKindResult<T, 'create', NarrowCreateResult<T, BT>>;
4255
- type CreateRawOrFromResult<T extends CreateSelf> = T extends {
4256
- isCount: true;
4257
- } ? SetQueryKind<T, 'create'> : T['returnType'] extends undefined | 'all' ? SetQueryReturnsOneKind<T, 'create'> : T['returnType'] extends 'pluck' ? SetQueryReturnsColumnKind<T, 'create'> : SetQueryKind<T, 'create'>;
4258
4435
  type InsertResult<T extends CreateSelf, BT> = T['meta']['hasSelect'] extends true ? T['returnType'] extends undefined | 'all' ? SetQueryReturnsOneKindResult<T, 'create', NarrowCreateResult<T, BT>> : T['returnType'] extends 'pluck' ? SetQueryReturnsColumnKindResult<T, 'create', NarrowCreateResult<T, BT>> : SetQueryKindResult<T, 'create', NarrowCreateResult<T, BT>> : SetQueryReturnsRowCount<T, 'create'>;
4259
- type InsertRawOrFromResult<T extends CreateSelf> = T['meta']['hasSelect'] extends true ? T['returnType'] extends undefined | 'all' ? SetQueryReturnsOneKind<T, 'create'> : T['returnType'] extends 'pluck' ? SetQueryReturnsColumnKind<T, 'create'> : SetQueryKind<T, 'create'> : SetQueryReturnsRowCount<T, 'create'>;
4260
4436
  type CreateManyResult<T extends CreateSelf, BT> = T extends {
4261
4437
  isCount: true;
4262
4438
  } ? SetQueryKindResult<T, 'create', NarrowCreateResult<T, BT>> : T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAllKindResult<T, 'create', NarrowCreateResult<T, BT>> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetQueryReturnsPluckColumnKindResult<T, 'create', NarrowCreateResult<T, BT>> : SetQueryKindResult<T, 'create', NarrowCreateResult<T, BT>>;
4263
- type CreateManyFromResult<T extends CreateSelf> = T extends {
4264
- isCount: true;
4265
- } ? SetQueryKind<T, 'create'> : T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAllKind<T, 'create'> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetQueryReturnsPluckColumnKind<T, 'create'> : SetQueryKind<T, 'create'>;
4266
4439
  type InsertManyResult<T extends CreateSelf, BT> = T['meta']['hasSelect'] extends true ? T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAllKindResult<T, 'create', NarrowCreateResult<T, BT>> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetQueryReturnsPluckColumnKindResult<T, 'create', NarrowCreateResult<T, BT>> : SetQueryKindResult<T, 'create', NarrowCreateResult<T, BT>> : SetQueryReturnsRowCountMany<T, 'create'>;
4267
- type InsertManyFromResult<T extends CreateSelf> = T['meta']['hasSelect'] extends true ? T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAllKind<T, 'create'> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetQueryReturnsPluckColumnKind<T, 'create'> : SetQueryKind<T, 'create'> : SetQueryReturnsRowCountMany<T, 'create'>;
4268
4440
  /**
4269
4441
  * When creating a record with a *belongs to* nested record,
4270
4442
  * un-nullify foreign key columns of the result.
@@ -4297,24 +4469,16 @@ interface CreateCtx {
4297
4469
  resultAll: RecordUnknown[];
4298
4470
  }
4299
4471
  declare const _queryCreate: <T extends CreateSelf, BT extends CreateBelongsToData<T>>(q: T, data: CreateData<T, BT>) => CreateResult<T, BT>;
4300
- declare const _queryInsert: <T extends CreateSelf, BT extends CreateBelongsToData<T>>(q: T, data: CreateData<T, BT>) => InsertResult<T, BT>;
4472
+ declare const _queryInsert: <T extends CreateSelf, BT extends CreateBelongsToData<T>>(query: T, data: CreateData<T, BT>) => InsertResult<T, BT>;
4301
4473
  declare const _queryCreateMany: <T extends CreateSelf, BT extends CreateBelongsToData<T>>(q: T, data: CreateData<T, BT>[]) => CreateManyResult<T, BT>;
4302
4474
  declare const _queryInsertMany: <T extends CreateSelf, BT extends CreateBelongsToData<T>>(q: T, data: CreateData<T, BT>[]) => InsertManyResult<T, BT>;
4303
- interface QueryReturningOne extends IsQuery {
4304
- result: QueryColumns;
4305
- returnType: 'one' | 'oneOrThrow';
4306
- }
4307
- declare const _queryCreateFrom: <T extends CreateSelf, Q extends QueryReturningOne>(q: T, query: Q, data?: Omit<CreateData<T, CreateBelongsToData<T>>, keyof Q['result']>) => CreateRawOrFromResult<T>;
4308
- declare const _queryInsertFrom: <T extends CreateSelf, Q extends QueryReturningOne>(q: T, query: Q, data?: Omit<CreateData<T, CreateBelongsToData<T>>, keyof Q['result']>) => InsertRawOrFromResult<T>;
4309
- declare const _queryCreateManyFrom: <T extends CreateSelf>(q: T, query: IsQuery) => CreateManyFromResult<T>;
4310
- declare const _queryInsertManyFrom: <T extends CreateSelf>(q: T, query: IsQuery) => InsertManyFromResult<T>;
4311
4475
  declare const _queryDefaults: <T extends CreateSelf, Data extends Partial<CreateData<T, CreateBelongsToData<T>>>>(q: T, data: Data) => AddQueryDefaults<T, { [K in keyof Data]: true; }>;
4312
4476
  /**
4313
4477
  * Names of all create methods,
4314
4478
  * is used in relational query to remove these methods if chained relation shouldn't have them,
4315
4479
  * for the case of has one/many through.
4316
4480
  */
4317
- type CreateMethodsNames = 'create' | 'insert' | 'createMany' | 'insertMany' | 'createFrom' | 'insertFrom' | 'createManyFrom' | 'insertManyFrom';
4481
+ type CreateMethodsNames = 'create' | 'insert' | 'createMany' | 'insertMany' | CreateFromMethodNames;
4318
4482
  declare class QueryCreate {
4319
4483
  /**
4320
4484
  * `create` and `insert` create a single record.
@@ -4420,77 +4584,6 @@ declare class QueryCreate {
4420
4584
  * @param data - array of records data, may have values, raw SQL, queries, relation operations
4421
4585
  */
4422
4586
  insertMany<T extends CreateSelf, BT extends CreateBelongsToData<T>>(this: T, data: CreateData<T, BT>[]): InsertManyResult<T, BT>;
4423
- /**
4424
- * These methods are for creating a single record, for batch creating see {@link createManyFrom}.
4425
- *
4426
- * `createFrom` is to perform the `INSERT ... SELECT ...` SQL statement, it does select and insert by performing a single query.
4427
- *
4428
- * The first argument is a query for a **single** record, it should have `find`, `take`, or similar.
4429
- *
4430
- * The second optional argument is a data which will be merged with columns returned from the select query.
4431
- *
4432
- * The data for the second argument is the same as in {@link create}.
4433
- *
4434
- * Columns with runtime defaults (defined with a callback) are supported here.
4435
- * The value for such a column will be injected unless selected from a related table or provided in a data object.
4436
- *
4437
- * ```ts
4438
- * const oneRecord = await db.table.createFrom(
4439
- * // In the select, key is a related table column, value is a column to insert as
4440
- * RelatedTable.select({ relatedId: 'id' }).findBy({ key: 'value' }),
4441
- * // optional argument:
4442
- * {
4443
- * key: 'value',
4444
- * // supports sql, nested select, create, update, delete queries
4445
- * fromSql: () => sql`custom sql`,
4446
- * fromQuery: () => db.otherTable.find(id).update(data).get('column'),
4447
- * fromRelated: (q) => q.relatedTable.create(data).get('column'),
4448
- * },
4449
- * );
4450
- * ```
4451
- *
4452
- * The query above will produce such SQL:
4453
- *
4454
- * ```sql
4455
- * INSERT INTO "table"("relatedId", "key")
4456
- * SELECT "relatedTable"."id" AS "relatedId", 'value'
4457
- * FROM "relatedTable"
4458
- * WHERE "relatedTable"."key" = 'value'
4459
- * LIMIT 1
4460
- * RETURNING *
4461
- * ```
4462
- *
4463
- * @param query - query to create new records from
4464
- * @param data - additionally you can set some columns
4465
- */
4466
- createFrom<T extends CreateSelf, Q extends QueryReturningOne>(this: T, query: Q, data?: Omit<CreateData<T, CreateBelongsToData<T>>, keyof Q['result']>): CreateRawOrFromResult<T>;
4467
- /**
4468
- * Works exactly as {@link createFrom}, except that it returns inserted row count by default.
4469
- *
4470
- * @param query - query to create new records from
4471
- * @param data - additionally you can set some columns
4472
- */
4473
- insertFrom<T extends CreateSelf, Q extends QueryReturningOne>(this: T, query: Q, data?: Omit<CreateData<T, CreateBelongsToData<T>>, keyof Q['result']>): InsertRawOrFromResult<T>;
4474
- /**
4475
- * Similar to `createFrom`, but intended to create many records.
4476
- *
4477
- * Unlike `createFrom`, it doesn't accept second argument with data, and runtime defaults cannot work with it.
4478
- *
4479
- * ```ts
4480
- * const manyRecords = await db.table.createManyFrom(
4481
- * RelatedTable.select({ relatedId: 'id' }).where({ key: 'value' }),
4482
- * );
4483
- * ```
4484
- *
4485
- * @param query - query to create new records from
4486
- */
4487
- createManyFrom<T extends CreateSelf>(this: T, query: IsQuery): CreateManyFromResult<T>;
4488
- /**
4489
- * Works exactly as {@link createManyFrom}, except that it returns inserted row count by default.
4490
- *
4491
- * @param query - query to create new records from
4492
- */
4493
- insertManyFrom<T extends CreateSelf>(this: T, query: IsQuery): InsertManyFromResult<T>;
4494
4587
  /**
4495
4588
  * `defaults` allows setting values that will be used later in `create`.
4496
4589
  *
@@ -5774,6 +5867,7 @@ type WithSqlResult<T extends PickQueryWithDataColumnTypes, Name extends string,
5774
5867
  } : K extends keyof T['withData'] ? T['withData'][K] : never;
5775
5868
  } : T[K];
5776
5869
  };
5870
+ declare const _addWith: (query: IsQuery, withStore: object, item: WithItem, key?: string | number) => void;
5777
5871
  declare const moveQueryValueToWith: (q: Query, withStore: object, value: Query, withKey: string | number, set?: RecordUnknown, key?: string) => string | undefined;
5778
5872
  declare class WithMethods {
5779
5873
  /**
@@ -7187,7 +7281,7 @@ interface SubQueryReturningSingle extends QueryMetaIsSubQuery {
7187
7281
  returnType: 'one' | 'oneOrThrow';
7188
7282
  }
7189
7283
  type WrapQueryArg = FromQuerySelf;
7190
- interface QueryMethods<ColumnTypes> extends QueryAsMethods, AggregateMethods, Select, FromMethods, Join, WithMethods, Union, JsonMethods, QueryCreate, Update, Delete, Transaction, For, Where, SearchMethods, Clear, Having, QueryLog, QueryHooks, QueryUpsert, QueryOrCreate, QueryGet, MergeQueryMethods, SqlMethod<ColumnTypes>, TransformMethods, QueryMap, ScopeMethods, SoftDeleteMethods, ExpressionMethods {
7284
+ interface QueryMethods<ColumnTypes> extends QueryAsMethods, AggregateMethods, Select, FromMethods, Join, WithMethods, Union, JsonMethods, QueryCreate, QueryCreateFrom, Update, Delete, Transaction, For, Where, SearchMethods, Clear, Having, QueryLog, QueryHooks, QueryUpsert, QueryOrCreate, QueryGet, MergeQueryMethods, SqlMethod<ColumnTypes>, TransformMethods, QueryMap, ScopeMethods, SoftDeleteMethods, ExpressionMethods {
7191
7285
  }
7192
7286
  declare class QueryMethods<ColumnTypes> {
7193
7287
  /**
@@ -8184,9 +8278,7 @@ declare abstract class ColumnType<Schema extends ColumnTypeSchemaArg = ColumnTyp
8184
8278
  * // options are described below:
8185
8279
  * name: t.text().index({ ...options }),
8186
8280
  * // with a database-level name:
8187
- * name: t.text().index('custom_index_name'),
8188
- * // with name and options:
8189
- * name: t.text().index('custom_index_name', { ...options }),
8281
+ * name: t.text().index({ name: 'custom_index_name', ...indexOptions }),
8190
8282
  * }));
8191
8283
  * });
8192
8284
  * ```
@@ -8195,6 +8287,7 @@ declare abstract class ColumnType<Schema extends ColumnTypeSchemaArg = ColumnTyp
8195
8287
  *
8196
8288
  * ```ts
8197
8289
  * type IndexOptions = {
8290
+ * name?: string,
8198
8291
  * // NULLS NOT DISTINCT: availabe in Postgres 15+, makes sense only for unique index
8199
8292
  * nullsNotDistinct?: true;
8200
8293
  * // index algorithm to use such as GIST, GIN
@@ -8220,7 +8313,7 @@ declare abstract class ColumnType<Schema extends ColumnTypeSchemaArg = ColumnTyp
8220
8313
  *
8221
8314
  * @param args
8222
8315
  */
8223
- index<T extends PickColumnData>(this: T, ...args: [options?: TableData.Index.ColumnArg] | [name: string, options?: TableData.Index.ColumnArg]): T;
8316
+ index<T extends PickColumnData>(this: T, ...args: [options?: TableData.Index.ColumnArg]): T;
8224
8317
  /**
8225
8318
  * `searchIndex` is designed for [full text search](/guide/text-search).
8226
8319
  *
@@ -8326,8 +8419,8 @@ declare abstract class ColumnType<Schema extends ColumnTypeSchemaArg = ColumnTyp
8326
8419
  searchIndex<T extends {
8327
8420
  data: ColumnType['data'];
8328
8421
  dataType: string;
8329
- }>(this: T, ...args: [options?: TableData.Index.TsVectorColumnArg] | [name: string, options?: TableData.Index.TsVectorColumnArg]): T;
8330
- unique<T extends PickColumnData, Name extends string>(this: T, ...args: [options?: TableData.Index.UniqueColumnArg] | [name: Name, options?: TableData.Index.UniqueColumnArg]): UniqueColumn<T, Name>;
8422
+ }>(this: T, ...args: [options?: TableData.Index.TsVectorColumnArg]): T;
8423
+ unique<T extends PickColumnData, const Options extends TableData.Index.ColumnArg>(this: T, ...args: [options?: Options]): UniqueColumn<T, Options['name'] & string>;
8331
8424
  /**
8332
8425
  * Add [EXCLUDE constraint](https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-EXCLUDE) to the column.
8333
8426
  *
@@ -8373,7 +8466,7 @@ declare abstract class ColumnType<Schema extends ColumnTypeSchemaArg = ColumnTyp
8373
8466
  * }
8374
8467
  * ```
8375
8468
  */
8376
- exclude<T extends PickColumnData>(this: T, ...args: [op: string, options?: TableData.Exclude.ColumnArg] | [op: string, name: string, options?: TableData.Exclude.ColumnArg]): T;
8469
+ exclude<T extends PickColumnData>(this: T, op: string, ...args: [options?: TableData.Exclude.ColumnArg]): T;
8377
8470
  comment<T extends PickColumnData>(this: T, comment: string): T;
8378
8471
  compression<T extends PickColumnData>(this: T, compression: string): T;
8379
8472
  collate<T extends PickColumnData>(this: T, collate: string): T;
@@ -8769,4 +8862,4 @@ type CopyResult<T extends PickQueryMeta> = SetQueryKind<T, 'copy'>;
8769
8862
  */
8770
8863
  declare function copyTableData<T extends PickQueryMetaShape>(query: T, arg: CopyArg<T>): CopyResult<T>;
8771
8864
 
8772
- export { type AddQueryDefaults, AfterCommitError, type AfterCommitErrorFulfilledResult, type AfterCommitErrorHandler, type AfterCommitErrorRejectedResult, type AfterCommitErrorResult, type AfterHook, type AggregateArgTypes, AggregateMethods, type AggregateOptions, ArrayColumn, type ArrayColumnValue, type ArrayData, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, type BooleanQueryColumn, BoxColumn, ByteaColumn, type ChangeCountArg, CidrColumn, CircleColumn, CitextColumn, Clear, type ClearStatement, type ColumnData, type ColumnDataGenerated, type ColumnFromDbParams, ColumnRefExpression, ColumnType, type ColumnsByType, type ColumnsShape, type ColumnsShapeToNullableObject, type ColumnsShapeToObject, type ColumnsShapeToObjectArray, type ColumnsShapeToPluck, ComputedColumn, type ComputedColumns, type ComputedColumnsFromOptions, type ComputedMethods, type ComputedOptionsConfig, type ComputedOptionsFactory, type CopyOptions, type CreateBelongsToData, type CreateColumn, type CreateCtx, type CreateData, type CreateMethodsNames, type CreateRelationsData, type CreateRelationsDataOmittingFKeys, type CreateResult, type CreateSelf, CustomTypeColumn, DateBaseColumn, DateColumn, type DateColumnInput, DateTimeBaseClass, DateTimeTzBaseClass, Db, type DbDomainArg, type DbDomainArgRecord, type DbExtension, type DbOptions, type DbOptionsWithAdapter, type DbResult, type DbSharedOptions, type DbSqlQuery, type DbStructureDomainsMap, type DbTableConstructor, type DbTableOptionScopes, type DbTableOptions, DecimalColumn, type DecimalColumnData, type DefaultColumnTypes, type DefaultSchemaConfig, Delete, type DeleteArgs, type DeleteMethodsNames, type DeleteResult, DomainColumn, DoublePrecisionColumn, DynamicRawSQL, EnumColumn, ExpressionMethods, type ExpressionOutput, FnExpression, type FnExpressionArgs, type FnExpressionArgsPairs, type FnExpressionArgsValue, For, type FromArg, FromMethods, type FromQuerySelf, type FromResult, type GeneratedColumn, type GeneratorIgnore, type GetArg, type GetColumnInfo, type GetResult, type GetResultOptional, type GetStringArg, type GroupArgs, type HandleResult, Having, type HavingItem, type HookAction, type HookSelectArg, type IdentityColumn, InetColumn, type InsertQueryDataFromValues, type InsertQueryDataObjectValues, IntegerBaseColumn, IntegerColumn, IntervalColumn, type IsolationLevel, JSONColumn, JSONTextColumn, Join, type JoinArgToQuery, type JoinArgs, type JoinCallback, type JoinFirstArg, type JoinItem, type JoinItemArgs, type JoinLateralResult, type JoinQueryBuilder, type JoinQueryMethod, type JoinResult, type JoinResultRequireMain, type JoinedParsers, type JoinedShapes, JsonMethods, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MergeQuery, MergeQueryMethods, MoneyColumn, type NoPrimaryKeyOption, type NonUniqDataItem, NumberAsStringBaseColumn, NumberBaseColumn, type NumberColumnData, type NumericColumns, type OnConflictMerge, OnConflictQueryBuilder, type OnConflictSet$1 as OnConflictSet, type OnConflictTarget, OnMethods, type Operator, Operators, type OperatorsAny, type OperatorsArray, type OperatorsBoolean, type OperatorsDate, type OperatorsJson, type OperatorsNumber, type OperatorsText, type OperatorsTime, OrExpression, type OrderArg, type OrderArgSelf, type OrderArgs, type OrderItem, type OrderTsQueryConfig, type Over, PathColumn, type PickColumnData, type PickQueryBaseQuery, type PickQueryDataShapeAndJoinedShapes, type PickQueryDataShapeAndJoinedShapesAndAliases, type PickQueryInternal, type PickQueryQ, type PickQueryQAndBaseQuery, type PickQueryQAndInternal, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type PostgisPoint, type Query, type QueryAfterHook, QueryAsMethods, type QueryBatchResult, type QueryBeforeHook, type QueryBeforeHookInternal, type QueryBuilder, type QueryComputedArg, QueryCreate, type QueryData, type QueryDataFromItem, type QueryDataJoinTo, type QueryDefaultReturnData, QueryGet, type QueryGetSelf, type QueryHelperResult, QueryHooks, type QueryIfResultThen, type QueryInternal, QueryLog, type QueryMetaHasSelect, type QueryMetaHasWhere, QueryMethods, type QueryOrExpressionBooleanOrNullResult, type QueryScopeData, type QueryScopes, type QuerySourceItem, type QueryTake, type QueryTakeOptional, QueryUpsert, RawSQL, RealColumn, type RecordOfColumnsShapeBase, RefExpression, type ReturnsQueryOrExpression, type RuntimeComputedQueryColumn, type SearchArg, SearchMethods, type SearchWeight, type SearchWeightRecord, Select, type SelectArg, type SelectArgs, type SelectAs, type SelectAsValue, type SelectItem, type SelectSubQueryResult, type SelectableFromShape, type SelectableOfType, type SelectableOrExpression, type SelectableOrExpressionOfType, type SelectableOrExpressions, SerialColumn, type SerialColumnData, type SetQueryKind, type SetQueryKindResult, type SetQueryReturnsAll, type SetQueryReturnsAllKind, type SetQueryReturnsAllKindResult, type SetQueryReturnsColumnInfo, type SetQueryReturnsColumnKind, type SetQueryReturnsColumnKindResult, type SetQueryReturnsColumnOptional, type SetQueryReturnsColumnOrThrow, type SetQueryReturnsOneKind, type SetQueryReturnsOneKindResult, type SetQueryReturnsPluck, type SetQueryReturnsPluckColumn, type SetQueryReturnsPluckColumnKind, type SetQueryReturnsPluckColumnKindResult, type SetQueryReturnsRowCount, type SetQueryReturnsRowCountMany, type SetQueryReturnsRows, type SetQueryReturnsValueOptional, type SetQueryReturnsValueOrThrow, type SetQueryReturnsValueOrThrowKind, type SetQueryReturnsVoid, type SetQueryReturnsVoidKind, type ShapeColumnPrimaryKeys, type ShapeUniqueColumns, type SimpleJoinItemNonSubQueryArgs, SmallIntColumn, SmallSerialColumn, type SortDir, type SqlFn, SqlMethod, StringColumn$1 as StringColumn, TableData, type TableDataFn, type TableDataInput, type TableDataItem, type TableDataItemsUniqueColumnTuples, type TableDataItemsUniqueColumns, type TableDataItemsUniqueConstraints, type TableDataMethods, TextBaseColumn, TextColumn, type TextColumnData, Then, TimeColumn, TimestampColumn, TimestampTZColumn, type ToSQLCtx, type ToSQLOptions, type ToSQLQuery, Transaction, type TransactionOptions, TransformMethods, TsQueryColumn, TsVectorColumn, UUIDColumn, Union, type UnionArgs, type UnionItem, type UnionKind, type UnionSet, type UniqueConstraints, type UniqueQueryTypeOrExpression, type UniqueTableDataItem, UnknownColumn, Update, type UpdateArg, type UpdateCtx, type UpdateCtxCollect, type UpdateData, type UpdateQueryDataItem, type UpdateQueryDataObject, type UpdateSelf, type UpdatedAtDataInjector, type UpsertResult, type UpsertThis, VarCharColumn, VirtualColumn, Where, type WhereArg, type WhereArgs, type WhereInArg, type WhereInColumn, type WhereInItem, type WhereInValues, type WhereItem, type WhereJsonPathEqualsItem, type WhereNotArgs, type WhereOnItem, type WhereOnJoinItem, type WhereQueryBuilder, type WhereResult, type WhereSearchItem, type WhereSearchResult, type WindowArg, type WindowArgDeclaration, type WindowDeclaration, type WindowItem, type WithArgsOptions, type WithConfigs, type WithItem, type WithItems, WithMethods, type WithOptions, type WithQueryBuilder, type WithRecursiveOptions, type WithResult, type WithSqlResult, type WrapQueryArg, XMLColumn, _clone, _getSelectableColumn, _initQueryBuilder, _queryAfterSaveCommit, _queryAll, _queryChangeCounter, _queryCreate, _queryCreateFrom, _queryCreateMany, _queryCreateManyFrom, _queryDefaults, _queryDelete, _queryExec, _queryFindBy, _queryFindByOptional, _queryGet, _queryGetOptional, _queryHookAfterCreate, _queryHookAfterCreateCommit, _queryHookAfterDelete, _queryHookAfterDeleteCommit, _queryHookAfterQuery, _queryHookAfterSave, _queryHookAfterUpdate, _queryHookAfterUpdateCommit, _queryHookBeforeCreate, _queryHookBeforeDelete, _queryHookBeforeQuery, _queryHookBeforeSave, _queryHookBeforeUpdate, _queryInsert, _queryInsertFrom, _queryInsertMany, _queryInsertManyFrom, _queryJoinOn, _queryJoinOnJsonPathEquals, _queryJoinOrOn, _queryOr, _queryOrNot, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUnion, _queryUpdate, _queryUpdateOrThrow, _queryWhere, _queryWhereExists, _queryWhereIn, _queryWhereNot, _queryWhereNotOneOf, _queryWhereNotSql, _queryWhereOneOf, _queryWhereSql, _runAfterCommitHooks, addColumnParserToQuery, addParserForRawExpression, addParserForSelectItem, addQueryOn, anyShape, applyComputedColumns, assignDbDataToColumn, checkIfASimpleQuery, cloneQueryBaseUnscoped, columnCheckToCode, columnCode, columnExcludesToCode, columnForeignKeysToCode, columnIndexesToCode, columnsShapeToCode, commitSql, constraintInnerToCode, constraintToCode, copyTableData, countSelect, createDbWithAdapter, defaultSchemaConfig, escapeForLog, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, extendQuery, filterResult, foreignKeyArgumentToCode, getClonedQueryData, getColumnBaseType, getColumnInfo, getColumnTypes, getFullColumnTable, getQueryAs, getShapeFromSelect, getSqlText, handleResult, identityToCode, indexInnerToCode, indexToCode, isDefaultTimeStamp, isInUserTransaction, isQueryReturnsAll, isSelectingCount, joinSubQuery, logParamToLogObject, makeColumnTypes, makeColumnsByType, makeFnExpression, moveQueryValueToWith, parseRecord, parseTableData, parseTableDataInput, performQuery, postgisTypmodToSql, primaryKeyInnerToCode, processComputedBatches, processComputedResult, processSelectArg, pushLimitSQL, pushQueryArrayImmutable, pushQueryOn, pushQueryOnForOuter, pushQueryOrOn, pushTableDataCode, queryFrom, queryFromSql, queryJson, queryMethodByReturnType, queryTypeWithLimitOne, queryWrap, raw, referencesArgsToCode, resolveSubQueryCallbackV2, rollbackSql, saveAliasedShape, setColumnDefaultParse, setColumnEncode, setColumnParse, setColumnParseNull, setParserForSelectedString, setQueryObjectValueImmutable, setQueryOperators, simplifyColumnDefault, sqlFn, sqlQueryArgsToExpression, tableDataMethods, templateLiteralToSQL, testTransaction, throwIfJoinLateral, throwIfNoWhere, toSQL };
8865
+ export { type AddQueryDefaults, AfterCommitError, type AfterCommitErrorFulfilledResult, type AfterCommitErrorHandler, type AfterCommitErrorRejectedResult, type AfterCommitErrorResult, type AfterHook, type AggregateArgTypes, AggregateMethods, type AggregateOptions, ArrayColumn, type ArrayColumnValue, type ArrayData, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, type BooleanQueryColumn, BoxColumn, ByteaColumn, type ChangeCountArg, CidrColumn, CircleColumn, CitextColumn, Clear, type ClearStatement, type ColumnData, type ColumnDataGenerated, type ColumnFromDbParams, ColumnRefExpression, ColumnType, type ColumnsByType, type ColumnsShape, type ColumnsShapeToNullableObject, type ColumnsShapeToObject, type ColumnsShapeToObjectArray, type ColumnsShapeToPluck, ComputedColumn, type ComputedColumns, type ComputedColumnsFromOptions, type ComputedMethods, type ComputedOptionsConfig, type ComputedOptionsFactory, type CopyOptions, type CreateBelongsToData, type CreateCtx, type CreateData, type CreateMethodsNames, type CreateSelf, CustomTypeColumn, DateBaseColumn, DateColumn, type DateColumnInput, DateTimeBaseClass, DateTimeTzBaseClass, Db, type DbDomainArg, type DbDomainArgRecord, type DbExtension, type DbOptions, type DbOptionsWithAdapter, type DbResult, type DbSharedOptions, type DbSqlQuery, type DbStructureDomainsMap, type DbTableConstructor, type DbTableOptionScopes, type DbTableOptions, DecimalColumn, type DecimalColumnData, type DefaultColumnTypes, type DefaultSchemaConfig, Delete, type DeleteArgs, type DeleteMethodsNames, type DeleteResult, DomainColumn, DoublePrecisionColumn, DynamicRawSQL, EnumColumn, ExpressionMethods, type ExpressionOutput, FnExpression, type FnExpressionArgs, type FnExpressionArgsPairs, type FnExpressionArgsValue, For, type FromArg, FromMethods, type FromQuerySelf, type FromResult, type GeneratedColumn, type GeneratorIgnore, type GetArg, type GetColumnInfo, type GetResult, type GetResultOptional, type GetStringArg, type GroupArgs, type HandleResult, Having, type HavingItem, type HookAction, type HookSelectArg, type IdentityColumn, InetColumn, type InsertQueryDataObjectValues, IntegerBaseColumn, IntegerColumn, IntervalColumn, type IsolationLevel, JSONColumn, JSONTextColumn, Join, type JoinArgToQuery, type JoinArgs, type JoinCallback, type JoinFirstArg, type JoinItem, type JoinItemArgs, type JoinLateralResult, type JoinQueryBuilder, type JoinQueryMethod, type JoinResult, type JoinResultRequireMain, type JoinedParsers, type JoinedShapes, JsonMethods, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MergeQuery, MergeQueryMethods, MoneyColumn, type NoPrimaryKeyOption, type NonUniqDataItem, NumberAsStringBaseColumn, NumberBaseColumn, type NumberColumnData, type NumericColumns, type OnConflictMerge, type OnConflictSet$1 as OnConflictSet, type OnConflictTarget, OnMethods, type Operator, Operators, type OperatorsAny, type OperatorsArray, type OperatorsBoolean, type OperatorsDate, type OperatorsJson, type OperatorsNumber, type OperatorsText, type OperatorsTime, OrExpression, type OrderArg, type OrderArgSelf, type OrderArgs, type OrderItem, type OrderTsQueryConfig, type Over, PathColumn, type PickColumnData, type PickQueryBaseQuery, type PickQueryDataShapeAndJoinedShapes, type PickQueryDataShapeAndJoinedShapesAndAliases, type PickQueryInternal, type PickQueryQ, type PickQueryQAndBaseQuery, type PickQueryQAndInternal, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type PostgisPoint, type Query, type QueryAfterHook, QueryAsMethods, type QueryBatchResult, type QueryBeforeHook, type QueryBeforeHookInternal, type QueryBuilder, type QueryComputedArg, type QueryData, type QueryDataFromItem, type QueryDataJoinTo, type QueryDefaultReturnData, QueryGet, type QueryGetSelf, type QueryHelperResult, QueryHooks, type QueryIfResultThen, type QueryInternal, QueryLog, type QueryMetaHasSelect, type QueryMetaHasWhere, QueryMethods, type QueryOrExpressionBooleanOrNullResult, type QueryScopeData, type QueryScopes, type QuerySourceItem, type QueryTake, type QueryTakeOptional, QueryUpsert, RawSQL, RealColumn, type RecordOfColumnsShapeBase, RefExpression, type ReturnsQueryOrExpression, type RuntimeComputedQueryColumn, type SearchArg, SearchMethods, type SearchWeight, type SearchWeightRecord, Select, type SelectArg, type SelectArgs, type SelectAs, type SelectAsValue, type SelectItem, type SelectSubQueryResult, type SelectableFromShape, type SelectableOfType, type SelectableOrExpression, type SelectableOrExpressionOfType, type SelectableOrExpressions, SerialColumn, type SerialColumnData, type SetQueryKind, type SetQueryKindResult, type SetQueryReturnsAll, type SetQueryReturnsAllKind, type SetQueryReturnsAllKindResult, type SetQueryReturnsColumnInfo, type SetQueryReturnsColumnKind, type SetQueryReturnsColumnKindResult, type SetQueryReturnsColumnOptional, type SetQueryReturnsColumnOrThrow, type SetQueryReturnsOneKind, type SetQueryReturnsOneKindResult, type SetQueryReturnsPluck, type SetQueryReturnsPluckColumn, type SetQueryReturnsPluckColumnKind, type SetQueryReturnsPluckColumnKindResult, type SetQueryReturnsRowCount, type SetQueryReturnsRowCountMany, type SetQueryReturnsRows, type SetQueryReturnsValueOptional, type SetQueryReturnsValueOrThrow, type SetQueryReturnsValueOrThrowKind, type SetQueryReturnsVoid, type SetQueryReturnsVoidKind, type ShapeColumnPrimaryKeys, type ShapeUniqueColumns, type SimpleJoinItemNonSubQueryArgs, SmallIntColumn, SmallSerialColumn, type SortDir, type SqlFn, SqlMethod, StringColumn$1 as StringColumn, TableData, type TableDataFn, type TableDataInput, type TableDataItem, type TableDataItemsUniqueColumnTuples, type TableDataItemsUniqueColumns, type TableDataItemsUniqueConstraints, type TableDataMethods, TextBaseColumn, TextColumn, type TextColumnData, Then, TimeColumn, TimestampColumn, TimestampTZColumn, type ToSQLCtx, type ToSQLOptions, type ToSQLQuery, Transaction, type TransactionOptions, TransformMethods, TsQueryColumn, TsVectorColumn, UUIDColumn, Union, type UnionArgs, type UnionItem, type UnionKind, type UnionSet, type UniqueConstraints, type UniqueQueryTypeOrExpression, type UniqueTableDataItem, UnknownColumn, Update, type UpdateArg, type UpdateCtx, type UpdateCtxCollect, type UpdateData, type UpdateQueryDataItem, type UpdateQueryDataObject, type UpdateSelf, type UpdatedAtDataInjector, type UpsertResult, type UpsertThis, VarCharColumn, VirtualColumn, Where, type WhereArg, type WhereArgs, type WhereInArg, type WhereInColumn, type WhereInItem, type WhereInValues, type WhereItem, type WhereJsonPathEqualsItem, type WhereNotArgs, type WhereOnItem, type WhereOnJoinItem, type WhereQueryBuilder, type WhereResult, type WhereSearchItem, type WhereSearchResult, type WindowArg, type WindowArgDeclaration, type WindowDeclaration, type WindowItem, type WithArgsOptions, type WithConfigs, type WithItem, type WithItems, WithMethods, type WithOptions, type WithQueryBuilder, type WithRecursiveOptions, type WithResult, type WithSqlResult, type WrapQueryArg, XMLColumn, _addWith, _clone, _getSelectableColumn, _initQueryBuilder, _queryAfterSaveCommit, _queryAll, _queryChangeCounter, _queryCreate, _queryCreateForEachFrom, _queryCreateMany, _queryCreateManyFrom, _queryCreateOneFrom, _queryDefaults, _queryDelete, _queryExec, _queryFindBy, _queryFindByOptional, _queryGet, _queryGetOptional, _queryHookAfterCreate, _queryHookAfterCreateCommit, _queryHookAfterDelete, _queryHookAfterDeleteCommit, _queryHookAfterQuery, _queryHookAfterSave, _queryHookAfterUpdate, _queryHookAfterUpdateCommit, _queryHookBeforeCreate, _queryHookBeforeDelete, _queryHookBeforeQuery, _queryHookBeforeSave, _queryHookBeforeUpdate, _queryInsert, _queryInsertForEachFrom, _queryInsertMany, _queryInsertManyFrom, _queryInsertOneFrom, _queryJoinOn, _queryJoinOnJsonPathEquals, _queryJoinOrOn, _queryOr, _queryOrNot, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUnion, _queryUpdate, _queryUpdateOrThrow, _queryWhere, _queryWhereExists, _queryWhereIn, _queryWhereNot, _queryWhereNotOneOf, _queryWhereNotSql, _queryWhereOneOf, _queryWhereSql, _runAfterCommitHooks, addColumnParserToQuery, addParserForRawExpression, addParserForSelectItem, addQueryOn, anyShape, applyComputedColumns, assignDbDataToColumn, checkIfASimpleQuery, cloneQueryBaseUnscoped, columnCheckToCode, columnCode, columnExcludesToCode, columnForeignKeysToCode, columnIndexesToCode, columnsShapeToCode, commitSql, constraintInnerToCode, constraintToCode, copyTableData, countSelect, createDbWithAdapter, defaultSchemaConfig, escapeForLog, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, extendQuery, filterResult, foreignKeyArgumentToCode, getClonedQueryData, getColumnBaseType, getColumnInfo, getColumnTypes, getFullColumnTable, getQueryAs, getShapeFromSelect, getSqlText, handleResult, identityToCode, indexInnerToCode, indexToCode, isDefaultTimeStamp, isInUserTransaction, isQueryReturnsAll, isSelectingCount, joinSubQuery, logParamToLogObject, makeColumnTypes, makeColumnsByType, makeFnExpression, moveQueryValueToWith, parseRecord, parseTableData, parseTableDataInput, performQuery, postgisTypmodToSql, primaryKeyInnerToCode, processComputedBatches, processComputedResult, processSelectArg, pushLimitSQL, pushQueryArrayImmutable, pushQueryOn, pushQueryOnForOuter, pushQueryOrOn, pushTableDataCode, queryFrom, queryFromSql, queryJson, queryMethodByReturnType, queryTypeWithLimitOne, queryWrap, raw, referencesArgsToCode, resolveSubQueryCallbackV2, rollbackSql, saveAliasedShape, setColumnDefaultParse, setColumnEncode, setColumnParse, setColumnParseNull, setParserForSelectedString, setQueryObjectValueImmutable, setQueryOperators, simplifyColumnDefault, sqlFn, sqlQueryArgsToExpression, tableDataMethods, templateLiteralToSQL, testTransaction, throwIfJoinLateral, throwIfNoWhere, toSQL };