@graffy/pg 0.19.1-alpha.3 → 0.19.2
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/Db.js +1 -0
- package/package.json +3 -3
- package/sql/clauses.js +2 -2
package/Db.js
CHANGED
|
@@ -7,6 +7,7 @@ import { del, patch, put, selectByArgs, selectByIds } from "./sql/index.js";
|
|
|
7
7
|
const log = debug('graffy:pg:db');
|
|
8
8
|
const { Pool, Client, types } = pg;
|
|
9
9
|
export default class Db {
|
|
10
|
+
client;
|
|
10
11
|
constructor(connection) {
|
|
11
12
|
if (typeof connection === 'object' &&
|
|
12
13
|
connection &&
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graffy/pg",
|
|
3
3
|
"description": "The standard Postgres module for Graffy. Each instance this module mounts a Postgres table as a Graffy subtree.",
|
|
4
|
-
"author": "
|
|
5
|
-
"version": "0.19.
|
|
4
|
+
"author": "graffy team (https://github.com/usegraffy)",
|
|
5
|
+
"version": "0.19.2",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"types": "./index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"sql-formatter": "^15.7.4",
|
|
16
|
-
"@graffy/common": "0.19.
|
|
16
|
+
"@graffy/common": "0.19.2",
|
|
17
17
|
"sql-template-tag": "^5.2.1",
|
|
18
18
|
"debug": "^4.4.3"
|
|
19
19
|
},
|
package/sql/clauses.js
CHANGED
|
@@ -193,8 +193,8 @@ function getJsonUpdate(object, col, path) {
|
|
|
193
193
|
let hasNulls = false; // Is it possible that one of the properties becomes null?
|
|
194
194
|
const patchSqls = Object.entries(object).map(([key, value]) => {
|
|
195
195
|
const [valSql, nullable] = getJsonUpdate(value, col, path.concat(key));
|
|
196
|
-
maybeNull
|
|
197
|
-
hasNulls
|
|
196
|
+
maybeNull &&= nullable;
|
|
197
|
+
hasNulls ||= nullable;
|
|
198
198
|
return sql `${key}::text, ${valSql}`;
|
|
199
199
|
});
|
|
200
200
|
let clause = sql `${baseSql} || jsonb_build_object(${join(patchSqls, ', ')})`;
|