proto.io 0.0.205 → 0.0.206

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.
Files changed (54) hide show
  1. package/dist/adapters/file/aliyun-oss.d.ts +3 -3
  2. package/dist/adapters/file/database.d.ts +2 -2
  3. package/dist/adapters/file/database.js +2 -2
  4. package/dist/adapters/file/database.mjs +2 -2
  5. package/dist/adapters/file/filesystem.d.ts +3 -3
  6. package/dist/adapters/file/google-cloud-storage.d.ts +3 -3
  7. package/dist/adapters/storage/progres.d.ts +5 -8
  8. package/dist/adapters/storage/progres.js +13 -17
  9. package/dist/adapters/storage/progres.js.map +1 -1
  10. package/dist/adapters/storage/progres.mjs +13 -17
  11. package/dist/adapters/storage/progres.mjs.map +1 -1
  12. package/dist/client.d.ts +3 -3
  13. package/dist/client.js +3 -2
  14. package/dist/client.js.map +1 -1
  15. package/dist/client.mjs +4 -3
  16. package/dist/client.mjs.map +1 -1
  17. package/dist/index.d.ts +3 -3
  18. package/dist/index.js +30 -11
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.mjs +31 -12
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/internals/{base-Cf7WkDhO.d.ts → base-Be7PFKEC.d.ts} +2 -2
  23. package/dist/internals/base-Be7PFKEC.d.ts.map +1 -0
  24. package/dist/internals/{chunk-ONaLyXL0.d.ts → chunk-CEQtSsWb.d.ts} +3 -3
  25. package/dist/internals/chunk-CEQtSsWb.d.ts.map +1 -0
  26. package/dist/internals/{index-DByHjIHI.js → index-BFZlY3IO.js} +23 -23
  27. package/dist/internals/index-BFZlY3IO.js.map +1 -0
  28. package/dist/internals/{index-DtCgllhg.mjs → index-CSnRU_KQ.mjs} +23 -23
  29. package/dist/internals/index-CSnRU_KQ.mjs.map +1 -0
  30. package/dist/internals/{index-DI-jPA6f.d.ts → index-CURcwPBG.d.ts} +3 -3
  31. package/dist/internals/index-CURcwPBG.d.ts.map +1 -0
  32. package/dist/internals/{index-B8TESzd9.js → index-CsmAYB_t.js} +2 -1
  33. package/dist/internals/{index-B8TESzd9.js.map → index-CsmAYB_t.js.map} +1 -1
  34. package/dist/internals/{index-C4vwSN74.js → index-CyPxh5dl.js} +241 -2
  35. package/dist/internals/index-CyPxh5dl.js.map +1 -0
  36. package/dist/internals/{index-JdEs5VLY.d.ts → index-DnbbpIaO.d.ts} +15 -18
  37. package/dist/internals/index-DnbbpIaO.d.ts.map +1 -0
  38. package/dist/internals/{index-al1N-qi7.mjs → index-DpN9tcbY.mjs} +2 -2
  39. package/dist/internals/{index-al1N-qi7.mjs.map → index-DpN9tcbY.mjs.map} +1 -1
  40. package/dist/internals/{index-Blw7vAq5.mjs → index-iRVgw566.mjs} +241 -2
  41. package/dist/internals/index-iRVgw566.mjs.map +1 -0
  42. package/dist/internals/{random-6nHcBOxn.mjs → random-BnGB_bVS.mjs} +3 -3
  43. package/dist/internals/{random-6nHcBOxn.mjs.map → random-BnGB_bVS.mjs.map} +1 -1
  44. package/dist/internals/{random-Dk3OhDNU.js → random-D7S1XD7F.js} +3 -3
  45. package/dist/internals/{random-Dk3OhDNU.js.map → random-D7S1XD7F.js.map} +1 -1
  46. package/package.json +1 -1
  47. package/dist/internals/base-Cf7WkDhO.d.ts.map +0 -1
  48. package/dist/internals/chunk-ONaLyXL0.d.ts.map +0 -1
  49. package/dist/internals/index-Blw7vAq5.mjs.map +0 -1
  50. package/dist/internals/index-C4vwSN74.js.map +0 -1
  51. package/dist/internals/index-DByHjIHI.js.map +0 -1
  52. package/dist/internals/index-DI-jPA6f.d.ts.map +0 -1
  53. package/dist/internals/index-DtCgllhg.mjs.map +0 -1
  54. package/dist/internals/index-JdEs5VLY.d.ts.map +0 -1
