proto.io 0.0.183 → 0.0.185
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.
- package/dist/adapters/file/database.d.ts +2 -2
- package/dist/adapters/file/filesystem.d.ts +2 -2
- package/dist/adapters/file/google-cloud-storage.d.ts +2 -2
- package/dist/adapters/storage/progres.d.ts +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/client.js +5 -4
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +5 -5
- package/dist/index.d.ts +3 -3
- package/dist/index.js +8 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -29
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{index-Z57iS68O.d.ts → index-C_l4FtV7.d.ts} +4 -3
- package/dist/internals/index-C_l4FtV7.d.ts.map +1 -0
- package/dist/internals/{index-BnDahEvz.js → index-DCWodSKL.js} +93 -83
- package/dist/internals/index-DCWodSKL.js.map +1 -0
- package/dist/internals/{index-C1pF5Xzm.d.ts → index-DS0eZOpV.d.ts} +2 -2
- package/dist/internals/index-DS0eZOpV.d.ts.map +1 -0
- package/dist/internals/{index-CmJh3t_k.mjs → index-DdXXYN4Z.mjs} +93 -84
- package/dist/internals/index-DdXXYN4Z.mjs.map +1 -0
- package/dist/internals/{index-YJ0pBNzy.d.ts → index-DoU5ipi_.d.ts} +17 -7
- package/dist/internals/index-DoU5ipi_.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/internals/index-BnDahEvz.js.map +0 -1
- package/dist/internals/index-C1pF5Xzm.d.ts.map +0 -1
- package/dist/internals/index-CmJh3t_k.mjs.map +0 -1
- package/dist/internals/index-YJ0pBNzy.d.ts.map +0 -1
- package/dist/internals/index-Z57iS68O.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TSchema, P as ProtoService } from '../../internals/index-
|
|
2
|
-
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-
|
|
1
|
+
import { T as TSchema, P as ProtoService } from '../../internals/index-DoU5ipi_.js';
|
|
2
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DS0eZOpV.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-
|
|
2
|
-
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-
|
|
1
|
+
import { P as ProtoService } from '../../internals/index-DoU5ipi_.js';
|
|
2
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DS0eZOpV.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-
|
|
4
|
-
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-
|
|
3
|
+
import { P as ProtoService } from '../../internals/index-DoU5ipi_.js';
|
|
4
|
+
import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-DS0eZOpV.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,
|
|
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-DoU5ipi_.js';
|
|
3
3
|
import * as _o2ter_utils_js from '@o2ter/utils-js';
|
|
4
4
|
import { asyncStream } from '@o2ter/utils-js';
|
|
5
5
|
import 'jsonwebtoken';
|
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as ProtoClient } from './internals/index-
|
|
2
|
-
export { c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-
|
|
1
|
+
import { P as ProtoClient } from './internals/index-C_l4FtV7.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-C_l4FtV7.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-
|
|
4
|
+
export { D as DeserializeOptions, S as SerializeOptions, d as TSerializable, e as deserialize, s as serialize } from './internals/index-DoU5ipi_.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-
|
|
5
|
+
var index = require('./internals/index-DCWodSKL.js');
|
|
6
6
|
var Decimal = require('decimal.js');
|
|
7
|
-
require('./internals/index-DRq6T_5w.js');
|
|
8
|
-
require('lodash');
|
|
9
|
-
require('./internals/private-Ciddhure.js');
|
|
10
7
|
require('@o2ter/utils-js');
|
|
8
|
+
require('./internals/private-Ciddhure.js');
|
|
9
|
+
require('lodash');
|
|
10
|
+
require('./internals/index-DRq6T_5w.js');
|
|
11
11
|
require('axios');
|
|
12
12
|
require('@o2ter/server-js/dist/const');
|
|
13
13
|
require('socket.io-client');
|
|
@@ -42,6 +42,7 @@ exports.classExtends = index.classExtends;
|
|
|
42
42
|
exports.default = index.ProtoClient;
|
|
43
43
|
exports.deserialize = index.deserialize;
|
|
44
44
|
exports.isFile = index.isFile;
|
|
45
|
+
exports.isJob = index.isJob;
|
|
45
46
|
exports.isObject = index.isObject;
|
|
46
47
|
exports.isQuery = index.isQuery;
|
|
47
48
|
exports.isRole = index.isRole;
|
package/dist/client.js.map
CHANGED
|
@@ -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,10 +1,10 @@
|
|
|
1
|
-
import { e as ProtoClient } from './internals/index-
|
|
2
|
-
export { f as classExtends, d as deserialize, k as isFile, g as isObject, i as isQuery, j as isRole, h as isUser, s as serialize } from './internals/index-
|
|
1
|
+
import { e as ProtoClient } from './internals/index-DdXXYN4Z.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-DdXXYN4Z.mjs';
|
|
3
3
|
export { Decimal } from 'decimal.js';
|
|
4
|
-
import './internals/index-DyjcBbS1.mjs';
|
|
5
|
-
import 'lodash';
|
|
6
|
-
import './internals/private-CNw40LZ7.mjs';
|
|
7
4
|
import '@o2ter/utils-js';
|
|
5
|
+
import './internals/private-CNw40LZ7.mjs';
|
|
6
|
+
import 'lodash';
|
|
7
|
+
import './internals/index-DyjcBbS1.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-
|
|
5
|
-
export { D as DeserializeOptions, S as SerializeOptions, c as TFileStorage, d as TSerializable, e as deserialize, s as serialize } from './internals/index-
|
|
4
|
+
import { T as TSchema, _ as _TValue, P as ProtoService, a as ProtoServiceOptions, b as ProtoServiceKeyOptions } from './internals/index-DoU5ipi_.js';
|
|
5
|
+
export { D as DeserializeOptions, S as SerializeOptions, c as TFileStorage, d as TSerializable, e as deserialize, s as serialize } from './internals/index-DoU5ipi_.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, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-
|
|
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-C_l4FtV7.js';
|
|
9
9
|
import '@o2ter/utils-js';
|
|
10
10
|
import 'jsonwebtoken';
|
|
11
11
|
import 'lodash';
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var serverJs = require('@o2ter/server-js');
|
|
|
7
7
|
var random = require('./internals/random-80Vpxbxh.js');
|
|
8
8
|
var _private = require('./internals/private-Ciddhure.js');
|
|
9
9
|
var utilsJs = require('@o2ter/utils-js');
|
|
10
|
-
var index = require('./internals/index-
|
|
10
|
+
var index = require('./internals/index-DCWodSKL.js');
|
|
11
11
|
var index$1 = require('./internals/index-DRq6T_5w.js');
|
|
12
12
|
var jwt = require('jsonwebtoken');
|
|
13
13
|
var node_buffer = require('node:buffer');
|
|
@@ -255,32 +255,6 @@ const dispatcher = (proto, options) => {
|
|
|
255
255
|
};
|
|
256
256
|
};
|
|
257
257
|
|
|
258
|
-
//
|
|
259
|
-
// options.ts
|
|
260
|
-
//
|
|
261
|
-
// The MIT License
|
|
262
|
-
// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
|
|
263
|
-
//
|
|
264
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
265
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
266
|
-
// in the Software without restriction, including without limitation the rights
|
|
267
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
268
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
269
|
-
// furnished to do so, subject to the following conditions:
|
|
270
|
-
//
|
|
271
|
-
// The above copyright notice and this permission notice shall be included in
|
|
272
|
-
// all copies or substantial portions of the Software.
|
|
273
|
-
//
|
|
274
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
275
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
276
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
277
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
278
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
279
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
280
|
-
// THE SOFTWARE.
|
|
281
|
-
//
|
|
282
|
-
const _serviceOf = (options) => options?.session instanceof ProtoService ? options?.session : undefined;
|
|
283
|
-
|
|
284
258
|
//
|
|
285
259
|
// methods.ts
|
|
286
260
|
//
|
|
@@ -737,6 +711,8 @@ const validateForeignField = (schema, key, dataType) => {
|
|
|
737
711
|
throw Error(`Invalid foreign field: ${key}`);
|
|
738
712
|
};
|
|
739
713
|
const validateShapedObject = (schema, dataType) => {
|
|
714
|
+
if (_.isEmpty(dataType.shape))
|
|
715
|
+
throw Error('Invalid empty shape');
|
|
740
716
|
for (const [key, type] of _.entries(dataType.shape)) {
|
|
741
717
|
if (!key.match(random.QueryValidator.patterns.name))
|
|
742
718
|
throw Error(`Invalid field name: ${key}`);
|
|
@@ -1311,7 +1287,8 @@ const fetchSessionInfo = async (proto, userId) => {
|
|
|
1311
1287
|
const cache = userCacheMap.get(proto[_private.PVK]);
|
|
1312
1288
|
if (_.isNil(cache[userId]))
|
|
1313
1289
|
cache[userId] = (async () => {
|
|
1314
|
-
const
|
|
1290
|
+
const _user = _.isString(userId) ? await proto.Query('User').get(userId, { master: true }) : undefined;
|
|
1291
|
+
const user = proto.req ? await proto[_private.PVK].options.userResolver(proto, _user) : _user;
|
|
1315
1292
|
const _roles = user instanceof index.TUser ? _.filter(await proto.userRoles(user), x => !_.isEmpty(x.name)) : [];
|
|
1316
1293
|
cache[userId] = undefined;
|
|
1317
1294
|
return { user, _roles };
|
|
@@ -1453,6 +1430,7 @@ const schedule = (proto) => {
|
|
|
1453
1430
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1454
1431
|
// THE SOFTWARE.
|
|
1455
1432
|
//
|
|
1433
|
+
const _serviceOf = (options) => options?.session instanceof ProtoService ? options?.session : undefined;
|
|
1456
1434
|
class ProtoService extends index.ProtoType {
|
|
1457
1435
|
/** @internal */
|
|
1458
1436
|
[_private.PVK];
|
|
@@ -1463,6 +1441,7 @@ class ProtoService extends index.ProtoType {
|
|
|
1463
1441
|
constructor(options) {
|
|
1464
1442
|
super();
|
|
1465
1443
|
this[_private.PVK] = new ProtoInternal({
|
|
1444
|
+
userResolver: (_req, user) => user,
|
|
1466
1445
|
roleResolver: {},
|
|
1467
1446
|
objectIdSize: 10,
|
|
1468
1447
|
maxFetchLimit: 1000,
|
|
@@ -2571,6 +2550,7 @@ exports.ProtoClient = index.ProtoClient;
|
|
|
2571
2550
|
exports.classExtends = index.classExtends;
|
|
2572
2551
|
exports.deserialize = index.deserialize;
|
|
2573
2552
|
exports.isFile = index.isFile;
|
|
2553
|
+
exports.isJob = index.isJob;
|
|
2574
2554
|
exports.isObject = index.isObject;
|
|
2575
2555
|
exports.isQuery = index.isQuery;
|
|
2576
2556
|
exports.isRole = index.isRole;
|