spytial-core 1.4.11-beta.1 → 1.4.11-beta.3

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.
@@ -94137,9 +94137,12 @@ VVbdfjptxz|~\x80\x82\x84\xA6\xA8W\b
94137
94137
  if (!relation) {
94138
94138
  throw new Error(`Cannot remove tuple: relation '${relationId}' not found`);
94139
94139
  }
94140
- const tupleKey = JSON.stringify(tuple);
94140
+ const tupleMatches = (t1, t2) => {
94141
+ if (t1.atoms.length !== t2.atoms.length) return false;
94142
+ return t1.atoms.every((atom, i) => atom === t2.atoms[i]);
94143
+ };
94141
94144
  const initialLength = relation.tuples.length;
94142
- relation.tuples = relation.tuples.filter((t) => JSON.stringify(t) !== tupleKey);
94145
+ relation.tuples = relation.tuples.filter((t) => !tupleMatches(t, tuple));
94143
94146
  if (relation.tuples.length === initialLength) {
94144
94147
  throw new Error(`Tuple not found in relation '${relationId}'`);
94145
94148
  }
@@ -95579,13 +95582,15 @@ VVbdfjptxz|~\x80\x82\x84\xA6\xA8W\b
95579
95582
  }
95580
95583
  this.dataInstance = instance;
95581
95584
  this.refreshTypesFromDataInstance();
95582
- this.dataInstanceEventHandlers.atomAdded = () => {
95583
- console.log("\u{1F4CD} Atom added to instance - updating UI");
95585
+ this.dataInstanceEventHandlers.atomAdded = async () => {
95586
+ console.log("\u{1F4CD} Atom added to instance - updating UI and re-validating constraints");
95584
95587
  this.handleDataChangeUIUpdate(true);
95588
+ await this.enforceConstraintsAndRegenerate();
95585
95589
  };
95586
- this.dataInstanceEventHandlers.relationTupleAdded = () => {
95587
- console.log("\u{1F517} Relation added to instance - updating UI");
95590
+ this.dataInstanceEventHandlers.relationTupleAdded = async () => {
95591
+ console.log("\u{1F517} Relation added to instance - updating UI and re-validating constraints");
95588
95592
  this.handleDataChangeUIUpdate(false);
95593
+ await this.enforceConstraintsAndRegenerate();
95589
95594
  };
95590
95595
  this.dataInstanceEventHandlers.atomRemoved = async () => {
95591
95596
  console.log("\u{1F5D1}\uFE0F Atom removed from instance - updating UI and re-validating constraints");