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