proto.io 0.0.204 → 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 (68) hide show
  1. package/dist/adapters/file/aliyun-oss.d.ts +3 -3
  2. package/dist/adapters/file/aliyun-oss.js +2 -2
  3. package/dist/adapters/file/aliyun-oss.mjs +2 -2
  4. package/dist/adapters/file/database.d.ts +2 -2
  5. package/dist/adapters/file/database.js +3 -3
  6. package/dist/adapters/file/database.mjs +3 -3
  7. package/dist/adapters/file/filesystem.d.ts +3 -3
  8. package/dist/adapters/file/filesystem.js +2 -2
  9. package/dist/adapters/file/filesystem.mjs +2 -2
  10. package/dist/adapters/file/google-cloud-storage.d.ts +3 -3
  11. package/dist/adapters/file/google-cloud-storage.js +2 -2
  12. package/dist/adapters/file/google-cloud-storage.mjs +2 -2
  13. package/dist/adapters/storage/progres.d.ts +5 -8
  14. package/dist/adapters/storage/progres.js +13 -17
  15. package/dist/adapters/storage/progres.js.map +1 -1
  16. package/dist/adapters/storage/progres.mjs +13 -17
  17. package/dist/adapters/storage/progres.mjs.map +1 -1
  18. package/dist/client.d.ts +3 -3
  19. package/dist/client.js +3 -2
  20. package/dist/client.js.map +1 -1
  21. package/dist/client.mjs +4 -3
  22. package/dist/client.mjs.map +1 -1
  23. package/dist/index.d.ts +3 -3
  24. package/dist/index.js +33 -12
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +34 -13
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/internals/{base-NsJYo2MG.js → base-BFKQpiws.js} +3 -3
  29. package/dist/internals/{base-NsJYo2MG.js.map → base-BFKQpiws.js.map} +1 -1
  30. package/dist/internals/{base-Cf7WkDhO.d.ts → base-Be7PFKEC.d.ts} +2 -2
  31. package/dist/internals/base-Be7PFKEC.d.ts.map +1 -0
  32. package/dist/internals/{base-DYc1_peK.mjs → base-CfQi0T0I.mjs} +3 -3
  33. package/dist/internals/{base-DYc1_peK.mjs.map → base-CfQi0T0I.mjs.map} +1 -1
  34. package/dist/internals/{chunk-CdEGTub2.js → chunk-BuMQw4dz.js} +2 -2
  35. package/dist/internals/{chunk-CdEGTub2.js.map → chunk-BuMQw4dz.js.map} +1 -1
  36. package/dist/internals/{chunk-ONaLyXL0.d.ts → chunk-CEQtSsWb.d.ts} +3 -3
  37. package/dist/internals/chunk-CEQtSsWb.d.ts.map +1 -0
  38. package/dist/internals/{chunk-3nNdftWC.mjs → chunk-DxYhYVky.mjs} +2 -2
  39. package/dist/internals/{chunk-3nNdftWC.mjs.map → chunk-DxYhYVky.mjs.map} +1 -1
  40. package/dist/internals/{index-DByHjIHI.js → index-BFZlY3IO.js} +23 -23
  41. package/dist/internals/index-BFZlY3IO.js.map +1 -0
  42. package/dist/internals/{index-DtCgllhg.mjs → index-CSnRU_KQ.mjs} +23 -23
  43. package/dist/internals/index-CSnRU_KQ.mjs.map +1 -0
  44. package/dist/internals/{index-DI-jPA6f.d.ts → index-CURcwPBG.d.ts} +3 -3
  45. package/dist/internals/index-CURcwPBG.d.ts.map +1 -0
  46. package/dist/internals/{index-B8TESzd9.js → index-CsmAYB_t.js} +2 -1
  47. package/dist/internals/{index-B8TESzd9.js.map → index-CsmAYB_t.js.map} +1 -1
  48. package/dist/internals/{index-C4vwSN74.js → index-CyPxh5dl.js} +241 -2
  49. package/dist/internals/index-CyPxh5dl.js.map +1 -0
  50. package/dist/internals/{index-JdEs5VLY.d.ts → index-DnbbpIaO.d.ts} +15 -18
  51. package/dist/internals/index-DnbbpIaO.d.ts.map +1 -0
  52. package/dist/internals/{index-al1N-qi7.mjs → index-DpN9tcbY.mjs} +2 -2
  53. package/dist/internals/{index-al1N-qi7.mjs.map → index-DpN9tcbY.mjs.map} +1 -1
  54. package/dist/internals/{index-Blw7vAq5.mjs → index-iRVgw566.mjs} +241 -2
  55. package/dist/internals/index-iRVgw566.mjs.map +1 -0
  56. package/dist/internals/{random-6nHcBOxn.mjs → random-BnGB_bVS.mjs} +3 -3
  57. package/dist/internals/{random-6nHcBOxn.mjs.map → random-BnGB_bVS.mjs.map} +1 -1
  58. package/dist/internals/{random-Dk3OhDNU.js → random-D7S1XD7F.js} +3 -3
  59. package/dist/internals/{random-Dk3OhDNU.js.map → random-D7S1XD7F.js.map} +1 -1
  60. package/package.json +1 -1
  61. package/dist/internals/base-Cf7WkDhO.d.ts.map +0 -1
  62. package/dist/internals/chunk-ONaLyXL0.d.ts.map +0 -1
  63. package/dist/internals/index-Blw7vAq5.mjs.map +0 -1
  64. package/dist/internals/index-C4vwSN74.js.map +0 -1
  65. package/dist/internals/index-DByHjIHI.js.map +0 -1
  66. package/dist/internals/index-DI-jPA6f.d.ts.map +0 -1
  67. package/dist/internals/index-DtCgllhg.mjs.map +0 -1
  68. package/dist/internals/index-JdEs5VLY.d.ts.map +0 -1
