Skip to content

Commit

Permalink
Merge PR#20
Browse files Browse the repository at this point in the history
  • Loading branch information
babyfish-ct committed Jun 27, 2022
1 parent f21fca6 commit 09bdadb
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 111 deletions.
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graphql-ts-client-api",
"version": "3.1.8",
"version": "3.1.9",
"description": "Strongly type API for graphql client",
"author": "ChenTao",
"license": "MIT",
Expand Down
11 changes: 6 additions & 5 deletions codegen/dist/async/AsyncGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,22 @@ import { TextWriter, util } from "graphql-ts-client-api";
export type GraphQLExecutor = (request: string, variables: object) => Promise<any>;
export function setGraphQLExecutor(exeucotr: GraphQLExecutor) {
graphQLExecutor = exeucotr;
export function setGraphQLExecutor(executor: GraphQLExecutor) {
graphQLExecutor = executor;
}
export async function execute<TData extends object, TVariables extends object>(
fetcher: Fetcher<"Query" | "Mutation", TData, TVariables>,
options?: {
readonly operationName?: string,
readonly variables?: TVariables
readonly variables?: TVariables,
readonly executor?: GraphQLExecutor
}
) : Promise<TData> {
const executor = graphQLExecutor;
const executor = options?.executor ?? graphQLExecutor;
if (executor === undefined) {
throw new Error("'setGraphQLExecutor' has not been called");
throw new Error("Executor not set. Call 'setGraphQLExecutor' first or pass executor in options.");
}
const writer = new TextWriter();
Expand Down
4 changes: 2 additions & 2 deletions example/client/apollo-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"graphql": "^15.5.1",
"graphql-ts-client-api": "^3.1.8",
"graphql-ts-client-api": "^3.1.9",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
Expand Down Expand Up @@ -50,6 +50,6 @@
]
},
"devDependencies": {
"graphql-ts-client-codegen": "^3.1.8"
"graphql-ts-client-codegen": "^3.1.9"
}
}
16 changes: 8 additions & 8 deletions example/client/apollo-demo/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5527,17 +5527,17 @@ graphql-tag@^2.12.3:
dependencies:
tslib "^2.1.0"

graphql-ts-client-api@^3.1.8:
version "3.1.8"
resolved "https://registry.yarnpkg.com/graphql-ts-client-api/-/graphql-ts-client-api-3.1.8.tgz#493d39c3101569abf39680c2d3274343b3168a48"
integrity sha512-Dct05eoymzVLK7mScaWw8SD2cmHV5leOUOqiWmQw2IhjpHqsLSfuwnhPyGMv/QRzH1QO4ZQ7FbqUMzVR5/SZOA==
graphql-ts-client-api@^3.1.9:
version "3.1.9"
resolved "https://registry.yarnpkg.com/graphql-ts-client-api/-/graphql-ts-client-api-3.1.9.tgz#0ae8ec796f4a30a75658670231f697be722abd6c"
integrity sha512-BznTSKg6NRl+DV2oJIY81hGcbwXO7wCfFtN8kTjg/iqDOVx2cmL7WRynwYXbhFmAMF5XDyVEcY/Y+8xVKtN+Tw==
dependencies:
ts-md5 "^1.2.9"

graphql-ts-client-codegen@^3.1.8:
version "3.1.8"
resolved "https://registry.yarnpkg.com/graphql-ts-client-codegen/-/graphql-ts-client-codegen-3.1.8.tgz#7b59816d62e11a443608457197b312df199ab2a2"
integrity sha512-qF16zpIZU9FxTAdc8KbZDuSBFazis2HbdqlwVb4WoMMOE/UyJpMcUp3Sn6ITbYNXtGEgeRBVP6ksAN22fQwezg==
graphql-ts-client-codegen@^3.1.9:
version "3.1.9"
resolved "https://registry.yarnpkg.com/graphql-ts-client-codegen/-/graphql-ts-client-codegen-3.1.9.tgz#cdc612978eb7dc349a5f6207c07acbb2427bb5b3"
integrity sha512-iFeHPYTlf/XJhM4uaikUByYV5sN52jpq25IqtUZSZYtucHfbXAnS0YsaNR/F56KC6F02lf/vx18Pdw7uVeQOIg==
dependencies:
"@types/node" "^15.12.2"
"@types/node-fetch" "^2.5.10"
Expand Down
4 changes: 2 additions & 2 deletions example/client/async-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@types/node": "^12.0.0",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"graphql-ts-client-api": "^3.1.8",
"graphql-ts-client-api": "^3.1.9",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
Expand Down Expand Up @@ -45,7 +45,7 @@
},
"devDependencies": {
"graphql": "^15.5.0",
"graphql-ts-client-codegen": "^3.1.8",
"graphql-ts-client-codegen": "^3.1.9",
"node-fetch": "^2.6.1"
}
}
11 changes: 6 additions & 5 deletions example/client/async-demo/src/__generated/Async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@ import { TextWriter, util } from "graphql-ts-client-api";

