@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.js
CHANGED
|
@@ -572,9 +572,6 @@ var stakingConfigSchema = z7.object({
|
|
|
572
572
|
// src/v2/streams/hooks.ts
|
|
573
573
|
import { useMutation as useMutation2, useQuery as useQuery3 } from "@tanstack/react-query";
|
|
574
574
|
|
|
575
|
-
// src/v2/streams/queries.ts
|
|
576
|
-
import { createQueryKeys as createQueryKeys3 } from "@lukemorales/query-key-factory";
|
|
577
|
-
|
|
578
575
|
// src/v2/streams/schemas.ts
|
|
579
576
|
import { z as z8 } from "zod";
|
|
580
577
|
var customArgsBaseSchema = z8.object({
|
|
@@ -853,16 +850,26 @@ var pauseStreamSnapshotComputationBodySchema = z8.object({
|
|
|
853
850
|
streamId: z8.string().uuid(),
|
|
854
851
|
snapshotComputationPaused: z8.boolean()
|
|
855
852
|
});
|
|
856
|
-
var
|
|
857
|
-
|
|
858
|
-
|
|
853
|
+
var stopStreamInputSchema = z8.object({
|
|
854
|
+
organizationId: z8.string().uuid(),
|
|
855
|
+
streamId: z8.string().uuid(),
|
|
856
|
+
stopStream: z8.boolean()
|
|
857
|
+
});
|
|
858
|
+
var stopStreamBodySchema = z8.object({
|
|
859
|
+
streamId: z8.string().uuid(),
|
|
860
|
+
stopStream: z8.boolean()
|
|
859
861
|
});
|
|
860
|
-
var pauseStreamSnapshotComputationOutputSchema = outputSchema;
|
|
861
862
|
var deleteStreamInputSchema = z8.object({
|
|
862
863
|
organizationId: z8.string().uuid(),
|
|
863
864
|
streamId: z8.string().uuid()
|
|
864
865
|
});
|
|
865
|
-
var
|
|
866
|
+
var updateStreamOutputSchema = z8.object({
|
|
867
|
+
success: z8.boolean(),
|
|
868
|
+
message: z8.string()
|
|
869
|
+
});
|
|
870
|
+
var pauseStreamSnapshotComputationOutputSchema = updateStreamOutputSchema;
|
|
871
|
+
var stopStreamOutputSchema = updateStreamOutputSchema;
|
|
872
|
+
var deleteStreamOutputSchema = updateStreamOutputSchema;
|
|
866
873
|
|
|
867
874
|
// src/v2/streams/api.ts
|
|
868
875
|
async function getStreams(query) {
|
|
@@ -980,6 +987,18 @@ async function pauseStreamSnapshotComputation(organizationId, body) {
|
|
|
980
987
|
}
|
|
981
988
|
return result.data;
|
|
982
989
|
}
|
|
990
|
+
async function stopStream(organizationId, body) {
|
|
991
|
+
const endpoint = `/streams/${organizationId}`;
|
|
992
|
+
const data = await apiClient.fetch(endpoint, {
|
|
993
|
+
method: "PATCH",
|
|
994
|
+
body
|
|
995
|
+
});
|
|
996
|
+
const result = stopStreamOutputSchema.safeParse(data);
|
|
997
|
+
if (!result.success) {
|
|
998
|
+
throw new Error(`Failed to parse stop stream response: ${result.error.message}`);
|
|
999
|
+
}
|
|
1000
|
+
return result.data;
|
|
1001
|
+
}
|
|
983
1002
|
async function deleteStream(organizationId, streamId) {
|
|
984
1003
|
const endpoint = `/streams/${organizationId}/${streamId}`;
|
|
985
1004
|
const data = await apiClient.fetch(endpoint, {
|
|
@@ -992,7 +1011,21 @@ async function deleteStream(organizationId, streamId) {
|
|
|
992
1011
|
return result.data;
|
|
993
1012
|
}
|
|
994
1013
|
|
|
1014
|
+
// src/v2/streams/mutations.ts
|
|
1015
|
+
var streamsMutations = {
|
|
1016
|
+
pauseSnapshotComputation: (input) => pauseStreamSnapshotComputation(input.organizationId, {
|
|
1017
|
+
streamId: input.streamId,
|
|
1018
|
+
snapshotComputationPaused: input.snapshotComputationPaused
|
|
1019
|
+
}),
|
|
1020
|
+
stop: (input) => stopStream(input.organizationId, {
|
|
1021
|
+
streamId: input.streamId,
|
|
1022
|
+
stopStream: input.stopStream
|
|
1023
|
+
}),
|
|
1024
|
+
deleteStream: (input) => deleteStream(input.organizationId, input.streamId)
|
|
1025
|
+
};
|
|
1026
|
+
|
|
995
1027
|
// src/v2/streams/queries.ts
|
|
1028
|
+
import { createQueryKeys as createQueryKeys3 } from "@lukemorales/query-key-factory";
|
|
996
1029
|
var streamsQueries = createQueryKeys3("streams", {
|
|
997
1030
|
list: (query) => ({
|
|
998
1031
|
queryKey: [query ?? "all"],
|
|
@@ -1015,13 +1048,6 @@ var streamsQueries = createQueryKeys3("streams", {
|
|
|
1015
1048
|
queryFn: () => getStreamsSupportedChains()
|
|
1016
1049
|
}
|
|
1017
1050
|
});
|
|
1018
|
-
var streamsMutations = {
|
|
1019
|
-
pauseSnapshotComputation: (input) => pauseStreamSnapshotComputation(input.organizationId, {
|
|
1020
|
-
streamId: input.streamId,
|
|
1021
|
-
snapshotComputationPaused: input.snapshotComputationPaused
|
|
1022
|
-
}),
|
|
1023
|
-
delete: (input) => deleteStream(input.organizationId, input.streamId)
|
|
1024
|
-
};
|
|
1025
1051
|
|
|
1026
1052
|
// src/v2/streams/hooks.ts
|
|
1027
1053
|
function useStreams({
|
|
@@ -1059,9 +1085,15 @@ function usePauseStreamSnapshotComputation(options) {
|
|
|
1059
1085
|
...options
|
|
1060
1086
|
});
|
|
1061
1087
|
}
|
|
1088
|
+
function useStopStream(options) {
|
|
1089
|
+
return useMutation2({
|
|
1090
|
+
mutationFn: streamsMutations.stop,
|
|
1091
|
+
...options
|
|
1092
|
+
});
|
|
1093
|
+
}
|
|
1062
1094
|
function useDeleteStream(options) {
|
|
1063
1095
|
return useMutation2({
|
|
1064
|
-
mutationFn: streamsMutations.
|
|
1096
|
+
mutationFn: streamsMutations.deleteStream,
|
|
1065
1097
|
...options
|
|
1066
1098
|
});
|
|
1067
1099
|
}
|
|
@@ -4756,7 +4788,6 @@ export {
|
|
|
4756
4788
|
orgUserLeaderboardResponseSchema,
|
|
4757
4789
|
organizationSchema,
|
|
4758
4790
|
organizationsMutations,
|
|
4759
|
-
outputSchema,
|
|
4760
4791
|
paginationSchema,
|
|
4761
4792
|
pauseStreamSnapshotComputation,
|
|
4762
4793
|
pauseStreamSnapshotComputationBodySchema,
|
|
@@ -4785,6 +4816,10 @@ export {
|
|
|
4785
4816
|
snapshotSchema,
|
|
4786
4817
|
stakingConfigSchema,
|
|
4787
4818
|
stepTx,
|
|
4819
|
+
stopStream,
|
|
4820
|
+
stopStreamBodySchema,
|
|
4821
|
+
stopStreamInputSchema,
|
|
4822
|
+
stopStreamOutputSchema,
|
|
4788
4823
|
streamPointSchema,
|
|
4789
4824
|
streamSchema,
|
|
4790
4825
|
streamSignatureRequestInputSchema,
|
|
@@ -4868,6 +4903,7 @@ export {
|
|
|
4868
4903
|
usePortfolioBalance,
|
|
4869
4904
|
useProduct,
|
|
4870
4905
|
useProducts,
|
|
4906
|
+
useStopStream,
|
|
4871
4907
|
useStreamPoints,
|
|
4872
4908
|
useStreamSupportedChains,
|
|
4873
4909
|
useStreamWalletDetails,
|