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/index.mjs
CHANGED
|
@@ -143,7 +143,7 @@ const dispatcher = (proto, options, disableSecurity) => {
|
|
|
143
143
|
includes: _includes,
|
|
144
144
|
matches: _matches,
|
|
145
145
|
objectIdSize: proto[PVK].options.objectIdSize
|
|
146
|
-
}, _attrs), { lockTable: options.className });
|
|
146
|
+
}, _attrs), { lockTable: options.className, retry: true });
|
|
147
147
|
}
|
|
148
148
|
catch (e) {
|
|
149
149
|
if (proto.storage.isDuplicateIdError(e))
|
|
@@ -167,7 +167,7 @@ const dispatcher = (proto, options, disableSecurity) => {
|
|
|
167
167
|
includes: _includes,
|
|
168
168
|
matches: _matches,
|
|
169
169
|
objectIdSize: proto[PVK].options.objectIdSize
|
|
170
|
-
}, _attrs), { lockTable: options.className });
|
|
170
|
+
}, _attrs), { lockTable: options.className, retry: true });
|
|
171
171
|
}
|
|
172
172
|
catch (e) {
|
|
173
173
|
if (proto.storage.isDuplicateIdError(e))
|
|
@@ -193,7 +193,7 @@ const dispatcher = (proto, options, disableSecurity) => {
|
|
|
193
193
|
const _setOnInsert = normalize(_validator.validateFields(query.className, setOnInsert, 'create', QueryValidator.patterns.name));
|
|
194
194
|
while (true) {
|
|
195
195
|
try {
|
|
196
|
-
return await proto.storage.atomic((storage) => storage.upsertOne(_query, _update, _setOnInsert));
|
|
196
|
+
return await proto.storage.atomic((storage) => storage.upsertOne(_query, _update, _setOnInsert), { lockTable: query.className, retry: true });
|
|
197
197
|
}
|
|
198
198
|
catch (e) {
|
|
199
199
|
if (proto.storage.isDuplicateIdError(e))
|
|
@@ -1144,9 +1144,9 @@ const sessionId = (proto, request) => {
|
|
|
1144
1144
|
const sessionInfoMap = new WeakMap();
|
|
1145
1145
|
const fetchSessionInfo = async (proto, userId) => {
|
|
1146
1146
|
const user = _.isString(userId) ? await proto.Query('User').get(userId, { master: true }) : undefined;
|
|
1147
|
-
const roles = user instanceof TUser ? _.
|
|
1147
|
+
const roles = user instanceof TUser ? _.filter(await proto.userRoles(user), x => !_.isEmpty(x.name)) : [];
|
|
1148
1148
|
return {
|
|
1149
|
-
|
|
1149
|
+
_roles: roles,
|
|
1150
1150
|
user: user instanceof TUser ? user : undefined,
|
|
1151
1151
|
};
|
|
1152
1152
|
};
|
|
@@ -1343,9 +1343,13 @@ class ProtoService extends ProtoType {
|
|
|
1343
1343
|
const session = await this.sessionInfo();
|
|
1344
1344
|
return session?.user;
|
|
1345
1345
|
}
|
|
1346
|
-
async
|
|
1346
|
+
async _currentRoles() {
|
|
1347
1347
|
const session = await this.sessionInfo();
|
|
1348
|
-
return session?.
|
|
1348
|
+
return session?._roles ?? [];
|
|
1349
|
+
}
|
|
1350
|
+
async currentRoles() {
|
|
1351
|
+
const roles = await this._currentRoles();
|
|
1352
|
+
return _.compact(_.map(roles, x => x.name));
|
|
1349
1353
|
}
|
|
1350
1354
|
get isMaster() {
|
|
1351
1355
|
return this.req ? sessionIsMaster(this, this.req) === 'valid' : false;
|