-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(client-ts): combine graphql schemas in client package
dev tooling often prefers a single combined schema, which is now included as an option. Closes #273
- Loading branch information
Showing
10 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const { loadFilesSync } = require('@graphql-tools/load-files'); | ||
const { mergeTypeDefs } = require('@graphql-tools/merge'); | ||
const { printSchemaWithDirectives } = require('@graphql-tools/utils'); | ||
const { makeExecutableSchema } = require('@graphql-tools/schema'); | ||
|
||
const cardanoDbHasuraSchema = loadFilesSync(path.resolve(__dirname, '..', 'api', 'cardano-db-hasura', 'schema.graphql')); | ||
const genesisSchema = loadFilesSync(path.resolve(__dirname, '..', 'api', 'genesis', 'schema.graphql')); | ||
const mergedTypes = mergeTypeDefs([cardanoDbHasuraSchema, genesisSchema], { | ||
throwOnConflict: true | ||
}); | ||
|
||
const executableSchema = makeExecutableSchema({ typeDefs: [mergedTypes] }); | ||
const schema = printSchemaWithDirectives(executableSchema); | ||
|
||
fs.writeFileSync(path.resolve(__dirname, '..','api', 'schema.graphql'), schema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,13 @@ | |
resolved "https://registry.yarnpkg.com/@ardatan/aggregate-error/-/aggregate-error-0.0.1.tgz#1403ac5de10d8ca689fc1f65844c27179ae1d44f" | ||
integrity sha512-UQ9BequOTIavs0pTHLMwQwKQF8tTV1oezY/H2O9chA+JNPFZSua55xpU5dPSjAU9/jLJ1VwU+HJuTVN8u7S6Fg== | ||
|
||
"@ardatan/[email protected]": | ||
version "0.0.6" | ||
resolved "https://registry.yarnpkg.com/@ardatan/aggregate-error/-/aggregate-error-0.0.6.tgz#fe6924771ea40fc98dc7a7045c2e872dc8527609" | ||
integrity sha512-vyrkEHG1jrukmzTPtyWB4NLPauUw5bQeg4uhn8f+1SSynmrOcyvlb1GKQjjgoBzElLdfXCRYX8UnBlhklOHYRQ== | ||
dependencies: | ||
tslib "~2.0.1" | ||
|
||
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4": | ||
version "7.10.4" | ||
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" | ||
|
@@ -766,6 +773,16 @@ | |
fs-extra "9.0.1" | ||
tslib "~2.0.0" | ||
|
||
"@graphql-tools/load-files@^6.2.3": | ||
version "6.2.3" | ||
resolved "https://registry.yarnpkg.com/@graphql-tools/load-files/-/load-files-6.2.3.tgz#f2b851911622e9f305fbb268a84876bf03062e01" | ||
integrity sha512-VXl/dixmNCuxxa/1trjh2ogx967lwfZetWY3gN3ck2qWjd4ERmYFnsXd2xcXRRTK4SOZilEaFFXU2tmtYy23xg== | ||
dependencies: | ||
fs-extra "9.0.1" | ||
globby "11.0.1" | ||
tslib "~2.0.1" | ||
unixify "1.0.0" | ||
|
||
"@graphql-tools/load@^6.0.0": | ||
version "6.0.12" | ||
resolved "https://registry.yarnpkg.com/@graphql-tools/load/-/load-6.0.12.tgz#3f40a5aae35d880e55fc52f797c861d868a47fdc" | ||
|
@@ -790,6 +807,15 @@ | |
"@graphql-tools/utils" "6.0.12" | ||
tslib "~2.0.0" | ||
|
||
"@graphql-tools/merge@^6.2.3": | ||
version "6.2.3" | ||
resolved "https://registry.yarnpkg.com/@graphql-tools/merge/-/merge-6.2.3.tgz#df6d84d9182bd289985da4cc3a45515a7c2135df" | ||
integrity sha512-qSSxdM2AKjnAHuChcnxIfzsGej78B56EE6ZD3tXMtKJOMQMhk4T4yXnKRHEw8fw7ZtNk/KqCmb6LJHy8Ws8frg== | ||
dependencies: | ||
"@graphql-tools/schema" "6.2.3" | ||
"@graphql-tools/utils" "6.2.3" | ||
tslib "~2.0.1" | ||
|
||
"@graphql-tools/prisma-loader@^6.0.0": | ||
version "6.0.12" | ||
resolved "https://registry.yarnpkg.com/@graphql-tools/prisma-loader/-/prisma-loader-6.0.12.tgz#30b639236138a1db2c33a9a39a53abcc0be64e91" | ||
|
@@ -817,6 +843,14 @@ | |
"@graphql-tools/utils" "6.0.12" | ||
tslib "~2.0.0" | ||
|
||
"@graphql-tools/[email protected]", "@graphql-tools/schema@^6.2.3": | ||
version "6.2.3" | ||
resolved "https://registry.yarnpkg.com/@graphql-tools/schema/-/schema-6.2.3.tgz#7ffc8e5f49d9a81f446fb8db87a6f5d07b1fba8e" | ||
integrity sha512-CV5vDfQhXidssLK5hjT55FfwRAvBoGW53lVBl0rbXrbsSX7H9iVHdUf4UaDIlMc6WcnnzOrRiue/khHz3rzDEg== | ||
dependencies: | ||
"@graphql-tools/utils" "6.2.3" | ||
tslib "~2.0.1" | ||
|
||
"@graphql-tools/[email protected]", "@graphql-tools/url-loader@^6.0.0": | ||
version "6.0.12" | ||
resolved "https://registry.yarnpkg.com/@graphql-tools/url-loader/-/url-loader-6.0.12.tgz#ea6e2e542ed0944efa8d3276c57e1979df095ecb" | ||
|
@@ -840,6 +874,15 @@ | |
"@ardatan/aggregate-error" "0.0.1" | ||
camel-case "4.1.1" | ||
|
||
"@graphql-tools/[email protected]", "@graphql-tools/utils@^6.2.3": | ||
version "6.2.3" | ||
resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-6.2.3.tgz#235636b47a62f12f3dddbdd30b2986fc03f3a5fa" | ||
integrity sha512-eOhZy4y23r6AddokBqvFpQybtHvhTyZCc3VFWn8eIqF92vre90UKHbCX6Cf6VBo6i7l0ZwChPPbUzEiHOk+HJQ== | ||
dependencies: | ||
"@ardatan/aggregate-error" "0.0.6" | ||
camel-case "4.1.1" | ||
tslib "~2.0.1" | ||
|
||
"@graphql-tools/[email protected]", "@graphql-tools/wrap@^6.0.9": | ||
version "6.0.12" | ||
resolved "https://registry.yarnpkg.com/@graphql-tools/wrap/-/wrap-6.0.12.tgz#fb0b9b74de30ca69877c9f806f681c98eabe49f4" | ||
|
@@ -8102,6 +8145,11 @@ tslib@^2.0.0, tslib@~2.0.0: | |
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.0.tgz#18d13fc2dce04051e20f074cc8387fd8089ce4f3" | ||
integrity sha512-lTqkx847PI7xEDYJntxZH89L2/aXInsyF2luSafe/+0fHOMjlBNXdH6th7f70qxLDhul7KZK0zC8V5ZIyHl0/g== | ||
|
||
tslib@~2.0.1: | ||
version "2.0.1" | ||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.1.tgz#410eb0d113e5b6356490eec749603725b021b43e" | ||
integrity sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ== | ||
|
||
tsutils@^3.17.1: | ||
version "3.17.1" | ||
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" | ||
|