This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "pagarme-types-test", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"devDependencies": { | |
"typescript": "4.9.5", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script lang="ts"> | |
import {queryStore} from "gqless-svelte/autoQuery"; | |
import {query} from "$gqless"; | |
const promise = queryStore(() => query.me.name) | |
</script> | |
{#await $promise then name} | |
{ name } | |
{/await} | |
<!-- It should update on mutations --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const Queries = queryType({ | |
definition: (t) => { | |
t.field("node", { | |
type: "Node", | |
args: { id: idArg({ required: true }) }, | |
resolve: (root, args, context, info) => { | |
const { id, __typename } = decode(args.id); | |
const objeto = __typename.charAt(0).toLowerCase() + __typename.slice(1); // from TitleCase to camelCase | |
return { | |
...context.prisma[objeto].findOne({ where: { id } }), |