proto.io 0.0.187 → 0.0.189

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 (44) hide show
  1. package/dist/adapters/file/database.d.ts +2 -2
  2. package/dist/adapters/file/database.js +2 -2
  3. package/dist/adapters/file/database.mjs +2 -2
  4. package/dist/adapters/file/filesystem.d.ts +2 -2
  5. package/dist/adapters/file/google-cloud-storage.d.ts +2 -2
  6. package/dist/adapters/storage/progres.d.ts +1 -1
  7. package/dist/adapters/storage/progres.js +3 -3
  8. package/dist/adapters/storage/progres.mjs +3 -3
  9. package/dist/client.d.ts +3 -3
  10. package/dist/client.js +2 -2
  11. package/dist/client.mjs +3 -3
  12. package/dist/index.d.ts +3 -3
  13. package/dist/index.js +13 -8
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +14 -9
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/internals/{index-CEgTPv9-.mjs → index-BAbXyJEC.mjs} +227 -227
  18. package/dist/internals/{index-CEgTPv9-.mjs.map → index-BAbXyJEC.mjs.map} +1 -1
  19. package/dist/internals/{index-fdvea17W.d.ts → index-BDHXW8gd.d.ts} +2 -1
  20. package/dist/internals/index-BDHXW8gd.d.ts.map +1 -0
  21. package/dist/internals/{index-wofihxjH.d.ts → index-BfsVioOA.d.ts} +2 -2
  22. package/dist/internals/index-BfsVioOA.d.ts.map +1 -0
  23. package/dist/internals/{index-DBuC2OsV.js → index-COOeeeBE.js} +2 -2
  24. package/dist/internals/{index-DBuC2OsV.js.map → index-COOeeeBE.js.map} +1 -1
  25. package/dist/internals/{index-BszoCthH.js → index-Dej3GgVf.js} +2 -2
  26. package/dist/internals/index-Dej3GgVf.js.map +1 -0
  27. package/dist/internals/{index-PN4p9vcR.js → index-M-VqTiz9.js} +227 -227
  28. package/dist/internals/{index-PN4p9vcR.js.map → index-M-VqTiz9.js.map} +1 -1
  29. package/dist/internals/{index-MPHIZrIu.mjs → index-ikHjpb6F.mjs} +2 -2
  30. package/dist/internals/{index-MPHIZrIu.mjs.map → index-ikHjpb6F.mjs.map} +1 -1
  31. package/dist/internals/{index-B1FyA93S.mjs → index-j8PFq8Ci.mjs} +2 -2
  32. package/dist/internals/index-j8PFq8Ci.mjs.map +1 -0
  33. package/dist/internals/{index-DSxxREND.d.ts → index-z8mWupzT.d.ts} +2 -2
  34. package/dist/internals/index-z8mWupzT.d.ts.map +1 -0
  35. package/dist/internals/{random-Bfm98f9v.js → random-CObICDCy.js} +3 -3
  36. package/dist/internals/{random-Bfm98f9v.js.map → random-CObICDCy.js.map} +1 -1
  37. package/dist/internals/{random-D6jBS4Q9.mjs → random-uHM4KXoV.mjs} +3 -3
  38. package/dist/internals/{random-D6jBS4Q9.mjs.map → random-uHM4KXoV.mjs.map} +1 -1
  39. package/package.json +1 -1
  40. package/dist/internals/index-B1FyA93S.mjs.map +0 -1
  41. package/dist/internals/index-BszoCthH.js.map +0 -1
  42. package/dist/internals/index-DSxxREND.d.ts.map +0 -1
  43. package/dist/internals/index-fdvea17W.d.ts.map +0 -1
  44. package/dist/internals/index-wofihxjH.d.ts.map +0 -1
@@ -1,5 +1,5 @@
1
- import { T as TSchema, P as ProtoService } from '../../internals/index-fdvea17W.js';
2
- import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-wofihxjH.js';
1
+ import { T as TSchema, P as ProtoService } from '../../internals/index-BDHXW8gd.js';
2
+ import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-BfsVioOA.js';
3
3
  import '@o2ter/utils-js';
4
4
  import 'jsonwebtoken';
5
5
  import '@o2ter/server-js';
@@ -4,12 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _ = require('lodash');
6
6
  var index = require('../../internals/index-DfPY7Xbb.js');
7
- var index$1 = require('../../internals/index-DBuC2OsV.js');
7
+ var index$1 = require('../../internals/index-COOeeeBE.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-BszoCthH.js');
12
+ require('../../internals/index-Dej3GgVf.js');
13
13
  require('decimal.js');
14
14
 
15
15
  //
@@ -1,11 +1,11 @@
1
1
  import _ from 'lodash';
2
2
  import { F as FileStorageBase } from '../../internals/index-BAFVUYCo.mjs';
3
- import { Q as QuerySelector } from '../../internals/index-MPHIZrIu.mjs';
3
+ import { Q as QuerySelector } from '../../internals/index-ikHjpb6F.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-B1FyA93S.mjs';
8
+ import '../../internals/index-j8PFq8Ci.mjs';
9
9
  import 'decimal.js';
