@constructive-io/graphql-codegen 4.6.0 → 4.7.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/client/error.d.ts +2 -93
- package/client/error.js +9 -273
- package/client/execute.d.ts +2 -55
- package/client/execute.js +5 -120
- package/client/typed-document.d.ts +2 -29
- package/client/typed-document.js +3 -39
- package/core/ast.d.ts +8 -10
- package/core/ast.js +17 -592
- package/core/custom-ast.d.ts +5 -33
- package/core/custom-ast.js +16 -203
- package/core/introspect/infer-tables.d.ts +2 -40
- package/core/introspect/infer-tables.js +4 -653
- package/core/introspect/schema-query.d.ts +3 -18
- package/core/introspect/schema-query.js +3 -118
- package/core/introspect/transform-schema.d.ts +2 -84
- package/core/introspect/transform-schema.js +14 -279
- package/core/introspect/transform.d.ts +2 -18
- package/core/introspect/transform.js +6 -39
- package/core/meta-object/convert.d.ts +2 -63
- package/core/meta-object/convert.js +4 -59
- package/core/meta-object/validate.d.ts +2 -7
- package/core/meta-object/validate.js +4 -30
- package/core/query-builder.d.ts +7 -46
- package/core/query-builder.js +8 -408
- package/core/types.d.ts +9 -139
- package/core/types.js +12 -26
- package/esm/client/error.d.ts +2 -93
- package/esm/client/error.js +2 -269
- package/esm/client/execute.d.ts +2 -55
- package/esm/client/execute.js +2 -118
- package/esm/client/typed-document.d.ts +2 -29
- package/esm/client/typed-document.js +2 -38
- package/esm/core/ast.d.ts +8 -10
- package/esm/core/ast.js +8 -550
- package/esm/core/custom-ast.d.ts +5 -33
- package/esm/core/custom-ast.js +5 -160
- package/esm/core/introspect/infer-tables.d.ts +2 -40
- package/esm/core/introspect/infer-tables.js +2 -652
- package/esm/core/introspect/schema-query.d.ts +3 -18
- package/esm/core/introspect/schema-query.js +2 -118
- package/esm/core/introspect/transform-schema.d.ts +2 -84
- package/esm/core/introspect/transform-schema.js +2 -269
- package/esm/core/introspect/transform.d.ts +2 -18
- package/esm/core/introspect/transform.js +2 -36
- package/esm/core/meta-object/convert.d.ts +2 -63
- package/esm/core/meta-object/convert.js +2 -58
- package/esm/core/meta-object/validate.d.ts +2 -7
- package/esm/core/meta-object/validate.js +2 -26
- package/esm/core/query-builder.d.ts +7 -46
- package/esm/core/query-builder.js +5 -373
- package/esm/core/types.d.ts +9 -139
- package/esm/core/types.js +9 -24
- package/esm/generators/field-selector.d.ts +5 -28
- package/esm/generators/field-selector.js +5 -354
- package/esm/generators/mutations.d.ts +5 -29
- package/esm/generators/mutations.js +5 -195
- package/esm/generators/naming-helpers.d.ts +6 -0
- package/esm/generators/naming-helpers.js +6 -0
- package/esm/generators/select.d.ts +6 -48
- package/esm/generators/select.js +6 -634
- package/esm/types/query.d.ts +9 -0
- package/esm/types/schema.d.ts +4 -0
- package/generators/field-selector.d.ts +5 -28
- package/generators/field-selector.js +12 -360
- package/generators/mutations.d.ts +5 -29
- package/generators/mutations.js +9 -231
- package/generators/naming-helpers.d.ts +6 -0
- package/generators/naming-helpers.js +20 -0
- package/generators/select.d.ts +6 -48
- package/generators/select.js +17 -677
- package/package.json +7 -6
- package/types/query.d.ts +9 -0
- package/types/schema.d.ts +4 -0
- package/core/meta-object/format.json +0 -93
- package/esm/core/meta-object/format.json +0 -93
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/graphql-codegen",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"description": "GraphQL SDK generator for Constructive databases with React Query hooks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graphql",
|
|
@@ -56,14 +56,15 @@
|
|
|
56
56
|
"@0no-co/graphql.web": "^1.1.2",
|
|
57
57
|
"@babel/generator": "^7.28.6",
|
|
58
58
|
"@babel/types": "^7.28.6",
|
|
59
|
+
"@constructive-io/graphql-query": "^3.3.0",
|
|
59
60
|
"@constructive-io/graphql-types": "^3.1.1",
|
|
60
61
|
"@inquirerer/utils": "^3.2.3",
|
|
61
|
-
"@pgpmjs/core": "^6.
|
|
62
|
+
"@pgpmjs/core": "^6.4.0",
|
|
62
63
|
"ajv": "^8.17.1",
|
|
63
64
|
"deepmerge": "^4.3.1",
|
|
64
65
|
"find-and-require-package-json": "^0.9.0",
|
|
65
66
|
"gql-ast": "^3.1.0",
|
|
66
|
-
"graphile-schema": "^1.
|
|
67
|
+
"graphile-schema": "^1.3.0",
|
|
67
68
|
"graphql": "^16.9.0",
|
|
68
69
|
"inflekt": "^0.3.1",
|
|
69
70
|
"inquirerer": "^4.4.0",
|
|
@@ -72,8 +73,8 @@
|
|
|
72
73
|
"oxfmt": "^0.26.0",
|
|
73
74
|
"pg-cache": "^3.1.0",
|
|
74
75
|
"pg-env": "^1.5.0",
|
|
75
|
-
"pgsql-client": "^3.
|
|
76
|
-
"pgsql-seed": "^2.
|
|
76
|
+
"pgsql-client": "^3.3.0",
|
|
77
|
+
"pgsql-seed": "^2.3.0",
|
|
77
78
|
"undici": "^7.19.0"
|
|
78
79
|
},
|
|
79
80
|
"peerDependencies": {
|
|
@@ -100,5 +101,5 @@
|
|
|
100
101
|
"tsx": "^4.21.0",
|
|
101
102
|
"typescript": "^5.9.3"
|
|
102
103
|
},
|
|
103
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "1e0c774144be23a4c57a15ffe54ea0ec9fbd7c55"
|
|
104
105
|
}
|
package/types/query.d.ts
CHANGED
|
@@ -39,6 +39,15 @@ export interface QueryOptions {
|
|
|
39
39
|
orderBy?: OrderByItem[];
|
|
40
40
|
/** Field selection options */
|
|
41
41
|
fieldSelection?: FieldSelection;
|
|
42
|
+
/**
|
|
43
|
+
* Maps requested relation field names to actual schema field names (or null to omit).
|
|
44
|
+
* When the mapped name differs from the key, a GraphQL alias is emitted so the
|
|
45
|
+
* consumer sees a stable field name regardless of the server-side name.
|
|
46
|
+
*
|
|
47
|
+
* Example: `{ contact: 'contactByOwnerId' }` emits `contact: contactByOwnerId { … }`
|
|
48
|
+
* Pass `null` to suppress a relation entirely: `{ internalNotes: null }`
|
|
49
|
+
*/
|
|
50
|
+
relationFieldMap?: Record<string, string | null>;
|
|
42
51
|
/** Include pageInfo in response */
|
|
43
52
|
includePageInfo?: boolean;
|
|
44
53
|
}
|
package/types/schema.d.ts
CHANGED
|
@@ -108,6 +108,10 @@ export interface CleanField {
|
|
|
108
108
|
/** Description from PostgreSQL COMMENT (smart comments stripped) */
|
|
109
109
|
description?: string;
|
|
110
110
|
type: CleanFieldType;
|
|
111
|
+
/** Whether the column has a NOT NULL constraint (inferred from NON_NULL wrapper on entity type field) */
|
|
112
|
+
isNotNull?: boolean | null;
|
|
113
|
+
/** Whether the column has a DEFAULT value (inferred by comparing entity vs CreateInput field nullability) */
|
|
114
|
+
hasDefault?: boolean | null;
|
|
111
115
|
}
|
|
112
116
|
/**
|
|
113
117
|
* Field type information from PostGraphile introspection
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$id": "root",
|
|
3
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"definitions": {
|
|
6
|
-
"field": {
|
|
7
|
-
"type": "object",
|
|
8
|
-
"required": ["name", "type"],
|
|
9
|
-
"additionalProperties": true,
|
|
10
|
-
"properties": {
|
|
11
|
-
"name": {
|
|
12
|
-
"type": "string",
|
|
13
|
-
"default": "id",
|
|
14
|
-
"examples": ["id"]
|
|
15
|
-
},
|
|
16
|
-
"type": {
|
|
17
|
-
"type": "object",
|
|
18
|
-
"required": ["pgType", "gqlType"],
|
|
19
|
-
"additionalProperties": true,
|
|
20
|
-
"properties": {
|
|
21
|
-
"gqlType": {
|
|
22
|
-
"type": ["string", "null"]
|
|
23
|
-
},
|
|
24
|
-
"pgType": {
|
|
25
|
-
"type": ["string", "null"]
|
|
26
|
-
},
|
|
27
|
-
"subtype": {
|
|
28
|
-
"type": ["string", "null"]
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
"properties": {
|
|
36
|
-
"tables": {
|
|
37
|
-
"type": "array",
|
|
38
|
-
"items": {
|
|
39
|
-
"type": "object",
|
|
40
|
-
"properties": {
|
|
41
|
-
"name": {
|
|
42
|
-
"type": "string",
|
|
43
|
-
"default": "User",
|
|
44
|
-
"examples": ["User"]
|
|
45
|
-
},
|
|
46
|
-
"fields": {
|
|
47
|
-
"type": "array",
|
|
48
|
-
"items": {
|
|
49
|
-
"$ref": "#/definitions/field"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"primaryConstraints": {
|
|
53
|
-
"type": "array",
|
|
54
|
-
"items": {
|
|
55
|
-
"$ref": "#/definitions/field"
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
"uniqueConstraints": {
|
|
59
|
-
"type": "array",
|
|
60
|
-
"items": {
|
|
61
|
-
"$ref": "#/definitions/field"
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
"foreignConstraints": {
|
|
65
|
-
"type": "array",
|
|
66
|
-
"items": {
|
|
67
|
-
"type": "object",
|
|
68
|
-
"properties": {
|
|
69
|
-
"refTable": {
|
|
70
|
-
"type": "string",
|
|
71
|
-
"default": "User",
|
|
72
|
-
"examples": ["User"]
|
|
73
|
-
},
|
|
74
|
-
"fromKey": {
|
|
75
|
-
"$ref": "#/definitions/field"
|
|
76
|
-
},
|
|
77
|
-
"toKey": {
|
|
78
|
-
"$ref": "#/definitions/field"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
"required": ["refTable", "fromKey", "toKey"],
|
|
82
|
-
"additionalProperties": false
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
"required": ["name", "fields"],
|
|
87
|
-
"additionalProperties": false
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
"required": ["tables"],
|
|
92
|
-
"additionalProperties": false
|
|
93
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$id": "root",
|
|
3
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"definitions": {
|
|
6
|
-
"field": {
|
|
7
|
-
"type": "object",
|
|
8
|
-
"required": ["name", "type"],
|
|
9
|
-
"additionalProperties": true,
|
|
10
|
-
"properties": {
|
|
11
|
-
"name": {
|
|
12
|
-
"type": "string",
|
|
13
|
-
"default": "id",
|
|
14
|
-
"examples": ["id"]
|
|
15
|
-
},
|
|
16
|
-
"type": {
|
|
17
|
-
"type": "object",
|
|
18
|
-
"required": ["pgType", "gqlType"],
|
|
19
|
-
"additionalProperties": true,
|
|
20
|
-
"properties": {
|
|
21
|
-
"gqlType": {
|
|
22
|
-
"type": ["string", "null"]
|
|
23
|
-
},
|
|
24
|
-
"pgType": {
|
|
25
|
-
"type": ["string", "null"]
|
|
26
|
-
},
|
|
27
|
-
"subtype": {
|
|
28
|
-
"type": ["string", "null"]
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
"properties": {
|
|
36
|
-
"tables": {
|
|
37
|
-
"type": "array",
|
|
38
|
-
"items": {
|
|
39
|
-
"type": "object",
|
|
40
|
-
"properties": {
|
|
41
|
-
"name": {
|
|
42
|
-
"type": "string",
|
|
43
|
-
"default": "User",
|
|
44
|
-
"examples": ["User"]
|
|
45
|
-
},
|
|
46
|
-
"fields": {
|
|
47
|
-
"type": "array",
|
|
48
|
-
"items": {
|
|
49
|
-
"$ref": "#/definitions/field"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"primaryConstraints": {
|
|
53
|
-
"type": "array",
|
|
54
|
-
"items": {
|
|
55
|
-
"$ref": "#/definitions/field"
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
"uniqueConstraints": {
|
|
59
|
-
"type": "array",
|
|
60
|
-
"items": {
|
|
61
|
-
"$ref": "#/definitions/field"
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
"foreignConstraints": {
|
|
65
|
-
"type": "array",
|
|
66
|
-
"items": {
|
|
67
|
-
"type": "object",
|
|
68
|
-
"properties": {
|
|
69
|
-
"refTable": {
|
|
70
|
-
"type": "string",
|
|
71
|
-
"default": "User",
|
|
72
|
-
"examples": ["User"]
|
|
73
|
-
},
|
|
74
|
-
"fromKey": {
|
|
75
|
-
"$ref": "#/definitions/field"
|
|
76
|
-
},
|
|
77
|
-
"toKey": {
|
|
78
|
-
"$ref": "#/definitions/field"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
"required": ["refTable", "fromKey", "toKey"],
|
|
82
|
-
"additionalProperties": false
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
"required": ["name", "fields"],
|
|
87
|
-
"additionalProperties": false
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
"required": ["tables"],
|
|
92
|
-
"additionalProperties": false
|
|
93
|
-
}
|