@sudobility/shapeshyft_client 0.0.54 → 0.0.56
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/hooks/useAiExecute.d.ts.map +1 -1
- package/dist/hooks/useAiExecute.js +51 -60
- package/dist/hooks/useAiExecute.js.map +1 -1
- package/dist/hooks/useAnalytics.d.ts +6 -2
- package/dist/hooks/useAnalytics.d.ts.map +1 -1
- package/dist/hooks/useAnalytics.js +27 -33
- package/dist/hooks/useAnalytics.js.map +1 -1
- package/dist/hooks/useEndpoints.d.ts +10 -6
- package/dist/hooks/useEndpoints.d.ts.map +1 -1
- package/dist/hooks/useEndpoints.js +87 -121
- package/dist/hooks/useEndpoints.js.map +1 -1
- package/dist/hooks/useEntities.d.ts +18 -15
- package/dist/hooks/useEntities.d.ts.map +1 -1
- package/dist/hooks/useEntities.js +235 -332
- package/dist/hooks/useEntities.js.map +1 -1
- package/dist/hooks/useKeys.d.ts +9 -6
- package/dist/hooks/useKeys.d.ts.map +1 -1
- package/dist/hooks/useKeys.js +82 -117
- package/dist/hooks/useKeys.js.map +1 -1
- package/dist/hooks/useProjects.d.ts +12 -8
- package/dist/hooks/useProjects.d.ts.map +1 -1
- package/dist/hooks/useProjects.js +103 -157
- package/dist/hooks/useProjects.js.map +1 -1
- package/dist/hooks/useSettings.d.ts +6 -3
- package/dist/hooks/useSettings.d.ts.map +1 -1
- package/dist/hooks/useSettings.js +53 -56
- package/dist/hooks/useSettings.js.map +1 -1
- package/dist/hooks/useStorageConfig.d.ts +8 -5
- package/dist/hooks/useStorageConfig.d.ts.map +1 -1
- package/dist/hooks/useStorageConfig.js +93 -119
- package/dist/hooks/useStorageConfig.js.map +1 -1
- package/dist/types.d.ts +8 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +8 -6
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAiExecute.d.ts","sourceRoot":"","sources":["../../src/hooks/useAiExecute.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAiExecute.d.ts","sourceRoot":"","sources":["../../src/hooks/useAiExecute.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,aAAa,EACb,QAAQ,EACT,MAAM,8BAA8B,CAAC;AAMtC,MAAM,MAAM,QAAQ,GAAG,mBAAmB,GAAG,gBAAgB,CAAC;AAK9D,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAExB,OAAO,EAAE,CACP,gBAAgB,EAAE,MAAM,EACxB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,UAAU,EACnB,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,KACb,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IAErC,SAAS,EAAE,CACT,gBAAgB,EAAE,MAAM,EACxB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,KACb,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAE7C,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAyBD,eAAO,MAAM,YAAY,GACvB,eAAe,aAAa,EAC5B,SAAS,MAAM,EACf,WAAU,OAAe,KACxB,kBAsHF,CAAC"}
|
|
@@ -1,74 +1,65 @@
|
|
|
1
|
-
import { useCallback, useMemo
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
|
+
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import { ShapeshyftClient } from '../network/ShapeshyftClient';
|
|
3
4
|
export const useAiExecute = (networkClient, baseUrl, testMode = false) => {
|
|
4
5
|
const client = useMemo(() => new ShapeshyftClient({ baseUrl, networkClient, testMode }), [baseUrl, networkClient, testMode]);
|
|
5
|
-
const
|
|
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
|
-
const
|
|
36
|
-
|
|
37
|
-
setError(null);
|
|
38
|
-
try {
|
|
39
|
-
const response = await client.getAiPrompt(organizationPath, projectName, endpointName, input, apiKey, timeout);
|
|
40
|
-
return response;
|
|
41
|
-
}
|
|
42
|
-
catch (err) {
|
|
43
|
-
const errorMessage = err instanceof Error ? err.message : 'Failed to get prompt';
|
|
44
|
-
setError(errorMessage);
|
|
45
|
-
console.error('[useAiExecute] getPrompt error:', errorMessage, err);
|
|
46
|
-
return {
|
|
47
|
-
success: false,
|
|
48
|
-
error: errorMessage,
|
|
49
|
-
timestamp: new Date().toISOString(),
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
finally {
|
|
53
|
-
setIsLoading(false);
|
|
54
|
-
}
|
|
55
|
-
}, [client]);
|
|
6
|
+
const executeMutation = useMutation({
|
|
7
|
+
mutationFn: async (params) => {
|
|
8
|
+
return client.executeAi(params.organizationPath, params.projectName, params.endpointName, params.input, params.method, params.apiKey, params.timeout);
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
const promptMutation = useMutation({
|
|
12
|
+
mutationFn: async (params) => {
|
|
13
|
+
return client.getAiPrompt(params.organizationPath, params.projectName, params.endpointName, params.input, params.apiKey, params.timeout);
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
const execute = useCallback((organizationPath, projectName, endpointName, input, method = 'POST', apiKey, timeout) => executeMutation.mutateAsync({
|
|
17
|
+
organizationPath,
|
|
18
|
+
projectName,
|
|
19
|
+
endpointName,
|
|
20
|
+
input,
|
|
21
|
+
method,
|
|
22
|
+
apiKey,
|
|
23
|
+
timeout,
|
|
24
|
+
}), [executeMutation]);
|
|
25
|
+
const getPrompt = useCallback((organizationPath, projectName, endpointName, input, apiKey, timeout) => promptMutation.mutateAsync({
|
|
26
|
+
organizationPath,
|
|
27
|
+
projectName,
|
|
28
|
+
endpointName,
|
|
29
|
+
input,
|
|
30
|
+
apiKey,
|
|
31
|
+
timeout,
|
|
32
|
+
}), [promptMutation]);
|
|
33
|
+
const executeData = executeMutation.data;
|
|
34
|
+
const result = executeData?.success && executeData.data ? executeData.data : null;
|
|
35
|
+
const mutationError = executeMutation.error ?? promptMutation.error;
|
|
36
|
+
const apiError = executeData && !executeData.success ? executeData.error : null;
|
|
37
|
+
const error = mutationError instanceof Error ? mutationError.message : (apiError ?? null);
|
|
56
38
|
const clearError = useCallback(() => {
|
|
57
|
-
|
|
58
|
-
|
|
39
|
+
executeMutation.reset();
|
|
40
|
+
promptMutation.reset();
|
|
41
|
+
}, [executeMutation, promptMutation]);
|
|
59
42
|
const reset = useCallback(() => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}, []);
|
|
43
|
+
executeMutation.reset();
|
|
44
|
+
promptMutation.reset();
|
|
45
|
+
}, [executeMutation, promptMutation]);
|
|
64
46
|
return useMemo(() => ({
|
|
65
47
|
result,
|
|
66
|
-
isLoading,
|
|
48
|
+
isLoading: executeMutation.isPending || promptMutation.isPending,
|
|
67
49
|
error,
|
|
68
50
|
execute,
|
|
69
51
|
getPrompt,
|
|
70
52
|
clearError,
|
|
71
53
|
reset,
|
|
72
|
-
}), [
|
|
54
|
+
}), [
|
|
55
|
+
result,
|
|
56
|
+
executeMutation.isPending,
|
|
57
|
+
promptMutation.isPending,
|
|
58
|
+
error,
|
|
59
|
+
execute,
|
|
60
|
+
getPrompt,
|
|
61
|
+
clearError,
|
|
62
|
+
reset,
|
|
63
|
+
]);
|
|
73
64
|
};
|
|
74
65
|
//# sourceMappingURL=useAiExecute.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAiExecute.js","sourceRoot":"","sources":["../../src/hooks/useAiExecute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useAiExecute.js","sourceRoot":"","sources":["../../src/hooks/useAiExecute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AASpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AA6D/D,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,aAA4B,EAC5B,OAAe,EACf,WAAoB,KAAK,EACL,EAAE;IACtB,MAAM,MAAM,GAAG,OAAO,CACpB,GAAG,EAAE,CAAC,IAAI,gBAAgB,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,EAChE,CAAC,OAAO,EAAE,aAAa,EAAE,QAAQ,CAAC,CACnC,CAAC;IAEF,MAAM,eAAe,GAAG,WAAW,CAAC;QAClC,UAAU,EAAE,KAAK,EAAE,MAAqB,EAAE,EAAE;YAC1C,OAAO,MAAM,CAAC,SAAS,CACrB,MAAM,CAAC,gBAAgB,EACvB,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,YAAY,EACnB,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,MAAM,EAC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,WAAW,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACjE,MAAM,KAAK,GACT,aAAa,YAAY,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC;IAE9E,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE;QAClC,eAAe,CAAC,KAAK,EAAE,CAAC;QACxB,cAAc,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC,EAAE,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC;IAEtC,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;QAC7B,eAAe,CAAC,KAAK,EAAE,CAAC;QACxB,cAAc,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC,EAAE,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC;IAEtC,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,MAAM;QACN,SAAS,EAAE,eAAe,CAAC,SAAS,IAAI,cAAc,CAAC,SAAS;QAChE,KAAK;QACL,OAAO;QACP,SAAS;QACT,UAAU;QACV,KAAK;KACN,CAAC,EACF;QACE,MAAM;QACN,eAAe,CAAC,SAAS;QACzB,cAAc,CAAC,SAAS;QACxB,KAAK;QACL,OAAO;QACP,SAAS;QACT,UAAU;QACV,KAAK;KACN,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -4,9 +4,13 @@ export interface UseAnalyticsReturn {
|
|
|
4
4
|
analytics: Optional<AnalyticsResponse>;
|
|
5
5
|
isLoading: boolean;
|
|
6
6
|
error: Optional<string>;
|
|
7
|
-
|
|
7
|
+
refetch: () => void;
|
|
8
8
|
clearError: () => void;
|
|
9
9
|
reset: () => void;
|
|
10
10
|
}
|
|
11
|
-
export declare const useAnalytics: (networkClient: NetworkClient, baseUrl: string,
|
|
11
|
+
export declare const useAnalytics: (networkClient: NetworkClient, baseUrl: string, userId: string | null, token: FirebaseIdToken | null, options?: {
|
|
12
|
+
testMode?: boolean;
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
params?: UsageAnalyticsQueryParams;
|
|
15
|
+
}) => UseAnalyticsReturn;
|
|
12
16
|
//# sourceMappingURL=useAnalytics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAnalytics.d.ts","sourceRoot":"","sources":["../../src/hooks/useAnalytics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAnalytics.d.ts","sourceRoot":"","sources":["../../src/hooks/useAnalytics.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,yBAAyB,EAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAOhD,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IACvC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAExB,OAAO,EAAE,MAAM,IAAI,CAAC;IAEpB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAMD,eAAO,MAAM,YAAY,GACvB,eAAe,aAAa,EAC5B,SAAS,MAAM,EACf,QAAQ,MAAM,GAAG,IAAI,EACrB,OAAO,eAAe,GAAG,IAAI,EAC7B,UAAU;IACR,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,yBAAyB,CAAC;CACpC,KACA,kBAyDF,CAAC"}
|
|
@@ -1,46 +1,40 @@
|
|
|
1
|
-
import { useCallback, useMemo
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
|
+
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
2
3
|
import { ShapeshyftClient } from '../network/ShapeshyftClient';
|
|
3
|
-
|
|
4
|
+
import { QUERY_KEYS } from '../types';
|
|
5
|
+
export const useAnalytics = (networkClient, baseUrl, userId, token, options) => {
|
|
6
|
+
const testMode = options?.testMode ?? false;
|
|
7
|
+
const enabled = (options?.enabled ?? true) && !!userId && !!token;
|
|
4
8
|
const client = useMemo(() => new ShapeshyftClient({ baseUrl, networkClient, testMode }), [baseUrl, networkClient, testMode]);
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const response = await client.getAnalytics(userId, token, params);
|
|
13
|
-
if (response.success && response.data) {
|
|
14
|
-
setAnalytics(response.data);
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const { data, isLoading, error: queryError, refetch, } = useQuery({
|
|
11
|
+
queryKey: QUERY_KEYS.analytics(userId ?? ''),
|
|
12
|
+
queryFn: async () => {
|
|
13
|
+
const response = await client.getAnalytics(userId, token, options?.params);
|
|
14
|
+
if (!response.success || !response.data) {
|
|
15
|
+
throw new Error(response.error || 'Failed to fetch analytics');
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
console.error('[useAnalytics] refresh error:', errorMessage, err);
|
|
24
|
-
}
|
|
25
|
-
finally {
|
|
26
|
-
setIsLoading(false);
|
|
27
|
-
}
|
|
28
|
-
}, [client]);
|
|
17
|
+
return response.data;
|
|
18
|
+
},
|
|
19
|
+
enabled,
|
|
20
|
+
staleTime: 5 * 60 * 1000,
|
|
21
|
+
gcTime: 30 * 60 * 1000,
|
|
22
|
+
});
|
|
23
|
+
const error = queryError instanceof Error ? queryError.message : null;
|
|
29
24
|
const clearError = useCallback(() => {
|
|
30
|
-
setError(null);
|
|
31
25
|
}, []);
|
|
32
26
|
const reset = useCallback(() => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, []);
|
|
27
|
+
if (userId) {
|
|
28
|
+
queryClient.resetQueries({ queryKey: QUERY_KEYS.analytics(userId) });
|
|
29
|
+
}
|
|
30
|
+
}, [queryClient, userId]);
|
|
37
31
|
return useMemo(() => ({
|
|
38
|
-
analytics,
|
|
32
|
+
analytics: data ?? null,
|
|
39
33
|
isLoading,
|
|
40
34
|
error,
|
|
41
|
-
|
|
35
|
+
refetch,
|
|
42
36
|
clearError,
|
|
43
37
|
reset,
|
|
44
|
-
}), [
|
|
38
|
+
}), [data, isLoading, error, refetch, clearError, reset]);
|
|
45
39
|
};
|
|
46
40
|
//# sourceMappingURL=useAnalytics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAnalytics.js","sourceRoot":"","sources":["../../src/hooks/useAnalytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useAnalytics.js","sourceRoot":"","sources":["../../src/hooks/useAnalytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAQjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAoBtC,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,aAA4B,EAC5B,OAAe,EACf,MAAqB,EACrB,KAA6B,EAC7B,OAIC,EACmB,EAAE;IACtB,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,KAAK,CAAC;IAC5C,MAAM,OAAO,GAAG,CAAC,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,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CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACvE,CAAC;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IAE1B,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,SAAS,EAAE,IAAI,IAAI,IAAI;QACvB,SAAS;QACT,KAAK;QACL,OAAO;QACP,UAAU;QACV,KAAK;KACN,CAAC,EACF,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,CACrD,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -4,13 +4,17 @@ export interface UseEndpointsReturn {
|
|
|
4
4
|
endpoints: Endpoint[];
|
|
5
5
|
isLoading: boolean;
|
|
6
6
|
error: Optional<string>;
|
|
7
|
-
|
|
8
|
-
getEndpoint: (
|
|
9
|
-
createEndpoint: (
|
|
10
|
-
updateEndpoint: (
|
|
11
|
-
deleteEndpoint: (
|
|
7
|
+
refetch: () => void;
|
|
8
|
+
getEndpoint: (endpointId: string) => Promise<BaseResponse<Endpoint>>;
|
|
9
|
+
createEndpoint: (data: EndpointCreateRequest) => Promise<BaseResponse<Endpoint>>;
|
|
10
|
+
updateEndpoint: (endpointId: string, data: EndpointUpdateRequest) => Promise<BaseResponse<Endpoint>>;
|
|
11
|
+
deleteEndpoint: (endpointId: string) => Promise<BaseResponse<Endpoint>>;
|
|
12
12
|
clearError: () => void;
|
|
13
13
|
reset: () => void;
|
|
14
14
|
}
|
|
15
|
-
export declare const useEndpoints: (networkClient: NetworkClient, baseUrl: string,
|
|
15
|
+
export declare const useEndpoints: (networkClient: NetworkClient, baseUrl: string, entitySlug: string | null, projectId: string | null, token: FirebaseIdToken | null, options?: {
|
|
16
|
+
testMode?: boolean;
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
params?: EndpointQueryParams;
|
|
19
|
+
}) => UseEndpointsReturn;
|
|
16
20
|
//# sourceMappingURL=useEndpoints.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEndpoints.d.ts","sourceRoot":"","sources":["../../src/hooks/useEndpoints.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useEndpoints.d.ts","sourceRoot":"","sources":["../../src/hooks/useEndpoints.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EACR,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,EACb,QAAQ,EACT,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAUhD,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAExB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IACrE,cAAc,EAAE,CACd,IAAI,EAAE,qBAAqB,KACxB,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IACrC,cAAc,EAAE,CACd,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,qBAAqB,KACxB,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IACrC,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IAExE,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAMD,eAAO,MAAM,YAAY,GACvB,eAAe,aAAa,EAC5B,SAAS,MAAM,EACf,YAAY,MAAM,GAAG,IAAI,EACzB,WAAW,MAAM,GAAG,IAAI,EACxB,OAAO,eAAe,GAAG,IAAI,EAC7B,UAAU;IACR,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B,KACA,kBAkLF,CAAC"}
|
|
@@ -1,140 +1,103 @@
|
|
|
1
|
-
import { useCallback, useMemo
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
|
+
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
2
3
|
import { ShapeshyftClient } from '../network/ShapeshyftClient';
|
|
3
|
-
|
|
4
|
+
import { QUERY_KEYS } from '../types';
|
|
5
|
+
const EMPTY_ENDPOINTS = [];
|
|
6
|
+
export const useEndpoints = (networkClient, baseUrl, entitySlug, projectId, token, options) => {
|
|
7
|
+
const testMode = options?.testMode ?? false;
|
|
8
|
+
const enabled = (options?.enabled ?? true) && !!entitySlug && !!projectId && !!token;
|
|
4
9
|
const client = useMemo(() => new ShapeshyftClient({ baseUrl, networkClient, testMode }), [baseUrl, networkClient, testMode]);
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
setLastParams(params);
|
|
13
|
-
try {
|
|
14
|
-
const response = await client.getEndpoints(entitySlug, projectId, token, params);
|
|
15
|
-
if (response.success && response.data) {
|
|
16
|
-
setEndpoints(response.data);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
setError(response.error || 'Failed to fetch endpoints');
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
const { data, isLoading, error: queryError, refetch, } = useQuery({
|
|
12
|
+
queryKey: QUERY_KEYS.endpoints(entitySlug ?? '', projectId ?? ''),
|
|
13
|
+
queryFn: async () => {
|
|
14
|
+
const response = await client.getEndpoints(entitySlug, projectId, token, options?.params);
|
|
15
|
+
if (!response.success || !response.data) {
|
|
16
|
+
throw new Error(response.error || 'Failed to fetch endpoints');
|
|
20
17
|
}
|
|
18
|
+
return response.data;
|
|
19
|
+
},
|
|
20
|
+
enabled,
|
|
21
|
+
staleTime: 5 * 60 * 1000,
|
|
22
|
+
gcTime: 30 * 60 * 1000,
|
|
23
|
+
});
|
|
24
|
+
const invalidateEndpoints = useCallback(() => {
|
|
25
|
+
if (entitySlug && projectId) {
|
|
26
|
+
queryClient.invalidateQueries({
|
|
27
|
+
queryKey: QUERY_KEYS.endpoints(entitySlug, projectId),
|
|
28
|
+
});
|
|
21
29
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
}, [queryClient, entitySlug, projectId]);
|
|
31
|
+
const createMutation = useMutation({
|
|
32
|
+
mutationFn: async (data) => {
|
|
33
|
+
return client.createEndpoint(entitySlug, projectId, data, token);
|
|
34
|
+
},
|
|
35
|
+
onSuccess: response => {
|
|
36
|
+
if (response.success)
|
|
37
|
+
invalidateEndpoints();
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
const updateMutation = useMutation({
|
|
41
|
+
mutationFn: async ({ endpointId, data, }) => {
|
|
42
|
+
return client.updateEndpoint(entitySlug, projectId, endpointId, data, token);
|
|
43
|
+
},
|
|
44
|
+
onSuccess: response => {
|
|
45
|
+
if (response.success)
|
|
46
|
+
invalidateEndpoints();
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
const deleteMutation = useMutation({
|
|
50
|
+
mutationFn: async (endpointId) => {
|
|
51
|
+
return client.deleteEndpoint(entitySlug, projectId, endpointId, token);
|
|
52
|
+
},
|
|
53
|
+
onSuccess: response => {
|
|
54
|
+
if (response.success)
|
|
55
|
+
invalidateEndpoints();
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
const getEndpoint = useCallback(async (endpointId) => {
|
|
34
59
|
try {
|
|
35
|
-
|
|
36
|
-
return response;
|
|
60
|
+
return await client.getEndpoint(entitySlug, projectId, endpointId, token);
|
|
37
61
|
}
|
|
38
62
|
catch (err) {
|
|
39
63
|
const errorMessage = err instanceof Error ? err.message : 'Failed to get endpoint';
|
|
40
|
-
setError(errorMessage);
|
|
41
|
-
console.error('[useEndpoints] getEndpoint error:', errorMessage, err);
|
|
42
64
|
return {
|
|
43
65
|
success: false,
|
|
44
66
|
error: errorMessage,
|
|
45
67
|
timestamp: new Date().toISOString(),
|
|
46
68
|
};
|
|
47
69
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
await refresh(entitySlug, projectId, token, lastParams ?? undefined);
|
|
59
|
-
}
|
|
60
|
-
return response;
|
|
61
|
-
}
|
|
62
|
-
catch (err) {
|
|
63
|
-
const errorMessage = err instanceof Error ? err.message : 'Failed to create endpoint';
|
|
64
|
-
setError(errorMessage);
|
|
65
|
-
console.error('[useEndpoints] createEndpoint error:', errorMessage, err);
|
|
66
|
-
return {
|
|
67
|
-
success: false,
|
|
68
|
-
error: errorMessage,
|
|
69
|
-
timestamp: new Date().toISOString(),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
finally {
|
|
73
|
-
setIsLoading(false);
|
|
74
|
-
}
|
|
75
|
-
}, [client, refresh, lastParams]);
|
|
76
|
-
const updateEndpoint = useCallback(async (entitySlug, projectId, endpointId, data, token) => {
|
|
77
|
-
setIsLoading(true);
|
|
78
|
-
setError(null);
|
|
79
|
-
try {
|
|
80
|
-
const response = await client.updateEndpoint(entitySlug, projectId, endpointId, data, token);
|
|
81
|
-
if (response.success) {
|
|
82
|
-
await refresh(entitySlug, projectId, token, lastParams ?? undefined);
|
|
83
|
-
}
|
|
84
|
-
return response;
|
|
85
|
-
}
|
|
86
|
-
catch (err) {
|
|
87
|
-
const errorMessage = err instanceof Error ? err.message : 'Failed to update endpoint';
|
|
88
|
-
setError(errorMessage);
|
|
89
|
-
console.error('[useEndpoints] updateEndpoint error:', errorMessage, err);
|
|
90
|
-
return {
|
|
91
|
-
success: false,
|
|
92
|
-
error: errorMessage,
|
|
93
|
-
timestamp: new Date().toISOString(),
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
finally {
|
|
97
|
-
setIsLoading(false);
|
|
98
|
-
}
|
|
99
|
-
}, [client, refresh, lastParams]);
|
|
100
|
-
const deleteEndpoint = useCallback(async (entitySlug, projectId, endpointId, token) => {
|
|
101
|
-
setIsLoading(true);
|
|
102
|
-
setError(null);
|
|
103
|
-
try {
|
|
104
|
-
const response = await client.deleteEndpoint(entitySlug, projectId, endpointId, token);
|
|
105
|
-
if (response.success) {
|
|
106
|
-
await refresh(entitySlug, projectId, token, lastParams ?? undefined);
|
|
107
|
-
}
|
|
108
|
-
return response;
|
|
109
|
-
}
|
|
110
|
-
catch (err) {
|
|
111
|
-
const errorMessage = err instanceof Error ? err.message : 'Failed to delete endpoint';
|
|
112
|
-
setError(errorMessage);
|
|
113
|
-
console.error('[useEndpoints] deleteEndpoint error:', errorMessage, err);
|
|
114
|
-
return {
|
|
115
|
-
success: false,
|
|
116
|
-
error: errorMessage,
|
|
117
|
-
timestamp: new Date().toISOString(),
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
finally {
|
|
121
|
-
setIsLoading(false);
|
|
122
|
-
}
|
|
123
|
-
}, [client, refresh, lastParams]);
|
|
70
|
+
}, [client, entitySlug, projectId, token]);
|
|
71
|
+
const createEndpoint = useCallback((data) => createMutation.mutateAsync(data), [createMutation]);
|
|
72
|
+
const updateEndpoint = useCallback((endpointId, data) => updateMutation.mutateAsync({ endpointId, data }), [updateMutation]);
|
|
73
|
+
const deleteEndpoint = useCallback((endpointId) => deleteMutation.mutateAsync(endpointId), [deleteMutation]);
|
|
74
|
+
const mutationError = createMutation.error ?? updateMutation.error ?? deleteMutation.error;
|
|
75
|
+
const error = queryError instanceof Error
|
|
76
|
+
? queryError.message
|
|
77
|
+
: mutationError instanceof Error
|
|
78
|
+
? mutationError.message
|
|
79
|
+
: null;
|
|
124
80
|
const clearError = useCallback(() => {
|
|
125
|
-
|
|
126
|
-
|
|
81
|
+
createMutation.reset();
|
|
82
|
+
updateMutation.reset();
|
|
83
|
+
deleteMutation.reset();
|
|
84
|
+
}, [createMutation, updateMutation, deleteMutation]);
|
|
127
85
|
const reset = useCallback(() => {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
86
|
+
if (entitySlug && projectId) {
|
|
87
|
+
queryClient.removeQueries({
|
|
88
|
+
queryKey: QUERY_KEYS.endpoints(entitySlug, projectId),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
clearError();
|
|
92
|
+
}, [queryClient, entitySlug, projectId, clearError]);
|
|
133
93
|
return useMemo(() => ({
|
|
134
|
-
endpoints,
|
|
135
|
-
isLoading
|
|
94
|
+
endpoints: data ?? EMPTY_ENDPOINTS,
|
|
95
|
+
isLoading: isLoading ||
|
|
96
|
+
createMutation.isPending ||
|
|
97
|
+
updateMutation.isPending ||
|
|
98
|
+
deleteMutation.isPending,
|
|
136
99
|
error,
|
|
137
|
-
|
|
100
|
+
refetch,
|
|
138
101
|
getEndpoint,
|
|
139
102
|
createEndpoint,
|
|
140
103
|
updateEndpoint,
|
|
@@ -142,10 +105,13 @@ export const useEndpoints = (networkClient, baseUrl, testMode = false) => {
|
|
|
142
105
|
clearError,
|
|
143
106
|
reset,
|
|
144
107
|
}), [
|
|
145
|
-
|
|
108
|
+
data,
|
|
146
109
|
isLoading,
|
|
110
|
+
createMutation.isPending,
|
|
111
|
+
updateMutation.isPending,
|
|
112
|
+
deleteMutation.isPending,
|
|
147
113
|
error,
|
|
148
|
-
|
|
114
|
+
refetch,
|
|
149
115
|
getEndpoint,
|
|
150
116
|
createEndpoint,
|
|
151
117
|
updateEndpoint,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEndpoints.js","sourceRoot":"","sources":["../../src/hooks/useEndpoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useEndpoints.js","sourceRoot":"","sources":["../../src/hooks/useEndpoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAW9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtC,MAAM,eAAe,GAAe,EAAE,CAAC;AA6BvC,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,aAA4B,EAC5B,OAAe,EACf,UAAyB,EACzB,SAAwB,EACxB,KAA6B,EAC7B,OAIC,EACmB,EAAE;IACtB,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,KAAK,CAAC;IAC5C,MAAM,OAAO,GACX,CAAC,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,KAAK,CAAC;IAEvE,MAAM,MAAM,GAAG,OAAO,CACpB,GAAG,EAAE,CAAC,IAAI,gBAAgB,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,EAChE,CAAC,OAAO,EAAE,aAAa,EAAE,QAAQ,CAAC,CACnC,CAAC;IAEF,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,MAAM,EACJ,IAAI,EACJ,SAAS,EACT,KAAK,EAAE,UAAU,EACjB,OAAO,GACR,GAAG,QAAQ,CAAC;QACX,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC,UAAU,IAAI,EAAE,EAAE,SA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