@@ -1,7 +1,7 @@
1
- import { P as ProtoService } from '../../internals/index-JdEs5VLY.js';
1
+ import { P as ProtoService } from '../../internals/index-DnbbpIaO.js';
2
2
  import OSS from 'ali-oss';
3
- import { a as FileStorageOptions } from '../../internals/base-Cf7WkDhO.js';
4
- import { F as FileChunkStorageBase } from '../../internals/chunk-ONaLyXL0.js';
3
+ import { a as FileStorageOptions } from '../../internals/base-Be7PFKEC.js';
4
+ import { F as FileChunkStorageBase } from '../../internals/chunk-CEQtSsWb.js';
5
5
  import '@o2ter/utils-js';
6
6
  import 'jsonwebtoken';
7
7
  import '@o2ter/server-js';
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _ = require('lodash');
6
- require('../../internals/base-NsJYo2MG.js');
7
- var chunk = require('../../internals/chunk-CdEGTub2.js');
6
+ require('../../internals/base-BFKQpiws.js');
7
+ var chunk = require('../../internals/chunk-BuMQw4dz.js');
8
8
  require('util');
9
9
  require('zlib');
10
10
  require('@o2ter/utils-js');
@@ -1,6 +1,6 @@
1
1
  import _ from 'lodash';
2
- import '../../internals/base-DYc1_peK.mjs';
3
- import { F as FileChunkStorageBase } from '../../internals/chunk-3nNdftWC.mjs';
2
+ import '../../internals/base-CfQi0T0I.mjs';
3
+ import { F as FileChunkStorageBase } from '../../internals/chunk-DxYhYVky.mjs';
4
4
  import 'util';
5
5
  import 'zlib';
6
6
  import '@o2ter/utils-js';
@@ -1,5 +1,5 @@
1
- import { T as TSchema, P as ProtoService } from '../../internals/index-JdEs5VLY.js';
2
- import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/base-Cf7WkDhO.js';
1
+ import { T as TSchema, P as ProtoService } from '../../internals/index-DnbbpIaO.js';
2
+ import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/base-Be7PFKEC.js';
3
3
  import '@o2ter/utils-js';
4
4
  import 'jsonwebtoken';
5
5
  import '@o2ter/server-js';
@@ -3,13 +3,13 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _ = require('lodash');
6
- var base = require('../../internals/base-NsJYo2MG.js');
7
- var index = require('../../internals/index-C4vwSN74.js');
6
+ var base = require('../../internals/base-BFKQpiws.js');
7
+ var index = require('../../internals/index-CyPxh5dl.js');
8
8
  var utilsJs = require('@o2ter/utils-js');
9
9
  require('util');
10
10
  require('zlib');
11
11
  require('../../internals/private-Ciddhure.js');
12
- require('../../internals/index-B8TESzd9.js');
12
+ require('../../internals/index-CsmAYB_t.js');
13
13
  require('decimal.js');
14
14
 
15
15
  //
@@ -1,11 +1,11 @@
1
1
  import _ from 'lodash';
