From 7581b9ae4ba3bb17d3068c52e3652900fbb04fdb Mon Sep 17 00:00:00 2001 From: Batuhan Wilhelm Date: Thu, 10 Oct 2024 17:09:58 +0300 Subject: [PATCH] feat(graphql): make options.ts and options.spec.ts files swizzleable?? --- packages/graphql/refine.config.js | 43 ++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/packages/graphql/refine.config.js b/packages/graphql/refine.config.js index 75d92f345d91..04da3801184b 100644 --- a/packages/graphql/refine.config.js +++ b/packages/graphql/refine.config.js @@ -3,10 +3,43 @@ module.exports = { group: "Data Provider", swizzle: { items: [ + { + group: "Providers", + label: "GraphQL Default Options", + requiredPackages: [ + "@urql/core@5.0.6", + "camelcase@6.2.0", + "pluralize@8.0.0", + ], + files: [ + { + src: "./src/dataProvider/options.ts", + dest: "./providers/graphql/dataProvider/options.ts", + }, + { + src: "./test/utils/options.spec.ts", + dest: "./providers/graphql/dataProvider/options.spec.ts", + }, + ], + message: ` + **\`Usage\`** + + \`\`\` + You can modify the swizzled options.ts file and pass it to the GraphQL data provider as a 2nd argument. + + import createDataProvider from "@refinedev/graphql"; + + const myOptions = { /* your options */ }; + + const dataProvider = createDataProvider(client, myOptions); + \`\`\` + `, + }, { group: "Providers", label: "GraphQL", requiredPackages: [ + "@urql/core@5.0.6", "graphql-ws@5.9.1", "camelcase@6.2.0", "graphql@15.6.1", @@ -51,7 +84,7 @@ module.exports = { \`\`\` // title: App.tsx - import dataProvider, { liveProvider } from "providers/graphql"; + import createDataProvider, { createLiveProvider } from "providers/graphql"; import { Client, fetchExchange } from "@urql/core"; import { createClient } from "graphql-ws"; @@ -60,13 +93,17 @@ module.exports = { const client = new Client({ url: API_URL, exchanges: [fetchExchange] }); + const dataProvider = createDataProvider(client) + const wsClient = createClient({ url: WS_URL }) + const liveProvider = createLiveProvider(wsClient) + const App = () => { return ( );