@graffy/pg 0.17.0 → 0.17.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.
Files changed (3) hide show
  1. package/index.cjs +2 -2
  2. package/index.mjs +2 -2
  3. package/package.json +4 -4
package/index.cjs CHANGED
@@ -89,7 +89,7 @@ function formatSql(sql2) {
89
89
  if (!values.length) break;
90
90
  const value = values.shift();
91
91
  output.push(
92
- typeof value === "number" ? value.toString() : typeof value === "object" ? `'${JSON.stringify(value)}'` : `'${value}'`
92
+ typeof value === "number" ? value.toString() : value === null ? "null" : typeof value === "object" ? `'${JSON.stringify(value)}'` : `'${value}'`
93
93
  );
94
94
  }
95
95
  return sqlFormatter.format(output.join(""), { language: "postgresql" });
@@ -410,7 +410,7 @@ function simplify(node) {
410
410
  if (op === "$or") {
411
411
  const { eqmap, noneq, change } = node[1].reduce(
412
412
  (acc, item) => {
413
- if (item[0] !== "$eq") {
413
+ if (item[0] !== "$eq" || item[2] === null) {
414
414
  acc.noneq.push(item);
415
415
  } else if (acc.eqmap[item[1]]) {
416
416
  acc.change = true;
package/index.mjs CHANGED
@@ -87,7 +87,7 @@ function formatSql(sql2) {
87
87
  if (!values.length) break;
88
88
  const value = values.shift();
89
89
  output.push(
90
- typeof value === "number" ? value.toString() : typeof value === "object" ? `'${JSON.stringify(value)}'` : `'${value}'`
90
+ typeof value === "number" ? value.toString() : value === null ? "null" : typeof value === "object" ? `'${JSON.stringify(value)}'` : `'${value}'`
91
91
  );
92
92
  }
93
93
  return format(output.join(""), { language: "postgresql" });
@@ -408,7 +408,7 @@ function simplify(node) {
408
408
  if (op === "$or") {
409
409
  const { eqmap, noneq, change } = node[1].reduce(
410
410
  (acc, item) => {
411
- if (item[0] !== "$eq") {
411
+ if (item[0] !== "$eq" || item[2] === null) {
412
412
  acc.noneq.push(item);
413
413
  } else if (acc.eqmap[item[1]]) {
414
414
  acc.change = true;
package/package.json CHANGED
@@ -2,7 +2,7 @@
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
4
  "author": "aravind (https://github.com/aravindet)",
5
- "version": "0.17.0",
5
+ "version": "0.17.1",
6
6
  "main": "./index.cjs",
7
7
  "exports": {
8
8
  "import": "./index.mjs",
@@ -16,9 +16,9 @@
16
16
  },
17
17
  "license": "Apache-2.0",
18
18
  "dependencies": {
19
- "@graffy/common": "0.17.0",
20
- "debug": "^4.3.3",
21
- "sql-formatter": "^15.6.2"
19
+ "@graffy/common": "0.17.1",
20
+ "debug": "^4.4.1",
21
+ "sql-formatter": "^15.6.4"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "pg": "^8.0.0"