@turtleclub/hooks 0.5.0-beta.95 → 0.5.0-beta.97
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 +66 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +61 -17
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/v2/organizations/schema.ts +10 -0
- 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,
|
|
@@ -799,6 +803,14 @@ var organizationSchema = import_zod6.z.object({
|
|
|
799
803
|
landingUrl: import_zod6.z.string().optional().nullable(),
|
|
800
804
|
iconUrl: import_zod6.z.string().optional().nullable(),
|
|
801
805
|
organizationType: import_zod6.z.string().optional().nullable(),
|
|
806
|
+
organizationPermissions: import_zod6.z.array(
|
|
807
|
+
import_zod6.z.object({
|
|
808
|
+
id: import_zod6.z.string().uuid(),
|
|
809
|
+
permissionId: import_zod6.z.string().uuid(),
|
|
810
|
+
status: import_zod6.z.enum(["revoked", "approved"]),
|
|
811
|
+
permissionName: import_zod6.z.string()
|
|
812
|
+
})
|
|
813
|
+
).optional(),
|
|
802
814
|
turtleRefCode: import_zod6.z.string().optional().nullable(),
|
|
803
815
|
twitterHandle: import_zod6.z.string().optional().nullable(),
|
|
804
816
|
status: import_zod6.z.string().optional().nullable(),
|
|
@@ -889,9 +901,6 @@ var stakingConfigSchema = import_zod7.z.object({
|
|
|
889
901
|
// src/v2/streams/hooks.ts
|
|
890
902
|
var import_react_query4 = require("@tanstack/react-query");
|
|
891
903
|
|
|
892
|
-
// src/v2/streams/queries.ts
|
|
893
|
-
var import_query_key_factory3 = require("@lukemorales/query-key-factory");
|
|
894
|
-
|
|
895
904
|
// src/v2/streams/schemas.ts
|
|
896
905
|
var import_zod8 = require("zod");
|
|
897
906
|
var customArgsBaseSchema = import_zod8.z.object({
|
|
@@ -1170,16 +1179,26 @@ var pauseStreamSnapshotComputationBodySchema = import_zod8.z.object({
|
|
|
1170
1179
|
streamId: import_zod8.z.string().uuid(),
|
|
1171
1180
|
snapshotComputationPaused: import_zod8.z.boolean()
|
|
1172
1181
|
});
|
|
1173
|
-
var
|
|
1174
|
-
|
|
1175
|
-
|
|
1182
|
+
var stopStreamInputSchema = import_zod8.z.object({
|
|
1183
|
+
organizationId: import_zod8.z.string().uuid(),
|
|
1184
|
+
streamId: import_zod8.z.string().uuid(),
|
|
1185
|
+
stopStream: import_zod8.z.boolean()
|
|
1186
|
+
});
|
|
1187
|
+
var stopStreamBodySchema = import_zod8.z.object({
|
|
1188
|
+
streamId: import_zod8.z.string().uuid(),
|
|
1189
|
+
stopStream: import_zod8.z.boolean()
|
|
1176
1190
|
});
|
|
1177
|
-
var pauseStreamSnapshotComputationOutputSchema = outputSchema;
|
|
1178
1191
|
var deleteStreamInputSchema = import_zod8.z.object({
|
|
1179
1192
|
organizationId: import_zod8.z.string().uuid(),
|
|
1180
1193
|
streamId: import_zod8.z.string().uuid()
|
|
1181
1194
|
});
|
|
1182
|
-
var
|
|
1195
|
+
var updateStreamOutputSchema = import_zod8.z.object({
|
|
1196
|
+
success: import_zod8.z.boolean(),
|
|
1197
|
+
message: import_zod8.z.string()
|
|
1198
|
+
});
|
|
1199
|
+
var pauseStreamSnapshotComputationOutputSchema = updateStreamOutputSchema;
|
|
1200
|
+
var stopStreamOutputSchema = updateStreamOutputSchema;
|
|
1201
|
+
var deleteStreamOutputSchema = updateStreamOutputSchema;
|
|
1183
1202
|
|
|
1184
1203
|
// src/v2/streams/api.ts
|
|
1185
1204
|
async function getStreams(query) {
|
|
@@ -1297,6 +1316,18 @@ async function pauseStreamSnapshotComputation(organizationId, body) {
|
|
|
1297
1316
|
}
|
|
1298
1317
|
return result.data;
|
|
1299
1318
|
}
|
|
1319
|
+
async function stopStream(organizationId, body) {
|
|
1320
|
+
const endpoint = `/streams/${organizationId}`;
|
|
1321
|
+
const data = await apiClient.fetch(endpoint, {
|
|
1322
|
+
method: "PATCH",
|
|
1323
|
+
body
|
|
1324
|
+
});
|
|
1325
|
+
const result = stopStreamOutputSchema.safeParse(data);
|
|
1326
|
+
if (!result.success) {
|
|
1327
|
+
throw new Error(`Failed to parse stop stream response: ${result.error.message}`);
|
|
1328
|
+
}
|
|
1329
|
+
return result.data;
|
|
1330
|
+
}
|
|
1300
1331
|
async function deleteStream(organizationId, streamId) {
|
|
1301
1332
|
const endpoint = `/streams/${organizationId}/${streamId}`;
|
|
1302
1333
|
const data = await apiClient.fetch(endpoint, {
|
|
@@ -1309,7 +1340,21 @@ async function deleteStream(organizationId, streamId) {
|
|
|
1309
1340
|
return result.data;
|
|
1310
1341
|
}
|
|
1311
1342
|
|
|
1343
|
+
// src/v2/streams/mutations.ts
|
|
1344
|
+
var streamsMutations = {
|
|
1345
|
+
pauseSnapshotComputation: (input) => pauseStreamSnapshotComputation(input.organizationId, {
|
|
1346
|
+
streamId: input.streamId,
|
|
1347
|
+
snapshotComputationPaused: input.snapshotComputationPaused
|
|
1348
|
+
}),
|
|
1349
|
+
stop: (input) => stopStream(input.organizationId, {
|
|
1350
|
+
streamId: input.streamId,
|
|
1351
|
+
stopStream: input.stopStream
|
|
1352
|
+
}),
|
|
1353
|
+
deleteStream: (input) => deleteStream(input.organizationId, input.streamId)
|
|
1354
|
+
};
|
|
1355
|
+
|
|
1312
1356
|
// src/v2/streams/queries.ts
|
|
1357
|
+
var import_query_key_factory3 = require("@lukemorales/query-key-factory");
|
|
1313
1358
|
var streamsQueries = (0, import_query_key_factory3.createQueryKeys)("streams", {
|
|
1314
1359
|
list: (query) => ({
|
|
1315
1360
|
queryKey: [query ?? "all"],
|
|
@@ -1332,13 +1377,6 @@ var streamsQueries = (0, import_query_key_factory3.createQueryKeys)("streams", {
|
|
|
1332
1377
|
queryFn: () => getStreamsSupportedChains()
|
|
1333
1378
|
}
|
|
1334
1379
|
});
|
|
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
1380
|
|
|
1343
1381
|
// src/v2/streams/hooks.ts
|
|
1344
1382
|
function useStreams({
|
|
@@ -1376,9 +1414,15 @@ function usePauseStreamSnapshotComputation(options) {
|
|
|
1376
1414
|
...options
|
|
1377
1415
|
});
|
|
1378
1416
|
}
|
|
1417
|
+
function useStopStream(options) {
|
|
1418
|
+
return (0, import_react_query4.useMutation)({
|
|
1419
|
+
mutationFn: streamsMutations.stop,
|
|
1420
|
+
...options
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1379
1423
|
function useDeleteStream(options) {
|
|
1380
1424
|
return (0, import_react_query4.useMutation)({
|
|
1381
|
-
mutationFn: streamsMutations.
|
|
1425
|
+
mutationFn: streamsMutations.deleteStream,
|
|
1382
1426
|
...options
|
|
1383
1427
|
});
|
|
1384
1428
|
}
|
|
@@ -5071,7 +5115,6 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
5071
5115
|
orgUserLeaderboardResponseSchema,
|
|
5072
5116
|
organizationSchema,
|
|
5073
5117
|
organizationsMutations,
|
|
5074
|
-
outputSchema,
|
|
5075
5118
|
paginationSchema,
|
|
5076
5119
|
pauseStreamSnapshotComputation,
|
|
5077
5120
|
pauseStreamSnapshotComputationBodySchema,
|
|
@@ -5100,6 +5143,10 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
5100
5143
|
snapshotSchema,
|
|
5101
5144
|
stakingConfigSchema,
|
|
5102
5145
|
stepTx,
|
|
5146
|
+
stopStream,
|
|
5147
|
+
stopStreamBodySchema,
|
|
5148
|
+
stopStreamInputSchema,
|
|
5149
|
+
stopStreamOutputSchema,
|
|
5103
5150
|
streamPointSchema,
|
|
5104
5151
|
streamSchema,
|
|
5105
5152
|
streamSignatureRequestInputSchema,
|
|
@@ -5183,6 +5230,7 @@ var queries = (0, import_query_key_factory22.mergeQueryKeys)(
|
|
|
5183
5230
|
usePortfolioBalance,
|
|
5184
5231
|
useProduct,
|
|
5185
5232
|
useProducts,
|
|
5233
|
+
useStopStream,
|
|
5186
5234
|
useStreamPoints,
|
|
5187
5235
|
useStreamSupportedChains,
|
|
5188
5236
|
useStreamWalletDetails,
|