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.d.ts CHANGED
@@ -5126,6 +5126,7 @@ declare class Transaction {
5126
5126
  * ```
5127
5127
  */
5128
5128
  ensureTransaction<Result>(this: PickQueryQAndInternal, cb: () => Promise<Result>): Promise<Result>;
5129
+ isInTransaction(): boolean;
5129
5130
  }
5130
5131
 
5131
5132
  type AfterHook<Select extends PropertyKey[], Shape extends QueryColumns> = QueryAfterHook<{
@@ -8167,6 +8168,7 @@ interface PostgisPoint {
8167
8168
  declare class PostgisGeographyPointColumn<Schema extends ColumnSchemaConfig> extends ColumnType<Schema, PostgisPoint, ReturnType<Schema['geographyPointSchema']>, OperatorsAny> {
8168
8169
  dataType: string;
8169
8170
  operators: OperatorsAny;
8171
+ static encode: ({ srid, lon, lat, }: PostgisPoint) => string;
8170
8172
  static isDefaultPoint(typmod: number): boolean;
8171
8173
  constructor(schema: Schema);
8172
8174
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
package/dist/index.js CHANGED
@@ -4285,6 +4285,10 @@ class Transaction {
4285
4285
  return cb();
4286
4286
  return Transaction.prototype.transaction.call(this, cb);
4287
4287
  }
4288
+ isInTransaction() {
4289
+ const trx = this.internal.transactionStorage.getStore();
4290
+ return !!(trx && (!trx.testTransactionCount || trx.transactionId >= trx.testTransactionCount));
4291
+ }
4288
4292
  }
4289
4293
  const runAfterCommit = async (afterCommit, result) => {
4290
4294
  if (afterCommit) {
@@ -7187,6 +7191,21 @@ class DomainColumn extends CustomTypeColumn {
7187
7191
  }
7188
7192
 
7189
7193
  const defaultSrid = 4326;
7194
+ const defaultEncode = ({
7195
+ srid = defaultSrid,
7196
+ lon,
7197
+ lat
7198
+ }) => {
7199
+ const arr = new Uint8Array(25);
7200
+ const view = new DataView(arr.buffer);
7201
+ view.setInt8(0, 1);
7202
+ view.setInt8(1, 1);
7203
+ view.setInt8(4, 32);
7204
+ view.setUint32(5, srid, true);
7205
+ view.setFloat64(9, lon, true);
7206
+ view.setFloat64(17, lat, true);
7207
+ return uint8ArrToHex(arr);
7208
+ };
7190
7209
  class PostgisGeographyPointColumn extends ColumnType {
7191
7210
  constructor(schema) {
7192
7211
  super(schema, schema.geographyPointSchema());
@@ -7202,6 +7221,7 @@ class PostgisGeographyPointColumn extends ColumnType {
7202
7221
  return columnCode(this, ctx, key, `geography.point()`);
7203
7222
  }
7204
7223
  }
7224
+ PostgisGeographyPointColumn.encode = defaultEncode;
7205
7225
  const defaultParse = (input) => {
7206
7226
  const bytes = new Uint8Array(20);
7207
7227
  for (let i = 0; i < 40; i += 2) {
@@ -7217,21 +7237,6 @@ const defaultParse = (input) => {
7217
7237
  srid
7218
7238
  };
7219
7239
  };
7220
- const defaultEncode = ({
7221
- srid = defaultSrid,
7222
- lon,
7223
- lat
7224
- }) => {
7225
- const arr = new Uint8Array(25);
7226
- const view = new DataView(arr.buffer);
7227
- view.setInt8(0, 1);
7228
- view.setInt8(1, 1);
7229
- view.setInt8(4, 32);
7230
- view.setUint32(5, srid, true);
7231
- view.setFloat64(9, lon, true);
7232
- view.setFloat64(17, lat, true);
7233
- return uint8ArrToHex(arr);
7234
- };
7235
7240
  const typmodGetType = (typmod) => (typmod & 252) >> 2;
7236
7241
  const lwtypeName = (type) => [
7237
7242
  "Unknown",