10
10
 
11
11
  //
@@ -1,5 +1,5 @@
1
- import { P as ProtoService } from '../../internals/index-fdvea17W.js';
2
- import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-wofihxjH.js';
1
+ import { P as ProtoService } from '../../internals/index-BDHXW8gd.js';
2
+ import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-BfsVioOA.js';
3
3
  import '@o2ter/utils-js';
4
4
  import 'jsonwebtoken';
5
5
  import '@o2ter/server-js';
@@ -1,7 +1,7 @@
1
1
  import * as _google_cloud_storage from '@google-cloud/storage';
2
2
  import { Storage } from '@google-cloud/storage';
3
- import { P as ProtoService } from '../../internals/index-fdvea17W.js';
4
- import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-wofihxjH.js';
3
+ import { P as ProtoService } from '../../internals/index-BDHXW8gd.js';
4
+ import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-BfsVioOA.js';
5
5
  import '@o2ter/utils-js';
6
6
  import 'jsonwebtoken';
7
7
  import '@o2ter/server-js';
@@ -1,5 +1,5 @@
1
1
  import { Pool, PoolClient, PoolConfig } from 'pg';
2
- import { _ as _TValue, T as TSchema, Q as QuerySelector, q as DecodedQuery, F as FindOptions, R as RelationOptions, r as DecodedSortOption, I as InsertOptions, t as TValue, u as FindOneOptions, v as TUpdateOp, w as FieldSelectorExpression, x as QueryExpression, y as TStorage, z as TransactionOptions, h as TObject, A as TQueryRandomOptions, B as TPubSub } from '../../internals/index-fdvea17W.js';
2
+ import { _ as _TValue, T as TSchema, Q as QuerySelector, q as DecodedQuery, F as FindOptions, R as RelationOptions, r as DecodedSortOption, I as InsertOptions, t as TValue, u as FindOneOptions, v as TUpdateOp, w as FieldSelectorExpression, x as QueryExpression, y as TStorage, z as TransactionOptions, h as TObject, A as TQueryRandomOptions, B as TPubSub } from '../../internals/index-BDHXW8gd.js';
3
3
  import * as _o2ter_utils_js from '@o2ter/utils-js';
4
4
  import { asyncStream } from '@o2ter/utils-js';
5
5
  import 'jsonwebtoken';
@@ -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-BszoCthH.js');
6
+ var index = require('../../internals/index-Dej3GgVf.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-DBuC2OsV.js');
12
+ var index$1 = require('../../internals/index-COOeeeBE.js');
13
13
  require('@o2ter/crypto-js');
14
- var random$1 = require('../../internals/random-Bfm98f9v.js');
14
+ var random$1 = require('../../internals/random-CObICDCy.js');
15
15
  var _private = require('../../internals/private-Ciddhure.js');
16
16
 
17
17
  //
@@ -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-B1FyA93S.mjs';
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-j8PFq8Ci.mjs';
3
3
  import { Pool, types } from 'pg';
4
4
  import QueryStream from 'pg-query-stream';
5
5
  import { asyncStream } 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-MPHIZrIu.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-ikHjpb6F.mjs';
9
9
  import '@o2ter/crypto-js';
10
- import { r as resolveColumn, a as resolveDataType, g as generateId, Q as QueryValidator } from '../../internals/random-D6jBS4Q9.mjs';
10
+ import { r as resolveColumn, a as resolveDataType, g as generateId, Q as QueryValidator } from '../../internals/random-uHM4KXoV.mjs';
11
11
  import { P as PVK } from '../../internals/private-CNw40LZ7.mjs';
12
12
 
13
13
  //
package/dist/client.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { P as ProtoClient } from './internals/index-DSxxREND.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-DSxxREND.js';
1
+ import { P as ProtoClient } from './internals/index-z8mWupzT.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-z8mWupzT.js';
3
3
  export { Decimal } from 'decimal.js';
4
- export { D as DeserializeOptions, S as SerializeOptions, d as TSerializable, e as deserialize, s as serialize } from './internals/index-fdvea17W.js';
4
+ export { D as DeserializeOptions, S as SerializeOptions, d as TSerializable, e as deserialize, s as serialize } from './internals/index-BDHXW8gd.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,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./internals/index-PN4p9vcR.js');
5
+ var index = require('./internals/index-M-VqTiz9.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-BszoCthH.js');
10
+ require('./internals/index-Dej3GgVf.js');
11
11
  require('axios');
12
12
  require('@o2ter/server-js/dist/const');
13
13
  require('socket.io-client');
package/dist/client.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import { e as ProtoClient } from './internals/index-CEgTPv9-.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-CEgTPv9-.mjs';
1
+ import { e as ProtoClient } from './internals/index-BAbXyJEC.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-BAbXyJEC.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-B1FyA93S.mjs';
7
+ import './internals/index-j8PFq8Ci.mjs';
8
8
  import 'axios';
