json-fs-query 1.0.1 → 1.0.2

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.
@@ -1375,6 +1375,16 @@
1375
1375
  const entity = parsed.entity
1376
1376
  const joinEntity = parsed.joinEntity
1377
1377
  const joinClauses = parsed.joinClauses
1378
+ if (!dataSets[entity].length) {
1379
+ // Nothing indexed entity's own rows yet (no WHERE condition narrowed them down ahead of this -
1380
+ // that only happens via getConditionIndexedList, called just before this). The loop below can't
1381
+ // pre-resolve anything against zero rows, so leave parsed.joinClauses exactly as parsed: the
1382
+ // later, unconditional joinEntity() call (once this command's own read actually runs) still
1383
+ // needs the real clauses to do the join itself. Previously this fell through to the loop,
1384
+ // which never ran, leaving reducedJoins (and so parsed.joinClauses) empty regardless of what
1385
+ // was actually parsed - silently discarding every join clause whenever the query had no WHERE.
1386
+ return parsed
1387
+ }
1378
1388
  for (const anEntity in dataSets[entity]) {
1379
1389
  const currentEntity = dataSets[entity][anEntity]
1380
1390
  // Loop over each of the main entities