proto.io 0.0.215 → 0.0.217
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/aliyun-oss.d.ts +3 -3
- package/dist/adapters/file/database.d.ts +2 -2
- package/dist/adapters/file/database.js +1 -1
- package/dist/adapters/file/database.mjs +2 -2
- package/dist/adapters/file/filesystem.d.ts +3 -3
- package/dist/adapters/file/google-cloud-storage.d.ts +3 -3
- package/dist/adapters/storage/progres.d.ts +8 -10
- package/dist/adapters/storage/progres.js +833 -451
- package/dist/adapters/storage/progres.js.map +1 -1
- package/dist/adapters/storage/progres.mjs +834 -452
- package/dist/adapters/storage/progres.mjs.map +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/client.js +1 -7
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +3 -3
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -12
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{base-Cp5le5dC.d.ts → base-CWnOBKD5.d.ts} +2 -2
- package/dist/internals/base-CWnOBKD5.d.ts.map +1 -0
- package/dist/internals/{chunk--Vo2-p-z.d.ts → chunk-CNNSQpRF.d.ts} +3 -3
- package/dist/internals/chunk-CNNSQpRF.d.ts.map +1 -0
- package/dist/internals/{index-CZUGnb-y.d.ts → index-BRIlS3mY.d.ts} +3 -9
- package/dist/internals/index-BRIlS3mY.d.ts.map +1 -0
- package/dist/internals/{index-YLrO0f2D.d.ts → index-Bs8n7Q8f.d.ts} +60 -20
- package/dist/internals/index-Bs8n7Q8f.d.ts.map +1 -0
- package/dist/internals/{index-al1N-qi7.mjs → index-BzDsTt4R.mjs} +2 -2
- package/dist/internals/{index-al1N-qi7.mjs.map → index-BzDsTt4R.mjs.map} +1 -1
- package/dist/internals/{index-ZPbBr9Db.mjs → index-DfqABzjr.mjs} +135 -142
- package/dist/internals/index-DfqABzjr.mjs.map +1 -0
- package/dist/internals/{index-DfnPpl1I.js → index-DylUjD_1.js} +133 -146
- package/dist/internals/index-DylUjD_1.js.map +1 -0
- package/dist/internals/{validator-ChrCrz_C.mjs → validator-CEcBF4Cn.mjs} +730 -27
- package/dist/internals/validator-CEcBF4Cn.mjs.map +1 -0
- package/dist/internals/{validator-m6wY35c6.js → validator-mcBCJP4P.js} +737 -27
- package/dist/internals/validator-mcBCJP4P.js.map +1 -0
- package/package.json +1 -1
- package/dist/internals/base-Cp5le5dC.d.ts.map +0 -1
- package/dist/internals/chunk--Vo2-p-z.d.ts.map +0 -1
- package/dist/internals/index-CZUGnb-y.d.ts.map +0 -1
- package/dist/internals/index-DfnPpl1I.js.map +0 -1
- package/dist/internals/index-YLrO0f2D.d.ts.map +0 -1
- package/dist/internals/index-ZPbBr9Db.mjs.map +0 -1
- package/dist/internals/validator-ChrCrz_C.mjs.map +0 -1
- package/dist/internals/validator-m6wY35c6.js.map +0 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as ProtoClient } from './internals/index-
|
|
2
|
-
export { c as classExtends
|
|
1
|
+
import { P as ProtoClient } from './internals/index-BRIlS3mY.js';
|
|
2
|
+
export { c as classExtends } from './internals/index-BRIlS3mY.js';
|
|
3
|
+
export { D as DeserializeOptions, S as SerializeOptions, e as TNumber, f as TSerializable, g as deserialize, s as serialize } from './internals/index-Bs8n7Q8f.js';
|
|
3
4
|
export { Decimal } from 'decimal.js';
|
|
4
|
-
export { D as DeserializeOptions, S as SerializeOptions, e as TNumber, f as TSerializable, g as deserialize, s as serialize } from './internals/index-YLrO0f2D.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,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('./internals/index-
|
|
5
|
+
var index = require('./internals/index-DylUjD_1.js');
|
|
6
6
|
var Decimal = require('decimal.js');
|
|
7
7
|
require('@o2ter/utils-js');
|
|
8
8
|
require('./internals/private-Ciddhure.js');
|
|
@@ -43,12 +43,6 @@ exports.ProtoClient = index.ProtoClient;
|
|
|
43
43
|
exports.classExtends = index.classExtends;
|
|
44
44
|
exports.default = index.ProtoClient;
|
|
45
45
|
exports.deserialize = index.deserialize;
|
|
46
|
-
exports.isFile = index.isFile;
|
|
47
|
-
exports.isJob = index.isJob;
|
|
48
|
-
exports.isObject = index.isObject;
|
|
49
|
-
exports.isQuery = index.isQuery;
|
|
50
|
-
exports.isRole = index.isRole;
|
|
51
|
-
exports.isUser = index.isUser;
|
|
52
46
|
exports.serialize = index.serialize;
|
|
53
47
|
Object.defineProperty(exports, "Decimal", {
|
|
54
48
|
enumerable: true,
|
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 '../
|
|
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 '../internals/codec';\nexport { classExtends } from '../internals/utils';\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 { b as ProtoClient } from './internals/index-
|
|
2
|
-
export { c as classExtends, d as deserialize,
|
|
1
|
+
import { b as ProtoClient } from './internals/index-DfqABzjr.mjs';
|
|
2
|
+
export { c as classExtends, d as deserialize, s as serialize } from './internals/index-DfqABzjr.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-
|
|
7
|
+
import './internals/index-BzDsTt4R.mjs';
|
|
8
8
|
import 'axios';
|
|
9
9
|
import './internals/const-Dkp7Nsv5.mjs';
|
|
10
10
|
import '@o2ter/server-js/dist/const';
|
package/dist/client.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.mjs","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 '../
|
|
1
|
+
{"version":3,"file":"client.mjs","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 '../internals/codec';\nexport { classExtends } from '../internals/utils';\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/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, a as TValueWithoutObject, P as ProtoService, b as ProtoServiceOptions, c as ProtoServiceKeyOptions } from './internals/index-
|
|
5
|
-
export { D as DeserializeOptions, S as SerializeOptions, d as TFileStorage, e as TNumber, f as TSerializable, g as deserialize, s as serialize } from './internals/index-
|
|
4
|
+
import { T as TSchema, a as TValueWithoutObject, P as ProtoService, b as ProtoServiceOptions, c as ProtoServiceKeyOptions } from './internals/index-Bs8n7Q8f.js';
|
|
5
|
+
export { D as DeserializeOptions, S as SerializeOptions, d as TFileStorage, e as TNumber, f as TSerializable, g as deserialize, s as serialize } from './internals/index-Bs8n7Q8f.js';
|
|
6
6
|
import Decimal from 'decimal.js';
|
|
7
7
|
export { Decimal } from 'decimal.js';
|
|
8
|
-
export { P as ProtoClient, c as classExtends
|
|
8
|
+
export { P as ProtoClient, c as classExtends } from './internals/index-BRIlS3mY.js';
|
|
9
9
|
import '@o2ter/utils-js';
|
|
10
10
|
import 'jsonwebtoken';
|
|
11
11
|
import 'lodash';
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _ = require('lodash');
|
|
6
6
|
var serverJs = require('@o2ter/server-js');
|
|
7
|
-
var validator = require('./internals/validator-
|
|
7
|
+
var validator = require('./internals/validator-mcBCJP4P.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-DylUjD_1.js');
|
|
11
11
|
var index$1 = require('./internals/index-B8TESzd9.js');
|
|
12
12
|
var jwt = require('jsonwebtoken');
|
|
13
13
|
var node_buffer = require('node:buffer');
|
|
@@ -17,9 +17,9 @@ var node_crypto = require('node:crypto');
|
|
|
17
17
|
var util = require('util');
|
|
18
18
|
var cryptoJs = require('@o2ter/crypto-js');
|
|
19
19
|
var _const = require('./internals/const-C3I6cfav.js');
|
|
20
|
-
var Decimal = require('decimal.js');
|
|
21
20
|
var queryType = require('query-types');
|
|
22
21
|
var busboy = require('busboy');
|
|
22
|
+
var Decimal = require('decimal.js');
|
|
23
23
|
require('axios');
|
|
24
24
|
require('@o2ter/server-js/dist/const');
|
|
25
25
|
require('socket.io-client');
|
|
@@ -132,9 +132,12 @@ const dispatcher = (proto, options) => {
|
|
|
132
132
|
const isGet = _validator.isGetMethod(decoded.filter);
|
|
133
133
|
if (!_validator.validateCLPs(query.className, isGet ? 'get' : 'find'))
|
|
134
134
|
throw Error('No permission');
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
const weight = opts?.weight ? validator.QueryExpression.decode(opts.weight, false) : undefined;
|
|
136
|
+
for (const key of weight?.keyPaths() ?? []) {
|
|
137
|
+
if (!_validator.validateKey(query.className, key, 'read', validator.QueryValidator.patterns.path))
|
|
138
|
+
throw Error('No permission');
|
|
139
|
+
}
|
|
140
|
+
return proto.storage.random(decoded, { weight });
|
|
138
141
|
},
|
|
139
142
|
async insert(options, values) {
|
|
140
143
|
if (!createFile && options.className === 'File')
|
|
@@ -2001,16 +2004,12 @@ var classesRoute = (router, proto) => {
|
|
|
2001
2004
|
return void res.sendStatus(404);
|
|
2002
2005
|
const payload = proto.connect(req);
|
|
2003
2006
|
const { weight } = req.query;
|
|
2004
|
-
if (_.isEmpty(weight) || !_.isString(weight))
|
|
2005
|
-
throw Error('Invalid operation');
|
|
2006
2007
|
await response(res, async () => createQuery(payload, req, true).random({ weight }, { master: payload.isMaster }));
|
|
2007
2008
|
});
|
|
2008
2009
|
router.get('/relation/random', queryType.middleware(), async (req, res) => {
|
|
2009
2010
|
res.setHeader('Cache-Control', ['no-cache', 'no-store']);
|
|
2010
2011
|
const payload = proto.connect(req);
|
|
2011
2012
|
const { weight } = req.query;
|
|
2012
|
-
if (_.isEmpty(weight) || !_.isString(weight))
|
|
2013
|
-
throw Error('Invalid operation');
|
|
2014
2013
|
await response(res, async () => createQuery(payload, req, true).random({ weight }, { master: payload.isMaster }));
|
|
2015
2014
|
});
|
|
2016
2015
|
router.get('/classes/:name/nonrefs', queryType.middleware(), async (req, res) => {
|
|
@@ -2664,12 +2663,6 @@ const registerProtoSocket = (proto, server, endpoint) => {
|
|
|
2664
2663
|
exports.ProtoClient = index.ProtoClient;
|
|
2665
2664
|
exports.classExtends = index.classExtends;
|
|
2666
2665
|
exports.deserialize = index.deserialize;
|
|
2667
|
-
exports.isFile = index.isFile;
|
|
2668
|
-
exports.isJob = index.isJob;
|
|
2669
|
-
exports.isObject = index.isObject;
|
|
2670
|
-
exports.isQuery = index.isQuery;
|
|
2671
|
-
exports.isRole = index.isRole;
|
|
2672
|
-
exports.isUser = index.isUser;
|
|
2673
2666
|
exports.serialize = index.serialize;
|
|
2674
2667
|
Object.defineProperty(exports, "Decimal", {
|
|
2675
2668
|
enumerable: true,
|