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
@@ -1,13 +1,13 @@
1
1
  import _ from 'lodash';
2
- import { a as isRelation, i as isPointer, b as isShape, e as decodeUpdateOp, s as shapePaths, c as isPrimitive, T as TObject, _ as _isTypeof, f as isVector, g as _encodeValue, h as _decodeValue, j as dimensionOf, k as _typeof } from '../../internals/index-al1N-qi7.mjs';
2
+ import { a as isRelation, i as isPointer, b as isShape, e as decodeUpdateOp, s as shapePaths, c as isPrimitive, f as defaultObjectKeys, T as TObject, _ as _isTypeof, g as isVector, h as _encodeValue, j as _decodeValue, k as dimensionOf, l as _typeof } from '../../internals/index-DpN9tcbY.mjs';
3
3
  import { Pool, types } from 'pg';
4
4
  import QueryStream from 'pg-query-stream';
5
5
  import { asyncStream, IteratorPool } from '@o2ter/utils-js';
6
6
  import Decimal from 'decimal.js';
7
7
  import { escapeLiteral, escapeIdentifier } from 'pg/lib/utils';
8
- import { a as QueryCoditionalSelector, b as QueryFieldSelector, c as QueryExpressionSelector, d as QueryDistanceExpression, e as QueryCoditionalExpression, f as QueryComparisonExpression, g as QueryNotExpression, h as QueryArrayExpression, i as QueryValueExpression, j as QueryKeyExpression, Q as QuerySelector, F as FieldSelectorExpression } from '../../internals/index-Blw7vAq5.mjs';
8
+ import { a as QueryCoditionalSelector, b as QueryFieldSelector, c as QueryExpressionSelector, d as QueryDistanceExpression, e as QueryCoditionalExpression, f as QueryComparisonExpression, g as QueryNotExpression, h as QueryArrayExpression, i as QueryValueExpression, j as QueryKeyExpression, Q as QuerySelector, F as FieldSelectorExpression } from '../../internals/index-iRVgw566.mjs';
9
9
  import '@o2ter/crypto-js';
10
- import { r as resolveColumn, a as resolveDataType$1, g as generateId, Q as QueryValidator } from '../../internals/random-6nHcBOxn.mjs';
10
+ import { r as resolveColumn, a as resolveDataType$1, g as generateId, Q as QueryValidator } from '../../internals/random-BnGB_bVS.mjs';
11
11
  import { P as PVK } from '../../internals/private-CNw40LZ7.mjs';
12
12
 
13
13
  //
@@ -96,7 +96,7 @@ class SQL {
96
96
  query += `${dialect.placeholder(nextIdx())}::DOUBLE PRECISION`;
97
97
  values.push(value.value);
98
98
  }
99
- else if (Decimal.isDecimal(value.value)) {
99
+ else if (value.value instanceof Decimal) {
100
100
  query += `${dialect.placeholder(nextIdx())}::DECIMAL`;
101
101
  values.push(value.value.toString());
102
102
  }
@@ -465,7 +465,7 @@ class QueryCompiler {
465
465
  INSERT INTO ${{ identifier: options.className }}
466
466
  (${_.map(keys, x => sql `${{ identifier: x }}`)})
467
467
  VALUES ${_.map(_values, v => sql `(${_.map(keys, k => sql `${v[k]}`)})`)}
468
- RETURNING _id
468
+ RETURNING ${_.map(defaultObjectKeys, k => sql `${{ identifier: k }}`)}
469
469
  `;
470
470
  }
471
471
  updateOne(query, update) {
@@ -488,7 +488,7 @@ class QueryCompiler {
488
488
  UPDATE ${{ identifier: query.className }}
489
489
  SET ${this._encodeUpdateAttrs(query.className, update)}
490
490
  WHERE ${{ identifier: query.className }}._id IN (SELECT ${{ identifier: fetchName }}._id FROM ${{ identifier: fetchName }})
491
- RETURNING _id
491
+ RETURNING ${_.map(defaultObjectKeys, k => sql `${{ identifier: k }}`)}
492
492
  `;
493
493
  });
