pqb 0.38.7 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -2887,7 +2887,7 @@ declare abstract class IntegerBaseColumn<Schema extends ColumnSchemaConfig> exte
2887
2887
  data: NumberColumnData;
2888
2888
  constructor(schema: Schema);
2889
2889
  }
2890
- declare abstract class NumberAsStringBaseColumn<Schema extends ColumnSchemaConfig> extends ColumnType<Schema, string, ReturnType<Schema['stringSchema']>, OperatorsNumber> {
2890
+ declare abstract class NumberAsStringBaseColumn<Schema extends ColumnSchemaConfig, InputType = string | number> extends ColumnType<Schema, string, ReturnType<Schema['stringSchema']>, OperatorsNumber, InputType> {
2891
2891
  operators: OperatorsNumber;
2892
2892
  data: ColumnData;
2893
2893
  constructor(schema: Schema);
@@ -2919,7 +2919,7 @@ declare class IntegerColumn<Schema extends ColumnSchemaConfig> extends IntegerBa
2919
2919
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
2920
2920
  identity<T extends ColumnType>(this: T, options?: TableData.Identity): IdentityColumn<T>;
2921
2921
  }
2922
- declare class BigIntColumn<Schema extends ColumnSchemaConfig> extends NumberAsStringBaseColumn<Schema> {
2922
+ declare class BigIntColumn<Schema extends ColumnSchemaConfig> extends NumberAsStringBaseColumn<Schema, string | number | bigint> {
2923
2923
  dataType: "int8";
2924
2924
  constructor(schema: Schema);
2925
2925
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
@@ -5796,10 +5796,10 @@ type UpdateArg<T extends UpdateSelf> = T['meta']['hasWhere'] extends true ? Upda
5796
5796
  type UpdateRawArgs<T extends UpdateSelf> = T['meta']['hasWhere'] extends true ? SQLQueryArgs : never;
5797
5797
  type UpdateResult<T extends UpdateSelf> = T['meta']['hasSelect'] extends true ? SetQueryKind<T, 'update'> : SetQueryReturnsRowCount<T, 'update'>;
5798
5798
  type NumericColumns<T extends PickQueryShape> = {
5799
- [K in keyof T['shape']]: T['shape'][K]['type'] extends number | null ? K : T['shape'][K] extends NumberAsStringBaseColumn<ColumnSchemaConfig> ? K : never;
5799
+ [K in keyof T['shape']]: Exclude<T['shape'][K]['queryType'], string> extends number | bigint | null ? K : never;
5800
5800
  }[keyof T['shape']];
5801
5801
  type ChangeCountArg<T extends PickQueryShape> = NumericColumns<T> | {
5802
- [K in NumericColumns<T>]?: T['shape'][K]['type'] extends number | null ? number : string;
5802
+ [K in NumericColumns<T>]?: T['shape'][K]['type'] extends number | null ? number : number | string | bigint;
5803
5803
  };
5804
5804
  interface UpdateCtx {
5805
5805
  queries?: ((queryResult: QueryResult) => Promise<void>)[];
package/dist/index.js CHANGED
@@ -4512,8 +4512,10 @@ const maybeUnNameColumn = (column, isSubQuery) => {
4512
4512
  return isSubQuery && (column == null ? void 0 : column.data.name) ? orchidCore.setColumnData(column, "name", void 0) : column;
4513
4513
  };
4514
4514
  function _querySelect(q, args) {
4515
+ var _a, _b;
4515
4516
  const len = args.length;
4516
4517
  if (!len) {
4518
+ (_b = (_a = q.q).select) != null ? _b : _a.select = [];
4517
4519
  return q;
4518
4520
  }
4519
4521
  const as = q.q.as || q.table;
@@ -4806,7 +4808,9 @@ function queryJson(self, coalesce) {
4806
4808
  }
4807
4809
 
4808
4810
  const pushSelectSql = (ctx, table, query, quotedAs) => {
4809
- ctx.sql.push(selectToSql(ctx, table, query, quotedAs));
4811
+ const sql = selectToSql(ctx, table, query, quotedAs);
4812
+ if (sql)
4813
+ ctx.sql.push(sql);
4810
4814
  };
4811
4815
  const selectToSql = (ctx, table, query, quotedAs, hookSelect = query.hookSelect) => {
4812
4816
  var _a, _b;
@@ -4917,7 +4921,7 @@ const selectToSql = (ctx, table, query, quotedAs, hookSelect = query.hookSelect)
4917
4921
  list.push(sql);
4918
4922
  }
4919
4923
  }
4920
- return list.length ? list.join(", ") : selectAllSql(table, query, quotedAs);
4924
+ return list.length ? list.join(", ") : query.select ? "" : selectAllSql(table, query, quotedAs);
4921
4925
  };
4922
4926
  function selectedObjectToSQL(ctx, quotedAs, item) {
4923
4927
  const sql = item.toSQL(ctx, quotedAs);