export type GraphQLExecutor = (request: string, variables: object) => Promise<any>;

export function setGraphQLExecutor(exeucotr: GraphQLExecutor) {
graphQLExecutor = exeucotr;
export function setGraphQLExecutor(executor: GraphQLExecutor) {
graphQLExecutor = executor;
}

export async function execute<TData extends object, TVariables extends object>(
fetcher: Fetcher<"Query" | "Mutation", TData, TVariables>,
options?: {
readonly operationName?: string,
readonly variables?: TVariables
readonly variables?: TVariables,
readonly executor?: GraphQLExecutor
}
) : Promise<TData> {

const executor = graphQLExecutor;
const executor = options?.executor ?? graphQLExecutor;
if (executor === undefined) {
throw new Error("'setGraphQLExecutor' has not been called");
throw new Error("Executor not set. Call 'setGraphQLExecutor' first or pass executor in options.");
}

const writer = new TextWriter();
Expand Down
16 changes: 8 additions & 8 deletions example/client/async-demo/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5439,17 +5439,17 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.6.tgz#ff040b2b0853b23c3d31027523706f1885d76bee"
integrity sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==

graphql-ts-client-api@^3.1.8:
version "3.1.8"
resolved "https://registry.yarnpkg.com/graphql-ts-client-api/-/graphql-ts-client-api-3.1.8.tgz#493d39c3101569abf39680c2d3274343b3168a48"
integrity sha512-Dct05eoymzVLK7mScaWw8SD2cmHV5leOUOqiWmQw2IhjpHqsLSfuwnhPyGMv/QRzH1QO4ZQ7FbqUMzVR5/SZOA==
graphql-ts-client-api@^3.1.9:
version "3.1.9"
resolved "https://registry.yarnpkg.com/graphql-ts-client-api/-/graphql-ts-client-api-3.1.9.tgz#0ae8ec796f4a30a75658670231f697be722abd6c"
integrity sha512-BznTSKg6NRl+DV2oJIY81hGcbwXO7wCfFtN8kTjg/iqDOVx2cmL7WRynwYXbhFmAMF5XDyVEcY/Y+8xVKtN+Tw==
dependencies:
ts-md5 "^1.2.9"

graphql-ts-client-codegen@^3.1.8:
version "3.1.8"
resolved "https://registry.yarnpkg.com/graphql-ts-client-codegen/-/graphql-ts-client-codegen-3.1.8.tgz#7b59816d62e11a443608457197b312df199ab2a2"
integrity sha512-qF16zpIZU9FxTAdc8KbZDuSBFazis2HbdqlwVb4WoMMOE/UyJpMcUp3Sn6ITbYNXtGEgeRBVP6ksAN22fQwezg==
graphql-ts-client-codegen@^3.1.9:
version "3.1.9"
resolved "https://registry.yarnpkg.com/graphql-ts-client-codegen/-/graphql-ts-client-codegen-3.1.9.tgz#cdc612978eb7dc349a5f6207c07acbb2427bb5b3"
integrity sha512-iFeHPYTlf/XJhM4uaikUByYV5sN52jpq25IqtUZSZYtucHfbXAnS0YsaNR/F56KC6F02lf/vx18Pdw7uVeQOIg==
dependencies:
"@types/node" "^15.12.2"
"@types/node-fetch" "^2.5.10"
Expand Down
6 changes: 3 additions & 3 deletions example/client/relay-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"@types/react-relay": "^11.0.2",
"@types/relay-runtime": "^11.0.3",
"antd": "^4.16.13",
"graphql-ts-client-api": "^3.1.8",
"graphql-ts-client-relay": "^3.1.8",
"graphql-ts-client-api": "^3.1.9",
"graphql-ts-client-relay": "^3.1.9",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-relay": "^12.0.0",
Expand Down Expand Up @@ -51,6 +51,6 @@
]
},
"devDependencies": {
"graphql-ts-client-codegen": "^3.1.8"
"graphql-ts-client-codegen": "^3.1.9"
}
}
70 changes: 35 additions & 35 deletions example/client/relay-demo/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1979,33 +1979,33 @@
"@jridgewell/sourcemap-codec" "^1.4.10"

