proto.io 0.0.155 → 0.0.157

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 (32) hide show
  1. package/dist/adapters/file/database.d.ts +2 -2
  2. package/dist/adapters/file/filesystem.d.ts +2 -2
  3. package/dist/adapters/file/google-cloud-storage.d.ts +2 -2
  4. package/dist/adapters/storage/progres.d.ts +1 -1
  5. package/dist/adapters/storage/progres.js +1 -1
  6. package/dist/adapters/storage/progres.mjs +1 -1
  7. package/dist/client.d.ts +3 -3
  8. package/dist/index.d.ts +3 -3
  9. package/dist/index.js +29 -3
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.mjs +29 -3
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/internals/index-B01TqoO1.mjs.map +1 -1
  14. package/dist/internals/{index-BLVOKfv3.d.ts → index-Bb9jyfQC.d.ts} +46 -46
  15. package/dist/internals/index-Bb9jyfQC.d.ts.map +1 -0
  16. package/dist/internals/index-BmRuvHVZ.mjs.map +1 -1
  17. package/dist/internals/index-Bs06MNCK.js.map +1 -1
  18. package/dist/internals/index-CVutVPmd.js.map +1 -1
  19. package/dist/internals/{index-DmcvF1dx.d.ts → index-DbUghBO0.d.ts} +19 -19
  20. package/dist/internals/index-DbUghBO0.d.ts.map +1 -0
  21. package/dist/internals/{index-DSU589g6.d.ts → index-dkBoWkei.d.ts} +2 -2
  22. package/dist/internals/index-dkBoWkei.d.ts.map +1 -0
  23. package/dist/internals/{random-DfnhGdY1.js → random-CPI-IjeV.js} +25 -13
  24. package/dist/internals/random-CPI-IjeV.js.map +1 -0
  25. package/dist/internals/{random-DXre8Q46.mjs → random-DLFngtjg.mjs} +25 -13
  26. package/dist/internals/random-DLFngtjg.mjs.map +1 -0
  27. package/package.json +1 -1
  28. package/dist/internals/index-BLVOKfv3.d.ts.map +0 -1
  29. package/dist/internals/index-DSU589g6.d.ts.map +0 -1
  30. package/dist/internals/index-DmcvF1dx.d.ts.map +0 -1
  31. package/dist/internals/random-DXre8Q46.mjs.map +0 -1
  32. package/dist/internals/random-DfnhGdY1.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import { T as TSchema, P as ProtoService } from '../../internals/index-BLVOKfv3.js';
2
- import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DSU589g6.js';
1
+ import { T as TSchema, P as ProtoService } from '../../internals/index-Bb9jyfQC.js';
2
+ import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-dkBoWkei.js';
3
3
  import '@o2ter/utils-js';
4
4
  import 'jsonwebtoken';
5
5
  import '@o2ter/server-js';
@@ -1,5 +1,5 @@
1
- import { P as ProtoService } from '../../internals/index-BLVOKfv3.js';
2
- import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DSU589g6.js';
1
+ import { P as ProtoService } from '../../internals/index-Bb9jyfQC.js';
2
+ import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-dkBoWkei.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-BLVOKfv3.js';
4
- import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DSU589g6.js';
3
+ import { P as ProtoService } from '../../internals/index-Bb9jyfQC.js';
4
+ import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-dkBoWkei.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, n as EventData, T as TSchema, o as DecodedQuery, F as FindOptions, R as RelationOptions, Q as QuerySelector, p as DecodedSortOption, I as InsertOptions, q as TValue, r as FindOneOptions, t as TUpdateOp, u as FieldSelectorExpression, v as QueryExpression, w as TStorage, x as TransactionOptions, h as TObject, y as TQueryRandomOptions, z as TPubSub } from '../../internals/index-BLVOKfv3.js';
2
+ import { _ as _TValue, n as EventData, T as TSchema, o as DecodedQuery, F as FindOptions, R as RelationOptions, Q as QuerySelector, p as DecodedSortOption, I as InsertOptions, q as TValue, r as FindOneOptions, t as TUpdateOp, u as FieldSelectorExpression, v as QueryExpression, w as TStorage, x as TransactionOptions, h as TObject, y as TQueryRandomOptions, z as TPubSub } from '../../internals/index-Bb9jyfQC.js';
3
3
  import * as _o2ter_utils_js from '@o2ter/utils-js';
4
4
  import { asyncStream } from '@o2ter/utils-js';
5
5
  import 'jsonwebtoken';
@@ -11,7 +11,7 @@ var Decimal = require('decimal.js');
11
11
  var utils = require('pg/lib/utils');
12
12
  var index$1 = require('../../internals/index-CSNRyhjB.js');
13
13
  require('@o2ter/crypto-js');
14
- var random$1 = require('../../internals/random-DfnhGdY1.js');
14
+ var random$1 = require('../../internals/random-CPI-IjeV.js');
15
15
  var _private = require('../../internals/private-CSB1Ep4g.js');
16
16
 
17
17
  //
@@ -7,7 +7,7 @@ import Decimal from 'decimal.js';
7
7
  import { escapeLiteral, escapeIdentifier } from 'pg/lib/utils';
