@lifeready/core 8.0.12 → 8.0.13

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.
@@ -10912,6 +10912,7 @@
10912
10912
  if (!(accessRole == exports.AccessRoleChoice.DENY)) return [3 /*break*/, 1];
10913
10913
  ret = {
10914
10914
  accessRole: accessRole,
10915
+ itemKeyId: null,
10915
10916
  wrappedItemKey: null,
10916
10917
  sharedCipherData: null,
10917
10918
  };
@@ -10945,6 +10946,7 @@
10945
10946
  wrappedItemKey = _a.sent();
10946
10947
  ret = {
10947
10948
  accessRole: accessRole,
10949
+ itemKeyId: itemKey.id,
10948
10950
  wrappedItemKey: wrappedItemKey,
10949
10951
  sharedCipherData: sharedCipherData,
10950
10952
  };
@@ -12117,7 +12119,9 @@
12117
12119
  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;
12118
12120
 
12119
12121
  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"])));
12120
- var templateObject_1$r;
12122
+ 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"])));
12123
+ 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"])));
12124
+ var templateObject_1$r, templateObject_2$l, templateObject_3$i;
12121
12125
 
12122
12126
  exports.TrustedPartyService = /** @class */ (function (_super) {
12123
12127
  __extends(TrustedPartyService, _super);
@@ -12195,12 +12199,28 @@
12195
12199
  };
12196
12200
  TrustedPartyService.prototype.prepareCreateItemShareMutation = function (options) {
12197
12201
  return __awaiter(this, void 0, void 0, function () {
12198
- var itemId, itemKeyId, tpId, tpSharedKeyId, accessRole, isDirectory, shareType, itemKey, wrappingKey, wrappedKey;
12202
+ var itemId, itemKeyId, tpId, tpSharedKeyId, accessRole, isDirectory, shareType, itemKey, wrappingKey, wrappedItemKey;
12199
12203
  var _this = this;
12200
12204
  return __generator(this, function (_a) {
12201
12205
  switch (_a.label) {
12202
12206
  case 0:
12203
12207
  itemId = options.itemId, itemKeyId = options.itemKeyId, tpId = options.tpId, tpSharedKeyId = options.tpSharedKeyId, accessRole = options.accessRole, isDirectory = options.isDirectory, shareType = options.shareType;
12208
+ if (accessRole == exports.AccessRoleChoice.DENY) {
12209
+ if (itemKeyId || tpSharedKeyId) {
12210
+ throw new KcBadArgumentException('If accessRole is AccessRoleChoice.DENY, must not specify any of itemId, itemKeyId, or tpSharedKeyId parameters');
12211
+ }
12212
+ return [2 /*return*/, {
12213
+ input: {
12214
+ itemId: itemId,
12215
+ tpId: tpId,
12216
+ accessRole: accessRole,
12217
+ itemKeyId: null,
12218
+ wrappingKeyId: null,
12219
+ wrappedItemKey: null,
12220
+ shareType: shareType,
12221
+ },
12222
+ }];
12223
+ }
12204
12224
  return [4 /*yield*/, this.keyGraph.getKey(itemKeyId, function () { return isDirectory
12205
12225
  ? _this.itemService.getDirectoryKeyId(itemId)
12206
12226
  : _this.itemService.getFileKeyId(itemId); })];
@@ -12211,15 +12231,15 @@
12211
12231
  wrappingKey = _a.sent();
12212
12232
  return [4 /*yield*/, this.keyGraph.wrapKey(wrappingKey, itemKey.jwk)];
12213
12233
  case 3:
12214
- wrappedKey = _a.sent();
12234
+ wrappedItemKey = _a.sent();
12215
12235
  return [2 /*return*/, {
12216
12236
  input: {
12217
- id: itemId,
12237
+ itemId: itemId,
12218
12238
  tpId: tpId,
12219
12239
  accessRole: accessRole,
12220
- keyId: itemKey.id,
12240
+ itemKeyId: itemKey.id,
12221
12241
  wrappingKeyId: wrappingKey.id,
12222
- wrappedKey: wrappedKey,
12242
+ wrappedItemKey: wrappedItemKey,
12223
12243
  shareType: shareType,
12224
12244
  },
12225
12245
  }];
@@ -12236,11 +12256,18 @@
12236
12256
  };
12237
12257
  TrustedPartyService.prototype.updateDirectoryShareMutation = function (options) {
12238
12258
  return __awaiter(this, void 0, void 0, function () {
12239
- return __generator(this, function (_a) {
12240
- return [2 /*return*/, new LrMutation({
12241
- mutation: UpdateDirectoryShareMutation,
12242
- variables: this.prepareUpdateItemShareMutation(options),
12243
- })];
12259
+ var _a, _b;
12260
+ return __generator(this, function (_c) {
12261
+ switch (_c.label) {
12262
+ case 0:
12263
+ _a = LrMutation.bind;
12264
+ _b = {
12265
+ mutation: UpdateDirectoryShareMutation
12266
+ };
12267
+ return [4 /*yield*/, this.prepareUpdateItemShareMutation(Object.assign(Object.assign({}, options), { isDirectory: true }))];
12268
+ case 1: return [2 /*return*/, new (_a.apply(LrMutation, [void 0, (_b.variables = _c.sent(),
12269
+ _b)]))()];
12270
+ }
12244
12271
  });
12245
12272
  });
12246
12273
  };
@@ -12253,22 +12280,138 @@
12253
12280
  };
12254
12281
  TrustedPartyService.prototype.updateFileShareMutation = function (options) {
12255
12282
  return __awaiter(this, void 0, void 0, function () {
12256
- return __generator(this, function (_a) {
12257
- return [2 /*return*/, new LrMutation({
12258
- mutation: UpdateFileShareMutation,
12259
- variables: this.prepareUpdateItemShareMutation(options),
12260
- })];
12283
+ var _a, _b;
12284
+ return __generator(this, function (_c) {
12285
+ switch (_c.label) {
12286
+ case 0:
12287
+ _a = LrMutation.bind;
12288
+ _b = {
12289
+ mutation: UpdateFileShareMutation
12290
+ };
12291
+ return [4 /*yield*/, this.prepareUpdateItemShareMutation(Object.assign(Object.assign({}, options), { isDirectory: false }))];
12292
+ case 1: return [2 /*return*/, new (_a.apply(LrMutation, [void 0, (_b.variables = _c.sent(),
12293
+ _b)]))()];
12294
+ }
12261
12295
  });
12262
12296
  });
12263
12297
  };
12264
- TrustedPartyService.prototype.prepareUpdateItemShareMutation = function (options) {
12265
- var itemShareId = options.itemShareId, accessRole = options.accessRole;
12266
- return {
12267
- input: {
12298
+ TrustedPartyService.prototype.getDirectoryShare = function (itemShareId) {
12299
+ return this.lrGraphQL.query({
12300
+ query: DirectoryShareQuery,
12301
+ variables: {
12268
12302
  id: itemShareId,
12269
- accessRole: accessRole,
12270
12303
  },
12271
- };
12304
+ });
12305
+ };
12306
+ TrustedPartyService.prototype.getFileShare = function (itemShareId) {
12307
+ return this.lrGraphQL.query({
12308
+ query: FileShareQuery,
12309
+ variables: {
12310
+ id: itemShareId,
12311
+ },
12312
+ });
12313
+ };
12314
+ TrustedPartyService.prototype.prepareUpdateItemShareMutation = function (options) {
12315
+ return __awaiter(this, void 0, void 0, function () {
12316
+ var itemShareId, accessRole, isDirectory, itemId, itemKeyId, tpId, tpSharedKeyId, itemShare, getItemShare, itemKey, wrappingKey, wrappedItemKey;
12317
+ var _this = this;
12318
+ return __generator(this, function (_a) {
12319
+ switch (_a.label) {
12320
+ case 0:
12321
+ itemShareId = options.itemShareId, accessRole = options.accessRole, isDirectory = options.isDirectory, itemId = options.itemId, itemKeyId = options.itemKeyId, tpId = options.tpId, tpSharedKeyId = options.tpSharedKeyId;
12322
+ if (accessRole == exports.AccessRoleChoice.DENY) {
12323
+ if (itemId || itemKeyId || tpId || tpSharedKeyId) {
12324
+ throw new KcBadArgumentException('If accessRole is AccessRoleChoice.DENY, must not specify any of itemId, itemKeyId, tpId, or tpSharedKeyId parameters');
12325
+ }
12326
+ return [2 /*return*/, {
12327
+ input: {
12328
+ id: itemShareId,
12329
+ accessRole: accessRole,
12330
+ itemKeyId: null,
12331
+ wrappingKeyId: null,
12332
+ wrappedItemKey: null,
12333
+ },
12334
+ }];
12335
+ }
12336
+ getItemShare = function () { return __awaiter(_this, void 0, void 0, function () {
12337
+ return __generator(this, function (_a) {
12338
+ switch (_a.label) {
12339
+ case 0:
12340
+ if (!!itemShare) return [3 /*break*/, 4];
12341
+ if (!isDirectory) return [3 /*break*/, 2];
12342
+ return [4 /*yield*/, this.getDirectoryShare(itemShareId)];
12343
+ case 1:
12344
+ itemShare = (_a.sent())
12345
+ .directoryShare;
12346
+ return [3 /*break*/, 4];
12347
+ case 2: return [4 /*yield*/, this.getFileShare(itemShareId)];
12348
+ case 3:
12349
+ itemShare = (_a.sent()).fileShare;
12350
+ _a.label = 4;
12351
+ case 4: return [2 /*return*/, itemShare];
12352
+ }
12353
+ });
12354
+ }); };
12355
+ return [4 /*yield*/, this.keyGraph.getKey(itemKeyId, function () { return __awaiter(_this, void 0, void 0, function () {
12356
+ var itemId_, _a;
12357
+ return __generator(this, function (_b) {
12358
+ switch (_b.label) {
12359
+ case 0:
12360
+ _a = itemId;
12361
+ if (_a) return [3 /*break*/, 2];
12362
+ return [4 /*yield*/, getItemShare()];
12363
+ case 1:
12364
+ _a = (_b.sent()).item.id;
12365
+ _b.label = 2;
12366
+ case 2:
12367
+ itemId_ = _a;
12368
+ if (isDirectory) {
12369
+ return [2 /*return*/, this.itemService.getDirectoryKeyId(itemId_)];
12370
+ }
12371
+ else {
12372
+ return [2 /*return*/, this.itemService.getFileKeyId(itemId_)];
12373
+ }
12374
+ return [2 /*return*/];
12375
+ }
12376
+ });
12377
+ }); })];
12378
+ case 1:
12379
+ itemKey = _a.sent();
12380
+ return [4 /*yield*/, this.keyGraph.getKey(tpSharedKeyId, function () { return __awaiter(_this, void 0, void 0, function () {
12381
+ var tpId_, _a;
12382
+ return __generator(this, function (_b) {
12383
+ switch (_b.label) {
12384
+ case 0:
12385
+ _a = tpId;
12386
+ if (_a) return [3 /*break*/, 2];
12387
+ return [4 /*yield*/, getItemShare()];
12388
+ case 1:
12389
+ _a = (_b.sent()).tp.id;
12390
+ _b.label = 2;
12391
+ case 2:
12392
+ tpId_ = _a;
12393
+ return [4 /*yield*/, this.getTpCurrentUserSharedKey(tpId_)];
12394
+ case 3: return [2 /*return*/, (_b.sent()).sharedKey.id];
12395
+ }
12396
+ });
12397
+ }); })];
12398
+ case 2:
12399
+ wrappingKey = _a.sent();
12400
+ return [4 /*yield*/, this.keyGraph.wrapKey(wrappingKey, itemKey.jwk)];
12401
+ case 3:
12402
+ wrappedItemKey = _a.sent();
12403
+ return [2 /*return*/, {
12404
+ input: {
12405
+ id: itemShareId,
12406
+ accessRole: accessRole,
12407
+ itemKeyId: itemKey.id,
12408
+ wrappingKeyId: wrappingKey.id,
12409
+ wrappedItemKey: wrappedItemKey,
12410
+ },
12411
+ }];
12412
+ }
12413
+ });
12414
+ });
12272
12415
  };
12273
12416
  TrustedPartyService.prototype.deleteDirectoryShare = function (id) {
12274
12417
  return __awaiter(this, void 0, void 0, function () {
@@ -12702,9 +12845,9 @@
12702
12845
  ]; };
12703
12846
 
12704
12847
  var RequestUserDeleteMutation = gql__default['default'](templateObject_1$s || (templateObject_1$s = __makeTemplateObject(["\n mutation RequestUserDelete($input: RequestUserDeleteInput!) {\n requestUserDelete(input: $input) {\n userDelete {\n state\n created\n }\n }\n }\n"], ["\n mutation RequestUserDelete($input: RequestUserDeleteInput!) {\n requestUserDelete(input: $input) {\n userDelete {\n state\n created\n }\n }\n }\n"])));
12705
- var CancelUserDeleteMutation = gql__default['default'](templateObject_2$l || (templateObject_2$l = __makeTemplateObject(["\n mutation CancelUserDelete($input: CancelUserDeleteInput!) {\n cancelUserDelete(input: $input) {\n id\n }\n }\n"], ["\n mutation CancelUserDelete($input: CancelUserDeleteInput!) {\n cancelUserDelete(input: $input) {\n id\n }\n }\n"])));
12706
- var LoginHistoryQuery = gql__default['default'](templateObject_3$i || (templateObject_3$i = __makeTemplateObject(["\n query LoginHistory($first: Int, $after: String) {\n loginHistory(first: $first, after: $after) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n events\n }\n }\n"], ["\n query LoginHistory($first: Int, $after: String) {\n loginHistory(first: $first, after: $after) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n events\n }\n }\n"])));
12707
- var templateObject_1$s, templateObject_2$l, templateObject_3$i;
12848
+ var CancelUserDeleteMutation = gql__default['default'](templateObject_2$m || (templateObject_2$m = __makeTemplateObject(["\n mutation CancelUserDelete($input: CancelUserDeleteInput!) {\n cancelUserDelete(input: $input) {\n id\n }\n }\n"], ["\n mutation CancelUserDelete($input: CancelUserDeleteInput!) {\n cancelUserDelete(input: $input) {\n id\n }\n }\n"])));
12849
+ var LoginHistoryQuery = gql__default['default'](templateObject_3$j || (templateObject_3$j = __makeTemplateObject(["\n query LoginHistory($first: Int, $after: String) {\n loginHistory(first: $first, after: $after) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n events\n }\n }\n"], ["\n query LoginHistory($first: Int, $after: String) {\n loginHistory(first: $first, after: $after) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n events\n }\n }\n"])));
12850
+ var templateObject_1$s, templateObject_2$m, templateObject_3$j;
12708
12851
 
12709
12852
  var UserService = /** @class */ (function () {
12710
12853
  function UserService(lrApollo) {