Skip to content

Commit

Permalink
chore: custom-file.ts => custom-file.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth9890 committed Jan 9, 2024
1 parent c6bf58d commit 9ce4d48
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .meshrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sources:
type: PDAMetadata
field: pdametadastatus

customFetch: ./custom-fetch.ts
customFetch: ./custom-fetch.js

sdk:
generateOperations:
Expand Down
17 changes: 3 additions & 14 deletions custom-fetch.ts → custom-fetch.js
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -22,4 +11,4 @@ export default function patchedFetch(
headers.set('X-Api-Key', context?.apiKey);
init.headers = headers;
return fetch(context?.url || url, init);
}
};
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"format": "prettier --write .",
"build": "tsc"
},
"files": [
"dist"
],
"keywords": [
"sdk",
"sdk-typescript",
Expand Down Expand Up @@ -47,4 +50,4 @@
"type": "git",
"url": "git+https://github.com/Gateway-DAO/gateway-js-sdk.git"
}
}
}
1 change: 0 additions & 1 deletion src/pda/pda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -8,6 +8,7 @@
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"allowJs": true,
"typeRoots": ["./typings", "./node_modules/@types/"],
"outDir": "./dist",
"declaration": true
Expand Down

0 comments on commit 9ce4d48

Please sign in to comment.