From bd07137f29b9ea1478d9480ea6e8a747e2aa88cd Mon Sep 17 00:00:00 2001 From: Yeldar <57894795+issa012@users.noreply.github.com> Date: Fri, 24 May 2024 13:46:08 +0500 Subject: [PATCH 1/4] feat(nestjs-query): implement getApiUrl --- packages/nestjs-query/src/dataProvider/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nestjs-query/src/dataProvider/index.ts b/packages/nestjs-query/src/dataProvider/index.ts index 51fbfda0ee7a..02ef100e6a25 100644 --- a/packages/nestjs-query/src/dataProvider/index.ts +++ b/packages/nestjs-query/src/dataProvider/index.ts @@ -416,7 +416,7 @@ const dataProvider = (client: GraphQLClient): Required => { }; }, getApiUrl: () => { - throw Error("Not implemented on refine-nestjs-query data provider."); + return (client as any).url; // url field in GraphQLClient is private }, custom: async ({ url, method, headers, meta }) => { if (url) { From 43de99b2c0878ba9eef0d5c02315dc43b7132526 Mon Sep 17 00:00:00 2001 From: Yeldar <57894795+issa012@users.noreply.github.com> Date: Fri, 24 May 2024 17:34:07 +0500 Subject: [PATCH 2/4] chore: add changeset --- .changeset/thick-doors-draw.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/thick-doors-draw.md diff --git a/.changeset/thick-doors-draw.md b/.changeset/thick-doors-draw.md new file mode 100644 index 000000000000..4b5114cf0c99 --- /dev/null +++ b/.changeset/thick-doors-draw.md @@ -0,0 +1,7 @@ +--- +"@refinedev/nestjs-query": minor +--- + +feat(nestjs-query): implemented getApiUrl + +resolves #5606 From eb8b1f430f90a28b3ac8071e521a933a32b23164 Mon Sep 17 00:00:00 2001 From: Alican Erdurmaz Date: Tue, 28 May 2024 12:12:44 +0300 Subject: [PATCH 3/4] feat(nestjs-query): add test to getApiUrl --- packages/nestjs-query/test/gqlClient.ts | 2 +- packages/nestjs-query/test/useApiUrl/index.spec.ts | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 packages/nestjs-query/test/useApiUrl/index.spec.ts diff --git a/packages/nestjs-query/test/gqlClient.ts b/packages/nestjs-query/test/gqlClient.ts index efe169f9e0ed..18f16cea484b 100644 --- a/packages/nestjs-query/test/gqlClient.ts +++ b/packages/nestjs-query/test/gqlClient.ts @@ -1,7 +1,7 @@ import { GraphQLClient } from "graphql-request"; // const API_URL = "https://api.nestjs-query.refine.dev/graphql"; -const API_URL = "http://localhost:3003/graphql"; +export const API_URL = "http://localhost:3003/graphql"; const client = new GraphQLClient(API_URL); diff --git a/packages/nestjs-query/test/useApiUrl/index.spec.ts b/packages/nestjs-query/test/useApiUrl/index.spec.ts new file mode 100644 index 000000000000..7db9fd053f76 --- /dev/null +++ b/packages/nestjs-query/test/useApiUrl/index.spec.ts @@ -0,0 +1,12 @@ +import dataProvider from "../../src/index"; +import client, { API_URL } from "../gqlClient"; + +describe("getApiUrl", () => { + describe("should return API URL from client", () => { + it("correct response with query", async () => { + const apiURL = dataProvider(client).getApiUrl(); + + expect(apiURL).toEqual(API_URL); + }); + }); +}); From 64cbcd6c669a1947453c857093e096af4aa9125c Mon Sep 17 00:00:00 2001 From: Alican Erdurmaz Date: Tue, 28 May 2024 12:13:23 +0300 Subject: [PATCH 4/4] fix(nestjs-query): test description --- packages/nestjs-query/test/useApiUrl/index.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nestjs-query/test/useApiUrl/index.spec.ts b/packages/nestjs-query/test/useApiUrl/index.spec.ts index 7db9fd053f76..1388d9df1a68 100644 --- a/packages/nestjs-query/test/useApiUrl/index.spec.ts +++ b/packages/nestjs-query/test/useApiUrl/index.spec.ts @@ -3,7 +3,7 @@ import client, { API_URL } from "../gqlClient"; describe("getApiUrl", () => { describe("should return API URL from client", () => { - it("correct response with query", async () => { + it("correct response with getApiUrl", async () => { const apiURL = dataProvider(client).getApiUrl(); expect(apiURL).toEqual(API_URL);