@supacloud/db 0.8.0 → 0.9.0

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.
@@ -12,7 +12,6 @@ var __esm = (fn, res, err) => () => {
12
12
 
13
13
  // src/sql-analysis.ts
14
14
  import { createHash } from "node:crypto";
15
- import { fingerprint, parse } from "libpg-query";
16
15
  function record(value) {
17
16
  return value !== null && typeof value === "object" && !Array.isArray(value);
18
17
  }
@@ -32,6 +31,7 @@ function names(value) {
32
31
  return value.flatMap((part) => record(part) && record(part["String"]) && typeof part["String"]["sval"] === "string" ? [part["String"]["sval"]] : []);
33
32
  }
34
33
  async function analyzeSql(sql) {
34
+ const { fingerprint, parse } = await import("libpg-query");
35
35
  const result = await parse(sql);
36
36
  const defines = new Set, touches = new Set, references = new Set, review = new Set;
37
37
  const qualified = (kind, parts) => {
@@ -139,6 +139,7 @@ async function analyzeSql(sql) {
139
139
  };
140
140
  }
141
141
  async function assertReadSql(sql) {
142
+ const { fingerprint, parse } = await import("libpg-query");
142
143
  const tree = await parse(sql);
143
144
  if (!record(tree) || !Array.isArray(tree["stmts"]) || tree["stmts"].length !== 1)
144
145
  throw new Error("Expected one read statement");
@@ -12,7 +12,6 @@ var __esm = (fn, res, err) => () => {
12
12
 
13
13
  // src/sql-analysis.ts
14
14
  import { createHash } from "node:crypto";
15
- import { fingerprint, parse } from "libpg-query";
16
15
  function record(value) {
17
16
  return value !== null && typeof value === "object" && !Array.isArray(value);
18
17
  }
@@ -32,6 +31,7 @@ function names(value) {
32
31
  return value.flatMap((part) => record(part) && record(part["String"]) && typeof part["String"]["sval"] === "string" ? [part["String"]["sval"]] : []);
33
32
  }
34
33
  async function analyzeSql(sql) {
34
+ const { fingerprint, parse } = await import("libpg-query");
35
35
  const result = await parse(sql);
36
36
  const defines = new Set, touches = new Set, references = new Set, review = new Set;
37
37
  const qualified = (kind, parts) => {
@@ -139,6 +139,7 @@ async function analyzeSql(sql) {
139
139
  };
140
140
  }
141
141
  async function assertReadSql(sql) {
142
+ const { fingerprint, parse } = await import("libpg-query");
142
143
  const tree = await parse(sql);
143
144
  if (!record(tree) || !Array.isArray(tree["stmts"]) || tree["stmts"].length !== 1)
144
145
  throw new Error("Expected one read statement");
@@ -13,7 +13,6 @@ var __esm = (fn, res, err) => () => {
13
13
 
14
14
  // src/sql-analysis.ts
15
15
  import { createHash } from "node:crypto";
16
- import { fingerprint, parse } from "libpg-query";
17
16
  function record(value) {
18
17
  return value !== null && typeof value === "object" && !Array.isArray(value);
19
18
  }
@@ -33,6 +32,7 @@ function names(value) {
33
32
  return value.flatMap((part) => record(part) && record(part["String"]) && typeof part["String"]["sval"] === "string" ? [part["String"]["sval"]] : []);
34
33
  }
35
34
  async function analyzeSql(sql) {
35
+ const { fingerprint, parse } = await import("libpg-query");
36
36
  const result = await parse(sql);
37
37
  const defines = new Set, touches = new Set, references = new Set, review = new Set;
38
38
  const qualified = (kind, parts) => {
@@ -140,6 +140,7 @@ async function analyzeSql(sql) {
140
140
  };
141
141
  }
142
142
  async function assertReadSql(sql) {
143
+ const { fingerprint, parse } = await import("libpg-query");
143
144
  const tree = await parse(sql);
144
145
  if (!record(tree) || !Array.isArray(tree["stmts"]) || tree["stmts"].length !== 1)
145
146
  throw new Error("Expected one read statement");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/db",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Database governance layer for SupaCloud: RLS policies, RPC functions and grants as first-class resources, with manifest/catalog reconciliation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -70,7 +70,7 @@
70
70
  },
71
71
  "dependencies": {
72
72
  "libpg-query": "18.1.4",
73
- "@supacloud/contracts": "0.4.0"
73
+ "@supacloud/contracts": "0.5.0"
74
74
  },
75
75
  "peerDependencies": {
76
76
  "drizzle-orm": "1.0.0-rc.4"
@@ -81,6 +81,6 @@
81
81
  }
82
82
  },
83
83
  "overrides": {
84
- "@supacloud/contracts": "0.4.0"
84
+ "@supacloud/contracts": "0.5.0"
85
85
  }
86
86
  }