@lifeready/core 8.0.14 → 8.0.15

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.
@@ -1409,18 +1409,21 @@
1409
1409
  var KC_CONFIG = new i0.InjectionToken('KC_CONFIG');
1410
1410
  var RETRY_ERROR_CODES = [exports.KcErrorCode.CONCURRENT_ACCESS];
1411
1411
  function httpOptions(auth, config) {
1412
- var _a;
1412
+ var _a, _b;
1413
1413
  return __awaiter(this, void 0, void 0, function () {
1414
- var token, debugUsername;
1415
- return __generator(this, function (_b) {
1416
- switch (_b.label) {
1414
+ var token, debugUsername, debugRbacCacheMode;
1415
+ return __generator(this, function (_c) {
1416
+ switch (_c.label) {
1417
1417
  case 0: return [4 /*yield*/, getAccessJwtToken(auth)];
1418
1418
  case 1:
1419
- token = _b.sent();
1419
+ token = _c.sent();
1420
1420
  debugUsername = (_a = config.debug) === null || _a === void 0 ? void 0 : _a.username;
1421
+ debugRbacCacheMode = (_b = config.debug) === null || _b === void 0 ? void 0 : _b.rbacCacheMode;
1421
1422
  return [2 /*return*/, {
1422
1423
  withCredentials: true,
1423
- headers: Object.assign(Object.assign({}, (token && { authorization: "Bearer " + token })), (debugUsername && { 'x-kc-dev-user': debugUsername })),
1424
+ headers: Object.assign(Object.assign(Object.assign({}, (token && { authorization: "Bearer " + token })), (debugUsername && { 'x-kc-dev-user': debugUsername })), (debugRbacCacheMode && {
1425
+ 'x-kc-dev-rbac-cache-mode': debugRbacCacheMode,
1426
+ })),
1424
1427
  }];
1425
1428
  }
1426
1429
  });
@@ -1441,15 +1444,15 @@
1441
1444
  errorPolicy: 'all',
1442
1445
  },
1443
1446
  };
1444
- var authLink = context.setContext(function (_, _b) {
1445
- var headers = _b.headers;
1447
+ var authLink = context.setContext(function (_, _c) {
1448
+ var headers = _c.headers;
1446
1449
  return __awaiter(void 0, void 0, void 0, function () {
1447
1450
  var options;
1448
- return __generator(this, function (_b) {
1449
- switch (_b.label) {
1451
+ return __generator(this, function (_c) {
1452
+ switch (_c.label) {
1450
1453
  case 0: return [4 /*yield*/, httpOptions(auth, config)];
1451
1454
  case 1:
1452
- options = _b.sent();
1455
+ options = _c.sent();
1453
1456
  return [2 /*return*/, Object.assign(Object.assign({}, options), { headers: Object.assign(Object.assign({}, headers), options.headers) })];
1454
1457
  }
1455
1458
  });
@@ -3099,6 +3102,16 @@
3099
3102
  plainFieldName: 'plain',
3100
3103
  }),
3101
3104
  ]));
3105
+ this.registerProcessor('DirectoryShareNode', common.series([
3106
+ common.makeJsonParseProcessor({
3107
+ plainFieldName: 'plainMeta',
3108
+ }),
3109
+ ]));
3110
+ this.registerProcessor('FileShareNode', common.series([
3111
+ common.makeJsonParseProcessor({
3112
+ plainFieldName: 'plainMeta',
3113
+ }),
3114
+ ]));
3102
3115
  }
3103
3116
  QueryProcessorService.prototype.processQuery = function (fields, options) {
3104
3117
  return __awaiter(this, void 0, void 0, function () {
@@ -6875,6 +6888,8 @@
6875
6888
  // This will fail if debug is null. But when debug is null, this function
6876
6889
  // should not be called.
6877
6890
  this.kcConfig.debug.username = username;
6891
+ // Reset it so we don't get surprises.
6892
+ this.kcConfig.debug.rbacCacheMode = null;
6878
6893
  // This mechanism only works in a browser session because it needs to set cookies etc.
6879
6894
  // But it sets the last_login field for the users which we need in some tests.
6880
6895
  return [4 /*yield*/, this.http
@@ -6944,6 +6959,9 @@
6944
6959
  });
6945
6960
  });
6946
6961
  };
6962
+ AuthService.prototype.debugRetainRbacCache = function (b) {
6963
+ this.kcConfig.debug.rbacCacheMode = b ? 'retain' : null;
6964
+ };
6947
6965
  return AuthService;
6948
6966
  }(LrService));
6949
6967
  exports.AuthService.CHALLENGE_TIMEOUT = 1000 * 60 * 5;
@@ -11054,7 +11072,7 @@
11054
11072
  sharedCipherDataClearJson: existingDirectory.sharedCipherDataClearJson,
11055
11073
  });
11056
11074
  });
