pqb 0.18.26 → 0.18.28

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.mjs CHANGED
@@ -3192,7 +3192,7 @@ class CitextColumn extends TextBaseColumn {
3192
3192
  }
3193
3193
 
3194
3194
  const dateTimeEncode = (input) => {
3195
- return typeof input === "object" ? input : new Date(input);
3195
+ return typeof input === "number" ? new Date(input) : input;
3196
3196
  };
3197
3197
  const skipDateMethodsFromToCode = { encodeFn: dateTimeEncode };
3198
3198
  const parseToNumber = (value) => value ? Date.parse(value) : value;
@@ -3278,10 +3278,12 @@ class TimestampTZColumn extends DateTimeTzBaseClass {
3278
3278
  return timestampToCode(this, t);
3279
3279
  }
3280
3280
  }
3281
- class TimeColumn extends DateTimeBaseClass {
3282
- constructor() {
3283
- super(...arguments);
3281
+ class TimeColumn extends ColumnType {
3282
+ constructor(dateTimePrecision) {
3283
+ super();
3284
3284
  this.dataType = "time";
3285
+ this.operators = Operators.time;
3286
+ this.data.dateTimePrecision = dateTimePrecision;
3285
3287
  }
3286
3288
  toCode(t) {
3287
3289
  const { dateTimePrecision } = this.data;
@@ -3294,6 +3296,7 @@ class TimeColumn extends DateTimeBaseClass {
3294
3296
  );
3295
3297
  }
3296
3298
  }
3299
+ assignMethodsToClass(TimeColumn, dateTypeMethods);
3297
3300
  class IntervalColumn extends ColumnType {
3298
3301
  constructor(fields, precision) {
3299
3302
  super();
@@ -7657,22 +7660,42 @@ const queryMethodByReturnType = {
7657
7660
  rowCount: "arrays",
7658
7661
  void: "arrays"
7659
7662
  };
7660
- let queryError = void 0;
7661
7663
  class Then {
7662
- get then() {
7664
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7665
+ catch(fn) {
7666
+ return this.then(void 0, fn);
7667
+ }
7668
+ }
7669
+ let queryError = void 0;
7670
+ let getThen;
7671
+ if (process.versions.bun) {
7672
+ getThen = function() {
7673
+ queryError = new Error();
7674
+ if (!this.internal)
7675
+ return maybeWrappedThen;
7676
+ const trx = this.internal.transactionStorage.getStore();
7677
+ if (!trx)
7678
+ return maybeWrappedThen;
7679
+ return (resolve, reject) => {
7680
+ return this.internal.transactionStorage.run(trx, () => {
7681
+ return maybeWrappedThen.call(this, resolve, reject);
7682
+ });
7683
+ };
7684
+ };
7685
+ } else {
7686
+ getThen = function() {
7663
7687
  queryError = new Error();
7664
7688
  return maybeWrappedThen;
7665
- }
7666
- set then(value) {
7689
+ };
7690
+ }
7691
+ Object.defineProperty(Then.prototype, "then", {
7692
+ get: getThen,
7693
+ set(value) {
7667
7694
  Object.defineProperty(this, "then", {
7668
7695
  value
7669
7696
  });
7670
7697
  }
7671
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7672
- catch(fn) {
7673
- return this.then(void 0, fn);
7674
- }
7675
- }
7698
+ });
7676
7699
  const handleResult = (q, returnType, result, isSubQuery) => {
7677
7700
  return parseResult(q, q.q.parsers, returnType, result, isSubQuery);
7678
7701
  };