@contember/engine-content-api 2.0.0-alpha.15 → 2.0.0-alpha.16
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/development/index.cjs +2 -1
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +2 -1
- package/dist/development/index.js.map +1 -1
- package/dist/development/src/introspection/IntrospectionSchemaDefinitionFactory.cjs +6 -163
- package/dist/development/src/introspection/IntrospectionSchemaDefinitionFactory.cjs.map +1 -1
- package/dist/development/src/introspection/IntrospectionSchemaDefinitionFactory.js +5 -162
- package/dist/development/src/introspection/IntrospectionSchemaDefinitionFactory.js.map +1 -1
- package/dist/development/src/introspection/introspection.schema.cjs +163 -0
- package/dist/development/src/introspection/introspection.schema.cjs.map +1 -0
- package/dist/development/src/introspection/introspection.schema.js +163 -0
- package/dist/development/src/introspection/introspection.schema.js.map +1 -0
- package/dist/production/index.cjs +2 -1
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +2 -1
- package/dist/production/index.js.map +1 -1
- package/dist/production/src/introspection/IntrospectionSchemaDefinitionFactory.cjs +6 -163
- package/dist/production/src/introspection/IntrospectionSchemaDefinitionFactory.cjs.map +1 -1
- package/dist/production/src/introspection/IntrospectionSchemaDefinitionFactory.js +5 -162
- package/dist/production/src/introspection/IntrospectionSchemaDefinitionFactory.js.map +1 -1
- package/dist/production/src/introspection/introspection.schema.cjs +163 -0
- package/dist/production/src/introspection/introspection.schema.cjs.map +1 -0
- package/dist/production/src/introspection/introspection.schema.js +163 -0
- package/dist/production/src/introspection/introspection.schema.js.map +1 -0
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/dist/types/introspection/IntrospectionSchemaDefinitionFactory.d.ts +1 -3
- package/dist/types/introspection/IntrospectionSchemaDefinitionFactory.d.ts.map +1 -1
- package/dist/types/introspection/index.d.ts +2 -1
- package/dist/types/introspection/index.d.ts.map +1 -1
- package/dist/types/introspection/introspection.schema.d.ts +5 -0
- package/dist/types/introspection/introspection.schema.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/graphql.codegen.yml +2 -2
- package/package.json +13 -17
- package/src/introspection/IntrospectionSchemaDefinitionFactory.ts +2 -194
- package/src/introspection/index.ts +2 -1
- package/src/introspection/introspection.schema.ts +194 -0
package/graphql.codegen.yml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
schema:
|
|
2
|
-
- "./src/introspection/
|
|
2
|
+
- "./src/introspection/introspection.schema.ts"
|
|
3
3
|
documents: []
|
|
4
4
|
config:
|
|
5
5
|
immutableTypes: "1"
|
|
@@ -12,4 +12,4 @@ generates:
|
|
|
12
12
|
- "typescript-operations"
|
|
13
13
|
hooks:
|
|
14
14
|
afterAllFileWrite:
|
|
15
|
-
- eslint --fix
|
|
15
|
+
- yarn run -T eslint --fix
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/engine-content-api",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.16",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/production/index.js",
|
|
6
6
|
"typings": "./dist/types/index.d.ts",
|
|
@@ -26,25 +26,21 @@
|
|
|
26
26
|
"generate": "gql-gen --config graphql.codegen.yml"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@contember/database": "2.0.0-alpha.
|
|
30
|
-
"@contember/dic": "2.0.0-alpha.
|
|
31
|
-
"@contember/graphql-utils": "2.0.0-alpha.
|
|
32
|
-
"@contember/logger": "2.0.0-alpha.
|
|
33
|
-
"@contember/schema": "2.0.0-alpha.
|
|
34
|
-
"@contember/schema-definition": "2.0.0-alpha.
|
|
35
|
-
"@contember/schema-utils": "2.0.0-alpha.
|
|
29
|
+
"@contember/database": "2.0.0-alpha.16",
|
|
30
|
+
"@contember/dic": "2.0.0-alpha.16",
|
|
31
|
+
"@contember/graphql-utils": "2.0.0-alpha.16",
|
|
32
|
+
"@contember/logger": "2.0.0-alpha.16",
|
|
33
|
+
"@contember/schema": "2.0.0-alpha.16",
|
|
34
|
+
"@contember/schema-definition": "2.0.0-alpha.16",
|
|
35
|
+
"@contember/schema-utils": "2.0.0-alpha.16",
|
|
36
36
|
"fast-deep-equal": "^3.1.3"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@contember/database-tester": "2.0.0-alpha.
|
|
40
|
-
"@contember/schema-definition": "2.0.0-alpha.
|
|
41
|
-
"@
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"@graphql-codegen/typescript-resolvers": "^4.0.1",
|
|
45
|
-
"@types/node": "^20.9.0",
|
|
46
|
-
"graphql": "^16.8.1",
|
|
47
|
-
"pg": "^8.11.3"
|
|
39
|
+
"@contember/database-tester": "2.0.0-alpha.16",
|
|
40
|
+
"@contember/schema-definition": "2.0.0-alpha.16",
|
|
41
|
+
"@types/node": "^20.16.5",
|
|
42
|
+
"graphql": "^16.9.0",
|
|
43
|
+
"pg": "^8.12.0"
|
|
48
44
|
},
|
|
49
45
|
"peerDependencies": {
|
|
50
46
|
"graphql": ">= 14.6.0",
|
|
@@ -1,199 +1,7 @@
|
|
|
1
|
+
import { GraphQLSchema, GraphQLSchemaConfig } from 'graphql'
|
|
1
2
|
import * as ContentSchema from './content-schema.types'
|
|
2
3
|
import { IntrospectionSchemaFactory } from './IntrospectionSchemaFactory'
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
GraphQLBoolean,
|
|
7
|
-
GraphQLEnumType,
|
|
8
|
-
GraphQLFieldResolver,
|
|
9
|
-
GraphQLInt,
|
|
10
|
-
GraphQLInterfaceType,
|
|
11
|
-
GraphQLList,
|
|
12
|
-
GraphQLNonNull,
|
|
13
|
-
GraphQLObjectType,
|
|
14
|
-
GraphQLSchema,
|
|
15
|
-
GraphQLSchemaConfig,
|
|
16
|
-
GraphQLString,
|
|
17
|
-
GraphQLUnionType,
|
|
18
|
-
} from 'graphql'
|
|
19
|
-
|
|
20
|
-
const _RuleMessage = new GraphQLObjectType({
|
|
21
|
-
name: '_RuleMessage',
|
|
22
|
-
fields: {
|
|
23
|
-
text: { type: GraphQLString },
|
|
24
|
-
},
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
const _ValidatorArgument = new GraphQLObjectType({
|
|
28
|
-
name: '_ValidatorArgument',
|
|
29
|
-
fields: {
|
|
30
|
-
validator: { type: new GraphQLNonNull(GraphQLInt) },
|
|
31
|
-
},
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
const _PathArgument = new GraphQLObjectType({
|
|
35
|
-
name: '_PathArgument',
|
|
36
|
-
fields: {
|
|
37
|
-
path: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(GraphQLString))) },
|
|
38
|
-
},
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
const _LiteralArgument = new GraphQLObjectType({
|
|
42
|
-
name: '_LiteralArgument',
|
|
43
|
-
fields: {
|
|
44
|
-
value: { type: JSONType },
|
|
45
|
-
},
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
const _Argument = new GraphQLUnionType({
|
|
49
|
-
name: '_Argument',
|
|
50
|
-
types: [_ValidatorArgument, _PathArgument, _LiteralArgument],
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
const _Validator = new GraphQLObjectType({
|
|
54
|
-
name: '_Validator',
|
|
55
|
-
fields: {
|
|
56
|
-
operation: { type: new GraphQLNonNull(GraphQLString) },
|
|
57
|
-
arguments: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_Argument))) },
|
|
58
|
-
},
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
const _Rule = new GraphQLObjectType({
|
|
62
|
-
name: '_Rule',
|
|
63
|
-
fields: {
|
|
64
|
-
message: { type: _RuleMessage },
|
|
65
|
-
validator: { type: new GraphQLNonNull(GraphQLInt) },
|
|
66
|
-
},
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
const _FieldInterface = new GraphQLInterfaceType({
|
|
70
|
-
name: '_Field',
|
|
71
|
-
fields: {
|
|
72
|
-
name: { type: new GraphQLNonNull(GraphQLString) },
|
|
73
|
-
type: { type: new GraphQLNonNull(GraphQLString) },
|
|
74
|
-
nullable: { type: GraphQLBoolean },
|
|
75
|
-
rules: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_Rule))) },
|
|
76
|
-
validators: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_Validator))) },
|
|
77
|
-
},
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
const _OrderByDirection = new GraphQLEnumType({
|
|
81
|
-
name: '_OrderByDirection',
|
|
82
|
-
values: {
|
|
83
|
-
asc: {},
|
|
84
|
-
desc: {},
|
|
85
|
-
},
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
const _OrderBy = new GraphQLObjectType({
|
|
89
|
-
name: '_OrderBy',
|
|
90
|
-
fields: {
|
|
91
|
-
path: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(GraphQLString))) },
|
|
92
|
-
direction: { type: new GraphQLNonNull(_OrderByDirection) },
|
|
93
|
-
},
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
const _OnDeleteBehaviour = new GraphQLEnumType({
|
|
97
|
-
name: '_OnDeleteBehaviour',
|
|
98
|
-
values: {
|
|
99
|
-
restrict: {},
|
|
100
|
-
cascade: {},
|
|
101
|
-
setNull: {},
|
|
102
|
-
},
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
const _RelationSide = new GraphQLEnumType({
|
|
106
|
-
name: '_RelationSide',
|
|
107
|
-
values: {
|
|
108
|
-
owning: {},
|
|
109
|
-
inverse: {},
|
|
110
|
-
},
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
const _Relation = new GraphQLObjectType({
|
|
114
|
-
name: '_Relation',
|
|
115
|
-
interfaces: [_FieldInterface],
|
|
116
|
-
fields: {
|
|
117
|
-
name: { type: new GraphQLNonNull(GraphQLString) },
|
|
118
|
-
type: { type: new GraphQLNonNull(GraphQLString) },
|
|
119
|
-
side: { type: new GraphQLNonNull(_RelationSide) },
|
|
120
|
-
targetEntity: { type: new GraphQLNonNull(GraphQLString) },
|
|
121
|
-
ownedBy: { type: GraphQLString },
|
|
122
|
-
inversedBy: { type: GraphQLString },
|
|
123
|
-
nullable: { type: GraphQLBoolean },
|
|
124
|
-
onDelete: { type: _OnDeleteBehaviour },
|
|
125
|
-
orphanRemoval: { type: GraphQLBoolean },
|
|
126
|
-
orderBy: { type: new GraphQLList(new GraphQLNonNull(_OrderBy)) },
|
|
127
|
-
rules: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_Rule))) },
|
|
128
|
-
validators: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_Validator))) },
|
|
129
|
-
},
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
const _Column = new GraphQLObjectType({
|
|
133
|
-
name: '_Column',
|
|
134
|
-
interfaces: [_FieldInterface],
|
|
135
|
-
fields: {
|
|
136
|
-
name: { type: new GraphQLNonNull(GraphQLString) },
|
|
137
|
-
type: { type: new GraphQLNonNull(GraphQLString) },
|
|
138
|
-
enumName: { type: GraphQLString },
|
|
139
|
-
defaultValue: { type: JSONType },
|
|
140
|
-
nullable: { type: new GraphQLNonNull(GraphQLBoolean) },
|
|
141
|
-
rules: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_Rule))) },
|
|
142
|
-
validators: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_Validator))) },
|
|
143
|
-
},
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
const _UniqueConstraint = new GraphQLObjectType({
|
|
147
|
-
name: '_UniqueConstraint',
|
|
148
|
-
fields: {
|
|
149
|
-
fields: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(GraphQLString))) },
|
|
150
|
-
},
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
const _Entity = new GraphQLObjectType({
|
|
154
|
-
name: '_Entity',
|
|
155
|
-
fields: {
|
|
156
|
-
name: { type: new GraphQLNonNull(GraphQLString) },
|
|
157
|
-
customPrimaryAllowed: { type: new GraphQLNonNull(GraphQLBoolean) },
|
|
158
|
-
fields: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_FieldInterface))) },
|
|
159
|
-
unique: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_UniqueConstraint))) },
|
|
160
|
-
},
|
|
161
|
-
})
|
|
162
|
-
|
|
163
|
-
const _Enum = new GraphQLObjectType({
|
|
164
|
-
name: '_Enum',
|
|
165
|
-
fields: {
|
|
166
|
-
name: { type: new GraphQLNonNull(GraphQLString) },
|
|
167
|
-
values: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(GraphQLString))) },
|
|
168
|
-
},
|
|
169
|
-
})
|
|
170
|
-
|
|
171
|
-
const _Schema = new GraphQLObjectType({
|
|
172
|
-
name: '_Schema',
|
|
173
|
-
fields: {
|
|
174
|
-
enums: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_Enum))) },
|
|
175
|
-
entities: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_Entity))) },
|
|
176
|
-
},
|
|
177
|
-
})
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
const createSchemaConfig = (resolver?: GraphQLFieldResolver<any, any>): GraphQLSchemaConfig => {
|
|
181
|
-
return {
|
|
182
|
-
query: new GraphQLObjectType({
|
|
183
|
-
name: 'Query',
|
|
184
|
-
fields: {
|
|
185
|
-
schema: {
|
|
186
|
-
type: _Schema,
|
|
187
|
-
resolve: resolver,
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
}),
|
|
191
|
-
types: [_Column, _Relation],
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
export default new GraphQLSchema(createSchemaConfig())
|
|
4
|
+
import { createSchemaConfig } from './introspection.schema'
|
|
197
5
|
|
|
198
6
|
export class IntrospectionSchemaDefinitionFactory {
|
|
199
7
|
constructor(private readonly introspectionSchemaFactory: IntrospectionSchemaFactory) {}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export * as ContentSchemaTypes from './content-schema.types'
|
|
2
|
-
export { IntrospectionSchemaDefinitionFactory
|
|
2
|
+
export { IntrospectionSchemaDefinitionFactory } from './IntrospectionSchemaDefinitionFactory'
|
|
3
|
+
export { default as ContentSchema } from './introspection.schema'
|
|
3
4
|
export * from './IntrospectionSchemaFactory'
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { JSONType } from '@contember/graphql-utils'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
GraphQLBoolean,
|
|
5
|
+
GraphQLEnumType,
|
|
6
|
+
GraphQLFieldResolver,
|
|
7
|
+
GraphQLInt,
|
|
8
|
+
GraphQLInterfaceType,
|
|
9
|
+
GraphQLList,
|
|
10
|
+
GraphQLNonNull,
|
|
11
|
+
GraphQLObjectType,
|
|
12
|
+
GraphQLSchema,
|
|
13
|
+
GraphQLSchemaConfig,
|
|
14
|
+
GraphQLString,
|
|
15
|
+
GraphQLUnionType,
|
|
16
|
+
} from 'graphql'
|
|
17
|
+
|
|
18
|
+
const _RuleMessage = new GraphQLObjectType({
|
|
19
|
+
name: '_RuleMessage',
|
|
20
|
+
fields: {
|
|
21
|
+
text: { type: GraphQLString },
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const _ValidatorArgument = new GraphQLObjectType({
|
|
26
|
+
name: '_ValidatorArgument',
|
|
27
|
+
fields: {
|
|
28
|
+
validator: { type: new GraphQLNonNull(GraphQLInt) },
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const _PathArgument = new GraphQLObjectType({
|
|
33
|
+
name: '_PathArgument',
|
|
34
|
+
fields: {
|
|
35
|
+
path: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(GraphQLString))) },
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const _LiteralArgument = new GraphQLObjectType({
|
|
40
|
+
name: '_LiteralArgument',
|
|
41
|
+
fields: {
|
|
42
|
+
value: { type: JSONType },
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const _Argument = new GraphQLUnionType({
|
|
47
|
+
name: '_Argument',
|
|
48
|
+
types: [_ValidatorArgument, _PathArgument, _LiteralArgument],
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const _Validator = new GraphQLObjectType({
|
|
52
|
+
name: '_Validator',
|
|
53
|
+
fields: {
|
|
54
|
+
operation: { type: new GraphQLNonNull(GraphQLString) },
|
|
55
|
+
arguments: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_Argument))) },
|
|
56
|
+
},
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const _Rule = new GraphQLObjectType({
|
|
60
|
+
name: '_Rule',
|
|
61
|
+
fields: {
|
|
62
|
+
message: { type: _RuleMessage },
|
|
63
|
+
validator: { type: new GraphQLNonNull(GraphQLInt) },
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
const _FieldInterface = new GraphQLInterfaceType({
|
|
68
|
+
name: '_Field',
|
|
69
|
+
fields: {
|
|
70
|
+
name: { type: new GraphQLNonNull(GraphQLString) },
|
|
71
|
+
type: { type: new GraphQLNonNull(GraphQLString) },
|
|
72
|
+
nullable: { type: GraphQLBoolean },
|
|
73
|
+
rules: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_Rule))) },
|
|
74
|
+
validators: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_Validator))) },
|
|
75
|
+
},
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const _OrderByDirection = new GraphQLEnumType({
|
|
79
|
+
name: '_OrderByDirection',
|
|
80
|
+
values: {
|
|
81
|
+
asc: {},
|
|
82
|
+
desc: {},
|
|
83
|
+
},
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
const _OrderBy = new GraphQLObjectType({
|
|
87
|
+
name: '_OrderBy',
|
|
88
|
+
fields: {
|
|
89
|
+
path: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(GraphQLString))) },
|
|
90
|
+
direction: { type: new GraphQLNonNull(_OrderByDirection) },
|
|
91
|
+
},
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
const _OnDeleteBehaviour = new GraphQLEnumType({
|
|
95
|
+
name: '_OnDeleteBehaviour',
|
|
96
|
+
values: {
|
|
97
|
+
restrict: {},
|
|
98
|
+
cascade: {},
|
|
99
|
+
setNull: {},
|
|
100
|
+
},
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
const _RelationSide = new GraphQLEnumType({
|
|
104
|
+
name: '_RelationSide',
|
|
105
|
+
values: {
|
|
106
|
+
owning: {},
|
|
107
|
+
inverse: {},
|
|
108
|
+
},
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
const _Relation = new GraphQLObjectType({
|
|
112
|
+
name: '_Relation',
|
|
113
|
+
interfaces: [_FieldInterface],
|
|
114
|
+
fields: {
|
|
115
|
+
name: { type: new GraphQLNonNull(GraphQLString) },
|
|
116
|
+
type: { type: new GraphQLNonNull(GraphQLString) },
|
|
117
|
+
side: { type: new GraphQLNonNull(_RelationSide) },
|
|
118
|
+
targetEntity: { type: new GraphQLNonNull(GraphQLString) },
|
|
119
|
+
ownedBy: { type: GraphQLString },
|
|
120
|
+
inversedBy: { type: GraphQLString },
|
|
121
|
+
nullable: { type: GraphQLBoolean },
|
|
122
|
+
onDelete: { type: _OnDeleteBehaviour },
|
|
123
|
+
orphanRemoval: { type: GraphQLBoolean },
|
|
124
|
+
orderBy: { type: new GraphQLList(new GraphQLNonNull(_OrderBy)) },
|
|
125
|
+
rules: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_Rule))) },
|
|
126
|
+
validators: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_Validator))) },
|
|
127
|
+
},
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
const _Column = new GraphQLObjectType({
|
|
131
|
+
name: '_Column',
|
|
132
|
+
interfaces: [_FieldInterface],
|
|
133
|
+
fields: {
|
|
134
|
+
name: { type: new GraphQLNonNull(GraphQLString) },
|
|
135
|
+
type: { type: new GraphQLNonNull(GraphQLString) },
|
|
136
|
+
enumName: { type: GraphQLString },
|
|
137
|
+
defaultValue: { type: JSONType },
|
|
138
|
+
nullable: { type: new GraphQLNonNull(GraphQLBoolean) },
|
|
139
|
+
rules: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_Rule))) },
|
|
140
|
+
validators: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_Validator))) },
|
|
141
|
+
},
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
const _UniqueConstraint = new GraphQLObjectType({
|
|
145
|
+
name: '_UniqueConstraint',
|
|
146
|
+
fields: {
|
|
147
|
+
fields: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(GraphQLString))) },
|
|
148
|
+
},
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
const _Entity = new GraphQLObjectType({
|
|
152
|
+
name: '_Entity',
|
|
153
|
+
fields: {
|
|
154
|
+
name: { type: new GraphQLNonNull(GraphQLString) },
|
|
155
|
+
customPrimaryAllowed: { type: new GraphQLNonNull(GraphQLBoolean) },
|
|
156
|
+
fields: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_FieldInterface))) },
|
|
157
|
+
unique: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_UniqueConstraint))) },
|
|
158
|
+
},
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
const _Enum = new GraphQLObjectType({
|
|
162
|
+
name: '_Enum',
|
|
163
|
+
fields: {
|
|
164
|
+
name: { type: new GraphQLNonNull(GraphQLString) },
|
|
165
|
+
values: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(GraphQLString))) },
|
|
166
|
+
},
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
const _Schema = new GraphQLObjectType({
|
|
170
|
+
name: '_Schema',
|
|
171
|
+
fields: {
|
|
172
|
+
enums: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_Enum))) },
|
|
173
|
+
entities: { type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(_Entity))) },
|
|
174
|
+
},
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
export const createSchemaConfig = (resolver?: GraphQLFieldResolver<any, any>): GraphQLSchemaConfig => {
|
|
179
|
+
return {
|
|
180
|
+
query: new GraphQLObjectType({
|
|
181
|
+
name: 'Query',
|
|
182
|
+
fields: {
|
|
183
|
+
schema: {
|
|
184
|
+
type: _Schema,
|
|
185
|
+
resolve: resolver,
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
}),
|
|
189
|
+
types: [_Column, _Relation],
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
export default new GraphQLSchema(createSchemaConfig())
|