11057
- // Fill in any missing update directories
11075
+ // Fill in any missing update files
11058
11076
  mapEdges(existingReceiver.receiverItems.receiverFiles).forEach(function (existingFile) {
11059
11077
  if (deleteFilesOptions.includes(existingFile.file.id)) {
11060
11078
  return;
@@ -12123,8 +12141,8 @@
12123
12141
  var templateObject_1$q, templateObject_2$k, templateObject_3$h, templateObject_4$d, templateObject_5$b, templateObject_6$6, templateObject_7$5, templateObject_8$5, templateObject_9$5, templateObject_10$2, templateObject_11$1, templateObject_12$1;
12124
12142
 
12125
12143
  var TpCurrentUserSharedKeyQuery = gqlTyped(templateObject_1$r || (templateObject_1$r = __makeTemplateObject(["\nquery TpCurrentUserSharedKeyQuery($id: LrRelayIdInput!) {\n tp(id: $id){\n currentUserSharedKey {\n userSharedKey {\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n mkPxk {\n id\n }\n mkReshareRequestCipher\n mkReshareRequestSent\n mkReshareResponseCipher\n mkReshareResponseSent\n }\n }\n }\n}\n"], ["\nquery TpCurrentUserSharedKeyQuery($id: LrRelayIdInput!) {\n tp(id: $id){\n currentUserSharedKey {\n userSharedKey {\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n mkPxk {\n id\n }\n mkReshareRequestCipher\n mkReshareRequestSent\n mkReshareResponseCipher\n mkReshareResponseSent\n }\n }\n }\n}\n"])));
12126
- var DirectoryShareQuery = gqlTyped(templateObject_2$l || (templateObject_2$l = __makeTemplateObject(["\nquery DirectoryShareQuery($id: LrRelayIdInput!) {\n directoryShare(id: $id) {\n item {\n id\n }\n tp {\n id\n }\n }\n}\n"], ["\nquery DirectoryShareQuery($id: LrRelayIdInput!) {\n directoryShare(id: $id) {\n item {\n id\n }\n tp {\n id\n }\n }\n}\n"])));
12127
- var FileShareQuery = gqlTyped(templateObject_3$i || (templateObject_3$i = __makeTemplateObject(["\nquery FileShareItemIdQuery($id: LrRelayIdInput!) {\n fileShare(id: $id) {\n item {\n id\n }\n tp {\n id\n }\n }\n}\n"], ["\nquery FileShareItemIdQuery($id: LrRelayIdInput!) {\n fileShare(id: $id) {\n item {\n id\n }\n tp {\n id\n }\n }\n}\n"])));
12144
+ var DirectoryShareQuery = gqlTyped(templateObject_2$l || (templateObject_2$l = __makeTemplateObject(["\nquery DirectoryShareQuery($id: LrRelayIdInput!) {\n directoryShare(id: $id) {\n item {\n id\n }\n tp {\n id\n }\n shareType\n }\n}\n"], ["\nquery DirectoryShareQuery($id: LrRelayIdInput!) {\n directoryShare(id: $id) {\n item {\n id\n }\n tp {\n id\n }\n shareType\n }\n}\n"])));
12145
+ var FileShareQuery = gqlTyped(templateObject_3$i || (templateObject_3$i = __makeTemplateObject(["\nquery FileShareItemIdQuery($id: LrRelayIdInput!) {\n fileShare(id: $id) {\n item {\n id\n }\n tp {\n id\n }\n shareType\n }\n}\n"], ["\nquery FileShareItemIdQuery($id: LrRelayIdInput!) {\n fileShare(id: $id) {\n item {\n id\n }\n tp {\n id\n }\n shareType\n }\n}\n"])));
12128
12146
  var templateObject_1$r, templateObject_2$l, templateObject_3$i;
12129
12147
 
12130
12148
  exports.TrustedPartyService = /** @class */ (function (_super) {
@@ -12203,12 +12221,13 @@
12203
12221
  };
12204
12222
  TrustedPartyService.prototype.prepareCreateItemShareMutation = function (options) {
12205
12223
  return __awaiter(this, void 0, void 0, function () {
12206
- var itemId, itemKeyId, tpId, tpSharedKeyId, accessRole, isDirectory, shareType, itemKey, wrappingKey, wrappedItemKey;
12224
+ var itemId, itemKeyId, tpId, tpSharedKeyId, accessRole, isDirectory, shareType, plainMetaJson, plainMeta, itemKey, wrappingKey, wrappedItemKey;
12207
12225
  var _this = this;
12208
12226
  return __generator(this, function (_a) {
12209
12227
  switch (_a.label) {
12210
12228
  case 0:
12211
- itemId = options.itemId, itemKeyId = options.itemKeyId, tpId = options.tpId, tpSharedKeyId = options.tpSharedKeyId, accessRole = options.accessRole, isDirectory = options.isDirectory, shareType = options.shareType;
12229
+ itemId = options.itemId, itemKeyId = options.itemKeyId, tpId = options.tpId, tpSharedKeyId = options.tpSharedKeyId, accessRole = options.accessRole, isDirectory = options.isDirectory, shareType = options.shareType, plainMetaJson = options.plainMetaJson;
12230
+ plainMeta = plainMetaJson && JSON.stringify(plainMetaJson);
12212
12231
  if (accessRole == exports.AccessRoleChoice.DENY) {
12213
12232
  if (itemKeyId || tpSharedKeyId) {
12214
12233
  throw new KcBadArgumentException('If accessRole is AccessRoleChoice.DENY, must not specify any of itemId, itemKeyId, or tpSharedKeyId parameters');
@@ -12222,6 +12241,7 @@
12222
12241
  wrappingKeyId: null,
12223
12242
  wrappedItemKey: null,
12224
12243
  shareType: shareType,
12244
+ plainMeta: plainMeta,
12225
12245
  },
12226
12246
  }];
12227
12247
  }
@@ -12245,6 +12265,7 @@
12245
12265
  wrappingKeyId: wrappingKey.id,
12246
12266
  wrappedItemKey: wrappedItemKey,
12247
12267
  shareType: shareType,
12268
+ plainMeta: plainMeta,
12248
12269
  },
12249
12270
  }];
12250
12271
  }
@@ -12275,6 +12296,30 @@
12275
12296
  });
12276
12297
  });
