fastapi-rtk 0.2.16 → 0.2.17
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/.external/cjs/{mantine-form-yup-resolver@2.0.0_@mantine_form@8.2.2_yup@1.6.1 → mantine-form-yup-resolver@2.0.0_@mantine_form@8.2.2_yup@1.7.0}/mantine-form-yup-resolver/dist/esm/index.cjs +1 -1
- package/dist/.external/cjs/{yup@1.6.1 → yup@1.7.0}/yup/index.esm.cjs +140 -11
- package/dist/.external/esm/{mantine-form-yup-resolver@2.0.0_@mantine_form@8.2.2_yup@1.6.1 → mantine-form-yup-resolver@2.0.0_@mantine_form@8.2.2_yup@1.7.0}/mantine-form-yup-resolver/dist/esm/index.mjs +1 -1
- package/dist/.external/esm/{yup@1.6.1 → yup@1.7.0}/yup/index.esm.mjs +140 -11
- package/dist/core/cjs/ActionIcons/View/ViewDialog.cjs +2 -3
- package/dist/core/cjs/Tables/DataGrid/FormField/Inputs/FormRelatedListSelect.cjs +2 -3
- package/dist/core/cjs/Tables/DataGrid/FormField/Inputs/FormRelatedSelect.cjs +3 -4
- package/dist/core/cjs/Tables/DataGrid/Main/Body/Body.cjs +2 -3
- package/dist/core/cjs/Tables/DataGrid/Toolbar/Filter/FilterMenu.cjs +2 -2
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilterInput/HeaderInputs/HeaderMultiSelectInput.cjs +1 -2
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/utils.cjs +2 -3
- package/dist/core/cjs/Wrappers/ApiProvider/ApiProvider.cjs +18 -28
- package/dist/core/cjs/Wrappers/ApiProvider/hooks/useProvideApi.cjs +31 -20
- package/dist/core/cjs/Wrappers/ApiProvider/hooks/useProvideBulk.cjs +5 -3
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/createItem.cjs +2 -7
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/deleteItem.cjs +1 -2
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/downloadItems.cjs +1 -2
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/formCreateItem.cjs +4 -13
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/formUpdateItem.cjs +4 -13
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/getInfo.cjs +2 -6
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/getItem.cjs +1 -2
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/getItems.cjs +1 -2
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/updateItem.cjs +1 -2
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/uploadItems.cjs +1 -2
- package/dist/core/cjs/Wrappers/ApiProvider/utils/bulkActions/postBulkAction.cjs +1 -14
- package/dist/core/cjs/Wrappers/ApiProvider/utils/getValidationSchema.cjs +1 -1
- package/dist/core/cjs/Wrappers/Provider/Provider.cjs +8 -15
- package/dist/core/cjs/Wrappers/Provider/hooks/useProvideAuth.cjs +55 -24
- package/dist/core/cjs/Wrappers/Provider/hooks/useProvideInfo.cjs +4 -3
- package/dist/core/cjs/Wrappers/Provider/utils/authFetch.cjs +1 -1
- package/dist/core/cjs/fab-react-toolkit-patch/api/hooks/useProvideApi.cjs +25 -299
- package/dist/core/cjs/fab-react-toolkit-patch/api/hooks/useProvideBulk.cjs +3 -25
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/api/getItems.cjs +1 -2
- package/dist/core/cjs/fab-react-toolkit-patch/auth/hooks/useProvideAuth.cjs +9 -56
- package/dist/core/cjs/fab-react-toolkit-patch/auth/hooks/useProvideInfo.cjs +2 -16
- package/dist/core/cjs/fab-react-toolkit-patch/auth/utils/authFetch.cjs +1 -1
- package/dist/core/esm/ActionIcons/View/ViewDialog.mjs +1 -2
- package/dist/core/esm/Tables/DataGrid/FormField/Inputs/FormRelatedListSelect.mjs +1 -2
- package/dist/core/esm/Tables/DataGrid/FormField/Inputs/FormRelatedSelect.mjs +1 -2
- package/dist/core/esm/Tables/DataGrid/Main/Body/Body.mjs +1 -2
- package/dist/core/esm/Tables/DataGrid/Toolbar/Filter/FilterMenu.mjs +2 -2
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilterInput/HeaderInputs/HeaderMultiSelectInput.mjs +1 -2
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/utils.mjs +1 -2
- package/dist/core/esm/Wrappers/ApiProvider/ApiProvider.mjs +21 -31
- package/dist/core/esm/Wrappers/ApiProvider/hooks/useProvideApi.mjs +30 -19
- package/dist/core/esm/Wrappers/ApiProvider/hooks/useProvideBulk.mjs +5 -3
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/createItem.mjs +2 -7
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/deleteItem.mjs +1 -2
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/downloadItems.mjs +1 -2
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/formCreateItem.mjs +3 -12
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/formUpdateItem.mjs +3 -12
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/getInfo.mjs +2 -6
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/getItem.mjs +1 -2
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/getItems.mjs +1 -2
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/updateItem.mjs +1 -2
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/uploadItems.mjs +1 -2
- package/dist/core/esm/Wrappers/ApiProvider/utils/bulkActions/postBulkAction.mjs +2 -15
- package/dist/core/esm/Wrappers/ApiProvider/utils/getValidationSchema.mjs +2 -2
- package/dist/core/esm/Wrappers/Provider/Provider.mjs +11 -18
- package/dist/core/esm/Wrappers/Provider/hooks/useProvideAuth.mjs +58 -27
- package/dist/core/esm/Wrappers/Provider/hooks/useProvideInfo.mjs +4 -3
- package/dist/core/esm/Wrappers/Provider/utils/authFetch.mjs +2 -2
- package/dist/core/esm/fab-react-toolkit-patch/api/hooks/useProvideApi.mjs +25 -299
- package/dist/core/esm/fab-react-toolkit-patch/api/hooks/useProvideBulk.mjs +3 -25
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/api/getItems.mjs +1 -2
- package/dist/core/esm/fab-react-toolkit-patch/auth/hooks/useProvideAuth.mjs +11 -58
- package/dist/core/esm/fab-react-toolkit-patch/auth/hooks/useProvideInfo.mjs +2 -16
- package/dist/core/esm/fab-react-toolkit-patch/auth/utils/authFetch.mjs +1 -1
- package/dist/core/lib/Wrappers/ApiProvider/ApiProvider.d.ts +15 -0
- package/dist/core/lib/Wrappers/ApiProvider/hooks/useProvideApi.d.ts +11 -0
- package/dist/core/lib/Wrappers/ApiProvider/hooks/useProvideBulk.d.ts +7 -1
- package/dist/core/lib/Wrappers/ApiProvider/utils/bulkActions/postBulkAction.d.ts +1 -1
- package/dist/core/lib/Wrappers/Provider/hooks/useProvideAuth.d.ts +16 -6
- package/dist/core/lib/Wrappers/Provider/hooks/useProvideInfo.d.ts +4 -1
- package/dist/core/lib/Wrappers/Provider/utils/authFetch.d.ts +2 -3
- package/dist/core/lib/fab-react-toolkit-patch/api/hooks/useProvideApi.d.ts +20 -41
- package/dist/core/lib/fab-react-toolkit-patch/api/hooks/useProvideBulk.d.ts +4 -11
- package/dist/core/lib/fab-react-toolkit-patch/auth/hooks/useProvideAuth.d.ts +10 -15
- package/dist/core/lib/fab-react-toolkit-patch/auth/hooks/useProvideInfo.d.ts +4 -7
- package/dist/core/lib/fab-react-toolkit-patch/auth/utils/authFetch.d.ts +2 -2
- package/dist/core/lib/hooks/auth/useAuth.d.ts +1 -1
- package/dist/utils/cjs/index.cjs +6 -0
- package/dist/{core/cjs/fab-react-toolkit-patch/api/utils/api/utils → utils/cjs/parseResponse}/parseResponse.cjs +3 -1
- package/dist/utils/esm/index.mjs +6 -0
- package/dist/{core/esm/fab-react-toolkit-patch/api/utils/api/utils → utils/esm/parseResponse}/parseResponse.mjs +3 -1
- package/dist/utils/lib/convertId/index.d.ts +1 -0
- package/dist/utils/lib/convertToFormData/index.d.ts +1 -0
- package/dist/utils/lib/index.d.ts +3 -0
- package/dist/utils/lib/parseResponse/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/utils/parseResponse.cjs +0 -19
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/api/createItem.cjs +0 -14
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/api/deleteItem.cjs +0 -10
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/api/getInfo.cjs +0 -13
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/api/getItem.cjs +0 -10
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/api/updateItem.cjs +0 -10
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/api/uploadItems.cjs +0 -27
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/bulkActions/postBulkAction.cjs +0 -26
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/convertId.cjs +0 -12
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/convertInfo.cjs +0 -20
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/createQueryParams.cjs +0 -18
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/getDefaultValues.cjs +0 -28
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/getValidationSchema.cjs +0 -38
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/utils/parseResponse.mjs +0 -19
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/api/createItem.mjs +0 -14
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/api/deleteItem.mjs +0 -10
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/api/getInfo.mjs +0 -13
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/api/getItem.mjs +0 -10
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/api/updateItem.mjs +0 -10
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/api/uploadItems.mjs +0 -27
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/bulkActions/postBulkAction.mjs +0 -26
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/convertId.mjs +0 -12
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/convertInfo.mjs +0 -20
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/createQueryParams.mjs +0 -18
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/getDefaultValues.mjs +0 -28
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/getValidationSchema.mjs +0 -39
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/createItem.d.ts +0 -1
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/deleteItem.d.ts +0 -1
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/getInfo.d.ts +0 -1
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/getItem.d.ts +0 -1
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/updateItem.d.ts +0 -1
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/uploadItems.d.ts +0 -1
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/utils/parseResponse.d.ts +0 -1
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/bulkActions/postBulkAction.d.ts +0 -1
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/convertId.d.ts +0 -1
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/convertInfo.d.ts +0 -1
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/createQueryParams.d.ts +0 -10
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/getDefaultValues.d.ts +0 -1
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/getValidationSchema.d.ts +0 -6
- /package/dist/.external/cjs/{@tanstack_react-query@5.84.0_react@18.3.1 → @tanstack_react-query@5.84.1_react@18.3.1}/@tanstack/react-query/build/modern/IsRestoringProvider.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_react-query@5.84.0_react@18.3.1 → @tanstack_react-query@5.84.1_react@18.3.1}/@tanstack/react-query/build/modern/QueryClientProvider.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_react-query@5.84.0_react@18.3.1 → @tanstack_react-query@5.84.1_react@18.3.1}/@tanstack/react-query/build/modern/QueryErrorResetBoundary.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_react-query@5.84.0_react@18.3.1 → @tanstack_react-query@5.84.1_react@18.3.1}/@tanstack/react-query/build/modern/errorBoundaryUtils.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_react-query@5.84.0_react@18.3.1 → @tanstack_react-query@5.84.1_react@18.3.1}/@tanstack/react-query/build/modern/suspense.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_react-query@5.84.0_react@18.3.1 → @tanstack_react-query@5.84.1_react@18.3.1}/@tanstack/react-query/build/modern/useBaseQuery.cjs +0 -0
- /package/dist/.external/cjs/{@tanstack_react-query@5.84.0_react@18.3.1 → @tanstack_react-query@5.84.1_react@18.3.1}/@tanstack/react-query/build/modern/useQuery.cjs +0 -0
- /package/dist/.external/esm/{@tanstack_react-query@5.84.0_react@18.3.1 → @tanstack_react-query@5.84.1_react@18.3.1}/@tanstack/react-query/build/modern/IsRestoringProvider.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_react-query@5.84.0_react@18.3.1 → @tanstack_react-query@5.84.1_react@18.3.1}/@tanstack/react-query/build/modern/QueryClientProvider.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_react-query@5.84.0_react@18.3.1 → @tanstack_react-query@5.84.1_react@18.3.1}/@tanstack/react-query/build/modern/QueryErrorResetBoundary.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_react-query@5.84.0_react@18.3.1 → @tanstack_react-query@5.84.1_react@18.3.1}/@tanstack/react-query/build/modern/errorBoundaryUtils.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_react-query@5.84.0_react@18.3.1 → @tanstack_react-query@5.84.1_react@18.3.1}/@tanstack/react-query/build/modern/suspense.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_react-query@5.84.0_react@18.3.1 → @tanstack_react-query@5.84.1_react@18.3.1}/@tanstack/react-query/build/modern/useBaseQuery.mjs +0 -0
- /package/dist/.external/esm/{@tanstack_react-query@5.84.0_react@18.3.1 → @tanstack_react-query@5.84.1_react@18.3.1}/@tanstack/react-query/build/modern/useQuery.mjs +0 -0
- /package/dist/{core/cjs/Wrappers/ApiProvider/utils → utils/cjs/convertId}/convertId.cjs +0 -0
- /package/dist/{core/cjs/Wrappers/ApiProvider/utils/api/utils → utils/cjs/convertToFormData}/convertToFormData.cjs +0 -0
- /package/dist/{core/esm/Wrappers/ApiProvider/utils → utils/esm/convertId}/convertId.mjs +0 -0
- /package/dist/{core/esm/Wrappers/ApiProvider/utils/api/utils → utils/esm/convertToFormData}/convertToFormData.mjs +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/utils → utils/lib/convertId}/convertId.d.ts +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/utils/api/utils → utils/lib/convertToFormData}/convertToFormData.d.ts +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/utils/api/utils → utils/lib/parseResponse}/parseResponse.d.ts +0 -0
|
@@ -1,303 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { deleteItem } from "../utils/api/deleteItem.mjs";
|
|
1
|
+
import { createItem } from "../../../Wrappers/ApiProvider/utils/api/createItem.mjs";
|
|
2
|
+
import { deleteItem } from "../../../Wrappers/ApiProvider/utils/api/deleteItem.mjs";
|
|
3
|
+
import { getInfo } from "../../../Wrappers/ApiProvider/utils/api/getInfo.mjs";
|
|
4
|
+
import { getItem } from "../../../Wrappers/ApiProvider/utils/api/getItem.mjs";
|
|
5
|
+
import { updateItem } from "../../../Wrappers/ApiProvider/utils/api/updateItem.mjs";
|
|
6
|
+
import { uploadItems } from "../../../Wrappers/ApiProvider/utils/api/uploadItems.mjs";
|
|
8
7
|
import { downloadItems } from "../utils/api/downloadItems.mjs";
|
|
9
|
-
import { getInfo } from "../utils/api/getInfo.mjs";
|
|
10
|
-
import { getItem } from "../utils/api/getItem.mjs";
|
|
11
8
|
import { getItems } from "../utils/api/getItems.mjs";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
const [queryParams, setQueryParams] = useState(
|
|
31
|
-
initialQueryParams ? createQueryParams(null, initialQueryParams) : null
|
|
32
|
-
);
|
|
33
|
-
const pathRef = useRef(path);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
pathRef.current = path;
|
|
36
|
-
}, [path]);
|
|
37
|
-
const memoizedQueryParamsPathRef = useRef(path);
|
|
38
|
-
const memoizedQueryParams = useMemo(
|
|
39
|
-
() => {
|
|
40
|
-
memoizedQueryParamsPathRef.current = path;
|
|
41
|
-
return queryParams ? {
|
|
42
|
-
...queryParams,
|
|
43
|
-
...relation ? {
|
|
44
|
-
filters: [
|
|
45
|
-
...queryParams.filters || [],
|
|
46
|
-
{ col: relation.foreign_key, opr: relation.type, value: convertId(getItemId(relation)) }
|
|
47
|
-
]
|
|
48
|
-
} : {}
|
|
49
|
-
} : null;
|
|
50
|
-
},
|
|
51
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
-
[queryParams, relation]
|
|
53
|
-
);
|
|
54
|
-
const queryParamsRef = useRef(memoizedQueryParams);
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
queryParamsRef.current = memoizedQueryParams;
|
|
57
|
-
}, [memoizedQueryParams]);
|
|
58
|
-
const setQueryParamsCallback = useCallback(
|
|
59
|
-
(partialQueryParams) => setQueryParams((prev) => {
|
|
60
|
-
if (typeof partialQueryParams === "function") {
|
|
61
|
-
partialQueryParams = partialQueryParams(prev);
|
|
62
|
-
}
|
|
63
|
-
if (!prev) {
|
|
64
|
-
return createQueryParams(null, partialQueryParams);
|
|
65
|
-
}
|
|
66
|
-
const newQueryParams = createQueryParams({ ...prev }, partialQueryParams);
|
|
67
|
-
if (partialQueryParams) {
|
|
68
|
-
if ((partialQueryParams.filters || partialQueryParams.order_column || partialQueryParams.order_direction) && !partialQueryParams.page) {
|
|
69
|
-
newQueryParams.page = 0;
|
|
70
|
-
}
|
|
71
|
-
if (streamingMode) {
|
|
72
|
-
if (partialQueryParams.page && partialQueryParams.page !== prev.page && !partialQueryParams.streaming) {
|
|
73
|
-
throw new Error("You cannot change page in streaming mode, use streaming.fetch() instead");
|
|
74
|
-
}
|
|
75
|
-
if (partialQueryParams.page_size && partialQueryParams.page_size !== prev.page_size) {
|
|
76
|
-
throw new Error("You cannot change page size in streaming mode, use streaming.fetch() instead");
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return newQueryParams;
|
|
81
|
-
}),
|
|
82
|
-
[streamingMode]
|
|
83
|
-
);
|
|
84
|
-
const [error, setError] = useState();
|
|
85
|
-
const memoizedError = useMemo(() => error, [error]);
|
|
86
|
-
const resetError = useCallback(() => setError(void 0), []);
|
|
87
|
-
const {
|
|
88
|
-
data: info,
|
|
89
|
-
isFetching: infoLoading,
|
|
90
|
-
refetch: infoRefetch,
|
|
91
|
-
error: infoError
|
|
92
|
-
} = useQuery({
|
|
93
|
-
queryKey: [`info`, path],
|
|
94
|
-
queryFn: ({ signal }) => getInfo(urlJoin(path, "_info"), signal).then((data2) => ({ ...convertInfo(data2), path })),
|
|
95
|
-
placeholderData: clearInfoOnRefetch ? null : keepPreviousData,
|
|
96
|
-
enabled: fetchInfo,
|
|
97
|
-
retry: false,
|
|
98
|
-
refetchOnMount: false,
|
|
99
|
-
refetchOnReconnect: false,
|
|
100
|
-
refetchOnWindowFocus: false,
|
|
101
|
-
...infoQueryProps
|
|
102
|
-
});
|
|
103
|
-
const {
|
|
104
|
-
data,
|
|
105
|
-
isFetching: dataLoading,
|
|
106
|
-
refetch: dataRefetch,
|
|
107
|
-
error: dataError
|
|
108
|
-
} = useQuery({
|
|
109
|
-
queryKey: [`data`, memoizedQueryParamsPathRef.current, JSON.stringify(memoizedQueryParams)],
|
|
110
|
-
queryFn: ({ signal }) => memoizedQueryParams ? getItems(urlJoin(memoizedQueryParamsPathRef.current, "/"), memoizedQueryParams, signal).then((data2) => ({
|
|
111
|
-
...data2,
|
|
112
|
-
result: data2.result.map((item, index) => ({ ...item, id: data2.ids[index] })),
|
|
113
|
-
path: memoizedQueryParamsPathRef.current,
|
|
114
|
-
queryParams: memoizedQueryParams
|
|
115
|
-
})) : null,
|
|
116
|
-
placeholderData: clearDataOnRefetch ? null : keepPreviousData,
|
|
117
|
-
retry: false,
|
|
118
|
-
...dataQueryProps
|
|
119
|
-
});
|
|
120
|
-
useEffect(() => {
|
|
121
|
-
if (infoError) {
|
|
122
|
-
setError({ message: `Couldn't fetch info`, originalError: infoError });
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
if (dataError) {
|
|
126
|
-
setError({ message: `Couldn't fetch list`, originalError: dataError });
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
resetError();
|
|
130
|
-
}, [infoError, dataError, resetError]);
|
|
131
|
-
const loading = useMemo(() => infoLoading || dataLoading, [infoLoading, dataLoading]);
|
|
132
|
-
useDidUpdate(() => {
|
|
133
|
-
if (!resetQueryParamsOnPathChange) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
const newQueryParams = createQueryParams(null, initialQueryParams);
|
|
137
|
-
if (queryParams == null ? void 0 : queryParams.page_size) {
|
|
138
|
-
newQueryParams.page_size = queryParams.page_size;
|
|
139
|
-
}
|
|
140
|
-
setQueryParams({ ...newQueryParams });
|
|
141
|
-
}, [path]);
|
|
142
|
-
const getEntry = useCallback(
|
|
143
|
-
async (id) => {
|
|
144
|
-
try {
|
|
145
|
-
resetError();
|
|
146
|
-
const response = await getItem(pathRef.current, convertId(id));
|
|
147
|
-
return response;
|
|
148
|
-
} catch (error2) {
|
|
149
|
-
setError({ message: `Couldn't fetch item with id ${id}`, originalError: error2 });
|
|
150
|
-
if (throwOnError) {
|
|
151
|
-
throw error2;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
[resetError, throwOnError]
|
|
156
|
-
);
|
|
157
|
-
const addEntry = useCallback(
|
|
158
|
-
async (item) => {
|
|
159
|
-
try {
|
|
160
|
-
resetError();
|
|
161
|
-
const response = await createItem(pathRef.current, item);
|
|
162
|
-
return response;
|
|
163
|
-
} catch (error2) {
|
|
164
|
-
setError({ message: `Couldn't add item`, originalError: error2 });
|
|
165
|
-
if (throwOnError) {
|
|
166
|
-
throw error2;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
[resetError, throwOnError]
|
|
171
|
-
);
|
|
172
|
-
const updateEntry = useCallback(
|
|
173
|
-
async (id, item) => {
|
|
174
|
-
try {
|
|
175
|
-
resetError();
|
|
176
|
-
const response = await updateItem(pathRef.current, convertId(id), item);
|
|
177
|
-
return response;
|
|
178
|
-
} catch (error2) {
|
|
179
|
-
setError({ message: `Couldn't update item with id ${id}`, originalError: error2 });
|
|
180
|
-
if (throwOnError) {
|
|
181
|
-
throw error2;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
[resetError, throwOnError]
|
|
186
|
-
);
|
|
187
|
-
const deleteEntry = useCallback(
|
|
188
|
-
async (id) => {
|
|
189
|
-
try {
|
|
190
|
-
resetError();
|
|
191
|
-
const response = await deleteItem(pathRef.current, convertId(id));
|
|
192
|
-
return response;
|
|
193
|
-
} catch (error2) {
|
|
194
|
-
setError({ message: `Couldn't delete item with id ${id}`, originalError: error2 });
|
|
195
|
-
if (throwOnError) {
|
|
196
|
-
throw error2;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
[resetError, throwOnError]
|
|
201
|
-
);
|
|
202
|
-
const download = useCallback(
|
|
203
|
-
async (label, { export_mode, delimiter, quotechar } = {}) => {
|
|
204
|
-
try {
|
|
205
|
-
resetError();
|
|
206
|
-
await downloadItems(pathRef.current, queryParamsRef.current, { label, export_mode, delimiter, quotechar });
|
|
207
|
-
} catch (error2) {
|
|
208
|
-
setError({ message: `Couldn't download`, originalError: error2 });
|
|
209
|
-
if (throwOnError) {
|
|
210
|
-
throw error2;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
[resetError, throwOnError]
|
|
215
|
-
);
|
|
216
|
-
const upload = useCallback(
|
|
217
|
-
async (file, { delimiter, quotechar } = {}) => {
|
|
218
|
-
try {
|
|
219
|
-
resetError();
|
|
220
|
-
const response = await uploadItems(pathRef.current, file, { delimiter, quotechar });
|
|
221
|
-
return response;
|
|
222
|
-
} catch (error2) {
|
|
223
|
-
setError({ message: `Couldn't upload`, originalError: error2 });
|
|
224
|
-
if (throwOnError) {
|
|
225
|
-
throw error2;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
[resetError, throwOnError]
|
|
230
|
-
);
|
|
231
|
-
const [streaming, setStreaming] = useSetState({
|
|
232
|
-
data: {},
|
|
233
|
-
isEnd: false,
|
|
234
|
-
fetch: streamingMode ? () => setQueryParamsCallback({ page: 0, streaming: true }) : () => null
|
|
235
|
-
});
|
|
236
|
-
useEffect(() => {
|
|
237
|
-
if (!streamingMode) {
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
if (!data) {
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
setStreaming((prev) => {
|
|
244
|
-
var _a;
|
|
245
|
-
const newStreaming = { isEnd: false };
|
|
246
|
-
const currentPage = Object.keys(prev.data).length;
|
|
247
|
-
const nextPage = ((_a = data.queryParams) == null ? void 0 : _a.page) ?? 0;
|
|
248
|
-
if (nextPage < currentPage) {
|
|
249
|
-
newStreaming.data = {};
|
|
250
|
-
} else {
|
|
251
|
-
newStreaming.data = { ...prev.data };
|
|
252
|
-
}
|
|
253
|
-
newStreaming.data[nextPage] = data.result;
|
|
254
|
-
if (data.result.length < data.queryParams.page_size) {
|
|
255
|
-
newStreaming.isEnd = true;
|
|
256
|
-
newStreaming.fetch = () => null;
|
|
257
|
-
} else {
|
|
258
|
-
newStreaming.fetch = () => setQueryParamsCallback({ page: nextPage + 1, streaming: true });
|
|
259
|
-
}
|
|
260
|
-
return newStreaming;
|
|
261
|
-
});
|
|
262
|
-
}, [data, setQueryParamsCallback, setStreaming, streamingMode]);
|
|
263
|
-
const specialKey = useMemo(() => {
|
|
264
|
-
var _a;
|
|
265
|
-
const specialKey2 = {
|
|
266
|
-
all: "all",
|
|
267
|
-
actions: "actions"
|
|
268
|
-
};
|
|
269
|
-
(_a = data == null ? void 0 : data.list_columns) == null ? void 0 : _a.forEach((key) => {
|
|
270
|
-
if (specialKey2[key]) {
|
|
271
|
-
specialKey2[key] = `_${key}`;
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
return specialKey2;
|
|
275
|
-
}, [data == null ? void 0 : data.list_columns]);
|
|
276
|
-
const refetch = useCallback(
|
|
277
|
-
() => queryParamsRef.current ? dataRefetch() : setQueryParamsCallback(),
|
|
278
|
-
[dataRefetch, setQueryParamsCallback]
|
|
279
|
-
);
|
|
280
|
-
return {
|
|
281
|
-
path,
|
|
282
|
-
data,
|
|
283
|
-
info,
|
|
284
|
-
queryParams: memoizedQueryParams,
|
|
285
|
-
loading,
|
|
286
|
-
error: memoizedError,
|
|
287
|
-
streaming,
|
|
288
|
-
specialKey,
|
|
289
|
-
setQueryParams: setQueryParamsCallback,
|
|
290
|
-
refetch,
|
|
291
|
-
refetchInfo: infoRefetch,
|
|
292
|
-
getEntry,
|
|
293
|
-
addEntry,
|
|
294
|
-
updateEntry,
|
|
295
|
-
deleteEntry,
|
|
296
|
-
download,
|
|
297
|
-
upload,
|
|
298
|
-
resetError
|
|
299
|
-
};
|
|
300
|
-
}
|
|
9
|
+
const defaultApi = {
|
|
10
|
+
getItem,
|
|
11
|
+
getItems,
|
|
12
|
+
createItem,
|
|
13
|
+
updateItem,
|
|
14
|
+
deleteItem,
|
|
15
|
+
downloadItems,
|
|
16
|
+
uploadItems,
|
|
17
|
+
getInfo,
|
|
18
|
+
// eslint-disable-next-line no-unused-vars
|
|
19
|
+
formCreateItem: async (path, item) => {
|
|
20
|
+
throw new Error("formCreateItem is not implemented in fab");
|
|
21
|
+
},
|
|
22
|
+
// eslint-disable-next-line no-unused-vars
|
|
23
|
+
formUpdateItem: async (path, id, item) => {
|
|
24
|
+
throw new Error("formUpdateItem is not implemented in fab");
|
|
25
|
+
}
|
|
26
|
+
};
|
|
301
27
|
export {
|
|
302
|
-
|
|
28
|
+
defaultApi
|
|
303
29
|
};
|
|
@@ -1,27 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const useFabProvideBulk = ({ path }) => {
|
|
4
|
-
const [selectedIds, setSelectedIds] = useState([]);
|
|
5
|
-
const [error, setError] = useState();
|
|
6
|
-
const resetError = useCallback(() => setError(void 0), []);
|
|
7
|
-
const dispatchBulkActions = useCallback(
|
|
8
|
-
async (handler, data) => {
|
|
9
|
-
try {
|
|
10
|
-
resetError();
|
|
11
|
-
if (data === void 0) {
|
|
12
|
-
data = selectedIds;
|
|
13
|
-
}
|
|
14
|
-
const response = await postBulk(path, handler, data);
|
|
15
|
-
return response;
|
|
16
|
-
} catch (error2) {
|
|
17
|
-
setError({ message: `Couldn't perform bulk action`, originalError: error2 });
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
[path, resetError, selectedIds]
|
|
21
|
-
);
|
|
22
|
-
const bulkActions = useMemo(() => ({ selectedIds, setSelectedIds }), [selectedIds, setSelectedIds]);
|
|
23
|
-
return { bulkActions, dispatchBulkActions, error, resetError };
|
|
24
|
-
};
|
|
1
|
+
import { postBulk } from "../../../Wrappers/ApiProvider/utils/bulkActions/postBulkAction.mjs";
|
|
2
|
+
const defaultBulk = { postBulk };
|
|
25
3
|
export {
|
|
26
|
-
|
|
4
|
+
defaultBulk
|
|
27
5
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { createFetchParams } from "fastapi-rtk/utils";
|
|
2
|
-
import { parseResponse } from "./utils/parseResponse.mjs";
|
|
1
|
+
import { createFetchParams, parseResponse } from "fastapi-rtk/utils";
|
|
3
2
|
const getItems = async (path, queryParams, signal) => {
|
|
4
3
|
const { fetchPath, options } = createFetchParams({ path, method: "GET", queryParams: { q: queryParams } });
|
|
5
4
|
const response = await fetch(fetchPath, { signal, ...options });
|
|
@@ -1,60 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
retry: false,
|
|
12
|
-
...authQueryProps
|
|
13
|
-
});
|
|
14
|
-
const [error, setError] = useState();
|
|
15
|
-
const resetError = useCallback(() => setError(void 0), []);
|
|
16
|
-
const signin = useCallback(
|
|
17
|
-
({ username, password }) => {
|
|
18
|
-
resetError();
|
|
19
|
-
authSignin(baseURL, { username, password }).then(() => queryClient.invalidateQueries({ queryKey: ["user"] })).catch((err) => setError(err));
|
|
20
|
-
},
|
|
21
|
-
[baseURL, queryClient, resetError]
|
|
22
|
-
);
|
|
23
|
-
const signout = useCallback(() => {
|
|
24
|
-
resetError();
|
|
25
|
-
authSignout(baseURL).then(() => queryClient.resetQueries({ queryKey: ["user"] })).then(() => queryClient.resetQueries({ queryKey: ["info"] })).catch((err) => setError(err));
|
|
26
|
-
}, [baseURL, queryClient, resetError]);
|
|
27
|
-
const update = useCallback(
|
|
28
|
-
(data) => {
|
|
29
|
-
resetError();
|
|
30
|
-
updateUser(baseURL, data).then(() => queryClient.invalidateQueries({ queryKey: ["user"] })).catch((err) => setError(err));
|
|
31
|
-
},
|
|
32
|
-
[baseURL, queryClient, resetError]
|
|
33
|
-
);
|
|
34
|
-
const resetPassword = useCallback(
|
|
35
|
-
(password) => {
|
|
36
|
-
resetError();
|
|
37
|
-
authResetPassword(baseURL, password, query.data).catch((err) => setError(err));
|
|
38
|
-
},
|
|
39
|
-
[baseURL, query.data, resetError]
|
|
40
|
-
);
|
|
41
|
-
const oauth_signin = useCallback(
|
|
42
|
-
(provider, popup) => authOAuthSignin(baseURL, provider, popup, () => queryClient.invalidateQueries({ queryKey: ["user"] })),
|
|
43
|
-
[baseURL, queryClient]
|
|
44
|
-
);
|
|
45
|
-
return {
|
|
46
|
-
user: query.isError ? null : query.data,
|
|
47
|
-
loading: query.isFetching,
|
|
48
|
-
error: error ? error.message : null,
|
|
49
|
-
signin,
|
|
50
|
-
signout,
|
|
51
|
-
update,
|
|
52
|
-
resetPassword,
|
|
53
|
-
oauth_signin,
|
|
54
|
-
refetch: query.refetch,
|
|
55
|
-
resetError
|
|
56
|
-
};
|
|
57
|
-
}
|
|
1
|
+
import { authOAuthSignin, authResetPassword, authSignout, authSignin } from "../utils/authFetch.mjs";
|
|
2
|
+
import { updateUser, getUser } from "../utils/userCRUD.mjs";
|
|
3
|
+
const defaultAuth = {
|
|
4
|
+
getUser,
|
|
5
|
+
update: updateUser,
|
|
6
|
+
signin: authSignin,
|
|
7
|
+
signout: authSignout,
|
|
8
|
+
resetPassword: authResetPassword,
|
|
9
|
+
oauthSignin: authOAuthSignin
|
|
10
|
+
};
|
|
58
11
|
export {
|
|
59
|
-
|
|
12
|
+
defaultAuth
|
|
60
13
|
};
|
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
import { useQuery } from "../../../../../.external/esm/@tanstack_react-query@5.84.0_react@18.3.1/@tanstack/react-query/build/modern/useQuery.mjs";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
1
|
import { authInfo } from "../utils/authFetch.mjs";
|
|
4
|
-
|
|
5
|
-
const query = useQuery({
|
|
6
|
-
queryKey: ["info"],
|
|
7
|
-
queryFn: ({ signal }) => authInfo(baseUrl, signal),
|
|
8
|
-
enabled: false
|
|
9
|
-
});
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
if (auth.user && !query.data) {
|
|
12
|
-
query.refetch();
|
|
13
|
-
}
|
|
14
|
-
}, [auth.user, query]);
|
|
15
|
-
return { baseUrl, info: query.data, loading: query.isFetching, error: query.error, fab: true };
|
|
16
|
-
}
|
|
2
|
+
const defaultInfo = { getInfo: authInfo };
|
|
17
3
|
export {
|
|
18
|
-
|
|
4
|
+
defaultInfo
|
|
19
5
|
};
|
|
@@ -46,7 +46,7 @@ async function authResetPassword(baseUrl, newPassword, { email }) {
|
|
|
46
46
|
throw new Error("Couldn't reset password");
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
function authOAuthSignin(baseUrl, provider, popup, afterSigninPopup) {
|
|
50
50
|
const url = urlJoin(baseUrl, "auth/login", provider);
|
|
51
51
|
if (!popup) {
|
|
52
52
|
window.location.href = urlJoin(baseUrl, "auth/login", provider);
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} ApiProviderProps
|
|
3
|
+
* @property {string} [resource_name] - The name of the resource to be used in the API path
|
|
4
|
+
* @property {Record<string, any>} [initialQueryParams] - The initial query parameters to be used in the API requests
|
|
5
|
+
* @property {string} [relation] - The relation to be used in the API requests
|
|
6
|
+
* @property {boolean} [fetchInfo] - Whether to fetch the `info` for the API requests when the component mounts
|
|
7
|
+
* @property {boolean} [clearInfoOnRefetch] - Whether to clear the `info` on refetch
|
|
8
|
+
* @property {boolean} [clearDataOnRefetch] - Whether to clear the `data` on refetch
|
|
9
|
+
* @property {boolean} [resetQueryParamsOnPathChange] - Whether to reset the `queryParams` on path change
|
|
10
|
+
* @property {Record<string, any>} [infoQueryProps] - The react-query props for the info query
|
|
11
|
+
* @property {Record<string, any>} [dataQueryProps] - The react-query props for the data query
|
|
12
|
+
* @property {boolean} [throwOnError] - Whether to throw an error on API request failure
|
|
13
|
+
* @property {boolean} [streaming] - Whether to enable streaming for the API requests
|
|
14
|
+
* @property {ReactNode} children - The children to be rendered inside the provider
|
|
15
|
+
*/
|
|
1
16
|
/**
|
|
2
17
|
* ApiProvider component that wraps the application and provides the API context, bulk actions context, and form contexts.
|
|
3
18
|
* @param {ApiProviderProps} props
|
|
@@ -10,6 +10,17 @@ export function useProvideApi({ path, initialQueryParams, relation, fetchInfo, c
|
|
|
10
10
|
dataQueryProps: any;
|
|
11
11
|
throwOnError?: boolean;
|
|
12
12
|
streaming?: boolean;
|
|
13
|
+
}, api?: {
|
|
14
|
+
getItem: (path: any, id: any) => Promise<string | Record<string, any>>;
|
|
15
|
+
getItems: (path: string, queryParams: Record<string, any>, signal: AbortSignal) => Promise<Record<string, any> | string>;
|
|
16
|
+
createItem: (path: any, data: any) => Promise<string | Record<string, any>>;
|
|
17
|
+
updateItem: (path: any, id: any, data: any) => Promise<string | Record<string, any>>;
|
|
18
|
+
deleteItem: (path: any, id: any) => Promise<string | Record<string, any>>;
|
|
19
|
+
downloadItems: (path: any, queryParams: any, { label, export_mode, delimiter, quotechar }?: {}) => Promise<void>;
|
|
20
|
+
uploadItems: (path: any, file: any, { delimiter, quotechar }?: {}) => Promise<string | Record<string, any>>;
|
|
21
|
+
getInfo: (path: string, signal: AbortSignal) => Promise<Record<string, any>>;
|
|
22
|
+
formCreateItem: (path: any, data: any) => Promise<string | Record<string, any>>;
|
|
23
|
+
formUpdateItem: (path: any, id: any, data: any) => Promise<string | Record<string, any>>;
|
|
13
24
|
}): {
|
|
14
25
|
path: any;
|
|
15
26
|
data: unknown;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
import { postBulk } from '../utils/bulkActions/postBulkAction';
|
|
2
|
+
export namespace defaultBulk {
|
|
3
|
+
export { postBulk };
|
|
4
|
+
}
|
|
1
5
|
export function useProvideBulk({ path }: {
|
|
2
6
|
path: any;
|
|
7
|
+
}, bulk?: {
|
|
8
|
+
postBulk: (path: any, handler: any, data: any) => Promise<string | Record<string, any>>;
|
|
3
9
|
}): {
|
|
4
10
|
bulkActions: {
|
|
5
11
|
selectedIds: any[];
|
|
6
12
|
setSelectedIds: import('react').Dispatch<import('react').SetStateAction<any[]>>;
|
|
7
13
|
};
|
|
8
|
-
dispatchBulkActions: (handler: any, data: any) => Promise<any
|
|
14
|
+
dispatchBulkActions: (handler: any, data: any) => Promise<string | Record<string, any>>;
|
|
9
15
|
error: undefined;
|
|
10
16
|
resetError: () => void;
|
|
11
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function postBulk(path: any, handler: any, data: any): Promise<any
|
|
1
|
+
export function postBulk(path: any, handler: any, data: any): Promise<string | Record<string, any>>;
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
import { getUser, updateUser } from '../utils/userCRUD';
|
|
2
|
+
import { authSignin, authSignout, authResetPassword, authOAuthSignin } from '../utils/authFetch';
|
|
3
|
+
export function useProvideAuth(baseURL: any, authQueryProps: any, auth?: {
|
|
4
|
+
getUser: typeof getUser;
|
|
5
|
+
update: typeof updateUser;
|
|
6
|
+
signin: typeof authSignin;
|
|
7
|
+
signout: typeof authSignout;
|
|
8
|
+
resetPassword: typeof authResetPassword;
|
|
9
|
+
oauthSignin: typeof authOAuthSignin;
|
|
10
|
+
}): {
|
|
2
11
|
user: unknown;
|
|
3
12
|
loading: boolean;
|
|
4
13
|
error: any;
|
|
5
14
|
signin: ({ username, password }: {
|
|
6
15
|
username: any;
|
|
7
16
|
password: any;
|
|
8
|
-
}) => void
|
|
9
|
-
signout: () => void
|
|
10
|
-
update: (data: any) => void
|
|
11
|
-
resetPassword: (password: any) => void
|
|
12
|
-
|
|
17
|
+
}) => Promise<void>;
|
|
18
|
+
signout: () => Promise<void>;
|
|
19
|
+
update: (data: any) => Promise<void>;
|
|
20
|
+
resetPassword: (password: any) => Promise<void>;
|
|
21
|
+
oauthSignin: (provider: any, popup: any) => void;
|
|
13
22
|
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<unknown, Error>>;
|
|
14
23
|
resetError: () => void;
|
|
24
|
+
oauth_signin: (provider: any, popup: any) => void;
|
|
15
25
|
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { authInfo } from '../utils/authFetch';
|
|
2
|
+
export function useProvideInfo(baseUrl: any, auth: any, info?: {
|
|
3
|
+
getInfo: typeof authInfo;
|
|
4
|
+
}): {
|
|
2
5
|
baseUrl: any;
|
|
3
6
|
info: Record<string, any>;
|
|
4
7
|
loading: boolean;
|
|
@@ -38,10 +38,9 @@ export function authResetPassword(baseUrl: string, newPassword: string, { email
|
|
|
38
38
|
* @param {string} provider - The OAuth provider to use for sign-in (e.g., 'google', 'facebook').
|
|
39
39
|
* @param {boolean} popup - Whether to use a popup window for the sign-in process.
|
|
40
40
|
* @param {function} [afterSigninPopup] - Optional callback function to be called after the popup is closed.
|
|
41
|
-
*
|
|
42
|
-
* @returns {Promise<void>} A promise that resolves when the sign-in process is initiated.
|
|
41
|
+
* @returns {void} Redirects the user to the OAuth provider's sign-in page or opens a popup window for the sign-in process.
|
|
43
42
|
*/
|
|
44
|
-
export function authOAuthSignin(baseUrl: string, provider: string, popup: boolean, afterSigninPopup?: Function):
|
|
43
|
+
export function authOAuthSignin(baseUrl: string, provider: string, popup: boolean, afterSigninPopup?: Function): void;
|
|
45
44
|
/**
|
|
46
45
|
* Fetches authentication information for the user.
|
|
47
46
|
*
|
|
@@ -1,41 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
error: undefined;
|
|
22
|
-
streaming: {
|
|
23
|
-
data: {};
|
|
24
|
-
isEnd: boolean;
|
|
25
|
-
fetch: () => void;
|
|
26
|
-
};
|
|
27
|
-
specialKey: {
|
|
28
|
-
all: string;
|
|
29
|
-
actions: string;
|
|
30
|
-
};
|
|
31
|
-
setQueryParams: (partialQueryParams: any) => void;
|
|
32
|
-
refetch: () => void | Promise<import('@tanstack/react-query').QueryObserverResult<unknown, Error>>;
|
|
33
|
-
refetchInfo: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<unknown, Error>>;
|
|
34
|
-
getEntry: (id: any) => Promise<string | Record<string, any>>;
|
|
35
|
-
addEntry: (item: any) => Promise<string | Record<string, any>>;
|
|
36
|
-
updateEntry: (id: any, item: any) => Promise<string | Record<string, any>>;
|
|
37
|
-
deleteEntry: (id: any) => Promise<string | Record<string, any>>;
|
|
38
|
-
download: (label: any, { export_mode, delimiter, quotechar }?: {}) => Promise<void>;
|
|
39
|
-
upload: (file: any, { delimiter, quotechar }?: {}) => Promise<string | Record<string, any>>;
|
|
40
|
-
resetError: () => void;
|
|
41
|
-
};
|
|
1
|
+
import { getItem } from '../../../Wrappers/ApiProvider/utils/api/getItem';
|
|
2
|
+
import { getItems } from '../utils/api/getItems';
|
|
3
|
+
import { createItem } from '../../../Wrappers/ApiProvider/utils/api/createItem';
|
|
4
|
+
import { updateItem } from '../../../Wrappers/ApiProvider/utils/api/updateItem';
|
|
5
|
+
import { deleteItem } from '../../../Wrappers/ApiProvider/utils/api/deleteItem';
|
|
6
|
+
import { downloadItems } from '../utils/api/downloadItems';
|
|
7
|
+
import { uploadItems } from '../../../Wrappers/ApiProvider/utils/api/uploadItems';
|
|
8
|
+
import { getInfo } from '../../../Wrappers/ApiProvider/utils/api/getInfo';
|
|
9
|
+
export namespace defaultApi {
|
|
10
|
+
export { getItem };
|
|
11
|
+
export { getItems };
|
|
12
|
+
export { createItem };
|
|
13
|
+
export { updateItem };
|
|
14
|
+
export { deleteItem };
|
|
15
|
+
export { downloadItems };
|
|
16
|
+
export { uploadItems };
|
|
17
|
+
export { getInfo };
|
|
18
|
+
export function formCreateItem(path: any, item: any): Promise<never>;
|
|
19
|
+
export function formUpdateItem(path: any, id: any, item: any): Promise<never>;
|
|
20
|
+
}
|