simple-graph-query 2.1.2 → 2.1.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.
@@ -48742,9 +48742,16 @@ class ForgeExprEvaluator extends AbstractParseTreeVisitor_1.AbstractParseTreeVis
48742
48742
  getIden() {
48743
48743
  const instanceTypes = this.instanceData.getTypes();
48744
48744
  const result = [];
48745
+ // Track unique atom IDs to avoid duplicates
48746
+ const seenAtomIds = new Set();
48745
48747
  for (const t of instanceTypes) {
48746
48748
  const typeAtoms = t.atoms;
48747
48749
  typeAtoms.forEach((atom) => {
48750
+ // Skip if we've already seen this atom ID
48751
+ if (seenAtomIds.has(atom.id)) {
48752
+ return;
48753
+ }
48754
+ seenAtomIds.add(atom.id);
48748
48755
  let value = atom.id;
48749
48756
  // do some type conversions so we don't return a string if the value
48750
48757
  // is a number or boolean
@@ -50001,7 +50008,15 @@ class ForgeExprEvaluator extends AbstractParseTreeVisitor_1.AbstractParseTreeVis
50001
50008
  const typeNames = this.instanceData.getTypes().map((t) => t.id);
50002
50009
  if (typeNames.includes(identifier)) {
50003
50010
  const typeAtoms = this.instanceData.getTypes().find(t => t.id === identifier)?.atoms || [];
50004
- const desiredValues = typeAtoms.map((atom) => atom.id);
50011
+ // Deduplicate atoms by ID to handle data sources with duplicate entries
50012
+ const uniqueAtomIds = new Set();
50013
+ const desiredValues = [];
50014
+ for (const atom of typeAtoms) {
50015
+ if (!uniqueAtomIds.has(atom.id)) {
50016
+ uniqueAtomIds.add(atom.id);
50017
+ desiredValues.push(atom.id);
50018
+ }
50019
+ }
50005
50020
  result = desiredValues.map((singleValue) => [singleValue]);
50006
50021
  }
50007
50022
  for (const typeObj of this.instanceData.getTypes()) {
@@ -50120,7 +50135,15 @@ class ForgeExprEvaluator extends AbstractParseTreeVisitor_1.AbstractParseTreeVis
50120
50135
  if (!intType) {
50121
50136
  throw new Error('Type "Int" not found in instance data');
50122
50137
  }
50123
- const intVals = intType.atoms.map((atom) => [Number(atom.id)]);
50138
+ // Deduplicate atoms by ID to handle data sources with duplicate entries
50139
+ const uniqueAtomIds = new Set();
50140
+ const intVals = [];
50141
+ for (const atom of intType.atoms) {
50142
+ if (!uniqueAtomIds.has(atom.id)) {
50143
+ uniqueAtomIds.add(atom.id);
50144
+ intVals.push([Number(atom.id)]);
50145
+ }
50146
+ }
50124
50147
  return intVals;
50125
50148
  }
50126
50149
  return this.visitChildren(ctx);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simple-graph-query",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "TypeScript evaluator for Forge expressions with browser-compatible UMD bundle",
5
5
  "main": "dist/simple-graph-query.bundle.js",
6
6
  "types": "dist/index.d.ts",