@platformatic/sql-graphql 0.13.1 → 0.14.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/index.js +7 -1
- package/package.json +6 -4
- package/test/datatypes.test.js +1 -1
- package/test/federation.test.js +5 -5
package/index.js
CHANGED
|
@@ -4,6 +4,7 @@ const fp = require('fastify-plugin')
|
|
|
4
4
|
const constructGraph = require('./lib/entity-to-type')
|
|
5
5
|
const mercurius = require('mercurius')
|
|
6
6
|
const graphql = require('graphql')
|
|
7
|
+
const { mercuriusFederationPlugin } = require('@mercuriusjs/federation')
|
|
7
8
|
const establishRelations = require('./lib/relationship')
|
|
8
9
|
const setupSubscriptions = require('./lib/subscriptions')
|
|
9
10
|
const scalars = require('graphql-scalars')
|
|
@@ -156,7 +157,12 @@ async function mapperToGraphql (app, opts) {
|
|
|
156
157
|
|
|
157
158
|
opts.graphiql = opts.graphiql !== false
|
|
158
159
|
|
|
159
|
-
|
|
160
|
+
let plugin = mercurius
|
|
161
|
+
if (opts.federationMetadata) {
|
|
162
|
+
plugin = mercuriusFederationPlugin
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
await app.register(plugin, {
|
|
160
166
|
...opts,
|
|
161
167
|
schema: sdl,
|
|
162
168
|
loaders,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/sql-graphql",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Map SQL dbs to GraphQL",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -14,23 +14,25 @@
|
|
|
14
14
|
},
|
|
15
15
|
"homepage": "https://github.com/platformatic/platformatic#readme",
|
|
16
16
|
"devDependencies": {
|
|
17
|
+
"@mercuriusjs/gateway": "^1.0.0",
|
|
17
18
|
"fastify": "^4.10.2",
|
|
18
19
|
"snazzy": "^9.0.0",
|
|
19
20
|
"standard": "^17.0.0",
|
|
20
21
|
"tap": "^16.3.2",
|
|
21
22
|
"tsd": "^0.25.0",
|
|
22
23
|
"ws": "^8.11.0",
|
|
23
|
-
"@platformatic/sql-events": "0.
|
|
24
|
-
"@platformatic/sql-mapper": "0.
|
|
24
|
+
"@platformatic/sql-events": "0.14.0",
|
|
25
|
+
"@platformatic/sql-mapper": "0.14.0"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
28
|
+
"@mercuriusjs/federation": "^1.0.0",
|
|
27
29
|
"camelcase": "^6.3.0",
|
|
28
30
|
"fastify-plugin": "^4.4.0",
|
|
29
31
|
"graphql": "^16.6.0",
|
|
30
32
|
"graphql-scalars": "^1.20.1",
|
|
31
33
|
"graphql-type-json": "^0.3.2",
|
|
32
34
|
"inflected": "^2.1.0",
|
|
33
|
-
"mercurius": "^
|
|
35
|
+
"mercurius": "^12.0.0"
|
|
34
36
|
},
|
|
35
37
|
"tsd": {
|
|
36
38
|
"directory": "test/types"
|
package/test/datatypes.test.js
CHANGED
|
@@ -723,7 +723,7 @@ test('[SQLite] - UUID', { skip: !isSQLite }, async ({ pass, teardown, same, equa
|
|
|
723
723
|
}
|
|
724
724
|
})
|
|
725
725
|
|
|
726
|
-
test('BIGINT!', { skip: isSQLite
|
|
726
|
+
test('BIGINT!', { skip: isSQLite }, async ({ pass, teardown, same, equal }) => {
|
|
727
727
|
const app = fastify()
|
|
728
728
|
app.register(sqlMapper, {
|
|
729
729
|
...connInfo,
|
package/test/federation.test.js
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
const { test } = require('tap')
|
|
4
4
|
const Fastify = require('fastify')
|
|
5
|
-
const
|
|
5
|
+
const Gateway = require('@mercuriusjs/gateway')
|
|
6
|
+
const { mercuriusFederationPlugin } = require('@mercuriusjs/federation')
|
|
6
7
|
const sqlGraphQL = require('..')
|
|
7
8
|
const sqlMapper = require('@platformatic/sql-mapper')
|
|
8
9
|
const { clear, connInfo, isSQLite } = require('./helper')
|
|
9
10
|
|
|
10
11
|
async function createTestService (t, schema, resolvers = {}) {
|
|
11
12
|
const service = Fastify({ logger: { level: 'error' } })
|
|
12
|
-
service.register(
|
|
13
|
+
service.register(mercuriusFederationPlugin, {
|
|
13
14
|
schema,
|
|
14
|
-
resolvers
|
|
15
|
-
federationMetadata: true
|
|
15
|
+
resolvers
|
|
16
16
|
})
|
|
17
17
|
await service.listen({ port: 0 })
|
|
18
18
|
return [service, service.server.address().port]
|
|
@@ -155,7 +155,7 @@ async function createTestGatewayServer (t, cacheOpts) {
|
|
|
155
155
|
await categoryService.close()
|
|
156
156
|
await postService.close()
|
|
157
157
|
})
|
|
158
|
-
gateway.register(
|
|
158
|
+
gateway.register(Gateway, {
|
|
159
159
|
gateway: {
|
|
160
160
|
services: [{
|
|
161
161
|
name: 'category',
|