494
494
  }
@@ -537,14 +537,14 @@ class QueryCompiler {
537
537
  UPDATE ${{ identifier: query.className }}
538
538
  SET ${this._encodeUpdateAttrs(query.className, update)}
539
539
  WHERE ${{ identifier: query.className }}._id IN (SELECT ${{ identifier: fetchName }}._id FROM ${{ identifier: fetchName }})
540
- RETURNING _id, __v
540
+ RETURNING ${_.map(defaultObjectKeys, k => sql `${{ identifier: k }}`)}
541
541
  )
542
542
  , ${{ identifier: insertName }} AS (
543
543
  INSERT INTO ${{ identifier: query.className }}
544
544
  (${_.map(_insert, x => sql `${{ identifier: x[0] }}`)})
545
545
  SELECT ${_.map(_insert, x => sql `${x[1]} AS ${{ identifier: x[0] }}`)}
546
546
  WHERE NOT EXISTS(SELECT * FROM ${{ identifier: updateName }})
547
- RETURNING _id, __v
547
+ RETURNING ${_.map(defaultObjectKeys, k => sql `${{ identifier: k }}`)}
548
548
  )
549
549
  SELECT * FROM ${{ identifier: updateName }}
550
550
  UNION
@@ -578,7 +578,7 @@ class QueryCompiler {
578
578
  return this._modifyQuery(query, (fetchName) => sql `
579
579
  DELETE FROM ${{ identifier: query.className }}
580
580
  WHERE ${{ identifier: query.className }}._id IN (SELECT ${{ identifier: fetchName }}._id FROM ${{ identifier: fetchName }})
581
- RETURNING _id
581
+ RETURNING ${_.map(defaultObjectKeys, k => sql `${{ identifier: k }}`)}
582
582
  `);
583
583
  }
584
584
  }
@@ -769,7 +769,7 @@ class SqlStorage {
769
769
  async insertMany(options, values) {
770
770
  const compiler = this._makeCompiler(true);
771
771
  const result = await this.query(compiler.insertMany(options, values));
772
- return result.length;
772
+ return _.map(result, x => this._decodeObject(options.className, x));
773
773
  }
774
774
  async updateOne(query, update) {
775
775
  const compiler = this._makeCompiler(true, query.extraFilter);
@@ -779,7 +779,7 @@ class SqlStorage {
779
779
  async updateMany(query, update) {
780
780
  const compiler = this._makeCompiler(true, query.extraFilter);
781
781
  const updated = await this.query(compiler.updateMany(query, update));
782
- return updated.length;
782
+ return _.map(updated, x => this._decodeObject(query.className, x));
783
783
  }
784
784
  async upsertOne(query, update, setOnInsert) {
785
785
  const compiler = this._makeCompiler(true, query.extraFilter);
@@ -789,11 +789,7 @@ class SqlStorage {
789
789
  async upsertMany(query, update, setOnInsert) {
790
790
  const compiler = this._makeCompiler(true, query.extraFilter);
791
791
  const upserted = await this.query(compiler.upsertMany(query, update, setOnInsert));
792
- const inserted = _.filter(upserted, x => x.__v === 0).length;
793
- return {
794
- updated: upserted.length - inserted,
795
- inserted: inserted,
796
- };
792
+ return _.map(upserted, x => this._decodeObject(query.className, x));
797
793
  }
798
794
  async deleteOne(query) {
799
795
  const compiler = this._makeCompiler(true, query.extraFilter);
@@ -803,7 +799,7 @@ class SqlStorage {
803
799
  async deleteMany(query) {
804
800
  const compiler = this._makeCompiler(true, query.extraFilter);
805
801
  const deleted = await this.query(compiler.deleteMany(query));
806
- return deleted.length;
802
+ return _.map(deleted, x => this._decodeObject(query.className, x));
807
803
  }
808
804
  }
809
805