12277
12298
  };
12299
+ TrustedPartyService.prototype.updateDetachedDirectoryShare = function (options) {
12300
+ return __awaiter(this, void 0, void 0, function () {
12301
+ return __generator(this, function (_a) {
12302
+ return [2 /*return*/, this.mutate(this.updateDetachedDirectoryShareMutation(options))];
12303
+ });
12304
+ });
12305
+ };
12306
+ TrustedPartyService.prototype.updateDetachedDirectoryShareMutation = function (options) {
12307
+ return __awaiter(this, void 0, void 0, function () {
12308
+ var _a, _b;
12309
+ return __generator(this, function (_c) {
12310
+ switch (_c.label) {
12311
+ case 0:
12312
+ _a = LrMutation.bind;
12313
+ _b = {
12314
+ mutation: UpdateDirectoryShareMutation
12315
+ };
12316
+ return [4 /*yield*/, this.prepareUpdateDetachedItemShareMutation(options)];
12317
+ case 1: return [2 /*return*/, new (_a.apply(LrMutation, [void 0, (_b.variables = _c.sent(),
12318
+ _b)]))()];
12319
+ }
12320
+ });
12321
+ });
12322
+ };
12278
12323
  TrustedPartyService.prototype.updateFileShare = function (options) {
12279
12324
  return __awaiter(this, void 0, void 0, function () {
12280
12325
  return __generator(this, function (_a) {
@@ -12299,6 +12344,30 @@
12299
12344
  });
12300
12345
  });
12301
12346
  };
