-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.ts
More file actions
78 lines (77 loc) · 2.36 KB
/
mod.ts
File metadata and controls
78 lines (77 loc) · 2.36 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**
* GraphQL client for [Probitas](https://github.com/probitas-test/probitas) scenario testing framework.
*
* This package provides a GraphQL client designed for integration testing of GraphQL APIs.
*
* ## Features
*
* - **Query & Mutation**: Full support for GraphQL operations
* - **Variables Support**: Pass typed variables to queries and mutations
* - **Duration Tracking**: Built-in timing for performance monitoring
* - **Error Inspection**: Inspect GraphQL errors and their structure
* - **Resource Management**: Implements `AsyncDisposable` for proper cleanup
* - **Template Literals**: Re-exports `outdent` for clean multi-line queries
*
* ## Installation
*
* ```bash
* deno add jsr:@probitas/client-graphql
* ```
*
* ## Quick Start
*
* ```ts
* import { createGraphqlClient, outdent } from "@probitas/client-graphql";
*
* const client = createGraphqlClient({ url: "http://localhost:4000/graphql" });
*
* // Query with variables
* const res = await client.query(outdent`
* query GetUser($id: ID!) {
* user(id: $id) { id name email }
* }
* `, { id: "123" });
* console.log("User:", res.data);
*
* // Mutation
* const created = await client.mutation(outdent`
* mutation CreateUser($input: CreateUserInput!) {
* createUser(input: $input) { id name }
* }
* `, { input: { name: "Jane", email: "jane@example.com" } });
* console.log("Created:", created.data);
*
* await client.close();
* ```
*
* ## Using with `using` Statement
*
* ```ts
* import { createGraphqlClient } from "@probitas/client-graphql";
*
* await using client = createGraphqlClient({ url: "http://localhost:4000/graphql" });
*
* const res = await client.query(`{ __typename }`);
* console.log(res.data);
* // Client automatically closed when block exits
* ```
*
* ## Related Packages
*
* | Package | Description |
* |---------|-------------|
* | [`@probitas/client`](https://jsr.io/@probitas/client) | Core utilities and types |
* | [`@probitas/client-http`](https://jsr.io/@probitas/client-http) | HTTP client |
*
* ## Links
*
* - [GitHub Repository](https://github.com/probitas-test/probitas-client)
* - [Probitas Framework](https://github.com/probitas-test/probitas)
*
* @module
*/
export type * from "./types.ts";
export * from "./errors.ts";
export type * from "./response.ts";
export * from "./client.ts";
export { outdent } from "@cspotcode/outdent";