From 9ce4d48d0ba99f64a1f7085ae737f88fe6947e52 Mon Sep 17 00:00:00 2001 From: Siddharth9890 Date: Tue, 9 Jan 2024 10:57:55 +0530 Subject: [PATCH] chore: custom-file.ts => custom-file.js --- .meshrc.yml | 2 +- custom-fetch.ts => custom-fetch.js | 17 +++-------------- package.json | 5 ++++- src/pda/pda.ts | 1 - tsconfig.json | 3 ++- 5 files changed, 10 insertions(+), 18 deletions(-) rename custom-fetch.ts => custom-fetch.js (54%) diff --git a/.meshrc.yml b/.meshrc.yml index 96b1900..8cbafc9 100644 --- a/.meshrc.yml +++ b/.meshrc.yml @@ -14,7 +14,7 @@ sources: type: PDAMetadata field: pdametadastatus -customFetch: ./custom-fetch.ts +customFetch: ./custom-fetch.js sdk: generateOperations: diff --git a/custom-fetch.ts b/custom-fetch.js similarity index 54% rename from custom-fetch.ts rename to custom-fetch.js index a7bfd8f..c823719 100644 --- a/custom-fetch.ts +++ b/custom-fetch.js @@ -1,17 +1,6 @@ -import { Headers, fetch } from '@whatwg-node/fetch'; -import { MeshContext } from '@graphql-mesh/runtime'; +const { Headers, fetch } = require('@whatwg-node/fetch'); -type ContextModified = MeshContext & { - token: string; - apiKey: string; - url: string; -}; - -export default function patchedFetch( - url: string, - init: RequestInit, - context: ContextModified, -) { +module.exports = function (url, init, context) { const headers = new Headers(); headers.set( 'accept', @@ -22,4 +11,4 @@ export default function patchedFetch( headers.set('X-Api-Key', context?.apiKey); init.headers = headers; return fetch(context?.url || url, init); -} +}; diff --git a/package.json b/package.json index 50e7638..8a9274a 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,9 @@ "format": "prettier --write .", "build": "tsc" }, + "files": [ + "dist" + ], "keywords": [ "sdk", "sdk-typescript", @@ -47,4 +50,4 @@ "type": "git", "url": "git+https://github.com/Gateway-DAO/gateway-js-sdk.git" } -} \ No newline at end of file +} diff --git a/src/pda/pda.ts b/src/pda/pda.ts index e225721..d011c8f 100644 --- a/src/pda/pda.ts +++ b/src/pda/pda.ts @@ -65,7 +65,6 @@ export class PDA { try { return await this.sdk.PDAs_query({ filter, order, skip, take }); } catch (error) { - console.log(error); throw new Error(errorHandler(error)); } } diff --git a/tsconfig.json b/tsconfig.json index b8a7494..826fdc2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,5 @@ { - "include": ["src/**/*.ts", "custom-fetch.ts"], + "include": ["src/**/*.ts", "custom-fetch.js"], "exclude": ["jest.config.ts", "test", "**/*.test.ts"], "compilerOptions": { "target": "es2016", @@ -8,6 +8,7 @@ "forceConsistentCasingInFileNames": true, "strict": true, "skipLibCheck": true, + "allowJs": true, "typeRoots": ["./typings", "./node_modules/@types/"], "outDir": "./dist", "declaration": true