proto.io 0.0.148 → 0.0.150
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/adapters/file/database.d.ts +2 -2
- package/dist/adapters/file/database.js +2 -2
- package/dist/adapters/file/database.mjs +2 -2
- package/dist/adapters/file/filesystem.d.ts +2 -2
- package/dist/adapters/file/google-cloud-storage.d.ts +2 -2
- package/dist/adapters/storage/progres.d.ts +6 -1
- package/dist/adapters/storage/progres.js +13 -4
- package/dist/adapters/storage/progres.js.map +1 -1
- package/dist/adapters/storage/progres.mjs +13 -4
- package/dist/adapters/storage/progres.mjs.map +1 -1
- package/dist/client.d.ts +3 -5
- package/dist/client.js +2 -2
- package/dist/client.mjs +3 -3
- package/dist/index.d.ts +3 -5
- package/dist/index.js +53 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -21
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{index-CvfRsxEZ.d.ts → index-013pxZ3P.d.ts} +5 -78
- package/dist/internals/index-013pxZ3P.d.ts.map +1 -0
- package/dist/internals/{index-EOtjV6U_.mjs → index-BmRuvHVZ.mjs} +11 -1
- package/dist/internals/index-BmRuvHVZ.mjs.map +1 -0
- package/dist/internals/index-BqFdBhFc.js.map +1 -1
- package/dist/internals/{index-DZS2c96L.js → index-CSNRyhjB.js} +2 -2
- package/dist/internals/{index-DZS2c96L.js.map → index-CSNRyhjB.js.map} +1 -1
- package/dist/internals/{index-C6zdNpc_.js → index-CVutVPmd.js} +11 -1
- package/dist/internals/{index-C6zdNpc_.js.map → index-CVutVPmd.js.map} +1 -1
- package/dist/internals/index-CsRN32Jf.d.ts +60 -0
- package/dist/internals/index-CsRN32Jf.d.ts.map +1 -0
- package/dist/internals/{index-D4VXQ1FB.d.ts → index-CyX8Lu9K.d.ts} +3 -2
- package/dist/internals/index-CyX8Lu9K.d.ts.map +1 -0
- package/dist/internals/{index-tNCIyuCp.js → index-D1YGwuNK.js} +8 -4
- package/dist/internals/index-D1YGwuNK.js.map +1 -0
- package/dist/internals/index-be1VYBY2.mjs.map +1 -1
- package/dist/internals/{index-DGau0Wqf.mjs → index-c-CaNuVY.mjs} +8 -4
- package/dist/internals/index-c-CaNuVY.mjs.map +1 -0
- package/dist/internals/{index-DTZ5uRgF.mjs → index-tU-lsQqj.mjs} +2 -2
- package/dist/internals/{index-DTZ5uRgF.mjs.map → index-tU-lsQqj.mjs.map} +1 -1
- package/dist/internals/{random-XGNkddOu.js → random-DBDmz54D.js} +3 -3
- package/dist/internals/{random-XGNkddOu.js.map → random-DBDmz54D.js.map} +1 -1
- package/dist/internals/{random-BjV_01xP.mjs → random-KZTFMK9-.mjs} +3 -3
- package/dist/internals/{random-BjV_01xP.mjs.map → random-KZTFMK9-.mjs.map} +1 -1
- package/package.json +2 -2
- package/dist/internals/index-BAB_APmb.d.ts +0 -116
- package/dist/internals/index-BAB_APmb.d.ts.map +0 -1
- package/dist/internals/index-CvfRsxEZ.d.ts.map +0 -1
- package/dist/internals/index-D4VXQ1FB.d.ts.map +0 -1
- package/dist/internals/index-DGau0Wqf.mjs.map +0 -1
- package/dist/internals/index-EOtjV6U_.mjs.map +0 -1
- package/dist/internals/index-tNCIyuCp.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TSchema, P as ProtoService } from '../../internals/index-
|
|
2
|
-
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-
|
|
1
|
+
import { T as TSchema, P as ProtoService } from '../../internals/index-013pxZ3P.js';
|
|
2
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-CyX8Lu9K.js';
|
|
3
3
|
import '@o2ter/utils-js';
|
|
4
4
|
import 'jsonwebtoken';
|
|
5
5
|
import '@o2ter/server-js';
|
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _ = require('lodash');
|
|
6
6
|
var index = require('../../internals/index-BqFdBhFc.js');
|
|
7
|
-
var index$1 = require('../../internals/index-
|
|
7
|
+
var index$1 = require('../../internals/index-CSNRyhjB.js');
|
|
8
8
|
var utilsJs = require('@o2ter/utils-js');
|
|
9
9
|
require('util');
|
|
10
10
|
require('zlib');
|
|
11
11
|
require('../../internals/private-CSB1Ep4g.js');
|
|
12
|
-
require('../../internals/index-
|
|
12
|
+
require('../../internals/index-CVutVPmd.js');
|
|
13
13
|
require('decimal.js');
|
|
14
14
|
|
|
15
15
|
//
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import { F as FileStorageBase } from '../../internals/index-be1VYBY2.mjs';
|
|
3
|
-
import { Q as QuerySelector } from '../../internals/index-
|
|
3
|
+
import { Q as QuerySelector } from '../../internals/index-tU-lsQqj.mjs';
|
|
4
4
|
import { bufferToBase64, base64ToBuffer } from '@o2ter/utils-js';
|
|
5
5
|
import 'util';
|
|
6
6
|
import 'zlib';
|
|
7
7
|
import '../../internals/private-BUpLAMZi.mjs';
|
|
8
|
-
import '../../internals/index-
|
|
8
|
+
import '../../internals/index-BmRuvHVZ.mjs';
|
|
9
9
|
import 'decimal.js';
|
|
10
10
|
|
|
11
11
|
//
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as ProtoService } from '../../internals/index-
|
|
2
|
-
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-
|
|
1
|
+
import { P as ProtoService } from '../../internals/index-013pxZ3P.js';
|
|
2
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-CyX8Lu9K.js';
|
|
3
3
|
import '@o2ter/utils-js';
|
|
4
4
|
import 'jsonwebtoken';
|
|
5
5
|
import '@o2ter/server-js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _google_cloud_storage from '@google-cloud/storage';
|
|
2
2
|
import { Storage } from '@google-cloud/storage';
|
|
3
|
-
import { P as ProtoService } from '../../internals/index-
|
|
4
|
-
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-
|
|
3
|
+
import { P as ProtoService } from '../../internals/index-013pxZ3P.js';
|
|
4
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-CyX8Lu9K.js';
|
|
5
5
|
import '@o2ter/utils-js';
|
|
6
6
|
import 'jsonwebtoken';
|
|
7
7
|
import '@o2ter/server-js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Pool, PoolClient, PoolConfig } from 'pg';
|
|
2
|
-
import { _ as _TValue,
|
|
2
|
+
import { _ as _TValue, n as EventData, T as TSchema, o as DecodedQuery, F as FindOptions, Q as QuerySelector, p as DecodedSortOption, I as InsertOptions, q as TValue, r as FindOneOptions, t as TUpdateOp, u as FieldSelectorExpression, v as QueryExpression, w as TStorage, x as TransactionOptions, h as TObject, y as TQueryRandomOptions, z as TPubSub } from '../../internals/index-013pxZ3P.js';
|
|
3
3
|
import * as _o2ter_utils_js from '@o2ter/utils-js';
|
|
4
4
|
import { asyncStream } from '@o2ter/utils-js';
|
|
5
5
|
import 'jsonwebtoken';
|
|
@@ -178,8 +178,10 @@ declare abstract class SqlStorage implements TStorage {
|
|
|
178
178
|
abstract setConfig(values: Record<string, _TValue>, acl?: string[]): PromiseLike<void>;
|
|
179
179
|
abstract lockTable(className: string | string[], update: boolean): Promise<void>;
|
|
180
180
|
abstract withConnection<T>(callback: (connection: TStorage) => PromiseLike<T>): PromiseLike<T>;
|
|
181
|
+
abstract isDuplicateIdError(error: any): boolean;
|
|
181
182
|
abstract atomic<T>(callback: (connection: TStorage) => PromiseLike<T>, options?: {
|
|
182
183
|
lockTable?: string;
|
|
184
|
+
retry?: boolean;
|
|
183
185
|
}): PromiseLike<T>;
|
|
184
186
|
abstract withTransaction<T>(callback: (connection: TStorage) => PromiseLike<T>, options?: TransactionOptions): PromiseLike<T>;
|
|
185
187
|
abstract get dialect(): SqlDialect;
|
|
@@ -236,8 +238,10 @@ declare class PostgresStorageClient<Driver extends PostgresClientDriver> extends
|
|
|
236
238
|
}>;
|
|
237
239
|
lockTable(table: string | string[], update: boolean): Promise<void>;
|
|
238
240
|
withConnection<T>(callback: (connection: PostgresStorageClient<PostgresClientDriver>) => PromiseLike<T>): PromiseLike<T>;
|
|
241
|
+
isDuplicateIdError(error: any): any;
|
|
239
242
|
atomic<T>(callback: (connection: PostgresStorageTransaction) => PromiseLike<T>, options?: {
|
|
240
243
|
lockTable?: string;
|
|
244
|
+
retry?: boolean;
|
|
241
245
|
}): PromiseLike<T>;
|
|
242
246
|
withTransaction<T>(callback: (connection: PostgresStorageTransaction) => PromiseLike<T>, options?: TransactionOptions): Promise<T>;
|
|
243
247
|
subscribe(callback: (payload: EventData) => void): () => void;
|
|
@@ -251,6 +255,7 @@ declare class PostgresStorageTransaction extends PostgresStorageClient<PostgresC
|
|
|
251
255
|
selectLock(): boolean;
|
|
252
256
|
atomic<T>(callback: (connection: PostgresStorageTransaction) => PromiseLike<T>, options?: {
|
|
253
257
|
lockTable?: string;
|
|
258
|
+
retry?: boolean;
|
|
254
259
|
}): PromiseLike<T>;
|
|
255
260
|
withTransaction<T>(callback: (connection: PostgresStorageTransaction) => PromiseLike<T>): Promise<T>;
|
|
256
261
|
}
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _ = require('lodash');
|
|
6
|
-
var index = require('../../internals/index-
|
|
6
|
+
var index = require('../../internals/index-CVutVPmd.js');
|
|
7
7
|
var pg = require('pg');
|
|
8
8
|
var QueryStream = require('pg-query-stream');
|
|
9
9
|
var utilsJs = require('@o2ter/utils-js');
|
|
10
10
|
var Decimal = require('decimal.js');
|
|
11
11
|
var utils = require('pg/lib/utils');
|
|
12
|
-
var index$1 = require('../../internals/index-
|
|
12
|
+
var index$1 = require('../../internals/index-CSNRyhjB.js');
|
|
13
13
|
require('@o2ter/crypto-js');
|
|
14
|
-
var random$1 = require('../../internals/random-
|
|
14
|
+
var random$1 = require('../../internals/random-DBDmz54D.js');
|
|
15
15
|
var _private = require('../../internals/private-CSB1Ep4g.js');
|
|
16
16
|
|
|
17
17
|
//
|
|
@@ -2449,6 +2449,9 @@ class PostgresStorageClient extends SqlStorage {
|
|
|
2449
2449
|
withConnection(callback) {
|
|
2450
2450
|
return callback(this);
|
|
2451
2451
|
}
|
|
2452
|
+
isDuplicateIdError(error) {
|
|
2453
|
+
return error.code === '23505' && error.table && error.constraint === `${error.table}_pkey`;
|
|
2454
|
+
}
|
|
2452
2455
|
atomic(callback, options) {
|
|
2453
2456
|
return this.withTransaction(async (conn) => {
|
|
2454
2457
|
if (options?.lockTable)
|
|
@@ -2532,7 +2535,13 @@ class PostgresStorageTransaction extends PostgresStorageClient {
|
|
|
2532
2535
|
return this._selectLock;
|
|
2533
2536
|
}
|
|
2534
2537
|
atomic(callback, options) {
|
|
2535
|
-
|
|
2538
|
+
if (!options?.retry)
|
|
2539
|
+
return callback(this);
|
|
2540
|
+
return this.withTransaction(async (conn) => {
|
|
2541
|
+
if (options?.lockTable)
|
|
2542
|
+
await conn.lockTable(options.lockTable, true);
|
|
2543
|
+
return callback(conn);
|
|
2544
|
+
});
|
|
2536
2545
|
}
|
|
2537
2546
|
async withTransaction(callback) {
|
|
2538
2547
|
const transaction = new PostgresStorageTransaction(this._driver, this.counter + 1, this._selectLock);
|