polfan-server-js-client 0.2.74 → 0.2.75
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/build/index.cjs.js
CHANGED
|
@@ -3219,9 +3219,7 @@ function PermissionsManager_toPrimitive(t, r) { if ("object" != PermissionsManag
|
|
|
3219
3219
|
|
|
3220
3220
|
|
|
3221
3221
|
var getOvId = function getOvId(location, target) {
|
|
3222
|
-
return [location.roomId ? null :
|
|
3223
|
-
// unify declaration of both space and room level overwrites
|
|
3224
|
-
location.roomId, location.topicId, target === null || target === void 0 ? void 0 : target.type, target === null || target === void 0 ? void 0 : target.userId, target === null || target === void 0 ? void 0 : target.roleId].filter(Boolean).join('/');
|
|
3222
|
+
return [location.spaceId, location.roomId, location.topicId, target === null || target === void 0 ? void 0 : target.type, target === null || target === void 0 ? void 0 : target.userId, target === null || target === void 0 ? void 0 : target.roleId].filter(Boolean).join('/');
|
|
3225
3223
|
};
|
|
3226
3224
|
var getOvIdByObject = function getOvIdByObject(overwrites) {
|
|
3227
3225
|
return getOvId(overwrites.location, overwrites.target);
|
|
@@ -3366,19 +3364,38 @@ var PermissionsManager = /*#__PURE__*/function (_EventTarget) {
|
|
|
3366
3364
|
key: "calculatePermissions",
|
|
3367
3365
|
value: function () {
|
|
3368
3366
|
var _calculatePermissions = PermissionsManager_asyncToGenerator(/*#__PURE__*/PermissionsManager_regenerator().m(function _callee4(location) {
|
|
3369
|
-
var _spaceMember$roles, _roomMember$roles, _yield$this$tracker$s, _yield$this$tracker$r
|
|
3370
|
-
var userId, _yield$this$fetchMemb, _yield$this$fetchMemb2, spaceMember, roomMember, userRoles, promises, filterLocation, _filterLocation, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0
|
|
3367
|
+
var _location$spaceId, _spaceMember$roles, _roomMember$roles, _yield$this$tracker$s, _yield$this$tracker$r;
|
|
3368
|
+
var room, userId, _yield$this$fetchMemb, _yield$this$fetchMemb2, spaceMember, roomMember, userRoles, promises, filterLocation, _filterLocation, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0;
|
|
3371
3369
|
return PermissionsManager_regenerator().w(function (_context4) {
|
|
3372
3370
|
while (1) switch (_context4.n) {
|
|
3373
3371
|
case 0:
|
|
3374
|
-
|
|
3372
|
+
if (!location.roomId) {
|
|
3373
|
+
_context4.n = 2;
|
|
3374
|
+
break;
|
|
3375
|
+
}
|
|
3375
3376
|
_context4.n = 1;
|
|
3376
|
-
return this.tracker.
|
|
3377
|
+
return this.tracker.rooms.get();
|
|
3377
3378
|
case 1:
|
|
3379
|
+
_t = _context4.v.get(location.roomId);
|
|
3380
|
+
_context4.n = 3;
|
|
3381
|
+
break;
|
|
3382
|
+
case 2:
|
|
3383
|
+
_t = null;
|
|
3384
|
+
case 3:
|
|
3385
|
+
room = _t;
|
|
3386
|
+
location = {
|
|
3387
|
+
spaceId: (_location$spaceId = location.spaceId) !== null && _location$spaceId !== void 0 ? _location$spaceId : room === null || room === void 0 ? void 0 : room.spaceId,
|
|
3388
|
+
roomId: location.roomId,
|
|
3389
|
+
topicId: location.topicId
|
|
3390
|
+
};
|
|
3391
|
+
this.validateLocation(location);
|
|
3392
|
+
_context4.n = 4;
|
|
3393
|
+
return this.tracker.getMe();
|
|
3394
|
+
case 4:
|
|
3378
3395
|
userId = _context4.v.id;
|
|
3379
|
-
_context4.n =
|
|
3396
|
+
_context4.n = 5;
|
|
3380
3397
|
return this.fetchMembersOrFail(location);
|
|
3381
|
-
case
|
|
3398
|
+
case 5:
|
|
3382
3399
|
_yield$this$fetchMemb = _context4.v;
|
|
3383
3400
|
_yield$this$fetchMemb2 = PermissionsManager_slicedToArray(_yield$this$fetchMemb, 2);
|
|
3384
3401
|
spaceMember = _yield$this$fetchMemb2[0];
|
|
@@ -3392,33 +3409,33 @@ var PermissionsManager = /*#__PURE__*/function (_EventTarget) {
|
|
|
3392
3409
|
}).then(function (v) {
|
|
3393
3410
|
return v.overwrites;
|
|
3394
3411
|
})];
|
|
3395
|
-
|
|
3396
|
-
if (!
|
|
3397
|
-
_context4.n =
|
|
3412
|
+
_t2 = location.spaceId;
|
|
3413
|
+
if (!_t2) {
|
|
3414
|
+
_context4.n = 9;
|
|
3398
3415
|
break;
|
|
3399
3416
|
}
|
|
3400
|
-
_context4.n =
|
|
3417
|
+
_context4.n = 6;
|
|
3401
3418
|
return this.tracker.spaces.get();
|
|
3402
|
-
case
|
|
3403
|
-
|
|
3404
|
-
|
|
3419
|
+
case 6:
|
|
3420
|
+
_t5 = _yield$this$tracker$s = _context4.v;
|
|
3421
|
+
_t4 = _t5 !== null;
|
|
3422
|
+
if (!_t4) {
|
|
3423
|
+
_context4.n = 7;
|
|
3424
|
+
break;
|
|
3425
|
+
}
|
|
3426
|
+
_t4 = _yield$this$tracker$s !== void 0;
|
|
3427
|
+
case 7:
|
|
3428
|
+
_t3 = _t4;
|
|
3405
3429
|
if (!_t3) {
|
|
3406
|
-
_context4.n =
|
|
3430
|
+
_context4.n = 8;
|
|
3407
3431
|
break;
|
|
3408
3432
|
}
|
|
3409
|
-
_t3 = _yield$this$tracker$s
|
|
3410
|
-
case
|
|
3433
|
+
_t3 = _yield$this$tracker$s.has(location.spaceId);
|
|
3434
|
+
case 8:
|
|
3411
3435
|
_t2 = _t3;
|
|
3436
|
+
case 9:
|
|
3412
3437
|
if (!_t2) {
|
|
3413
|
-
_context4.n =
|
|
3414
|
-
break;
|
|
3415
|
-
}
|
|
3416
|
-
_t2 = _yield$this$tracker$s.has(location.spaceId);
|
|
3417
|
-
case 5:
|
|
3418
|
-
_t = _t2;
|
|
3419
|
-
case 6:
|
|
3420
|
-
if (!_t) {
|
|
3421
|
-
_context4.n = 7;
|
|
3438
|
+
_context4.n = 10;
|
|
3422
3439
|
break;
|
|
3423
3440
|
}
|
|
3424
3441
|
filterLocation = {
|
|
@@ -3431,79 +3448,51 @@ var PermissionsManager = /*#__PURE__*/function (_EventTarget) {
|
|
|
3431
3448
|
}).then(function (v) {
|
|
3432
3449
|
return v.overwrites;
|
|
3433
3450
|
}));
|
|
3434
|
-
case
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3451
|
+
case 10:
|
|
3452
|
+
if (room) {
|
|
3453
|
+
_filterLocation = {
|
|
3454
|
+
spaceId: location.spaceId,
|
|
3455
|
+
roomId: location.roomId
|
|
3456
|
+
};
|
|
3457
|
+
if (userRoles.length) {
|
|
3458
|
+
promises.push(this.collectRoleOverwrites(_filterLocation, userRoles));
|
|
3459
|
+
}
|
|
3460
|
+
promises.push(this.getOverwrites(_filterLocation, {
|
|
3461
|
+
type: 'User',
|
|
3462
|
+
userId: userId
|
|
3463
|
+
}).then(function (v) {
|
|
3464
|
+
return v.overwrites;
|
|
3465
|
+
}));
|
|
3448
3466
|
}
|
|
3449
|
-
|
|
3450
|
-
case 9:
|
|
3451
|
-
_t6 = _t7;
|
|
3467
|
+
_t6 = location.topicId;
|
|
3452
3468
|
if (!_t6) {
|
|
3453
|
-
_context4.n =
|
|
3469
|
+
_context4.n = 14;
|
|
3454
3470
|
break;
|
|
3455
3471
|
}
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
_t5 = _t6;
|
|
3472
|
+
_context4.n = 11;
|
|
3473
|
+
return this.tracker.rooms.getTopics(location.roomId);
|
|
3459
3474
|
case 11:
|
|
3460
|
-
|
|
3475
|
+
_t9 = _yield$this$tracker$r = _context4.v;
|
|
3476
|
+
_t8 = _t9 !== null;
|
|
3477
|
+
if (!_t8) {
|
|
3461
3478
|
_context4.n = 12;
|
|
3462
3479
|
break;
|
|
3463
3480
|
}
|
|
3464
|
-
|
|
3465
|
-
spaceId: location.spaceId,
|
|
3466
|
-
roomId: location.roomId
|
|
3467
|
-
};
|
|
3468
|
-
if (userRoles.length) {
|
|
3469
|
-
promises.push(this.collectRoleOverwrites(_filterLocation, userRoles));
|
|
3470
|
-
}
|
|
3471
|
-
promises.push(this.getOverwrites(_filterLocation, {
|
|
3472
|
-
type: 'User',
|
|
3473
|
-
userId: userId
|
|
3474
|
-
}).then(function (v) {
|
|
3475
|
-
return v.overwrites;
|
|
3476
|
-
}));
|
|
3481
|
+
_t8 = _yield$this$tracker$r !== void 0;
|
|
3477
3482
|
case 12:
|
|
3478
|
-
|
|
3479
|
-
if (!
|
|
3480
|
-
_context4.n =
|
|
3483
|
+
_t7 = _t8;
|
|
3484
|
+
if (!_t7) {
|
|
3485
|
+
_context4.n = 13;
|
|
3481
3486
|
break;
|
|
3482
3487
|
}
|
|
3483
|
-
|
|
3484
|
-
return this.tracker.rooms.getTopics(location.roomId);
|
|
3488
|
+
_t7 = _yield$this$tracker$r.has(location.topicId);
|
|
3485
3489
|
case 13:
|
|
3486
|
-
|
|
3487
|
-
_t1 = _t10 !== null;
|
|
3488
|
-
if (!_t1) {
|
|
3489
|
-
_context4.n = 14;
|
|
3490
|
-
break;
|
|
3491
|
-
}
|
|
3492
|
-
_t1 = _yield$this$tracker$r2 !== void 0;
|
|
3490
|
+
_t6 = _t7;
|
|
3493
3491
|
case 14:
|
|
3494
|
-
|
|
3495
|
-
if (!_t0) {
|
|
3492
|
+
if (!_t6) {
|
|
3496
3493
|
_context4.n = 15;
|
|
3497
3494
|
break;
|
|
3498
3495
|
}
|
|
3499
|
-
_t0 = _yield$this$tracker$r2.has(location.topicId);
|
|
3500
|
-
case 15:
|
|
3501
|
-
_t9 = _t0;
|
|
3502
|
-
case 16:
|
|
3503
|
-
if (!_t9) {
|
|
3504
|
-
_context4.n = 17;
|
|
3505
|
-
break;
|
|
3506
|
-
}
|
|
3507
3496
|
if (userRoles.length) {
|
|
3508
3497
|
promises.push(this.collectRoleOverwrites(location, userRoles));
|
|
3509
3498
|
}
|
|
@@ -3513,12 +3502,12 @@ var PermissionsManager = /*#__PURE__*/function (_EventTarget) {
|
|
|
3513
3502
|
}).then(function (v) {
|
|
3514
3503
|
return v.overwrites;
|
|
3515
3504
|
}));
|
|
3516
|
-
case
|
|
3517
|
-
|
|
3518
|
-
_context4.n =
|
|
3505
|
+
case 15:
|
|
3506
|
+
_t0 = this;
|
|
3507
|
+
_context4.n = 16;
|
|
3519
3508
|
return Promise.all(promises);
|
|
3520
|
-
case
|
|
3521
|
-
return _context4.a(2,
|
|
3509
|
+
case 16:
|
|
3510
|
+
return _context4.a(2, _t0.resolveOverwritesHierarchy.call(_t0, _context4.v));
|
|
3522
3511
|
}
|
|
3523
3512
|
}, _callee4, this);
|
|
3524
3513
|
}));
|