@lifeready/core 8.0.8 → 8.0.10

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.
@@ -7687,10 +7687,10 @@
7687
7687
  });
7688
7688
  });
7689
7689
  };
7690
- ItemService.prototype.createDirectoryTree = function (options) {
7690
+ ItemService.prototype.createDirectoryWithStaging = function (options) {
7691
7691
  return __awaiter(this, void 0, void 0, function () {
7692
7692
  return __generator(this, function (_d) {
7693
- return [2 /*return*/, this.mutate(this.createDirectoryTreeMutation(options))];
7693
+ return [2 /*return*/, this.mutate(this.createDirectoryWithStagingMutation(options))];
7694
7694
  });
7695
7695
  });
7696
7696
  };
@@ -7699,7 +7699,7 @@
7699
7699
  * server, otherwise the temp directory will get cleaned up.
7700
7700
  *
7701
7701
  */
7702
- ItemService.prototype.createDirectoryTreeMutation = function (options) {
7702
+ ItemService.prototype.createDirectoryWithStagingMutation = function (options) {
7703
7703
  return __awaiter(this, void 0, void 0, function () {
7704
7704
  var tempDir, directory;
7705
7705
  return __generator(this, function (_d) {
@@ -7735,13 +7735,13 @@
7735
7735
  })];
7736
7736
  case 3:
7737
7737
  directory = (_d.sent()).createDirectory.directory;
7738
- // Create the contents
7739
- return [4 /*yield*/, options.createContent({
7738
+ // Call back with item that's currently in staging.
7739
+ return [4 /*yield*/, options.onCreatedInStaging({
7740
7740
  id: directory.id,
7741
7741
  keyId: directory.keyId,
7742
7742
  })];
7743
7743
  case 4:
7744
- // Create the contents
7744
+ // Call back with item that's currently in staging.
7745
7745
  _d.sent();
7746
7746
  // TODO client-side check for timeout on requestWindowMs
7747
7747
  // TODO return the server time where delete is scheduled. Expirable mutation
@@ -7756,6 +7756,66 @@
7756
7756
  });
7757
7757
  });
7758
7758
  };
7759
+ ItemService.prototype.createFileWithStaging = function (options) {
7760
+ return __awaiter(this, void 0, void 0, function () {
7761
+ return __generator(this, function (_d) {
7762
+ return [2 /*return*/, this.mutate(this.createFileWithStagingMutation(options))];
7763
+ });
7764
+ });
7765
+ };
7766
+ ItemService.prototype.createFileWithStagingMutation = function (options) {
7767
+ return __awaiter(this, void 0, void 0, function () {
7768
+ var tempDir, file;
7769
+ return __generator(this, function (_d) {
7770
+ switch (_d.label) {
7771
+ case 0: return [4 /*yield*/, this.ensureTempDirectory()];
7772
+ case 1:
7773
+ tempDir = _d.sent();
7774
+ // Clear the temp directory of the ones we are about to create.
7775
+ // NOTE: this mutation can not be merged into a single mutation with the
7776
+ // the createDirectory mutation because it uses the current server time to
7777
+ // clean up. So it must successfully complete before the creation of the
7778
+ // directories.
7779
+ return [4 /*yield*/, this.beginDeleteChildItemLinksWindow({
7780
+ directoryId: tempDir.id,
7781
+ requestWindowMs: options.requestWindowMs,
7782
+ })];
7783
+ case 2:
7784
+ // Clear the temp directory of the ones we are about to create.
7785
+ // NOTE: this mutation can not be merged into a single mutation with the
7786
+ // the createDirectory mutation because it uses the current server time to
7787
+ // clean up. So it must successfully complete before the creation of the
7788
+ // directories.
7789
+ _d.sent();
7790
+ return [4 /*yield*/, this.createFile(Object.assign(Object.assign({}, options), { parentDirectories: [
7791
+ {
7792
+ directoryId: tempDir.id,
7793
+ wrappingKeyId: tempDir.keyId,
7794
+ },
7795
+ ] }))];
7796
+ case 3:
7797
+ file = (_d.sent()).createFile.file;
7798
+ // Call back with item that's currently in staging.
7799
+ return [4 /*yield*/, options.onCreatedInStaging({
7800
+ id: file.id,
7801
+ keyId: file.keyId,
7802
+ })];
7803
+ case 4:
7804
+ // Call back with item that's currently in staging.
7805
+ _d.sent();
7806
+ // TODO client-side check for timeout on requestWindowMs
7807
+ // TODO return the server time where delete is scheduled. Expirable mutation
7808
+ // Return the mutation that moves the directory into the dst directories
7809
+ return [2 /*return*/, this.changeFileParentsMutation({
7810
+ fileId: file.id,
7811
+ fileKeyId: file.keyId,
7812
+ parentsToRemove: [tempDir.id],
7813
+ parentsToAdd: options.parentDirectories,
7814
+ })];
7815
+ }
7816
+ });
7817
+ });
7818
+ };
7759
7819
  ItemService.prototype.setFileConfidential = function (options) {
7760
7820
  return __awaiter(this, void 0, void 0, function () {
7761
7821
  return __generator(this, function (_d) {
@@ -10529,6 +10589,7 @@
10529
10589
  ScenarioService.prototype.approveClaim = function (sharedScenarioId, sharedClaimId) {
10530
10590
  return __awaiter(this, void 0, void 0, function () {
10531
10591
  return __generator(this, function (_a) {
10592
+ // TODO this needs a cast so the result is not ANY.
10532
10593
  return [2 /*return*/, this.mutate(this.approveClaimMutation(sharedScenarioId, sharedClaimId))];
10533
10594
  });
10534
10595
  });