mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
c0d2bc6653
add remote joins: Create relationships across database and remote schemas (#2392) Co-authored-by: Aleksandra Sikora <ola.zxcvbnm@gmail.com> Co-authored-by: Chris Done <chrisdone@gmail.com> Co-authored-by: Chris Done <github@chrisdone.com> Co-authored-by: wawhal <rishichandra.wawhal@gmail.com> Co-authored-by: Aravind Shankar <aravind@hasura.io> Co-authored-by: Brandon Simmons <brandon.m.simmons@gmail.com> Co-authored-by: Rishichandra Wawhal <rishi@hasura.io> Co-authored-by: Brandon Simmons <brandon@hasura.io> Co-authored-by: nizar-m <19857260+nizar-m@users.noreply.github.com> Co-authored-by: Praveen Durairaju <praveend.web@gmail.com> Co-authored-by: rakeshkky <12475069+rakeshkky@users.noreply.github.com> Co-authored-by: Anon Ray <rayanon004@gmail.com> Co-authored-by: Shahidh K Muhammed <shahidh@hasura.io> Co-authored-by: soorajshankar <soorajshankar@users.noreply.github.com> Co-authored-by: Sooraj Sanker <sooraj@Soorajs-MacBook-Pro.local> Co-authored-by: Karthikeyan Chinnakonda <karthikeyan@hasura.io> Co-authored-by: Aleksandra Sikora <ola.zxcvbnm@gmail.com>
47 lines
1.4 KiB
JavaScript
Executable File
47 lines
1.4 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
// Some copypasta that does an exhaustive introspection query on some graphql
|
|
// server and outputs a pretty-printed schema.
|
|
//
|
|
// Install dependencies:
|
|
//
|
|
// $ npm install -g axios graphql
|
|
//
|
|
// Usage, e.g.:
|
|
//
|
|
// $ NODE_PATH=$(npm root --quiet -g) utils/dump-remote-schema.js http://localhost:8088/v1/graphql
|
|
//
|
|
// TODO whatever if there's a more appropriate way to install dependencies such
|
|
// that this script can be called from anywhere, and without littering
|
|
// everything with node_modules directories.
|
|
|
|
const { introspectionQuery, buildClientSchema, printSchema } = require('graphql');
|
|
const axios = require('axios');
|
|
|
|
|
|
if (process.argv.length != 3){
|
|
console.log("Supply the graphql server URL as the only argument on the command line");
|
|
process.exit(1);
|
|
}
|
|
|
|
|
|
axios({
|
|
url: process.argv[2],
|
|
method: 'post',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
data: {operationName: "IntrospectionQuery", query: introspectionQuery},
|
|
}).then(({data}) => {
|
|
console.log(data);
|
|
if (data.errors) {
|
|
console.log(data.errors);
|
|
console.log("\n ^^^^^^^^^^^^^^^ OOPS GOT SOME ERRORS FROM THE SERVER ^^^^^^^^^^^^^^^\n\n");
|
|
// proceed anyway I guess
|
|
}
|
|
const schema = buildClientSchema(data.data);
|
|
console.log(printSchema(schema));
|
|
|
|
}).catch(error => {
|
|
console.log(error);
|
|
console.log("\n ^^^^^^^^^^^^^^^ OOPS GOT SOME ERRORS ^^^^^^^^^^^^^^^\n\n");
|
|
});
|