9
9
  import '@o2ter/server-js/dist/const';
10
10
  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 { T as TSchema, _ as _TValue, P as ProtoService, a as ProtoServiceOptions, b as ProtoServiceKeyOptions } from './internals/index-fdvea17W.js';
5
- export { D as DeserializeOptions, S as SerializeOptions, c as TFileStorage, d as TSerializable, e as deserialize, s as serialize } from './internals/index-fdvea17W.js';
4
+ import { T as TSchema, _ as _TValue, P as ProtoService, a as ProtoServiceOptions, b as ProtoServiceKeyOptions } from './internals/index-BDHXW8gd.js';
5
+ export { D as DeserializeOptions, S as SerializeOptions, c as TFileStorage, d as TSerializable, e as deserialize, s as serialize } from './internals/index-BDHXW8gd.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-DSxxREND.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-z8mWupzT.js';
9
9
  import '@o2ter/utils-js';
10
10
  import 'jsonwebtoken';
11
11
  import 'lodash';
package/dist/index.js CHANGED
@@ -4,21 +4,21 @@ 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-Bfm98f9v.js');
7
+ var random = require('./internals/random-CObICDCy.js');
8
8
  var _private = require('./internals/private-Ciddhure.js');
9
9
  var utilsJs = require('@o2ter/utils-js');
10
- var index = require('./internals/index-PN4p9vcR.js');
11
- var index$1 = require('./internals/index-BszoCthH.js');
10
+ var index = require('./internals/index-M-VqTiz9.js');
11
+ var index$1 = require('./internals/index-Dej3GgVf.js');
12
12
  var jwt = require('jsonwebtoken');
13
13
  var node_buffer = require('node:buffer');
14
14
  var node_stream = require('node:stream');
15
15
  var node_crypto = require('node:crypto');
16
16
  var util = require('util');
17
17
  var cryptoJs = require('@o2ter/crypto-js');
18
- var index$2 = require('./internals/index-DBuC2OsV.js');
18
+ var Decimal = require('decimal.js');
19
+ var index$2 = require('./internals/index-COOeeeBE.js');
19
20
  var queryType = require('query-types');
20
21
  var busboy = require('busboy');
21
- var Decimal = require('decimal.js');
22
22
  require('axios');
23
23
  require('@o2ter/server-js/dist/const');
24
24
  require('socket.io-client');
@@ -493,7 +493,7 @@ const defaultSchema = {
493
493
  type: { update: [] },
494
494
  token: { update: [] },
495
495
  nonce: { update: [] },
496
- _expired_at: { create: [], update: [] },
496
+ _expired_at: { update: [] },
497
497
  },
498
498
  indexes: [
499
499
  {
@@ -903,11 +903,12 @@ class ProtoInternal {
903
903
  return object;
904
904
  }
905
905
  varifyUploadToken(proto, token, isMaster) {
906
- const { nonce, maxUploadSize } = (_.isString(token) ? this.jwtVarify(token, 'upload') ?? {} : {});
906
+ const { nonce, attributes, maxUploadSize, } = (_.isString(token) ? this.jwtVarify(token, 'upload') ?? {} : {});
907
907
  if (!isMaster && !nonce)
908
908
  throw Error('Upload token is required');
909
909
  return {
910
910
  nonce,
911
+ attributes: _.isObject(attributes) ? index.deserialize(JSON.stringify(attributes)) : {},
911
912
  maxUploadSize: maxUploadSize ?? this.options.maxUploadSize,
912
913
  };
913
914
  }
@@ -915,7 +916,7 @@ class ProtoInternal {
915
916
  const data = object[_private.PVK].extra.data;
916
917
  if (_.isNil(data))
917
918
  throw Error('Invalid file object');
918
- const { nonce, maxUploadSize } = this.varifyUploadToken(proto, options?.uploadToken, options?.master);
919
+ const { nonce, maxUploadSize, attributes } = this.varifyUploadToken(proto, options?.uploadToken, options?.master);
919
920
  if (nonce) {
920
921
  const found = await proto.Query('File').equalTo('nonce', nonce).first({ master: true });
921
922
  if (found)
@@ -949,6 +950,9 @@ class ProtoInternal {
949
950
  throw Error('Invalid file object');
950
951
  }
951
952
  try {
953
+ for (const [key, value] of _.entries(attributes)) {
954
+ object.set(key, value);
955
+ }
952
956
  object.set('token', file._id);
953
957
  object.set('size', file.size);
954
958
  if (nonce)
@@ -1625,6 +1629,7 @@ class ProtoService extends index.ProtoType {
1625
1629
  return this[_private.PVK].jwtSign({
1626
1630
  nonce: cryptoJs.randomUUID(),
1627
1631
  maxUploadSize: options.maxUploadSize,
1632
+ attributes: JSON.parse(index.serialize(options.attributes ?? {})),
1628
1633
  }, options?.jwtSignOptions ?? 'upload');
1629
1634
  }
1630
1635
  jwtSign(payload, options) {