pqb 0.42.2 → 0.42.4

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
@@ -4283,6 +4283,10 @@ class Transaction {
4283
4283
  return cb();
4284
4284
  return Transaction.prototype.transaction.call(this, cb);
4285
4285
  }
4286
+ isInTransaction() {
4287
+ const trx = this.internal.transactionStorage.getStore();
4288
+ return !!(trx && (!trx.testTransactionCount || trx.transactionId >= trx.testTransactionCount));
4289
+ }
4286
4290
  }
4287
4291
  const runAfterCommit = async (afterCommit, result) => {
4288
4292
  if (afterCommit) {
@@ -7185,6 +7189,21 @@ class DomainColumn extends CustomTypeColumn {
7185
7189
  }
7186
7190
 
7187
7191
  const defaultSrid = 4326;
7192
+ const defaultEncode = ({
7193
+ srid = defaultSrid,
7194
+ lon,
7195
+ lat
7196
+ }) => {
7197
+ const arr = new Uint8Array(25);
7198
+ const view = new DataView(arr.buffer);
7199
+ view.setInt8(0, 1);
7200
+ view.setInt8(1, 1);
7201
+ view.setInt8(4, 32);
7202
+ view.setUint32(5, srid, true);
7203
+ view.setFloat64(9, lon, true);
7204
+ view.setFloat64(17, lat, true);
7205
+ return uint8ArrToHex(arr);
7206
+ };
7188
7207
  class PostgisGeographyPointColumn extends ColumnType {
7189
7208
  constructor(schema) {
7190
7209
  super(schema, schema.geographyPointSchema());
@@ -7200,6 +7219,7 @@ class PostgisGeographyPointColumn extends ColumnType {
7200
7219
  return columnCode(this, ctx, key, `geography.point()`);
7201
7220
  }
7202
7221
  }
7222
+ PostgisGeographyPointColumn.encode = defaultEncode;
7203
7223
  const defaultParse = (input) => {
7204
7224
  const bytes = new Uint8Array(20);
7205
7225
  for (let i = 0; i < 40; i += 2) {
@@ -7215,21 +7235,6 @@ const defaultParse = (input) => {
7215
7235
  srid
7216
7236
  };
7217
7237
  };
7218
- const defaultEncode = ({
7219
- srid = defaultSrid,
7220
- lon,
7221
- lat
7222
- }) => {
7223
- const arr = new Uint8Array(25);
7224
- const view = new DataView(arr.buffer);
7225
- view.setInt8(0, 1);
7226
- view.setInt8(1, 1);
7227
- view.setInt8(4, 32);
7228
- view.setUint32(5, srid, true);
7229
- view.setFloat64(9, lon, true);
7230
- view.setFloat64(17, lat, true);
7231
- return uint8ArrToHex(arr);
7232
- };
7233
7238
  const typmodGetType = (typmod) => (typmod & 252) >> 2;
7234
7239
  const lwtypeName = (type) => [
7235
7240
  "Unknown",