@turtleclub/hooks 0.5.0-beta.95 → 0.5.0-beta.96
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/dist/index.cjs +58 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +53 -17
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/v2/streams/api.ts +22 -0
- package/src/v2/streams/hooks.ts +17 -2
- package/src/v2/streams/index.ts +3 -0
- package/src/v2/streams/mutations.ts +20 -0
- package/src/v2/streams/queries.ts +1 -18
- package/src/v2/streams/schemas.ts +20 -5
package/dist/index.cjs
CHANGED
|
@@ -166,7 +166,6 @@ __export(index_exports, {
|
|
|
166
166
|
orgUserLeaderboardResponseSchema: () => orgUserLeaderboardResponseSchema,
|
|
167
167
|
organizationSchema: () => organizationSchema,
|
|
168
168
|
organizationsMutations: () => organizationsMutations,
|
|
169
|
-
outputSchema: () => outputSchema,
|
|
170
169
|
paginationSchema: () => paginationSchema,
|
|
171
170
|
pauseStreamSnapshotComputation: () => pauseStreamSnapshotComputation,
|
|
172
171
|
pauseStreamSnapshotComputationBodySchema: () => pauseStreamSnapshotComputationBodySchema,
|
|
@@ -195,6 +194,10 @@ __export(index_exports, {
|
|
|
195
194
|
snapshotSchema: () => snapshotSchema,
|
|
196
195
|
stakingConfigSchema: () => stakingConfigSchema,
|
|
197
196
|
stepTx: () => stepTx,
|
|
197
|
+
stopStream: () => stopStream,
|
|
198
|
+
stopStreamBodySchema: () => stopStreamBodySchema,
|
|
199
|
+
stopStreamInputSchema: () => stopStreamInputSchema,
|
|
200
|
+
stopStreamOutputSchema: () => stopStreamOutputSchema,
|
|
198
201
|
streamPointSchema: () => streamPointSchema,
|
|
199
202
|
streamSchema: () => streamSchema,
|
|
200
203
|
streamSignatureRequestInputSchema: () => streamSignatureRequestInputSchema,
|
|
@@ -278,6 +281,7 @@ __export(index_exports, {
|
|
|
278
281
|
usePortfolioBalance: () => usePortfolioBalance,
|
|
279
282
|
useProduct: () => useProduct,
|
|
280
283
|
useProducts: () => useProducts,
|
|
284
|
+
useStopStream: () => useStopStream,
|
|
281
285
|
useStreamPoints: () => useStreamPoints,
|
|
282
286
|
useStreamSupportedChains: () => useStreamSupportedChains,
|
|
283
287
|
useStreamWalletDetails: () => useStreamWalletDetails,
|
|
@@ -889,9 +893,6 @@ var stakingConfigSchema = import_zod7.z.object({
|
|
|
889
893
|
// src/v2/streams/hooks.ts
|
|
890
894
|
var import_react_query4 = require("@tanstack/react-query");
|
|
891
895
|
|
|
892
|
-
// src/v2/streams/queries.ts
|
|
893
|
-
var import_query_key_factory3 = require("@lukemorales/query-key-factory");
|
|
894
|
-
|
|
895
896
|
// src/v2/streams/schemas.ts
|
|
896
897
|
var import_zod8 = require("zod");
|
|
897
898
|
var customArgsBaseSchema = import_zod8.z.object({
|
|
@@ -1170,16 +1171,26 @@ var pauseStreamSnapshotComputationBodySchema = import_zod8.z.object({
|
|
|
1170
1171
|
streamId: import_zod8.z.string().uuid(),
|
|
1171
1172
|
snapshotComputationPaused: import_zod8.z.boolean()
|
|
1172
1173
|
});
|
|
1173
|
-
var
|
|
1174
|
-
|
|
1175
|
-
|
|
1174
|
+
var stopStreamInputSchema = import_zod8.z.object({
|
|
1175
|
+
organizationId: import_zod8.z.string().uuid(),
|
|
1176
|
+
streamId: import_zod8.z.string().uuid(),
|
|
1177
|
+
stopStream: import_zod8.z.boolean()
|
|
1178
|
+
});
|
|
1179
|
+
var stopStreamBodySchema = import_zod8.z.object({
|
|
1180
|
+
streamId: import_zod8.z.string().uuid(),
|
|
1181
|
+
stopStream: import_zod8.z.boolean()
|
|
1176
1182
|
});
|
|
1177
|
-
var pauseStreamSnapshotComputationOutputSchema = outputSchema;
|
|
1178
1183
|
var deleteStreamInputSchema = import_zod8.z.object({
|
|
1179
1184
|
organizationId: import_zod8.z.string().uuid(),
|
|
1180
1185
|
streamId: import_zod8.z.string().uuid()
|
|
1181
1186
|
});
|
|
1182
|
-
var
|
|
1187
|
+
var updateStreamOutputSchema = import_zod8.z.object({
|
|
1188
|
+
success: import_zod8.z.boolean(),
|
|
1189
|
+
message: import_zod8.z.string()
|
|
1190
|
+
});
|
|
1191
|
+
var pauseStreamSnapshotComputationOutputSchema = updateStreamOutputSchema;
|
|
1192
|
+
var stopStreamOutputSchema = updateStreamOutputSchema;
|
|
1193
|
+
var deleteStreamOutputSchema = updateStreamOutputSchema;
|
|
1183
1194
|
|
|
1184
1195
|
// src/v2/streams/api.ts
|
|
1185
1196
|
async function getStreams(query) {
|
|
@@ -1297,6 +1308,18 @@ async function pauseStreamSnapshotComputation(organizationId, body) {
|
|
|
1297
1308
|
}
|
|
1298
1309
|
return result.data;
|
|
1299
1310
|
}
|
|
1311
|
+
async function stopStream(organizationId, body) {
|
|
1312
|
+
const endpoint = `/streams/${organizationId}`;
|
|
1313
|
+
const data = await apiClient.fetch(endpoint, {
|
|
1314
|
+
method: "PATCH",
|
|
1315
|
+
body
|
|
1316
|
+
});
|
|
1317
|
+
const result = stopStreamOutputSchema.safeParse(data);
|
|
1318
|
+
if (!result.success) {
|
|
1319
|
+
throw new Error(`Failed to parse stop stream response: ${result.error.message}`);
|
|
1320
|
+
}
|
|
1321
|
+
return result.data;
|
|
1322
|
+
}
|
|
1300
1323
|
async function deleteStream(organizationId, streamId) {
|
|
1301
1324
|
const endpoint = `/streams/${organizationId}/${streamId}`;
|
|
1302
1325
|
const data = await apiClient.fetch(endpoint, {
|
|
@@ -1309,7 +1332,21 @@ async function deleteStream(organizationId, streamId) {
|
|
|
1309
1332
|
return result.data;
|
|
1310
1333
|
}
|
|
1311
1334
|
|
|
1335
|
+
// src/v2/streams/mutations.ts
|
|
1336
|
+
var streamsMutations = {
|
|
1337
|
+
pauseSnapshotComputation: (input) => pauseStreamSnapshotComputation(input.organizationId, {
|
|
1338
|
+
streamId: input.streamId,
|
|
1339
|
+
snapshotComputationPaused: input.snapshotComputationPaused
|
|
1340
|
+
}),
|
|
1341
|
+
stop: (input) => stopStream(input.organizationId, {
|
|
1342
|
+
streamId: input.streamId,
|
|
1343
|
+
stopStream: input.stopStream
|
|
1344
|
+
}),
|
|
1345
|
+
deleteStream: (input) => deleteStream(input.organizationId, input.streamId)
|
|
1346
|
+
};
|
|
1347
|
+
|
|
1312
1348
|
// src/v2/streams/queries.ts
|
|
1349
|
+
var import_query_key_factory3 = require("@lukemorales/query-key-factory");
|
|
1313
1350
|
var streamsQueries = (0, import_query_key_factory3.createQueryKeys)("streams", {
|
|
1314
1351
|
list: (query) => ({
|
|
1315
1352
|
queryKey: [query ?? "all"],
|
|
@@ -1332,13 +1369,6 @@ var streamsQueries = (0, import_query_key_factory3.createQueryKeys)("streams", {
|
|
|
1332
1369
|
queryFn: () => getStreamsSupportedChains()
|
|
1333
1370
|
}
|
|
1334
1371
|
});
|
|
1335
|
-
var streamsMutations = {
|
|
1336
|
-
pauseSnapshotComputation: (input) => pauseStreamSnapshotComputation(input.organizationId, {
|
|
1337
|
-
streamId: input.streamId,
|
|
1338
|
-
snapshotComputationPaused: input.snapshotComputationPaused
|
|
1339
|
-
}),
|
|
1340
|
-
delete: (input) => deleteStream(input.organizationId, input.streamId)
|
|
1341
|
-
};
|
|
1342
1372
|
|
|
1343
1373
|
// src/v2/streams/hooks.ts
|
|
1344
1374
|
function useStreams({
|
|
@@ -1376,9 +1406,15 @@ function usePauseStreamSnapshotComputation(options) {
|
|
|
1376
1406
|
...options
|
|
1377
1407
|
});
|
|
1378
1408
|
}
|
|
1409
|
+
function useStopStream(options) {
|
|
1410
|
+
return (0, import_react_query4.useMutation)({
|
|
1411
|
+
mutationFn: streamsMutations.stop,
|
|
1412
|
+
...options
|
|
1413
|
+
});
|
|
1414
|
+
}
|
|
1379
1415
|
function useDeleteStream(options) {
|
|
1380
1416
|
return (0, import_react_query4.useMutation)({
|
|
1381
|
-
mutationFn: streamsMutations.
|
|
1417
|
+
mutationFn: streamsMutations.deleteStream,
|
|
1382
1418
|
...options
|
|
1383
1419
|
});
|
|
1384
1420
|
}
|
|
@@ -5071,7 +5107,6 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
5071
5107
|
orgUserLeaderboardResponseSchema,
|
|
5072
5108
|
organizationSchema,
|
|
5073
5109
|
organizationsMutations,
|
|
5074
|
-
outputSchema,
|
|
5075
5110
|
paginationSchema,
|
|
5076
5111
|
pauseStreamSnapshotComputation,
|
|
5077
5112
|
pauseStreamSnapshotComputationBodySchema,
|
|
@@ -5100,6 +5135,10 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
5100
5135
|
snapshotSchema,
|
|
5101
5136
|
stakingConfigSchema,
|
|
5102
5137
|
stepTx,
|
|
5138
|
+
stopStream,
|
|
5139
|
+
stopStreamBodySchema,
|
|
5140
|
+
stopStreamInputSchema,
|
|
5141
|
+
stopStreamOutputSchema,
|
|
5103
5142
|
streamPointSchema,
|
|
5104
5143
|
streamSchema,
|
|
5105
5144
|
streamSignatureRequestInputSchema,
|
|
@@ -5183,6 +5222,7 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
5183
5222
|
usePortfolioBalance,
|
|
5184
5223
|
useProduct,
|
|
5185
5224
|
useProducts,
|
|
5225
|
+
useStopStream,
|
|
5186
5226
|
useStreamPoints,
|
|
5187
5227
|
useStreamSupportedChains,
|
|
5188
5228
|
useStreamWalletDetails,
|