@constructive-io/graphql-codegen 2.22.0 → 2.23.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/cli/codegen/barrel.d.ts +5 -1
- package/cli/codegen/barrel.js +13 -11
- package/cli/codegen/index.d.ts +3 -3
- package/cli/codegen/index.js +15 -9
- package/cli/codegen/orm/client-generator.js +3 -2
- package/cli/codegen/orm/custom-ops-generator.js +17 -4
- package/cli/codegen/orm/input-types-generator.js +129 -18
- package/cli/codegen/orm/model-generator.js +2 -1
- package/cli/codegen/orm/query-builder.d.ts +1 -1
- package/cli/codegen/orm/query-builder.js +2 -2
- package/cli/codegen/schema-types-generator.js +5 -5
- package/cli/codegen/utils.d.ts +6 -1
- package/cli/codegen/utils.js +23 -8
- package/cli/commands/generate-orm.d.ts +5 -3
- package/cli/commands/generate-orm.js +65 -84
- package/cli/commands/generate.d.ts +2 -0
- package/cli/commands/generate.js +66 -87
- package/cli/commands/shared.d.ts +74 -0
- package/cli/commands/shared.js +88 -0
- package/cli/index.js +75 -45
- package/cli/introspect/index.d.ts +8 -5
- package/cli/introspect/index.js +19 -7
- package/cli/introspect/infer-tables.d.ts +51 -0
- package/cli/introspect/infer-tables.js +550 -0
- package/cli/introspect/pluralize.d.ts +30 -0
- package/cli/introspect/pluralize.js +124 -0
- package/cli/introspect/source/endpoint.d.ts +34 -0
- package/cli/introspect/source/endpoint.js +35 -0
- package/cli/introspect/source/file.d.ts +20 -0
- package/cli/introspect/source/file.js +103 -0
- package/cli/introspect/source/index.d.ts +48 -0
- package/cli/introspect/source/index.js +72 -0
- package/cli/introspect/source/types.d.ts +58 -0
- package/cli/introspect/source/types.js +27 -0
- package/cli/introspect/transform.d.ts +5 -6
- package/cli/introspect/transform.js +0 -173
- package/cli/watch/cache.d.ts +3 -4
- package/cli/watch/cache.js +6 -10
- package/cli/watch/poller.d.ts +1 -2
- package/cli/watch/poller.js +27 -45
- package/cli/watch/types.d.ts +0 -3
- package/esm/cli/codegen/barrel.d.ts +5 -1
- package/esm/cli/codegen/barrel.js +13 -11
- package/esm/cli/codegen/index.d.ts +3 -3
- package/esm/cli/codegen/index.js +18 -12
- package/esm/cli/codegen/orm/client-generator.js +3 -2
- package/esm/cli/codegen/orm/custom-ops-generator.js +18 -5
- package/esm/cli/codegen/orm/input-types-generator.js +130 -19
- package/esm/cli/codegen/orm/model-generator.js +3 -2
- package/esm/cli/codegen/orm/query-builder.d.ts +1 -1
- package/esm/cli/codegen/orm/query-builder.js +2 -2
- package/esm/cli/codegen/schema-types-generator.js +6 -6
- package/esm/cli/codegen/utils.d.ts +6 -1
- package/esm/cli/codegen/utils.js +22 -8
- package/esm/cli/commands/generate-orm.d.ts +5 -3
- package/esm/cli/commands/generate-orm.js +65 -84
- package/esm/cli/commands/generate.d.ts +2 -0
- package/esm/cli/commands/generate.js +66 -87
- package/esm/cli/commands/shared.d.ts +74 -0
- package/esm/cli/commands/shared.js +84 -0
- package/esm/cli/index.js +76 -46
- package/esm/cli/introspect/index.d.ts +8 -5
- package/esm/cli/introspect/index.js +10 -3
- package/esm/cli/introspect/infer-tables.d.ts +51 -0
- package/esm/cli/introspect/infer-tables.js +547 -0
- package/esm/cli/introspect/pluralize.d.ts +30 -0
- package/esm/cli/introspect/pluralize.js +83 -0
- package/esm/cli/introspect/source/endpoint.d.ts +34 -0
- package/esm/cli/introspect/source/endpoint.js +31 -0
- package/esm/cli/introspect/source/file.d.ts +20 -0
- package/esm/cli/introspect/source/file.js +66 -0
- package/esm/cli/introspect/source/index.d.ts +48 -0
- package/esm/cli/introspect/source/index.js +54 -0
- package/esm/cli/introspect/source/types.d.ts +58 -0
- package/esm/cli/introspect/source/types.js +23 -0
- package/esm/cli/introspect/transform.d.ts +5 -6
- package/esm/cli/introspect/transform.js +0 -172
- package/esm/cli/watch/cache.d.ts +3 -4
- package/esm/cli/watch/cache.js +7 -11
- package/esm/cli/watch/poller.d.ts +1 -2
- package/esm/cli/watch/poller.js +28 -46
- package/esm/cli/watch/types.d.ts +0 -3
- package/esm/types/config.d.ts +21 -5
- package/esm/types/config.js +2 -1
- package/package.json +4 -3
- package/types/config.d.ts +21 -5
- package/types/config.js +2 -1
- package/cli/introspect/fetch-meta.d.ts +0 -31
- package/cli/introspect/fetch-meta.js +0 -108
- package/cli/introspect/meta-query.d.ts +0 -111
- package/cli/introspect/meta-query.js +0 -191
- package/esm/cli/introspect/fetch-meta.d.ts +0 -31
- package/esm/cli/introspect/fetch-meta.js +0 -104
- package/esm/cli/introspect/meta-query.d.ts +0 -111
- package/esm/cli/introspect/meta-query.js +0 -188
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The _meta GraphQL query for introspecting PostGraphile schema
|
|
4
|
-
* This query fetches all table metadata including fields, constraints, and relations
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.META_QUERY = void 0;
|
|
8
|
-
exports.META_QUERY = `
|
|
9
|
-
query Meta {
|
|
10
|
-
_meta {
|
|
11
|
-
tables {
|
|
12
|
-
name
|
|
13
|
-
query {
|
|
14
|
-
all
|
|
15
|
-
create
|
|
16
|
-
delete
|
|
17
|
-
one
|
|
18
|
-
update
|
|
19
|
-
}
|
|
20
|
-
fields {
|
|
21
|
-
name
|
|
22
|
-
type {
|
|
23
|
-
gqlType
|
|
24
|
-
isArray
|
|
25
|
-
modifier
|
|
26
|
-
pgAlias
|
|
27
|
-
pgType
|
|
28
|
-
subtype
|
|
29
|
-
typmod
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
inflection {
|
|
33
|
-
allRows
|
|
34
|
-
allRowsSimple
|
|
35
|
-
conditionType
|
|
36
|
-
connection
|
|
37
|
-
createField
|
|
38
|
-
createInputType
|
|
39
|
-
createPayloadType
|
|
40
|
-
deleteByPrimaryKey
|
|
41
|
-
deletePayloadType
|
|
42
|
-
edge
|
|
43
|
-
edgeField
|
|
44
|
-
enumType
|
|
45
|
-
filterType
|
|
46
|
-
inputType
|
|
47
|
-
orderByType
|
|
48
|
-
patchField
|
|
49
|
-
patchType
|
|
50
|
-
tableFieldName
|
|
51
|
-
tableType
|
|
52
|
-
typeName
|
|
53
|
-
updateByPrimaryKey
|
|
54
|
-
updatePayloadType
|
|
55
|
-
}
|
|
56
|
-
primaryKeyConstraints {
|
|
57
|
-
name
|
|
58
|
-
fields {
|
|
59
|
-
name
|
|
60
|
-
type {
|
|
61
|
-
gqlType
|
|
62
|
-
isArray
|
|
63
|
-
modifier
|
|
64
|
-
pgAlias
|
|
65
|
-
pgType
|
|
66
|
-
subtype
|
|
67
|
-
typmod
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
uniqueConstraints {
|
|
72
|
-
name
|
|
73
|
-
fields {
|
|
74
|
-
name
|
|
75
|
-
type {
|
|
76
|
-
gqlType
|
|
77
|
-
isArray
|
|
78
|
-
modifier
|
|
79
|
-
pgAlias
|
|
80
|
-
pgType
|
|
81
|
-
subtype
|
|
82
|
-
typmod
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
foreignKeyConstraints {
|
|
87
|
-
name
|
|
88
|
-
fields {
|
|
89
|
-
name
|
|
90
|
-
type {
|
|
91
|
-
gqlType
|
|
92
|
-
isArray
|
|
93
|
-
modifier
|
|
94
|
-
pgAlias
|
|
95
|
-
pgType
|
|
96
|
-
subtype
|
|
97
|
-
typmod
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
refFields {
|
|
101
|
-
name
|
|
102
|
-
type {
|
|
103
|
-
gqlType
|
|
104
|
-
isArray
|
|
105
|
-
modifier
|
|
106
|
-
pgAlias
|
|
107
|
-
pgType
|
|
108
|
-
subtype
|
|
109
|
-
typmod
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
refTable {
|
|
113
|
-
name
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
relations {
|
|
117
|
-
belongsTo {
|
|
118
|
-
fieldName
|
|
119
|
-
isUnique
|
|
120
|
-
keys {
|
|
121
|
-
name
|
|
122
|
-
type {
|
|
123
|
-
gqlType
|
|
124
|
-
isArray
|
|
125
|
-
modifier
|
|
126
|
-
pgAlias
|
|
127
|
-
pgType
|
|
128
|
-
subtype
|
|
129
|
-
typmod
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
references {
|
|
133
|
-
name
|
|
134
|
-
}
|
|
135
|
-
type
|
|
136
|
-
}
|
|
137
|
-
hasOne {
|
|
138
|
-
fieldName
|
|
139
|
-
isUnique
|
|
140
|
-
keys {
|
|
141
|
-
name
|
|
142
|
-
type {
|
|
143
|
-
gqlType
|
|
144
|
-
isArray
|
|
145
|
-
modifier
|
|
146
|
-
pgAlias
|
|
147
|
-
pgType
|
|
148
|
-
subtype
|
|
149
|
-
typmod
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
referencedBy {
|
|
153
|
-
name
|
|
154
|
-
}
|
|
155
|
-
type
|
|
156
|
-
}
|
|
157
|
-
hasMany {
|
|
158
|
-
fieldName
|
|
159
|
-
isUnique
|
|
160
|
-
keys {
|
|
161
|
-
name
|
|
162
|
-
type {
|
|
163
|
-
gqlType
|
|
164
|
-
isArray
|
|
165
|
-
modifier
|
|
166
|
-
pgAlias
|
|
167
|
-
pgType
|
|
168
|
-
subtype
|
|
169
|
-
typmod
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
referencedBy {
|
|
173
|
-
name
|
|
174
|
-
}
|
|
175
|
-
type
|
|
176
|
-
}
|
|
177
|
-
manyToMany {
|
|
178
|
-
fieldName
|
|
179
|
-
junctionTable {
|
|
180
|
-
name
|
|
181
|
-
}
|
|
182
|
-
rightTable {
|
|
183
|
-
name
|
|
184
|
-
}
|
|
185
|
-
type
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
`;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetch _meta query from a PostGraphile endpoint
|
|
3
|
-
*/
|
|
4
|
-
import { type MetaQueryResponse } from './meta-query';
|
|
5
|
-
export interface FetchMetaOptions {
|
|
6
|
-
/** GraphQL endpoint URL */
|
|
7
|
-
endpoint: string;
|
|
8
|
-
/** Optional authorization header value (e.g., "Bearer token") */
|
|
9
|
-
authorization?: string;
|
|
10
|
-
/** Optional additional headers */
|
|
11
|
-
headers?: Record<string, string>;
|
|
12
|
-
/** Request timeout in milliseconds (default: 30000) */
|
|
13
|
-
timeout?: number;
|
|
14
|
-
}
|
|
15
|
-
export interface FetchMetaResult {
|
|
16
|
-
success: boolean;
|
|
17
|
-
data?: MetaQueryResponse;
|
|
18
|
-
error?: string;
|
|
19
|
-
statusCode?: number;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Fetch the _meta query from a PostGraphile endpoint
|
|
23
|
-
*/
|
|
24
|
-
export declare function fetchMeta(options: FetchMetaOptions): Promise<FetchMetaResult>;
|
|
25
|
-
/**
|
|
26
|
-
* Validate that an endpoint URL is valid
|
|
27
|
-
*/
|
|
28
|
-
export declare function validateEndpoint(endpoint: string): {
|
|
29
|
-
valid: boolean;
|
|
30
|
-
error?: string;
|
|
31
|
-
};
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fetch _meta query from a PostGraphile endpoint
|
|
3
|
-
*/
|
|
4
|
-
import { META_QUERY } from './meta-query';
|
|
5
|
-
/**
|
|
6
|
-
* Fetch the _meta query from a PostGraphile endpoint
|
|
7
|
-
*/
|
|
8
|
-
export async function fetchMeta(options) {
|
|
9
|
-
const { endpoint, authorization, headers = {}, timeout = 30000 } = options;
|
|
10
|
-
// Build headers
|
|
11
|
-
const requestHeaders = {
|
|
12
|
-
'Content-Type': 'application/json',
|
|
13
|
-
Accept: 'application/json',
|
|
14
|
-
...headers,
|
|
15
|
-
};
|
|
16
|
-
if (authorization) {
|
|
17
|
-
requestHeaders['Authorization'] = authorization;
|
|
18
|
-
}
|
|
19
|
-
// Create abort controller for timeout
|
|
20
|
-
const controller = new AbortController();
|
|
21
|
-
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
22
|
-
try {
|
|
23
|
-
const response = await fetch(endpoint, {
|
|
24
|
-
method: 'POST',
|
|
25
|
-
headers: requestHeaders,
|
|
26
|
-
body: JSON.stringify({
|
|
27
|
-
query: META_QUERY,
|
|
28
|
-
variables: {},
|
|
29
|
-
}),
|
|
30
|
-
signal: controller.signal,
|
|
31
|
-
});
|
|
32
|
-
clearTimeout(timeoutId);
|
|
33
|
-
if (!response.ok) {
|
|
34
|
-
return {
|
|
35
|
-
success: false,
|
|
36
|
-
error: `HTTP ${response.status}: ${response.statusText}`,
|
|
37
|
-
statusCode: response.status,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
const json = (await response.json());
|
|
41
|
-
// Check for GraphQL errors
|
|
42
|
-
if (json.errors && json.errors.length > 0) {
|
|
43
|
-
const errorMessages = json.errors.map((e) => e.message).join('; ');
|
|
44
|
-
return {
|
|
45
|
-
success: false,
|
|
46
|
-
error: `GraphQL errors: ${errorMessages}`,
|
|
47
|
-
statusCode: response.status,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
// Check if _meta is present
|
|
51
|
-
if (!json.data?._meta) {
|
|
52
|
-
return {
|
|
53
|
-
success: false,
|
|
54
|
-
error: 'No _meta field in response. Make sure the endpoint has the PostGraphile meta plugin installed.',
|
|
55
|
-
statusCode: response.status,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
success: true,
|
|
60
|
-
data: json.data,
|
|
61
|
-
statusCode: response.status,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
catch (err) {
|
|
65
|
-
clearTimeout(timeoutId);
|
|
66
|
-
if (err instanceof Error) {
|
|
67
|
-
if (err.name === 'AbortError') {
|
|
68
|
-
return {
|
|
69
|
-
success: false,
|
|
70
|
-
error: `Request timeout after ${timeout}ms`,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
return {
|
|
74
|
-
success: false,
|
|
75
|
-
error: err.message,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
return {
|
|
79
|
-
success: false,
|
|
80
|
-
error: 'Unknown error occurred',
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Validate that an endpoint URL is valid
|
|
86
|
-
*/
|
|
87
|
-
export function validateEndpoint(endpoint) {
|
|
88
|
-
try {
|
|
89
|
-
const url = new URL(endpoint);
|
|
90
|
-
if (!['http:', 'https:'].includes(url.protocol)) {
|
|
91
|
-
return {
|
|
92
|
-
valid: false,
|
|
93
|
-
error: 'Endpoint must use http or https protocol',
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
return { valid: true };
|
|
97
|
-
}
|
|
98
|
-
catch {
|
|
99
|
-
return {
|
|
100
|
-
valid: false,
|
|
101
|
-
error: 'Invalid URL format',
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The _meta GraphQL query for introspecting PostGraphile schema
|
|
3
|
-
* This query fetches all table metadata including fields, constraints, and relations
|
|
4
|
-
*/
|
|
5
|
-
export declare const META_QUERY = "\nquery Meta {\n _meta {\n tables {\n name\n query {\n all\n create\n delete\n one\n update\n }\n fields {\n name\n type {\n gqlType\n isArray\n modifier\n pgAlias\n pgType\n subtype\n typmod\n }\n }\n inflection {\n allRows\n allRowsSimple\n conditionType\n connection\n createField\n createInputType\n createPayloadType\n deleteByPrimaryKey\n deletePayloadType\n edge\n edgeField\n enumType\n filterType\n inputType\n orderByType\n patchField\n patchType\n tableFieldName\n tableType\n typeName\n updateByPrimaryKey\n updatePayloadType\n }\n primaryKeyConstraints {\n name\n fields {\n name\n type {\n gqlType\n isArray\n modifier\n pgAlias\n pgType\n subtype\n typmod\n }\n }\n }\n uniqueConstraints {\n name\n fields {\n name\n type {\n gqlType\n isArray\n modifier\n pgAlias\n pgType\n subtype\n typmod\n }\n }\n }\n foreignKeyConstraints {\n name\n fields {\n name\n type {\n gqlType\n isArray\n modifier\n pgAlias\n pgType\n subtype\n typmod\n }\n }\n refFields {\n name\n type {\n gqlType\n isArray\n modifier\n pgAlias\n pgType\n subtype\n typmod\n }\n }\n refTable {\n name\n }\n }\n relations {\n belongsTo {\n fieldName\n isUnique\n keys {\n name\n type {\n gqlType\n isArray\n modifier\n pgAlias\n pgType\n subtype\n typmod\n }\n }\n references {\n name\n }\n type\n }\n hasOne {\n fieldName\n isUnique\n keys {\n name\n type {\n gqlType\n isArray\n modifier\n pgAlias\n pgType\n subtype\n typmod\n }\n }\n referencedBy {\n name\n }\n type\n }\n hasMany {\n fieldName\n isUnique\n keys {\n name\n type {\n gqlType\n isArray\n modifier\n pgAlias\n pgType\n subtype\n typmod\n }\n }\n referencedBy {\n name\n }\n type\n }\n manyToMany {\n fieldName\n junctionTable {\n name\n }\n rightTable {\n name\n }\n type\n }\n }\n }\n }\n}\n";
|
|
6
|
-
/**
|
|
7
|
-
* Types for the _meta query response
|
|
8
|
-
*/
|
|
9
|
-
export interface MetaFieldType {
|
|
10
|
-
gqlType: string;
|
|
11
|
-
isArray: boolean;
|
|
12
|
-
modifier: string | number | null;
|
|
13
|
-
pgAlias: string | null;
|
|
14
|
-
pgType: string | null;
|
|
15
|
-
subtype: string | null;
|
|
16
|
-
typmod: number | null;
|
|
17
|
-
}
|
|
18
|
-
export interface MetaField {
|
|
19
|
-
name: string;
|
|
20
|
-
type: MetaFieldType;
|
|
21
|
-
}
|
|
22
|
-
export interface MetaConstraint {
|
|
23
|
-
name: string;
|
|
24
|
-
fields: MetaField[];
|
|
25
|
-
}
|
|
26
|
-
export interface MetaForeignKeyConstraint extends MetaConstraint {
|
|
27
|
-
refFields: MetaField[];
|
|
28
|
-
refTable: {
|
|
29
|
-
name: string;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
export interface MetaTableQuery {
|
|
33
|
-
all: string;
|
|
34
|
-
create: string;
|
|
35
|
-
delete: string | null;
|
|
36
|
-
one: string;
|
|
37
|
-
update: string | null;
|
|
38
|
-
}
|
|
39
|
-
export interface MetaTableInflection {
|
|
40
|
-
allRows: string;
|
|
41
|
-
allRowsSimple: string;
|
|
42
|
-
conditionType: string;
|
|
43
|
-
connection: string;
|
|
44
|
-
createField: string;
|
|
45
|
-
createInputType: string;
|
|
46
|
-
createPayloadType: string;
|
|
47
|
-
deleteByPrimaryKey: string | null;
|
|
48
|
-
deletePayloadType: string;
|
|
49
|
-
edge: string;
|
|
50
|
-
edgeField: string;
|
|
51
|
-
enumType: string;
|
|
52
|
-
filterType: string | null;
|
|
53
|
-
inputType: string;
|
|
54
|
-
orderByType: string;
|
|
55
|
-
patchField: string;
|
|
56
|
-
patchType: string | null;
|
|
57
|
-
tableFieldName: string;
|
|
58
|
-
tableType: string;
|
|
59
|
-
typeName: string;
|
|
60
|
-
updateByPrimaryKey: string | null;
|
|
61
|
-
updatePayloadType: string | null;
|
|
62
|
-
}
|
|
63
|
-
export interface MetaBelongsToRelation {
|
|
64
|
-
fieldName: string | null;
|
|
65
|
-
isUnique: boolean;
|
|
66
|
-
keys: MetaField[];
|
|
67
|
-
references: {
|
|
68
|
-
name: string;
|
|
69
|
-
};
|
|
70
|
-
type: string | null;
|
|
71
|
-
}
|
|
72
|
-
export interface MetaHasRelation {
|
|
73
|
-
fieldName: string | null;
|
|
74
|
-
isUnique: boolean;
|
|
75
|
-
keys: MetaField[];
|
|
76
|
-
referencedBy: {
|
|
77
|
-
name: string;
|
|
78
|
-
};
|
|
79
|
-
type: string | null;
|
|
80
|
-
}
|
|
81
|
-
export interface MetaManyToManyRelation {
|
|
82
|
-
fieldName: string | null;
|
|
83
|
-
junctionTable: {
|
|
84
|
-
name: string;
|
|
85
|
-
};
|
|
86
|
-
rightTable: {
|
|
87
|
-
name: string;
|
|
88
|
-
};
|
|
89
|
-
type: string | null;
|
|
90
|
-
}
|
|
91
|
-
export interface MetaTableRelations {
|
|
92
|
-
belongsTo: MetaBelongsToRelation[];
|
|
93
|
-
hasOne: MetaHasRelation[];
|
|
94
|
-
hasMany: MetaHasRelation[];
|
|
95
|
-
manyToMany: MetaManyToManyRelation[];
|
|
96
|
-
}
|
|
97
|
-
export interface MetaTable {
|
|
98
|
-
name: string;
|
|
99
|
-
query: MetaTableQuery;
|
|
100
|
-
fields: MetaField[];
|
|
101
|
-
inflection: MetaTableInflection;
|
|
102
|
-
primaryKeyConstraints: MetaConstraint[];
|
|
103
|
-
uniqueConstraints: MetaConstraint[];
|
|
104
|
-
foreignKeyConstraints: MetaForeignKeyConstraint[];
|
|
105
|
-
relations: MetaTableRelations;
|
|
106
|
-
}
|
|
107
|
-
export interface MetaQueryResponse {
|
|
108
|
-
_meta: {
|
|
109
|
-
tables: MetaTable[];
|
|
110
|
-
};
|
|
111
|
-
}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The _meta GraphQL query for introspecting PostGraphile schema
|
|
3
|
-
* This query fetches all table metadata including fields, constraints, and relations
|
|
4
|
-
*/
|
|
5
|
-
export const META_QUERY = `
|
|
6
|
-
query Meta {
|
|
7
|
-
_meta {
|
|
8
|
-
tables {
|
|
9
|
-
name
|
|
10
|
-
query {
|
|
11
|
-
all
|
|
12
|
-
create
|
|
13
|
-
delete
|
|
14
|
-
one
|
|
15
|
-
update
|
|
16
|
-
}
|
|
17
|
-
fields {
|
|
18
|
-
name
|
|
19
|
-
type {
|
|
20
|
-
gqlType
|
|
21
|
-
isArray
|
|
22
|
-
modifier
|
|
23
|
-
pgAlias
|
|
24
|
-
pgType
|
|
25
|
-
subtype
|
|
26
|
-
typmod
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
inflection {
|
|
30
|
-
allRows
|
|
31
|
-
allRowsSimple
|
|
32
|
-
conditionType
|
|
33
|
-
connection
|
|
34
|
-
createField
|
|
35
|
-
createInputType
|
|
36
|
-
createPayloadType
|
|
37
|
-
deleteByPrimaryKey
|
|
38
|
-
deletePayloadType
|
|
39
|
-
edge
|
|
40
|
-
edgeField
|
|
41
|
-
enumType
|
|
42
|
-
filterType
|
|
43
|
-
inputType
|
|
44
|
-
orderByType
|
|
45
|
-
patchField
|
|
46
|
-
patchType
|
|
47
|
-
tableFieldName
|
|
48
|
-
tableType
|
|
49
|
-
typeName
|
|
50
|
-
updateByPrimaryKey
|
|
51
|
-
updatePayloadType
|
|
52
|
-
}
|
|
53
|
-
primaryKeyConstraints {
|
|
54
|
-
name
|
|
55
|
-
fields {
|
|
56
|
-
name
|
|
57
|
-
type {
|
|
58
|
-
gqlType
|
|
59
|
-
isArray
|
|
60
|
-
modifier
|
|
61
|
-
pgAlias
|
|
62
|
-
pgType
|
|
63
|
-
subtype
|
|
64
|
-
typmod
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
uniqueConstraints {
|
|
69
|
-
name
|
|
70
|
-
fields {
|
|
71
|
-
name
|
|
72
|
-
type {
|
|
73
|
-
gqlType
|
|
74
|
-
isArray
|
|
75
|
-
modifier
|
|
76
|
-
pgAlias
|
|
77
|
-
pgType
|
|
78
|
-
subtype
|
|
79
|
-
typmod
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
foreignKeyConstraints {
|
|
84
|
-
name
|
|
85
|
-
fields {
|
|
86
|
-
name
|
|
87
|
-
type {
|
|
88
|
-
gqlType
|
|
89
|
-
isArray
|
|
90
|
-
modifier
|
|
91
|
-
pgAlias
|
|
92
|
-
pgType
|
|
93
|
-
subtype
|
|
94
|
-
typmod
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
refFields {
|
|
98
|
-
name
|
|
99
|
-
type {
|
|
100
|
-
gqlType
|
|
101
|
-
isArray
|
|
102
|
-
modifier
|
|
103
|
-
pgAlias
|
|
104
|
-
pgType
|
|
105
|
-
subtype
|
|
106
|
-
typmod
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
refTable {
|
|
110
|
-
name
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
relations {
|
|
114
|
-
belongsTo {
|
|
115
|
-
fieldName
|
|
116
|
-
isUnique
|
|
117
|
-
keys {
|
|
118
|
-
name
|
|
119
|
-
type {
|
|
120
|
-
gqlType
|
|
121
|
-
isArray
|
|
122
|
-
modifier
|
|
123
|
-
pgAlias
|
|
124
|
-
pgType
|
|
125
|
-
subtype
|
|
126
|
-
typmod
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
references {
|
|
130
|
-
name
|
|
131
|
-
}
|
|
132
|
-
type
|
|
133
|
-
}
|
|
134
|
-
hasOne {
|
|
135
|
-
fieldName
|
|
136
|
-
isUnique
|
|
137
|
-
keys {
|
|
138
|
-
name
|
|
139
|
-
type {
|
|
140
|
-
gqlType
|
|
141
|
-
isArray
|
|
142
|
-
modifier
|
|
143
|
-
pgAlias
|
|
144
|
-
pgType
|
|
145
|
-
subtype
|
|
146
|
-
typmod
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
referencedBy {
|
|
150
|
-
name
|
|
151
|
-
}
|
|
152
|
-
type
|
|
153
|
-
}
|
|
154
|
-
hasMany {
|
|
155
|
-
fieldName
|
|
156
|
-
isUnique
|
|
157
|
-
keys {
|
|
158
|
-
name
|
|
159
|
-
type {
|
|
160
|
-
gqlType
|
|
161
|
-
isArray
|
|
162
|
-
modifier
|
|
163
|
-
pgAlias
|
|
164
|
-
pgType
|
|
165
|
-
subtype
|
|
166
|
-
typmod
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
referencedBy {
|
|
170
|
-
name
|
|
171
|
-
}
|
|
172
|
-
type
|
|
173
|
-
}
|
|
174
|
-
manyToMany {
|
|
175
|
-
fieldName
|
|
176
|
-
junctionTable {
|
|
177
|
-
name
|
|
178
|
-
}
|
|
179
|
-
rightTable {
|
|
180
|
-
name
|
|
181
|
-
}
|
|
182
|
-
type
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
`;
|