forked from Achilles4400/graphql-mesh-json-schema
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
33 lines (29 loc) · 968 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { getMesh, findAndParseConfig } from "@graphql-mesh/runtime";
import { getSdk } from "./sdk";
async function makeSdk() {
const meshConfig = await findAndParseConfig();
const { sdkRequester } = await getMesh(meshConfig);
// Get fully-typed SDK using the Mesh client and based on your GraphQL operations
return getSdk(sdkRequester);
}
async function main() {
const sdk = await makeSdk();
// me query working as expected
const me = await sdk.meQuery();
console.log("\n=== ME_QUERY ===>\n", JSON.stringify(me, null, 4));
// new user mutation not working because of transform fieldNames: camelCase
// without firstName and lastName params it's working
const newUser = await sdk.createUserMutation({
input: {
email: "[email protected]",
username: "jdoe",
firstName: "John",
lastName: "Doe",
},
});
console.log(
"\n=== CREATE_USER_MUTATION ===>\n",
JSON.stringify(newUser, null, 4)
);
}
main();