proto.io 0.0.149 → 0.0.151
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 +4 -1
- package/dist/adapters/storage/progres.js +7 -1
- package/dist/adapters/storage/progres.js.map +1 -1
- package/dist/adapters/storage/progres.mjs +7 -1
- package/dist/adapters/storage/progres.mjs.map +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -7
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{index-DnREUbmG.d.ts → index-DGI4rZSw.d.ts} +6 -4
- package/dist/internals/index-DGI4rZSw.d.ts.map +1 -0
- package/dist/internals/{index-CKgKjs8z.d.ts → index-DoamtgZq.d.ts} +2 -2
- package/dist/internals/index-DoamtgZq.d.ts.map +1 -0
- package/dist/internals/{index-BuXVzVd8.d.ts → index-Wck9rIH6.d.ts} +2 -2
- package/dist/internals/index-Wck9rIH6.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/internals/index-BuXVzVd8.d.ts.map +0 -1
- package/dist/internals/index-CKgKjs8z.d.ts.map +0 -1
- package/dist/internals/index-DnREUbmG.d.ts.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, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-
|
|
1
|
+
import { P as ProtoClient } from './internals/index-DoamtgZq.js';
|
|
2
|
+
export { c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-DoamtgZq.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-DGI4rZSw.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-
|
|
6
|
-
export { D as DeserializeOptions, S as SerializeOptions, c as TFileStorage, d as TSerializable, e as deserialize, s as serialize } from './internals/index-
|
|
5
|
+
import { T as TSchema, _ as _TValue, P as ProtoService, a as ProtoServiceOptions, b as ProtoServiceKeyOptions } from './internals/index-DGI4rZSw.js';
|
|
6
|
+
export { D as DeserializeOptions, S as SerializeOptions, c as TFileStorage, d as TSerializable, e as deserialize, s as serialize } from './internals/index-DGI4rZSw.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-
|
|
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-DoamtgZq.js';
|
|
10
10
|
import '@o2ter/utils-js';
|
|
11
11
|
import 'jsonwebtoken';
|
|
12
12
|
import 'lodash';
|
package/dist/index.js
CHANGED
|
@@ -146,7 +146,7 @@ const dispatcher = (proto, options, disableSecurity) => {
|
|
|
146
146
|
includes: _includes,
|
|
147
147
|
matches: _matches,
|
|
148
148
|
objectIdSize: proto[_private.PVK].options.objectIdSize
|
|
149
|
-
}, _attrs), { lockTable: options.className });
|
|
149
|
+
}, _attrs), { lockTable: options.className, retry: true });
|
|
150
150
|
}
|
|
151
151
|
catch (e) {
|
|
152
152
|
if (proto.storage.isDuplicateIdError(e))
|
|
@@ -170,7 +170,7 @@ const dispatcher = (proto, options, disableSecurity) => {
|
|
|
170
170
|
includes: _includes,
|
|
171
171
|
matches: _matches,
|
|
172
172
|
objectIdSize: proto[_private.PVK].options.objectIdSize
|
|
173
|
-
}, _attrs), { lockTable: options.className });
|
|
173
|
+
}, _attrs), { lockTable: options.className, retry: true });
|
|
174
174
|
}
|
|
175
175
|
catch (e) {
|
|
176
176
|
if (proto.storage.isDuplicateIdError(e))
|
|
@@ -196,7 +196,7 @@ const dispatcher = (proto, options, disableSecurity) => {
|
|
|
196
196
|
const _setOnInsert = normalize(_validator.validateFields(query.className, setOnInsert, 'create', random.QueryValidator.patterns.name));
|
|
197
197
|
while (true) {
|
|
198
198
|
try {
|
|
199
|
-
return await proto.storage.atomic((storage) => storage.upsertOne(_query, _update, _setOnInsert));
|
|
199
|
+
return await proto.storage.atomic((storage) => storage.upsertOne(_query, _update, _setOnInsert), { lockTable: query.className, retry: true });
|
|
200
200
|
}
|
|
201
201
|
catch (e) {
|
|
202
202
|
if (proto.storage.isDuplicateIdError(e))
|
|
@@ -1147,9 +1147,9 @@ const sessionId = (proto, request) => {
|
|
|
1147
1147
|
const sessionInfoMap = new WeakMap();
|
|
1148
1148
|
const fetchSessionInfo = async (proto, userId) => {
|
|
1149
1149
|
const user = _.isString(userId) ? await proto.Query('User').get(userId, { master: true }) : undefined;
|
|
1150
|
-
const roles = user instanceof index.TUser ? _.
|
|
1150
|
+
const roles = user instanceof index.TUser ? _.filter(await proto.userRoles(user), x => !_.isEmpty(x.name)) : [];
|
|
1151
1151
|
return {
|
|
1152
|
-
|
|
1152
|
+
_roles: roles,
|
|
1153
1153
|
user: user instanceof index.TUser ? user : undefined,
|
|
1154
1154
|
};
|
|
1155
1155
|
};
|
|
@@ -1346,9 +1346,13 @@ class ProtoService extends index.ProtoType {
|
|
|
1346
1346
|
const session = await this.sessionInfo();
|
|
1347
1347
|
return session?.user;
|
|
1348
1348
|
}
|
|
1349
|
-
async
|
|
1349
|
+
async _currentRoles() {
|
|
1350
1350
|
const session = await this.sessionInfo();
|
|
1351
|
-
return session?.
|
|
1351
|
+
return session?._roles ?? [];
|
|
1352
|
+
}
|
|
1353
|
+
async currentRoles() {
|
|
1354
|
+
const roles = await this._currentRoles();
|
|
1355
|
+
return _.compact(_.map(roles, x => x.name));
|
|
1352
1356
|
}
|
|
1353
1357
|
get isMaster() {
|
|
1354
1358
|
return this.req ? sessionIsMaster(this, this.req) === 'valid' : false;
|