proto.io 0.0.209 → 0.0.211
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/aliyun-oss.d.ts +3 -3
- package/dist/adapters/file/database.d.ts +2 -2
- package/dist/adapters/file/database.js +1 -1
- package/dist/adapters/file/database.mjs +1 -1
- package/dist/adapters/file/filesystem.d.ts +3 -3
- package/dist/adapters/file/google-cloud-storage.d.ts +3 -3
- package/dist/adapters/storage/progres.d.ts +1 -1
- package/dist/adapters/storage/progres.js +22 -28
- package/dist/adapters/storage/progres.js.map +1 -1
- package/dist/adapters/storage/progres.mjs +22 -28
- package/dist/adapters/storage/progres.mjs.map +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/client.js +2 -1
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +3 -2
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +134 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +127 -16
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{base-DbSaGX_u.d.ts → base-BCWOHUaQ.d.ts} +2 -2
- package/dist/internals/base-BCWOHUaQ.d.ts.map +1 -0
- package/dist/internals/{chunk-bYrnqXiI.d.ts → chunk-2pKgkO5-.d.ts} +3 -3
- package/dist/internals/chunk-2pKgkO5-.d.ts.map +1 -0
- package/dist/internals/const-C3I6cfav.js +42 -0
- package/dist/internals/const-C3I6cfav.js.map +1 -0
- package/dist/internals/const-Dkp7Nsv5.mjs +34 -0
- package/dist/internals/const-Dkp7Nsv5.mjs.map +1 -0
- package/dist/internals/{index-Dx36qTUa.d.ts → index-8AdKlZUU.d.ts} +2 -2
- package/dist/internals/index-8AdKlZUU.d.ts.map +1 -0
- package/dist/internals/index-B8TESzd9.js.map +1 -1
- package/dist/internals/{index-CK1snZyh.js → index-Btxxs0KS.js} +106 -29
- package/dist/internals/index-Btxxs0KS.js.map +1 -0
- package/dist/internals/{index-Eo70ZAdZ.mjs → index-CoeDMG5V.mjs} +101 -20
- package/dist/internals/index-CoeDMG5V.mjs.map +1 -0
- package/dist/internals/{index-CkAvNaAe.js → index-D8O7SinR.js} +50 -3
- package/dist/internals/index-D8O7SinR.js.map +1 -0
- package/dist/internals/{index-DlY33lfO.mjs → index-DPPLcZx8.mjs} +51 -4
- package/dist/internals/index-DPPLcZx8.mjs.map +1 -0
- package/dist/internals/index-al1N-qi7.mjs.map +1 -1
- package/dist/internals/{index-Dn1IkLDx.d.ts → index-lTzbCO8S.d.ts} +24 -1
- package/dist/internals/index-lTzbCO8S.d.ts.map +1 -0
- package/dist/internals/{random-B0V0EnjP.js → random-CyU_Y2Ay.js} +2 -2
- package/dist/internals/{random-B0V0EnjP.js.map → random-CyU_Y2Ay.js.map} +1 -1
- package/dist/internals/{random-ZgzzM5v_.mjs → random-ycCeBd0S.mjs} +2 -2
- package/dist/internals/{random-ZgzzM5v_.mjs.map → random-ycCeBd0S.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/internals/base-DbSaGX_u.d.ts.map +0 -1
- package/dist/internals/chunk-bYrnqXiI.d.ts.map +0 -1
- package/dist/internals/index-CK1snZyh.js.map +0 -1
- package/dist/internals/index-CkAvNaAe.js.map +0 -1
- package/dist/internals/index-DlY33lfO.mjs.map +0 -1
- package/dist/internals/index-Dn1IkLDx.d.ts.map +0 -1
- package/dist/internals/index-Dx36qTUa.d.ts.map +0 -1
- package/dist/internals/index-Eo70ZAdZ.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as ProtoService } from '../../internals/index-
|
|
1
|
+
import { P as ProtoService } from '../../internals/index-lTzbCO8S.js';
|
|
2
2
|
import OSS from 'ali-oss';
|
|
3
|
-
import { a as FileStorageOptions } from '../../internals/base-
|
|
4
|
-
import { F as FileChunkStorageBase } from '../../internals/chunk-
|
|
3
|
+
import { a as FileStorageOptions } from '../../internals/base-BCWOHUaQ.js';
|
|
4
|
+
import { F as FileChunkStorageBase } from '../../internals/chunk-2pKgkO5-.js';
|
|
5
5
|
import '@o2ter/utils-js';
|
|
6
6
|
import 'jsonwebtoken';
|
|
7
7
|
import '@o2ter/server-js';
|
|
@@ -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/base-
|
|
1
|
+
import { T as TSchema, P as ProtoService } from '../../internals/index-lTzbCO8S.js';
|
|
2
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/base-BCWOHUaQ.js';
|
|
3
3
|
import '@o2ter/utils-js';
|
|
4
4
|
import 'jsonwebtoken';
|
|
5
5
|
import '@o2ter/server-js';
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _ = require('lodash');
|
|
6
6
|
var base = require('../../internals/base-NsJYo2MG.js');
|
|
7
7
|
var utilsJs = require('@o2ter/utils-js');
|
|
8
|
-
var index = require('../../internals/index-
|
|
8
|
+
var index = require('../../internals/index-D8O7SinR.js');
|
|
9
9
|
require('util');
|
|
10
10
|
require('zlib');
|
|
11
11
|
require('../../internals/private-Ciddhure.js');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import { F as FileStorageBase } from '../../internals/base-DYc1_peK.mjs';
|
|
3
3
|
import { bufferToBase64, base64ToBuffer } from '@o2ter/utils-js';
|
|
4
|
-
import { Q as QuerySelector } from '../../internals/index-
|
|
4
|
+
import { Q as QuerySelector } from '../../internals/index-DPPLcZx8.mjs';
|
|
5
5
|
import 'util';
|
|
6
6
|
import 'zlib';
|
|
7
7
|
import '../../internals/private-CNw40LZ7.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as ProtoService } from '../../internals/index-
|
|
2
|
-
import { a as FileStorageOptions } from '../../internals/base-
|
|
3
|
-
import { F as FileChunkStorageBase } from '../../internals/chunk-
|
|
1
|
+
import { P as ProtoService } from '../../internals/index-lTzbCO8S.js';
|
|
2
|
+
import { a as FileStorageOptions } from '../../internals/base-BCWOHUaQ.js';
|
|
3
|
+
import { F as FileChunkStorageBase } from '../../internals/chunk-2pKgkO5-.js';
|
|
4
4
|
import '@o2ter/utils-js';
|
|
5
5
|
import 'jsonwebtoken';
|
|
6
6
|
import '@o2ter/server-js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _google_cloud_storage from '@google-cloud/storage';
|
|
2
2
|
import { File, Storage } from '@google-cloud/storage';
|
|
3
|
-
import { P as ProtoService } from '../../internals/index-
|
|
4
|
-
import { a as FileStorageOptions } from '../../internals/base-
|
|
5
|
-
import { F as FileChunkStorageBase } from '../../internals/chunk-
|
|
3
|
+
import { P as ProtoService } from '../../internals/index-lTzbCO8S.js';
|
|
4
|
+
import { a as FileStorageOptions } from '../../internals/base-BCWOHUaQ.js';
|
|
5
|
+
import { F as FileChunkStorageBase } from '../../internals/chunk-2pKgkO5-.js';
|
|
6
6
|
import '@o2ter/utils-js';
|
|
7
7
|
import 'jsonwebtoken';
|
|
8
8
|
import '@o2ter/server-js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Pool, PoolClient, PoolConfig } from 'pg';
|
|
2
|
-
import { a as TValueWithoutObject, T as TSchema, u as TValueWithUndefined, v as TValue, w as TUpdateOp, F as FieldSelectorExpression, Q as QueryExpression, R as RelationOptions, x as QuerySelector, y as DecodedSortOption, z as DecodedQuery, A as FindOptions, I as InsertOptions, B as TStorage, C as TransactionOptions, j as TObject, G as TQueryRandomOptions, H as TPubSub } from '../../internals/index-
|
|
2
|
+
import { a as TValueWithoutObject, T as TSchema, u as TValueWithUndefined, v as TValue, w as TUpdateOp, F as FieldSelectorExpression, Q as QueryExpression, R as RelationOptions, x as QuerySelector, y as DecodedSortOption, z as DecodedQuery, A as FindOptions, I as InsertOptions, B as TStorage, C as TransactionOptions, j as TObject, G as TQueryRandomOptions, H as TPubSub } from '../../internals/index-lTzbCO8S.js';
|
|
3
3
|
import * as _o2ter_utils_js from '@o2ter/utils-js';
|
|
4
4
|
import { asyncStream } from '@o2ter/utils-js';
|
|
5
5
|
import 'jsonwebtoken';
|
|
@@ -9,9 +9,10 @@ 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-D8O7SinR.js');
|
|
13
13
|
require('@o2ter/crypto-js');
|
|
14
|
-
var random$1 = require('../../internals/random-
|
|
14
|
+
var random$1 = require('../../internals/random-CyU_Y2Ay.js');
|
|
15
|
+
var _const = require('../../internals/const-C3I6cfav.js');
|
|
15
16
|
var _private = require('../../internals/private-Ciddhure.js');
|
|
16
17
|
|
|
17
18
|
//
|
|
@@ -1063,24 +1064,24 @@ class PostgresClientDriver {
|
|
|
1063
1064
|
}
|
|
1064
1065
|
async publish(channel, payload) {
|
|
1065
1066
|
await this.withClient(async (db) => {
|
|
1066
|
-
await db.query(`NOTIFY ${
|
|
1067
|
+
await db.query(`NOTIFY ${_const.PROTO_EVENT}, ${quote(JSON.stringify(index._encodeValue({ channel, payload })))}`);
|
|
1067
1068
|
});
|
|
1068
1069
|
}
|
|
1069
1070
|
}
|
|
1070
1071
|
class PostgresPubSub {
|
|
1071
1072
|
client;
|
|
1072
|
-
subscribers =
|
|
1073
|
-
channels = [];
|
|
1073
|
+
subscribers = [];
|
|
1074
1074
|
constructor(client) {
|
|
1075
1075
|
this.client = client;
|
|
1076
1076
|
(async () => {
|
|
1077
1077
|
try {
|
|
1078
|
-
|
|
1079
|
-
|
|
1078
|
+
client = await client;
|
|
1079
|
+
client.on('notification', ({ channel, payload }) => {
|
|
1080
|
+
if (_.toUpper(channel) !== _const.PROTO_EVENT || !payload)
|
|
1080
1081
|
return;
|
|
1081
1082
|
try {
|
|
1082
1083
|
const _payload = index._decodeValue(JSON.parse(payload));
|
|
1083
|
-
for (const subscriber of this.subscribers
|
|
1084
|
+
for (const subscriber of this.subscribers) {
|
|
1084
1085
|
subscriber(_payload);
|
|
1085
1086
|
}
|
|
1086
1087
|
}
|
|
@@ -1088,6 +1089,7 @@ class PostgresPubSub {
|
|
|
1088
1089
|
console.error(`Unknown payload: ${e}`);
|
|
1089
1090
|
}
|
|
1090
1091
|
});
|
|
1092
|
+
await client.query(`LISTEN ${_const.PROTO_EVENT}`);
|
|
1091
1093
|
}
|
|
1092
1094
|
catch (e) {
|
|
1093
1095
|
console.error(e);
|
|
@@ -1097,20 +1099,14 @@ class PostgresPubSub {
|
|
|
1097
1099
|
async shutdown() {
|
|
1098
1100
|
(await this.client).release();
|
|
1099
1101
|
}
|
|
1100
|
-
|
|
1101
|
-
this.
|
|
1102
|
-
await (await this.client).query(`LISTEN ${channel}`);
|
|
1103
|
-
}
|
|
1104
|
-
subscribe(channel, callback) {
|
|
1105
|
-
if (_.isNil(this.subscribers[channel]))
|
|
1106
|
-
this.subscribers[channel] = [];
|
|
1107
|
-
this.subscribers[channel].push(callback);
|
|
1102
|
+
subscribe(callback) {
|
|
1103
|
+
this.subscribers.push(callback);
|
|
1108
1104
|
return () => {
|
|
1109
|
-
this.subscribers
|
|
1105
|
+
this.subscribers = this.subscribers.filter(x => x !== callback);
|
|
1110
1106
|
};
|
|
1111
1107
|
}
|
|
1112
1108
|
isEmpty() {
|
|
1113
|
-
return _.
|
|
1109
|
+
return _.isEmpty(this.subscribers);
|
|
1114
1110
|
}
|
|
1115
1111
|
}
|
|
1116
1112
|
class PostgresDriver extends PostgresClientDriver {
|
|
@@ -1129,14 +1125,9 @@ class PostgresDriver extends PostgresClientDriver {
|
|
|
1129
1125
|
await this.database.end();
|
|
1130
1126
|
}
|
|
1131
1127
|
_init_pubsub() {
|
|
1132
|
-
if (this.pubsub)
|
|
1128
|
+
if (this.pubsub || this.database.ending || this.database.ended)
|
|
1133
1129
|
return;
|
|
1134
|
-
|
|
1135
|
-
this.pubsub = new PostgresPubSub(this.database.connect());
|
|
1136
|
-
}
|
|
1137
|
-
catch (e) {
|
|
1138
|
-
console.error(e);
|
|
1139
|
-
}
|
|
1130
|
+
this.pubsub = new PostgresPubSub(this.database.connect());
|
|
1140
1131
|
}
|
|
1141
1132
|
async _release_pubsub() {
|
|
1142
1133
|
const pubsub = this.pubsub;
|
|
@@ -1145,9 +1136,12 @@ class PostgresDriver extends PostgresClientDriver {
|
|
|
1145
1136
|
}
|
|
1146
1137
|
subscribe(channel, callback) {
|
|
1147
1138
|
this._init_pubsub();
|
|
1148
|
-
if (!
|
|
1149
|
-
|
|
1150
|
-
const release = this.pubsub.subscribe(channel,
|
|
1139
|
+
if (!this.pubsub)
|
|
1140
|
+
return () => void 0;
|
|
1141
|
+
const release = this.pubsub.subscribe(({ channel: _channel, payload }) => {
|
|
1142
|
+
if (_channel === channel)
|
|
1143
|
+
callback(payload);
|
|
1144
|
+
});
|
|
1151
1145
|
return () => {
|
|
1152
1146
|
release();
|
|
1153
1147
|
if (this.pubsub?.isEmpty())
|