@settlemint/sdk-hasura 2.4.1-pr6c40584b → 2.4.1-pr79cb50b0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -120
- package/dist/hasura.cjs +0 -118
- package/dist/hasura.cjs.map +1 -1
- package/dist/hasura.d.cts +1 -57
- package/dist/hasura.d.ts +1 -57
- package/dist/hasura.js +1 -117
- package/dist/hasura.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -30,9 +30,7 @@
|
|
|
30
30
|
- [API Reference](#api-reference)
|
|
31
31
|
- [Functions](#functions)
|
|
32
32
|
- [createHasuraClient()](#createhasuraclient)
|
|
33
|
-
- [createHasuraMetadataClient()](#createhasurametadataclient)
|
|
34
33
|
- [createPostgresPool()](#createpostgrespool)
|
|
35
|
-
- [trackAllTables()](#trackalltables)
|
|
36
34
|
- [Type Aliases](#type-aliases)
|
|
37
35
|
- [ClientOptions](#clientoptions)
|
|
38
36
|
- [RequestConfig](#requestconfig)
|
|
@@ -53,7 +51,7 @@ The SettleMint Hasura SDK provides a seamless way to interact with Hasura GraphQ
|
|
|
53
51
|
|
|
54
52
|
> **createHasuraClient**\<`Setup`\>(`options`, `clientOptions?`, `logger?`): `object`
|
|
55
53
|
|
|
56
|
-
Defined in: [sdk/hasura/src/hasura.ts:
|
|
54
|
+
Defined in: [sdk/hasura/src/hasura.ts:82](https://github.com/settlemint/sdk/blob/v2.4.1/sdk/hasura/src/hasura.ts#L82)
|
|
57
55
|
|
|
58
56
|
Creates a Hasura GraphQL client with proper type safety using gql.tada
|
|
59
57
|
|
|
@@ -85,8 +83,8 @@ An object containing:
|
|
|
85
83
|
|
|
86
84
|
| Name | Type | Defined in |
|
|
87
85
|
| ------ | ------ | ------ |
|
|
88
|
-
| `client` | `GraphQLClient` | [sdk/hasura/src/hasura.ts:
|
|
89
|
-
| `graphql` | `initGraphQLTada`\<`Setup`\> | [sdk/hasura/src/hasura.ts:
|
|
86
|
+
| `client` | `GraphQLClient` | [sdk/hasura/src/hasura.ts:87](https://github.com/settlemint/sdk/blob/v2.4.1/sdk/hasura/src/hasura.ts#L87) |
|
|
87
|
+
| `graphql` | `initGraphQLTada`\<`Setup`\> | [sdk/hasura/src/hasura.ts:88](https://github.com/settlemint/sdk/blob/v2.4.1/sdk/hasura/src/hasura.ts#L88) |
|
|
90
88
|
|
|
91
89
|
##### Throws
|
|
92
90
|
|
|
@@ -140,72 +138,6 @@ const result = await client.request(query);
|
|
|
140
138
|
|
|
141
139
|
***
|
|
142
140
|
|
|
143
|
-
#### createHasuraMetadataClient()
|
|
144
|
-
|
|
145
|
-
> **createHasuraMetadataClient**(`options`, `logger?`): \<`T`\>(`query`) => `Promise`\<\{ `data`: `T`; `ok`: `boolean`; \}\>
|
|
146
|
-
|
|
147
|
-
Defined in: [sdk/hasura/src/hasura.ts:132](https://github.com/settlemint/sdk/blob/v2.4.1/sdk/hasura/src/hasura.ts#L132)
|
|
148
|
-
|
|
149
|
-
Creates a Hasura Metadata client
|
|
150
|
-
|
|
151
|
-
##### Parameters
|
|
152
|
-
|
|
153
|
-
| Parameter | Type | Description |
|
|
154
|
-
| ------ | ------ | ------ |
|
|
155
|
-
| `options` | \{ `accessToken?`: `string`; `adminSecret`: `string`; `cache?`: `"default"` \| `"force-cache"` \| `"no-cache"` \| `"no-store"` \| `"only-if-cached"` \| `"reload"`; `instance`: `string`; \} | Configuration options for the client |
|
|
156
|
-
| `options.accessToken?` | `string` | - |
|
|
157
|
-
| `options.adminSecret?` | `string` | - |
|
|
158
|
-
| `options.cache?` | `"default"` \| `"force-cache"` \| `"no-cache"` \| `"no-store"` \| `"only-if-cached"` \| `"reload"` | - |
|
|
159
|
-
| `options.instance?` | `string` | - |
|
|
160
|
-
| `logger?` | `Logger` | Optional logger to use for logging the requests |
|
|
161
|
-
|
|
162
|
-
##### Returns
|
|
163
|
-
|
|
164
|
-
A function that can be used to make requests to the Hasura Metadata API
|
|
165
|
-
|
|
166
|
-
> \<`T`\>(`query`): `Promise`\<\{ `data`: `T`; `ok`: `boolean`; \}\>
|
|
167
|
-
|
|
168
|
-
###### Type Parameters
|
|
169
|
-
|
|
170
|
-
| Type Parameter |
|
|
171
|
-
| ------ |
|
|
172
|
-
| `T` |
|
|
173
|
-
|
|
174
|
-
###### Parameters
|
|
175
|
-
|
|
176
|
-
| Parameter | Type |
|
|
177
|
-
| ------ | ------ |
|
|
178
|
-
| `query` | `object` |
|
|
179
|
-
|
|
180
|
-
###### Returns
|
|
181
|
-
|
|
182
|
-
`Promise`\<\{ `data`: `T`; `ok`: `boolean`; \}\>
|
|
183
|
-
|
|
184
|
-
##### Throws
|
|
185
|
-
|
|
186
|
-
Will throw an error if the options fail validation against ClientOptionsSchema
|
|
187
|
-
|
|
188
|
-
##### Example
|
|
189
|
-
|
|
190
|
-
```ts
|
|
191
|
-
import { createHasuraMetadataClient } from '@settlemint/sdk-hasura';
|
|
192
|
-
|
|
193
|
-
const client = createHasuraMetadataClient({
|
|
194
|
-
instance: process.env.SETTLEMINT_HASURA_ENDPOINT,
|
|
195
|
-
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
|
196
|
-
adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET,
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
const result = await client({
|
|
200
|
-
type: "pg_get_source_tables",
|
|
201
|
-
args: {
|
|
202
|
-
source: "default",
|
|
203
|
-
},
|
|
204
|
-
});
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
***
|
|
208
|
-
|
|
209
141
|
#### createPostgresPool()
|
|
210
142
|
|
|
211
143
|
> **createPostgresPool**(`databaseUrl`): `Pool`
|
|
@@ -247,55 +179,13 @@ try {
|
|
|
247
179
|
}
|
|
248
180
|
```
|
|
249
181
|
|
|
250
|
-
***
|
|
251
|
-
|
|
252
|
-
#### trackAllTables()
|
|
253
|
-
|
|
254
|
-
> **trackAllTables**(`databaseName`, `client`): `Promise`\<\{ `messages`: `string`[]; `result`: `"success"` \| `"no-tables"`; \}\>
|
|
255
|
-
|
|
256
|
-
Defined in: [sdk/hasura/src/utils/track-all-tables.ts:25](https://github.com/settlemint/sdk/blob/v2.4.1/sdk/hasura/src/utils/track-all-tables.ts#L25)
|
|
257
|
-
|
|
258
|
-
Track all tables in a database
|
|
259
|
-
|
|
260
|
-
##### Parameters
|
|
261
|
-
|
|
262
|
-
| Parameter | Type | Description |
|
|
263
|
-
| ------ | ------ | ------ |
|
|
264
|
-
| `databaseName` | `string` | The name of the database to track tables for |
|
|
265
|
-
| `client` | \<`T`\>(`query`) => `Promise`\<\{ `data`: `T`; `ok`: `boolean`; \}\> | - |
|
|
266
|
-
|
|
267
|
-
##### Returns
|
|
268
|
-
|
|
269
|
-
`Promise`\<\{ `messages`: `string`[]; `result`: `"success"` \| `"no-tables"`; \}\>
|
|
270
|
-
|
|
271
|
-
A promise that resolves to an object with a result property indicating success or failure
|
|
272
|
-
|
|
273
|
-
##### Example
|
|
274
|
-
|
|
275
|
-
```ts
|
|
276
|
-
import { trackAllTables } from "@settlemint/sdk-hasura/utils/track-all-tables";
|
|
277
|
-
|
|
278
|
-
const client = createHasuraMetadataClient({
|
|
279
|
-
instance: "http://localhost:8080",
|
|
280
|
-
accessToken: "test",
|
|
281
|
-
adminSecret: "test",
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
const result = await trackAllTables("default", client);
|
|
285
|
-
if (result.result === "success") {
|
|
286
|
-
console.log("Tables tracked successfully");
|
|
287
|
-
} else {
|
|
288
|
-
console.error("Failed to track tables");
|
|
289
|
-
}
|
|
290
|
-
```
|
|
291
|
-
|
|
292
182
|
### Type Aliases
|
|
293
183
|
|
|
294
184
|
#### ClientOptions
|
|
295
185
|
|
|
296
186
|
> **ClientOptions** = `object`
|
|
297
187
|
|
|
298
|
-
Defined in: [sdk/hasura/src/hasura.ts:
|
|
188
|
+
Defined in: [sdk/hasura/src/hasura.ts:27](https://github.com/settlemint/sdk/blob/v2.4.1/sdk/hasura/src/hasura.ts#L27)
|
|
299
189
|
|
|
300
190
|
Type definition for client options derived from the ClientOptionsSchema.
|
|
301
191
|
|
|
@@ -303,10 +193,10 @@ Type definition for client options derived from the ClientOptionsSchema.
|
|
|
303
193
|
|
|
304
194
|
| Name | Type | Default value | Defined in |
|
|
305
195
|
| ------ | ------ | ------ | ------ |
|
|
306
|
-
| <a id="accesstoken"></a> `accessToken?` | `string` | - | [sdk/hasura/src/hasura.ts:
|
|
307
|
-
| <a id="adminsecret"></a> `adminSecret` | `string` | - | [sdk/hasura/src/hasura.ts:
|
|
308
|
-
| <a id="cache"></a> `cache?` | `"default"` \| `"force-cache"` \| `"no-cache"` \| `"no-store"` \| `"only-if-cached"` \| `"reload"` | - | [sdk/hasura/src/hasura.ts:
|
|
309
|
-
| <a id="instance"></a> `instance` | `string` | `UrlOrPathSchema` | [sdk/hasura/src/hasura.ts:
|
|
196
|
+
| <a id="accesstoken"></a> `accessToken?` | `string` | - | [sdk/hasura/src/hasura.ts:19](https://github.com/settlemint/sdk/blob/v2.4.1/sdk/hasura/src/hasura.ts#L19) |
|
|
197
|
+
| <a id="adminsecret"></a> `adminSecret` | `string` | - | [sdk/hasura/src/hasura.ts:20](https://github.com/settlemint/sdk/blob/v2.4.1/sdk/hasura/src/hasura.ts#L20) |
|
|
198
|
+
| <a id="cache"></a> `cache?` | `"default"` \| `"force-cache"` \| `"no-cache"` \| `"no-store"` \| `"only-if-cached"` \| `"reload"` | - | [sdk/hasura/src/hasura.ts:21](https://github.com/settlemint/sdk/blob/v2.4.1/sdk/hasura/src/hasura.ts#L21) |
|
|
199
|
+
| <a id="instance"></a> `instance` | `string` | `UrlOrPathSchema` | [sdk/hasura/src/hasura.ts:18](https://github.com/settlemint/sdk/blob/v2.4.1/sdk/hasura/src/hasura.ts#L18) |
|
|
310
200
|
|
|
311
201
|
***
|
|
312
202
|
|
|
@@ -314,7 +204,7 @@ Type definition for client options derived from the ClientOptionsSchema.
|
|
|
314
204
|
|
|
315
205
|
> **RequestConfig** = `ConstructorParameters`\<*typeof* `GraphQLClient`\>\[`1`\]
|
|
316
206
|
|
|
317
|
-
Defined in: [sdk/hasura/src/hasura.ts:
|
|
207
|
+
Defined in: [sdk/hasura/src/hasura.ts:12](https://github.com/settlemint/sdk/blob/v2.4.1/sdk/hasura/src/hasura.ts#L12)
|
|
318
208
|
|
|
319
209
|
Type definition for GraphQL client configuration options
|
|
320
210
|
|
|
@@ -324,7 +214,7 @@ Type definition for GraphQL client configuration options
|
|
|
324
214
|
|
|
325
215
|
> `const` **ClientOptionsSchema**: `ZodObject`\<[`ClientOptions`](#clientoptions)\>
|
|
326
216
|
|
|
327
|
-
Defined in: [sdk/hasura/src/hasura.ts:
|
|
217
|
+
Defined in: [sdk/hasura/src/hasura.ts:17](https://github.com/settlemint/sdk/blob/v2.4.1/sdk/hasura/src/hasura.ts#L17)
|
|
328
218
|
|
|
329
219
|
Schema for validating client options for the Hasura client.
|
|
330
220
|
|
package/dist/hasura.cjs
CHANGED
|
@@ -22,7 +22,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
|
|
24
24
|
//#endregion
|
|
25
|
-
const __settlemint_sdk_utils = __toESM(require("@settlemint/sdk-utils"));
|
|
26
25
|
const __settlemint_sdk_utils_http = __toESM(require("@settlemint/sdk-utils/http"));
|
|
27
26
|
const __settlemint_sdk_utils_logging = __toESM(require("@settlemint/sdk-utils/logging"));
|
|
28
27
|
const __settlemint_sdk_utils_runtime = __toESM(require("@settlemint/sdk-utils/runtime"));
|
|
@@ -31,71 +30,6 @@ const gql_tada = __toESM(require("gql.tada"));
|
|
|
31
30
|
const graphql_request = __toESM(require("graphql-request"));
|
|
32
31
|
const zod_v4 = __toESM(require("zod/v4"));
|
|
33
32
|
|
|
34
|
-
//#region src/utils/track-all-tables.ts
|
|
35
|
-
/**
|
|
36
|
-
* Track all tables in a database
|
|
37
|
-
*
|
|
38
|
-
* @param databaseName - The name of the database to track tables for
|
|
39
|
-
* @param options - The client options to use for the Hasura client
|
|
40
|
-
* @returns A promise that resolves to an object with a result property indicating success or failure
|
|
41
|
-
* @example
|
|
42
|
-
* import { trackAllTables } from "@settlemint/sdk-hasura/utils/track-all-tables";
|
|
43
|
-
*
|
|
44
|
-
* const client = createHasuraMetadataClient({
|
|
45
|
-
* instance: "http://localhost:8080",
|
|
46
|
-
* accessToken: "test",
|
|
47
|
-
* adminSecret: "test",
|
|
48
|
-
* });
|
|
49
|
-
*
|
|
50
|
-
* const result = await trackAllTables("default", client);
|
|
51
|
-
* if (result.result === "success") {
|
|
52
|
-
* console.log("Tables tracked successfully");
|
|
53
|
-
* } else {
|
|
54
|
-
* console.error("Failed to track tables");
|
|
55
|
-
* }
|
|
56
|
-
*/
|
|
57
|
-
async function trackAllTables(databaseName, client) {
|
|
58
|
-
const messages = [];
|
|
59
|
-
const getTablesResult = await client({
|
|
60
|
-
type: "pg_get_source_tables",
|
|
61
|
-
args: { source: databaseName }
|
|
62
|
-
});
|
|
63
|
-
if (!getTablesResult.ok) {
|
|
64
|
-
throw new Error(`Failed to get tables: ${JSON.stringify(getTablesResult.data)}`);
|
|
65
|
-
}
|
|
66
|
-
const tables = getTablesResult.data;
|
|
67
|
-
if (tables.length === 0) {
|
|
68
|
-
return {
|
|
69
|
-
result: "no-tables",
|
|
70
|
-
messages
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
messages.push(`Found ${tables.length} tables in database "${databaseName}"`);
|
|
74
|
-
await client({
|
|
75
|
-
type: "pg_untrack_tables",
|
|
76
|
-
args: {
|
|
77
|
-
tables: tables.map((table) => ({ table: table.name })),
|
|
78
|
-
allow_warnings: true
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
const trackResult = await client({
|
|
82
|
-
type: "pg_track_tables",
|
|
83
|
-
args: {
|
|
84
|
-
tables: tables.map((table) => ({ table: table.name })),
|
|
85
|
-
allow_warnings: true
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
if (!trackResult.ok) {
|
|
89
|
-
throw new Error(`Failed to track tables: ${JSON.stringify(trackResult.data)}`);
|
|
90
|
-
}
|
|
91
|
-
messages.push(`Successfully tracked ${tables.length} tables`);
|
|
92
|
-
return {
|
|
93
|
-
result: "success",
|
|
94
|
-
messages
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
//#endregion
|
|
99
33
|
//#region src/hasura.ts
|
|
100
34
|
/**
|
|
101
35
|
* Schema for validating client options for the Hasura client.
|
|
@@ -183,66 +117,14 @@ function createHasuraClient(options, clientOptions, logger) {
|
|
|
183
117
|
graphql
|
|
184
118
|
};
|
|
185
119
|
}
|
|
186
|
-
/**
|
|
187
|
-
* Creates a Hasura Metadata client
|
|
188
|
-
*
|
|
189
|
-
* @param options - Configuration options for the client
|
|
190
|
-
* @param logger - Optional logger to use for logging the requests
|
|
191
|
-
* @returns A function that can be used to make requests to the Hasura Metadata API
|
|
192
|
-
* @throws Will throw an error if the options fail validation against ClientOptionsSchema
|
|
193
|
-
* @example
|
|
194
|
-
* import { createHasuraMetadataClient } from '@settlemint/sdk-hasura';
|
|
195
|
-
*
|
|
196
|
-
* const client = createHasuraMetadataClient({
|
|
197
|
-
* instance: process.env.SETTLEMINT_HASURA_ENDPOINT,
|
|
198
|
-
* accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
|
199
|
-
* adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET,
|
|
200
|
-
* });
|
|
201
|
-
*
|
|
202
|
-
* const result = await client({
|
|
203
|
-
* type: "pg_get_source_tables",
|
|
204
|
-
* args: {
|
|
205
|
-
* source: "default",
|
|
206
|
-
* },
|
|
207
|
-
* });
|
|
208
|
-
*/
|
|
209
|
-
function createHasuraMetadataClient(options, logger) {
|
|
210
|
-
(0, __settlemint_sdk_utils_runtime.ensureServer)();
|
|
211
|
-
const validatedOptions = (0, __settlemint_sdk_utils_validation.validate)(ClientOptionsSchema, options);
|
|
212
|
-
const baseUrl = (0, __settlemint_sdk_utils.extractBaseUrlBeforeSegment)(options.instance, "/v1/graphql");
|
|
213
|
-
const queryEndpoint = new URL(`${baseUrl}/v1/metadata`).toString();
|
|
214
|
-
const fetchInstance = logger ? (0, __settlemint_sdk_utils_logging.requestLogger)(logger, "hasura", fetch) : fetch;
|
|
215
|
-
return async (query) => {
|
|
216
|
-
const response = await fetchInstance(queryEndpoint, {
|
|
217
|
-
method: "POST",
|
|
218
|
-
headers: (0, __settlemint_sdk_utils_http.appendHeaders)({ "Content-Type": "application/json" }, {
|
|
219
|
-
"x-auth-token": validatedOptions.accessToken,
|
|
220
|
-
"x-hasura-admin-secret": validatedOptions.adminSecret
|
|
221
|
-
}),
|
|
222
|
-
body: JSON.stringify(query)
|
|
223
|
-
});
|
|
224
|
-
if (!response.ok) {
|
|
225
|
-
return {
|
|
226
|
-
ok: false,
|
|
227
|
-
data: await response.json()
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
return {
|
|
231
|
-
ok: true,
|
|
232
|
-
data: await response.json()
|
|
233
|
-
};
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
120
|
|
|
237
121
|
//#endregion
|
|
238
122
|
exports.ClientOptionsSchema = ClientOptionsSchema;
|
|
239
123
|
exports.createHasuraClient = createHasuraClient;
|
|
240
|
-
exports.createHasuraMetadataClient = createHasuraMetadataClient;
|
|
241
124
|
Object.defineProperty(exports, 'readFragment', {
|
|
242
125
|
enumerable: true,
|
|
243
126
|
get: function () {
|
|
244
127
|
return gql_tada.readFragment;
|
|
245
128
|
}
|
|
246
129
|
});
|
|
247
|
-
exports.trackAllTables = trackAllTables;
|
|
248
130
|
//# sourceMappingURL=hasura.cjs.map
|
package/dist/hasura.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasura.cjs","names":["databaseName: string","client: ReturnType<typeof createHasuraMetadataClient>","messages: string[]","UrlOrPathSchema","options: ClientOptions","clientOptions?: RequestConfig","logger?: Logger","GraphQLClient","query: object"],"sources":["../src/utils/track-all-tables.ts","../src/hasura.ts"],"sourcesContent":["import type { createHasuraMetadataClient } from \"../hasura.js\";\n\n/**\n * Track all tables in a database\n *\n * @param databaseName - The name of the database to track tables for\n * @param options - The client options to use for the Hasura client\n * @returns A promise that resolves to an object with a result property indicating success or failure\n * @example\n * import { trackAllTables } from \"@settlemint/sdk-hasura/utils/track-all-tables\";\n *\n * const client = createHasuraMetadataClient({\n * instance: \"http://localhost:8080\",\n * accessToken: \"test\",\n * adminSecret: \"test\",\n * });\n *\n * const result = await trackAllTables(\"default\", client);\n * if (result.result === \"success\") {\n * console.log(\"Tables tracked successfully\");\n * } else {\n * console.error(\"Failed to track tables\");\n * }\n */\nexport async function trackAllTables(\n databaseName: string,\n client: ReturnType<typeof createHasuraMetadataClient>,\n): Promise<{ result: \"success\" | \"no-tables\"; messages: string[] }> {\n const messages: string[] = [];\n\n // Get all tables using pg_get_source_tables\n const getTablesResult = await client<\n Array<{\n name: string;\n schema: string;\n }>\n >({\n type: \"pg_get_source_tables\",\n args: {\n source: databaseName,\n },\n });\n\n if (!getTablesResult.ok) {\n throw new Error(`Failed to get tables: ${JSON.stringify(getTablesResult.data)}`);\n }\n\n const tables = getTablesResult.data;\n\n if (tables.length === 0) {\n return { result: \"no-tables\" as const, messages };\n }\n\n messages.push(`Found ${tables.length} tables in database \"${databaseName}\"`);\n\n // Incase a table is already tracked, untrack it first\n await client<{ code?: string }>({\n type: \"pg_untrack_tables\",\n args: {\n tables: tables.map((table) => ({\n table: table.name,\n })),\n allow_warnings: true,\n },\n });\n\n // Track all tables\n const trackResult = await client<{ code?: string }>({\n type: \"pg_track_tables\",\n args: {\n tables: tables.map((table) => ({\n table: table.name,\n })),\n allow_warnings: true,\n },\n });\n\n if (!trackResult.ok) {\n throw new Error(`Failed to track tables: ${JSON.stringify(trackResult.data)}`);\n }\n\n messages.push(`Successfully tracked ${tables.length} tables`);\n\n return { result: \"success\" as const, messages };\n}\n","import { extractBaseUrlBeforeSegment } from \"@settlemint/sdk-utils\";\nimport { appendHeaders } from \"@settlemint/sdk-utils/http\";\nimport { type Logger, requestLogger } from \"@settlemint/sdk-utils/logging\";\nimport { ensureServer } from \"@settlemint/sdk-utils/runtime\";\nimport { ApplicationAccessTokenSchema, UrlOrPathSchema, validate } from \"@settlemint/sdk-utils/validation\";\nimport { type AbstractSetupSchema, initGraphQLTada } from \"gql.tada\";\nimport { GraphQLClient } from \"graphql-request\";\nimport { z } from \"zod/v4\";\n\n/**\n * Type definition for GraphQL client configuration options\n */\nexport type RequestConfig = ConstructorParameters<typeof GraphQLClient>[1];\n\n/**\n * Schema for validating client options for the Hasura client.\n */\nexport const ClientOptionsSchema = z.object({\n instance: UrlOrPathSchema,\n accessToken: ApplicationAccessTokenSchema.optional(),\n adminSecret: z.string(),\n cache: z.enum([\"default\", \"force-cache\", \"no-cache\", \"no-store\", \"only-if-cached\", \"reload\"]).optional(),\n});\n\n/**\n * Type definition for client options derived from the ClientOptionsSchema.\n */\nexport type ClientOptions = z.infer<typeof ClientOptionsSchema>;\n\n/**\n * Creates a Hasura GraphQL client with proper type safety using gql.tada\n *\n * @param options - Configuration options for the client\n * @param clientOptions - Optional GraphQL client configuration options\n * @param logger - Optional logger to use for logging the requests\n * @returns An object containing:\n * - client: The configured GraphQL client instance\n * - graphql: The initialized gql.tada function for type-safe queries\n * @throws Will throw an error if the options fail validation against ClientOptionsSchema\n * @example\n * import { createHasuraClient } from '@settlemint/sdk-hasura';\n * import type { introspection } from \"@schemas/hasura-env\";\n * import { createLogger, requestLogger } from \"@settlemint/sdk-utils/logging\";\n *\n * const logger = createLogger();\n *\n * const { client, graphql } = createHasuraClient<{\n * introspection: introspection;\n * disableMasking: true;\n * scalars: {\n * timestamp: string;\n * timestampz: string;\n * uuid: string;\n * date: string;\n * time: string;\n * jsonb: string;\n * numeric: string;\n * interval: string;\n * geometry: string;\n * geography: string;\n * };\n * }>({\n * instance: process.env.SETTLEMINT_HASURA_ENDPOINT,\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,\n * adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET,\n * }, {\n * fetch: requestLogger(logger, \"hasura\", fetch) as typeof fetch,\n * });\n *\n * // Making GraphQL queries\n * const query = graphql(`\n * query GetUsers {\n * users {\n * id\n * name\n * email\n * }\n * }\n * `);\n *\n * const result = await client.request(query);\n */\nexport function createHasuraClient<const Setup extends AbstractSetupSchema>(\n options: ClientOptions,\n clientOptions?: RequestConfig,\n logger?: Logger,\n): {\n client: GraphQLClient;\n graphql: initGraphQLTada<Setup>;\n} {\n ensureServer();\n const validatedOptions = validate(ClientOptionsSchema, options);\n const graphql = initGraphQLTada<Setup>();\n const fullUrl = new URL(validatedOptions.instance).toString();\n\n return {\n client: new GraphQLClient(fullUrl, {\n ...clientOptions,\n headers: appendHeaders(clientOptions?.headers, {\n \"x-auth-token\": validatedOptions.accessToken,\n \"x-hasura-admin-secret\": validatedOptions.adminSecret,\n }),\n fetch: (logger ? requestLogger(logger, \"hasura\", fetch) : fetch) as typeof fetch,\n }),\n graphql,\n };\n}\n\n/**\n * Creates a Hasura Metadata client\n *\n * @param options - Configuration options for the client\n * @param logger - Optional logger to use for logging the requests\n * @returns A function that can be used to make requests to the Hasura Metadata API\n * @throws Will throw an error if the options fail validation against ClientOptionsSchema\n * @example\n * import { createHasuraMetadataClient } from '@settlemint/sdk-hasura';\n *\n * const client = createHasuraMetadataClient({\n * instance: process.env.SETTLEMINT_HASURA_ENDPOINT,\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,\n * adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET,\n * });\n *\n * const result = await client({\n * type: \"pg_get_source_tables\",\n * args: {\n * source: \"default\",\n * },\n * });\n */\nexport function createHasuraMetadataClient(options: ClientOptions, logger?: Logger) {\n ensureServer();\n const validatedOptions = validate(ClientOptionsSchema, options);\n const baseUrl = extractBaseUrlBeforeSegment(options.instance, \"/v1/graphql\");\n const queryEndpoint = new URL(`${baseUrl}/v1/metadata`).toString();\n const fetchInstance = logger ? requestLogger(logger, \"hasura\", fetch) : fetch;\n\n return async <T>(query: object): Promise<{ ok: boolean; data: T }> => {\n const response = await fetchInstance(queryEndpoint, {\n method: \"POST\",\n headers: appendHeaders(\n { \"Content-Type\": \"application/json\" },\n {\n \"x-auth-token\": validatedOptions.accessToken,\n \"x-hasura-admin-secret\": validatedOptions.adminSecret,\n },\n ),\n body: JSON.stringify(query),\n });\n\n if (!response.ok) {\n return { ok: false, data: (await response.json()) as T };\n }\n\n return { ok: true, data: (await response.json()) as T };\n };\n}\n\nexport type { FragmentOf, ResultOf, VariablesOf } from \"gql.tada\";\nexport { readFragment } from \"gql.tada\";\nexport { trackAllTables } from \"./utils/track-all-tables.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,eAAsB,eACpBA,cACAC,QACkE;CAClE,MAAMC,WAAqB,CAAE;CAG7B,MAAM,kBAAkB,MAAM,OAK5B;EACA,MAAM;EACN,MAAM,EACJ,QAAQ,aACT;CACF,EAAC;AAEF,MAAK,gBAAgB,IAAI;AACvB,QAAM,IAAI,OAAO,wBAAwB,KAAK,UAAU,gBAAgB,KAAK,CAAC;CAC/E;CAED,MAAM,SAAS,gBAAgB;AAE/B,KAAI,OAAO,WAAW,GAAG;AACvB,SAAO;GAAE,QAAQ;GAAsB;EAAU;CAClD;AAED,UAAS,MAAM,QAAQ,OAAO,OAAO,uBAAuB,aAAa,GAAG;AAG5E,OAAM,OAA0B;EAC9B,MAAM;EACN,MAAM;GACJ,QAAQ,OAAO,IAAI,CAAC,WAAW,EAC7B,OAAO,MAAM,KACd,GAAE;GACH,gBAAgB;EACjB;CACF,EAAC;CAGF,MAAM,cAAc,MAAM,OAA0B;EAClD,MAAM;EACN,MAAM;GACJ,QAAQ,OAAO,IAAI,CAAC,WAAW,EAC7B,OAAO,MAAM,KACd,GAAE;GACH,gBAAgB;EACjB;CACF,EAAC;AAEF,MAAK,YAAY,IAAI;AACnB,QAAM,IAAI,OAAO,0BAA0B,KAAK,UAAU,YAAY,KAAK,CAAC;CAC7E;AAED,UAAS,MAAM,uBAAuB,OAAO,OAAO,SAAS;AAE7D,QAAO;EAAE,QAAQ;EAAoB;CAAU;AAChD;;;;;;;ACnED,MAAa,sBAAsB,SAAE,OAAO;CAC1C,UAAUC;CACV,aAAa,+DAA6B,UAAU;CACpD,aAAa,SAAE,QAAQ;CACvB,OAAO,SAAE,KAAK;EAAC;EAAW;EAAe;EAAY;EAAY;EAAkB;CAAS,EAAC,CAAC,UAAU;AACzG,EAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DF,SAAgB,mBACdC,SACAC,eACAC,QAIA;AACA,mDAAc;CACd,MAAM,mBAAmB,gDAAS,qBAAqB,QAAQ;CAC/D,MAAM,UAAU,+BAAwB;CACxC,MAAM,UAAU,IAAI,IAAI,iBAAiB,UAAU,UAAU;AAE7D,QAAO;EACL,QAAQ,IAAIC,8BAAc,SAAS;GACjC,GAAG;GACH,SAAS,+CAAc,eAAe,SAAS;IAC7C,gBAAgB,iBAAiB;IACjC,yBAAyB,iBAAiB;GAC3C,EAAC;GACF,OAAQ,SAAS,kDAAc,QAAQ,UAAU,MAAM,GAAG;EAC3D;EACD;CACD;AACF;;;;;;;;;;;;;;;;;;;;;;;;AAyBD,SAAgB,2BAA2BH,SAAwBE,QAAiB;AAClF,mDAAc;CACd,MAAM,mBAAmB,gDAAS,qBAAqB,QAAQ;CAC/D,MAAM,UAAU,wDAA4B,QAAQ,UAAU,cAAc;CAC5E,MAAM,gBAAgB,IAAI,KAAK,EAAE,QAAQ,eAAe,UAAU;CAClE,MAAM,gBAAgB,SAAS,kDAAc,QAAQ,UAAU,MAAM,GAAG;AAExE,QAAO,OAAUE,UAAqD;EACpE,MAAM,WAAW,MAAM,cAAc,eAAe;GAClD,QAAQ;GACR,SAAS,+CACP,EAAE,gBAAgB,mBAAoB,GACtC;IACE,gBAAgB,iBAAiB;IACjC,yBAAyB,iBAAiB;GAC3C,EACF;GACD,MAAM,KAAK,UAAU,MAAM;EAC5B,EAAC;AAEF,OAAK,SAAS,IAAI;AAChB,UAAO;IAAE,IAAI;IAAO,MAAO,MAAM,SAAS,MAAM;GAAQ;EACzD;AAED,SAAO;GAAE,IAAI;GAAM,MAAO,MAAM,SAAS,MAAM;EAAQ;CACxD;AACF"}
|
|
1
|
+
{"version":3,"file":"hasura.cjs","names":["UrlOrPathSchema","options: ClientOptions","clientOptions?: RequestConfig","logger?: Logger","GraphQLClient"],"sources":["../src/hasura.ts"],"sourcesContent":["import { appendHeaders } from \"@settlemint/sdk-utils/http\";\nimport { type Logger, requestLogger } from \"@settlemint/sdk-utils/logging\";\nimport { ensureServer } from \"@settlemint/sdk-utils/runtime\";\nimport { ApplicationAccessTokenSchema, UrlOrPathSchema, validate } from \"@settlemint/sdk-utils/validation\";\nimport { type AbstractSetupSchema, initGraphQLTada } from \"gql.tada\";\nimport { GraphQLClient } from \"graphql-request\";\nimport { z } from \"zod/v4\";\n\n/**\n * Type definition for GraphQL client configuration options\n */\nexport type RequestConfig = ConstructorParameters<typeof GraphQLClient>[1];\n\n/**\n * Schema for validating client options for the Hasura client.\n */\nexport const ClientOptionsSchema = z.object({\n instance: UrlOrPathSchema,\n accessToken: ApplicationAccessTokenSchema.optional(),\n adminSecret: z.string(),\n cache: z.enum([\"default\", \"force-cache\", \"no-cache\", \"no-store\", \"only-if-cached\", \"reload\"]).optional(),\n});\n\n/**\n * Type definition for client options derived from the ClientOptionsSchema.\n */\nexport type ClientOptions = z.infer<typeof ClientOptionsSchema>;\n\n/**\n * Creates a Hasura GraphQL client with proper type safety using gql.tada\n *\n * @param options - Configuration options for the client\n * @param clientOptions - Optional GraphQL client configuration options\n * @param logger - Optional logger to use for logging the requests\n * @returns An object containing:\n * - client: The configured GraphQL client instance\n * - graphql: The initialized gql.tada function for type-safe queries\n * @throws Will throw an error if the options fail validation against ClientOptionsSchema\n * @example\n * import { createHasuraClient } from '@settlemint/sdk-hasura';\n * import type { introspection } from \"@schemas/hasura-env\";\n * import { createLogger, requestLogger } from \"@settlemint/sdk-utils/logging\";\n *\n * const logger = createLogger();\n *\n * const { client, graphql } = createHasuraClient<{\n * introspection: introspection;\n * disableMasking: true;\n * scalars: {\n * timestamp: string;\n * timestampz: string;\n * uuid: string;\n * date: string;\n * time: string;\n * jsonb: string;\n * numeric: string;\n * interval: string;\n * geometry: string;\n * geography: string;\n * };\n * }>({\n * instance: process.env.SETTLEMINT_HASURA_ENDPOINT,\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,\n * adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET,\n * }, {\n * fetch: requestLogger(logger, \"hasura\", fetch) as typeof fetch,\n * });\n *\n * // Making GraphQL queries\n * const query = graphql(`\n * query GetUsers {\n * users {\n * id\n * name\n * email\n * }\n * }\n * `);\n *\n * const result = await client.request(query);\n */\nexport function createHasuraClient<const Setup extends AbstractSetupSchema>(\n options: ClientOptions,\n clientOptions?: RequestConfig,\n logger?: Logger,\n): {\n client: GraphQLClient;\n graphql: initGraphQLTada<Setup>;\n} {\n ensureServer();\n const validatedOptions = validate(ClientOptionsSchema, options);\n const graphql = initGraphQLTada<Setup>();\n const fullUrl = new URL(validatedOptions.instance).toString();\n\n return {\n client: new GraphQLClient(fullUrl, {\n ...clientOptions,\n headers: appendHeaders(clientOptions?.headers, {\n \"x-auth-token\": validatedOptions.accessToken,\n \"x-hasura-admin-secret\": validatedOptions.adminSecret,\n }),\n fetch: (logger ? requestLogger(logger, \"hasura\", fetch) : fetch) as typeof fetch,\n }),\n graphql,\n };\n}\n\nexport { readFragment } from \"gql.tada\";\nexport type { FragmentOf, ResultOf, VariablesOf } from \"gql.tada\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAa,sBAAsB,SAAE,OAAO;CAC1C,UAAUA;CACV,aAAa,+DAA6B,UAAU;CACpD,aAAa,SAAE,QAAQ;CACvB,OAAO,SAAE,KAAK;EAAC;EAAW;EAAe;EAAY;EAAY;EAAkB;CAAS,EAAC,CAAC,UAAU;AACzG,EAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DF,SAAgB,mBACdC,SACAC,eACAC,QAIA;AACA,mDAAc;CACd,MAAM,mBAAmB,gDAAS,qBAAqB,QAAQ;CAC/D,MAAM,UAAU,+BAAwB;CACxC,MAAM,UAAU,IAAI,IAAI,iBAAiB,UAAU,UAAU;AAE7D,QAAO;EACL,QAAQ,IAAIC,8BAAc,SAAS;GACjC,GAAG;GACH,SAAS,+CAAc,eAAe,SAAS;IAC7C,gBAAgB,iBAAiB;IACjC,yBAAyB,iBAAiB;GAC3C,EAAC;GACF,OAAQ,SAAS,kDAAc,QAAQ,UAAU,MAAM,GAAG;EAC3D;EACD;CACD;AACF"}
|
package/dist/hasura.d.cts
CHANGED
|
@@ -4,35 +4,6 @@ import { AbstractSetupSchema, FragmentOf, ResultOf, VariablesOf, initGraphQLTada
|
|
|
4
4
|
import { GraphQLClient } from "graphql-request";
|
|
5
5
|
import { z } from "zod/v4";
|
|
6
6
|
|
|
7
|
-
//#region src/utils/track-all-tables.d.ts
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Track all tables in a database
|
|
11
|
-
*
|
|
12
|
-
* @param databaseName - The name of the database to track tables for
|
|
13
|
-
* @param options - The client options to use for the Hasura client
|
|
14
|
-
* @returns A promise that resolves to an object with a result property indicating success or failure
|
|
15
|
-
* @example
|
|
16
|
-
* import { trackAllTables } from "@settlemint/sdk-hasura/utils/track-all-tables";
|
|
17
|
-
*
|
|
18
|
-
* const client = createHasuraMetadataClient({
|
|
19
|
-
* instance: "http://localhost:8080",
|
|
20
|
-
* accessToken: "test",
|
|
21
|
-
* adminSecret: "test",
|
|
22
|
-
* });
|
|
23
|
-
*
|
|
24
|
-
* const result = await trackAllTables("default", client);
|
|
25
|
-
* if (result.result === "success") {
|
|
26
|
-
* console.log("Tables tracked successfully");
|
|
27
|
-
* } else {
|
|
28
|
-
* console.error("Failed to track tables");
|
|
29
|
-
* }
|
|
30
|
-
*/
|
|
31
|
-
declare function trackAllTables(databaseName: string, client: ReturnType<typeof createHasuraMetadataClient>): Promise<{
|
|
32
|
-
result: "success" | "no-tables";
|
|
33
|
-
messages: string[];
|
|
34
|
-
}>;
|
|
35
|
-
//#endregion
|
|
36
7
|
//#region src/hasura.d.ts
|
|
37
8
|
/**
|
|
38
9
|
* Type definition for GraphQL client configuration options
|
|
@@ -115,33 +86,6 @@ declare function createHasuraClient<const Setup extends AbstractSetupSchema>(opt
|
|
|
115
86
|
client: GraphQLClient;
|
|
116
87
|
graphql: initGraphQLTada<Setup>;
|
|
117
88
|
};
|
|
118
|
-
/**
|
|
119
|
-
* Creates a Hasura Metadata client
|
|
120
|
-
*
|
|
121
|
-
* @param options - Configuration options for the client
|
|
122
|
-
* @param logger - Optional logger to use for logging the requests
|
|
123
|
-
* @returns A function that can be used to make requests to the Hasura Metadata API
|
|
124
|
-
* @throws Will throw an error if the options fail validation against ClientOptionsSchema
|
|
125
|
-
* @example
|
|
126
|
-
* import { createHasuraMetadataClient } from '@settlemint/sdk-hasura';
|
|
127
|
-
*
|
|
128
|
-
* const client = createHasuraMetadataClient({
|
|
129
|
-
* instance: process.env.SETTLEMINT_HASURA_ENDPOINT,
|
|
130
|
-
* accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
|
131
|
-
* adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET,
|
|
132
|
-
* });
|
|
133
|
-
*
|
|
134
|
-
* const result = await client({
|
|
135
|
-
* type: "pg_get_source_tables",
|
|
136
|
-
* args: {
|
|
137
|
-
* source: "default",
|
|
138
|
-
* },
|
|
139
|
-
* });
|
|
140
|
-
*/
|
|
141
|
-
declare function createHasuraMetadataClient(options: ClientOptions, logger?: Logger): <T>(query: object) => Promise<{
|
|
142
|
-
ok: boolean;
|
|
143
|
-
data: T;
|
|
144
|
-
}>;
|
|
145
89
|
//#endregion
|
|
146
|
-
export { ClientOptions, ClientOptionsSchema, FragmentOf, RequestConfig, ResultOf, VariablesOf, createHasuraClient,
|
|
90
|
+
export { ClientOptions, ClientOptionsSchema, FragmentOf, RequestConfig, ResultOf, VariablesOf, createHasuraClient, readFragment };
|
|
147
91
|
//# sourceMappingURL=hasura.d.cts.map
|
package/dist/hasura.d.ts
CHANGED
|
@@ -4,35 +4,6 @@ import { AbstractSetupSchema, FragmentOf, ResultOf, VariablesOf, initGraphQLTada
|
|
|
4
4
|
import { GraphQLClient } from "graphql-request";
|
|
5
5
|
import { z } from "zod/v4";
|
|
6
6
|
|
|
7
|
-
//#region src/utils/track-all-tables.d.ts
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Track all tables in a database
|
|
11
|
-
*
|
|
12
|
-
* @param databaseName - The name of the database to track tables for
|
|
13
|
-
* @param options - The client options to use for the Hasura client
|
|
14
|
-
* @returns A promise that resolves to an object with a result property indicating success or failure
|
|
15
|
-
* @example
|
|
16
|
-
* import { trackAllTables } from "@settlemint/sdk-hasura/utils/track-all-tables";
|
|
17
|
-
*
|
|
18
|
-
* const client = createHasuraMetadataClient({
|
|
19
|
-
* instance: "http://localhost:8080",
|
|
20
|
-
* accessToken: "test",
|
|
21
|
-
* adminSecret: "test",
|
|
22
|
-
* });
|
|
23
|
-
*
|
|
24
|
-
* const result = await trackAllTables("default", client);
|
|
25
|
-
* if (result.result === "success") {
|
|
26
|
-
* console.log("Tables tracked successfully");
|
|
27
|
-
* } else {
|
|
28
|
-
* console.error("Failed to track tables");
|
|
29
|
-
* }
|
|
30
|
-
*/
|
|
31
|
-
declare function trackAllTables(databaseName: string, client: ReturnType<typeof createHasuraMetadataClient>): Promise<{
|
|
32
|
-
result: "success" | "no-tables";
|
|
33
|
-
messages: string[];
|
|
34
|
-
}>;
|
|
35
|
-
//#endregion
|
|
36
7
|
//#region src/hasura.d.ts
|
|
37
8
|
/**
|
|
38
9
|
* Type definition for GraphQL client configuration options
|
|
@@ -115,33 +86,6 @@ declare function createHasuraClient<const Setup extends AbstractSetupSchema>(opt
|
|
|
115
86
|
client: GraphQLClient;
|
|
116
87
|
graphql: initGraphQLTada<Setup>;
|
|
117
88
|
};
|
|
118
|
-
/**
|
|
119
|
-
* Creates a Hasura Metadata client
|
|
120
|
-
*
|
|
121
|
-
* @param options - Configuration options for the client
|
|
122
|
-
* @param logger - Optional logger to use for logging the requests
|
|
123
|
-
* @returns A function that can be used to make requests to the Hasura Metadata API
|
|
124
|
-
* @throws Will throw an error if the options fail validation against ClientOptionsSchema
|
|
125
|
-
* @example
|
|
126
|
-
* import { createHasuraMetadataClient } from '@settlemint/sdk-hasura';
|
|
127
|
-
*
|
|
128
|
-
* const client = createHasuraMetadataClient({
|
|
129
|
-
* instance: process.env.SETTLEMINT_HASURA_ENDPOINT,
|
|
130
|
-
* accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
|
131
|
-
* adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET,
|
|
132
|
-
* });
|
|
133
|
-
*
|
|
134
|
-
* const result = await client({
|
|
135
|
-
* type: "pg_get_source_tables",
|
|
136
|
-
* args: {
|
|
137
|
-
* source: "default",
|
|
138
|
-
* },
|
|
139
|
-
* });
|
|
140
|
-
*/
|
|
141
|
-
declare function createHasuraMetadataClient(options: ClientOptions, logger?: Logger): <T>(query: object) => Promise<{
|
|
142
|
-
ok: boolean;
|
|
143
|
-
data: T;
|
|
144
|
-
}>;
|
|
145
89
|
//#endregion
|
|
146
|
-
export { ClientOptions, ClientOptionsSchema, FragmentOf, RequestConfig, ResultOf, VariablesOf, createHasuraClient,
|
|
90
|
+
export { ClientOptions, ClientOptionsSchema, FragmentOf, RequestConfig, ResultOf, VariablesOf, createHasuraClient, readFragment };
|
|
147
91
|
//# sourceMappingURL=hasura.d.ts.map
|
package/dist/hasura.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* SettleMint Hasura SDK - GraphQL API */
|
|
2
|
-
import { extractBaseUrlBeforeSegment } from "@settlemint/sdk-utils";
|
|
3
2
|
import { appendHeaders } from "@settlemint/sdk-utils/http";
|
|
4
3
|
import { requestLogger } from "@settlemint/sdk-utils/logging";
|
|
5
4
|
import { ensureServer } from "@settlemint/sdk-utils/runtime";
|
|
@@ -8,71 +7,6 @@ import { initGraphQLTada, readFragment } from "gql.tada";
|
|
|
8
7
|
import { GraphQLClient } from "graphql-request";
|
|
9
8
|
import { z } from "zod/v4";
|
|
10
9
|
|
|
11
|
-
//#region src/utils/track-all-tables.ts
|
|
12
|
-
/**
|
|
13
|
-
* Track all tables in a database
|
|
14
|
-
*
|
|
15
|
-
* @param databaseName - The name of the database to track tables for
|
|
16
|
-
* @param options - The client options to use for the Hasura client
|
|
17
|
-
* @returns A promise that resolves to an object with a result property indicating success or failure
|
|
18
|
-
* @example
|
|
19
|
-
* import { trackAllTables } from "@settlemint/sdk-hasura/utils/track-all-tables";
|
|
20
|
-
*
|
|
21
|
-
* const client = createHasuraMetadataClient({
|
|
22
|
-
* instance: "http://localhost:8080",
|
|
23
|
-
* accessToken: "test",
|
|
24
|
-
* adminSecret: "test",
|
|
25
|
-
* });
|
|
26
|
-
*
|
|
27
|
-
* const result = await trackAllTables("default", client);
|
|
28
|
-
* if (result.result === "success") {
|
|
29
|
-
* console.log("Tables tracked successfully");
|
|
30
|
-
* } else {
|
|
31
|
-
* console.error("Failed to track tables");
|
|
32
|
-
* }
|
|
33
|
-
*/
|
|
34
|
-
async function trackAllTables(databaseName, client) {
|
|
35
|
-
const messages = [];
|
|
36
|
-
const getTablesResult = await client({
|
|
37
|
-
type: "pg_get_source_tables",
|
|
38
|
-
args: { source: databaseName }
|
|
39
|
-
});
|
|
40
|
-
if (!getTablesResult.ok) {
|
|
41
|
-
throw new Error(`Failed to get tables: ${JSON.stringify(getTablesResult.data)}`);
|
|
42
|
-
}
|
|
43
|
-
const tables = getTablesResult.data;
|
|
44
|
-
if (tables.length === 0) {
|
|
45
|
-
return {
|
|
46
|
-
result: "no-tables",
|
|
47
|
-
messages
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
messages.push(`Found ${tables.length} tables in database "${databaseName}"`);
|
|
51
|
-
await client({
|
|
52
|
-
type: "pg_untrack_tables",
|
|
53
|
-
args: {
|
|
54
|
-
tables: tables.map((table) => ({ table: table.name })),
|
|
55
|
-
allow_warnings: true
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
const trackResult = await client({
|
|
59
|
-
type: "pg_track_tables",
|
|
60
|
-
args: {
|
|
61
|
-
tables: tables.map((table) => ({ table: table.name })),
|
|
62
|
-
allow_warnings: true
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
if (!trackResult.ok) {
|
|
66
|
-
throw new Error(`Failed to track tables: ${JSON.stringify(trackResult.data)}`);
|
|
67
|
-
}
|
|
68
|
-
messages.push(`Successfully tracked ${tables.length} tables`);
|
|
69
|
-
return {
|
|
70
|
-
result: "success",
|
|
71
|
-
messages
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
//#endregion
|
|
76
10
|
//#region src/hasura.ts
|
|
77
11
|
/**
|
|
78
12
|
* Schema for validating client options for the Hasura client.
|
|
@@ -160,57 +94,7 @@ function createHasuraClient(options, clientOptions, logger) {
|
|
|
160
94
|
graphql
|
|
161
95
|
};
|
|
162
96
|
}
|
|
163
|
-
/**
|
|
164
|
-
* Creates a Hasura Metadata client
|
|
165
|
-
*
|
|
166
|
-
* @param options - Configuration options for the client
|
|
167
|
-
* @param logger - Optional logger to use for logging the requests
|
|
168
|
-
* @returns A function that can be used to make requests to the Hasura Metadata API
|
|
169
|
-
* @throws Will throw an error if the options fail validation against ClientOptionsSchema
|
|
170
|
-
* @example
|
|
171
|
-
* import { createHasuraMetadataClient } from '@settlemint/sdk-hasura';
|
|
172
|
-
*
|
|
173
|
-
* const client = createHasuraMetadataClient({
|
|
174
|
-
* instance: process.env.SETTLEMINT_HASURA_ENDPOINT,
|
|
175
|
-
* accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
|
176
|
-
* adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET,
|
|
177
|
-
* });
|
|
178
|
-
*
|
|
179
|
-
* const result = await client({
|
|
180
|
-
* type: "pg_get_source_tables",
|
|
181
|
-
* args: {
|
|
182
|
-
* source: "default",
|
|
183
|
-
* },
|
|
184
|
-
* });
|
|
185
|
-
*/
|
|
186
|
-
function createHasuraMetadataClient(options, logger) {
|
|
187
|
-
ensureServer();
|
|
188
|
-
const validatedOptions = validate(ClientOptionsSchema, options);
|
|
189
|
-
const baseUrl = extractBaseUrlBeforeSegment(options.instance, "/v1/graphql");
|
|
190
|
-
const queryEndpoint = new URL(`${baseUrl}/v1/metadata`).toString();
|
|
191
|
-
const fetchInstance = logger ? requestLogger(logger, "hasura", fetch) : fetch;
|
|
192
|
-
return async (query) => {
|
|
193
|
-
const response = await fetchInstance(queryEndpoint, {
|
|
194
|
-
method: "POST",
|
|
195
|
-
headers: appendHeaders({ "Content-Type": "application/json" }, {
|
|
196
|
-
"x-auth-token": validatedOptions.accessToken,
|
|
197
|
-
"x-hasura-admin-secret": validatedOptions.adminSecret
|
|
198
|
-
}),
|
|
199
|
-
body: JSON.stringify(query)
|
|
200
|
-
});
|
|
201
|
-
if (!response.ok) {
|
|
202
|
-
return {
|
|
203
|
-
ok: false,
|
|
204
|
-
data: await response.json()
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
return {
|
|
208
|
-
ok: true,
|
|
209
|
-
data: await response.json()
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
97
|
|
|
214
98
|
//#endregion
|
|
215
|
-
export { ClientOptionsSchema, createHasuraClient,
|
|
99
|
+
export { ClientOptionsSchema, createHasuraClient, readFragment };
|
|
216
100
|
//# sourceMappingURL=hasura.js.map
|
package/dist/hasura.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasura.js","names":["databaseName: string","client: ReturnType<typeof createHasuraMetadataClient>","messages: string[]","options: ClientOptions","clientOptions?: RequestConfig","logger?: Logger","query: object"],"sources":["../src/utils/track-all-tables.ts","../src/hasura.ts"],"sourcesContent":["import type { createHasuraMetadataClient } from \"../hasura.js\";\n\n/**\n * Track all tables in a database\n *\n * @param databaseName - The name of the database to track tables for\n * @param options - The client options to use for the Hasura client\n * @returns A promise that resolves to an object with a result property indicating success or failure\n * @example\n * import { trackAllTables } from \"@settlemint/sdk-hasura/utils/track-all-tables\";\n *\n * const client = createHasuraMetadataClient({\n * instance: \"http://localhost:8080\",\n * accessToken: \"test\",\n * adminSecret: \"test\",\n * });\n *\n * const result = await trackAllTables(\"default\", client);\n * if (result.result === \"success\") {\n * console.log(\"Tables tracked successfully\");\n * } else {\n * console.error(\"Failed to track tables\");\n * }\n */\nexport async function trackAllTables(\n databaseName: string,\n client: ReturnType<typeof createHasuraMetadataClient>,\n): Promise<{ result: \"success\" | \"no-tables\"; messages: string[] }> {\n const messages: string[] = [];\n\n // Get all tables using pg_get_source_tables\n const getTablesResult = await client<\n Array<{\n name: string;\n schema: string;\n }>\n >({\n type: \"pg_get_source_tables\",\n args: {\n source: databaseName,\n },\n });\n\n if (!getTablesResult.ok) {\n throw new Error(`Failed to get tables: ${JSON.stringify(getTablesResult.data)}`);\n }\n\n const tables = getTablesResult.data;\n\n if (tables.length === 0) {\n return { result: \"no-tables\" as const, messages };\n }\n\n messages.push(`Found ${tables.length} tables in database \"${databaseName}\"`);\n\n // Incase a table is already tracked, untrack it first\n await client<{ code?: string }>({\n type: \"pg_untrack_tables\",\n args: {\n tables: tables.map((table) => ({\n table: table.name,\n })),\n allow_warnings: true,\n },\n });\n\n // Track all tables\n const trackResult = await client<{ code?: string }>({\n type: \"pg_track_tables\",\n args: {\n tables: tables.map((table) => ({\n table: table.name,\n })),\n allow_warnings: true,\n },\n });\n\n if (!trackResult.ok) {\n throw new Error(`Failed to track tables: ${JSON.stringify(trackResult.data)}`);\n }\n\n messages.push(`Successfully tracked ${tables.length} tables`);\n\n return { result: \"success\" as const, messages };\n}\n","import { extractBaseUrlBeforeSegment } from \"@settlemint/sdk-utils\";\nimport { appendHeaders } from \"@settlemint/sdk-utils/http\";\nimport { type Logger, requestLogger } from \"@settlemint/sdk-utils/logging\";\nimport { ensureServer } from \"@settlemint/sdk-utils/runtime\";\nimport { ApplicationAccessTokenSchema, UrlOrPathSchema, validate } from \"@settlemint/sdk-utils/validation\";\nimport { type AbstractSetupSchema, initGraphQLTada } from \"gql.tada\";\nimport { GraphQLClient } from \"graphql-request\";\nimport { z } from \"zod/v4\";\n\n/**\n * Type definition for GraphQL client configuration options\n */\nexport type RequestConfig = ConstructorParameters<typeof GraphQLClient>[1];\n\n/**\n * Schema for validating client options for the Hasura client.\n */\nexport const ClientOptionsSchema = z.object({\n instance: UrlOrPathSchema,\n accessToken: ApplicationAccessTokenSchema.optional(),\n adminSecret: z.string(),\n cache: z.enum([\"default\", \"force-cache\", \"no-cache\", \"no-store\", \"only-if-cached\", \"reload\"]).optional(),\n});\n\n/**\n * Type definition for client options derived from the ClientOptionsSchema.\n */\nexport type ClientOptions = z.infer<typeof ClientOptionsSchema>;\n\n/**\n * Creates a Hasura GraphQL client with proper type safety using gql.tada\n *\n * @param options - Configuration options for the client\n * @param clientOptions - Optional GraphQL client configuration options\n * @param logger - Optional logger to use for logging the requests\n * @returns An object containing:\n * - client: The configured GraphQL client instance\n * - graphql: The initialized gql.tada function for type-safe queries\n * @throws Will throw an error if the options fail validation against ClientOptionsSchema\n * @example\n * import { createHasuraClient } from '@settlemint/sdk-hasura';\n * import type { introspection } from \"@schemas/hasura-env\";\n * import { createLogger, requestLogger } from \"@settlemint/sdk-utils/logging\";\n *\n * const logger = createLogger();\n *\n * const { client, graphql } = createHasuraClient<{\n * introspection: introspection;\n * disableMasking: true;\n * scalars: {\n * timestamp: string;\n * timestampz: string;\n * uuid: string;\n * date: string;\n * time: string;\n * jsonb: string;\n * numeric: string;\n * interval: string;\n * geometry: string;\n * geography: string;\n * };\n * }>({\n * instance: process.env.SETTLEMINT_HASURA_ENDPOINT,\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,\n * adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET,\n * }, {\n * fetch: requestLogger(logger, \"hasura\", fetch) as typeof fetch,\n * });\n *\n * // Making GraphQL queries\n * const query = graphql(`\n * query GetUsers {\n * users {\n * id\n * name\n * email\n * }\n * }\n * `);\n *\n * const result = await client.request(query);\n */\nexport function createHasuraClient<const Setup extends AbstractSetupSchema>(\n options: ClientOptions,\n clientOptions?: RequestConfig,\n logger?: Logger,\n): {\n client: GraphQLClient;\n graphql: initGraphQLTada<Setup>;\n} {\n ensureServer();\n const validatedOptions = validate(ClientOptionsSchema, options);\n const graphql = initGraphQLTada<Setup>();\n const fullUrl = new URL(validatedOptions.instance).toString();\n\n return {\n client: new GraphQLClient(fullUrl, {\n ...clientOptions,\n headers: appendHeaders(clientOptions?.headers, {\n \"x-auth-token\": validatedOptions.accessToken,\n \"x-hasura-admin-secret\": validatedOptions.adminSecret,\n }),\n fetch: (logger ? requestLogger(logger, \"hasura\", fetch) : fetch) as typeof fetch,\n }),\n graphql,\n };\n}\n\n/**\n * Creates a Hasura Metadata client\n *\n * @param options - Configuration options for the client\n * @param logger - Optional logger to use for logging the requests\n * @returns A function that can be used to make requests to the Hasura Metadata API\n * @throws Will throw an error if the options fail validation against ClientOptionsSchema\n * @example\n * import { createHasuraMetadataClient } from '@settlemint/sdk-hasura';\n *\n * const client = createHasuraMetadataClient({\n * instance: process.env.SETTLEMINT_HASURA_ENDPOINT,\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,\n * adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET,\n * });\n *\n * const result = await client({\n * type: \"pg_get_source_tables\",\n * args: {\n * source: \"default\",\n * },\n * });\n */\nexport function createHasuraMetadataClient(options: ClientOptions, logger?: Logger) {\n ensureServer();\n const validatedOptions = validate(ClientOptionsSchema, options);\n const baseUrl = extractBaseUrlBeforeSegment(options.instance, \"/v1/graphql\");\n const queryEndpoint = new URL(`${baseUrl}/v1/metadata`).toString();\n const fetchInstance = logger ? requestLogger(logger, \"hasura\", fetch) : fetch;\n\n return async <T>(query: object): Promise<{ ok: boolean; data: T }> => {\n const response = await fetchInstance(queryEndpoint, {\n method: \"POST\",\n headers: appendHeaders(\n { \"Content-Type\": \"application/json\" },\n {\n \"x-auth-token\": validatedOptions.accessToken,\n \"x-hasura-admin-secret\": validatedOptions.adminSecret,\n },\n ),\n body: JSON.stringify(query),\n });\n\n if (!response.ok) {\n return { ok: false, data: (await response.json()) as T };\n }\n\n return { ok: true, data: (await response.json()) as T };\n };\n}\n\nexport type { FragmentOf, ResultOf, VariablesOf } from \"gql.tada\";\nexport { readFragment } from \"gql.tada\";\nexport { trackAllTables } from \"./utils/track-all-tables.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,eAAsB,eACpBA,cACAC,QACkE;CAClE,MAAMC,WAAqB,CAAE;CAG7B,MAAM,kBAAkB,MAAM,OAK5B;EACA,MAAM;EACN,MAAM,EACJ,QAAQ,aACT;CACF,EAAC;AAEF,MAAK,gBAAgB,IAAI;AACvB,QAAM,IAAI,OAAO,wBAAwB,KAAK,UAAU,gBAAgB,KAAK,CAAC;CAC/E;CAED,MAAM,SAAS,gBAAgB;AAE/B,KAAI,OAAO,WAAW,GAAG;AACvB,SAAO;GAAE,QAAQ;GAAsB;EAAU;CAClD;AAED,UAAS,MAAM,QAAQ,OAAO,OAAO,uBAAuB,aAAa,GAAG;AAG5E,OAAM,OAA0B;EAC9B,MAAM;EACN,MAAM;GACJ,QAAQ,OAAO,IAAI,CAAC,WAAW,EAC7B,OAAO,MAAM,KACd,GAAE;GACH,gBAAgB;EACjB;CACF,EAAC;CAGF,MAAM,cAAc,MAAM,OAA0B;EAClD,MAAM;EACN,MAAM;GACJ,QAAQ,OAAO,IAAI,CAAC,WAAW,EAC7B,OAAO,MAAM,KACd,GAAE;GACH,gBAAgB;EACjB;CACF,EAAC;AAEF,MAAK,YAAY,IAAI;AACnB,QAAM,IAAI,OAAO,0BAA0B,KAAK,UAAU,YAAY,KAAK,CAAC;CAC7E;AAED,UAAS,MAAM,uBAAuB,OAAO,OAAO,SAAS;AAE7D,QAAO;EAAE,QAAQ;EAAoB;CAAU;AAChD;;;;;;;ACnED,MAAa,sBAAsB,EAAE,OAAO;CAC1C,UAAU;CACV,aAAa,6BAA6B,UAAU;CACpD,aAAa,EAAE,QAAQ;CACvB,OAAO,EAAE,KAAK;EAAC;EAAW;EAAe;EAAY;EAAY;EAAkB;CAAS,EAAC,CAAC,UAAU;AACzG,EAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DF,SAAgB,mBACdC,SACAC,eACAC,QAIA;AACA,eAAc;CACd,MAAM,mBAAmB,SAAS,qBAAqB,QAAQ;CAC/D,MAAM,UAAU,iBAAwB;CACxC,MAAM,UAAU,IAAI,IAAI,iBAAiB,UAAU,UAAU;AAE7D,QAAO;EACL,QAAQ,IAAI,cAAc,SAAS;GACjC,GAAG;GACH,SAAS,cAAc,eAAe,SAAS;IAC7C,gBAAgB,iBAAiB;IACjC,yBAAyB,iBAAiB;GAC3C,EAAC;GACF,OAAQ,SAAS,cAAc,QAAQ,UAAU,MAAM,GAAG;EAC3D;EACD;CACD;AACF;;;;;;;;;;;;;;;;;;;;;;;;AAyBD,SAAgB,2BAA2BF,SAAwBE,QAAiB;AAClF,eAAc;CACd,MAAM,mBAAmB,SAAS,qBAAqB,QAAQ;CAC/D,MAAM,UAAU,4BAA4B,QAAQ,UAAU,cAAc;CAC5E,MAAM,gBAAgB,IAAI,KAAK,EAAE,QAAQ,eAAe,UAAU;CAClE,MAAM,gBAAgB,SAAS,cAAc,QAAQ,UAAU,MAAM,GAAG;AAExE,QAAO,OAAUC,UAAqD;EACpE,MAAM,WAAW,MAAM,cAAc,eAAe;GAClD,QAAQ;GACR,SAAS,cACP,EAAE,gBAAgB,mBAAoB,GACtC;IACE,gBAAgB,iBAAiB;IACjC,yBAAyB,iBAAiB;GAC3C,EACF;GACD,MAAM,KAAK,UAAU,MAAM;EAC5B,EAAC;AAEF,OAAK,SAAS,IAAI;AAChB,UAAO;IAAE,IAAI;IAAO,MAAO,MAAM,SAAS,MAAM;GAAQ;EACzD;AAED,SAAO;GAAE,IAAI;GAAM,MAAO,MAAM,SAAS,MAAM;EAAQ;CACxD;AACF"}
|
|
1
|
+
{"version":3,"file":"hasura.js","names":["options: ClientOptions","clientOptions?: RequestConfig","logger?: Logger"],"sources":["../src/hasura.ts"],"sourcesContent":["import { appendHeaders } from \"@settlemint/sdk-utils/http\";\nimport { type Logger, requestLogger } from \"@settlemint/sdk-utils/logging\";\nimport { ensureServer } from \"@settlemint/sdk-utils/runtime\";\nimport { ApplicationAccessTokenSchema, UrlOrPathSchema, validate } from \"@settlemint/sdk-utils/validation\";\nimport { type AbstractSetupSchema, initGraphQLTada } from \"gql.tada\";\nimport { GraphQLClient } from \"graphql-request\";\nimport { z } from \"zod/v4\";\n\n/**\n * Type definition for GraphQL client configuration options\n */\nexport type RequestConfig = ConstructorParameters<typeof GraphQLClient>[1];\n\n/**\n * Schema for validating client options for the Hasura client.\n */\nexport const ClientOptionsSchema = z.object({\n instance: UrlOrPathSchema,\n accessToken: ApplicationAccessTokenSchema.optional(),\n adminSecret: z.string(),\n cache: z.enum([\"default\", \"force-cache\", \"no-cache\", \"no-store\", \"only-if-cached\", \"reload\"]).optional(),\n});\n\n/**\n * Type definition for client options derived from the ClientOptionsSchema.\n */\nexport type ClientOptions = z.infer<typeof ClientOptionsSchema>;\n\n/**\n * Creates a Hasura GraphQL client with proper type safety using gql.tada\n *\n * @param options - Configuration options for the client\n * @param clientOptions - Optional GraphQL client configuration options\n * @param logger - Optional logger to use for logging the requests\n * @returns An object containing:\n * - client: The configured GraphQL client instance\n * - graphql: The initialized gql.tada function for type-safe queries\n * @throws Will throw an error if the options fail validation against ClientOptionsSchema\n * @example\n * import { createHasuraClient } from '@settlemint/sdk-hasura';\n * import type { introspection } from \"@schemas/hasura-env\";\n * import { createLogger, requestLogger } from \"@settlemint/sdk-utils/logging\";\n *\n * const logger = createLogger();\n *\n * const { client, graphql } = createHasuraClient<{\n * introspection: introspection;\n * disableMasking: true;\n * scalars: {\n * timestamp: string;\n * timestampz: string;\n * uuid: string;\n * date: string;\n * time: string;\n * jsonb: string;\n * numeric: string;\n * interval: string;\n * geometry: string;\n * geography: string;\n * };\n * }>({\n * instance: process.env.SETTLEMINT_HASURA_ENDPOINT,\n * accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,\n * adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET,\n * }, {\n * fetch: requestLogger(logger, \"hasura\", fetch) as typeof fetch,\n * });\n *\n * // Making GraphQL queries\n * const query = graphql(`\n * query GetUsers {\n * users {\n * id\n * name\n * email\n * }\n * }\n * `);\n *\n * const result = await client.request(query);\n */\nexport function createHasuraClient<const Setup extends AbstractSetupSchema>(\n options: ClientOptions,\n clientOptions?: RequestConfig,\n logger?: Logger,\n): {\n client: GraphQLClient;\n graphql: initGraphQLTada<Setup>;\n} {\n ensureServer();\n const validatedOptions = validate(ClientOptionsSchema, options);\n const graphql = initGraphQLTada<Setup>();\n const fullUrl = new URL(validatedOptions.instance).toString();\n\n return {\n client: new GraphQLClient(fullUrl, {\n ...clientOptions,\n headers: appendHeaders(clientOptions?.headers, {\n \"x-auth-token\": validatedOptions.accessToken,\n \"x-hasura-admin-secret\": validatedOptions.adminSecret,\n }),\n fetch: (logger ? requestLogger(logger, \"hasura\", fetch) : fetch) as typeof fetch,\n }),\n graphql,\n };\n}\n\nexport { readFragment } from \"gql.tada\";\nexport type { FragmentOf, ResultOf, VariablesOf } from \"gql.tada\";\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAa,sBAAsB,EAAE,OAAO;CAC1C,UAAU;CACV,aAAa,6BAA6B,UAAU;CACpD,aAAa,EAAE,QAAQ;CACvB,OAAO,EAAE,KAAK;EAAC;EAAW;EAAe;EAAY;EAAY;EAAkB;CAAS,EAAC,CAAC,UAAU;AACzG,EAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DF,SAAgB,mBACdA,SACAC,eACAC,QAIA;AACA,eAAc;CACd,MAAM,mBAAmB,SAAS,qBAAqB,QAAQ;CAC/D,MAAM,UAAU,iBAAwB;CACxC,MAAM,UAAU,IAAI,IAAI,iBAAiB,UAAU,UAAU;AAE7D,QAAO;EACL,QAAQ,IAAI,cAAc,SAAS;GACjC,GAAG;GACH,SAAS,cAAc,eAAe,SAAS;IAC7C,gBAAgB,iBAAiB;IACjC,yBAAyB,iBAAiB;GAC3C,EAAC;GACF,OAAQ,SAAS,cAAc,QAAQ,UAAU,MAAM,GAAG;EAC3D;EACD;CACD;AACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@settlemint/sdk-hasura",
|
|
3
3
|
"description": "Hasura and PostgreSQL integration module for SettleMint SDK, enabling database operations and GraphQL queries",
|
|
4
|
-
"version": "2.4.1-
|
|
4
|
+
"version": "2.4.1-pr79cb50b0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
7
7
|
"license": "FSL-1.1-MIT",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"gql.tada": "^1",
|
|
69
|
-
"@settlemint/sdk-utils": "2.4.1-
|
|
69
|
+
"@settlemint/sdk-utils": "2.4.1-pr79cb50b0",
|
|
70
70
|
"graphql-request": "^7",
|
|
71
71
|
"zod": "^3.25.0",
|
|
72
72
|
"drizzle-orm": "^0.44.0",
|