pqb 0.70.0 → 0.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -668,7 +668,7 @@ interface ColumnSchemaGetterTableClass$1 {
668
668
  }
669
669
  interface ColumnTypeSchemaArg$1 {
670
670
  __schemaType: unknown;
671
- nullable<T extends Column$1.Pick.ForNullable>(this: T): Column$1.Modifiers.Nullable<T, unknown, unknown, unknown>;
671
+ nullable: unknown;
672
672
  encode: unknown;
673
673
  parse: unknown;
674
674
  parseNull: unknown;
@@ -943,7 +943,7 @@ interface NumberColumnData$1 extends BaseNumberData$1, Column$1.Data {
943
943
  identity?: TableData$1.Identity;
944
944
  }
945
945
  interface SerialColumnData$1 extends NumberColumnData$1 {
946
- default: Expression$1;
946
+ default: true;
947
947
  }
948
948
  declare abstract class NumberBaseColumn<Schema extends ColumnSchemaConfig$1, SchemaType extends Schema['__schemaType']> extends Column$1 {
949
949
  __schema: Schema;
@@ -988,27 +988,26 @@ declare class DecimalColumn$1<Schema extends ColumnSchemaConfig$1> extends Numbe
988
988
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
989
989
  toSQL(): string;
990
990
  }
991
- type IdentityColumn<T extends Column$1.Pick.Data> = Column$1.Modifiers.Default<T, Expression$1>;
992
991
  declare class SmallIntColumn$1<Schema extends ColumnSchemaConfig$1> extends IntegerBaseColumn<Schema> {
993
992
  dataType: "int2";
994
993
  querySchema: ReturnType<Schema['int']>;
995
994
  constructor(schema: Schema);
996
995
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
997
- identity<T extends Column$1.Pick.Data>(this: T, options?: TableData$1.Identity): IdentityColumn<T>;
996
+ identity<T extends Column$1.Pick.Data>(this: T, options?: TableData$1.Identity): Column$1.Modifiers.HasDefault<T>;
998
997
  }
999
998
  declare class IntegerColumn$1<Schema extends ColumnSchemaConfig$1> extends IntegerBaseColumn<Schema> {
1000
999
  dataType: "int4";
1001
1000
  querySchema: ReturnType<Schema['int']>;
1002
1001
  constructor(schema: Schema);
1003
1002
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1004
- identity<T extends Column$1.Pick.Data>(this: T, options?: TableData$1.Identity): IdentityColumn<T>;
1003
+ identity<T extends Column$1.Pick.Data>(this: T, options?: TableData$1.Identity): Column$1.Modifiers.HasDefault<T>;
1005
1004
  }
1006
1005
  declare class BigIntColumn$1<Schema extends ColumnSchemaConfig$1> extends NumberAsStringBaseColumn<Schema, string | number | bigint> {
1007
1006
  dataType: "int8";
1008
1007
  querySchema: ReturnType<Schema['stringSchema']>;
1009
1008
  constructor(schema: Schema);
1010
1009
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1011
- identity<T extends Column$1.Pick.Data>(this: T, options?: TableData$1.Identity): IdentityColumn<T>;
1010
+ identity<T extends Column$1.Pick.Data>(this: T, options?: TableData$1.Identity): Column$1.Modifiers.HasDefault<T>;
1012
1011
  }
1013
1012
  declare class RealColumn$1<Schema extends ColumnSchemaConfig$1> extends NumberBaseColumn<Schema, ReturnType<Schema['number']>> {
1014
1013
  dataType: "float4";
@@ -1203,6 +1202,7 @@ declare class JSONTextColumn$1<T, Schema extends ColumnTypeSchemaArg$1, InputSch
1203
1202
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1204
1203
  }
1205
1204
  interface DefaultSchemaConfig$1 extends ColumnSchemaConfig$1<Column$1> {
1205
+ nullable<T extends Column$1.Pick.ForNullable>(this: T): Column$1.Modifiers.Nullable<T>;
1206
1206
  parse<T extends Column$1.Pick.ForParse, Output>(this: T, fn: (input: T['__type']) => Output): Column$1.Modifiers.Parse<T, unknown, Output>;
1207
1207
  parseNull<T extends Column$1.Pick.ForParseNull, Output>(this: T, fn: () => Output): Column$1.Modifiers.ParseNull<T, unknown, Output>;
1208
1208
  encode<T extends Column$1.Pick.Type, Input>(this: T, fn: (input: Input) => unknown): Column$1.Modifiers.Encode<T, unknown, Input>;
@@ -1599,7 +1599,7 @@ declare class UUIDColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
1599
1599
  T & {
1600
1600
  data: {
1601
1601
  primaryKey: Name;
1602
- default: RawSqlBase$1;
1602
+ default: true;
1603
1603
  };
1604
1604
  };
1605
1605
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
@@ -1651,8 +1651,8 @@ declare class BooleanColumn$1<Schema extends ColumnSchemaConfig$1> extends Colum
1651
1651
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1652
1652
  }
1653
1653
  interface Timestamps$1<T extends Column$1.Pick.Data> {
1654
- createdAt: Column$1.Modifiers.Default<T, RawSqlBase$1>;
1655
- updatedAt: Column$1.Modifiers.Default<T, RawSqlBase$1>;
1654
+ createdAt: Column$1.Modifiers.HasDefault<T>;
1655
+ updatedAt: Column$1.Modifiers.HasDefault<T>;
1656
1656
  }
1657
1657
  interface TimestampHelpers {
1658
1658
  /**
@@ -1734,7 +1734,7 @@ interface DefaultColumnTypes$1<SchemaConfig extends ColumnSchemaConfig$1> extend
1734
1734
  decimal: SchemaConfig['decimal'];
1735
1735
  real: SchemaConfig['real'];
1736
1736
  doublePrecision: SchemaConfig['doublePrecision'];
1737
- identity(options?: TableData$1.Identity): IdentityColumn<ReturnType<SchemaConfig['integer']>>;
1737
+ identity(options?: TableData$1.Identity): Column$1.Modifiers.HasDefault<ReturnType<SchemaConfig['integer']>>;
1738
1738
  smallSerial: SchemaConfig['smallSerial'];
1739
1739
  serial: SchemaConfig['serial'];
1740
1740
  bigSerial: SchemaConfig['bigSerial'];
@@ -7247,7 +7247,8 @@ declare namespace Column$1 {
7247
7247
  unique: Name;
7248
7248
  };
7249
7249
  };
7250
- export type Nullable<T extends Column.Pick.ForNullable, InputSchema, OutputSchema, QuerySchema> = { [K in keyof T]: K extends '__type' ? T['__type'] | null : K extends '__inputType' ? T['__inputType'] | null : K extends 'inputSchema' ? InputSchema : K extends '__outputType' ? T['__outputType'] | (unknown extends T['__nullType'] ? null : T['__nullType']) : K extends 'outputSchema' ? OutputSchema : K extends '__queryType' ? T['__queryType'] | null : K extends 'querySchema' ? QuerySchema : K extends 'data' ? T['data'] & DataNullable : K extends 'operators' ? { [K in keyof T['operators']]: K extends 'equals' | 'not' | 'isDistinctFrom' | 'isNotDistinctFrom' ? Operator<T['__queryType'] | null, T> : T['operators'][K] } : T[K] };
7250
+ export type Nullable<T extends Column.Pick.ForNullable> = { [K in keyof T]: K extends '__type' ? T['__type'] | null : K extends '__inputType' ? T['__inputType'] | null : K extends '__outputType' ? T['__outputType'] | (unknown extends T['__nullType'] ? null : T['__nullType']) : K extends '__queryType' ? T['__queryType'] | null : K extends 'data' ? T['data'] & DataNullable : K extends 'operators' ? { [K in keyof T['operators']]: K extends 'equals' | 'not' | 'isDistinctFrom' | 'isNotDistinctFrom' ? Operator<T['__queryType'] | null, T> : T['operators'][K] } : T[K] };
7251
+ export type NullableWithSchema<T extends Column.Pick.ForNullable, InputSchema, OutputSchema, QuerySchema> = { [K in keyof T]: K extends '__type' ? T['__type'] | null : K extends '__inputType' ? T['__inputType'] | null : K extends 'inputSchema' ? InputSchema : K extends '__outputType' ? T['__outputType'] | (unknown extends T['__nullType'] ? null : T['__nullType']) : K extends 'outputSchema' ? OutputSchema : K extends '__queryType' ? T['__queryType'] | null : K extends 'querySchema' ? QuerySchema : K extends 'data' ? T['data'] & DataNullable : K extends 'operators' ? { [K in keyof T['operators']]: K extends 'equals' | 'not' | 'isDistinctFrom' | 'isNotDistinctFrom' ? Operator<T['__queryType'] | null, T> : T['operators'][K] } : T[K] };
7251
7252
  export type QueryColumnToNullable<C> = { [K in keyof C]: K extends '__outputType' | '__queryType' ? C[K] | null : C[K] };
7252
7253
  export type QueryColumnToOptional<C> = { [K in keyof C]: K extends '__outputType' ? C[K] | undefined : C[K] };
7253
7254
  interface DataNullable {
@@ -7263,8 +7264,7 @@ declare namespace Column$1 {
7263
7264
  export type Encode<T, InputSchema, Input> = { [K in keyof T]: K extends '__inputType' ? Input : K extends 'inputSchema' ? InputSchema : T[K] };
7264
7265
  export type Parse<T extends Pick.ForParse, OutputSchema, Output> = { [K in keyof T]: K extends '__outputType' ? null extends T['__type'] ? (Output extends null ? never : Output) | (unknown extends T['__nullType'] ? null : T['__nullType']) : Output : K extends 'outputSchema' ? null extends T['__type'] ? OutputSchema | T['nullSchema'] : OutputSchema : T[K] };
7265
7266
  export type ParseNull<T extends Column.Pick.ForParseNull, NullSchema, NullType> = { [K in keyof T]: K extends '__outputType' ? null extends T['__type'] ? Exclude<T['__outputType'], null> | NullType : T['__outputType'] : K extends '__nullType' ? NullType : K extends 'outputSchema' ? null extends T['__type'] ? T['outputSchema'] | NullSchema : T['outputSchema'] : K extends 'nullSchema' ? NullSchema : T[K] };
7266
- type DefaultData<T extends Column.Data, Value> = { [K in keyof T]: K extends 'default' ? Value extends null ? never : Value : K extends 'optional' ? true : T[K] };
7267
- export type Default<T extends Column.Pick.Data, Value> = { [K in keyof T]: K extends 'data' ? DefaultData<T['data'], Value> : T[K] };
7267
+ export type HasDefault<T extends Column.Pick.Data> = T & Column.Data.Default;
7268
7268
  type DefaultSelectData<T extends Column.Data, Value> = { [K in keyof T]: K extends 'explicitSelect' ? Value extends true ? false : true : T[K] };
7269
7269
  export type DefaultSelect<T extends Column.Pick.Data, Value extends boolean> = { [K in keyof T]: K extends 'data' ? DefaultSelectData<T['data'], Value> : T[K] };
7270
7270
  export interface IsAppReadOnly {
@@ -7364,6 +7364,7 @@ declare namespace Column$1 {
7364
7364
  interface TableParamInstance {
7365
7365
  schema?: string;
7366
7366
  table: string;
7367
+ nameInDb?: string;
7367
7368
  columns: PickQueryShape$1;
7368
7369
  }
7369
7370
  interface TableParam {
@@ -7455,6 +7456,12 @@ declare namespace Column$1 {
7455
7456
  skipValueToArray?: boolean;
7456
7457
  }
7457
7458
  export namespace Data {
7459
+ interface Default {
7460
+ data: {
7461
+ default: true;
7462
+ optional: true;
7463
+ };
7464
+ }
7458
7465
  interface Check {
7459
7466
  sql: RawSqlBase$1;
7460
7467
  name?: string;
@@ -7525,13 +7532,13 @@ declare abstract class Column$1 {
7525
7532
  *
7526
7533
  * @param value - default value or a function returning a value
7527
7534
  */
7528
- default<T extends Column.Pick.DataAndInputType, Value extends T['__inputType'] | null | RawSqlBase$1 | (() => T['__inputType'])>(this: T, value: Value): Column.Modifiers.Default<T, Value>;
7535
+ default<T extends Column.Pick.DataAndInputType, Value extends T['__inputType'] | null | RawSqlBase$1 | (() => T['__inputType'])>(this: T, value: Value): Column.Modifiers.HasDefault<T>;
7529
7536
  /**
7530
7537
  * Use `hasDefault` to let the column be omitted when creating records.
7531
7538
  *
7532
7539
  * It's better to use {@link default} instead so the value is explicit and serves as a hint.
7533
7540
  */
7534
- hasDefault<T extends Column.Pick.Data>(this: T): Column.Modifiers.Default<T, RawSqlBase$1>;
7541
+ hasDefault<T extends Column.Pick.Data>(this: T): Column.Modifiers.HasDefault<T>;
7535
7542
  /**
7536
7543
  * Set a database-level validation check to a column. `check` accepts a raw SQL.
7537
7544
  *
@@ -8347,6 +8354,7 @@ interface QueryData$1 extends QueryDataAliases, PickQueryDataParsers, HasHookSel
8347
8354
  type: QueryType;
8348
8355
  adapter: Adapter$1;
8349
8356
  selectShape: ColumnsShape$1;
8357
+ nameInDb?: string;
8350
8358
  handleResult: HandleResult;
8351
8359
  catch?: boolean;
8352
8360
  returnType: QueryReturnType$1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pqb",
3
- "version": "0.70.0",
3
+ "version": "0.71.0",
4
4
  "description": "Postgres query builder",
5
5
  "keywords": [
6
6
  "pg",