@elyx-code/project-logic-tree 0.0.6623 → 0.0.6624

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.
package/dist/index.d.ts CHANGED
@@ -31623,7 +31623,7 @@ export declare function getReferencedEntityStateOrErrors(data: ElementGeneration
31623
31623
  visitAsync(callback: (entity: Element_2 | ElementTransfer | EntityState | ElementShallowTransfer, knownEntitiesRecord: Record<EntityId, Element_2 | ElementTransfer | EntityState | ElementShallowTransfer>) => any, { yieldEvery }?: {
31624
31624
  yieldEvery?: number;
31625
31625
  }): Promise<Traverser>;
31626
- reverseVisitAsync(callback: (entity: Element_2 | ElementTransfer | EntityState | ElementShallowTransfer, knownEntitiesRecord: Record<EntityId, Element_2 | ElementTransfer | EntityState | ElementShallowTransfer>) => Promise<any>, { yieldEvery }?: {
31626
+ reverseVisitAsync(callback: (entity: Element_2 | ElementTransfer | EntityState | ElementShallowTransfer, knownEntitiesRecord: Record<EntityId, Element_2 | ElementTransfer | EntityState | ElementShallowTransfer>) => any, { yieldEvery }?: {
31627
31627
  yieldEvery?: number;
31628
31628
  }): Promise<Traverser>;
31629
31629
  }
package/dist/index.js CHANGED
@@ -93331,8 +93331,14 @@ class S extends qf {
93331
93331
  return this.autoclose && this.autoCloseActionName && this.autoCloseActionName === i && (this.self && n === ((l = this.self) == null ? void 0 : l.id) || !this.self) && await this.closeAsync(), this;
93332
93332
  }
93333
93333
  async closeAsync(i = {}) {
93334
+ if (!this.open || this.startedClose)
93335
+ return ne.warn(
93336
+ `Change-set (${this.id}) is already closed or in the process of closing.`
93337
+ ), this;
93334
93338
  const n = i.awaitBeforeClose ?? !0, l = i.awaitExtenalClosing ?? !0;
93335
- return this.startedClose || (this.startedClose = !0, n ? await this.beforeCloseAsync() : this.beforeCloseAsync()), !this.isValid && this.self && !this.added[this.self.id] && !this.updated[this.self.id] && this.removed[this.self.id], this.discardOrphans(), this.sanitize(), this.recursiveCaptureUpstreamVersions(), this.lockedVersions || (this.captureAllChangesInVersionInstances(), this.recursiveCaptureUpstreamVersions()), this.open = !1, this.isEmpty ? (ne.warn(`Empty change-set (${this.id}) discarded upon closing.`), this.project.discardChangeSet(this), this.project.closePendingChangeSets(), this) : (l ? await this.project.closeChangeSet(this) : this.project.closeChangeSet(this), this);
93339
+ return this.startedClose || (this.startedClose = !0, n ? await this.beforeCloseAsync() : this.beforeCloseAsync()), !this.isValid && this.self && !this.added[this.self.id] && !this.updated[this.self.id] && this.removed[this.self.id], this.discardOrphans(), this.sanitize(), this.recursiveCaptureUpstreamVersions(), this.lockedVersions || (this.captureAllChangesInVersionInstances(), this.recursiveCaptureUpstreamVersions()), this.open = !1, this.isEmpty ? (ne.warn(
93340
+ `[ChangeSet.closeAsync] Empty change-set (${this.id}) discarded upon closing.`
93341
+ ), this.project.discardChangeSet(this), console.log("[ChangeSet.closeAsync] Closing pending change-sets..."), this.project.closePendingChangeSets(), this) : (l ? await this.project.closeChangeSet(this) : this.project.closeChangeSet(this), this);
93336
93342
  }
93337
93343
  attemptAutoclose(i, n) {
93338
93344
  var l;
@@ -93403,8 +93409,14 @@ class S extends qf {
93403
93409
  return aAi(this);
93404
93410
  }
93405
93411
  close() {
93412
+ if (!this.open || this.startedClose)
93413
+ return ne.warn(
93414
+ `Change-set (${this.id}) is already closed or in the process of closing.`
93415
+ ), this;
93406
93416
  if (this.startedClose || (this.startedClose = !0, this.beforeClose()), !this.isValid && this.self && !this.added[this.self.id] && !this.updated[this.self.id] && this.removed[this.self.id], this.discardOrphans(), this.sanitize(), this.captureAllChangesInVersionInstances(), this.lockedVersions || (this.recursiveCaptureUpstreamVersions(), this.captureAllChangesInVersionInstances()), this.open = !1, this.isEmpty)
93407
- return ne.warn(`Empty change-set (${this.id}) discarded upon closing.`), this.project.discardChangeSet(this), this.project.closePendingChangeSets(), this;
93417
+ return ne.warn(
93418
+ `[ChangeSet.close] Empty change-set (${this.id}) discarded upon closing.`
93419
+ ), this.project.discardChangeSet(this), console.log("[ChangeSet.close] Closing pending change-sets..."), this.project.closePendingChangeSets(), this;
93408
93420
  if (this.added[this.project.id] && this.updatedIds.length)
93409
93421
  throw new Error(
93410
93422
  "No 'updated' entities should be present in the change-set when the project entity is in the 'added' list. New projects can only have newly added entities"
@@ -192912,13 +192924,18 @@ const o6 = {
192912
192924
  return this.parentContext.events.emitAsyncSequentiallyAllSettled;
192913
192925
  }
192914
192926
  async closePendingChangeSets() {
192927
+ console.log("[ProjectState.closePendingChangeSets] called");
192915
192928
  const i = this.history.find(
192916
192929
  (n) => n.dirty && !n.open
192917
192930
  );
192918
- i && await this.closeChangeSet(i);
192931
+ i && (console.log(
192932
+ `[ProjectState.closePendingChangeSets] closing pending change-set ${i.id} - ${i.autoCloseActionName}`
192933
+ ), await this.closeChangeSet(i));
192919
192934
  }
192920
192935
  async onCloseChangeSet(i) {
192921
- this.onCloseChangeSetCallback = i, await this.closePendingChangeSets();
192936
+ this.onCloseChangeSetCallback = i, console.log(
192937
+ "[ProjectState.onCloseChangeSet] onCloseChangeSetCallback has been set. Checking for pending change-sets."
192938
+ ), await this.closePendingChangeSets();
192922
192939
  }
192923
192940
  onAddChangeSet(i) {
192924
192941
  this.onAddChangeSetCallback = i;
@@ -192927,11 +192944,21 @@ const o6 = {
192927
192944
  this.onDiscardChangeSetCallback = i;
192928
192945
  }
192929
192946
  async closeChangeSet(i) {
192947
+ console.log(
192948
+ `[ProjectState.closeChangeSet] called for change-set ${i.id} - ${i.autoCloseActionName}`
192949
+ );
192930
192950
  const n = this.history.findIndex((e) => e.id === i.id), l = this.history.slice(0, n), c = l[l.length - 1];
192931
- if (!(c != null && c.dirty) && this.onCloseChangeSetCallback) {
192932
- (await this.onCloseChangeSetCallback(i)).success && (i.dirty = !1, this.emit("change-set-closed", i), this.closePendingChangeSets());
192951
+ if (c != null && c.dirty) {
192952
+ console.log(
192953
+ `[ProjectState.closeChangeSet] lastBeforeSelf is dirty: ${c.id} - ${c.autoCloseActionName}, closing it first.`
192954
+ );
192933
192955
  return;
192934
192956
  }
192957
+ this.onCloseChangeSetCallback && (console.log(
192958
+ `[ProjectState.closeChangeSet] invoking onCloseChangeSetCallback for change-set ${i.id} - ${i.autoCloseActionName}`
192959
+ ), (await this.onCloseChangeSetCallback(i)).success && (i.dirty = !1, this.emit("change-set-closed", i), console.log(
192960
+ `[ProjectState.closeChangeSet] change-set ${i.id} - ${i.autoCloseActionName} closed successfully, checking for pending change-sets to close.`
192961
+ ), this.closePendingChangeSets()));
192935
192962
  }
192936
192963
  // Returns the last open change set or creates a new one with the information provided
192937
192964
  toLatestChangeSet(i, n, l, c = !1, e = "here-this") {