From b6ed13eade521dc5e5bb9d69b530ae6a2086467c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Wed, 17 Dec 2025 19:24:39 +0100 Subject: [PATCH] Setup 2 relay configs for 2 graphQL APIs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Émile Ré --- apps/console/package.json | 2 +- .../{relay.config.json => relay.core.json} | 5 +--- apps/console/relay.iam.json | 8 ++++++ apps/console/src/environments.ts | 4 +-- apps/console/vite.config.ts | 28 ++++++++++++++----- 5 files changed, 33 insertions(+), 14 deletions(-) rename apps/console/{relay.config.json => relay.core.json} (69%) create mode 100644 apps/console/relay.iam.json diff --git a/apps/console/package.json b/apps/console/package.json index 6f8c77c89..b626839a5 100644 --- a/apps/console/package.json +++ b/apps/console/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "vite", - "relay": "find src -type d -name \"__generated__\" -exec rm -rf {} + && npx relay-compiler ./relay.config.json", + "relay": "find src -type d -name \"__generated__\" -exec rm -rf {} + && npx relay-compiler ./relay.core.json && npx relay-compiler ./relay.iam.json", "build": "tsc -b && vite build", "lint": "eslint .", "check": "tsc --noEmit -p tsconfig.app.json", diff --git a/apps/console/relay.config.json b/apps/console/relay.core.json similarity index 69% rename from apps/console/relay.config.json rename to apps/console/relay.core.json index 56677b108..cb236f35d 100644 --- a/apps/console/relay.config.json +++ b/apps/console/relay.core.json @@ -4,8 +4,5 @@ "language": "typescript", "eagerEsModules": true, "noFutureProofEnums": true, - "excludes": [ - "**/PublicTrustCenterGraph.ts", - "**/trust/**" - ] + "excludes": ["**/pages/iam/**/*", "**/node_modules/**"] } diff --git a/apps/console/relay.iam.json b/apps/console/relay.iam.json new file mode 100644 index 000000000..5483c0c4f --- /dev/null +++ b/apps/console/relay.iam.json @@ -0,0 +1,8 @@ +{ + "src": "./src/pages/iam", + "schema": "../../pkg/server/api/connect/v1/schema.graphql", + "language": "typescript", + "eagerEsModules": true, + "noFutureProofEnums": true, + "excludes": ["**/node_modules/**"] +} diff --git a/apps/console/src/environments.ts b/apps/console/src/environments.ts index 2e1ac42c4..d67d353a1 100644 --- a/apps/console/src/environments.ts +++ b/apps/console/src/environments.ts @@ -8,11 +8,11 @@ const store = new Store(source, { }); export const consoleEnvironment = new Environment({ - network: Network.create(makeFetchQuery("/api/console/v1/query")), + network: Network.create(makeFetchQuery("/api/console/v1/graphql")), store, }); export const connectEnvironment = new Environment({ - network: Network.create(makeFetchQuery("/api/connect/v1/query")), + network: Network.create(makeFetchQuery("/api/connect/v1/graphql")), store, }); diff --git a/apps/console/vite.config.ts b/apps/console/vite.config.ts index cc6514dda..ebdb5ecce 100644 --- a/apps/console/vite.config.ts +++ b/apps/console/vite.config.ts @@ -5,7 +5,21 @@ import { fileURLToPath, URL } from "node:url"; // https://vite.dev/config/ export default defineConfig({ - plugins: [react({ babel: { plugins: ["relay"] } }), tailwindcss()], + plugins: [ + react({ + babel: { + plugins: [ + [ + "relay", + { + eagerEsModules: true, + }, + ], + ], + }, + }), + tailwindcss(), + ], server: { proxy: { "/connect": { @@ -24,21 +38,21 @@ export default defineConfig({ }, resolve: { alias: { - "/environments": fileURLToPath(new URL("./src/environments", import.meta.url)), + "/environments": fileURLToPath( + new URL("./src/environments", import.meta.url) + ), "/type": fileURLToPath(new URL("./src/type.ts", import.meta.url)), "/components": fileURLToPath( - new URL("./src/components", import.meta.url), - ), - "/coredata": fileURLToPath( - new URL("./src/coredata", import.meta.url), + new URL("./src/components", import.meta.url) ), + "/coredata": fileURLToPath(new URL("./src/coredata", import.meta.url)), "/hooks": fileURLToPath(new URL("./src/hooks", import.meta.url)), "/layouts": fileURLToPath(new URL("./src/layouts", import.meta.url)), "/pages": fileURLToPath(new URL("./src/pages", import.meta.url)), "/routes": fileURLToPath(new URL("./src/routes", import.meta.url)), "/providers": fileURLToPath(new URL("./src/providers", import.meta.url)), "/permissions": fileURLToPath( - new URL("./src/permissions", import.meta.url), + new URL("./src/permissions", import.meta.url) ), }, },