Add graqhql introspection schema
This commit is contained in:
parent
41cd8d25fb
commit
8d879ba981
|
|
@ -289,3 +289,4 @@ git-crypt-encrypted-files-check.txt
|
||||||
/server/vbv_lernwelt/static/vue/
|
/server/vbv_lernwelt/static/vue/
|
||||||
/server/vbv_lernwelt/templates/vue/index.html
|
/server/vbv_lernwelt/templates/vue/index.html
|
||||||
/server/vbv_lernwelt/media
|
/server/vbv_lernwelt/media
|
||||||
|
/client/src/gql/minifiedSchema.json
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
import type { CodegenConfig } from "@graphql-codegen/cli";
|
import type { CodegenConfig } from "@graphql-codegen/cli";
|
||||||
|
|
||||||
const config: CodegenConfig = {
|
const config: CodegenConfig = {
|
||||||
schema: "../server/schema.graphql",
|
schema: "./src/gql/schema.graphql",
|
||||||
documents: ["src/**/*.vue", "src/graphql/**/*.ts"],
|
documents: ["src/**/*.vue", "src/graphql/**/*.ts"],
|
||||||
ignoreNoDocuments: true,
|
ignoreNoDocuments: true,
|
||||||
|
hooks: {
|
||||||
|
afterAllFileWrite: ["node minimizeGraphqlSchema.mjs"],
|
||||||
|
},
|
||||||
generates: {
|
generates: {
|
||||||
"./src/gql/": {
|
"./src/gql/": {
|
||||||
preset: "client",
|
preset: "client",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { getIntrospectedSchema, minifyIntrospectionQuery } from "@urql/introspection";
|
||||||
|
import { readFileSync, writeFileSync } from "fs";
|
||||||
|
|
||||||
|
// Read the existing introspection schema
|
||||||
|
const schema = readFileSync("./src/gql/schema.graphql", "utf-8");
|
||||||
|
// const schema = JSON.parse(schemaJson);
|
||||||
|
|
||||||
|
const minifiedSchema = minifyIntrospectionQuery(getIntrospectedSchema(schema));
|
||||||
|
|
||||||
|
// Write the minified schema to a new file
|
||||||
|
writeFileSync("./src/gql/minifiedSchema.json", JSON.stringify(minifiedSchema));
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
"@sentry/vue": "^7.20.0",
|
"@sentry/vue": "^7.20.0",
|
||||||
"@urql/devtools": "^2.0.3",
|
"@urql/devtools": "^2.0.3",
|
||||||
"@urql/exchange-graphcache": "^6.0.4",
|
"@urql/exchange-graphcache": "^6.0.4",
|
||||||
|
"@urql/introspection": "^1.0.2",
|
||||||
"@urql/vue": "^1.1.1",
|
"@urql/vue": "^1.1.1",
|
||||||
"@vueuse/core": "^9.13.0",
|
"@vueuse/core": "^9.13.0",
|
||||||
"@vueuse/router": "^10.1.2",
|
"@vueuse/router": "^10.1.2",
|
||||||
|
|
@ -7041,6 +7042,14 @@
|
||||||
"wonka": "^6.3.2"
|
"wonka": "^6.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@urql/introspection": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@urql/introspection/-/introspection-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-vPuX+DjbmL5EUsvwgAMV8dkxc7JKuuNTzDfsNvtCuVmbAED4Nx39p08HImjTWAewSatjyzZZs+fAhU7z/4P+UQ==",
|
||||||
|
"peerDependencies": {
|
||||||
|
"graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@urql/vue": {
|
"node_modules/@urql/vue": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@urql/vue/-/vue-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/@urql/vue/-/vue-1.1.1.tgz",
|
||||||
|
|
@ -24994,6 +25003,11 @@
|
||||||
"wonka": "^6.3.2"
|
"wonka": "^6.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@urql/introspection": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@urql/introspection/-/introspection-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-vPuX+DjbmL5EUsvwgAMV8dkxc7JKuuNTzDfsNvtCuVmbAED4Nx39p08HImjTWAewSatjyzZZs+fAhU7z/4P+UQ=="
|
||||||
|
},
|
||||||
"@urql/vue": {
|
"@urql/vue": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@urql/vue/-/vue-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/@urql/vue/-/vue-1.1.1.tgz",
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
"name": "client",
|
"name": "client",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vue-tsc --noEmit && vite build && node versionize && cp ./dist/index.html ../server/vbv_lernwelt/templates/vue/index.html && rm -rf ../server/vbv_lernwelt/static/vue/* && cp -r ./dist/static/vue ../server/vbv_lernwelt/static/ && npm run build-storybook",
|
"build": "npm run codegen && vue-tsc --noEmit && vite build && node versionize && cp ./dist/index.html ../server/vbv_lernwelt/templates/vue/index.html && rm -rf ../server/vbv_lernwelt/static/vue/* && cp -r ./dist/static/vue ../server/vbv_lernwelt/static/ && npm run build-storybook",
|
||||||
"build-storybook": "rm -rf ../server/vbv_lernwelt/static/storybook/* && storybook build -o ../server/vbv_lernwelt/static/storybook",
|
"build-storybook": "rm -rf ../server/vbv_lernwelt/static/storybook/* && storybook build -o ../server/vbv_lernwelt/static/storybook",
|
||||||
"build:tailwind": "tailwindcss -i tailwind.css -o ../server/vbv_lernwelt/static/css/tailwind.css --minify",
|
"build:tailwind": "tailwindcss -i tailwind.css -o ../server/vbv_lernwelt/static/css/tailwind.css --minify",
|
||||||
"codegen": "graphql-codegen",
|
"codegen": "graphql-codegen && node minimizeGraphqlSchema.mjs",
|
||||||
"codegen:watch": "graphql-codegen --watch",
|
"codegen:watch": "graphql-codegen --watch",
|
||||||
"coverage": "vitest run --coverage",
|
"coverage": "vitest run --coverage",
|
||||||
"cypress:open": "cypress open",
|
"cypress:open": "cypress open",
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
"storybook": "storybook dev -p 6006",
|
"storybook": "storybook dev -p 6006",
|
||||||
"tailwind": "tailwindcss -i tailwind.css -o ../server/vbv_lernwelt/static/css/tailwind.css --watch",
|
"tailwind": "tailwindcss -i tailwind.css -o ../server/vbv_lernwelt/static/css/tailwind.css --watch",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"typecheck": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
|
"typecheck": "npm run codegen && vue-tsc --noEmit -p tsconfig.app.json --composite false",
|
||||||
"vue-i18n-extract": "vue-i18n-extract report"
|
"vue-i18n-extract": "vue-i18n-extract report"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
"@sentry/vue": "^7.20.0",
|
"@sentry/vue": "^7.20.0",
|
||||||
"@urql/devtools": "^2.0.3",
|
"@urql/devtools": "^2.0.3",
|
||||||
"@urql/exchange-graphcache": "^6.0.4",
|
"@urql/exchange-graphcache": "^6.0.4",
|
||||||
|
"@urql/introspection": "^1.0.2",
|
||||||
"@urql/vue": "^1.1.1",
|
"@urql/vue": "^1.1.1",
|
||||||
"@vueuse/core": "^9.13.0",
|
"@vueuse/core": "^9.13.0",
|
||||||
"@vueuse/router": "^10.1.2",
|
"@vueuse/router": "^10.1.2",
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
import schema from "../gql/minifiedSchema.json";
|
||||||
|
|
||||||
import { devtoolsExchange } from "@urql/devtools";
|
import { devtoolsExchange } from "@urql/devtools";
|
||||||
import { cacheExchange } from "@urql/exchange-graphcache";
|
import { cacheExchange } from "@urql/exchange-graphcache";
|
||||||
import { Client, fetchExchange } from "@urql/vue";
|
import { Client, fetchExchange } from "@urql/vue";
|
||||||
|
|
@ -7,6 +11,7 @@ export const graphqlClient = new Client({
|
||||||
exchanges: [
|
exchanges: [
|
||||||
devtoolsExchange,
|
devtoolsExchange,
|
||||||
cacheExchange({
|
cacheExchange({
|
||||||
|
schema: schema,
|
||||||
updates: {
|
updates: {
|
||||||
Mutation: {
|
Mutation: {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
"name": "VBV Schema",
|
|
||||||
"schemaPath": "schema.graphql",
|
|
||||||
"extensions": {
|
|
||||||
"endpoints": {
|
|
||||||
"Default GraphQL Endpoint": {
|
|
||||||
"url": "http://localhost:8000/server/graphql/",
|
|
||||||
"headers": {
|
|
||||||
"user-agent": "JS GraphQL"
|
|
||||||
},
|
|
||||||
"introspect": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -568,7 +568,7 @@ OAUTH = {
|
||||||
|
|
||||||
GRAPHENE = {
|
GRAPHENE = {
|
||||||
"SCHEMA": "vbv_lernwelt.core.schema.schema",
|
"SCHEMA": "vbv_lernwelt.core.schema.schema",
|
||||||
"SCHEMA_OUTPUT": "schema.graphql",
|
"SCHEMA_OUTPUT": "../client/src/gql/schema.graphql",
|
||||||
}
|
}
|
||||||
# GRAPPLE = {
|
# GRAPPLE = {
|
||||||
# "EXPOSE_GRAPHIQL": DEBUG,
|
# "EXPOSE_GRAPHIQL": DEBUG,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
schema: client/src/gql/schema.graphql
|
||||||
|
extensions:
|
||||||
|
endpoints:
|
||||||
|
Default GraphQL Endpoint:
|
||||||
|
url: http://localhost:8000/server/graphql/
|
||||||
|
headers:
|
||||||
|
user-agent: JS GraphQL
|
||||||
|
introspect: true
|
||||||
Loading…
Reference in New Issue