2
- import { F as FileStorageBase } from '../../internals/base-DYc1_peK.mjs';
3
- import { Q as QuerySelector } from '../../internals/index-Blw7vAq5.mjs';
2
+ import { F as FileStorageBase } from '../../internals/base-CfQi0T0I.mjs';
3
+ import { Q as QuerySelector } from '../../internals/index-iRVgw566.mjs';
4
4
  import { bufferToBase64, base64ToBuffer } from '@o2ter/utils-js';
5
5
  import 'util';
6
6
  import 'zlib';
7
7
  import '../../internals/private-CNw40LZ7.mjs';
8
- import '../../internals/index-al1N-qi7.mjs';
8
+ import '../../internals/index-DpN9tcbY.mjs';
9
9
  import 'decimal.js';
10
10
 
11
11
  //
@@ -1,6 +1,6 @@
1
- import { P as ProtoService } from '../../internals/index-JdEs5VLY.js';
2
- import { a as FileStorageOptions } from '../../internals/base-Cf7WkDhO.js';
3
- import { F as FileChunkStorageBase } from '../../internals/chunk-ONaLyXL0.js';
1
+ import { P as ProtoService } from '../../internals/index-DnbbpIaO.js';
2
+ import { a as FileStorageOptions } from '../../internals/base-Be7PFKEC.js';
3
+ import { F as FileChunkStorageBase } from '../../internals/chunk-CEQtSsWb.js';
4
4
  import '@o2ter/utils-js';
5
5
  import 'jsonwebtoken';
6
6
  import '@o2ter/server-js';
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _ = require('lodash');
6
6
  var path = require('path');
7
7
  var fs = require('fs/promises');
8
- var chunk = require('../../internals/chunk-CdEGTub2.js');
9
- require('../../internals/base-NsJYo2MG.js');
8
+ var chunk = require('../../internals/chunk-BuMQw4dz.js');
9
+ require('../../internals/base-BFKQpiws.js');
10
10
  require('util');
11
11
  require('zlib');
12
12
  require('@o2ter/utils-js');
@@ -1,8 +1,8 @@
1
1
  import _ from 'lodash';
2
2
  import path from 'path';
3
3
  import fs from 'fs/promises';
4
- import { F as FileChunkStorageBase } from '../../internals/chunk-3nNdftWC.mjs';
5
- import '../../internals/base-DYc1_peK.mjs';
4
+ import { F as FileChunkStorageBase } from '../../internals/chunk-DxYhYVky.mjs';
5
+ import '../../internals/base-CfQi0T0I.mjs';
6
6
  import 'util';
7
7
  import 'zlib';
8
8
  import '@o2ter/utils-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-JdEs5VLY.js';
4
- import { a as FileStorageOptions } from '../../internals/base-Cf7WkDhO.js';
5
- import { F as FileChunkStorageBase } from '../../internals/chunk-ONaLyXL0.js';
3
+ import { P as ProtoService } from '../../internals/index-DnbbpIaO.js';
4
+ import { a as FileStorageOptions } from '../../internals/base-Be7PFKEC.js';
5
+ import { F as FileChunkStorageBase } from '../../internals/chunk-CEQtSsWb.js';
6
6
  import '@o2ter/utils-js';
7
7
  import 'jsonwebtoken';
8
8
  import '@o2ter/server-js';
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _ = require('lodash');
6
- var chunk = require('../../internals/chunk-CdEGTub2.js');
7
- require('../../internals/base-NsJYo2MG.js');
6
+ var chunk = require('../../internals/chunk-BuMQw4dz.js');
7
+ require('../../internals/base-BFKQpiws.js');
8
8
  require('util');
9
9
  require('zlib');
10
10
  require('@o2ter/utils-js');
@@ -1,6 +1,6 @@
1
1
  import _ from 'lodash';
2
- import { F as FileChunkStorageBase } from '../../internals/chunk-3nNdftWC.mjs';
3
- import '../../internals/base-DYc1_peK.mjs';
2
+ import { F as FileChunkStorageBase } from '../../internals/chunk-DxYhYVky.mjs';
3
+ import '../../internals/base-CfQi0T0I.mjs';
4
4
  import 'util';
5
5
  import 'zlib';
6
6
  import '@o2ter/utils-js';
@@ -1,5 +1,5 @@
1
1
  import { Pool, PoolClient, PoolConfig } from 'pg';
