pqb 0.18.20 → 0.18.21

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
@@ -1,5 +1,5 @@
1
1
  import * as orchid_core from 'orchid-core';
2
- import { QueryResultRow, AdapterBase, QueryInput, Sql, QueryBaseCommon, ColumnsShapeBase, QueryInternal, QueryMetaBase, StringKey, Expression, ColumnTypeBase, MaybeArray, TemplateLiteralArgs, ColumnsParsers, getValueKey, ColumnTypesBase, ColumnShapeOutput, DefaultSelectColumns, EmptyObject, DbBase, QueryThen, QueryCatch, TransactionState, SQLQueryArgs, NullableColumn, SetOptional, EmptyTuple, MergeObjects, RawSQLBase, RawSQLValues, ExpressionTypeMethod, DynamicSQLArg, StaticSQLArgs, Spread, Code, OperatorToSQL, BaseNumberData, NumberTypeMethods, ColumnWithDefault, StringTypeData, PrimaryKeyColumn, stringTypeMethods, DateTypeMethods, DateColumnData, EncodeColumn, ParseColumn, JSONType, JSONUnknown, JSONTypes, ArrayMethodsData, arrayTypeMethods, ForeignKeyTable, TimestampHelpers, ColumnNameOfTable, ValidationContext, ErrorMessage, ColumnDataBase } from 'orchid-core';
2
+ import { QueryResultRow, AdapterBase, QueryInput, Sql, QueryBaseCommon, ColumnsShapeBase, QueryInternal, QueryMetaBase, StringKey, Expression, ColumnTypeBase, MaybeArray, TemplateLiteralArgs, ColumnsParsers, getValueKey, ColumnTypesBase, ColumnShapeOutput, DefaultSelectColumns, EmptyObject, DbBase, QueryThen, QueryCatch, TransactionState, SQLQueryArgs, NullableColumn, SetOptional, EmptyTuple, MergeObjects, RawSQLBase, RawSQLValues, ExpressionTypeMethod, DynamicSQLArg, StaticSQLArgs, Spread, Code, OperatorToSQL, BaseNumberData, NumberTypeMethods, ColumnWithDefault, StringTypeData, PrimaryKeyColumn, stringTypeMethods, DateTypeMethods, DateColumnData, EncodeColumn, ParseColumn, JSONType, JSONUnknown, JSONTypes, ArrayMethodsData, arrayTypeMethods, ForeignKeyTable, TimestampHelpers, ColumnNameOfTable, ColumnDataBase, ValidationContext, ErrorMessage } from 'orchid-core';
3
3
  import { PoolConfig, Pool, PoolClient } from 'pg';
4
4
  import { inspect } from 'node:util';
5
5
  import { AsyncLocalStorage } from 'node:async_hooks';