"@jridgewell/gen-mapping@^0.3.0":
version "0.3.1"
resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.1.tgz#cf92a983c83466b8c0ce9124fadeaf09f7c66ea9"
integrity sha512-GcHwniMlA2z+WFPWuY8lp3fsza0I8xPFMWL5+n8LYyP6PSvPrXf4+n8stDHZY2DM0zy9sVkRDy1jDI4XGzYVqg==
version "0.3.2"
resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9"
integrity sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==
dependencies:
"@jridgewell/set-array" "^1.0.0"
"@jridgewell/set-array" "^1.0.1"
"@jridgewell/sourcemap-codec" "^1.4.10"
"@jridgewell/trace-mapping" "^0.3.9"

"@jridgewell/resolve-uri@^3.0.3":
version "3.0.7"
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.0.7.tgz#30cd49820a962aff48c8fffc5cd760151fca61fe"
integrity sha512-8cXDaBBHOr2pQ7j77Y6Vp5VDT2sIqWyWQ56TjEq4ih/a4iST3dItRe8Q9fp0rrIl9DoKhWQtUQz/YpOxLkXbNA==
version "3.0.8"
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.0.8.tgz#687cc2bbf243f4e9a868ecf2262318e2658873a1"
integrity sha512-YK5G9LaddzGbcucK4c8h5tWFmMPBvRZ/uyWmN1/SbBdIvqGUdWGkJ5BAaccgs6XbzVLsqbPJrBSFwKv3kT9i7w==

"@jridgewell/set-array@^1.0.0":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.1.tgz#36a6acc93987adcf0ba50c66908bd0b70de8afea"
integrity sha512-Ct5MqZkLGEXTVmQYbGtx9SVqD2fqwvdubdps5D3djjAkgkKwT918VNOz65pEHFaYTeWcukmJmH5SwsA9Tn2ObQ==
"@jridgewell/set-array@^1.0.0", "@jridgewell/set-array@^1.0.1":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72"
integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==

"@jridgewell/sourcemap-codec@^1.4.10":
version "1.4.13"
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.13.tgz#b6461fb0c2964356c469e115f504c95ad97ab88c"
integrity sha512-GryiOJmNcWbovBxTfZSF71V/mXbgcV3MewDe3kIMCLyIh5e7SKAeUZs+rMnJ8jkMolZ/4/VsdBmMrw3l+VdZ3w==
version "1.4.14"
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24"
integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==

"@jridgewell/trace-mapping@^0.3.9":
version "0.3.13"
resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.13.tgz#dcfe3e95f224c8fe97a87a5235defec999aa92ea"
integrity sha512-o1xbKhp9qnIAoHJSWd6KlCZfqslL4valSF81H8ImioOAxluWYWOpWkpyktY2vnt4tbrX9XYaxovq6cgowaJp2w==
version "0.3.14"
resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz#b231a081d8f66796e475ad588a1ef473112701ed"
integrity sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ==
dependencies:
"@jridgewell/resolve-uri" "^3.0.3"
"@jridgewell/sourcemap-codec" "^1.4.10"
Expand Down Expand Up @@ -3891,9 +3891,9 @@ caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001109, can
integrity sha512-xJJqzyd+7GCJXkcoBiQ1GuxEiOBCLQ0aVW9HMekifZsAVGdj5eJ4mFB9fEhSHipq9IOk/QXFJUiIr9lZT+EsGw==

caniuse-lite@^1.0.30001358:
version "1.0.30001358"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001358.tgz#473d35dabf5e448b463095cab7924e96ccfb8c00"
integrity sha512-hvp8PSRymk85R20bsDra7ZTCpSVGN/PAz9pSAjPSjKC+rNmnUk5vCRgJwiTT/O4feQ/yu/drvZYpKxxhbFuChw==
version "1.0.30001359"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001359.tgz#a1c1cbe1c2da9e689638813618b4219acbd4925e"
integrity sha512-Xln/BAsPzEuiVLgJ2/45IaqD9jShtk3Y33anKb4+yLwQzws3+v6odKfpgES/cDEaZMLzSChpIGdbOYtH9MyuHw==

capture-exit@^2.0.0:
version "2.0.0"
Expand Down Expand Up @@ -5066,9 +5066,9 @@ electron-to-chromium@^1.3.564, electron-to-chromium@^1.3.649:
integrity sha512-RTD97QkdrJKaKwRv9h/wGAaoR2lGxNXEcBXS31vjitgTPwTWAbLdS7cEsBK68eEQy7p6YyT8D5BxBEYHu2SuwQ==

electron-to-chromium@^1.4.164:
version "1.4.167"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.167.tgz#72424aebc85df12c5331d37b1bcfd1ae01322c55"
integrity sha512-lPHuHXBwpkr4RcfaZBKm6TKOWG/1N9mVggUpP4fY3l1JIUU2x4fkM8928smYdZ5lF+6KCTAxo1aK9JmqT+X71Q==
version "1.4.170"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.170.tgz#0415fc489402e09bfbe1f0c99bbf4d73f31d48d4"
integrity sha512-rZ8PZLhK4ORPjFqLp9aqC4/S1j4qWFsPPz13xmWdrbBkU/LlxMcok+f+6f8YnQ57MiZwKtOaW15biZZsY5Igvw==