12347
+ TrustedPartyService.prototype.updateDetachedFileShare = function (options) {
12348
+ return __awaiter(this, void 0, void 0, function () {
12349
+ return __generator(this, function (_a) {
12350
+ return [2 /*return*/, this.mutate(this.updateDetachedFileShareMutation(options))];
12351
+ });
12352
+ });
12353
+ };
12354
+ TrustedPartyService.prototype.updateDetachedFileShareMutation = function (options) {
12355
+ return __awaiter(this, void 0, void 0, function () {
12356
+ var _a, _b;
12357
+ return __generator(this, function (_c) {
12358
+ switch (_c.label) {
12359
+ case 0:
12360
+ _a = LrMutation.bind;
12361
+ _b = {
12362
+ mutation: UpdateFileShareMutation
12363
+ };
12364
+ return [4 /*yield*/, this.prepareUpdateDetachedItemShareMutation(options)];
12365
+ case 1: return [2 /*return*/, new (_a.apply(LrMutation, [void 0, (_b.variables = _c.sent(),
12366
+ _b)]))()];
12367
+ }
12368
+ });
12369
+ });
12370
+ };
12302
12371
  TrustedPartyService.prototype.getDirectoryShare = function (itemShareId) {
12303
12372
  return this.lrGraphQL.query({
12304
12373
  query: DirectoryShareQuery,
@@ -12317,13 +12386,15 @@
12317
12386
  };
12318
12387
  TrustedPartyService.prototype.prepareUpdateItemShareMutation = function (options) {
12319
12388
  return __awaiter(this, void 0, void 0, function () {
12320
- var itemShareId, accessRole, isDirectory, itemId, itemKeyId, tpId, tpSharedKeyId, itemShare, getItemShare, itemKey, wrappingKey, wrappedItemKey;
12389
+ var itemShareId, accessRole, isDirectory, itemId, itemKeyId, tpId, tpSharedKeyId, plainMetaJson, plainMeta, itemShare, getItemShare, itemKey, wrappingKey, wrappedItemKey;
12321
12390
  var _this = this;
12322
12391
  return __generator(this, function (_a) {
12323
12392
  switch (_a.label) {
12324
12393
  case 0:
12325
- itemShareId = options.itemShareId, accessRole = options.accessRole, isDirectory = options.isDirectory, itemId = options.itemId, itemKeyId = options.itemKeyId, tpId = options.tpId, tpSharedKeyId = options.tpSharedKeyId;
12326
- if (accessRole == exports.AccessRoleChoice.DENY) {
12394
+ itemShareId = options.itemShareId, accessRole = options.accessRole, isDirectory = options.isDirectory, itemId = options.itemId, itemKeyId = options.itemKeyId, tpId = options.tpId, tpSharedKeyId = options.tpSharedKeyId, plainMetaJson = options.plainMetaJson;
12395
+ plainMeta = plainMetaJson && JSON.stringify(plainMetaJson);
12396
+ // If not updating access role or updating to DENY role, then we don't need any key material.
12397
+ if (accessRole == null || accessRole == exports.AccessRoleChoice.DENY) {
12327
12398
  if (itemId || itemKeyId || tpId || tpSharedKeyId) {
12328
12399
  throw new KcBadArgumentException('If accessRole is AccessRoleChoice.DENY, must not specify any of itemId, itemKeyId, tpId, or tpSharedKeyId parameters');
12329
12400
  }
@@ -12331,9 +12402,7 @@
12331
12402
  input: {
12332
12403
  id: itemShareId,
12333
12404
  accessRole: accessRole,
12334
- itemKeyId: null,
12335
- wrappingKeyId: null,
12336
- wrappedItemKey: null,
12405
+ plainMeta: plainMeta,
12337
12406
  },
12338
12407
  }];
12339
12408
  }
@@ -12341,7 +12410,7 @@
12341
12410
  return __generator(this, function (_a) {
12342
12411
  switch (_a.label) {
12343
12412
  case 0:
12344
- if (!!itemShare) return [3 /*break*/, 4];
12413
+ if (!!itemShare) return [3 /*break*/, 5];
12345
12414
  if (!isDirectory) return [3 /*break*/, 2];
12346
12415
  return [4 /*yield*/, this.getDirectoryShare(itemShareId)];
12347
12416
  case 1:
@@ -12352,7 +12421,12 @@
12352
12421
  case 3:
12353
12422
  itemShare = (_a.sent()).fileShare;
12354
12423
  _a.label = 4;
12355
- case 4: return [2 /*return*/, itemShare];
12424
+ case 4:
12425
+ if (itemShare.shareType == exports.ShareTypeChoice.DETACHED) {
12426
+ throw new KcBadArgumentException('Use updateDetachedDirectoryShare() or updateDetachedFileShare() to updated DETACHED shares.');
12427
+ }
12428
+ _a.label = 5;
12429
+ case 5: return [2 /*return*/, itemShare];
12356
12430
  }
12357
12431
  });
12358
12432
  }); };
@@ -12411,12 +12485,28 @@
12411
12485
  itemKeyId: itemKey.id,
12412
12486
  wrappingKeyId: wrappingKey.id,
12413
12487
  wrappedItemKey: wrappedItemKey,
12488
+ plainMeta: plainMeta,
12414
12489
  },
12415
12490
  }];
12416
12491
  }
12417
12492
  });
12418
12493
  });
12419
12494
  };
12495
+ TrustedPartyService.prototype.prepareUpdateDetachedItemShareMutation = function (options) {
12496
+ return __awaiter(this, void 0, void 0, function () {
12497
+ var itemShareId, accessRole, plainMetaJson;
12498
+ return __generator(this, function (_a) {
12499
+ itemShareId = options.itemShareId, accessRole = options.accessRole, plainMetaJson = options.plainMetaJson;
12500
+ return [2 /*return*/, {
12501
+ input: {
12502
+ id: itemShareId,
12503
+ accessRole: accessRole,
12504
+ plainMeta: plainMetaJson && JSON.stringify(plainMetaJson),
12505
+ },
12506
+ }];
12507
+ });
12508
+ });
12509
+ };
12420
12510
  TrustedPartyService.prototype.deleteDirectoryShare = function (id) {
12421
12511
  return __awaiter(this, void 0, void 0, function () {
12422
12512
  return __generator(this, function (_a) {