2
- import { a as TValueWithoutObject, T as TSchema, r as TValueWithUndefined, t as TValue, u as TUpdateOp, F as FieldSelectorExpression, Q as QueryExpression, R as RelationOptions, v as QuerySelector, w as DecodedSortOption, x as DecodedQuery, y as FindOptions, I as InsertOptions, z as FindOneOptions, A as TStorage, B as TransactionOptions, i as TObject, C as TQueryRandomOptions, G as TPubSub } from '../../internals/index-JdEs5VLY.js';
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 FindOneOptions, C as TStorage, G as TransactionOptions, j as TObject, H as TQueryRandomOptions, J as TPubSub } from '../../internals/index-DnbbpIaO.js';
3
3
  import * as _o2ter_utils_js from '@o2ter/utils-js';
4
4
  import { asyncStream } from '@o2ter/utils-js';
5
5
  import 'jsonwebtoken';
@@ -191,16 +191,13 @@ declare abstract class SqlStorage implements TStorage {
191
191
  refs(object: TObject, classNames: string[], roles?: string[]): AsyncGenerator<TObject, void, unknown>;
192
192
  nonrefs(query: DecodedQuery<FindOptions>): AsyncGenerator<TObject, void, unknown>;
193
193
  insert(options: InsertOptions, attrs: Record<string, TValueWithUndefined>): Promise<TObject | undefined>;
194
- insertMany(options: InsertOptions, values: Record<string, TValueWithUndefined>[]): Promise<number>;
194
+ insertMany(options: InsertOptions, values: Record<string, TValueWithUndefined>[]): Promise<TObject[]>;
195
195
  updateOne(query: DecodedQuery<FindOneOptions>, update: Record<string, TUpdateOp>): Promise<TObject | undefined>;
196
- updateMany(query: DecodedQuery<FindOptions>, update: Record<string, TUpdateOp>): Promise<number>;
196
+ updateMany(query: DecodedQuery<FindOptions>, update: Record<string, TUpdateOp>): Promise<TObject[]>;
197
197
  upsertOne(query: DecodedQuery<FindOneOptions>, update: Record<string, TUpdateOp>, setOnInsert: Record<string, TValueWithUndefined>): Promise<TObject | undefined>;
198
- upsertMany(query: DecodedQuery<FindOptions>, update: Record<string, TUpdateOp>, setOnInsert: Record<string, TValueWithUndefined>): Promise<{
199
- updated: number;
200
- inserted: number;
201
- }>;
198
+ upsertMany(query: DecodedQuery<FindOptions>, update: Record<string, TUpdateOp>, setOnInsert: Record<string, TValueWithUndefined>): Promise<TObject[]>;
202
199
  deleteOne(query: DecodedQuery<FindOneOptions>): Promise<TObject | undefined>;
203
- deleteMany(query: DecodedQuery<FindOptions>): Promise<number>;
200
+ deleteMany(query: DecodedQuery<FindOptions>): Promise<TObject[]>;
204
201
  }
205
202
 
206
203
  declare class PostgresStorageClient<Driver extends PostgresClientDriver> extends SqlStorage implements TPubSub {
@@ -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-B8TESzd9.js');
6
+ var index = require('../../internals/index-CsmAYB_t.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-C4vwSN74.js');
12
+ var index$1 = require('../../internals/index-CyPxh5dl.js');
13
13
  require('@o2ter/crypto-js');
14
- var random$1 = require('../../internals/random-Dk3OhDNU.js');
14
+ var random$1 = require('../../internals/random-D7S1XD7F.js');
15
15
  var _private = require('../../internals/private-Ciddhure.js');
16
16
 
17
17
  //
@@ -100,7 +100,7 @@ class SQL {
100
100
  query += `${dialect.placeholder(nextIdx())}::DOUBLE PRECISION`;
101
101
  values.push(value.value);
102
102
  }
103
- else if (Decimal.isDecimal(value.value)) {
103
+ else if (value.value instanceof Decimal) {
104
104
  query += `${dialect.placeholder(nextIdx())}::DECIMAL`;
105
105
  values.push(value.value.toString());
106
106
  }
@@ -469,7 +469,7 @@ class QueryCompiler {
469
469
  INSERT INTO ${{ identifier: options.className }}
470
470
  (${_.map(keys, x => sql `${{ identifier: x }}`)})
471
471
  VALUES ${_.map(_values, v => sql `(${_.map(keys, k => sql `${v[k]}`)})`)}
472
- RETURNING _id
472
+ RETURNING ${_.map(index.defaultObjectKeys, k => sql `${{ identifier: k }}`)}
473
473
  `;
474
474
  }
475
475
  updateOne(query, update) {
@@ -492,7 +492,7 @@ class QueryCompiler {
492
492
  UPDATE ${{ identifier: query.className }}
493
493
  SET ${this._encodeUpdateAttrs(query.className, update)}
494
494
  WHERE ${{ identifier: query.className }}._id IN (SELECT ${{ identifier: fetchName }}._id FROM ${{ identifier: fetchName }})
495
- RETURNING _id
495
+ RETURNING ${_.map(index.defaultObjectKeys, k => sql `${{ identifier: k }}`)}
496
496
  `;
497
497
  });
498
498
  }
