@platformatic/sql-graphql 0.34.1 → 0.35.1
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/lib/entity-to-type.js +4 -1
- package/package.json +3 -3
- package/test/array.test.js +156 -0
package/lib/entity-to-type.js
CHANGED
|
@@ -121,7 +121,10 @@ function constructGraph (app, entity, opts, ignore) {
|
|
|
121
121
|
} else {
|
|
122
122
|
graphqlFields = {
|
|
123
123
|
any: { type: fields[field].type.ofType },
|
|
124
|
-
all: { type: fields[field].type.ofType }
|
|
124
|
+
all: { type: fields[field].type.ofType },
|
|
125
|
+
contains: { type: new graphql.GraphQLList(fields[field].type) },
|
|
126
|
+
contained: { type: new graphql.GraphQLList(fields[field].type) },
|
|
127
|
+
overlaps: { type: new graphql.GraphQLList(fields[field].type) }
|
|
125
128
|
}
|
|
126
129
|
}
|
|
127
130
|
acc[field] = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/sql-graphql",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.1",
|
|
4
4
|
"description": "Map SQL dbs to GraphQL",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"tap": "^16.3.6",
|
|
23
23
|
"tsd": "^0.28.1",
|
|
24
24
|
"ws": "^8.13.0",
|
|
25
|
-
"@platformatic/sql-events": "0.
|
|
26
|
-
"@platformatic/sql-mapper": "0.
|
|
25
|
+
"@platformatic/sql-events": "0.35.1",
|
|
26
|
+
"@platformatic/sql-mapper": "0.35.1"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@mercuriusjs/federation": "^2.0.0",
|
package/test/array.test.js
CHANGED
|
@@ -110,6 +110,90 @@ test('array support', { skip: !isPg }, async ({ pass, teardown, same, equal }) =
|
|
|
110
110
|
}, 'pages response')
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
{
|
|
114
|
+
const res = await app.inject({
|
|
115
|
+
method: 'POST',
|
|
116
|
+
url: '/graphql',
|
|
117
|
+
body: {
|
|
118
|
+
query: `
|
|
119
|
+
query {
|
|
120
|
+
pages(where: { tags: { contains: ["foo"] } }) {
|
|
121
|
+
id
|
|
122
|
+
title
|
|
123
|
+
tags
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
`
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
equal(res.statusCode, 200, 'pages status code')
|
|
130
|
+
same(res.json(), {
|
|
131
|
+
data: {
|
|
132
|
+
pages: [{
|
|
133
|
+
id: 1,
|
|
134
|
+
title: 'Hello',
|
|
135
|
+
tags: ['foo', 'bar']
|
|
136
|
+
}]
|
|
137
|
+
}
|
|
138
|
+
}, 'pages response')
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
{
|
|
142
|
+
const res = await app.inject({
|
|
143
|
+
method: 'POST',
|
|
144
|
+
url: '/graphql',
|
|
145
|
+
body: {
|
|
146
|
+
query: `
|
|
147
|
+
query {
|
|
148
|
+
pages(where: { tags: { contained: ["foo", "bar"] } }) {
|
|
149
|
+
id
|
|
150
|
+
title
|
|
151
|
+
tags
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
`
|
|
155
|
+
}
|
|
156
|
+
})
|
|
157
|
+
equal(res.statusCode, 200, 'pages status code')
|
|
158
|
+
same(res.json(), {
|
|
159
|
+
data: {
|
|
160
|
+
pages: [{
|
|
161
|
+
id: 1,
|
|
162
|
+
title: 'Hello',
|
|
163
|
+
tags: ['foo', 'bar']
|
|
164
|
+
}]
|
|
165
|
+
}
|
|
166
|
+
}, 'pages response')
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
{
|
|
170
|
+
const res = await app.inject({
|
|
171
|
+
method: 'POST',
|
|
172
|
+
url: '/graphql',
|
|
173
|
+
body: {
|
|
174
|
+
query: `
|
|
175
|
+
query {
|
|
176
|
+
pages(where: { tags: { overlaps: ["foo"] } }) {
|
|
177
|
+
id
|
|
178
|
+
title
|
|
179
|
+
tags
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
`
|
|
183
|
+
}
|
|
184
|
+
})
|
|
185
|
+
equal(res.statusCode, 200, 'pages status code')
|
|
186
|
+
same(res.json(), {
|
|
187
|
+
data: {
|
|
188
|
+
pages: [{
|
|
189
|
+
id: 1,
|
|
190
|
+
title: 'Hello',
|
|
191
|
+
tags: ['foo', 'bar']
|
|
192
|
+
}]
|
|
193
|
+
}
|
|
194
|
+
}, 'pages response')
|
|
195
|
+
}
|
|
196
|
+
|
|
113
197
|
{
|
|
114
198
|
const res = await app.inject({
|
|
115
199
|
method: 'POST',
|
|
@@ -134,6 +218,78 @@ test('array support', { skip: !isPg }, async ({ pass, teardown, same, equal }) =
|
|
|
134
218
|
}, 'pages response')
|
|
135
219
|
}
|
|
136
220
|
|
|
221
|
+
{
|
|
222
|
+
const res = await app.inject({
|
|
223
|
+
method: 'POST',
|
|
224
|
+
url: '/graphql',
|
|
225
|
+
body: {
|
|
226
|
+
query: `
|
|
227
|
+
query {
|
|
228
|
+
pages(where: { tags: { contains: ["baz"] } }) {
|
|
229
|
+
id
|
|
230
|
+
title,
|
|
231
|
+
tags
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
`
|
|
235
|
+
}
|
|
236
|
+
})
|
|
237
|
+
equal(res.statusCode, 200, 'pages status code')
|
|
238
|
+
same(res.json(), {
|
|
239
|
+
data: {
|
|
240
|
+
pages: []
|
|
241
|
+
}
|
|
242
|
+
}, 'pages response')
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
{
|
|
246
|
+
const res = await app.inject({
|
|
247
|
+
method: 'POST',
|
|
248
|
+
url: '/graphql',
|
|
249
|
+
body: {
|
|
250
|
+
query: `
|
|
251
|
+
query {
|
|
252
|
+
pages(where: { tags: { contained: ["foo"] } }) {
|
|
253
|
+
id
|
|
254
|
+
title,
|
|
255
|
+
tags
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
`
|
|
259
|
+
}
|
|
260
|
+
})
|
|
261
|
+
equal(res.statusCode, 200, 'pages status code')
|
|
262
|
+
same(res.json(), {
|
|
263
|
+
data: {
|
|
264
|
+
pages: []
|
|
265
|
+
}
|
|
266
|
+
}, 'pages response')
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
{
|
|
270
|
+
const res = await app.inject({
|
|
271
|
+
method: 'POST',
|
|
272
|
+
url: '/graphql',
|
|
273
|
+
body: {
|
|
274
|
+
query: `
|
|
275
|
+
query {
|
|
276
|
+
pages(where: { tags: { overlaps: ["baz"] } }) {
|
|
277
|
+
id
|
|
278
|
+
title,
|
|
279
|
+
tags
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
`
|
|
283
|
+
}
|
|
284
|
+
})
|
|
285
|
+
equal(res.statusCode, 200, 'pages status code')
|
|
286
|
+
same(res.json(), {
|
|
287
|
+
data: {
|
|
288
|
+
pages: []
|
|
289
|
+
}
|
|
290
|
+
}, 'pages response')
|
|
291
|
+
}
|
|
292
|
+
|
|
137
293
|
{
|
|
138
294
|
const res = await app.inject({
|
|
139
295
|
method: 'POST',
|