proto.io 0.0.225 → 0.0.227
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/filesystem.d.ts +3 -3
- package/dist/adapters/file/google-cloud-storage.d.ts +3 -3
- package/dist/adapters/storage/{progres.d.ts → postgres.d.ts} +2 -2
- package/dist/adapters/storage/postgres.d.ts.map +1 -0
- package/dist/adapters/storage/{progres.js → postgres.js} +1 -1
- package/dist/adapters/storage/postgres.js.map +1 -0
- package/dist/adapters/storage/{progres.mjs → postgres.mjs} +1 -1
- package/dist/adapters/storage/postgres.mjs.map +1 -0
- package/dist/client.d.ts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +42 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -14
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{base-DPYj2_4S.d.ts → base-DSo02iAX.d.ts} +2 -2
- package/dist/internals/{base-DPYj2_4S.d.ts.map → base-DSo02iAX.d.ts.map} +1 -1
- package/dist/internals/{chunk-B9XHpR52.d.ts → chunk-BhwfdCdq.d.ts} +3 -3
- package/dist/internals/{chunk-B9XHpR52.d.ts.map → chunk-BhwfdCdq.d.ts.map} +1 -1
- package/dist/internals/{index-Bi9H_aYC.d.ts → index-1ZK5N4yb.d.ts} +2 -2
- package/dist/internals/{index-Bi9H_aYC.d.ts.map → index-1ZK5N4yb.d.ts.map} +1 -1
- package/dist/internals/{index-y_bUWp3C.d.ts → index-Cj45GkKv.d.ts} +2 -2
- package/dist/internals/{index-y_bUWp3C.d.ts.map → index-Cj45GkKv.d.ts.map} +1 -1
- package/package.json +1 -1
- package/dist/adapters/storage/progres.d.ts.map +0 -1
- package/dist/adapters/storage/progres.js.map +0 -1
- package/dist/adapters/storage/progres.mjs.map +0 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as ProtoClient } from './internals/index-
|
|
2
|
-
export { c as classExtends } from './internals/index-
|
|
3
|
-
export { D as DeserializeOptions, S as SerializeOptions, e as TNumber, f as TSerializable, g as deserialize, s as serialize } from './internals/index-
|
|
1
|
+
import { P as ProtoClient } from './internals/index-Cj45GkKv.js';
|
|
2
|
+
export { c as classExtends } from './internals/index-Cj45GkKv.js';
|
|
3
|
+
export { D as DeserializeOptions, S as SerializeOptions, e as TNumber, f as TSerializable, g as deserialize, s as serialize } from './internals/index-1ZK5N4yb.js';
|
|
4
4
|
export { Decimal } from 'decimal.js';
|
|
5
5
|
import '@o2ter/utils-js';
|
|
6
6
|
import 'socket.io-client';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as socket_io from 'socket.io';
|
|
2
2
|
import { Router } from 'express';
|
|
3
3
|
import { Server } from '@o2ter/server-js';
|
|
4
|
-
import { P as ProtoService, a as ProtoServiceOptions, b as ProtoServiceKeyOptions, T as TSchema, c as TValueWithoutObject } from './internals/index-
|
|
5
|
-
export { D as DeserializeOptions, S as SerializeOptions, d as TFileStorage, e as TNumber, f as TSerializable, g as deserialize, s as serialize } from './internals/index-
|
|
4
|
+
import { P as ProtoService, a as ProtoServiceOptions, b as ProtoServiceKeyOptions, T as TSchema, c as TValueWithoutObject } from './internals/index-1ZK5N4yb.js';
|
|
5
|
+
export { D as DeserializeOptions, S as SerializeOptions, d as TFileStorage, e as TNumber, f as TSerializable, g as deserialize, s as serialize } from './internals/index-1ZK5N4yb.js';
|
|
6
6
|
import Decimal from 'decimal.js';
|
|
7
7
|
export { Decimal } from 'decimal.js';
|
|
8
|
-
export { P as ProtoClient, c as classExtends } from './internals/index-
|
|
8
|
+
export { P as ProtoClient, c as classExtends } from './internals/index-Cj45GkKv.js';
|
|
9
9
|
import '@o2ter/utils-js';
|
|
10
10
|
import 'jsonwebtoken';
|
|
11
11
|
import 'lodash';
|
package/dist/index.js
CHANGED
|
@@ -265,6 +265,7 @@ const proxy = (x) => {
|
|
|
265
265
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
266
266
|
// THE SOFTWARE.
|
|
267
267
|
//
|
|
268
|
+
const afterCommitTasks = new WeakMap();
|
|
268
269
|
class _ProtoQuery extends index.TQuery {
|
|
269
270
|
_proto;
|
|
270
271
|
_opts;
|
|
@@ -383,6 +384,15 @@ class _ProtoQuery extends index.TQuery {
|
|
|
383
384
|
})();
|
|
384
385
|
}
|
|
385
386
|
}
|
|
387
|
+
_do_tasks(session, task) {
|
|
388
|
+
const registers = session && afterCommitTasks.get(session);
|
|
389
|
+
if (!_.isNil(registers)) {
|
|
390
|
+
registers.push(task);
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
task();
|
|
394
|
+
}
|
|
395
|
+
}
|
|
386
396
|
async insertMany(values, options) {
|
|
387
397
|
const objs = this._objectMethods(await this._dispatcher(options).insert({
|
|
388
398
|
className: this.className,
|
|
@@ -390,30 +400,38 @@ class _ProtoQuery extends index.TQuery {
|
|
|
390
400
|
matches: this[_private.PVK].options.matches,
|
|
391
401
|
groupMatches: this[_private.PVK].options.groupMatches,
|
|
392
402
|
}, values));
|
|
393
|
-
this.
|
|
394
|
-
|
|
395
|
-
|
|
403
|
+
this._do_tasks(options?.session, () => {
|
|
404
|
+
this._on_upsert(objs);
|
|
405
|
+
if (!options?.silent || !options.master)
|
|
406
|
+
this._on_upsert_traggers(objs);
|
|
407
|
+
});
|
|
396
408
|
return objs;
|
|
397
409
|
}
|
|
398
410
|
async updateMany(update, options) {
|
|
399
411
|
const objs = this._objectMethods(await this._dispatcher(options).update(this._queryOptions, update));
|
|
400
|
-
this.
|
|
401
|
-
|
|
402
|
-
|
|
412
|
+
this._do_tasks(options?.session, () => {
|
|
413
|
+
this._on_upsert(objs);
|
|
414
|
+
if (!options?.silent || !options.master)
|
|
415
|
+
this._on_upsert_traggers(objs);
|
|
416
|
+
});
|
|
403
417
|
return objs;
|
|
404
418
|
}
|
|
405
419
|
async upsertMany(update, setOnInsert, options) {
|
|
406
420
|
const objs = this._objectMethods(await this._dispatcher(options).upsert(this._queryOptions, update, setOnInsert));
|
|
407
|
-
this.
|
|
408
|
-
|
|
409
|
-
|
|
421
|
+
this._do_tasks(options?.session, () => {
|
|
422
|
+
this._on_upsert(objs);
|
|
423
|
+
if (!options?.silent || !options.master)
|
|
424
|
+
this._on_upsert_traggers(objs);
|
|
425
|
+
});
|
|
410
426
|
return objs;
|
|
411
427
|
}
|
|
412
428
|
async deleteMany(options) {
|
|
413
429
|
const objs = this._objectMethods(await this._dispatcher(options).delete(this._queryOptions));
|
|
414
|
-
this.
|
|
415
|
-
|
|
416
|
-
|
|
430
|
+
this._do_tasks(options?.session, () => {
|
|
431
|
+
this._on_delete(objs);
|
|
432
|
+
if (!options?.silent || !options.master)
|
|
433
|
+
this._on_delete_traggers(objs);
|
|
434
|
+
});
|
|
417
435
|
return objs;
|
|
418
436
|
}
|
|
419
437
|
}
|
|
@@ -1749,8 +1767,18 @@ class ProtoService extends index.ProtoType {
|
|
|
1749
1767
|
lockTable(className, update) {
|
|
1750
1768
|
return this.storage.lockTable(className, update);
|
|
1751
1769
|
}
|
|
1752
|
-
withTransaction(callback, options) {
|
|
1753
|
-
|
|
1770
|
+
async withTransaction(callback, options) {
|
|
1771
|
+
const tasks = afterCommitTasks.get(this) ?? [];
|
|
1772
|
+
const result = await this.storage.withTransaction((storage) => {
|
|
1773
|
+
const payload = _.create(this, { _storage: storage });
|
|
1774
|
+
afterCommitTasks.set(payload, tasks);
|
|
1775
|
+
return callback(payload);
|
|
1776
|
+
}, options);
|
|
1777
|
+
if (!afterCommitTasks.has(this)) {
|
|
1778
|
+
for (const task of tasks)
|
|
1779
|
+
task();
|
|
1780
|
+
}
|
|
1781
|
+
return result;
|
|
1754
1782
|
}
|
|
1755
1783
|
generateUploadToken(options = {}) {
|
|
1756
1784
|
return this[_private.PVK].jwtSign({
|