@@ -541,14 +541,14 @@ class QueryCompiler {
541
541
  UPDATE ${{ identifier: query.className }}
542
542
  SET ${this._encodeUpdateAttrs(query.className, update)}
543
543
  WHERE ${{ identifier: query.className }}._id IN (SELECT ${{ identifier: fetchName }}._id FROM ${{ identifier: fetchName }})
544
- RETURNING _id, __v
544
+ RETURNING ${_.map(index.defaultObjectKeys, k => sql `${{ identifier: k }}`)}
545
545
  )
546
546
  , ${{ identifier: insertName }} AS (
547
547
  INSERT INTO ${{ identifier: query.className }}
548
548
  (${_.map(_insert, x => sql `${{ identifier: x[0] }}`)})
549
549
  SELECT ${_.map(_insert, x => sql `${x[1]} AS ${{ identifier: x[0] }}`)}
550
550
  WHERE NOT EXISTS(SELECT * FROM ${{ identifier: updateName }})
551
- RETURNING _id, __v
551
+ RETURNING ${_.map(index.defaultObjectKeys, k => sql `${{ identifier: k }}`)}
552
552
  )
553
553
  SELECT * FROM ${{ identifier: updateName }}
554
554
  UNION
@@ -582,7 +582,7 @@ class QueryCompiler {
582
582
  return this._modifyQuery(query, (fetchName) => sql `
583
583
  DELETE FROM ${{ identifier: query.className }}
584
584
  WHERE ${{ identifier: query.className }}._id IN (SELECT ${{ identifier: fetchName }}._id FROM ${{ identifier: fetchName }})
585
- RETURNING _id
585
+ RETURNING ${_.map(index.defaultObjectKeys, k => sql `${{ identifier: k }}`)}
586
586
  `);
587
587
  }
588
588
  }
@@ -773,7 +773,7 @@ class SqlStorage {
773
773
  async insertMany(options, values) {
774
774
  const compiler = this._makeCompiler(true);
775
775
  const result = await this.query(compiler.insertMany(options, values));
776
- return result.length;
776
+ return _.map(result, x => this._decodeObject(options.className, x));
777
777
  }
778
778
  async updateOne(query, update) {
779
779
  const compiler = this._makeCompiler(true, query.extraFilter);
@@ -783,7 +783,7 @@ class SqlStorage {
783
783
  async updateMany(query, update) {
784
784
  const compiler = this._makeCompiler(true, query.extraFilter);
785
785
  const updated = await this.query(compiler.updateMany(query, update));
786
- return updated.length;
786
+ return _.map(updated, x => this._decodeObject(query.className, x));
787
787
  }
788
788
  async upsertOne(query, update, setOnInsert) {
789
789
  const compiler = this._makeCompiler(true, query.extraFilter);
@@ -793,11 +793,7 @@ class SqlStorage {
793
793
  async upsertMany(query, update, setOnInsert) {
794
794
  const compiler = this._makeCompiler(true, query.extraFilter);
795
795
  const upserted = await this.query(compiler.upsertMany(query, update, setOnInsert));
796
- const inserted = _.filter(upserted, x => x.__v === 0).length;
797
- return {
798
- updated: upserted.length - inserted,
799
- inserted: inserted,
800
- };
796
+ return _.map(upserted, x => this._decodeObject(query.className, x));
801
797
  }
802
798
  async deleteOne(query) {
803
799
  const compiler = this._makeCompiler(true, query.extraFilter);
@@ -807,7 +803,7 @@ class SqlStorage {
807
803
  async deleteMany(query) {
808
804
  const compiler = this._makeCompiler(true, query.extraFilter);
809
805
  const deleted = await this.query(compiler.deleteMany(query));
810
- return deleted.length;
806
+ return _.map(deleted, x => this._decodeObject(query.className, x));
811
807
  }
812
808
  }
813
809