package/dist/client.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { P as ProtoClient } from './internals/index-DI-jPA6f.js';
2
- export { c as classExtends, e as isFile, f as isJob, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-DI-jPA6f.js';
1
+ import { P as ProtoClient } from './internals/index-CURcwPBG.js';
2
+ export { c as classExtends, e as isFile, f as isJob, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-CURcwPBG.js';
3
3
  export { Decimal } from 'decimal.js';
4
- export { D as DeserializeOptions, S as SerializeOptions, e as TSerializable, f as deserialize, s as serialize } from './internals/index-JdEs5VLY.js';
4
+ export { D as DeserializeOptions, S as SerializeOptions, e as TNumber, f as TSerializable, g as deserialize, s as serialize } from './internals/index-DnbbpIaO.js';
5
5
  import '@o2ter/utils-js';
6
6
  import 'socket.io-client';
7
7
  import '@socket.io/component-emitter';
package/dist/client.js CHANGED
@@ -2,15 +2,16 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./internals/index-DByHjIHI.js');
5
+ var index = require('./internals/index-BFZlY3IO.js');
6
6
  var Decimal = require('decimal.js');
7
7
  require('@o2ter/utils-js');
8
8
  require('./internals/private-Ciddhure.js');
9
9
  require('lodash');
10
- require('./internals/index-B8TESzd9.js');
10
+ require('./internals/index-CsmAYB_t.js');
11
11
  require('axios');
12
12
  require('@o2ter/server-js/dist/const');
13
13
  require('socket.io-client');
14
+ require('@o2ter/crypto-js');
14
15
 
15
16
  //
16
17
  // index.ts
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sources":["../../src/client/index.ts"],"sourcesContent":["//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { ProtoClient } from './proto';\n\nexport * from '../common';\n\nexport { ProtoClient };\n\nexport default ProtoClient;"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"client.js","sources":["../../src/client/index.ts"],"sourcesContent":["//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { ProtoClient } from './proto';\n\nexport * from '../common';\n\nexport { ProtoClient };\n\nexport default ProtoClient;"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;"}
package/dist/client.mjs CHANGED
@@ -1,13 +1,14 @@
1
- import { e as ProtoClient } from './internals/index-DtCgllhg.mjs';
2
- export { f as classExtends, d as deserialize, k as isFile, l as isJob, g as isObject, i as isQuery, j as isRole, h as isUser, s as serialize } from './internals/index-DtCgllhg.mjs';
1
+ import { e as ProtoClient } from './internals/index-CSnRU_KQ.mjs';
2
+ export { f as classExtends, d as deserialize, k as isFile, l as isJob, g as isObject, i as isQuery, j as isRole, h as isUser, s as serialize } from './internals/index-CSnRU_KQ.mjs';
3
3
  export { Decimal } from 'decimal.js';
4
4
  import '@o2ter/utils-js';
5
5
  import './internals/private-CNw40LZ7.mjs';
6
6
  import 'lodash';
7
- import './internals/index-al1N-qi7.mjs';
7
+ import './internals/index-DpN9tcbY.mjs';
8
8
  import 'axios';
9
9
  import '@o2ter/server-js/dist/const';
10
10
  import 'socket.io-client';
11
+ import '@o2ter/crypto-js';
11
12
 
12
13
  //
13
14
  // index.ts
@@ -1 +1 @@
1
- {"version":3,"file":"client.mjs","sources":["../../src/client/index.ts"],"sourcesContent":["//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { ProtoClient } from './proto';\n\nexport * from '../common';\n\nexport { ProtoClient };\n\nexport default ProtoClient;"],"names":[],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
1
+ {"version":3,"file":"client.mjs","sources":["../../src/client/index.ts"],"sourcesContent":["//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { ProtoClient } from './proto';\n\nexport * from '../common';\n\nexport { ProtoClient };\n\nexport default ProtoClient;"],"names":[],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
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 { T as TSchema, a as TValueWithoutObject, P as ProtoService, b as ProtoServiceOptions, c as ProtoServiceKeyOptions } from './internals/index-JdEs5VLY.js';
5
- export { D as DeserializeOptions, S as SerializeOptions, d as TFileStorage, e as TSerializable, f as deserialize, s as serialize } from './internals/index-JdEs5VLY.js';
4
+ import { T as TSchema, a as TValueWithoutObject, P as ProtoService, b as ProtoServiceOptions, c as ProtoServiceKeyOptions } from './internals/index-DnbbpIaO.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-DnbbpIaO.js';
6
6
  import Decimal from 'decimal.js';
7
7
  export { Decimal } from 'decimal.js';
8
- export { P as ProtoClient, c as classExtends, e as isFile, f as isJob, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-DI-jPA6f.js';
8
+ export { P as ProtoClient, c as classExtends, e as isFile, f as isJob, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-CURcwPBG.js';
9
9
  import '@o2ter/utils-js';
10
10
  import 'jsonwebtoken';
11
11
  import 'lodash';
package/dist/index.js CHANGED
@@ -4,11 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _ = require('lodash');
6
6
  var serverJs = require('@o2ter/server-js');
7
- var random = require('./internals/random-Dk3OhDNU.js');
7
+ var random = require('./internals/random-D7S1XD7F.js');
8
8
  var _private = require('./internals/private-Ciddhure.js');
9
9
  var utilsJs = require('@o2ter/utils-js');
10
- var index = require('./internals/index-DByHjIHI.js');
11
- var index$1 = require('./internals/index-B8TESzd9.js');
10
+ var index = require('./internals/index-BFZlY3IO.js');
11
+ var index$1 = require('./internals/index-CsmAYB_t.js');
12
12
  var jwt = require('jsonwebtoken');
13
13
  var node_buffer = require('node:buffer');
14
14
  var node_stream = require('node:stream');
@@ -16,7 +16,7 @@ var node_crypto = require('node:crypto');
16
16
  var util = require('util');
17
17
  var cryptoJs = require('@o2ter/crypto-js');
18
18
  var Decimal = require('decimal.js');
19
- var index$2 = require('./internals/index-C4vwSN74.js');
19
+ var index$2 = require('./internals/index-CyPxh5dl.js');
20
20
  var queryType = require('query-types');
21
21
  var busboy = require('busboy');
22
22
  require('axios');
@@ -358,18 +358,18 @@ class _ProtoQuery extends index.TQuery {
358
358
  return result;
359
359
  }
360
360
  async insertMany(values, options) {
361
- return this._dispatcher(options).insertMany({
361
+ return this._objectMethods(await this._dispatcher(options).insertMany({
362
362
  className: this.className,
363
363
  includes: this[_private.PVK].options.includes,
364
364
  matches: this[_private.PVK].options.matches,
365
365
  countMatches: this[_private.PVK].options.countMatches,
366
- }, values);
366
+ }, values));
367
367
  }
368
368
  async updateOne(update, options) {
369
369
  return this._objectMethods(await this._dispatcher(options).updateOne(this._queryOptions, update));
370
370
  }
371
371
  async updateMany(update, options) {
372
- return this._dispatcher(options).updateMany(this._queryOptions, update);
372
+ return this._objectMethods(await this._dispatcher(options).updateMany(this._queryOptions, update));
373
373
  }
374
374
  async upsertOne(update, setOnInsert, options) {
375
375
  const result = this._objectMethods(await this._dispatcher(options).upsertOne(this._queryOptions, update, setOnInsert));
@@ -378,13 +378,13 @@ class _ProtoQuery extends index.TQuery {
378
378
  return result;
379
379
  }
380
380
  async upsertMany(update, setOnInsert, options) {
381
- return this._dispatcher(options).upsertMany(this._queryOptions, update, setOnInsert);
381
+ return this._objectMethods(await this._dispatcher(options).upsertMany(this._queryOptions, update, setOnInsert));
382
382
  }
383
383
  async deleteOne(options) {
384
384
  return this._objectMethods(await this._dispatcher(options).deleteOne(this._queryOptions));
385
385
  }
386
386
  async deleteMany(options) {
387
- return this._dispatcher(options).deleteMany(this._queryOptions);
387
+ return this._objectMethods(await this._dispatcher(options).deleteMany(this._queryOptions));
388
388
  }
389
389
  }
390
390
  class ProtoQuery extends _ProtoQuery {
@@ -1643,8 +1643,11 @@ class ProtoService extends index.ProtoType {
1643
1643
  notify(data) {
1644
1644
  return this[_private.PVK].notify(this, data);
1645
1645
  }
1646
- listen(callback) {
1646
+ listen(callback, selector) {
1647
+ const _selector = !_.isNil(selector) ? index$2.QuerySelector.decode(selector) : undefined;
1647
1648
  return this[_private.PVK].listen(this, data => {
1649
+ if (_selector && !_selector.eval(data))
1650
+ return;
1648
1651
  callback(data);
1649
1652
  });
1650
1653
  }
@@ -2516,10 +2519,13 @@ const ProtoRoute = async (options) => {
2516
2519
  const registerProtoSocket = (proto, server, endpoint) => {
2517
2520
  const io = endpoint ? server.socket().of(endpoint) : server.socket();
2518
2521
  io.on('connection', async (socket) => {
2522
+ let listeners = {};
2519
2523
  const connect = async (token) => {
2520
2524
  const payload = await proto.connectWithSessionToken(token);
2521
2525
  const { remove } = payload.listen(data => {
2522
- socket.emit('data', data);
2526
+ const ids = _.keys(_.pickBy(listeners, v => v instanceof index$2.QuerySelector ? v.eval(data) : v));
2527
+ if (!_.isEmpty(ids))
2528
+ socket.emit('data', { ids, data });
2523
2529
  });
2524
2530
  return remove;
2525
2531
  };
@@ -2532,6 +2538,19 @@ const registerProtoSocket = (proto, server, endpoint) => {
2532
2538
  socket.on('disconnect', () => {
2533
2539
  remove.then(rm => rm());
2534
2540
  });
2541
+ socket.on('register', (payload) => {
2542
+ listeners = _.mapValues(payload, v => {
2543
+ if (_.isBoolean(v))
2544
+ return true;
2545
+ try {
2546
+ return index$2.QuerySelector.decode(v);
2547
+ }
2548
+ catch (error) {
2549
+ console.error(error);
2550
+ return false;
2551
+ }
2552
+ });
2553
+ });
2535
2554
  });
2536
2555
  return io;
2537
2556
  };