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

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
@@ -9271,8 +9271,9 @@ export declare class ChangeSet extends Events {
9271
9271
  author: string;
9272
9272
  timestamp: string;
9273
9273
  open: boolean;
9274
- dirty: boolean;
9275
9274
  startedClose: boolean;
9275
+ dirty: boolean;
9276
+ submitting: boolean;
9276
9277
  lockedVersions: boolean;
9277
9278
  type: ChangeSetChangeCaptureType;
9278
9279
  autoclose: boolean;
@@ -11120,7 +11121,7 @@ export declare class DefaultProjectLogicContext extends ExtensionContextBase<Ext
11120
11121
  toLatestChangeSet(author: string, timestamp: string, // ISO 8601 format
11121
11122
  self: UserManagedEntityState | null, autoclose?: boolean, autoCloseActionName?: string): ChangeSet;
11122
11123
  addChangeSet(changeSet: ChangeSet): ChangeSet;
11123
- discardChangeSet(changeSet: ChangeSet | null): ProjectState;
11124
+ discardChangeSet(changeSet: ChangeSet): ProjectState;
11124
11125
  subscribeDependents(dependencies: {
11125
11126
  entity: UserManagedEntityState;
11126
11127
  field: string;
@@ -28404,7 +28405,7 @@ export declare function getReferencedEntityStateOrErrors(data: ElementGeneration
28404
28405
  toLatestChangeSet(author: string, timestamp: string, // ISO 8601 format
28405
28406
  self: UserManagedEntityState | null, autoclose?: boolean, autoCloseActionName?: string): ChangeSet;
28406
28407
  addChangeSet(changeSet: ChangeSet): ChangeSet;
28407
- discardChangeSet(changeSet: ChangeSet | null): ProjectState;
28408
+ discardChangeSet(changeSet: ChangeSet): ProjectState;
28408
28409
  validateGeneratedUpdate(data: Partial<IProjectGenerationTarget>): {
28409
28410
  errors: EntityGenerationError[];
28410
28411
  modifiedData: Partial<IProjectGenerationTarget>;
package/dist/index.js CHANGED
@@ -93180,9 +93180,12 @@ class S extends qf {
93180
93180
  // ISO 8601 format
93181
93181
  // Whether the change-set is still open and can accept more changes.
93182
93182
  I(this, "open", !0);
93183
+ // Whether the change-set closing process has been started.
93184
+ I(this, "startedClose", !1);
93183
93185
  // Whether the change-set changes have been permanently persisted.
93184
93186
  I(this, "dirty", !0);
93185
- I(this, "startedClose", !1);
93187
+ // Whether the change-set is in the process of being submitted.
93188
+ I(this, "submitting", !1);
93186
93189
  // Whether the entities in this change-set should not be auto-versioned
93187
93190
  I(this, "lockedVersions", !1);
93188
93191
  /*
@@ -93338,7 +93341,7 @@ class S extends qf {
93338
93341
  const n = i.awaitBeforeClose ?? !0, l = i.awaitExtenalClosing ?? !0;
93339
93342
  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
93343
  `[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);
93344
+ ), 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
93345
  }
93343
93346
  attemptAutoclose(i, n) {
93344
93347
  var l;
@@ -192926,7 +192929,7 @@ const o6 = {
192926
192929
  async closePendingChangeSets() {
192927
192930
  console.log("[ProjectState.closePendingChangeSets] called");
192928
192931
  const i = this.history.find(
192929
- (n) => n.dirty && !n.open
192932
+ (n) => n.dirty && !n.open && !n.submitting
192930
192933
  );
192931
192934
  i && (console.log(
192932
192935
  `[ProjectState.closePendingChangeSets] closing pending change-set ${i.id} - ${i.autoCloseActionName}`
@@ -192944,9 +192947,14 @@ const o6 = {
192944
192947
  this.onDiscardChangeSetCallback = i;
192945
192948
  }
192946
192949
  async closeChangeSet(i) {
192947
- console.log(
192950
+ if (console.log(
192948
192951
  `[ProjectState.closeChangeSet] called for change-set ${i.id} - ${i.autoCloseActionName}`
192949
- );
192952
+ ), !i.dirty || i.open || i.submitting) {
192953
+ console.log(
192954
+ `[ProjectState.closeChangeSet] change-set ${i.id} - ${i.autoCloseActionName} is not dirty, or is open, or is already being submitted, skipping.`
192955
+ );
192956
+ return;
192957
+ }
192950
192958
  const n = this.history.findIndex((e) => e.id === i.id), l = this.history.slice(0, n), c = l[l.length - 1];
192951
192959
  if (c != null && c.dirty) {
192952
192960
  console.log(
@@ -192956,7 +192964,7 @@ const o6 = {
192956
192964
  }
192957
192965
  this.onCloseChangeSetCallback && (console.log(
192958
192966
  `[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(
192967
+ ), i.submitting = !0, (await this.onCloseChangeSetCallback(i)).success && (i.dirty = !1, this.emit("change-set-closed", i), console.log(
192960
192968
  `[ProjectState.closeChangeSet] change-set ${i.id} - ${i.autoCloseActionName} closed successfully, checking for pending change-sets to close.`
192961
192969
  ), this.closePendingChangeSets()));
192962
192970
  }
@@ -193015,8 +193023,13 @@ const o6 = {
193015
193023
  // So we remove them from the state
193016
193024
  discardChangeSet(i) {
193017
193025
  var l;
193026
+ console.log(
193027
+ `[ProjectState.discardChangeSet] called for change-set ${i.id} - ${i.autoCloseActionName}`
193028
+ );
193018
193029
  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;
193030
+ return n !== -1 && (this.history.splice(n, 1), console.log(
193031
+ `[ProjectState.discardChangeSet] Removed change-set ${i.id} - ${i.autoCloseActionName} from history.`
193032
+ ), this.undoableStackValueIndex = this.undoableStackValueIndex - 1, (l = this.onDiscardChangeSetCallback) == null || l.call(this, i), i == null || i.teardown()), this;
193020
193033
  }
193021
193034
  validateGeneratedUpdate(i) {
193022
193035
  return { errors: [], modifiedData: i };