fastapi-rtk 2.8.0 → 2.9.0
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/yup@1.7.1/yup/index.esm.cjs +1 -435
- package/dist/.external/esm/yup@1.7.1/yup/index.esm.mjs +2 -436
- package/dist/.external/lib/type-fest/index.d.ts +95 -0
- package/dist/.external/lib/type-fest/source/async-return-type.d.ts +25 -0
- package/dist/.external/lib/type-fest/source/asyncify.d.ts +33 -0
- package/dist/.external/lib/type-fest/source/basic.d.ts +45 -0
- package/dist/.external/lib/type-fest/source/camel-case.d.ts +73 -0
- package/dist/.external/lib/type-fest/source/camel-cased-properties-deep.d.ts +54 -0
- package/dist/.external/lib/type-fest/source/camel-cased-properties.d.ts +36 -0
- package/dist/.external/lib/type-fest/source/conditional-except.d.ts +45 -0
- package/dist/.external/lib/type-fest/source/conditional-keys.d.ts +47 -0
- package/dist/.external/lib/type-fest/source/conditional-pick.d.ts +44 -0
- package/dist/.external/lib/type-fest/source/delimiter-case.d.ts +93 -0
- package/dist/.external/lib/type-fest/source/delimiter-cased-properties-deep.d.ts +60 -0
- package/dist/.external/lib/type-fest/source/delimiter-cased-properties.d.ts +37 -0
- package/dist/.external/lib/type-fest/source/entries.d.ts +62 -0
- package/dist/.external/lib/type-fest/source/entry.d.ts +65 -0
- package/dist/.external/lib/type-fest/source/exact.d.ts +73 -0
- package/dist/.external/lib/type-fest/source/except.d.ts +57 -0
- package/dist/.external/lib/type-fest/source/fixed-length-array.d.ts +43 -0
- package/dist/.external/lib/type-fest/source/get.d.ts +184 -0
- package/dist/.external/lib/type-fest/source/has-optional-keys.d.ts +21 -0
- package/dist/.external/lib/type-fest/source/has-required-keys.d.ts +59 -0
- package/dist/.external/lib/type-fest/source/includes.d.ts +22 -0
- package/dist/.external/lib/type-fest/source/internal.d.ts +59 -0
- package/dist/.external/lib/type-fest/source/invariant-of.d.ts +76 -0
- package/dist/.external/lib/type-fest/source/iterable-element.d.ts +54 -0
- package/dist/.external/lib/type-fest/source/join.d.ts +30 -0
- package/dist/.external/lib/type-fest/source/jsonify.d.ts +90 -0
- package/dist/.external/lib/type-fest/source/kebab-case.d.ts +38 -0
- package/dist/.external/lib/type-fest/source/kebab-cased-properties-deep.d.ts +47 -0
- package/dist/.external/lib/type-fest/source/kebab-cased-properties.d.ts +30 -0
- package/dist/.external/lib/type-fest/source/last-array-element.d.ts +28 -0
- package/dist/.external/lib/type-fest/source/literal-to-primitive.d.ts +36 -0
- package/dist/.external/lib/type-fest/source/literal-union.d.ts +35 -0
- package/dist/.external/lib/type-fest/source/merge-exclusive.d.ts +41 -0
- package/dist/.external/lib/type-fest/source/merge.d.ts +27 -0
- package/dist/.external/lib/type-fest/source/multidimensional-array.d.ts +43 -0
- package/dist/.external/lib/type-fest/source/multidimensional-readonly-array.d.ts +47 -0
- package/dist/.external/lib/type-fest/source/mutable.d.ts +5 -0
- package/dist/.external/lib/type-fest/source/numeric.d.ts +170 -0
- package/dist/.external/lib/type-fest/source/observable-like.d.ts +62 -0
- package/dist/.external/lib/type-fest/source/opaque.d.ts +107 -0
- package/dist/.external/lib/type-fest/source/optional-keys-of.d.ts +38 -0
- package/dist/.external/lib/type-fest/source/package-json.d.ts +663 -0
- package/dist/.external/lib/type-fest/source/partial-deep.d.ts +113 -0
- package/dist/.external/lib/type-fest/source/partial-on-undefined-deep.d.ts +70 -0
- package/dist/.external/lib/type-fest/source/pascal-case.d.ts +38 -0
- package/dist/.external/lib/type-fest/source/pascal-cased-properties-deep.d.ts +54 -0
- package/dist/.external/lib/type-fest/source/pascal-cased-properties.d.ts +34 -0
- package/dist/.external/lib/type-fest/source/primitive.d.ts +13 -0
- package/dist/.external/lib/type-fest/source/promisable.d.ts +25 -0
- package/dist/.external/lib/type-fest/source/promise-value.d.ts +29 -0
- package/dist/.external/lib/type-fest/source/readonly-deep.d.ts +85 -0
- package/dist/.external/lib/type-fest/source/readonly-tuple.d.ts +41 -0
- package/dist/.external/lib/type-fest/source/remove-index-signature.d.ts +104 -0
- package/dist/.external/lib/type-fest/source/replace.d.ts +67 -0
- package/dist/.external/lib/type-fest/source/require-all-or-none.d.ts +36 -0
- package/dist/.external/lib/type-fest/source/require-at-least-one.d.ts +35 -0
- package/dist/.external/lib/type-fest/source/require-exactly-one.d.ts +34 -0
- package/dist/.external/lib/type-fest/source/required-keys-of.d.ts +29 -0
- package/dist/.external/lib/type-fest/source/schema.d.ts +72 -0
- package/dist/.external/lib/type-fest/source/screaming-snake-case.d.ts +33 -0
- package/dist/.external/lib/type-fest/source/set-non-nullable.d.ts +35 -0
- package/dist/.external/lib/type-fest/source/set-optional.d.ts +35 -0
- package/dist/.external/lib/type-fest/source/set-required.d.ts +35 -0
- package/dist/.external/lib/type-fest/source/set-return-type.d.ts +31 -0
- package/dist/.external/lib/type-fest/source/simplify.d.ts +83 -0
- package/dist/.external/lib/type-fest/source/snake-case.d.ts +38 -0
- package/dist/.external/lib/type-fest/source/snake-cased-properties-deep.d.ts +47 -0
- package/dist/.external/lib/type-fest/source/snake-cased-properties.d.ts +30 -0
- package/dist/.external/lib/type-fest/source/split.d.ts +29 -0
- package/dist/.external/lib/type-fest/source/spread.d.ts +85 -0
- package/dist/.external/lib/type-fest/source/string-key-of.d.ts +25 -0
- package/dist/.external/lib/type-fest/source/stringified.d.ts +23 -0
- package/dist/.external/lib/type-fest/source/trim.d.ts +25 -0
- package/dist/.external/lib/type-fest/source/tsconfig-json.d.ts +1172 -0
- package/dist/.external/lib/type-fest/source/typed-array.d.ts +17 -0
- package/dist/.external/lib/type-fest/source/union-to-intersection.d.ts +60 -0
- package/dist/.external/lib/type-fest/source/value-of.d.ts +42 -0
- package/dist/.external/lib/type-fest/source/writable.d.ts +40 -0
- package/dist/api/cjs/ApiProvider/ApiProvider.cjs +80 -0
- package/dist/{core/cjs/Wrappers → api/cjs}/ApiProvider/hooks/useProvideApi.cjs +26 -25
- package/dist/{core/cjs/Wrappers → api/cjs}/ApiProvider/hooks/useProvideBulk.cjs +5 -3
- package/dist/{core/cjs/Wrappers → api/cjs}/ApiProvider/hooks/useProvideForm.cjs +1 -1
- package/dist/{core/cjs/Wrappers → api/cjs}/ApiProvider/hooks/utils/useApiActions.cjs +15 -15
- package/dist/{core/cjs/Wrappers → api/cjs}/ApiProvider/hooks/utils/useStreamingData.cjs +2 -2
- package/dist/{core/cjs/Wrappers → api/cjs}/ApiProvider/utils/getValidationSchema.cjs +1 -1
- package/dist/{core/cjs/Wrappers → api/cjs}/Provider/Contexts/LangContext.cjs +20 -6
- package/dist/api/cjs/Provider/Provider.cjs +51 -0
- package/dist/{core/cjs/Wrappers → api/cjs}/Provider/hooks/useProvideAuth.cjs +18 -17
- package/dist/{core/cjs/Wrappers → api/cjs}/Provider/hooks/useProvideInfo.cjs +6 -4
- package/dist/api/cjs/Provider/hooks/useProvideLang.cjs +76 -0
- package/dist/api/cjs/_virtual/_commonjsHelpers.cjs +6 -0
- package/dist/api/cjs/_virtual/index.cjs +5 -0
- package/dist/api/cjs/_virtual/index2.cjs +5 -0
- package/dist/api/cjs/_virtual/index3.cjs +6 -0
- package/dist/api/cjs/_virtual/index4.cjs +4 -0
- package/dist/api/cjs/adapters/AdaptersContext.cjs +10 -0
- package/dist/api/cjs/auth/authFetch.cjs +63 -0
- package/dist/api/cjs/auth/userCRUD.cjs +20 -0
- package/dist/api/cjs/fetchers/createItem.cjs +14 -0
- package/dist/api/cjs/fetchers/deleteItem.cjs +14 -0
- package/dist/api/cjs/fetchers/downloadItems.cjs +33 -0
- package/dist/api/cjs/fetchers/formCreateItem.cjs +18 -0
- package/dist/api/cjs/fetchers/formUpdateItem.cjs +18 -0
- package/dist/api/cjs/fetchers/getInfo.cjs +10 -0
- package/dist/api/cjs/fetchers/getItem.cjs +14 -0
- package/dist/api/cjs/fetchers/getItems.cjs +13 -0
- package/dist/api/cjs/fetchers/postBulkAction.cjs +14 -0
- package/dist/api/cjs/fetchers/request.cjs +9 -0
- package/dist/api/cjs/fetchers/updateItem.cjs +14 -0
- package/dist/api/cjs/fetchers/uploadItems.cjs +24 -0
- package/dist/{core → api}/cjs/hooks/auth/useAuth.cjs +1 -1
- package/dist/{core → api}/cjs/hooks/auth/useInfo.cjs +1 -1
- package/dist/api/cjs/hooks/useDidUpdate.cjs +20 -0
- package/dist/api/cjs/index.cjs +75 -0
- package/dist/{utils/cjs → api/cjs/utils}/convertToFormData/convertToFormData.cjs +5 -5
- package/dist/{utils/cjs → api/cjs/utils}/createFetchParams/createFetchParams.cjs +1 -3
- package/dist/api/esm/ApiProvider/ApiProvider.mjs +80 -0
- package/dist/{core/esm/Wrappers → api/esm}/ApiProvider/hooks/useProvideApi.mjs +19 -18
- package/dist/{core/esm/Wrappers → api/esm}/ApiProvider/hooks/useProvideBulk.mjs +5 -3
- package/dist/{core/esm/Wrappers → api/esm}/ApiProvider/hooks/useProvideForm.mjs +1 -1
- package/dist/{core/esm/Wrappers → api/esm}/ApiProvider/hooks/utils/useApiActions.mjs +15 -15
- package/dist/{core/esm/Wrappers → api/esm}/ApiProvider/hooks/utils/useStreamingData.mjs +1 -1
- package/dist/{core/esm/Wrappers → api/esm}/ApiProvider/utils/getValidationSchema.mjs +2 -2
- package/dist/{core/esm/Wrappers → api/esm}/Provider/Contexts/LangContext.mjs +21 -7
- package/dist/api/esm/Provider/Provider.mjs +51 -0
- package/dist/{core/esm/Wrappers → api/esm}/Provider/hooks/useProvideAuth.mjs +16 -15
- package/dist/{core/esm/Wrappers → api/esm}/Provider/hooks/useProvideInfo.mjs +5 -3
- package/dist/api/esm/Provider/hooks/useProvideLang.mjs +76 -0
- package/dist/api/esm/_virtual/_commonjsHelpers.mjs +6 -0
- package/dist/api/esm/_virtual/index.mjs +5 -0
- package/dist/api/esm/_virtual/index2.mjs +5 -0
- package/dist/api/esm/_virtual/index3.mjs +7 -0
- package/dist/api/esm/_virtual/index4.mjs +4 -0
- package/dist/api/esm/adapters/AdaptersContext.mjs +10 -0
- package/dist/api/esm/auth/authFetch.mjs +63 -0
- package/dist/api/esm/auth/userCRUD.mjs +20 -0
- package/dist/api/esm/fetchers/createItem.mjs +14 -0
- package/dist/api/esm/fetchers/deleteItem.mjs +14 -0
- package/dist/api/esm/fetchers/downloadItems.mjs +33 -0
- package/dist/api/esm/fetchers/formCreateItem.mjs +18 -0
- package/dist/api/esm/fetchers/formUpdateItem.mjs +18 -0
- package/dist/api/esm/fetchers/getInfo.mjs +10 -0
- package/dist/api/esm/fetchers/getItem.mjs +14 -0
- package/dist/api/esm/fetchers/getItems.mjs +13 -0
- package/dist/api/esm/fetchers/postBulkAction.mjs +14 -0
- package/dist/api/esm/fetchers/request.mjs +9 -0
- package/dist/api/esm/fetchers/updateItem.mjs +14 -0
- package/dist/api/esm/fetchers/uploadItems.mjs +24 -0
- package/dist/{core → api}/esm/hooks/auth/useAuth.mjs +1 -1
- package/dist/{core → api}/esm/hooks/auth/useInfo.mjs +1 -1
- package/dist/api/esm/hooks/useDidUpdate.mjs +20 -0
- package/dist/api/esm/index.mjs +75 -0
- package/dist/{utils/esm → api/esm/utils}/convertToFormData/convertToFormData.mjs +5 -5
- package/dist/{utils/esm → api/esm/utils}/createFetchParams/createFetchParams.mjs +1 -3
- package/dist/api/lib/ApiProvider/ApiProvider.d.ts +17 -0
- package/dist/{core/lib/Wrappers → api/lib}/ApiProvider/Contexts/BulkActionsContext.d.ts +1 -1
- package/dist/api/lib/ApiProvider/Contexts/FormContext.d.ts +5 -0
- package/dist/api/lib/ApiProvider/hooks/types.d.ts +150 -0
- package/dist/api/lib/ApiProvider/hooks/useProvideBulk.d.ts +7 -0
- package/dist/api/lib/ApiProvider/hooks/useProvideForm.d.ts +2 -0
- package/dist/api/lib/ApiProvider/hooks/utils/useApiActions.d.ts +11 -0
- package/dist/{core/lib/Wrappers → api/lib}/ApiProvider/hooks/utils/useStreamingData.d.ts +26 -26
- package/dist/api/lib/ApiProvider/types.d.ts +51 -0
- package/dist/{core/lib/Wrappers → api/lib}/ApiProvider/utils/getDefaultValues.d.ts +2 -2
- package/dist/{core/lib/Wrappers → api/lib}/ApiProvider/utils/getValidationSchema.d.ts +1 -1
- package/dist/{core/lib/Wrappers → api/lib}/Provider/Contexts/AuthContext.d.ts +1 -1
- package/dist/{core/lib/Wrappers → api/lib}/Provider/Contexts/InfoContext.d.ts +1 -1
- package/dist/{core/lib/Wrappers → api/lib}/Provider/Contexts/types.d.ts +5 -4
- package/dist/api/lib/Provider/Provider.d.ts +14 -0
- package/dist/api/lib/Provider/hooks/types.d.ts +22 -0
- package/dist/api/lib/Provider/hooks/useProvideAuth.d.ts +17 -0
- package/dist/{core/lib/Wrappers → api/lib}/Provider/hooks/useProvideInfo.d.ts +2 -2
- package/dist/{core/lib/Wrappers → api/lib}/Provider/hooks/useProvideLang.d.ts +1 -2
- package/dist/api/lib/Provider/types.d.ts +35 -0
- package/dist/api/lib/adapters/AdaptersContext.d.ts +10 -0
- package/dist/api/lib/adapters/types.d.ts +69 -0
- package/dist/{core/lib/Wrappers/Provider/utils → api/lib/auth}/authFetch.d.ts +13 -7
- package/dist/api/lib/auth/types.d.ts +40 -0
- package/dist/api/lib/auth/userCRUD.d.ts +22 -0
- package/dist/{core/lib/Wrappers/ApiProvider/utils/bulkActions/types.d.ts → api/lib/fetchers/bulkActions.types.d.ts} +3 -3
- package/dist/api/lib/fetchers/createItem.d.ts +4 -0
- package/dist/api/lib/fetchers/deleteItem.d.ts +4 -0
- package/dist/api/lib/fetchers/downloadItems.d.ts +4 -0
- package/dist/api/lib/fetchers/formCreateItem.d.ts +4 -0
- package/dist/api/lib/fetchers/formUpdateItem.d.ts +4 -0
- package/dist/{core/lib/Wrappers/ApiProvider/utils/api → api/lib/fetchers}/getInfo.d.ts +3 -1
- package/dist/api/lib/fetchers/getItem.d.ts +4 -0
- package/dist/{core/lib/Wrappers/ApiProvider/utils/api → api/lib/fetchers}/getItems.d.ts +3 -1
- package/dist/api/lib/fetchers/postBulkAction.d.ts +4 -0
- package/dist/api/lib/fetchers/request.d.ts +7 -0
- package/dist/{core/lib/Wrappers/ApiProvider/utils/api → api/lib/fetchers}/types.d.ts +3 -7
- package/dist/api/lib/fetchers/updateItem.d.ts +4 -0
- package/dist/api/lib/fetchers/uploadItems.d.ts +3 -0
- package/dist/api/lib/fetchers/uploadItems.test.d.ts +1 -0
- package/dist/{core → api}/lib/hooks/auth/types.d.ts +2 -39
- package/dist/api/lib/hooks/auth/useAuth.test.d.ts +1 -0
- package/dist/api/lib/hooks/auth/useInfo.test.d.ts +1 -0
- package/dist/api/lib/hooks/useDidUpdate.d.ts +3 -0
- package/dist/api/lib/index.d.ts +35 -0
- package/dist/api/lib/utils/convertToFormData/convertToFormData.d.ts +17 -0
- package/dist/api/lib/utils/convertToFormData/convertToFormData.test.d.ts +1 -0
- package/dist/{utils/lib → api/lib/utils}/createFetchParams/createFetchParams.d.ts +3 -4
- package/dist/api/lib/utils/createFetchParams/createFetchParams.test.d.ts +1 -0
- package/dist/{utils/lib → api/lib/utils}/parseResponse/parseResponse.d.ts +1 -2
- package/dist/api/lib/utils/parseResponse/parseResponse.test.d.ts +1 -0
- package/dist/constants/cjs/index.cjs +16 -2
- package/dist/constants/esm/index.mjs +16 -2
- package/dist/core/cjs/Dialogs/AddDialog.cjs +2 -2
- package/dist/core/cjs/Dialogs/EditDialog.cjs +2 -2
- package/dist/core/cjs/Menu/UserMenu/UserMenu.cjs +2 -2
- package/dist/core/cjs/Modals/CommonModal.cjs +2 -2
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useActions.cjs +5 -5
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/Cell.cjs +4 -4
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter.cjs +4 -4
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/HeaderAdvancedFiltersMenuButton.cjs +4 -4
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useColumns/useColumns.cjs +5 -5
- package/dist/core/cjs/Tables/NextGenDataGrid/hooks/useToolbar/useToolbar.cjs +9 -9
- package/dist/core/cjs/Wrappers/ApiProvider/ApiProvider.cjs +8 -74
- package/dist/core/cjs/Wrappers/Provider/Provider.cjs +18 -47
- package/dist/core/cjs/adapters/web/cookieTransport.cjs +15 -0
- package/dist/core/cjs/adapters/web/index.cjs +23 -0
- package/dist/core/cjs/adapters/web/webFileDownloadAdapter.cjs +16 -0
- package/dist/core/cjs/adapters/web/webFormDataAdapter.cjs +8 -0
- package/dist/core/cjs/adapters/web/webNetworkAdapter.cjs +6 -0
- package/dist/core/cjs/adapters/web/webOAuthOpener.cjs +26 -0
- package/dist/core/cjs/adapters/web/webStorageAdapter.cjs +21 -0
- package/dist/core/cjs/fab-react-toolkit-patch/api/hooks/useProvideApi.cjs +7 -12
- package/dist/core/cjs/fab-react-toolkit-patch/api/hooks/useProvideBulk.cjs +2 -2
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/api/downloadItems.cjs +5 -3
- package/dist/core/cjs/fab-react-toolkit-patch/api/utils/api/getItems.cjs +6 -5
- package/dist/core/cjs/fab-react-toolkit-patch/auth/utils/authFetch.cjs +19 -15
- package/dist/core/cjs/fab-react-toolkit-patch/auth/utils/userCRUD.cjs +9 -6
- package/dist/core/cjs/hooks/api/useBulkActions.cjs +2 -5
- package/dist/core/cjs/hooks/api/useForms.cjs +5 -5
- package/dist/core/cjs/index.cjs +83 -6
- package/dist/core/esm/Dialogs/AddDialog.mjs +1 -1
- package/dist/core/esm/Dialogs/EditDialog.mjs +1 -1
- package/dist/core/esm/Menu/UserMenu/UserMenu.mjs +1 -1
- package/dist/core/esm/Modals/CommonModal.mjs +1 -1
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useActions.mjs +1 -1
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/Cell.mjs +1 -1
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/ColumnHeaderFilter.mjs +1 -1
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/HeaderAdvancedFiltersMenuButton.mjs +1 -1
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useColumns/useColumns.mjs +1 -1
- package/dist/core/esm/Tables/NextGenDataGrid/hooks/useToolbar/useToolbar.mjs +1 -1
- package/dist/core/esm/Wrappers/ApiProvider/ApiProvider.mjs +5 -73
- package/dist/core/esm/Wrappers/Provider/Provider.mjs +15 -46
- package/dist/core/esm/adapters/web/cookieTransport.mjs +15 -0
- package/dist/core/esm/adapters/web/index.mjs +23 -0
- package/dist/core/esm/adapters/web/webFileDownloadAdapter.mjs +16 -0
- package/dist/core/esm/adapters/web/webFormDataAdapter.mjs +8 -0
- package/dist/core/esm/adapters/web/webNetworkAdapter.mjs +6 -0
- package/dist/core/esm/adapters/web/webOAuthOpener.mjs +26 -0
- package/dist/core/esm/adapters/web/webStorageAdapter.mjs +21 -0
- package/dist/core/esm/fab-react-toolkit-patch/api/hooks/useProvideApi.mjs +1 -6
- package/dist/core/esm/fab-react-toolkit-patch/api/hooks/useProvideBulk.mjs +1 -1
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/api/downloadItems.mjs +5 -3
- package/dist/core/esm/fab-react-toolkit-patch/api/utils/api/getItems.mjs +4 -3
- package/dist/core/esm/fab-react-toolkit-patch/auth/utils/authFetch.mjs +15 -11
- package/dist/core/esm/fab-react-toolkit-patch/auth/utils/userCRUD.mjs +8 -5
- package/dist/core/esm/hooks/api/useBulkActions.mjs +2 -5
- package/dist/core/esm/hooks/api/useForms.mjs +1 -1
- package/dist/core/esm/index.mjs +21 -4
- package/dist/core/lib/Tables/NextGenDataGrid/types.d.ts +1 -1
- package/dist/core/lib/Wrappers/ApiProvider/ApiProvider.d.ts +4 -17
- package/dist/core/lib/Wrappers/ApiProvider/types.d.ts +3 -47
- package/dist/core/lib/Wrappers/Provider/Provider.d.ts +4 -14
- package/dist/core/lib/Wrappers/Provider/types.d.ts +6 -27
- package/dist/core/lib/adapters/web/cookieTransport.d.ts +2 -0
- package/dist/core/lib/adapters/web/index.d.ts +9 -0
- package/dist/core/lib/adapters/web/webAdapters.test.d.ts +1 -0
- package/dist/core/lib/adapters/web/webFileDownloadAdapter.d.ts +2 -0
- package/dist/core/lib/adapters/web/webFormDataAdapter.d.ts +2 -0
- package/dist/core/lib/adapters/web/webNetworkAdapter.d.ts +2 -0
- package/dist/core/lib/adapters/web/webOAuthOpener.d.ts +2 -0
- package/dist/core/lib/adapters/web/webStorageAdapter.d.ts +3 -0
- package/dist/core/lib/fab-react-toolkit-patch/api/hooks/useProvideApi.d.ts +1 -1
- package/dist/core/lib/fab-react-toolkit-patch/api/hooks/useProvideBulk.d.ts +1 -1
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/downloadItems.d.ts +2 -2
- package/dist/core/lib/fab-react-toolkit-patch/api/utils/api/getItems.d.ts +3 -2
- package/dist/core/lib/fab-react-toolkit-patch/auth/utils/authFetch.d.ts +11 -6
- package/dist/core/lib/fab-react-toolkit-patch/auth/utils/userCRUD.d.ts +5 -3
- package/dist/core/lib/hooks/api/types.d.ts +1 -59
- package/dist/core/lib/hooks/api/useForms.d.ts +1 -1
- package/dist/core/lib/index.d.ts +5 -6
- package/dist/core/lib/test-helpers/types.d.ts +1 -1
- package/dist/jsonforms/lib/test-helpers/inputWrap.d.ts +2 -2
- package/dist/react-native-adapters/cjs/asyncStorageAdapter.cjs +8 -0
- package/dist/react-native-adapters/cjs/bearerTransport.cjs +29 -0
- package/dist/react-native-adapters/cjs/createReactNativeAdapters.cjs +24 -0
- package/dist/react-native-adapters/cjs/index.cjs +16 -0
- package/dist/react-native-adapters/cjs/rnFileDownloadAdapter.cjs +24 -0
- package/dist/react-native-adapters/cjs/rnFormDataAdapter.cjs +15 -0
- package/dist/react-native-adapters/cjs/rnNetworkAdapter.cjs +9 -0
- package/dist/react-native-adapters/cjs/rnOAuthOpener.cjs +9 -0
- package/dist/react-native-adapters/esm/asyncStorageAdapter.mjs +8 -0
- package/dist/react-native-adapters/esm/bearerTransport.mjs +29 -0
- package/dist/react-native-adapters/esm/createReactNativeAdapters.mjs +24 -0
- package/dist/react-native-adapters/esm/index.mjs +16 -0
- package/dist/react-native-adapters/esm/rnFileDownloadAdapter.mjs +24 -0
- package/dist/react-native-adapters/esm/rnFormDataAdapter.mjs +15 -0
- package/dist/react-native-adapters/esm/rnNetworkAdapter.mjs +9 -0
- package/dist/react-native-adapters/esm/rnOAuthOpener.mjs +9 -0
- package/dist/react-native-adapters/lib/asyncStorageAdapter.d.ts +7 -0
- package/dist/react-native-adapters/lib/asyncStorageAdapter.test.d.ts +1 -0
- package/dist/react-native-adapters/lib/bearerTransport.d.ts +5 -0
- package/dist/react-native-adapters/lib/bearerTransport.test.d.ts +1 -0
- package/dist/react-native-adapters/lib/createReactNativeAdapters.d.ts +11 -0
- package/dist/react-native-adapters/lib/createReactNativeAdapters.test.d.ts +1 -0
- package/dist/react-native-adapters/lib/index.d.ts +8 -0
- package/dist/react-native-adapters/lib/rnFileDownloadAdapter.d.ts +7 -0
- package/dist/react-native-adapters/lib/rnFileDownloadAdapter.test.d.ts +1 -0
- package/dist/react-native-adapters/lib/rnFormDataAdapter.d.ts +2 -0
- package/dist/react-native-adapters/lib/rnFormDataAdapter.test.d.ts +1 -0
- package/dist/react-native-adapters/lib/rnNetworkAdapter.d.ts +4 -0
- package/dist/react-native-adapters/lib/rnNetworkAdapter.test.d.ts +1 -0
- package/dist/react-native-adapters/lib/rnOAuthOpener.d.ts +5 -0
- package/dist/react-native-adapters/lib/rnOAuthOpener.test.d.ts +1 -0
- package/dist/react-native-adapters/lib/types.d.ts +23 -0
- package/dist/utils/cjs/Memoizer/MemoWrapper.cjs +2 -2
- package/dist/utils/cjs/Memoizer/RenderWrapper.cjs +2 -2
- package/dist/utils/cjs/index.cjs +2 -6
- package/dist/utils/cjs/randomId/randomId.cjs +4 -0
- package/dist/utils/esm/Memoizer/MemoWrapper.mjs +1 -1
- package/dist/utils/esm/Memoizer/RenderWrapper.mjs +1 -1
- package/dist/utils/esm/index.mjs +2 -6
- package/dist/utils/esm/randomId/randomId.mjs +4 -0
- package/dist/utils/lib/index.d.ts +1 -3
- package/dist/utils/lib/randomId/index.d.ts +1 -0
- package/dist/utils/lib/randomId/randomId.d.ts +2 -0
- package/dist/utils/lib/randomId/randomId.test.d.ts +1 -0
- package/package.json +11 -1
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/createItem.cjs +0 -14
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/deleteItem.cjs +0 -13
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/downloadItems.cjs +0 -39
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/formCreateItem.cjs +0 -12
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/formUpdateItem.cjs +0 -16
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/getInfo.cjs +0 -9
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/getItem.cjs +0 -13
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/getItems.cjs +0 -9
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/updateItem.cjs +0 -14
- package/dist/core/cjs/Wrappers/ApiProvider/utils/api/uploadItems.cjs +0 -26
- package/dist/core/cjs/Wrappers/ApiProvider/utils/bulkActions/postBulkAction.cjs +0 -14
- package/dist/core/cjs/Wrappers/Provider/hooks/useProvideLang.cjs +0 -45
- package/dist/core/cjs/Wrappers/Provider/utils/authFetch.cjs +0 -99
- package/dist/core/cjs/Wrappers/Provider/utils/userCRUD.cjs +0 -32
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/createItem.mjs +0 -14
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/deleteItem.mjs +0 -13
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/downloadItems.mjs +0 -39
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/formCreateItem.mjs +0 -12
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/formUpdateItem.mjs +0 -16
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/getInfo.mjs +0 -9
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/getItem.mjs +0 -13
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/getItems.mjs +0 -9
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/updateItem.mjs +0 -14
- package/dist/core/esm/Wrappers/ApiProvider/utils/api/uploadItems.mjs +0 -26
- package/dist/core/esm/Wrappers/ApiProvider/utils/bulkActions/postBulkAction.mjs +0 -14
- package/dist/core/esm/Wrappers/Provider/hooks/useProvideLang.mjs +0 -45
- package/dist/core/esm/Wrappers/Provider/utils/authFetch.mjs +0 -99
- package/dist/core/esm/Wrappers/Provider/utils/userCRUD.mjs +0 -32
- package/dist/core/lib/Wrappers/ApiProvider/Contexts/FormContext.d.ts +0 -5
- package/dist/core/lib/Wrappers/ApiProvider/hooks/types.d.ts +0 -90
- package/dist/core/lib/Wrappers/ApiProvider/hooks/useProvideBulk.d.ts +0 -8
- package/dist/core/lib/Wrappers/ApiProvider/hooks/useProvideForm.d.ts +0 -2
- package/dist/core/lib/Wrappers/ApiProvider/hooks/utils/useApiActions.d.ts +0 -11
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/createItem.d.ts +0 -3
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/deleteItem.d.ts +0 -3
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/downloadItems.d.ts +0 -3
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/formCreateItem.d.ts +0 -3
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/formUpdateItem.d.ts +0 -3
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/getItem.d.ts +0 -3
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/updateItem.d.ts +0 -3
- package/dist/core/lib/Wrappers/ApiProvider/utils/api/uploadItems.d.ts +0 -2
- package/dist/core/lib/Wrappers/ApiProvider/utils/bulkActions/postBulkAction.d.ts +0 -3
- package/dist/core/lib/Wrappers/Provider/hooks/types.d.ts +0 -24
- package/dist/core/lib/Wrappers/Provider/hooks/useProvideAuth.d.ts +0 -17
- package/dist/core/lib/Wrappers/Provider/utils/userCRUD.d.ts +0 -19
- package/dist/utils/lib/convertToFormData/convertToFormData.d.ts +0 -15
- /package/dist/{core/cjs/Wrappers → api/cjs}/ApiProvider/Contexts/BulkActionsContext.cjs +0 -0
- /package/dist/{core/cjs/Wrappers → api/cjs}/ApiProvider/Contexts/FormContext.cjs +0 -0
- /package/dist/{core/cjs/Wrappers → api/cjs}/ApiProvider/hooks/utils/useLatest.cjs +0 -0
- /package/dist/{core/cjs/Wrappers → api/cjs}/ApiProvider/utils/convertInfo.cjs +0 -0
- /package/dist/{core/cjs/Wrappers → api/cjs}/ApiProvider/utils/createQueryParams.cjs +0 -0
- /package/dist/{core/cjs/Wrappers → api/cjs}/ApiProvider/utils/getDefaultValues.cjs +0 -0
- /package/dist/{core/cjs/Wrappers → api/cjs}/Provider/Contexts/AuthContext.cjs +0 -0
- /package/dist/{core/cjs/Wrappers → api/cjs}/Provider/Contexts/InfoContext.cjs +0 -0
- /package/dist/{core → api}/cjs/translations/de.cjs +0 -0
- /package/dist/{utils/cjs → api/cjs/utils}/parseResponse/parseResponse.cjs +0 -0
- /package/dist/{core/esm/Wrappers → api/esm}/ApiProvider/Contexts/BulkActionsContext.mjs +0 -0
- /package/dist/{core/esm/Wrappers → api/esm}/ApiProvider/Contexts/FormContext.mjs +0 -0
- /package/dist/{core/esm/Wrappers → api/esm}/ApiProvider/hooks/utils/useLatest.mjs +0 -0
- /package/dist/{core/esm/Wrappers → api/esm}/ApiProvider/utils/convertInfo.mjs +0 -0
- /package/dist/{core/esm/Wrappers → api/esm}/ApiProvider/utils/createQueryParams.mjs +0 -0
- /package/dist/{core/esm/Wrappers → api/esm}/ApiProvider/utils/getDefaultValues.mjs +0 -0
- /package/dist/{core/esm/Wrappers → api/esm}/Provider/Contexts/AuthContext.mjs +0 -0
- /package/dist/{core/esm/Wrappers → api/esm}/Provider/Contexts/InfoContext.mjs +0 -0
- /package/dist/{core → api}/esm/translations/de.mjs +0 -0
- /package/dist/{utils/esm → api/esm/utils}/parseResponse/parseResponse.mjs +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/hooks/useProvideApi.test.d.ts → api/lib/ApiProvider/ApiProvider.test.d.ts} +0 -0
- /package/dist/{core/lib/Wrappers → api/lib}/ApiProvider/Contexts/ApiContext.d.ts +0 -0
- /package/dist/{core/lib/Wrappers → api/lib}/ApiProvider/hooks/useProvideApi.d.ts +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/hooks/useProvideBulk.test.d.ts → api/lib/ApiProvider/hooks/useProvideApi.test.d.ts} +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/hooks/useProvideForm.test.d.ts → api/lib/ApiProvider/hooks/useProvideBulk.test.d.ts} +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/hooks/utils/useApiActions.test.d.ts → api/lib/ApiProvider/hooks/useProvideForm.test.d.ts} +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/hooks/utils/useLatest.test.d.ts → api/lib/ApiProvider/hooks/utils/useApiActions.test.d.ts} +0 -0
- /package/dist/{core/lib/Wrappers → api/lib}/ApiProvider/hooks/utils/useLatest.d.ts +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/hooks/utils/useStreamingData.test.d.ts → api/lib/ApiProvider/hooks/utils/useLatest.test.d.ts} +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/utils/api/createItem.test.d.ts → api/lib/ApiProvider/hooks/utils/useStreamingData.test.d.ts} +0 -0
- /package/dist/{core/lib/Wrappers → api/lib}/ApiProvider/utils/convertInfo.d.ts +0 -0
- /package/dist/{core/lib/Wrappers → api/lib}/ApiProvider/utils/convertInfo.test.d.ts +0 -0
- /package/dist/{core/lib/Wrappers → api/lib}/ApiProvider/utils/createQueryParams.d.ts +0 -0
- /package/dist/{core/lib/Wrappers → api/lib}/ApiProvider/utils/createQueryParams.test.d.ts +0 -0
- /package/dist/{core/lib/Wrappers → api/lib}/ApiProvider/utils/getDefaultValues.test.d.ts +0 -0
- /package/dist/{core/lib/Wrappers → api/lib}/ApiProvider/utils/getValidationSchema.test.d.ts +0 -0
- /package/dist/{core/lib/Wrappers → api/lib}/ApiProvider/utils/types.d.ts +0 -0
- /package/dist/{core/lib/Wrappers → api/lib}/Provider/Contexts/LangContext.d.ts +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/utils/api/deleteItem.test.d.ts → api/lib/Provider/Provider.test.d.ts} +0 -0
- /package/dist/{core/lib/Wrappers → api/lib}/Provider/hooks/useProvideAuth.test.d.ts +0 -0
- /package/dist/{core/lib/Wrappers → api/lib}/Provider/hooks/useProvideInfo.test.d.ts +0 -0
- /package/dist/{core/lib/Wrappers → api/lib}/Provider/hooks/useProvideLang.test.d.ts +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/utils/api/downloadItems.test.d.ts → api/lib/__tests__/purity.test.d.ts} +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/utils/api/formCreateItem.test.d.ts → api/lib/__tests__/smoke.test.d.ts} +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/utils/api/formUpdateItem.test.d.ts → api/lib/adapters/AdaptersContext.test.d.ts} +0 -0
- /package/dist/{core/lib/Wrappers/Provider/utils → api/lib/auth}/authFetch.test.d.ts +0 -0
- /package/dist/{core/lib/Wrappers/Provider/utils → api/lib/auth}/userCRUD.test.d.ts +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/utils/api/getInfo.test.d.ts → api/lib/fetchers/createItem.test.d.ts} +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/utils/api/getItem.test.d.ts → api/lib/fetchers/deleteItem.test.d.ts} +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/utils/api/getItems.test.d.ts → api/lib/fetchers/downloadItems.test.d.ts} +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/utils/api/updateItem.test.d.ts → api/lib/fetchers/formCreateItem.test.d.ts} +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/utils/api/uploadItems.test.d.ts → api/lib/fetchers/formUpdateItem.test.d.ts} +0 -0
- /package/dist/{core/lib/Wrappers/ApiProvider/utils/bulkActions/postBulkAction.test.d.ts → api/lib/fetchers/getInfo.test.d.ts} +0 -0
- /package/dist/{core/lib/hooks/auth/useAuth.test.d.ts → api/lib/fetchers/getItem.test.d.ts} +0 -0
- /package/dist/{core/lib/hooks/auth/useInfo.test.d.ts → api/lib/fetchers/getItems.test.d.ts} +0 -0
- /package/dist/{utils/lib/convertToFormData/convertToFormData.test.d.ts → api/lib/fetchers/postBulkAction.test.d.ts} +0 -0
- /package/dist/{utils/lib/createFetchParams/createFetchParams.test.d.ts → api/lib/fetchers/request.test.d.ts} +0 -0
- /package/dist/{utils/lib/parseResponse/parseResponse.test.d.ts → api/lib/fetchers/updateItem.test.d.ts} +0 -0
- /package/dist/{core → api}/lib/hooks/auth/useAuth.d.ts +0 -0
- /package/dist/{core → api}/lib/hooks/auth/useInfo.d.ts +0 -0
- /package/dist/{core → api}/lib/translations/de.d.ts +0 -0
- /package/dist/{utils/lib → api/lib/utils}/convertToFormData/index.d.ts +0 -0
- /package/dist/{utils/lib → api/lib/utils}/createFetchParams/index.d.ts +0 -0
- /package/dist/{utils/lib → api/lib/utils}/parseResponse/index.d.ts +0 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { convertId } from 'fastapi-rtk/utils';
|
|
2
|
+
import { EntryRow } from 'fastapi-rtk/contexts';
|
|
3
|
+
import { InfiniteData, QueryKey, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
4
|
+
import { RefObject } from 'react';
|
|
5
|
+
import { Adapters } from '../../adapters/types';
|
|
6
|
+
import { createItem } from '../../fetchers/createItem';
|
|
7
|
+
import { deleteItem } from '../../fetchers/deleteItem';
|
|
8
|
+
import { downloadItems } from '../../fetchers/downloadItems';
|
|
9
|
+
import { formCreateItem } from '../../fetchers/formCreateItem';
|
|
10
|
+
import { formUpdateItem } from '../../fetchers/formUpdateItem';
|
|
11
|
+
import { getInfo } from '../../fetchers/getInfo';
|
|
12
|
+
import { getItem } from '../../fetchers/getItem';
|
|
13
|
+
import { getItems } from '../../fetchers/getItems';
|
|
14
|
+
import { updateItem } from '../../fetchers/updateItem';
|
|
15
|
+
import { uploadItems } from '../../fetchers/uploadItems';
|
|
16
|
+
import { postBulk } from '../../fetchers/postBulkAction';
|
|
17
|
+
import { BulkActionResponse } from '../../fetchers/bulkActions.types';
|
|
18
|
+
import { DataPage, PrimaryKey, StreamingPage, ValidationError } from 'fastapi-rtk/api-types';
|
|
19
|
+
import { CoreConvertedInfo, QueryParams } from '../utils/types';
|
|
20
|
+
export type { DataPage, StreamingPage };
|
|
21
|
+
/** An entry identifier as accepted by the action functions before conversion. */
|
|
22
|
+
export type EntryId = Parameters<typeof convertId>[0];
|
|
23
|
+
/** The converted `/_info` data as held by the info query, tagged with the resource path. */
|
|
24
|
+
export type InfoQueryData = CoreConvertedInfo & {
|
|
25
|
+
path: string;
|
|
26
|
+
};
|
|
27
|
+
/** The set of API functions the provider hooks dispatch through. */
|
|
28
|
+
export interface ApiFunctions {
|
|
29
|
+
getItem: typeof getItem;
|
|
30
|
+
getItems: typeof getItems;
|
|
31
|
+
createItem: typeof createItem;
|
|
32
|
+
updateItem: typeof updateItem;
|
|
33
|
+
deleteItem: typeof deleteItem;
|
|
34
|
+
downloadItems: typeof downloadItems;
|
|
35
|
+
uploadItems: typeof uploadItems;
|
|
36
|
+
getInfo: typeof getInfo;
|
|
37
|
+
formCreateItem: typeof formCreateItem;
|
|
38
|
+
formUpdateItem: typeof formUpdateItem;
|
|
39
|
+
}
|
|
40
|
+
/** The set of bulk-action functions the bulk provider dispatches through. */
|
|
41
|
+
export interface BulkFunctions {
|
|
42
|
+
postBulk: typeof postBulk;
|
|
43
|
+
}
|
|
44
|
+
/** A relation reference seeded into the query filters by the provider. */
|
|
45
|
+
export interface RelationParam {
|
|
46
|
+
foreign_key?: string;
|
|
47
|
+
type?: string;
|
|
48
|
+
id?: PrimaryKey | null;
|
|
49
|
+
id_?: PrimaryKey | null;
|
|
50
|
+
}
|
|
51
|
+
/** The arguments accepted by `useApiActions`. */
|
|
52
|
+
export interface UseApiActionsParams {
|
|
53
|
+
api: ApiFunctions;
|
|
54
|
+
adapters: Adapters;
|
|
55
|
+
path: string;
|
|
56
|
+
pathRef: RefObject<string>;
|
|
57
|
+
infoRef: RefObject<InfoQueryData | undefined>;
|
|
58
|
+
queryParamsRef: RefObject<QueryParams | null>;
|
|
59
|
+
currentLanguage: string;
|
|
60
|
+
}
|
|
61
|
+
/** The options accepted by the provider's download action. */
|
|
62
|
+
export interface DownloadActionOptions {
|
|
63
|
+
export_mode?: string;
|
|
64
|
+
delimiter?: string;
|
|
65
|
+
quotechar?: string;
|
|
66
|
+
}
|
|
67
|
+
/** The options accepted by the provider's upload action. */
|
|
68
|
+
export interface UploadActionOptions {
|
|
69
|
+
delimiter?: string;
|
|
70
|
+
quotechar?: string;
|
|
71
|
+
}
|
|
72
|
+
/** The arguments accepted by `useStreamingData`. */
|
|
73
|
+
export interface UseStreamingDataParams {
|
|
74
|
+
streamingMode: boolean;
|
|
75
|
+
dataQuery: UseQueryResult<DataPage | null>;
|
|
76
|
+
streamingQuery: UseInfiniteQueryResult<InfiniteData<StreamingPage | null>>;
|
|
77
|
+
streamingQueryKey: QueryKey;
|
|
78
|
+
}
|
|
79
|
+
/** The configuration object accepted by `useProvideApi`. */
|
|
80
|
+
export interface UseProvideApiParams {
|
|
81
|
+
path: string;
|
|
82
|
+
initialQueryParams?: QueryParams;
|
|
83
|
+
relation?: RelationParam;
|
|
84
|
+
fetchInfo?: boolean;
|
|
85
|
+
clearInfoOnRefetch?: boolean;
|
|
86
|
+
clearDataOnRefetch?: boolean;
|
|
87
|
+
refetchInfoBasedOnLang?: boolean;
|
|
88
|
+
refetchDataBasedOnLang?: boolean;
|
|
89
|
+
resetQueryParamsOnPathChange?: boolean;
|
|
90
|
+
infoQueryProps?: Partial<UseQueryOptions<InfoQueryData>>;
|
|
91
|
+
dataQueryProps?: Partial<UseQueryOptions<DataPage | null>>;
|
|
92
|
+
streamingQueryProps?: Partial<UseInfiniteQueryOptions<StreamingPage | null, Error, InfiniteData<StreamingPage | null>, QueryKey, number>>;
|
|
93
|
+
streaming?: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface BulkActions {
|
|
96
|
+
/** An array of currently selected IDs for bulk actions. */
|
|
97
|
+
selectedIds: Array<string | number>;
|
|
98
|
+
/** A function to set the selected IDs. */
|
|
99
|
+
setSelectedIds: (ids: Array<string | number>) => void;
|
|
100
|
+
}
|
|
101
|
+
export interface BulkActionsContextValue {
|
|
102
|
+
/** An object containing the selected IDs and a function to set them. */
|
|
103
|
+
bulkActions: BulkActions;
|
|
104
|
+
/**
|
|
105
|
+
* Dispatches a bulk action; falls back to the currently selected IDs when `data` is omitted.
|
|
106
|
+
* Resolves to `undefined` when the action throws (the error is surfaced via `error`).
|
|
107
|
+
*/
|
|
108
|
+
dispatchBulkActions: (handler: string, data?: Array<string | number>) => Promise<BulkActionResponse | undefined>;
|
|
109
|
+
/** An error object if the bulk action failed. */
|
|
110
|
+
error?: {
|
|
111
|
+
message: string;
|
|
112
|
+
originalError: Error;
|
|
113
|
+
};
|
|
114
|
+
/** A function to reset the error state. */
|
|
115
|
+
resetError: () => void;
|
|
116
|
+
}
|
|
117
|
+
export type FormType = 'view' | 'add' | 'edit' | 'delete';
|
|
118
|
+
export type FormViewMode = 'normal' | 'fullScreen' | 'overlay';
|
|
119
|
+
export interface FormState {
|
|
120
|
+
errors: ValidationError[];
|
|
121
|
+
data: EntryRow | undefined;
|
|
122
|
+
}
|
|
123
|
+
export interface FormsContextValue<TItem = EntryRow> {
|
|
124
|
+
/** Indicates whether the form is currently opened. */
|
|
125
|
+
opened: boolean;
|
|
126
|
+
/** A function to get the current opened state of the form. */
|
|
127
|
+
getOpened: () => boolean;
|
|
128
|
+
/** A function to set the opened state of the form. */
|
|
129
|
+
setOpened: (newOpened: boolean) => void;
|
|
130
|
+
/** The current view mode of the form. See `VIEW_MODE` from `@fastapi-rtk/constants` for more details. */
|
|
131
|
+
view: FormViewMode;
|
|
132
|
+
/** A function to get the current view mode of the form. */
|
|
133
|
+
getView: () => FormViewMode;
|
|
134
|
+
/** A function to set the view mode of the form. */
|
|
135
|
+
setView: (newView: FormViewMode) => void;
|
|
136
|
+
/** The current state of the form, including errors and data. */
|
|
137
|
+
state: FormState;
|
|
138
|
+
/** A function to get the current state of the form. */
|
|
139
|
+
getState: () => FormState;
|
|
140
|
+
/** A function to set the state of the form. */
|
|
141
|
+
setState: (newState: FormState) => void;
|
|
142
|
+
/** A function to reset the form state to its initial state. */
|
|
143
|
+
reset: () => void;
|
|
144
|
+
/** The current item being edited in the form, if applicable. */
|
|
145
|
+
item: TItem | undefined;
|
|
146
|
+
/** A function to get the current item in the form. */
|
|
147
|
+
getItem: () => TItem | undefined;
|
|
148
|
+
/** A function to set the current item in the form. */
|
|
149
|
+
setItem: (newItem: TItem | undefined) => void;
|
|
150
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BulkActionsContextValue, BulkFunctions } from './types';
|
|
2
|
+
export declare const defaultBulk: {
|
|
3
|
+
postBulk: (adapters: import('../..').Adapters, path: string, handler: string, data: import('../..').BulkActionPayload, options?: import('../..').FetchOptions) => Promise<import('../..').BulkActionResponse>;
|
|
4
|
+
};
|
|
5
|
+
export declare const useProvideBulk: (params: {
|
|
6
|
+
path: string;
|
|
7
|
+
}, bulk?: BulkFunctions) => BulkActionsContextValue;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EntryRow } from 'fastapi-rtk/contexts';
|
|
2
|
+
import { DownloadActionOptions, EntryId, UploadActionOptions, UseApiActionsParams } from '../types';
|
|
3
|
+
export declare const useApiActions: (params: UseApiActionsParams) => {
|
|
4
|
+
getEntry: (id: EntryId) => Promise<import('fastapi-rtk/api-types').ResultRow>;
|
|
5
|
+
addEntry: (item: EntryRow) => Promise<import('fastapi-rtk/api-types').ResultRow>;
|
|
6
|
+
updateEntry: (id: EntryId, item: EntryRow) => Promise<import('fastapi-rtk/api-types').ResultRow>;
|
|
7
|
+
deleteEntry: (id: EntryId) => Promise<import('fastapi-rtk/api-types').ResultRow | null>;
|
|
8
|
+
download: (label?: string, { export_mode, delimiter, quotechar }?: DownloadActionOptions) => Promise<void>;
|
|
9
|
+
upload: (file: File, { delimiter, quotechar }?: UploadActionOptions) => Promise<import('../../..').UploadResponse>;
|
|
10
|
+
getItemURL: (type: string, item: string | File) => string;
|
|
11
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { InfiniteData } from '
|
|
1
|
+
import { InfiniteData } from '@tanstack/react-query';
|
|
2
2
|
import { StreamingPage, UseStreamingDataParams } from '../types';
|
|
3
3
|
export declare const useStreamingData: (params: UseStreamingDataParams) => {
|
|
4
4
|
streamingPages: (StreamingPage | null)[];
|
|
5
|
-
activeDataQuery: import('
|
|
5
|
+
activeDataQuery: import('@tanstack/react-query').QueryObserverRefetchErrorResult<import('fastapi-rtk/api-types').DataPage | null, Error> | import('@tanstack/react-query').QueryObserverSuccessResult<import('fastapi-rtk/api-types').DataPage | null, Error> | import('@tanstack/react-query').QueryObserverLoadingErrorResult<import('fastapi-rtk/api-types').DataPage | null, Error> | import('@tanstack/react-query').QueryObserverPendingResult<import('fastapi-rtk/api-types').DataPage | null, Error> | import('@tanstack/react-query').QueryObserverPlaceholderResult<import('fastapi-rtk/api-types').DataPage | null, Error> | {
|
|
6
6
|
data: StreamingPage | null;
|
|
7
7
|
error: Error;
|
|
8
8
|
isError: true;
|
|
@@ -13,8 +13,8 @@ export declare const useStreamingData: (params: UseStreamingDataParams) => {
|
|
|
13
13
|
isSuccess: false;
|
|
14
14
|
isPlaceholderData: false;
|
|
15
15
|
status: "error";
|
|
16
|
-
fetchNextPage: (options?: import('
|
|
17
|
-
fetchPreviousPage: (options?: import('
|
|
16
|
+
fetchNextPage: (options?: import('@tanstack/react-query').FetchNextPageOptions) => Promise<import('@tanstack/react-query').InfiniteQueryObserverResult<InfiniteData<StreamingPage | null, unknown>, Error>>;
|
|
17
|
+
fetchPreviousPage: (options?: import('@tanstack/react-query').FetchPreviousPageOptions) => Promise<import('@tanstack/react-query').InfiniteQueryObserverResult<InfiniteData<StreamingPage | null, unknown>, Error>>;
|
|
18
18
|
hasNextPage: boolean;
|
|
19
19
|
hasPreviousPage: boolean;
|
|
20
20
|
isFetchNextPageError: boolean;
|
|
@@ -34,8 +34,8 @@ export declare const useStreamingData: (params: UseStreamingDataParams) => {
|
|
|
34
34
|
isRefetching: boolean;
|
|
35
35
|
isStale: boolean;
|
|
36
36
|
isEnabled: boolean;
|
|
37
|
-
refetch: (options?: import('
|
|
38
|
-
fetchStatus: import('
|
|
37
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<InfiniteData<StreamingPage | null, unknown>, Error>>;
|
|
38
|
+
fetchStatus: import('@tanstack/react-query').FetchStatus;
|
|
39
39
|
promise: Promise<InfiniteData<StreamingPage | null, unknown>>;
|
|
40
40
|
} | {
|
|
41
41
|
data: StreamingPage | null;
|
|
@@ -50,8 +50,8 @@ export declare const useStreamingData: (params: UseStreamingDataParams) => {
|
|
|
50
50
|
isSuccess: true;
|
|
51
51
|
isPlaceholderData: false;
|
|
52
52
|
status: "success";
|
|
53
|
-
fetchNextPage: (options?: import('
|
|
54
|
-
fetchPreviousPage: (options?: import('
|
|
53
|
+
fetchNextPage: (options?: import('@tanstack/react-query').FetchNextPageOptions) => Promise<import('@tanstack/react-query').InfiniteQueryObserverResult<InfiniteData<StreamingPage | null, unknown>, Error>>;
|
|
54
|
+
fetchPreviousPage: (options?: import('@tanstack/react-query').FetchPreviousPageOptions) => Promise<import('@tanstack/react-query').InfiniteQueryObserverResult<InfiniteData<StreamingPage | null, unknown>, Error>>;
|
|
55
55
|
hasNextPage: boolean;
|
|
56
56
|
hasPreviousPage: boolean;
|
|
57
57
|
isFetchingNextPage: boolean;
|
|
@@ -69,8 +69,8 @@ export declare const useStreamingData: (params: UseStreamingDataParams) => {
|
|
|
69
69
|
isRefetching: boolean;
|
|
70
70
|
isStale: boolean;
|
|
71
71
|
isEnabled: boolean;
|
|
72
|
-
refetch: (options?: import('
|
|
73
|
-
fetchStatus: import('
|
|
72
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<InfiniteData<StreamingPage | null, unknown>, Error>>;
|
|
73
|
+
fetchStatus: import('@tanstack/react-query').FetchStatus;
|
|
74
74
|
promise: Promise<InfiniteData<StreamingPage | null, unknown>>;
|
|
75
75
|
} | {
|
|
76
76
|
data: StreamingPage | null;
|
|
@@ -85,8 +85,8 @@ export declare const useStreamingData: (params: UseStreamingDataParams) => {
|
|
|
85
85
|
isSuccess: false;
|
|
86
86
|
isPlaceholderData: false;
|
|
87
87
|
status: "error";
|
|
88
|
-
fetchNextPage: (options?: import('
|
|
89
|
-
fetchPreviousPage: (options?: import('
|
|
88
|
+
fetchNextPage: (options?: import('@tanstack/react-query').FetchNextPageOptions) => Promise<import('@tanstack/react-query').InfiniteQueryObserverResult<InfiniteData<StreamingPage | null, unknown>, Error>>;
|
|
89
|
+
fetchPreviousPage: (options?: import('@tanstack/react-query').FetchPreviousPageOptions) => Promise<import('@tanstack/react-query').InfiniteQueryObserverResult<InfiniteData<StreamingPage | null, unknown>, Error>>;
|
|
90
90
|
hasNextPage: boolean;
|
|
91
91
|
hasPreviousPage: boolean;
|
|
92
92
|
isFetchingNextPage: boolean;
|
|
@@ -104,8 +104,8 @@ export declare const useStreamingData: (params: UseStreamingDataParams) => {
|
|
|
104
104
|
isRefetching: boolean;
|
|
105
105
|
isStale: boolean;
|
|
106
106
|
isEnabled: boolean;
|
|
107
|
-
refetch: (options?: import('
|
|
108
|
-
fetchStatus: import('
|
|
107
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<InfiniteData<StreamingPage | null, unknown>, Error>>;
|
|
108
|
+
fetchStatus: import('@tanstack/react-query').FetchStatus;
|
|
109
109
|
promise: Promise<InfiniteData<StreamingPage | null, unknown>>;
|
|
110
110
|
} | {
|
|
111
111
|
data: StreamingPage | null;
|
|
@@ -119,8 +119,8 @@ export declare const useStreamingData: (params: UseStreamingDataParams) => {
|
|
|
119
119
|
isSuccess: false;
|
|
120
120
|
isPlaceholderData: false;
|
|
121
121
|
status: "pending";
|
|
122
|
-
fetchNextPage: (options?: import('
|
|
123
|
-
fetchPreviousPage: (options?: import('
|
|
122
|
+
fetchNextPage: (options?: import('@tanstack/react-query').FetchNextPageOptions) => Promise<import('@tanstack/react-query').InfiniteQueryObserverResult<InfiniteData<StreamingPage | null, unknown>, Error>>;
|
|
123
|
+
fetchPreviousPage: (options?: import('@tanstack/react-query').FetchPreviousPageOptions) => Promise<import('@tanstack/react-query').InfiniteQueryObserverResult<InfiniteData<StreamingPage | null, unknown>, Error>>;
|
|
124
124
|
hasNextPage: boolean;
|
|
125
125
|
hasPreviousPage: boolean;
|
|
126
126
|
isFetchingNextPage: boolean;
|
|
@@ -139,8 +139,8 @@ export declare const useStreamingData: (params: UseStreamingDataParams) => {
|
|
|
139
139
|
isRefetching: boolean;
|
|
140
140
|
isStale: boolean;
|
|
141
141
|
isEnabled: boolean;
|
|
142
|
-
refetch: (options?: import('
|
|
143
|
-
fetchStatus: import('
|
|
142
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<InfiniteData<StreamingPage | null, unknown>, Error>>;
|
|
143
|
+
fetchStatus: import('@tanstack/react-query').FetchStatus;
|
|
144
144
|
promise: Promise<InfiniteData<StreamingPage | null, unknown>>;
|
|
145
145
|
} | {
|
|
146
146
|
data: StreamingPage | null;
|
|
@@ -155,8 +155,8 @@ export declare const useStreamingData: (params: UseStreamingDataParams) => {
|
|
|
155
155
|
isFetchNextPageError: false;
|
|
156
156
|
isFetchPreviousPageError: false;
|
|
157
157
|
status: "success";
|
|
158
|
-
fetchNextPage: (options?: import('
|
|
159
|
-
fetchPreviousPage: (options?: import('
|
|
158
|
+
fetchNextPage: (options?: import('@tanstack/react-query').FetchNextPageOptions) => Promise<import('@tanstack/react-query').InfiniteQueryObserverResult<InfiniteData<StreamingPage | null, unknown>, Error>>;
|
|
159
|
+
fetchPreviousPage: (options?: import('@tanstack/react-query').FetchPreviousPageOptions) => Promise<import('@tanstack/react-query').InfiniteQueryObserverResult<InfiniteData<StreamingPage | null, unknown>, Error>>;
|
|
160
160
|
hasNextPage: boolean;
|
|
161
161
|
hasPreviousPage: boolean;
|
|
162
162
|
isFetchingNextPage: boolean;
|
|
@@ -174,20 +174,20 @@ export declare const useStreamingData: (params: UseStreamingDataParams) => {
|
|
|
174
174
|
isRefetching: boolean;
|
|
175
175
|
isStale: boolean;
|
|
176
176
|
isEnabled: boolean;
|
|
177
|
-
refetch: (options?: import('
|
|
178
|
-
fetchStatus: import('
|
|
177
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<InfiniteData<StreamingPage | null, unknown>, Error>>;
|
|
178
|
+
fetchStatus: import('@tanstack/react-query').FetchStatus;
|
|
179
179
|
promise: Promise<InfiniteData<StreamingPage | null, unknown>>;
|
|
180
180
|
};
|
|
181
|
-
fetchStreamingPage: () => Promise<import('
|
|
181
|
+
fetchStreamingPage: () => Promise<import('@tanstack/react-query').QueryObserverResult<InfiniteData<StreamingPage | null, unknown>, Error>> | null;
|
|
182
182
|
resetStreamingPages: ({ refetch }?: {
|
|
183
183
|
refetch?: boolean;
|
|
184
|
-
}) => Promise<import('
|
|
184
|
+
}) => Promise<import('@tanstack/react-query').QueryObserverRefetchErrorResult<InfiniteData<StreamingPage | null, unknown>, Error> | import('@tanstack/react-query').QueryObserverSuccessResult<InfiniteData<StreamingPage | null, unknown>, Error> | import('@tanstack/react-query').QueryObserverLoadingErrorResult<InfiniteData<StreamingPage | null, unknown>, Error> | import('@tanstack/react-query').QueryObserverPendingResult<InfiniteData<StreamingPage | null, unknown>, Error> | import('@tanstack/react-query').QueryObserverPlaceholderResult<InfiniteData<StreamingPage | null, unknown>, Error> | null>;
|
|
185
185
|
streaming: {
|
|
186
186
|
data: Record<number, import('fastapi-rtk/api-types').ResultRow[]>;
|
|
187
187
|
isEnd: boolean;
|
|
188
|
-
fetch: () => Promise<import('
|
|
188
|
+
fetch: () => Promise<import('@tanstack/react-query').QueryObserverResult<InfiniteData<StreamingPage | null, unknown>, Error>> | null;
|
|
189
189
|
reset: ({ refetch }?: {
|
|
190
190
|
refetch?: boolean;
|
|
191
|
-
}) => Promise<import('
|
|
191
|
+
}) => Promise<import('@tanstack/react-query').QueryObserverRefetchErrorResult<InfiniteData<StreamingPage | null, unknown>, Error> | import('@tanstack/react-query').QueryObserverSuccessResult<InfiniteData<StreamingPage | null, unknown>, Error> | import('@tanstack/react-query').QueryObserverLoadingErrorResult<InfiniteData<StreamingPage | null, unknown>, Error> | import('@tanstack/react-query').QueryObserverPendingResult<InfiniteData<StreamingPage | null, unknown>, Error> | import('@tanstack/react-query').QueryObserverPlaceholderResult<InfiniteData<StreamingPage | null, unknown>, Error> | null>;
|
|
192
192
|
} | undefined;
|
|
193
193
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { DataPage, StreamingPage } from 'fastapi-rtk/api-types';
|
|
2
|
+
import { InfiniteData, QueryKey, UseInfiniteQueryOptions, UseQueryOptions } from '@tanstack/react-query';
|
|
3
|
+
import { PropsWithChildren } from 'react';
|
|
4
|
+
import { ApiFunctions, BulkFunctions, InfoQueryData, RelationParam } from './hooks/types';
|
|
5
|
+
import { QueryParams } from './utils/types';
|
|
6
|
+
/**
|
|
7
|
+
* Props accepted by the `ApiProvider` component.
|
|
8
|
+
*
|
|
9
|
+
* @typeParam TQuery - Custom query-param keys forwarded to the backend (read off `request.query_params`).
|
|
10
|
+
* Surfaced typed on `initialQueryParams`; pass the same shape to `useApi<…, TQuery>()` to type `queryParams` /
|
|
11
|
+
* `setQueryParams` (React context cannot carry the Provider's type param to a distant `useApi` call).
|
|
12
|
+
*/
|
|
13
|
+
export type ApiProviderProps<TQuery extends object = object> = PropsWithChildren<{
|
|
14
|
+
/** The name of the resource to be used in the API path. */
|
|
15
|
+
resource_name?: string;
|
|
16
|
+
/** The initial query parameters to be used in the API requests. May include custom keys (typed via `TQuery`) forwarded to the backend. */
|
|
17
|
+
initialQueryParams?: QueryParams & Partial<TQuery>;
|
|
18
|
+
/** The relation to be used in the API requests. */
|
|
19
|
+
relation?: RelationParam;
|
|
20
|
+
/** Whether to fetch the `info` for the API requests when the component mounts. */
|
|
21
|
+
fetchInfo?: boolean;
|
|
22
|
+
/** Whether to clear the `info` on refetch. */
|
|
23
|
+
clearInfoOnRefetch?: boolean;
|
|
24
|
+
/** Whether to clear the `data` on refetch. */
|
|
25
|
+
clearDataOnRefetch?: boolean;
|
|
26
|
+
/** Whether to refetch the `info` when the language changes. Defaults to true. */
|
|
27
|
+
refetchInfoBasedOnLang?: boolean;
|
|
28
|
+
/** Whether to refetch the `data` when the language changes. Defaults to true. */
|
|
29
|
+
refetchDataBasedOnLang?: boolean;
|
|
30
|
+
/** Whether to reset the `queryParams` on path change. */
|
|
31
|
+
resetQueryParamsOnPathChange?: boolean;
|
|
32
|
+
/** The react-query props for the info query. */
|
|
33
|
+
infoQueryProps?: Partial<UseQueryOptions<InfoQueryData>>;
|
|
34
|
+
/** The react-query props for the data query. */
|
|
35
|
+
dataQueryProps?: Partial<UseQueryOptions<DataPage | null>>;
|
|
36
|
+
/** The react-query props for the streaming (infinite) query. */
|
|
37
|
+
streamingQueryProps?: Partial<UseInfiniteQueryOptions<StreamingPage | null, Error, InfiniteData<StreamingPage | null>, QueryKey, number>>;
|
|
38
|
+
/** Whether to enable streaming for the API requests. */
|
|
39
|
+
streaming?: boolean;
|
|
40
|
+
/** Overrides for the API dependency functions. */
|
|
41
|
+
apiParams?: ApiFunctions;
|
|
42
|
+
/** Overrides for the bulk-action dependency functions. */
|
|
43
|
+
bulkParams?: BulkFunctions;
|
|
44
|
+
}>;
|
|
45
|
+
/** Additional options for the `withApiProvider` HOC. */
|
|
46
|
+
export interface WithApiProviderOptions {
|
|
47
|
+
/** The display name for the wrapped component. */
|
|
48
|
+
displayName?: string;
|
|
49
|
+
/** Whether to forward refs to the wrapped component. */
|
|
50
|
+
forwardRef?: boolean;
|
|
51
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AnyColumnInfo } from 'fastapi-rtk/api-types';
|
|
2
|
-
import {
|
|
3
|
-
export declare const getDefaultValues: (columns: AnyColumnInfo[]) =>
|
|
2
|
+
import { EntryRow } from 'fastapi-rtk/contexts';
|
|
3
|
+
export declare const getDefaultValues: (columns: AnyColumnInfo[]) => EntryRow;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnyColumnInfo } from 'fastapi-rtk/api-types';
|
|
2
|
-
import * as yup from '
|
|
2
|
+
import * as yup from '../../../../.external/lib/yup';
|
|
3
3
|
export declare const getValidationSchema: (columns: AnyColumnInfo[]) => yup.ObjectSchema<{
|
|
4
4
|
[x: string]: unknown;
|
|
5
5
|
}, yup.AnyObject, {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AuthContextValue } from '
|
|
1
|
+
import { AuthContextValue } from '../../hooks/auth/types';
|
|
2
2
|
export declare const AuthContextProvider: import('react').Provider<AuthContextValue | null>, useAuthProvider: (options?: import('fastapi-rtk/utils').SafeContextOptions<AuthContextValue>) => AuthContextValue;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { InfoContextValue } from '
|
|
1
|
+
import { InfoContextValue } from '../../hooks/auth/types';
|
|
2
2
|
export declare const InfoContextProvider: import('react').Provider<InfoContextValue | null>, useInfoProvider: (options?: import('fastapi-rtk/utils').SafeContextOptions<InfoContextValue>) => InfoContextValue;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { LangContextValue } from 'fastapi-rtk/contexts';
|
|
2
|
-
import { i18n, InitOptions } from '
|
|
3
|
-
import { MRT_Localization } from '../../../../../.external/lib/mantine-react-table';
|
|
2
|
+
import { i18n, InitOptions } from '../../../../.external/lib/i18next';
|
|
4
3
|
import { PropsWithChildren, ProviderProps } from 'react';
|
|
5
|
-
/** A
|
|
4
|
+
/** A single MRT (Mantine React Table) localization resource: a flat map of localization keys to translated strings. Local so `api` has no `mantine-react-table` type dependency; the web grid re-types it to `MRT_Localization` at the consumer boundary. */
|
|
5
|
+
export type MRTLocalization = Record<string, string>;
|
|
6
|
+
/** A map of MRT localization resources keyed by language code. */
|
|
6
7
|
export type MRTLocalizationMap = {
|
|
7
|
-
[locale: string]: Partial<
|
|
8
|
+
[locale: string]: Partial<MRTLocalization>;
|
|
8
9
|
};
|
|
9
10
|
export interface GetI18nProps {
|
|
10
11
|
/** The props for `i18n.init`. */
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InnerProviderProps, WithProvider } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Wraps the application with auth and info hooks for use with the fastapi-rtk python backend library.
|
|
4
|
+
*/
|
|
5
|
+
export declare const Provider: (props: InnerProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
/**
|
|
7
|
+
* Higher-order component to wrap a component with Provider.
|
|
8
|
+
*
|
|
9
|
+
* @param providerProps - The props passed to the Provider, or a function that returns them.
|
|
10
|
+
* @param Component - The component to wrap.
|
|
11
|
+
* @param options - Additional options for the HOC.
|
|
12
|
+
* @returns The wrapped component.
|
|
13
|
+
*/
|
|
14
|
+
export declare const withProvider: WithProvider;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AppApiInfo } from 'fastapi-rtk/api-types';
|
|
2
|
+
import { Adapters, SigninCredentials } from '../../adapters/types';
|
|
3
|
+
import { AuthUser } from '../../auth/types';
|
|
4
|
+
export type { SigninCredentials };
|
|
5
|
+
export interface AuthDependencies {
|
|
6
|
+
getUser: (adapters: Adapters, baseUrl: string, signal?: AbortSignal) => Promise<AuthUser>;
|
|
7
|
+
update: (adapters: Adapters, baseUrl: string, userData: Partial<AuthUser>) => Promise<AuthUser>;
|
|
8
|
+
signin: (adapters: Adapters, baseUrl: string, credentials: SigninCredentials) => Promise<void>;
|
|
9
|
+
signout: (adapters: Adapters, baseUrl: string) => Promise<void>;
|
|
10
|
+
resetPassword: (adapters: Adapters, baseUrl: string, newPassword: string, user: {
|
|
11
|
+
email: string;
|
|
12
|
+
}) => Promise<void>;
|
|
13
|
+
oauthSignin: (adapters: Adapters, baseUrl: string, provider: string, popup: boolean, afterSigninPopup?: () => void) => Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export interface InfoDependencies {
|
|
16
|
+
getInfo: (adapters: Adapters, baseUrl: string, signal?: AbortSignal) => Promise<AppApiInfo[]>;
|
|
17
|
+
fab?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface ProvideAuthError {
|
|
20
|
+
message: string;
|
|
21
|
+
originalError: Error;
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { AuthUser } from '../../auth/types';
|
|
3
|
+
import { AuthDependencies, SigninCredentials } from './types';
|
|
4
|
+
export declare function useProvideAuth(baseURL: string, authQueryProps?: Partial<UseQueryOptions<AuthUser>>, auth?: AuthDependencies): {
|
|
5
|
+
user: AuthUser | null | undefined;
|
|
6
|
+
loading: boolean;
|
|
7
|
+
error: string | null;
|
|
8
|
+
query: import('@tanstack/react-query').UseQueryResult<AuthUser, Error>;
|
|
9
|
+
signin: ({ username, password }: SigninCredentials) => Promise<void>;
|
|
10
|
+
signout: () => Promise<void>;
|
|
11
|
+
update: (data: Partial<AuthUser>) => Promise<void>;
|
|
12
|
+
resetPassword: (password: string) => Promise<void>;
|
|
13
|
+
oauthSignin: (provider: string, popup: boolean) => Promise<void>;
|
|
14
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<AuthUser, Error>>;
|
|
15
|
+
resetError: () => void;
|
|
16
|
+
oauth_signin: (provider: string, popup: boolean) => Promise<void>;
|
|
17
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthUser } from '
|
|
1
|
+
import { AuthUser } from '../../auth/types';
|
|
2
2
|
import { InfoDependencies } from './types';
|
|
3
3
|
export declare function useProvideInfo(baseUrl: string, auth: {
|
|
4
4
|
user?: Partial<AuthUser> | null;
|
|
@@ -8,5 +8,5 @@ export declare function useProvideInfo(baseUrl: string, auth: {
|
|
|
8
8
|
loading: boolean;
|
|
9
9
|
error: Error | null;
|
|
10
10
|
fab: boolean | undefined;
|
|
11
|
-
query: import('
|
|
11
|
+
query: import('@tanstack/react-query').UseQueryResult<import('fastapi-rtk/api-types').AppApiInfo[], Error>;
|
|
12
12
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { LangContextValue } from 'fastapi-rtk/contexts';
|
|
2
|
-
import { UseSetStateCallback } from '@mantine/hooks';
|
|
3
2
|
import { MRTLocalizationMap } from '../Contexts/types';
|
|
4
3
|
type ProvideLangValue = LangContextValue & {
|
|
5
4
|
currentMRTLocalization: MRTLocalizationMap[string] | undefined;
|
|
6
5
|
MRTLocalization: MRTLocalizationMap;
|
|
7
|
-
setMRTLocalization:
|
|
6
|
+
setMRTLocalization: (partial: Partial<MRTLocalizationMap>) => void;
|
|
8
7
|
};
|
|
9
8
|
export declare const useProvideLang: (baseMRTLocalization?: MRTLocalizationMap) => ProvideLangValue;
|
|
10
9
|
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { QueryClientConfig, UseQueryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { ComponentType, PropsWithChildren } from 'react';
|
|
3
|
+
import { Adapters } from '../adapters/types';
|
|
4
|
+
import { AuthUser } from '../auth/types';
|
|
5
|
+
import { LangProps } from './Contexts/types';
|
|
6
|
+
import { AuthDependencies, InfoDependencies } from './hooks/types';
|
|
7
|
+
export interface ProviderProps {
|
|
8
|
+
/** The platform adapters (storage, network, auth transport, file download, OAuth opener, form data) provided to the app. */
|
|
9
|
+
adapters: Adapters;
|
|
10
|
+
/** The base URL for the API. */
|
|
11
|
+
baseUrl?: string;
|
|
12
|
+
/** The props for the QueryClient. See here `https://tanstack.com/query/latest/docs/reference/QueryClient`. */
|
|
13
|
+
queryClientProps?: QueryClientConfig;
|
|
14
|
+
/** The react-query props for the auth. See here `https://tanstack.com/query/latest/docs/framework/react/reference/useQuery`. */
|
|
15
|
+
authQueryProps?: Partial<UseQueryOptions<AuthUser>>;
|
|
16
|
+
/** Overrides for the auth dependency functions. */
|
|
17
|
+
authParams?: AuthDependencies;
|
|
18
|
+
/** Overrides for the info dependency functions. */
|
|
19
|
+
infoParams?: InfoDependencies;
|
|
20
|
+
/** Whether to inherit the Mantine theme. */
|
|
21
|
+
inheritMantineTheme?: boolean;
|
|
22
|
+
/** The props for the language context. */
|
|
23
|
+
langProps?: LangProps;
|
|
24
|
+
/** Whether to enable debug mode, which logs additional information to the console. */
|
|
25
|
+
debug?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface WithProviderOptions {
|
|
28
|
+
/** The display name for the wrapped component. */
|
|
29
|
+
displayName?: string;
|
|
30
|
+
/** Whether to forward refs to the wrapped component. */
|
|
31
|
+
forwardRef?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export type WithProviderProps<P> = ProviderProps | ((props: P) => ProviderProps);
|
|
34
|
+
export type WithProvider = <P>(providerProps: WithProviderProps<P>, Component: ComponentType<P>, options?: WithProviderOptions) => ComponentType<P>;
|
|
35
|
+
export type InnerProviderProps = PropsWithChildren<ProviderProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SafeContextOptions } from 'fastapi-rtk/utils';
|
|
2
|
+
import { Adapters } from './types';
|
|
3
|
+
export declare const AdaptersProvider: import('react').Provider<Adapters | null>, useAdaptersProvider: (options?: SafeContextOptions<Adapters>) => Adapters;
|
|
4
|
+
/**
|
|
5
|
+
* Access the platform adapters supplied to the top-level Provider.
|
|
6
|
+
*
|
|
7
|
+
* @param options - Options for the context hook.
|
|
8
|
+
* @returns The active adapters ({ storage, network, authTransport, fileDownload, oauthOpener, formData }).
|
|
9
|
+
*/
|
|
10
|
+
export declare const useAdapters: (options?: SafeContextOptions<Adapters>) => Adapters;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ParseableResponse } from '../utils/parseResponse/parseResponse';
|
|
2
|
+
export type RequestOptions = Omit<RequestInit, 'headers'> & {
|
|
3
|
+
headers: {
|
|
4
|
+
[name: string]: string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Login credentials. Lives here (not auth/types) because AuthTransport.buildLoginBody references
|
|
9
|
+
* it and adapters/types must not import from auth/types (that would cycle with AuthDependencies'
|
|
10
|
+
* Adapters reference). auth/types.ts re-exports it.
|
|
11
|
+
*/
|
|
12
|
+
export interface SigninCredentials {
|
|
13
|
+
username: string;
|
|
14
|
+
password: string;
|
|
15
|
+
}
|
|
16
|
+
export interface StorageAdapter {
|
|
17
|
+
get(key: string): Promise<string | null> | string | null;
|
|
18
|
+
set(key: string, value: string): Promise<void> | void;
|
|
19
|
+
remove(key: string): Promise<void> | void;
|
|
20
|
+
/** Optional reactivity. Web: the `storage` event. RN: an event emitter, or omitted. Returns an unsubscribe fn. */
|
|
21
|
+
subscribe?(key: string, cb: (value: string | null) => void): () => void;
|
|
22
|
+
}
|
|
23
|
+
export interface NetworkAdapter {
|
|
24
|
+
/** Perform the request. Web: global `fetch`. Returns the DOM-free ParseableResponse (a raw Response satisfies it structurally). */
|
|
25
|
+
request(path: string, options: RequestOptions): Promise<ParseableResponse>;
|
|
26
|
+
}
|
|
27
|
+
export interface AuthTransport {
|
|
28
|
+
/** Path segment appended after `auth/`: 'login' (cookie) or 'jwt/login' (bearer). */
|
|
29
|
+
loginPath: string;
|
|
30
|
+
/** Build the login request body. Both transports send urlencoded form today. */
|
|
31
|
+
buildLoginBody(creds: SigninCredentials): BodyInit;
|
|
32
|
+
/** Cookie: set `credentials:'include'`. Bearer: add the Authorization header from the storage it was constructed with. */
|
|
33
|
+
decorateRequest(options: RequestOptions): RequestOptions | Promise<RequestOptions>;
|
|
34
|
+
/** Bearer: read + store the JWT from the login response. Cookie: no-op. */
|
|
35
|
+
persistLogin(response: ParseableResponse): Promise<void> | void;
|
|
36
|
+
/** Bearer: drop the persisted JWT. Cookie: no-op. */
|
|
37
|
+
clearLogin(): Promise<void> | void;
|
|
38
|
+
}
|
|
39
|
+
export interface FileDownloadAdapter {
|
|
40
|
+
/** Web: anchor-navigate to `url` (cookie auth). RN: fetch the bytes with `headers`, then write/share as `filename`. */
|
|
41
|
+
save(source: {
|
|
42
|
+
url: string;
|
|
43
|
+
filename?: string;
|
|
44
|
+
headers?: Record<string, string>;
|
|
45
|
+
}): Promise<void>;
|
|
46
|
+
/** Web: URL.createObjectURL. RN: a content/file uri. */
|
|
47
|
+
objectUrl(file: unknown): string;
|
|
48
|
+
}
|
|
49
|
+
export interface OAuthOpenerAdapter {
|
|
50
|
+
/** Web: window.open (popup) / window.location (redirect) + a setInterval close-poll that calls onClose. */
|
|
51
|
+
open(url: string, opts: {
|
|
52
|
+
popup: boolean;
|
|
53
|
+
onClose?: () => void;
|
|
54
|
+
}): void | Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
export interface FormDataAdapter {
|
|
57
|
+
/** Web: `value instanceof File`. RN: shape check `{ uri, name, type }`. */
|
|
58
|
+
isFilePart(value: unknown): boolean;
|
|
59
|
+
/** Append a file part. Web: `fd.append(key, file as File)`. */
|
|
60
|
+
appendFile(fd: FormData, key: string, file: unknown): void;
|
|
61
|
+
}
|
|
62
|
+
export interface Adapters {
|
|
63
|
+
storage: StorageAdapter;
|
|
64
|
+
network: NetworkAdapter;
|
|
65
|
+
authTransport: AuthTransport;
|
|
66
|
+
fileDownload: FileDownloadAdapter;
|
|
67
|
+
oauthOpener: OAuthOpenerAdapter;
|
|
68
|
+
formData: FormDataAdapter;
|
|
69
|
+
}
|