TypeScript Operations Reference

Our ORM is currently alpha so expect bugs and API changes. Please report bugs and feature requests on GitHub 🙏

A configured data source can be accessed from a custom operation via. the graph property of your handler's configuration object. See documentation on the ORM.

For example, assuming we have a data source defined with the namespace users with a query of get:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { createOperation, z } from '../generated/wundergraph.factory';
export default createOperation.query({
input: z.object({
id: z.string(),
}),
handler: async ({ input, graph }) => {
const user = await graph.from('users').query('get').where({ id: input.id }).exec();
return {
userID: user.id,
userName: user.name,
};
},
});

Was this article helpful to you?
Provide feedback

Edit this page