pqb 0.57.3 → 0.57.4

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
@@ -3756,7 +3756,7 @@ const makeRowToJson = (table, shape, aliasName) => {
3756
3756
  `'${key}', "${table}"."${aliasName && column.data.name || key}"${column.data.jsonCast ? `::${column.data.jsonCast}` : ""}`
3757
3757
  );
3758
3758
  }
3759
- return isSimple ? `row_to_json("${table}".*)` : `CASE WHEN "${table}".* IS NULL THEN NULL ELSE json_build_object(` + list.join(", ") + ") END";
3759
+ return isSimple ? `row_to_json("${table}".*)` : `CASE WHEN to_jsonb("${table}") IS NULL THEN NULL ELSE json_build_object(` + list.join(", ") + ") END";
3760
3760
  };
3761
3761
 
3762
3762
  const pushDistinctSql = (ctx, table, distinct, quotedAs) => {
@@ -6169,6 +6169,15 @@ class Then {
6169
6169
  catch(fn) {
6170
6170
  return this.then(void 0, fn);
6171
6171
  }
6172
+ catchUniqueError(fn) {
6173
+ return this.then(void 0, (err) => {
6174
+ if (err instanceof QueryError && err.isUnique) {
6175
+ fn(err);
6176
+ } else {
6177
+ throw err;
6178
+ }
6179
+ });
6180
+ }
6172
6181
  }
6173
6182
  let queryError = void 0;
6174
6183
  const getThen = function() {