@@ -270,7 +270,7 @@ type CommonQueryData = {
270
270
  wrapInTransaction?: boolean;
271
271
  throwOnNotFound?: boolean;
272
272
  with?: WithItem[];
273
- withShapes?: Record<string, ColumnsShape>;
273
+ withShapes?: Record<string, ColumnsShapeBase>;
274
274
  joinTo?: QueryBase;
275
275
  joinedShapes?: JoinedShapes;
276
276
  joinedParsers?: JoinedParsers;
@@ -437,9 +437,9 @@ declare class OrchidOrmInternalError extends Error {
437
437
  }
438
438
  type QueryErrorName = 'parseComplete' | 'bindComplete' | 'closeComplete' | 'noData' | 'portalSuspended' | 'replicationStart' | 'emptyQuery' | 'copyDone' | 'copyData' | 'rowDescription' | 'parameterDescription' | 'parameterStatus' | 'backendKeyData' | 'notification' | 'readyForQuery' | 'commandComplete' | 'dataRow' | 'copyInResponse' | 'copyOutResponse' | 'authenticationOk' | 'authenticationMD5Password' | 'authenticationCleartextPassword' | 'authenticationSASL' | 'authenticationSASLContinue' | 'authenticationSASLFinal' | 'error' | 'notice';
439
439
  declare abstract class QueryError<T extends {
440
- shape: ColumnsShape;
440
+ shape: ColumnsShapeBase;
441
441
  } = {
442
- shape: ColumnsShape;
442
+ shape: ColumnsShapeBase;
443
443
  }> extends OrchidOrmInternalError {
444
444
  message: string;
445
445
  name: QueryErrorName;
@@ -492,8 +492,8 @@ type DbTableOptions = {
492
492
  language?: string;
493
493
  } & QueryLogOptions;
494
494
  type QueryDefaultReturnData<Shape extends ColumnsShapeBase> = Pick<ColumnShapeOutput<Shape>, DefaultSelectColumns<Shape>[number]>[];
495
- declare const anyShape: Record<string, ColumnType<unknown, BaseOperators, unknown, unknown, unknown>>;
496
- interface Db<Table extends string | undefined = undefined, Shape extends ColumnsShape = Record<string, never>, Relations extends RelationsBase = EmptyObject, ColumnTypes = DefaultColumnTypes, ShapeWithComputed extends ColumnsShape = Shape, Data = QueryDefaultReturnData<Shape>> extends DbBase<Adapter, Table, Shape, ColumnTypes, ShapeWithComputed>, QueryMethods<ColumnTypes> {
495
+ declare const anyShape: Record<string, ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, unknown, unknown, orchid_core.ColumnDataBase>>;
496
+ interface Db<Table extends string | undefined = undefined, Shape extends ColumnsShapeBase = Record<string, never>, Relations extends RelationsBase = EmptyObject, ColumnTypes = DefaultColumnTypes, ShapeWithComputed extends ColumnsShapeBase = Shape, Data = QueryDefaultReturnData<Shape>> extends DbBase<Adapter, Table, Shape, ColumnTypes, ShapeWithComputed>, QueryMethods<ColumnTypes> {
497
497
  new (adapter: Adapter, queryBuilder: Db<Table, Shape, Relations, ColumnTypes>, table?: Table, shape?: Shape, options?: DbTableOptions): this;
498
498
  internal: Query['internal'];
499
499
  queryBuilder: Db;
@@ -516,7 +516,7 @@ interface Db<Table extends string | undefined = undefined, Shape extends Columns
516
516
  }[keyof Shape], true>;
517
517
  };
518
518
  }
519
- declare class Db<Table extends string | undefined = undefined, Shape extends ColumnsShape = Record<string, never>, Relations extends RelationsBase = EmptyObject, ColumnTypes = DefaultColumnTypes, ShapeWithComputed extends ColumnsShape = Shape> implements Query {
519
+ declare class Db<Table extends string | undefined = undefined, Shape extends ColumnsShapeBase = Record<string, never>, Relations extends RelationsBase = EmptyObject, ColumnTypes = DefaultColumnTypes, ShapeWithComputed extends ColumnsShapeBase = Shape> implements Query {
520
520
  adapter: Adapter;
521
521
  queryBuilder: Db;
522
522
  table: Table;
@@ -583,7 +583,7 @@ declare class Db<Table extends string | undefined = undefined, Shape extends Col
583
583
  queryArrays<R extends any[] = any[]>(...args: SQLQueryArgs): Promise<QueryArraysResult<R>>;
584
584
  }
585
585
  type DbResult<ColumnTypes> = Db<string, Record<string, never>, EmptyObject, ColumnTypes> & {
586
- <Table extends string, Shape extends ColumnsShape = ColumnsShape>(table: Table, shape?: ((t: ColumnTypes) => Shape) | Shape, options?: DbTableOptions): Db<Table, Shape, EmptyObject>;
586
+ <Table extends string, Shape extends ColumnsShapeBase = ColumnsShapeBase>(table: Table, shape?: ((t: ColumnTypes) => Shape) | Shape, options?: DbTableOptions): Db<Table, Shape, EmptyObject>;
587
587
  adapter: Adapter;
588
588
  close: Adapter['close'];
589
589
  };
@@ -5654,7 +5654,7 @@ type Query = QueryBase & QueryMethods<unknown> & {
5654
5654
  columnTypes: unknown;
5655
5655
  onQueryBuilder: typeof OnQueryBuilder;
5656
5656
  table?: string;
5657
- shape: ColumnsShape;
5657
+ shape: ColumnsShapeBase;
5658
5658
  singlePrimaryKey: string;
5659
5659
  primaryKeys: string[];
5660
5660
  inputType: Record<string, unknown>;
@@ -6519,48 +6519,6 @@ declare class ArrayColumn<Item extends ColumnTypeBase> extends ColumnType<Item['
6519
6519
  };
6520
6520
  }
6521
6521
 
6522
- type ColumnsShape = Record<string, ColumnType>;
6523
- declare abstract class ColumnsObject<Shape extends ColumnsShapeBase> extends ColumnType<{
6524
- [K in keyof Shape]: Shape[K]['type'];
6525
- }, typeof Operators.any, {
6526
- [K in keyof Shape]: Shape[K]['inputType'];
6527
- }, {
6528
- [K in keyof Shape]: Shape[K]['outputType'];
6529
- }, {
6530
- [K in keyof Shape]: Shape[K]['queryType'];
6531
- }> {
6532
- shape: Shape;
6533
- dataType: "object";
6534
- operators: {
6535
- equals: Operator<any, BooleanColumn>;
6536
- not: Operator<any, BooleanColumn>;
6537
- in: Operator<any[] | orchid_core.Expression<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, unknown, unknown, orchid_core.ColumnDataBase>> | Query, BooleanColumn>;
6538
- notIn: Operator<any[] | orchid_core.Expression<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, unknown, unknown, orchid_core.ColumnDataBase>> | Query, BooleanColumn>;
6539
- };
6540
- constructor(shape: Shape);
6541
- }
6542
- declare abstract class ArrayOfColumnsObjects<Shape extends ColumnsShapeBase> extends ColumnType<{
6543
- [K in keyof Shape]: Shape[K]['type'];
6544
- }[], typeof Operators.any, {
6545
- [K in keyof Shape]: Shape[K]['inputType'];
6546
- }[], {
6547
- [K in keyof Shape]: Shape[K]['outputType'];
6548
- }[], {
6549
- [K in keyof Shape]: Shape[K]['queryType'];
6550
- }[]> {
6551
- shape: Shape;
6552
- dataType: "array";
6553
- operators: {
6554
- equals: Operator<any, BooleanColumn>;
6555
- not: Operator<any, BooleanColumn>;
6556
- in: Operator<any[] | orchid_core.Expression<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, unknown, unknown, orchid_core.ColumnDataBase>> | Query, BooleanColumn>;
6557
- notIn: Operator<any[] | orchid_core.Expression<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, unknown, unknown, orchid_core.ColumnDataBase>> | Query, BooleanColumn>;
6558
- };
6559
- constructor(shape: Shape);
6560
- }
6561
- declare abstract class PluckResultColumnType<C extends ColumnTypeBase> extends ColumnTypeBase<C['type'][], typeof Operators.any, C['inputType'][], C['outputType'][], C['queryType'][]> {
6562
- }
6563
-
6564
6522
  declare class CustomTypeColumn extends ColumnType<unknown, typeof Operators.any> {
6565
6523
  dataType: string;
6566
6524
  operators: {
@@ -6624,7 +6582,7 @@ declare const getConstraintKind: (it: TableData.Constraint) => 'constraint' | 'f
6624
6582
  declare const newTableData: () => TableData;
6625
6583
  declare const getTableData: () => TableData;
6626
6584
  declare const resetTableData: (data?: TableData) => void;
6627
- declare const getColumnTypes: <ColumnTypes, Shape extends ColumnsShape>(types: ColumnTypes, fn: (t: ColumnTypes) => Shape, nowSQL: string | undefined, language: string | undefined, data?: TableData) => Shape;
6585
+ declare const getColumnTypes: <ColumnTypes, Shape extends ColumnsShapeBase>(types: ColumnTypes, fn: (t: ColumnTypes) => Shape, nowSQL: string | undefined, language: string | undefined, data?: TableData) => Shape;
6628
6586
  type DefaultColumnTypes = TimestampHelpers & {
6629
6587
  name<T extends ColumnTypesBase>(this: T, name: string): T;
6630
6588
  sql<T extends ColumnTypesBase>(this: T, sql: TemplateStringsArray, ...values: unknown[]): RawSQLBase<ColumnType, T>;
@@ -6745,7 +6703,7 @@ type ForeignKeyAction = 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SET
6745
6703
  type ForeignKey<Table extends string, Columns extends string[]> = ({
6746
6704
  fn(): new () => {
6747
6705
  table: Table;
6748
- columns: ColumnsShape;
6706
+ columns: ColumnsShapeBase;
6749
6707
  };
6750
6708
  } | {
6751
6709
  table: Table;
@@ -6988,6 +6946,48 @@ declare abstract class ColumnType<Type = unknown, Ops extends BaseOperators = Ba
6988
6946
  generated<T extends ColumnType>(this: T, ...args: StaticSQLArgs): T;
6989
6947
  }
6990
6948
 
6949
+ type ColumnsShape = Record<string, ColumnType>;
6950
+ declare abstract class ColumnsObject<Shape extends ColumnsShapeBase> extends ColumnType<{
6951
+ [K in keyof Shape]: Shape[K]['type'];
6952
+ }, typeof Operators.any, {
6953
+ [K in keyof Shape]: Shape[K]['inputType'];
6954
+ }, {
6955
+ [K in keyof Shape]: Shape[K]['outputType'];
6956
+ }, {
6957
+ [K in keyof Shape]: Shape[K]['queryType'];
6958
+ }> {
6959
+ shape: Shape;
6960
+ dataType: "object";
6961
+ operators: {
6962
+ equals: Operator<any, BooleanColumn>;
6963
+ not: Operator<any, BooleanColumn>;
6964
+ in: Operator<any[] | orchid_core.Expression<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, unknown, unknown, orchid_core.ColumnDataBase>> | Query, BooleanColumn>;
6965
+ notIn: Operator<any[] | orchid_core.Expression<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, unknown, unknown, orchid_core.ColumnDataBase>> | Query, BooleanColumn>;
6966
+ };
6967
+ constructor(shape: Shape);
6968
+ }
6969
+ declare abstract class ArrayOfColumnsObjects<Shape extends ColumnsShapeBase> extends ColumnType<{
6970
+ [K in keyof Shape]: Shape[K]['type'];
6971
+ }[], typeof Operators.any, {
6972
+ [K in keyof Shape]: Shape[K]['inputType'];
6973
+ }[], {
6974
+ [K in keyof Shape]: Shape[K]['outputType'];
6975
+ }[], {
6976
+ [K in keyof Shape]: Shape[K]['queryType'];
6977
+ }[]> {
6978
+ shape: Shape;
6979
+ dataType: "array";
6980
+ operators: {
6981
+ equals: Operator<any, BooleanColumn>;
6982
+ not: Operator<any, BooleanColumn>;
6983
+ in: Operator<any[] | orchid_core.Expression<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, unknown, unknown, orchid_core.ColumnDataBase>> | Query, BooleanColumn>;
6984
+ notIn: Operator<any[] | orchid_core.Expression<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, unknown, unknown, orchid_core.ColumnDataBase>> | Query, BooleanColumn>;
6985
+ };
6986
+ constructor(shape: Shape);
6987
+ }
6988
+ declare abstract class PluckResultColumnType<C extends ColumnTypeBase> extends ColumnTypeBase<C['type'][], typeof Operators.any, C['inputType'][], C['outputType'][], C['queryType'][]> {
6989
+ }
6990
+
6991
6991
  declare abstract class VirtualColumn extends ColumnType<unknown, typeof Operators.any> {
6992
6992
  dataType: string;
6993
6993
  operators: {