graphile-sql-expression-validator 0.2.1 → 0.2.3
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/README.md +3 -3
- package/esm/index.js +1 -1
- package/index.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ npm install graphile-sql-expression-validator
|
|
|
15
15
|
Tag columns that contain SQL expressions with `@sqlExpression`:
|
|
16
16
|
|
|
17
17
|
```sql
|
|
18
|
-
COMMENT ON COLUMN
|
|
18
|
+
COMMENT ON COLUMN metaschema_public.field.default_value IS E'@sqlExpression';
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
The plugin will automatically look for a companion `*_ast` column (e.g., `default_value_ast`) to store the parsed AST.
|
|
@@ -26,7 +26,7 @@ By default, the plugin looks for a companion column named `<column>_ast`. You ca
|
|
|
26
26
|
|
|
27
27
|
```sql
|
|
28
28
|
-- Use a custom AST column name
|
|
29
|
-
COMMENT ON COLUMN
|
|
29
|
+
COMMENT ON COLUMN metaschema_public.field.default_value IS E'@sqlExpression\n@rawSqlAstField my_custom_ast_column';
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
If `@rawSqlAstField` points to a non-existent column, the plugin will throw an error. If not specified, it falls back to the `<column>_ast` convention (and silently skips AST storage if that column doesn't exist).
|
|
@@ -47,7 +47,7 @@ const postgraphileOptions = {
|
|
|
47
47
|
// Optional: Maximum expression length (default: 10000)
|
|
48
48
|
maxExpressionLength: 5000,
|
|
49
49
|
// Optional: Auto-allow schemas owned by the current database
|
|
50
|
-
// Queries: SELECT schema_name FROM
|
|
50
|
+
// Queries: SELECT schema_name FROM metaschema_public.schema
|
|
51
51
|
// WHERE database_id = jwt_private.current_database_id()
|
|
52
52
|
allowOwnedSchemas: true,
|
|
53
53
|
// Optional: Custom hook for dynamic schema resolution
|
package/esm/index.js
CHANGED
|
@@ -199,7 +199,7 @@ async function resolveEffectiveOptions(baseOptions, gqlContext) {
|
|
|
199
199
|
let ownedSchemas = gqlContext[OWNED_SCHEMAS_CACHE_KEY];
|
|
200
200
|
if (!ownedSchemas) {
|
|
201
201
|
try {
|
|
202
|
-
const result = await gqlContext.pgClient.query(`SELECT schema_name FROM
|
|
202
|
+
const result = await gqlContext.pgClient.query(`SELECT schema_name FROM metaschema_public.schema WHERE database_id = jwt_private.current_database_id()`);
|
|
203
203
|
ownedSchemas = result.rows.map((row) => row.schema_name);
|
|
204
204
|
gqlContext[OWNED_SCHEMAS_CACHE_KEY] = ownedSchemas;
|
|
205
205
|
}
|
package/index.js
CHANGED
|
@@ -203,7 +203,7 @@ async function resolveEffectiveOptions(baseOptions, gqlContext) {
|
|
|
203
203
|
let ownedSchemas = gqlContext[OWNED_SCHEMAS_CACHE_KEY];
|
|
204
204
|
if (!ownedSchemas) {
|
|
205
205
|
try {
|
|
206
|
-
const result = await gqlContext.pgClient.query(`SELECT schema_name FROM
|
|
206
|
+
const result = await gqlContext.pgClient.query(`SELECT schema_name FROM metaschema_public.schema WHERE database_id = jwt_private.current_database_id()`);
|
|
207
207
|
ownedSchemas = result.rows.map((row) => row.schema_name);
|
|
208
208
|
gqlContext[OWNED_SCHEMAS_CACHE_KEY] = ownedSchemas;
|
|
209
209
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-sql-expression-validator",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Graphile plugin for SQL expression validation and AST normalization",
|
|
5
5
|
"author": "Constructive <developers@constructive.io>",
|
|
6
6
|
"homepage": "https://github.com/constructive-io/constructive",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"graphile-build": "^4.14.1",
|
|
50
50
|
"graphql": "15.10.1",
|
|
51
|
-
"pgsql-deparser": "^17.17.
|
|
52
|
-
"pgsql-parser": "^17.9.
|
|
51
|
+
"pgsql-deparser": "^17.17.2",
|
|
52
|
+
"pgsql-parser": "^17.9.11"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "22c89cfc6f67879e77ca47f652c31c80828665f5"
|
|
55
55
|
}
|