prisma-sql 1.66.0 → 1.66.1

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.cjs CHANGED
@@ -8558,7 +8558,7 @@ function fetchAndAttachChildren(segment, parentIds, parentMap, allModels, modelM
8558
8558
  return __async(this, null, function* () {
8559
8559
  const childModel = modelMap.get(segment.childModelName);
8560
8560
  if (!childModel) return;
8561
- const childArgs = buildChildArgs(
8561
+ const childArgs = buildChildArgs2(
8562
8562
  segment.relArgs,
8563
8563
  segment.fkFieldName,
8564
8564
  parentIds
@@ -8590,10 +8590,16 @@ function fetchAndAttachChildren(segment, parentIds, parentMap, allModels, modelM
8590
8590
  }
8591
8591
  });
8592
8592
  }
8593
+ function buildChildArgs2(relArgs, fkFieldName, parentIds) {
8594
+ const base = relArgs === true || typeof relArgs !== "object" || relArgs === null ? {} : __spreadValues({}, relArgs);
8595
+ const existingWhere = base.where;
8596
+ const inCondition = { [fkFieldName]: { in: parentIds } };
8597
+ base.where = existingWhere ? { AND: [existingWhere, inCondition] } : inCondition;
8598
+ return base;
8599
+ }
8593
8600
  var init_streaming_where_in_executor = __esm({
8594
8601
  "src/builder/select/streaming-where-in-executor.ts"() {
8595
8602
  init_primary_key_utils();
8596
- init_where_in_executor_base();
8597
8603
  init_src();
8598
8604
  init_reducer();
8599
8605
  }