elliptic@^6.5.3:
version "6.5.4"
Expand Down Expand Up @@ -6207,28 +6207,28 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.6.tgz#ff040b2b0853b23c3d31027523706f1885d76bee"
integrity sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==

graphql-ts-client-api@^3.1.8:
version "3.1.8"
resolved "https://registry.yarnpkg.com/graphql-ts-client-api/-/graphql-ts-client-api-3.1.8.tgz#493d39c3101569abf39680c2d3274343b3168a48"
integrity sha512-Dct05eoymzVLK7mScaWw8SD2cmHV5leOUOqiWmQw2IhjpHqsLSfuwnhPyGMv/QRzH1QO4ZQ7FbqUMzVR5/SZOA==
graphql-ts-client-api@^3.1.9:
version "3.1.9"
resolved "https://registry.yarnpkg.com/graphql-ts-client-api/-/graphql-ts-client-api-3.1.9.tgz#0ae8ec796f4a30a75658670231f697be722abd6c"
integrity sha512-BznTSKg6NRl+DV2oJIY81hGcbwXO7wCfFtN8kTjg/iqDOVx2cmL7WRynwYXbhFmAMF5XDyVEcY/Y+8xVKtN+Tw==
dependencies:
ts-md5 "^1.2.9"

graphql-ts-client-codegen@^3.1.8:
version "3.1.8"
resolved "https://registry.yarnpkg.com/graphql-ts-client-codegen/-/graphql-ts-client-codegen-3.1.8.tgz#7b59816d62e11a443608457197b312df199ab2a2"
integrity sha512-qF16zpIZU9FxTAdc8KbZDuSBFazis2HbdqlwVb4WoMMOE/UyJpMcUp3Sn6ITbYNXtGEgeRBVP6ksAN22fQwezg==
graphql-ts-client-codegen@^3.1.9:
version "3.1.9"
resolved "https://registry.yarnpkg.com/graphql-ts-client-codegen/-/graphql-ts-client-codegen-3.1.9.tgz#cdc612978eb7dc349a5f6207c07acbb2427bb5b3"
integrity sha512-iFeHPYTlf/XJhM4uaikUByYV5sN52jpq25IqtUZSZYtucHfbXAnS0YsaNR/F56KC6F02lf/vx18Pdw7uVeQOIg==
dependencies:
"@types/node" "^15.12.2"
"@types/node-fetch" "^2.5.10"
graphql "^15.5.1"
node-fetch "^2.6.1"
typescript "^4.3.2"

graphql-ts-client-relay@^3.1.8:
version "3.1.8"
resolved "https://registry.yarnpkg.com/graphql-ts-client-relay/-/graphql-ts-client-relay-3.1.8.tgz#b89aa80e1402e8852c78bd1d0cb66042ab22e866"
integrity sha512-xDSMj7vM885WMU0hjZQ3ieSJy+VfjaQGKtAyFfH2w3VvJVTraGHimEcv0kbSeWDMjc5svoZZ7t+fQVqF6bEd3Q==
graphql-ts-client-relay@^3.1.9:
version "3.1.9"
resolved "https://registry.yarnpkg.com/graphql-ts-client-relay/-/graphql-ts-client-relay-3.1.9.tgz#15f6fbb4d4ade5305dd2ec81bd6ebd8aefe467a6"
integrity sha512-Xm/Yxq+epcIJOFkIn8Dw33kKrJVopSJVWWw0nR1fMgy69pN/XgznuTQ5IBAc2bHX7ygQukm/jGaGa3+LbDcvOQ==
dependencies:
"@types/node" "^16.7.10"
"@types/react-relay" "^11.0.2"
Expand Down
6 changes: 3 additions & 3 deletions example/client/relay-tutorial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"@types/react-dom": "^17.0.0",
"@types/react-relay": "^11.0.2",
"@types/relay-runtime": "^11.0.3",
"graphql-ts-client-api": "^3.1.8",
"graphql-ts-client-relay": "^3.1.8",
"graphql-ts-client-api": "^3.1.9",
"graphql-ts-client-relay": "^3.1.9",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-relay": "^12.0.0",
Expand Down Expand Up @@ -50,6 +50,6 @@
]
},
"devDependencies": {
"graphql-ts-client-codegen": "^3.1.8"
"graphql-ts-client-codegen": "^3.1.9"
}
}
Loading

0 comments on commit 09bdadb

Please sign in to comment.