pqb 0.46.4 → 0.47.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.js CHANGED
@@ -2156,7 +2156,7 @@ const makeRowToJson = (table, shape, aliasName) => {
2156
2156
  `'${key}', "${table}"."${aliasName && column.data.name || key}"${column.data.jsonCast ? `::${column.data.jsonCast}` : ""}`
2157
2157
  );
2158
2158
  }
2159
- return isSimple ? `row_to_json("${table}".*)` : "json_build_object(" + list.join(", ") + ")";
2159
+ return isSimple ? `row_to_json("${table}".*)` : `CASE WHEN "${table}".* IS NULL THEN NULL ELSE json_build_object(` + list.join(", ") + ") END";
2160
2160
  };
2161
2161
 
2162
2162
  const queryTypeWithLimitOne = {
@@ -5987,14 +5987,21 @@ const subJoinToSql = (ctx, jq, innerAs, outerAs, cloned) => {
5987
5987
  )}) ${outerAs || innerAs}`;
5988
5988
  };
5989
5989
  const processArgs = (args, ctx, query, joinAs, joinShape, quotedAs) => {
5990
- return args.length === 1 ? getObjectOrRawConditions(ctx, query, args[0], quotedAs, joinAs, joinShape) : getConditionsFor3Or4LengthItem(
5990
+ return args.length ? args.length === 1 ? getObjectOrRawConditions(
5991
+ ctx,
5992
+ query,
5993
+ args[0],
5994
+ quotedAs,
5995
+ joinAs,
5996
+ joinShape
5997
+ ) : getConditionsFor3Or4LengthItem(
5991
5998
  ctx,
5992
5999
  query,
5993
6000
  joinAs,
5994
6001
  quotedAs,
5995
6002
  args,
5996
6003
  joinShape
5997
- );
6004
+ ) : void 0;
5998
6005
  };
5999
6006
  const getConditionsFor3Or4LengthItem = (ctx, query, target, quotedAs, args, joinShape) => {
6000
6007
  const [leftColumn, opOrRightColumn, maybeRightColumn] = args;
@@ -8297,7 +8304,7 @@ const handleOneData = (q, data, ctx) => {
8297
8304
  columns.map(
8298
8305
  (key) => (
8299
8306
  // undefined values were stripped and no need to check for them
8300
- encoders[key] && !orchidCore.isExpression(data[key]) ? encoders[key](data[key]) : data[key]
8307
+ encoders[key] && !orchidCore.isExpression(data[key]) && data[key] !== null ? encoders[key](data[key]) : data[key]
8301
8308
  )
8302
8309
  )
8303
8310
  ];