@lifeready/core 8.0.12 → 8.0.14

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.
@@ -3946,6 +3946,10 @@
3946
3946
  LinkTypeField["SOFT"] = "SOFT";
3947
3947
  LinkTypeField["REFERENCE"] = "REFERENCE";
3948
3948
  })(exports.LinkTypeField || (exports.LinkTypeField = {}));
3949
+ (function (BillingPeriodField) {
3950
+ BillingPeriodField["MONTHLY"] = "MONTHLY";
3951
+ BillingPeriodField["ANNUAL"] = "ANNUAL";
3952
+ })(exports.BillingPeriodField || (exports.BillingPeriodField = {}));
3949
3953
  (function (PlanStateField) {
3950
3954
  PlanStateField["TRIALLING"] = "TRIALLING";
3951
3955
  PlanStateField["ACTIVE"] = "ACTIVE";
@@ -10912,6 +10916,7 @@
10912
10916
  if (!(accessRole == exports.AccessRoleChoice.DENY)) return [3 /*break*/, 1];
10913
10917
  ret = {
10914
10918
  accessRole: accessRole,
10919
+ itemKeyId: null,
10915
10920
  wrappedItemKey: null,
10916
10921
  sharedCipherData: null,
10917
10922
  };
@@ -10945,6 +10950,7 @@
10945
10950
  wrappedItemKey = _a.sent();
10946
10951
  ret = {
10947
10952
  accessRole: accessRole,
10953
+ itemKeyId: itemKey.id,
10948
10954
  wrappedItemKey: wrappedItemKey,
10949
10955
  sharedCipherData: sharedCipherData,
10950
10956
  };
@@ -12117,7 +12123,9 @@
12117
12123
  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
12124
 
12119
12125
  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;
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"])));
12128
+ var templateObject_1$r, templateObject_2$l, templateObject_3$i;
12121
12129
 
12122
12130
  exports.TrustedPartyService = /** @class */ (function (_super) {
12123
12131
  __extends(TrustedPartyService, _super);
@@ -12195,12 +12203,28 @@
12195
12203
  };
12196
12204
  TrustedPartyService.prototype.prepareCreateItemShareMutation = function (options) {
12197
12205
  return __awaiter(this, void 0, void 0, function () {
12198
- var itemId, itemKeyId, tpId, tpSharedKeyId, accessRole, isDirectory, shareType, itemKey, wrappingKey, wrappedKey;
12206
+ var itemId, itemKeyId, tpId, tpSharedKeyId, accessRole, isDirectory, shareType, itemKey, wrappingKey, wrappedItemKey;
12199
12207
  var _this = this;
12200
12208
  return __generator(this, function (_a) {
12201
12209
  switch (_a.label) {
12202
12210
  case 0:
12203
12211
  itemId = options.itemId, itemKeyId = options.itemKeyId, tpId = options.tpId, tpSharedKeyId = options.tpSharedKeyId, accessRole = options.accessRole, isDirectory = options.isDirectory, shareType = options.shareType;
12212
+ if (accessRole == exports.AccessRoleChoice.DENY) {
12213
+ if (itemKeyId || tpSharedKeyId) {
12214
+ throw new KcBadArgumentException('If accessRole is AccessRoleChoice.DENY, must not specify any of itemId, itemKeyId, or tpSharedKeyId parameters');
12215
+ }
12216
+ return [2 /*return*/, {
12217
+ input: {
12218
+ itemId: itemId,
12219
+ tpId: tpId,
12220
+ accessRole: accessRole,
12221
+ itemKeyId: null,
12222
+ wrappingKeyId: null,
12223
+ wrappedItemKey: null,
12224
+ shareType: shareType,
12225
+ },
12226
+ }];
12227
+ }
12204
12228
  return [4 /*yield*/, this.keyGraph.getKey(itemKeyId, function () { return isDirectory
12205
12229
  ? _this.itemService.getDirectoryKeyId(itemId)
12206
12230
  : _this.itemService.getFileKeyId(itemId); })];
@@ -12211,15 +12235,15 @@
12211
12235
  wrappingKey = _a.sent();
12212
12236
  return [4 /*yield*/, this.keyGraph.wrapKey(wrappingKey, itemKey.jwk)];
12213
12237
  case 3:
12214
- wrappedKey = _a.sent();
12238
+ wrappedItemKey = _a.sent();
12215
12239
  return [2 /*return*/, {
12216
12240
  input: {
12217
- id: itemId,
12241
+ itemId: itemId,
12218
12242
  tpId: tpId,
12219
12243
  accessRole: accessRole,
12220
- keyId: itemKey.id,
12244
+ itemKeyId: itemKey.id,
12221
12245
  wrappingKeyId: wrappingKey.id,
12222
- wrappedKey: wrappedKey,
12246
+ wrappedItemKey: wrappedItemKey,
12223
12247
  shareType: shareType,
12224
12248
  },
12225
12249
  }];
@@ -12236,11 +12260,18 @@
12236
12260
  };
12237
12261
  TrustedPartyService.prototype.updateDirectoryShareMutation = function (options) {
12238
12262
  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
- })];
12263
+ var _a, _b;
12264
+ return __generator(this, function (_c) {
12265
+ switch (_c.label) {
12266
+ case 0:
12267
+ _a = LrMutation.bind;
12268
+ _b = {
12269
+ mutation: UpdateDirectoryShareMutation
12270
+ };
12271
+ return [4 /*yield*/, this.prepareUpdateItemShareMutation(Object.assign(Object.assign({}, options), { isDirectory: true }))];
12272
+ case 1: return [2 /*return*/, new (_a.apply(LrMutation, [void 0, (_b.variables = _c.sent(),
12273
+ _b)]))()];
12274
+ }
12244
12275
  });
12245
12276
  });
12246
12277
  };
@@ -12253,22 +12284,138 @@
12253
12284
  };
12254
12285
  TrustedPartyService.prototype.updateFileShareMutation = function (options) {
12255
12286
  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
- })];
12287
+ var _a, _b;
12288
+ return __generator(this, function (_c) {
12289
+ switch (_c.label) {
12290
+ case 0:
12291
+ _a = LrMutation.bind;
12292
+ _b = {
12293
+ mutation: UpdateFileShareMutation
12294
+ };
12295
+ return [4 /*yield*/, this.prepareUpdateItemShareMutation(Object.assign(Object.assign({}, options), { isDirectory: false }))];
12296
+ case 1: return [2 /*return*/, new (_a.apply(LrMutation, [void 0, (_b.variables = _c.sent(),
12297
+ _b)]))()];
12298
+ }
12261
12299
  });
