@lifeready/core 8.0.9 → 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,14 +7756,21 @@
7756
7756
  });
7757
7757
  });
7758
7758
  };
7759
- ItemService.prototype.createFileUsingTempMutation = function (options) {
7759
+ ItemService.prototype.createFileWithStaging = function (options) {
7760
7760
  return __awaiter(this, void 0, void 0, function () {
7761
- var tempDir, file, _d;
7762
- return __generator(this, function (_e) {
7763
- switch (_e.label) {
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) {
7764
7771
  case 0: return [4 /*yield*/, this.ensureTempDirectory()];
7765
7772
  case 1:
7766
- tempDir = _e.sent();
7773
+ tempDir = _d.sent();
7767
7774
  // Clear the temp directory of the ones we are about to create.
7768
7775
  // NOTE: this mutation can not be merged into a single mutation with the
7769
7776
  // the createDirectory mutation because it uses the current server time to
@@ -7779,7 +7786,7 @@
7779
7786
  // the createDirectory mutation because it uses the current server time to
7780
7787
  // clean up. So it must successfully complete before the creation of the
7781
7788
  // directories.
7782
- _e.sent();
7789
+ _d.sent();
7783
7790
  return [4 /*yield*/, this.createFile(Object.assign(Object.assign({}, options), { parentDirectories: [
7784
7791
  {
7785
7792
  directoryId: tempDir.id,
@@ -7787,24 +7794,24 @@
7787
7794
  },
7788
7795
  ] }))];
7789
7796
  case 3:
7790
- file = (_e.sent()).createFile.file;
7791
- _d = {};
7792
- return [4 /*yield*/, this.changeFileParentsMutation({
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({
7793
7810
  fileId: file.id,
7794
7811
  fileKeyId: file.keyId,
7795
7812
  parentsToRemove: [tempDir.id],
7796
7813
  parentsToAdd: options.parentDirectories,
7797
7814
  })];
7798
- case 4:
7799
- // TODO client-side check for timeout on requestWindowMs
7800
- // TODO return the server time where delete is scheduled. Expirable mutation
7801
- // Return the mutation that moves the directory into the dst directories
7802
- return [2 /*return*/, (_d.mutation = _e.sent(),
7803
- _d.file = {
7804
- id: file.id,
7805
- keyId: file.keyId,
7806
- },
7807
- _d)];
7808
7815
  }
7809
7816
  });
7810
7817
  });