@stonecrop/graphql-middleware 0.17.0 → 0.19.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.
- package/dist/graphql-middleware.d.ts +13 -5
- package/dist/index.js +460 -304
- package/dist/index.js.map +1 -1
- package/dist/src/fields.d.ts +23 -0
- package/dist/src/fields.d.ts.map +1 -0
- package/dist/src/fields.js +28 -0
- package/dist/src/link-display.d.ts +19 -0
- package/dist/src/link-display.d.ts.map +1 -0
- package/dist/src/link-display.js +80 -0
- package/dist/src/plugin/postgraphile.d.ts +19 -5
- package/dist/src/plugin/postgraphile.d.ts.map +1 -1
- package/dist/src/plugin/postgraphile.js +244 -50
- package/dist/src/registry/doctypes.d.ts +12 -1
- package/dist/src/registry/doctypes.d.ts.map +1 -1
- package/dist/src/registry/doctypes.js +65 -2
- package/dist/src/tables.d.ts +14 -0
- package/dist/src/tables.d.ts.map +1 -0
- package/dist/src/tables.js +21 -0
- package/dist/src/typeDefs.d.ts.map +1 -1
- package/dist/src/typeDefs.js +16 -0
- package/package.json +2 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The quoted SQL table a doctype reads from: the `tables` override when the adapter supplies one,
|
|
3
|
+
* otherwise the doctype name snake-cased.
|
|
4
|
+
*
|
|
5
|
+
* The one definition of that mapping. It lives in its own module rather than beside either caller
|
|
6
|
+
* because the plugin imports the link-display enrichment, so the enrichment cannot import back —
|
|
7
|
+
* and the copy it made instead was byte-identical, which is the state a mapping is in right before
|
|
8
|
+
* one side learns about schema-qualified names and the other does not.
|
|
9
|
+
*
|
|
10
|
+
* A dotted override is read as `schema.table` and quoted in two parts, so a table in a non-default
|
|
11
|
+
* Postgres schema survives quoting instead of becoming one identifier containing a dot.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveTableName(name: string, tables?: Record<string, string>): string;
|
|
14
|
+
//# sourceMappingURL=tables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../src/tables.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAOtF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { pascalToSnake } from '@stonecrop/schema';
|
|
2
|
+
/**
|
|
3
|
+
* The quoted SQL table a doctype reads from: the `tables` override when the adapter supplies one,
|
|
4
|
+
* otherwise the doctype name snake-cased.
|
|
5
|
+
*
|
|
6
|
+
* The one definition of that mapping. It lives in its own module rather than beside either caller
|
|
7
|
+
* because the plugin imports the link-display enrichment, so the enrichment cannot import back —
|
|
8
|
+
* and the copy it made instead was byte-identical, which is the state a mapping is in right before
|
|
9
|
+
* one side learns about schema-qualified names and the other does not.
|
|
10
|
+
*
|
|
11
|
+
* A dotted override is read as `schema.table` and quoted in two parts, so a table in a non-default
|
|
12
|
+
* Postgres schema survives quoting instead of becoming one identifier containing a dot.
|
|
13
|
+
*/
|
|
14
|
+
export function resolveTableName(name, tables) {
|
|
15
|
+
const target = tables?.[name] ?? pascalToSnake(name);
|
|
16
|
+
const dotIndex = target.indexOf('.');
|
|
17
|
+
if (dotIndex > 0) {
|
|
18
|
+
return `"${target.slice(0, dotIndex)}"."${target.slice(dotIndex + 1)}"`;
|
|
19
|
+
}
|
|
20
|
+
return `"${target}"`;
|
|
21
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeDefs.d.ts","sourceRoot":"","sources":["../../src/typeDefs.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"typeDefs.d.ts","sourceRoot":"","sources":["../../src/typeDefs.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,QAAQ,gCA8GpB,CAAA"}
|
package/dist/src/typeDefs.js
CHANGED
|
@@ -48,6 +48,7 @@ export const typeDefs = gql `
|
|
|
48
48
|
type StonecropDoctypeMeta {
|
|
49
49
|
name: String!
|
|
50
50
|
slug: String
|
|
51
|
+
displayField: String
|
|
51
52
|
fields: [StonecropFieldMeta!]!
|
|
52
53
|
workflow: StonecropWorkflowMeta
|
|
53
54
|
inherits: String
|
|
@@ -57,6 +58,13 @@ export const typeDefs = gql `
|
|
|
57
58
|
data: JSON
|
|
58
59
|
doctype: String!
|
|
59
60
|
unknownLinks: [String!]
|
|
61
|
+
"""
|
|
62
|
+
Fields whose linked rows were cut short by a row cap, so data holds a prefix of the
|
|
63
|
+
relation rather than all of it. Null when nothing was truncated. A link cannot be paged,
|
|
64
|
+
so a client that sees a name here must not write that relation back — the rows it never
|
|
65
|
+
received would be deleted.
|
|
66
|
+
"""
|
|
67
|
+
truncatedLinks: [String!]
|
|
60
68
|
}
|
|
61
69
|
|
|
62
70
|
type StonecropRecordsResult {
|
|
@@ -78,6 +86,14 @@ export const typeDefs = gql `
|
|
|
78
86
|
success: Boolean!
|
|
79
87
|
data: JSON
|
|
80
88
|
error: String
|
|
89
|
+
"""
|
|
90
|
+
Keys the write discarded because the doctype declares no column for them, or because the
|
|
91
|
+
value was a nested relation rather than a column value. Null when everything sent was
|
|
92
|
+
stored. The action still succeeded — this is what it did not keep, and a client that
|
|
93
|
+
reports an unqualified success without checking it tells the user data was saved that
|
|
94
|
+
was not.
|
|
95
|
+
"""
|
|
96
|
+
droppedFields: [String!]
|
|
81
97
|
}
|
|
82
98
|
|
|
83
99
|
extend type Query {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/graphql-middleware",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "GraphQL middleware for PostGraphile and Stonecrop schema",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"graphql": "^16.14.0",
|
|
24
24
|
"pluralize": "^8.0.0",
|
|
25
25
|
"postgraphile": "^5.0.3",
|
|
26
|
-
"@stonecrop/schema": "0.
|
|
26
|
+
"@stonecrop/schema": "0.19.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@electric-sql/pglite": "^0.4.5",
|