12262
12300
  });
12263
12301
  };
12264
- TrustedPartyService.prototype.prepareUpdateItemShareMutation = function (options) {
12265
- var itemShareId = options.itemShareId, accessRole = options.accessRole;
12266
- return {
12267
- input: {
12302
+ TrustedPartyService.prototype.getDirectoryShare = function (itemShareId) {
12303
+ return this.lrGraphQL.query({
12304
+ query: DirectoryShareQuery,
12305
+ variables: {
12268
12306
  id: itemShareId,
12269
- accessRole: accessRole,
12270
12307
  },
12271
- };
12308
+ });
12309
+ };
12310
+ TrustedPartyService.prototype.getFileShare = function (itemShareId) {
12311
+ return this.lrGraphQL.query({
12312
+ query: FileShareQuery,
12313
+ variables: {
12314
+ id: itemShareId,
12315
+ },
12316
+ });
12317
+ };
12318
+ TrustedPartyService.prototype.prepareUpdateItemShareMutation = function (options) {
12319
+ return __awaiter(this, void 0, void 0, function () {
12320
+ var itemShareId, accessRole, isDirectory, itemId, itemKeyId, tpId, tpSharedKeyId, itemShare, getItemShare, itemKey, wrappingKey, wrappedItemKey;
12321
+ var _this = this;
12322
+ return __generator(this, function (_a) {
12323
+ switch (_a.label) {
12324
+ 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) {
12327
+ if (itemId || itemKeyId || tpId || tpSharedKeyId) {
12328
+ throw new KcBadArgumentException('If accessRole is AccessRoleChoice.DENY, must not specify any of itemId, itemKeyId, tpId, or tpSharedKeyId parameters');
12329
+ }
12330
+ return [2 /*return*/, {
12331
+ input: {
12332
+ id: itemShareId,
12333
+ accessRole: accessRole,
12334
+ itemKeyId: null,
12335
+ wrappingKeyId: null,
12336
+ wrappedItemKey: null,
12337
+ },
12338
+ }];
12339
+ }
12340
+ getItemShare = function () { return __awaiter(_this, void 0, void 0, function () {
12341
+ return __generator(this, function (_a) {
12342
+ switch (_a.label) {
12343
+ case 0:
12344
+ if (!!itemShare) return [3 /*break*/, 4];
12345
+ if (!isDirectory) return [3 /*break*/, 2];
12346
+ return [4 /*yield*/, this.getDirectoryShare(itemShareId)];
12347
+ case 1:
12348
+ itemShare = (_a.sent())
12349
+ .directoryShare;
12350
+ return [3 /*break*/, 4];
12351
+ case 2: return [4 /*yield*/, this.getFileShare(itemShareId)];
12352
+ case 3:
12353
+ itemShare = (_a.sent()).fileShare;
12354
+ _a.label = 4;
12355
+ case 4: return [2 /*return*/, itemShare];
12356
+ }
12357
+ });
12358
+ }); };
12359
+ return [4 /*yield*/, this.keyGraph.getKey(itemKeyId, function () { return __awaiter(_this, void 0, void 0, function () {
12360
+ var itemId_, _a;
12361
+ return __generator(this, function (_b) {
12362
+ switch (_b.label) {
12363
+ case 0:
12364
+ _a = itemId;
12365
+ if (_a) return [3 /*break*/, 2];
12366
+ return [4 /*yield*/, getItemShare()];
12367
+ case 1:
12368
+ _a = (_b.sent()).item.id;
12369
+ _b.label = 2;
12370
+ case 2:
12371
+ itemId_ = _a;
12372
+ if (isDirectory) {
12373
+ return [2 /*return*/, this.itemService.getDirectoryKeyId(itemId_)];
12374
+ }
12375
+ else {
12376
+ return [2 /*return*/, this.itemService.getFileKeyId(itemId_)];
12377
+ }
12378
+ return [2 /*return*/];
12379
+ }
12380
+ });
12381
+ }); })];
12382
+ case 1:
12383
+ itemKey = _a.sent();
12384
+ return [4 /*yield*/, this.keyGraph.getKey(tpSharedKeyId, function () { return __awaiter(_this, void 0, void 0, function () {
12385
+ var tpId_, _a;
12386
+ return __generator(this, function (_b) {
12387
+ switch (_b.label) {
12388
+ case 0:
12389
+ _a = tpId;
12390
+ if (_a) return [3 /*break*/, 2];
12391
+ return [4 /*yield*/, getItemShare()];
12392
+ case 1:
12393
+ _a = (_b.sent()).tp.id;
12394
+ _b.label = 2;
12395
+ case 2:
12396
+ tpId_ = _a;
12397
+ return [4 /*yield*/, this.getTpCurrentUserSharedKey(tpId_)];
12398
+ case 3: return [2 /*return*/, (_b.sent()).sharedKey.id];
12399
+ }
12400
+ });
12401
+ }); })];
12402
+ case 2:
12403
+ wrappingKey = _a.sent();
12404
+ return [4 /*yield*/, this.keyGraph.wrapKey(wrappingKey, itemKey.jwk)];
12405
+ case 3:
12406
+ wrappedItemKey = _a.sent();
12407
+ return [2 /*return*/, {
12408
+ input: {
12409
+ id: itemShareId,
12410
+ accessRole: accessRole,
12411
+ itemKeyId: itemKey.id,
12412
+ wrappingKeyId: wrappingKey.id,
12413
+ wrappedItemKey: wrappedItemKey,
12414
+ },
12415
+ }];
12416
+ }
12417
+ });
12418
+ });
12272
12419
  };
12273
12420
  TrustedPartyService.prototype.deleteDirectoryShare = function (id) {
12274
12421
  return __awaiter(this, void 0, void 0, function () {
@@ -12702,9 +12849,9 @@
12702
12849
  ]; };
12703
12850
 
12704
12851
  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;
12852
+ 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"])));
12853
+ 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"])));
12854
+ var templateObject_1$s, templateObject_2$m, templateObject_3$j;
12708
12855
 
12709
12856
  var UserService = /** @class */ (function () {
12710
12857
  function UserService(lrApollo) {