@lifeready/core 1.1.3 → 1.1.4

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.
@@ -12274,11 +12274,12 @@
12274
12274
  this.recordAttachmentService = recordAttachmentService;
12275
12275
  }
12276
12276
  RecordService.prototype.getRecord = function (recordId) {
12277
+ var _a;
12277
12278
  return __awaiter(this, void 0, void 0, function () {
12278
- var record, contents, _a, name, recordType, fields, categories, attachments;
12279
+ var record, contents, _b, name, recordType, fields, categories, attachments;
12279
12280
  var _this = this;
12280
- return __generator(this, function (_b) {
12281
- switch (_b.label) {
12281
+ return __generator(this, function (_c) {
12282
+ switch (_c.label) {
12282
12283
  case 0: return [4 /*yield*/, this.lrApollo.query({
12283
12284
  query: GetRecordQuery(),
12284
12285
  variables: {
@@ -12289,31 +12290,31 @@
12289
12290
  },
12290
12291
  })];
12291
12292
  case 1:
12292
- record = (_b.sent()).record;
12293
+ record = (_c.sent()).record;
12293
12294
  contents = record.content.edges[0].node.childFile;
12294
12295
  return [4 /*yield*/, this.keyMetaService.decryptMeta(contents.currentVersion.state)];
12295
12296
  case 2:
12296
- _a = (_b.sent()) ||
12297
- {}, name = _a.name, recordType = _a.recordType, fields = _a.fields;
12297
+ _b = (_c.sent()) ||
12298
+ {}, name = _b.name, recordType = _b.recordType, fields = _b.fields;
12298
12299
  return [4 /*yield*/, Promise.all(record.parentCategories.edges.map(function (x) { return __awaiter(_this, void 0, void 0, function () {
12299
- var _a;
12300
- return __generator(this, function (_b) {
12301
- switch (_b.label) {
12300
+ var _b;
12301
+ return __generator(this, function (_c) {
12302
+ switch (_c.label) {
12302
12303
  case 0: return [4 /*yield*/, this.categoryService.mapParentCategories(x.node.parentDirectory)];
12303
12304
  case 1:
12304
- _a = [(_b.sent())];
12305
+ _b = [(_c.sent())];
12305
12306
  return [4 /*yield*/, this.categoryService.mapCategory(x.node.parentDirectory)];
12306
- case 2: return [2 /*return*/, __spread.apply(void 0, _a.concat([[
12307
- _b.sent()
12307
+ case 2: return [2 /*return*/, __spread.apply(void 0, _b.concat([[
12308
+ _c.sent()
12308
12309
  ]]))];
12309
12310
  }
12310
12311
  });
12311
12312
  }); }))];
12312
12313
  case 3:
12313
- categories = _b.sent();
12314
+ categories = _c.sent();
12314
12315
  return [4 /*yield*/, this.mapAttachments(record.attachments.edges)];
12315
12316
  case 4:
12316
- attachments = _b.sent();
12317
+ attachments = _c.sent();
12317
12318
  return [2 /*return*/, {
12318
12319
  id: record.id,
12319
12320
  keyId: record.keyId,
@@ -12325,7 +12326,7 @@
12325
12326
  categories: categories,
12326
12327
  attachments: attachments,
12327
12328
  isArchived: !!record.archived,
12328
- isConfidential: record.confidentiality.isConfidential,
12329
+ isConfidential: !!((_a = record.confidentiality) === null || _a === void 0 ? void 0 : _a.isConfidential),
12329
12330
  createdOn: record.created,
12330
12331
  lastModified: new Date(record.modified) >
12331
12332
  new Date(contents.currentVersion.state.modified)
@@ -12339,18 +12340,18 @@
12339
12340
  RecordService.prototype.mapAttachments = function (attachments) {
12340
12341
  return __awaiter(this, void 0, void 0, function () {
12341
12342
  var _this = this;
12342
- return __generator(this, function (_a) {
12343
- switch (_a.label) {
12343
+ return __generator(this, function (_b) {
12344
+ switch (_b.label) {
12344
12345
  case 0: return [4 /*yield*/, Promise.all(attachments
12345
12346
  .map(function (x) { return x.node.childFile; })
12346
12347
  .map(function (x) { return __awaiter(_this, void 0, void 0, function () {
12347
- var _a, name, fieldId, fileType, fileSize, lastModified;
12348
- return __generator(this, function (_b) {
12349
- switch (_b.label) {
12348
+ var _b, name, fieldId, fileType, fileSize, lastModified;
12349
+ return __generator(this, function (_c) {
12350
+ switch (_c.label) {
12350
12351
  case 0: return [4 /*yield*/, this.keyMetaService.decryptMeta(x.currentVersion.state)];
12351
12352
  case 1:
12352
- _a = (_b.sent()) ||
12353
- {}, name = _a.name, fieldId = _a.fieldId, fileType = _a.fileType, fileSize = _a.fileSize, lastModified = _a.lastModified;
12353
+ _b = (_c.sent()) ||
12354
+ {}, name = _b.name, fieldId = _b.fieldId, fileType = _b.fileType, fileSize = _b.fileSize, lastModified = _b.lastModified;
12354
12355
  return [2 /*return*/, {
12355
12356
  fileId: x.id,
12356
12357
  keyId: x.currentVersion.state.keyId,
@@ -12364,7 +12365,7 @@
12364
12365
  }
12365
12366
  });
12366
12367
  }); }))];
12367
- case 1: return [2 /*return*/, _a.sent()];
12368
+ case 1: return [2 /*return*/, _b.sent()];
12368
12369
  }
12369
12370
  });
12370
12371
  });
@@ -12372,11 +12373,11 @@
12372
12373
  RecordService.prototype.createRecord = function (newRecord) {
12373
12374
  return __awaiter(this, void 0, void 0, function () {
12374
12375
  var wrappedContent, response, recordId, secureContent, doubleWrappedContent, e_1;
12375
- return __generator(this, function (_a) {
12376
- switch (_a.label) {
12376
+ return __generator(this, function (_b) {
12377
+ switch (_b.label) {
12377
12378
  case 0: return [4 /*yield*/, this.keyMetaService.wrapContent(null, newRecord.categoryIds)];
12378
12379
  case 1:
12379
- wrappedContent = _a.sent();
12380
+ wrappedContent = _b.sent();
12380
12381
  return [4 /*yield*/, this.lrApollo.mutate({
12381
12382
  mutation: CreateRecordContainerMutation,
12382
12383
  variables: {
@@ -12389,7 +12390,7 @@
12389
12390
  },
12390
12391
  })];
12391
12392
  case 2:
12392
- response = _a.sent();
12393
+ response = _b.sent();
12393
12394
  recordId = response.new.category.id;
12394
12395
  secureContent = {
12395
12396
  name: newRecord.name,
@@ -12398,7 +12399,7 @@
12398
12399
  };
12399
12400
  return [4 /*yield*/, this.keyMetaService.doubleWrapContent(secureContent, [recordId])];
12400
12401
  case 3:
12401
- doubleWrappedContent = _a.sent();
12402
+ doubleWrappedContent = _b.sent();
12402
12403
  // Create the file that holds the record contents
12403
12404
  return [4 /*yield*/, this.lrApollo.mutate({
12404
12405
  mutation: CreateRecordMutation,
@@ -12417,16 +12418,16 @@
12417
12418
  })];
12418
12419
  case 4:
12419
12420
  // Create the file that holds the record contents
12420
- _a.sent();
12421
- _a.label = 5;
12421
+ _b.sent();
12422
+ _b.label = 5;
12422
12423
  case 5:
12423
- _a.trys.push([5, 7, , 8]);
12424
+ _b.trys.push([5, 7, , 8]);
12424
12425
  return [4 /*yield*/, this.recordAttachmentService.uploadAttachments(recordId, newRecord.attachments)];
12425
12426
  case 6:
12426
- _a.sent();
12427
+ _b.sent();
12427
12428
  return [3 /*break*/, 8];
12428
12429
  case 7:
12429
- e_1 = _a.sent();
12430
+ e_1 = _b.sent();
12430
12431
  console.error(e_1);
12431
12432
  return [2 /*return*/, { recordId: recordId, attachmentError: e_1 }];
12432
12433
  case 8: return [2 /*return*/, { recordId: recordId }];
@@ -12437,8 +12438,8 @@
12437
12438
  RecordService.prototype.updateRecord = function (recordId, updateId, updateKeyId, updatedRecord) {
12438
12439
  return __awaiter(this, void 0, void 0, function () {
12439
12440
  var secureContent, reWrappedContent, e_2;
12440
- return __generator(this, function (_a) {
12441
- switch (_a.label) {
12441
+ return __generator(this, function (_b) {
12442
+ switch (_b.label) {
12442
12443
  case 0:
12443
12444
  secureContent = {
12444
12445
  name: updatedRecord.name,
@@ -12447,7 +12448,7 @@
12447
12448
  };
12448
12449
  return [4 /*yield*/, this.keyMetaService.reWrapContent(updateKeyId, secureContent)];
12449
12450
  case 1:
12450
- reWrappedContent = _a.sent();
12451
+ reWrappedContent = _b.sent();
12451
12452
  return [4 /*yield*/, this.lrApollo.mutate({
12452
12453
  mutation: UpdateRecordMutation,
12453
12454
  variables: {
@@ -12460,16 +12461,16 @@
12460
12461
  },
12461
12462
  })];
12462
12463
  case 2:
12463
- _a.sent();
12464
- _a.label = 3;
12464
+ _b.sent();
12465
+ _b.label = 3;
12465
12466
  case 3:
12466
- _a.trys.push([3, 5, , 6]);
12467
+ _b.trys.push([3, 5, , 6]);
12467
12468
  return [4 /*yield*/, this.recordAttachmentService.uploadAttachments(recordId, updatedRecord.attachments)];
12468
12469
  case 4:
12469
- _a.sent();
12470
+ _b.sent();
12470
12471
  return [3 /*break*/, 6];
12471
12472
  case 5:
12472
- e_2 = _a.sent();
12473
+ e_2 = _b.sent();
12473
12474
  console.error(e_2);
12474
12475
  return [2 /*return*/, { recordId: recordId, attachmentError: e_2 }];
12475
12476
  case 6: return [2 /*return*/, { recordId: recordId }];
@@ -12479,7 +12480,7 @@
12479
12480
  };
12480
12481
  RecordService.prototype.archiveRecord = function (recordId) {
12481
12482
  return __awaiter(this, void 0, void 0, function () {
12482
- return __generator(this, function (_a) {
12483
+ return __generator(this, function (_b) {
12483
12484
  // All content of the record should also be archived, hence, recursive=true
12484
12485
  return [2 /*return*/, this.categoryService.archiveDirectory(recordId, true)];
12485
12486
  });
@@ -12487,7 +12488,7 @@
12487
12488
  };
12488
12489
  RecordService.prototype.unarchiveRecord = function (recordId) {
12489
12490
  return __awaiter(this, void 0, void 0, function () {
12490
- return __generator(this, function (_a) {
12491
+ return __generator(this, function (_b) {
12491
12492
  // All content of the record should also be unarchived, hence, recursive=true
12492
12493
  return [2 /*return*/, this.categoryService.unarchiveDirectory(recordId, true)];
12493
12494
  });
@@ -12495,14 +12496,14 @@
12495
12496
  };
12496
12497
  RecordService.prototype.deleteRecord = function (recordId) {
12497
12498
  return __awaiter(this, void 0, void 0, function () {
12498
- return __generator(this, function (_a) {
12499
- switch (_a.label) {
12499
+ return __generator(this, function (_b) {
12500
+ switch (_b.label) {
12500
12501
  case 0: return [4 /*yield*/, this.lrApollo.mutate({
12501
12502
  mutation: DeleteRecordMutation,
12502
12503
  variables: { recordId: recordId },
12503
12504
  })];
12504
12505
  case 1:
12505
- _a.sent();
12506
+ _b.sent();
12506
12507
  return [2 /*return*/];
12507
12508
  }
12508
12509
  });