8
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-tU-lsQqj.mjs';
9
9
  import '@o2ter/crypto-js';
10
- import { _ as _resolveColumn, g as generateId, Q as QueryValidator } from '../../internals/random-DXre8Q46.mjs';
10
+ import { _ as _resolveColumn, g as generateId, Q as QueryValidator } from '../../internals/random-DLFngtjg.mjs';
11
11
  import { P as PVK } from '../../internals/private-BUpLAMZi.mjs';
12
12
 
13
13
  //
package/dist/client.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { P as ProtoClient } from './internals/index-DmcvF1dx.js';
2
- export { c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-DmcvF1dx.js';
1
+ import { P as ProtoClient } from './internals/index-DbUghBO0.js';
2
+ export { c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-DbUghBO0.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-BLVOKfv3.js';
4
+ export { D as DeserializeOptions, S as SerializeOptions, d as TSerializable, e as deserialize, s as serialize } from './internals/index-Bb9jyfQC.js';
5
5
  import '@o2ter/utils-js';
6
6
  import 'socket.io-client';
7
7
  import '@socket.io/component-emitter';
package/dist/index.d.ts CHANGED
@@ -2,11 +2,11 @@ import * as socket_io from 'socket.io';
2
2
  import * as socket_io_dist_typed_events from 'socket.io/dist/typed-events';
3
3
  import * as express_serve_static_core from 'express-serve-static-core';
4
4
  import { Server, RequestHandler } from '@o2ter/server-js';
5
- import { T as TSchema, _ as _TValue, P as ProtoService, a as ProtoServiceOptions, b as ProtoServiceKeyOptions } from './internals/index-BLVOKfv3.js';
6
- export { D as DeserializeOptions, S as SerializeOptions, c as TFileStorage, d as TSerializable, e as deserialize, s as serialize } from './internals/index-BLVOKfv3.js';
5
+ import { T as TSchema, _ as _TValue, P as ProtoService, a as ProtoServiceOptions, b as ProtoServiceKeyOptions } from './internals/index-Bb9jyfQC.js';
6
+ export { D as DeserializeOptions, S as SerializeOptions, c as TFileStorage, d as TSerializable, e as deserialize, s as serialize } from './internals/index-Bb9jyfQC.js';
7
7
  import Decimal from 'decimal.js';
8
8
  export { Decimal } from 'decimal.js';
9
- export { P as ProtoClient, c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-DmcvF1dx.js';
9
+ export { P as ProtoClient, c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-DbUghBO0.js';
10
10
  import '@o2ter/utils-js';
11
11
  import 'jsonwebtoken';
12
12
  import 'lodash';
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ 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-DfnhGdY1.js');
7
+ var random = require('./internals/random-CPI-IjeV.js');
8
8
  var _private = require('./internals/private-CSB1Ep4g.js');
9
9
  var utilsJs = require('@o2ter/utils-js');
10
10
  var index = require('./internals/index-Bs06MNCK.js');
@@ -269,6 +269,32 @@ const proxy = (x) => {
269
269
  return proxy;
270
270
  };
271
271
 
272
+ //
273
+ // options.ts
274
+ //
275
+ // The MIT License
276
+ // Copyright (c) 2021 - 2024 O2ter Limited. All rights reserved.
277
+ //
278
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
279
+ // of this software and associated documentation files (the "Software"), to deal
280
+ // in the Software without restriction, including without limitation the rights
281
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
282
+ // copies of the Software, and to permit persons to whom the Software is
283
+ // furnished to do so, subject to the following conditions:
284
+ //
285
+ // The above copyright notice and this permission notice shall be included in
286
+ // all copies or substantial portions of the Software.
287
+ //
288
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
289
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
290
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
291
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
292
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
293
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
294
+ // THE SOFTWARE.
295
+ //
296
+ const _serviceOf = (options) => options?.session instanceof ProtoService ? options?.session : undefined;
297
+
272
298
  //
273
299
  // methods.ts
274
300
  //
@@ -313,7 +339,7 @@ class ProtoQuery extends index.TQuery {
313
339
  if (options?.master !== true)
314
340
  throw Error('No permission');
315
341
  }
316
- return dispatcher(options?.session ?? this._proto, options ?? {}, !!this._opts.insecure);
342
+ return dispatcher(_serviceOf(options) ?? this._proto, options ?? {}, !!this._opts.insecure);
317
343
  }
318
344
  explain(options) {
319
345
  return this._dispatcher(options).explain(this._queryOptions);
@@ -1069,7 +1095,7 @@ class ProtoInternal {
1069
1095
  async refs(proto, object, options) {
1070
1096
  const roles = options?.master ? [] : await this._perms(proto);
1071
1097
  const classNames = options?.master ? _.keys(this.options.schema) : _.filter(_.keys(this.options.schema), x => proto[_private.PVK].validateCLPs(x, roles, ['find']));
1072
- const storage = options?.session?.storage ?? this.options.storage;
1098
+ const storage = _serviceOf(options)?.storage ?? this.options.storage;
1073
1099
  return storage.refs(object, classNames, options?.master ? undefined : roles);
1074
1100
  }
1075
1101
  }