proto.io 0.0.215 → 0.0.216
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 +4 -8
- package/dist/adapters/storage/progres.js +444 -425
- package/dist/adapters/storage/progres.js.map +1 -1
- package/dist/adapters/storage/progres.mjs +445 -426
- package/dist/adapters/storage/progres.mjs.map +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/client.mjs +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -11
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{base-Cp5le5dC.d.ts → base-BO3ZP6EF.d.ts} +2 -2
- package/dist/internals/base-BO3ZP6EF.d.ts.map +1 -0
- package/dist/internals/{chunk--Vo2-p-z.d.ts → chunk-DDkLpKXp.d.ts} +3 -3
- package/dist/internals/chunk-DDkLpKXp.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-CZUGnb-y.d.ts → index-CYhA8SU8.d.ts} +2 -2
- package/dist/internals/index-CYhA8SU8.d.ts.map +1 -0
- package/dist/internals/{index-ZPbBr9Db.mjs → index-DF2AfSGK.mjs} +2 -2
- package/dist/internals/index-DF2AfSGK.mjs.map +1 -0
- package/dist/internals/index-DfnPpl1I.js.map +1 -1
- package/dist/internals/{index-YLrO0f2D.d.ts → index-HdMgLYtD.d.ts} +8 -5
- package/dist/internals/index-HdMgLYtD.d.ts.map +1 -0
- package/dist/internals/{validator-m6wY35c6.js → validator-BBjOdLiT.js} +4 -1
- package/dist/internals/validator-BBjOdLiT.js.map +1 -0
- package/dist/internals/{validator-ChrCrz_C.mjs → validator-LNgZGT_l.mjs} +5 -3
- package/dist/internals/validator-LNgZGT_l.mjs.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-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, e as isFile, f as isJob, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-
|
|
1
|
+
import { P as ProtoClient } from './internals/index-CYhA8SU8.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-CYhA8SU8.js';
|
|
3
3
|
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-
|
|
4
|
+
export { D as DeserializeOptions, S as SerializeOptions, e as TNumber, f as TSerializable, g as deserialize, s as serialize } from './internals/index-HdMgLYtD.js';
|
|
5
5
|
import '@o2ter/utils-js';
|
|
6
6
|
import 'socket.io-client';
|
|
7
7
|
import '@socket.io/component-emitter';
|
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, h as isFile, j as isJob, e as isObject, i as isQuery, g as isRole, f as isUser, s as serialize } from './internals/index-
|
|
1
|
+
import { b as ProtoClient } from './internals/index-DF2AfSGK.mjs';
|
|
2
|
+
export { c as classExtends, d as deserialize, h as isFile, j as isJob, e as isObject, i as isQuery, g as isRole, f as isUser, s as serialize } from './internals/index-DF2AfSGK.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/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-HdMgLYtD.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-HdMgLYtD.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-
|
|
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-CYhA8SU8.js';
|
|
9
9
|
import '@o2ter/utils-js';
|
|
10
10
|
import 'jsonwebtoken';
|
|
11
11
|
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 validator = require('./internals/validator-
|
|
7
|
+
var validator = require('./internals/validator-BBjOdLiT.js');
|
|
8
8
|
var _private = require('./internals/private-Ciddhure.js');
|
|
9
9
|
var utilsJs = require('@o2ter/utils-js');
|
|
10
10
|
var index = require('./internals/index-DfnPpl1I.js');
|
|
@@ -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) => {
|