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

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
@@ -11120,7 +11120,7 @@ export declare class DefaultProjectLogicContext extends ExtensionContextBase<Ext
11120
11120
  toLatestChangeSet(author: string, timestamp: string, // ISO 8601 format
11121
11121
  self: UserManagedEntityState | null, autoclose?: boolean, autoCloseActionName?: string): ChangeSet;
11122
11122
  addChangeSet(changeSet: ChangeSet): ChangeSet;
11123
- discardChangeSet(changeSet: ChangeSet | null): ProjectState;
11123
+ discardChangeSet(changeSet: ChangeSet): ProjectState;
11124
11124
  subscribeDependents(dependencies: {
11125
11125
  entity: UserManagedEntityState;
11126
11126
  field: string;
@@ -28404,7 +28404,7 @@ export declare function getReferencedEntityStateOrErrors(data: ElementGeneration
28404
28404
  toLatestChangeSet(author: string, timestamp: string, // ISO 8601 format
28405
28405
  self: UserManagedEntityState | null, autoclose?: boolean, autoCloseActionName?: string): ChangeSet;
28406
28406
  addChangeSet(changeSet: ChangeSet): ChangeSet;
28407
- discardChangeSet(changeSet: ChangeSet | null): ProjectState;
28407
+ discardChangeSet(changeSet: ChangeSet): ProjectState;
28408
28408
  validateGeneratedUpdate(data: Partial<IProjectGenerationTarget>): {
28409
28409
  errors: EntityGenerationError[];
28410
28410
  modifiedData: Partial<IProjectGenerationTarget>;
package/dist/index.js CHANGED
@@ -93338,7 +93338,7 @@ class S extends qf {
93338
93338
  const n = i.awaitBeforeClose ?? !0, l = i.awaitExtenalClosing ?? !0;
93339
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
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);
93341
+ ), this.dirty = !1, 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);
93342
93342
  }
93343
93343
  attemptAutoclose(i, n) {
93344
93344
  var l;
@@ -192926,7 +192926,7 @@ const o6 = {
192926
192926
  async closePendingChangeSets() {
192927
192927
  console.log("[ProjectState.closePendingChangeSets] called");
192928
192928
  const i = this.history.find(
192929
- (n) => n.dirty && !n.open
192929
+ (n) => n.dirty && !n.open && !n.startedClose
192930
192930
  );
192931
192931
  i && (console.log(
192932
192932
  `[ProjectState.closePendingChangeSets] closing pending change-set ${i.id} - ${i.autoCloseActionName}`
@@ -192944,9 +192944,14 @@ const o6 = {
192944
192944
  this.onDiscardChangeSetCallback = i;
192945
192945
  }
192946
192946
  async closeChangeSet(i) {
192947
- console.log(
192947
+ if (console.log(
192948
192948
  `[ProjectState.closeChangeSet] called for change-set ${i.id} - ${i.autoCloseActionName}`
192949
- );
192949
+ ), !i.open || i.startedClose || !i.dirty) {
192950
+ console.log(
192951
+ `[ProjectState.closeChangeSet] change-set ${i.id} - ${i.autoCloseActionName} is not open, started closing, or not dirty.`
192952
+ );
192953
+ return;
192954
+ }
192950
192955
  const n = this.history.findIndex((e) => e.id === i.id), l = this.history.slice(0, n), c = l[l.length - 1];
192951
192956
  if (c != null && c.dirty) {
192952
192957
  console.log(
@@ -193015,8 +193020,13 @@ const o6 = {
193015
193020
  // So we remove them from the state
193016
193021
  discardChangeSet(i) {
193017
193022
  var l;
193023
+ console.log(
193024
+ `[ProjectState.discardChangeSet] called for change-set ${i.id} - ${i.autoCloseActionName}`
193025
+ );
193018
193026
  const n = this.history.findIndex((c) => c.id === (i == null ? void 0 : i.id));
193019
- return n !== -1 && (this.history.splice(n, 1), this.undoableStackValueIndex = this.undoableStackValueIndex - 1, (l = this.onDiscardChangeSetCallback) == null || l.call(this, i), i == null || i.teardown()), this;
193027
+ return n !== -1 && (this.history.splice(n, 1), console.log(
193028
+ `[ProjectState.discardChangeSet] Removed change-set ${i.id} - ${i.autoCloseActionName} from history.`
193029
+ ), this.undoableStackValueIndex = this.undoableStackValueIndex - 1, (l = this.onDiscardChangeSetCallback) == null || l.call(this, i), i == null || i.teardown()), this;
193020
193030
  }
193021
193031
  validateGeneratedUpdate(i) {
193022
193032
  return { errors: [], modifiedData: i };