pqb 0.48.6 → 0.49.0

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.mjs CHANGED
@@ -3000,7 +3000,12 @@ const runAfterCommit = async (afterCommit, result) => {
3000
3000
  const applyBatchTransforms = (q, batches) => {
3001
3001
  if (q.transform) {
3002
3002
  for (const item of batches) {
3003
- item.parent[item.key] = item.data === null ? void 0 : applyTransforms(q, q.returnType, q.transform, item.data);
3003
+ item.parent[item.key] = applyTransforms(
3004
+ q,
3005
+ q.returnType,
3006
+ q.transform,
3007
+ item.data
3008
+ );
3004
3009
  }
3005
3010
  }
3006
3011
  };
@@ -3782,8 +3787,9 @@ const addParserForSelectItem = (q, as, key, arg, joinQuery) => {
3782
3787
  const { parsers } = query;
3783
3788
  if (parsers) {
3784
3789
  if (returnType === "one") {
3785
- for (const { data } of batches) {
3786
- if (data) parseRecord(parsers, data);
3790
+ for (const batch of batches) {
3791
+ if (batch.data) parseRecord(parsers, batch.data);
3792
+ else batch.data = void 0;
3787
3793
  }
3788
3794
  } else {
3789
3795
  for (const { data } of batches) {
@@ -3791,7 +3797,11 @@ const addParserForSelectItem = (q, as, key, arg, joinQuery) => {
3791
3797
  parseRecord(parsers, data);
3792
3798
  }
3793
3799
  }
3794
- } else if (returnType !== "one") {
3800
+ } else if (returnType === "one") {
3801
+ for (const batch of batches) {
3802
+ if (!batch.data) batch.data = void 0;
3803
+ }
3804
+ } else {
3795
3805
  for (const { data } of batches) {
3796
3806
  if (!data) throw new NotFoundError(arg);
3797
3807
  }