@gravity-ui/data-source 0.8.2 → 0.9.1-alpha.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/build/cjs/core/types/DataSource.d.ts +8 -8
- package/build/cjs/core/types/DataSource.js.map +1 -1
- package/build/cjs/core/utils/withCatch.d.ts +4 -1
- package/build/cjs/core/utils/withCatch.js +2 -0
- package/build/cjs/core/utils/withCatch.js.map +1 -1
- package/build/cjs/react/components/AsyncBoundary/AsyncBoundary.d.ts +3 -0
- package/build/cjs/react/components/AsyncBoundary/AsyncBoundary.js +35 -0
- package/build/cjs/react/components/AsyncBoundary/AsyncBoundary.js.map +1 -0
- package/build/cjs/react/components/AsyncBoundary/index.d.ts +3 -0
- package/build/cjs/react/components/AsyncBoundary/index.js +20 -0
- package/build/cjs/react/components/AsyncBoundary/index.js.map +1 -0
- package/build/cjs/react/components/AsyncBoundary/types.d.ts +13 -0
- package/build/cjs/react/components/AsyncBoundary/types.js +6 -0
- package/build/cjs/react/components/AsyncBoundary/types.js.map +1 -0
- package/build/cjs/react/components/AsyncBoundary/withAsyncBoundary.d.ts +3 -0
- package/build/cjs/react/components/AsyncBoundary/withAsyncBoundary.js +26 -0
- package/build/cjs/react/components/AsyncBoundary/withAsyncBoundary.js.map +1 -0
- package/build/cjs/react/components/EmptyView/EmptyView.d.ts +2 -0
- package/build/cjs/react/components/EmptyView/EmptyView.js +10 -0
- package/build/cjs/react/components/EmptyView/EmptyView.js.map +1 -0
- package/build/cjs/react/components/EmptyView/index.d.ts +1 -0
- package/build/cjs/react/components/EmptyView/index.js +13 -0
- package/build/cjs/react/components/EmptyView/index.js.map +1 -0
- package/build/cjs/react/components/types.d.ts +1 -1
- package/build/cjs/react/components/types.js.map +1 -1
- package/build/cjs/react/index.d.ts +5 -3
- package/build/cjs/react/index.js +27 -3
- package/build/cjs/react/index.js.map +1 -1
- package/build/cjs/react-query/components/QueryAsyncBoundary/QueryAsyncBoundary.d.ts +3 -0
- package/build/cjs/react-query/components/QueryAsyncBoundary/QueryAsyncBoundary.js +23 -0
- package/build/cjs/react-query/components/QueryAsyncBoundary/QueryAsyncBoundary.js.map +1 -0
- package/build/cjs/react-query/components/QueryAsyncBoundary/index.d.ts +3 -0
- package/build/cjs/react-query/components/QueryAsyncBoundary/index.js +20 -0
- package/build/cjs/react-query/components/QueryAsyncBoundary/index.js.map +1 -0
- package/build/cjs/react-query/components/QueryAsyncBoundary/types.d.ts +8 -0
- package/build/cjs/react-query/components/QueryAsyncBoundary/types.js +6 -0
- package/build/cjs/react-query/components/QueryAsyncBoundary/types.js.map +1 -0
- package/build/cjs/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.d.ts +3 -0
- package/build/cjs/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.js +26 -0
- package/build/cjs/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.js.map +1 -0
- package/build/cjs/react-query/hooks/useSuspenseQueryData.d.ts +9 -0
- package/build/cjs/react-query/hooks/useSuspenseQueryData.js +22 -0
- package/build/cjs/react-query/hooks/useSuspenseQueryData.js.map +1 -0
- package/build/cjs/react-query/impl/infinite/hooks.js +5 -1
- package/build/cjs/react-query/impl/infinite/hooks.js.map +1 -1
- package/build/cjs/react-query/impl/infinite/types.d.ts +1 -0
- package/build/cjs/react-query/impl/infinite/types.js.map +1 -1
- package/build/cjs/react-query/impl/plain/hooks.js +5 -1
- package/build/cjs/react-query/impl/plain/hooks.js.map +1 -1
- package/build/cjs/react-query/impl/plain/types.d.ts +1 -0
- package/build/cjs/react-query/impl/plain/types.js.map +1 -1
- package/build/cjs/react-query/index.d.ts +2 -0
- package/build/cjs/react-query/index.js +35 -0
- package/build/cjs/react-query/index.js.map +1 -1
- package/build/cjs/react-query/types/options.d.ts +5 -0
- package/build/cjs/react-query/types/options.js.map +1 -1
- package/build/cjs/react-query/utils/warn.d.ts +1 -0
- package/build/cjs/react-query/utils/warn.js +15 -0
- package/build/cjs/react-query/utils/warn.js.map +1 -0
- package/build/cjs/react-query/utils/warnDisabledRefetch.d.ts +1 -0
- package/build/cjs/react-query/utils/warnDisabledRefetch.js +27 -0
- package/build/cjs/react-query/utils/warnDisabledRefetch.js.map +1 -0
- package/build/cjs/react-query/utils/wrapRefetch.d.ts +2 -0
- package/build/cjs/react-query/utils/wrapRefetch.js +29 -0
- package/build/cjs/react-query/utils/wrapRefetch.js.map +1 -0
- package/build/esm/core/types/DataSource.d.ts +8 -8
- package/build/esm/core/types/DataSource.js.map +1 -1
- package/build/esm/core/utils/withCatch.d.ts +4 -1
- package/build/esm/core/utils/withCatch.js +2 -0
- package/build/esm/core/utils/withCatch.js.map +1 -1
- package/build/esm/react/components/AsyncBoundary/AsyncBoundary.d.ts +3 -0
- package/build/esm/react/components/AsyncBoundary/AsyncBoundary.js +28 -0
- package/build/esm/react/components/AsyncBoundary/AsyncBoundary.js.map +1 -0
- package/build/esm/react/components/AsyncBoundary/index.d.ts +3 -0
- package/build/esm/react/components/AsyncBoundary/index.js +3 -0
- package/build/esm/react/components/AsyncBoundary/index.js.map +1 -0
- package/build/esm/react/components/AsyncBoundary/types.d.ts +13 -0
- package/build/esm/react/components/AsyncBoundary/types.js +2 -0
- package/build/esm/react/components/AsyncBoundary/types.js.map +1 -0
- package/build/esm/react/components/AsyncBoundary/withAsyncBoundary.d.ts +3 -0
- package/build/esm/react/components/AsyncBoundary/withAsyncBoundary.js +19 -0
- package/build/esm/react/components/AsyncBoundary/withAsyncBoundary.js.map +1 -0
- package/build/esm/react/components/EmptyView/EmptyView.d.ts +2 -0
- package/build/esm/react/components/EmptyView/EmptyView.js +4 -0
- package/build/esm/react/components/EmptyView/EmptyView.js.map +1 -0
- package/build/esm/react/components/EmptyView/index.d.ts +1 -0
- package/build/esm/react/components/EmptyView/index.js +2 -0
- package/build/esm/react/components/EmptyView/index.js.map +1 -0
- package/build/esm/react/components/types.d.ts +1 -1
- package/build/esm/react/components/types.js.map +1 -1
- package/build/esm/react/index.d.ts +5 -3
- package/build/esm/react/index.js +4 -2
- package/build/esm/react/index.js.map +1 -1
- package/build/esm/react-query/components/QueryAsyncBoundary/QueryAsyncBoundary.d.ts +3 -0
- package/build/esm/react-query/components/QueryAsyncBoundary/QueryAsyncBoundary.js +16 -0
- package/build/esm/react-query/components/QueryAsyncBoundary/QueryAsyncBoundary.js.map +1 -0
- package/build/esm/react-query/components/QueryAsyncBoundary/index.d.ts +3 -0
- package/build/esm/react-query/components/QueryAsyncBoundary/index.js +3 -0
- package/build/esm/react-query/components/QueryAsyncBoundary/index.js.map +1 -0
- package/build/esm/react-query/components/QueryAsyncBoundary/types.d.ts +8 -0
- package/build/esm/react-query/components/QueryAsyncBoundary/types.js +2 -0
- package/build/esm/react-query/components/QueryAsyncBoundary/types.js.map +1 -0
- package/build/esm/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.d.ts +3 -0
- package/build/esm/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.js +19 -0
- package/build/esm/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.js.map +1 -0
- package/build/esm/react-query/hooks/useSuspenseQueryData.d.ts +9 -0
- package/build/esm/react-query/hooks/useSuspenseQueryData.js +15 -0
- package/build/esm/react-query/hooks/useSuspenseQueryData.js.map +1 -0
- package/build/esm/react-query/impl/infinite/hooks.js +6 -2
- package/build/esm/react-query/impl/infinite/hooks.js.map +1 -1
- package/build/esm/react-query/impl/infinite/types.d.ts +1 -0
- package/build/esm/react-query/impl/infinite/types.js.map +1 -1
- package/build/esm/react-query/impl/plain/hooks.js +6 -2
- package/build/esm/react-query/impl/plain/hooks.js.map +1 -1
- package/build/esm/react-query/impl/plain/types.d.ts +1 -0
- package/build/esm/react-query/impl/plain/types.js.map +1 -1
- package/build/esm/react-query/index.d.ts +2 -0
- package/build/esm/react-query/index.js +2 -0
- package/build/esm/react-query/index.js.map +1 -1
- package/build/esm/react-query/types/options.d.ts +5 -0
- package/build/esm/react-query/types/options.js.map +1 -1
- package/build/esm/react-query/utils/warn.d.ts +1 -0
- package/build/esm/react-query/utils/warn.js +9 -0
- package/build/esm/react-query/utils/warn.js.map +1 -0
- package/build/esm/react-query/utils/warnDisabledRefetch.d.ts +1 -0
- package/build/esm/react-query/utils/warnDisabledRefetch.js +20 -0
- package/build/esm/react-query/utils/warnDisabledRefetch.js.map +1 -0
- package/build/esm/react-query/utils/wrapRefetch.d.ts +2 -0
- package/build/esm/react-query/utils/wrapRefetch.js +22 -0
- package/build/esm/react-query/utils/wrapRefetch.js.map +1 -0
- package/build/plugin/esbuild.d.mts +7 -0
- package/build/plugin/esbuild.mjs +6 -0
- package/build/plugin/factory-2tSt4Rte.mjs +513 -0
- package/build/plugin/index-mY40Sgl5.d.mts +24 -0
- package/build/plugin/index.d.mts +7 -0
- package/build/plugin/index.mjs +6 -0
- package/build/plugin/rollup.d.mts +6 -0
- package/build/plugin/rollup.mjs +6 -0
- package/build/plugin/rspack.d.mts +7 -0
- package/build/plugin/rspack.mjs +6 -0
- package/build/plugin/typings/client.d.ts +11 -0
- package/build/plugin/vite.d.mts +6 -0
- package/build/plugin/vite.mjs +6 -0
- package/build/plugin/webpack.d.mts +7 -0
- package/build/plugin/webpack.mjs +6 -0
- package/package.json +54 -5
- package/build/cjs/core/utils/__tests__/composeFullKey.test.js +0 -34
- package/build/cjs/core/utils/__tests__/composeFullKey.test.js.map +0 -1
- package/build/cjs/core/utils/__tests__/composeKey.test.js +0 -32
- package/build/cjs/core/utils/__tests__/composeKey.test.js.map +0 -1
- package/build/cjs/core/utils/__tests__/getError.test.js +0 -31
- package/build/cjs/core/utils/__tests__/getError.test.js.map +0 -1
- package/build/cjs/core/utils/__tests__/getStatus.test.js +0 -49
- package/build/cjs/core/utils/__tests__/getStatus.test.js.map +0 -1
- package/build/cjs/core/utils/__tests__/hasTag.test.js +0 -31
- package/build/cjs/core/utils/__tests__/hasTag.test.js.map +0 -1
- package/build/cjs/core/utils/__tests__/mergeStatuses.test.js +0 -25
- package/build/cjs/core/utils/__tests__/mergeStatuses.test.js.map +0 -1
- package/build/cjs/core/utils/__tests__/skipContext.test.js +0 -70
- package/build/cjs/core/utils/__tests__/skipContext.test.js.map +0 -1
- package/build/cjs/core/utils/__tests__/withCancellation.test.js +0 -106
- package/build/cjs/core/utils/__tests__/withCancellation.test.js.map +0 -1
- package/build/cjs/core/utils/__tests__/withCatch.test.js +0 -208
- package/build/cjs/core/utils/__tests__/withCatch.test.js.map +0 -1
- package/build/cjs/react/__tests__/DataManagerContext.test.js +0 -47
- package/build/cjs/react/__tests__/DataManagerContext.test.js.map +0 -1
- package/build/cjs/react/__tests__/withDataManager.test.js +0 -61
- package/build/cjs/react/__tests__/withDataManager.test.js.map +0 -1
- package/build/cjs/react/components/DataInfiniteLoader/__tests__/DataInfiniteLoader.test.js +0 -187
- package/build/cjs/react/components/DataInfiniteLoader/__tests__/DataInfiniteLoader.test.js.map +0 -1
- package/build/cjs/react/components/DataLoader/__tests__/DataLoader.test.js +0 -119
- package/build/cjs/react/components/DataLoader/__tests__/DataLoader.test.js.map +0 -1
- package/build/cjs/react-query/__tests__/createQueryNormalizer.test.js +0 -177
- package/build/cjs/react-query/__tests__/createQueryNormalizer.test.js.map +0 -1
- package/build/cjs/react-query/__tests__/normalizationEdgeCases.test.js +0 -100
- package/build/cjs/react-query/__tests__/normalizationEdgeCases.test.js.map +0 -1
- package/build/cjs/react-query/__tests__/subscriptions.test.js +0 -1180
- package/build/cjs/react-query/__tests__/subscriptions.test.js.map +0 -1
- package/build/cjs/react-query/__tests__/threeLevelIntegration.test.js +0 -659
- package/build/cjs/react-query/__tests__/threeLevelIntegration.test.js.map +0 -1
- package/build/cjs/react-query/__tests__/updateQueriesFromMutationData.test.js +0 -229
- package/build/cjs/react-query/__tests__/updateQueriesFromMutationData.test.js.map +0 -1
- package/build/cjs/react-query/hooks/__tests__/useQueryContext.test.js +0 -55
- package/build/cjs/react-query/hooks/__tests__/useQueryContext.test.js.map +0 -1
- package/build/cjs/react-query/hooks/__tests__/useQueryData.test.js +0 -97
- package/build/cjs/react-query/hooks/__tests__/useQueryData.test.js.map +0 -1
- package/build/cjs/react-query/hooks/__tests__/useQueryResponses.test.js +0 -77
- package/build/cjs/react-query/hooks/__tests__/useQueryResponses.test.js.map +0 -1
- package/build/cjs/react-query/hooks/__tests__/useRefetchAll.test.js +0 -79
- package/build/cjs/react-query/hooks/__tests__/useRefetchAll.test.js.map +0 -1
- package/build/cjs/react-query/hooks/__tests__/useRefetchErrored.test.js +0 -117
- package/build/cjs/react-query/hooks/__tests__/useRefetchErrored.test.js.map +0 -1
- package/build/cjs/react-query/hooks/__tests__/useRefetchInterval.test.js +0 -156
- package/build/cjs/react-query/hooks/__tests__/useRefetchInterval.test.js.map +0 -1
- package/build/cjs/react-query/utils/__tests__/checkMutationObjectsKeys.test.js +0 -295
- package/build/cjs/react-query/utils/__tests__/checkMutationObjectsKeys.test.js.map +0 -1
- package/build/cjs/react-query/utils/__tests__/formatNullableValue.test.js +0 -27
- package/build/cjs/react-query/utils/__tests__/formatNullableValue.test.js.map +0 -1
- package/build/cjs/react-query/utils/__tests__/getProgressiveRefetch.test.js +0 -76
- package/build/cjs/react-query/utils/__tests__/getProgressiveRefetch.test.js.map +0 -1
- package/build/cjs/react-query/utils/__tests__/normalizeStatus.test.js +0 -30
- package/build/cjs/react-query/utils/__tests__/normalizeStatus.test.js.map +0 -1
- package/build/cjs/react-query/utils/__tests__/notReachable.test.js +0 -35
- package/build/cjs/react-query/utils/__tests__/notReachable.test.js.map +0 -1
- package/build/cjs/react-query/utils/__tests__/parseNullableValue.test.js +0 -27
- package/build/cjs/react-query/utils/__tests__/parseNullableValue.test.js.map +0 -1
- package/build/cjs/setupTests.d.ts +0 -1
- package/build/cjs/setupTests.js +0 -4
- package/build/cjs/setupTests.js.map +0 -1
- package/build/esm/core/utils/__tests__/composeFullKey.test.js +0 -32
- package/build/esm/core/utils/__tests__/composeFullKey.test.js.map +0 -1
- package/build/esm/core/utils/__tests__/composeKey.test.js +0 -30
- package/build/esm/core/utils/__tests__/composeKey.test.js.map +0 -1
- package/build/esm/core/utils/__tests__/getError.test.js +0 -29
- package/build/esm/core/utils/__tests__/getError.test.js.map +0 -1
- package/build/esm/core/utils/__tests__/getStatus.test.js +0 -47
- package/build/esm/core/utils/__tests__/getStatus.test.js.map +0 -1
- package/build/esm/core/utils/__tests__/hasTag.test.js +0 -29
- package/build/esm/core/utils/__tests__/hasTag.test.js.map +0 -1
- package/build/esm/core/utils/__tests__/mergeStatuses.test.js +0 -23
- package/build/esm/core/utils/__tests__/mergeStatuses.test.js.map +0 -1
- package/build/esm/core/utils/__tests__/skipContext.test.js +0 -67
- package/build/esm/core/utils/__tests__/skipContext.test.js.map +0 -1
- package/build/esm/core/utils/__tests__/withCancellation.test.js +0 -104
- package/build/esm/core/utils/__tests__/withCancellation.test.js.map +0 -1
- package/build/esm/core/utils/__tests__/withCatch.test.js +0 -205
- package/build/esm/core/utils/__tests__/withCatch.test.js.map +0 -1
- package/build/esm/react/__tests__/DataManagerContext.test.js +0 -44
- package/build/esm/react/__tests__/DataManagerContext.test.js.map +0 -1
- package/build/esm/react/__tests__/withDataManager.test.js +0 -58
- package/build/esm/react/__tests__/withDataManager.test.js.map +0 -1
- package/build/esm/react/components/DataInfiniteLoader/__tests__/DataInfiniteLoader.test.js +0 -184
- package/build/esm/react/components/DataInfiniteLoader/__tests__/DataInfiniteLoader.test.js.map +0 -1
- package/build/esm/react/components/DataLoader/__tests__/DataLoader.test.js +0 -116
- package/build/esm/react/components/DataLoader/__tests__/DataLoader.test.js.map +0 -1
- package/build/esm/react-query/__tests__/createQueryNormalizer.test.js +0 -174
- package/build/esm/react-query/__tests__/createQueryNormalizer.test.js.map +0 -1
- package/build/esm/react-query/__tests__/normalizationEdgeCases.test.js +0 -98
- package/build/esm/react-query/__tests__/normalizationEdgeCases.test.js.map +0 -1
- package/build/esm/react-query/__tests__/subscriptions.test.js +0 -1176
- package/build/esm/react-query/__tests__/subscriptions.test.js.map +0 -1
- package/build/esm/react-query/__tests__/threeLevelIntegration.test.js +0 -656
- package/build/esm/react-query/__tests__/threeLevelIntegration.test.js.map +0 -1
- package/build/esm/react-query/__tests__/updateQueriesFromMutationData.test.js +0 -227
- package/build/esm/react-query/__tests__/updateQueriesFromMutationData.test.js.map +0 -1
- package/build/esm/react-query/hooks/__tests__/useQueryContext.test.js +0 -52
- package/build/esm/react-query/hooks/__tests__/useQueryContext.test.js.map +0 -1
- package/build/esm/react-query/hooks/__tests__/useQueryData.test.js +0 -95
- package/build/esm/react-query/hooks/__tests__/useQueryData.test.js.map +0 -1
- package/build/esm/react-query/hooks/__tests__/useQueryResponses.test.js +0 -74
- package/build/esm/react-query/hooks/__tests__/useQueryResponses.test.js.map +0 -1
- package/build/esm/react-query/hooks/__tests__/useRefetchAll.test.js +0 -77
- package/build/esm/react-query/hooks/__tests__/useRefetchAll.test.js.map +0 -1
- package/build/esm/react-query/hooks/__tests__/useRefetchErrored.test.js +0 -115
- package/build/esm/react-query/hooks/__tests__/useRefetchErrored.test.js.map +0 -1
- package/build/esm/react-query/hooks/__tests__/useRefetchInterval.test.js +0 -154
- package/build/esm/react-query/hooks/__tests__/useRefetchInterval.test.js.map +0 -1
- package/build/esm/react-query/utils/__tests__/checkMutationObjectsKeys.test.js +0 -292
- package/build/esm/react-query/utils/__tests__/checkMutationObjectsKeys.test.js.map +0 -1
- package/build/esm/react-query/utils/__tests__/formatNullableValue.test.js +0 -25
- package/build/esm/react-query/utils/__tests__/formatNullableValue.test.js.map +0 -1
- package/build/esm/react-query/utils/__tests__/getProgressiveRefetch.test.js +0 -74
- package/build/esm/react-query/utils/__tests__/getProgressiveRefetch.test.js.map +0 -1
- package/build/esm/react-query/utils/__tests__/normalizeStatus.test.js +0 -28
- package/build/esm/react-query/utils/__tests__/normalizeStatus.test.js.map +0 -1
- package/build/esm/react-query/utils/__tests__/notReachable.test.js +0 -33
- package/build/esm/react-query/utils/__tests__/notReachable.test.js.map +0 -1
- package/build/esm/react-query/utils/__tests__/parseNullableValue.test.js +0 -25
- package/build/esm/react-query/utils/__tests__/parseNullableValue.test.js.map +0 -1
- package/build/esm/setupTests.d.ts +0 -1
- package/build/esm/setupTests.js +0 -2
- package/build/esm/setupTests.js.map +0 -1
|
@@ -15,14 +15,14 @@ export interface DataSource<TContext, TParams, TRequest, TResponse, TData, TErro
|
|
|
15
15
|
}
|
|
16
16
|
export type AnyDataSource = DataSource<any, any, any, any, any, any, any, any, any>;
|
|
17
17
|
export type DataSourceContext<TDataSource> = TDataSource extends DataSource<infer TContext, infer _TParams, infer _TRequest, infer _TResponse, infer _TData, infer _TError, infer _TOptions, infer _TState, infer _TFetchContext> ? TContext : never;
|
|
18
|
-
export type DataSourceParams<TDataSource> = TDataSource extends DataSource<infer
|
|
19
|
-
export type DataSourceRequest<TDataSource> = TDataSource extends DataSource<infer
|
|
20
|
-
export type DataSourceResponse<TDataSource> = TDataSource extends DataSource<infer
|
|
21
|
-
export type DataSourceData<TDataSource> = TDataSource extends DataSource<infer
|
|
22
|
-
export type DataSourceError<TDataSource> = TDataSource extends DataSource<infer
|
|
23
|
-
export type DataSourceOptions<TDataSource> = TDataSource extends DataSource<infer
|
|
24
|
-
export type DataSourceState<TDataSource> = TDataSource extends DataSource<infer
|
|
25
|
-
export type DataSourceFetchContext<TDataSource> = TDataSource extends DataSource<infer
|
|
18
|
+
export type DataSourceParams<TDataSource> = TDataSource extends DataSource<infer _TContext, infer TParams, infer TRequest, infer _TResponse, infer _TData, infer _TError, infer _TOptions, infer _TState, infer _TFetchContext> ? ActualParams<TParams, TRequest> : never;
|
|
19
|
+
export type DataSourceRequest<TDataSource> = TDataSource extends DataSource<infer _TContext, infer _TParams, infer TRequest, infer _TResponse, infer _TData, infer _TError, infer _TOptions, infer _TState, infer _TFetchContext> ? TRequest : never;
|
|
20
|
+
export type DataSourceResponse<TDataSource> = TDataSource extends DataSource<infer _TContext, infer _TParams, infer _TRequest, infer TResponse, infer _TData, infer _TError, infer _TOptions, infer _TState, infer _TFetchContext> ? TResponse : never;
|
|
21
|
+
export type DataSourceData<TDataSource> = TDataSource extends DataSource<infer _TContext, infer _TParams, infer _TRequest, infer TResponse, infer TData, infer _TError, infer _TOptions, infer _TState, infer _TFetchContext> ? ActualData<TData, TResponse> : never;
|
|
22
|
+
export type DataSourceError<TDataSource> = TDataSource extends DataSource<infer _TContext, infer _TParams, infer _TRequest, infer _TResponse, infer _TData, infer TError, infer _TOptions, infer _TState, infer _TFetchContext> ? TError : never;
|
|
23
|
+
export type DataSourceOptions<TDataSource> = TDataSource extends DataSource<infer _TContext, infer _TParams, infer _TRequest, infer _TResponse, infer _TData, infer _TError, infer TOptions, infer _TState, infer _TFetchContext> ? TOptions : never;
|
|
24
|
+
export type DataSourceState<TDataSource> = TDataSource extends DataSource<infer _TContext, infer _TParams, infer _TRequest, infer _TResponse, infer _TData, infer _TError, infer _TOptions, infer TState, infer _TFetchContext> ? TState : never;
|
|
25
|
+
export type DataSourceFetchContext<TDataSource> = TDataSource extends DataSource<infer _TContext, infer _TParams, infer _TRequest, infer _TResponse, infer _TData, infer _TError, infer _TOptions, infer _TState, infer TFetchContext> ? TFetchContext : never;
|
|
26
26
|
export type ActualParams<TParams, TRequest> = (unknown extends TParams ? TRequest : TParams) | typeof idle;
|
|
27
27
|
export type ActualData<TData, TResponse> = unknown extends TData ? TResponse : TData;
|
|
28
28
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["DataSource.ts"],"sourcesContent":["import type {idle} from '../constants';\n\nexport type DataSourceKey = ReadonlyArray<unknown>;\nexport type DataSourceTag = string;\n\ndeclare const errorHintSymbol: unique symbol;\ndeclare const stateHintSymbol: unique symbol;\n\nexport interface DataSource<\n TContext,\n TParams,\n TRequest,\n TResponse,\n TData,\n TError,\n TOptions,\n TState,\n TFetchContext,\n> {\n readonly name: string;\n\n fetch: (\n context: TContext,\n fetchContext: TFetchContext,\n request: TRequest,\n ) => Promise<TResponse> | TResponse;\n tags?: (params: ActualParams<NoInfer<TParams>, NoInfer<TRequest>>) => DataSourceTag[];\n\n transformParams?: (params: TParams) => NoInfer<TRequest>;\n transformResponse?: (response: TResponse) => TData;\n\n options?: Partial<TOptions>;\n [stateHintSymbol]?: TState;\n [errorHintSymbol]?: TError;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyDataSource = DataSource<any, any, any, any, any, any, any, any, any>;\n\nexport type DataSourceContext<TDataSource> =\n TDataSource extends DataSource<\n infer TContext,\n infer _TParams,\n infer _TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? TContext\n : never;\n\nexport type DataSourceParams<TDataSource> =\n TDataSource extends DataSource<\n infer
|
|
1
|
+
{"version":3,"names":[],"sources":["DataSource.ts"],"sourcesContent":["import type {idle} from '../constants';\n\nexport type DataSourceKey = ReadonlyArray<unknown>;\nexport type DataSourceTag = string;\n\ndeclare const errorHintSymbol: unique symbol;\ndeclare const stateHintSymbol: unique symbol;\n\nexport interface DataSource<\n TContext,\n TParams,\n TRequest,\n TResponse,\n TData,\n TError,\n TOptions,\n TState,\n TFetchContext,\n> {\n readonly name: string;\n\n fetch: (\n context: TContext,\n fetchContext: TFetchContext,\n request: TRequest,\n ) => Promise<TResponse> | TResponse;\n tags?: (params: ActualParams<NoInfer<TParams>, NoInfer<TRequest>>) => DataSourceTag[];\n\n transformParams?: (params: TParams) => NoInfer<TRequest>;\n transformResponse?: (response: TResponse) => TData;\n\n options?: Partial<TOptions>;\n [stateHintSymbol]?: TState;\n [errorHintSymbol]?: TError;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyDataSource = DataSource<any, any, any, any, any, any, any, any, any>;\n\nexport type DataSourceContext<TDataSource> =\n TDataSource extends DataSource<\n infer TContext,\n infer _TParams,\n infer _TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? TContext\n : never;\n\nexport type DataSourceParams<TDataSource> =\n TDataSource extends DataSource<\n infer _TContext,\n infer TParams,\n infer TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? ActualParams<TParams, TRequest>\n : never;\n\nexport type DataSourceRequest<TDataSource> =\n TDataSource extends DataSource<\n infer _TContext,\n infer _TParams,\n infer TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? TRequest\n : never;\n\nexport type DataSourceResponse<TDataSource> =\n TDataSource extends DataSource<\n infer _TContext,\n infer _TParams,\n infer _TRequest,\n infer TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? TResponse\n : never;\n\nexport type DataSourceData<TDataSource> =\n TDataSource extends DataSource<\n infer _TContext,\n infer _TParams,\n infer _TRequest,\n infer TResponse,\n infer TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? ActualData<TData, TResponse>\n : never;\n\nexport type DataSourceError<TDataSource> =\n TDataSource extends DataSource<\n infer _TContext,\n infer _TParams,\n infer _TRequest,\n infer _TResponse,\n infer _TData,\n infer TError,\n infer _TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? TError\n : never;\n\nexport type DataSourceOptions<TDataSource> =\n TDataSource extends DataSource<\n infer _TContext,\n infer _TParams,\n infer _TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer TOptions,\n infer _TState,\n infer _TFetchContext\n >\n ? TOptions\n : never;\n\nexport type DataSourceState<TDataSource> =\n TDataSource extends DataSource<\n infer _TContext,\n infer _TParams,\n infer _TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer TState,\n infer _TFetchContext\n >\n ? TState\n : never;\n\nexport type DataSourceFetchContext<TDataSource> =\n TDataSource extends DataSource<\n infer _TContext,\n infer _TParams,\n infer _TRequest,\n infer _TResponse,\n infer _TData,\n infer _TError,\n infer _TOptions,\n infer _TState,\n infer TFetchContext\n >\n ? TFetchContext\n : never;\n\nexport type ActualParams<TParams, TRequest> =\n | (unknown extends TParams ? TRequest : TParams)\n | typeof idle;\n\nexport type ActualData<TData, TResponse> = unknown extends TData ? TResponse : TData;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -23,4 +23,7 @@
|
|
|
23
23
|
* (error) => ({ error: true, message: error.message })
|
|
24
24
|
* );
|
|
25
25
|
*/
|
|
26
|
-
export declare function withCatch<TArgs extends unknown[], TFetchReturnType, TCatchReturnType>(fetchFn: (...args: TArgs) => Promise<TFetchReturnType>, onCatchFn: (reason: unknown) => TCatchReturnType): (...args: TArgs) => Promise<TFetchReturnType
|
|
26
|
+
export declare function withCatch<TArgs extends unknown[], TFetchReturnType, TCatchReturnType>(fetchFn: (...args: TArgs) => Promise<TFetchReturnType>, onCatchFn: (reason: unknown) => TCatchReturnType): (...args: TArgs) => Promise<WithCatchMergedReturn<TFetchReturnType, TCatchReturnType>>;
|
|
27
|
+
/** If success is array-typed, an inferred `() => []` handler (`never[]`) is merged into the success type. */
|
|
28
|
+
type WithCatchMergedReturn<TSuccess, TCatch> = [TCatch] extends [never] ? TSuccess : [TSuccess] extends [readonly unknown[]] ? TCatch extends readonly never[] ? TSuccess : TSuccess | TCatch : TSuccess | TCatch;
|
|
29
|
+
export {};
|
|
@@ -34,4 +34,6 @@ function withCatch(fetchFn, onCatchFn) {
|
|
|
34
34
|
return fetchFn.apply(void 0, arguments)["catch"](onCatchFn);
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
+
|
|
38
|
+
/** If success is array-typed, an inferred `() => []` handler (`never[]`) is merged into the success type. */
|
|
37
39
|
// #sourceMappingURL=withCatch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withCatch","fetchFn","onCatchFn","apply","arguments"],"sources":["withCatch.ts"],"sourcesContent":["/**\n * Creates a wrapper around a function that safely handles errors using a provided error handler.\n *\n * This utility function enhances a Promise-returning function by adding standardized error handling.\n * It catches any errors thrown by the original function and processes them through the provided\n * error handler, allowing for consistent error management across the application.\n *\n * @template TArgs - The argument types of the original function\n * @template TFetchReturnType - The return type of the original function's Promise\n * @template TCatchReturnType - The return type of the error handler function\n *\n * @param fetchFn - The original function that returns a Promise\n * @param onCatchFn - The error handler function that processes any caught errors\n *\n * @returns A new function with the same signature as the original function,\n * but with error handling applied. The returned function will resolve to either\n * the successful result of the original function or the result of the error handler.\n *\n * @example\n * // Basic usage with a string parameter\n * const fetchUser = withCatch(\n * someFetchFunction,\n * (error) => ({ error: true, message: error.message })\n * );\n */\nexport function withCatch<TArgs extends unknown[], TFetchReturnType, TCatchReturnType>(\n fetchFn: (...args: TArgs) => Promise<TFetchReturnType>,\n onCatchFn: (reason: unknown) => TCatchReturnType,\n): (...args: TArgs) => Promise<TFetchReturnType
|
|
1
|
+
{"version":3,"names":["withCatch","fetchFn","onCatchFn","apply","arguments"],"sources":["withCatch.ts"],"sourcesContent":["/**\n * Creates a wrapper around a function that safely handles errors using a provided error handler.\n *\n * This utility function enhances a Promise-returning function by adding standardized error handling.\n * It catches any errors thrown by the original function and processes them through the provided\n * error handler, allowing for consistent error management across the application.\n *\n * @template TArgs - The argument types of the original function\n * @template TFetchReturnType - The return type of the original function's Promise\n * @template TCatchReturnType - The return type of the error handler function\n *\n * @param fetchFn - The original function that returns a Promise\n * @param onCatchFn - The error handler function that processes any caught errors\n *\n * @returns A new function with the same signature as the original function,\n * but with error handling applied. The returned function will resolve to either\n * the successful result of the original function or the result of the error handler.\n *\n * @example\n * // Basic usage with a string parameter\n * const fetchUser = withCatch(\n * someFetchFunction,\n * (error) => ({ error: true, message: error.message })\n * );\n */\nexport function withCatch<TArgs extends unknown[], TFetchReturnType, TCatchReturnType>(\n fetchFn: (...args: TArgs) => Promise<TFetchReturnType>,\n onCatchFn: (reason: unknown) => TCatchReturnType,\n): (...args: TArgs) => Promise<WithCatchMergedReturn<TFetchReturnType, TCatchReturnType>> {\n return (...args) => {\n return fetchFn(...args).catch(onCatchFn) as Promise<\n WithCatchMergedReturn<TFetchReturnType, TCatchReturnType>\n >;\n };\n}\n\n/** If success is array-typed, an inferred `() => []` handler (`never[]`) is merged into the success type. */\ntype WithCatchMergedReturn<TSuccess, TCatch> = [TCatch] extends [never]\n ? TSuccess\n : [TSuccess] extends [readonly unknown[]]\n ? TCatch extends readonly never[]\n ? TSuccess\n : TSuccess | TCatch\n : TSuccess | TCatch;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,SAASA,CACrBC,OAAsD,EACtDC,SAAgD,EACsC;EACtF,OAAO,YAAa;IAChB,OAAOD,OAAO,CAAAE,KAAA,SAAAC,SAAQ,CAAC,SAAM,CAACF,SAAS,CAAC;EAG5C,CAAC;AACL;;AAEA","ignoreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AsyncBoundary = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactErrorBoundary = require("react-error-boundary");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
var AsyncBoundary = exports.AsyncBoundary = function AsyncBoundary(_ref) {
|
|
12
|
+
var LoadingView = _ref.LoadingView,
|
|
13
|
+
ErrorView = _ref.ErrorView,
|
|
14
|
+
onReset = _ref.onReset,
|
|
15
|
+
children = _ref.children;
|
|
16
|
+
var fallbackRender = _react.default.useCallback(function (_ref2) {
|
|
17
|
+
var error = _ref2.error,
|
|
18
|
+
resetErrorBoundary = _ref2.resetErrorBoundary;
|
|
19
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ErrorView, {
|
|
20
|
+
error: error,
|
|
21
|
+
action: {
|
|
22
|
+
handler: resetErrorBoundary
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}, [ErrorView]);
|
|
26
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactErrorBoundary.ErrorBoundary, {
|
|
27
|
+
fallbackRender: fallbackRender,
|
|
28
|
+
onReset: onReset,
|
|
29
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.default.Suspense, {
|
|
30
|
+
fallback: /*#__PURE__*/(0, _jsxRuntime.jsx)(LoadingView, {}),
|
|
31
|
+
children: children
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
// #sourceMappingURL=AsyncBoundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactErrorBoundary","_jsxRuntime","e","__esModule","default","AsyncBoundary","exports","_ref","LoadingView","ErrorView","onReset","children","fallbackRender","React","useCallback","_ref2","error","resetErrorBoundary","_jsx","action","handler","ErrorBoundary","Suspense","fallback"],"sources":["AsyncBoundary.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {FallbackProps} from 'react-error-boundary';\nimport {ErrorBoundary} from 'react-error-boundary';\n\nimport type {AsyncBoundaryProps} from './types';\n\nexport const AsyncBoundary: React.FC<AsyncBoundaryProps> = ({\n LoadingView,\n ErrorView,\n onReset,\n children,\n}) => {\n const fallbackRender = React.useCallback(\n ({error, resetErrorBoundary}: FallbackProps) => (\n <ErrorView error={error} action={{handler: resetErrorBoundary}} />\n ),\n [ErrorView],\n );\n\n return (\n <ErrorBoundary fallbackRender={fallbackRender} onReset={onReset}>\n <React.Suspense fallback={<LoadingView />}>{children}</React.Suspense>\n </ErrorBoundary>\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,mBAAA,GAAAD,OAAA;AAAmD,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAI5C,IAAMG,aAA2C,GAAAC,OAAA,CAAAD,aAAA,GAAG,SAA9CA,aAA2CA,CAAAE,IAAA,EAKlD;EAAA,IAJFC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IACXC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IACPC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;EAER,IAAMC,cAAc,GAAGC,cAAK,CAACC,WAAW,CACpC,UAAAC,KAAA;IAAA,IAAEC,KAAK,GAAAD,KAAA,CAALC,KAAK;MAAEC,kBAAkB,GAAAF,KAAA,CAAlBE,kBAAkB;IAAA,oBACvB,IAAAC,eAAA,EAACT,SAAS;MAACO,KAAK,EAAEA,KAAM;MAACG,MAAM,EAAE;QAACC,OAAO,EAAEH;MAAkB;IAAE,CAAE,CAAC;EAAA,CACrE,EACD,CAACR,SAAS,CACd,CAAC;EAED,oBACI,IAAAS,eAAA,EAACG,iCAAa;IAACT,cAAc,EAAEA,cAAe;IAACF,OAAO,EAAEA,OAAQ;IAAAC,QAAA,eAC5D,IAAAO,eAAA,EAACL,cAAK,CAACS,QAAQ;MAACC,QAAQ,eAAE,IAAAL,eAAA,EAACV,WAAW,IAAE,CAAE;MAAAG,QAAA,EAAEA;IAAQ,CAAiB;EAAC,CAC3D,CAAC;AAExB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "AsyncBoundary", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _AsyncBoundary.AsyncBoundary;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "withAsyncBoundary", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _withAsyncBoundary.withAsyncBoundary;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _AsyncBoundary = require("./AsyncBoundary");
|
|
19
|
+
var _withAsyncBoundary = require("./withAsyncBoundary");
|
|
20
|
+
// #sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_AsyncBoundary","require","_withAsyncBoundary"],"sources":["index.ts"],"sourcesContent":["export type {AsyncBoundaryProps, AsyncBoundaryComponent} from './types';\nexport {AsyncBoundary} from './AsyncBoundary';\nexport {withAsyncBoundary} from './withAsyncBoundary';\n"],"mappings":";;;;;;;;;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import type { ErrorViewProps } from '../types';
|
|
3
|
+
export interface AsyncBoundaryProps {
|
|
4
|
+
LoadingView: ComponentType;
|
|
5
|
+
ErrorView: ComponentType<ErrorViewProps>;
|
|
6
|
+
onReset?: () => void;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export interface AsyncBoundaryComponent<TProps extends object> extends React.FC<TProps> {
|
|
10
|
+
Content: React.ComponentType<TProps>;
|
|
11
|
+
Loading: AsyncBoundaryProps['LoadingView'];
|
|
12
|
+
Error: AsyncBoundaryProps['ErrorView'];
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {ComponentType, ReactNode} from 'react';\n\nimport type {ErrorViewProps} from '../types';\n\nexport interface AsyncBoundaryProps {\n LoadingView: ComponentType;\n ErrorView: ComponentType<ErrorViewProps>;\n onReset?: () => void;\n children: ReactNode;\n}\n\nexport interface AsyncBoundaryComponent<TProps extends object> extends React.FC<TProps> {\n Content: React.ComponentType<TProps>;\n Loading: AsyncBoundaryProps['LoadingView'];\n Error: AsyncBoundaryProps['ErrorView'];\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AsyncBoundaryComponent, AsyncBoundaryProps } from './types';
|
|
3
|
+
export declare const withAsyncBoundary: <TProps extends object>(Component: React.ComponentType<TProps>, LoadingView: AsyncBoundaryProps["LoadingView"], ErrorView: AsyncBoundaryProps["ErrorView"]) => AsyncBoundaryComponent<TProps>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.withAsyncBoundary = void 0;
|
|
7
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _AsyncBoundary = require("./AsyncBoundary");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
var withAsyncBoundary = exports.withAsyncBoundary = function withAsyncBoundary(Component, LoadingView, ErrorView) {
|
|
13
|
+
var WrappedComponent = function WrappedComponent(props) {
|
|
14
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AsyncBoundary.AsyncBoundary, {
|
|
15
|
+
LoadingView: LoadingView,
|
|
16
|
+
ErrorView: ErrorView,
|
|
17
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, (0, _objectSpread2.default)({}, props))
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
WrappedComponent.displayName = "WithAsyncBoundary(".concat(Component.displayName || Component.name, ")");
|
|
21
|
+
WrappedComponent.Content = Component;
|
|
22
|
+
WrappedComponent.Loading = LoadingView;
|
|
23
|
+
WrappedComponent.Error = ErrorView;
|
|
24
|
+
return WrappedComponent;
|
|
25
|
+
};
|
|
26
|
+
// #sourceMappingURL=withAsyncBoundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_AsyncBoundary","_jsxRuntime","e","__esModule","default","withAsyncBoundary","exports","Component","LoadingView","ErrorView","WrappedComponent","props","_jsx","AsyncBoundary","children","_objectSpread","displayName","concat","name","Content","Loading","Error"],"sources":["withAsyncBoundary.tsx"],"sourcesContent":["import React from 'react';\n\nimport {AsyncBoundary} from './AsyncBoundary';\nimport type {AsyncBoundaryComponent, AsyncBoundaryProps} from './types';\n\nexport const withAsyncBoundary = <TProps extends object>(\n Component: React.ComponentType<TProps>,\n LoadingView: AsyncBoundaryProps['LoadingView'],\n ErrorView: AsyncBoundaryProps['ErrorView'],\n) => {\n const WrappedComponent = ((props: TProps) => (\n <AsyncBoundary LoadingView={LoadingView} ErrorView={ErrorView}>\n <Component {...props} />\n </AsyncBoundary>\n )) as AsyncBoundaryComponent<TProps>;\n\n WrappedComponent.displayName = `WithAsyncBoundary(${Component.displayName || Component.name})`;\n\n WrappedComponent.Content = Component;\n WrappedComponent.Loading = LoadingView;\n WrappedComponent.Error = ErrorView;\n\n return WrappedComponent;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAA8C,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGvC,IAAMG,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,SAApBA,iBAAiBA,CAC1BE,SAAsC,EACtCC,WAA8C,EAC9CC,SAA0C,EACzC;EACD,IAAMC,gBAAgB,GAAI,SAApBA,gBAAgBA,CAAKC,KAAa;IAAA,oBACpC,IAAAC,eAAA,EAACC,4BAAa;MAACL,WAAW,EAAEA,WAAY;MAACC,SAAS,EAAEA,SAAU;MAAAK,QAAA,eAC1D,IAAAF,eAAA,EAACL,SAAS,MAAAQ,sBAAA,MAAKJ,KAAK,CAAG;IAAC,CACb,CAAC;EAAA,CACgB;EAEpCD,gBAAgB,CAACM,WAAW,wBAAAC,MAAA,CAAwBV,SAAS,CAACS,WAAW,IAAIT,SAAS,CAACW,IAAI,MAAG;EAE9FR,gBAAgB,CAACS,OAAO,GAAGZ,SAAS;EACpCG,gBAAgB,CAACU,OAAO,GAAGZ,WAAW;EACtCE,gBAAgB,CAACW,KAAK,GAAGZ,SAAS;EAElC,OAAOC,gBAAgB;AAC3B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["EmptyView","exports"],"sources":["EmptyView.tsx"],"sourcesContent":["import type React from 'react';\n\nexport const EmptyView: React.FC = () => {\n return null;\n};\n"],"mappings":";;;;;;AAEO,IAAMA,SAAmB,GAAAC,OAAA,CAAAD,SAAA,GAAG,SAAtBA,SAAmBA,CAAA,EAAS;EACrC,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EmptyView } from './EmptyView';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "EmptyView", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _EmptyView.EmptyView;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _EmptyView = require("./EmptyView");
|
|
13
|
+
// #sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_EmptyView","require"],"sources":["index.ts"],"sourcesContent":["export {EmptyView} from './EmptyView';\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {ReactNode} from 'react';\n\nexport interface ErrorAction {\n handler: () => unknown;\n children?: ReactNode;\n}\n\nexport interface ErrorViewProps<TError> {\n error: TError | null;\n action?: ErrorAction;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {ReactNode} from 'react';\n\nexport interface ErrorAction {\n handler: () => unknown;\n children?: ReactNode;\n}\n\nexport interface ErrorViewProps<TError = unknown> {\n error: TError | null;\n action?: ErrorAction;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
export * from './components/AsyncBoundary';
|
|
2
|
+
export * from './components/DataLoader';
|
|
3
|
+
export * from './components/DataInfiniteLoader';
|
|
4
|
+
export * from './components/EmptyView';
|
|
5
|
+
export type { ErrorAction, ErrorViewProps } from './components/types';
|
|
1
6
|
export { DataManagerContext, useDataManager } from './DataManagerContext';
|
|
2
7
|
export { DataManagerProvider } from './DataManagerProvider';
|
|
3
8
|
export type { DataManagerProviderProps } from './DataManagerProvider';
|
|
4
9
|
export type { WithDataManagerProps } from './withDataManager';
|
|
5
10
|
export { withDataManager } from './withDataManager';
|
|
6
|
-
export type { ErrorAction, ErrorViewProps } from './components/types';
|
|
7
|
-
export * from './components/DataLoader';
|
|
8
|
-
export * from './components/DataInfiniteLoader';
|
package/build/cjs/react/index.js
CHANGED
|
@@ -33,9 +33,18 @@ Object.defineProperty(exports, "withDataManager", {
|
|
|
33
33
|
return _withDataManager.withDataManager;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
var _AsyncBoundary = require("./components/AsyncBoundary");
|
|
37
|
+
Object.keys(_AsyncBoundary).forEach(function (key) {
|
|
38
|
+
if (key === "default" || key === "__esModule") return;
|
|
39
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
40
|
+
if (key in exports && exports[key] === _AsyncBoundary[key]) return;
|
|
41
|
+
Object.defineProperty(exports, key, {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () {
|
|
44
|
+
return _AsyncBoundary[key];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
39
48
|
var _DataLoader = require("./components/DataLoader");
|
|
40
49
|
Object.keys(_DataLoader).forEach(function (key) {
|
|
41
50
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -60,4 +69,19 @@ Object.keys(_DataInfiniteLoader).forEach(function (key) {
|
|
|
60
69
|
}
|
|
61
70
|
});
|
|
62
71
|
});
|
|
72
|
+
var _EmptyView = require("./components/EmptyView");
|
|
73
|
+
Object.keys(_EmptyView).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
76
|
+
if (key in exports && exports[key] === _EmptyView[key]) return;
|
|
77
|
+
Object.defineProperty(exports, key, {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function () {
|
|
80
|
+
return _EmptyView[key];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
var _DataManagerContext = require("./DataManagerContext");
|
|
85
|
+
var _DataManagerProvider = require("./DataManagerProvider");
|
|
86
|
+
var _withDataManager = require("./withDataManager");
|
|
63
87
|
// #sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_AsyncBoundary","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_DataLoader","_DataInfiniteLoader","_EmptyView","_DataManagerContext","_DataManagerProvider","_withDataManager"],"sources":["index.ts"],"sourcesContent":["export * from './components/AsyncBoundary';\nexport * from './components/DataLoader';\nexport * from './components/DataInfiniteLoader';\nexport * from './components/EmptyView';\nexport type {ErrorAction, ErrorViewProps} from './components/types';\n\nexport {DataManagerContext, useDataManager} from './DataManagerContext';\nexport {DataManagerProvider} from './DataManagerProvider';\nexport type {DataManagerProviderProps} from './DataManagerProvider';\nexport type {WithDataManagerProps} from './withDataManager';\nexport {withDataManager} from './withDataManager';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,cAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,cAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,cAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,WAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,WAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,WAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,WAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,mBAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,mBAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAU,mBAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,mBAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AACA,IAAAW,UAAA,GAAAf,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAa,UAAA,EAAAZ,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAW,UAAA,CAAAX,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,UAAA,CAAAX,GAAA;IAAA;EAAA;AAAA;AAGA,IAAAY,mBAAA,GAAAhB,OAAA;AACA,IAAAiB,oBAAA,GAAAjB,OAAA;AAGA,IAAAkB,gBAAA,GAAAlB,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.QueryAsyncBoundary = void 0;
|
|
7
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactQuery = require("@tanstack/react-query");
|
|
10
|
+
var _react2 = require("../../../react");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
var QueryAsyncBoundary = exports.QueryAsyncBoundary = function QueryAsyncBoundary(props) {
|
|
14
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactQuery.QueryErrorResetBoundary, {
|
|
15
|
+
children: function children(_ref) {
|
|
16
|
+
var reset = _ref.reset;
|
|
17
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.AsyncBoundary, (0, _objectSpread2.default)({
|
|
18
|
+
onReset: reset
|
|
19
|
+
}, props));
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
// #sourceMappingURL=QueryAsyncBoundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactQuery","_react2","_jsxRuntime","e","__esModule","default","QueryAsyncBoundary","exports","props","_jsx","QueryErrorResetBoundary","children","_ref","reset","AsyncBoundary","_objectSpread","onReset"],"sources":["QueryAsyncBoundary.tsx"],"sourcesContent":["import React from 'react';\n\nimport {QueryErrorResetBoundary} from '@tanstack/react-query';\n\nimport {AsyncBoundary} from '../../../react';\n\nimport type {QueryAsyncBoundaryProps} from './types';\n\nexport const QueryAsyncBoundary: React.FC<QueryAsyncBoundaryProps> = (props) => (\n <QueryErrorResetBoundary>\n {({reset}) => <AsyncBoundary onReset={reset} {...props} />}\n </QueryErrorResetBoundary>\n);\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAA6C,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAItC,IAAMG,kBAAqD,GAAAC,OAAA,CAAAD,kBAAA,GAAG,SAAxDA,kBAAqDA,CAAIE,KAAK;EAAA,oBACvE,IAAAC,eAAA,EAACC,mCAAuB;IAAAC,QAAA,EACnB,SAAAA,SAAAC,IAAA;MAAA,IAAEC,KAAK,GAAAD,IAAA,CAALC,KAAK;MAAA,oBAAM,IAAAJ,eAAA,EAACK,qBAAa,MAAAC,sBAAA;QAACC,OAAO,EAAEH;MAAM,GAAKL,KAAK,CAAG,CAAC;IAAA;EAAA,CACrC,CAAC;AAAA,CAC7B","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "QueryAsyncBoundary", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _QueryAsyncBoundary.QueryAsyncBoundary;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "withQueryAsyncBoundary", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _withQueryAsyncBoundary.withQueryAsyncBoundary;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _QueryAsyncBoundary = require("./QueryAsyncBoundary");
|
|
19
|
+
var _withQueryAsyncBoundary = require("./withQueryAsyncBoundary");
|
|
20
|
+
// #sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_QueryAsyncBoundary","require","_withQueryAsyncBoundary"],"sources":["index.ts"],"sourcesContent":["export {QueryAsyncBoundary} from './QueryAsyncBoundary';\nexport type {QueryAsyncBoundaryProps, QueryAsyncBoundaryComponent} from './types';\nexport {withQueryAsyncBoundary} from './withQueryAsyncBoundary';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAEA,IAAAC,uBAAA,GAAAD,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AsyncBoundaryProps } from '../../../react';
|
|
2
|
+
export interface QueryAsyncBoundaryProps extends AsyncBoundaryProps {
|
|
3
|
+
}
|
|
4
|
+
export interface QueryAsyncBoundaryComponent<TProps extends object> extends React.FC<TProps> {
|
|
5
|
+
Content: React.ComponentType<TProps>;
|
|
6
|
+
Loading: QueryAsyncBoundaryProps['LoadingView'];
|
|
7
|
+
Error: QueryAsyncBoundaryProps['ErrorView'];
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {AsyncBoundaryProps} from '../../../react';\n\nexport interface QueryAsyncBoundaryProps extends AsyncBoundaryProps {}\n\nexport interface QueryAsyncBoundaryComponent<TProps extends object> extends React.FC<TProps> {\n Content: React.ComponentType<TProps>;\n Loading: QueryAsyncBoundaryProps['LoadingView'];\n Error: QueryAsyncBoundaryProps['ErrorView'];\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { QueryAsyncBoundaryComponent, QueryAsyncBoundaryProps } from './types';
|
|
3
|
+
export declare const withQueryAsyncBoundary: <TProps extends object>(Component: React.ComponentType<TProps>, LoadingView: QueryAsyncBoundaryProps["LoadingView"], ErrorView: QueryAsyncBoundaryProps["ErrorView"]) => QueryAsyncBoundaryComponent<TProps>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.withQueryAsyncBoundary = void 0;
|
|
7
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _QueryAsyncBoundary = require("./QueryAsyncBoundary");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
var withQueryAsyncBoundary = exports.withQueryAsyncBoundary = function withQueryAsyncBoundary(Component, LoadingView, ErrorView) {
|
|
13
|
+
var WrappedComponent = function WrappedComponent(props) {
|
|
14
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_QueryAsyncBoundary.QueryAsyncBoundary, {
|
|
15
|
+
LoadingView: LoadingView,
|
|
16
|
+
ErrorView: ErrorView,
|
|
17
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, (0, _objectSpread2.default)({}, props))
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
WrappedComponent.displayName = "WithQueryAsyncBoundary(".concat(Component.displayName || Component.name, ")");
|
|
21
|
+
WrappedComponent.Content = Component;
|
|
22
|
+
WrappedComponent.Loading = LoadingView;
|
|
23
|
+
WrappedComponent.Error = ErrorView;
|
|
24
|
+
return WrappedComponent;
|
|
25
|
+
};
|
|
26
|
+
// #sourceMappingURL=withQueryAsyncBoundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_QueryAsyncBoundary","_jsxRuntime","e","__esModule","default","withQueryAsyncBoundary","exports","Component","LoadingView","ErrorView","WrappedComponent","props","_jsx","QueryAsyncBoundary","children","_objectSpread","displayName","concat","name","Content","Loading","Error"],"sources":["withQueryAsyncBoundary.tsx"],"sourcesContent":["import React from 'react';\n\nimport {QueryAsyncBoundary} from './QueryAsyncBoundary';\nimport type {QueryAsyncBoundaryComponent, QueryAsyncBoundaryProps} from './types';\n\nexport const withQueryAsyncBoundary = <TProps extends object>(\n Component: React.ComponentType<TProps>,\n LoadingView: QueryAsyncBoundaryProps['LoadingView'],\n ErrorView: QueryAsyncBoundaryProps['ErrorView'],\n) => {\n const WrappedComponent = ((props: TProps) => (\n <QueryAsyncBoundary LoadingView={LoadingView} ErrorView={ErrorView}>\n <Component {...props} />\n </QueryAsyncBoundary>\n )) as QueryAsyncBoundaryComponent<TProps>;\n\n WrappedComponent.displayName = `WithQueryAsyncBoundary(${\n Component.displayName || Component.name\n })`;\n\n WrappedComponent.Content = Component;\n WrappedComponent.Loading = LoadingView;\n WrappedComponent.Error = ErrorView;\n\n return WrappedComponent;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAD,OAAA;AAAwD,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGjD,IAAMG,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,SAAzBA,sBAAsBA,CAC/BE,SAAsC,EACtCC,WAAmD,EACnDC,SAA+C,EAC9C;EACD,IAAMC,gBAAgB,GAAI,SAApBA,gBAAgBA,CAAKC,KAAa;IAAA,oBACpC,IAAAC,eAAA,EAACC,sCAAkB;MAACL,WAAW,EAAEA,WAAY;MAACC,SAAS,EAAEA,SAAU;MAAAK,QAAA,eAC/D,IAAAF,eAAA,EAACL,SAAS,MAAAQ,sBAAA,MAAKJ,KAAK,CAAG;IAAC,CACR,CAAC;EAAA,CACgB;EAEzCD,gBAAgB,CAACM,WAAW,6BAAAC,MAAA,CACxBV,SAAS,CAACS,WAAW,IAAIT,SAAS,CAACW,IAAI,MACxC;EAEHR,gBAAgB,CAACS,OAAO,GAAGZ,SAAS;EACpCG,gBAAgB,CAACU,OAAO,GAAGZ,WAAW;EACtCE,gBAAgB,CAACW,KAAK,GAAGZ,SAAS;EAElC,OAAOC,gBAAgB;AAC3B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Overwrite } from 'utility-types';
|
|
2
|
+
import type { DataSourceData, DataSourceOptions, DataSourceParams, DataSourceState, idle } from '../../core';
|
|
3
|
+
import type { AnyQueryDataSource } from '../types/base';
|
|
4
|
+
type SuspenseQueryOptions<TDataSource extends AnyQueryDataSource> = Omit<Partial<DataSourceOptions<TDataSource>>, 'suspense' | 'enabled' | 'throwOnError' | 'retryOnMount' | 'placeholderData'>;
|
|
5
|
+
type SuspenseQueryResult<TDataSource extends AnyQueryDataSource> = Overwrite<DataSourceState<TDataSource>, {
|
|
6
|
+
data: NonNullable<DataSourceData<TDataSource>>;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const useSuspenseQueryData: <TDataSource extends AnyQueryDataSource>(dataSource: TDataSource, params: Exclude<DataSourceParams<TDataSource>, typeof idle>, options?: SuspenseQueryOptions<TDataSource>) => SuspenseQueryResult<TDataSource>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useSuspenseQueryData = void 0;
|
|
7
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
8
|
+
var _useQueryData = require("./useQueryData");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
var defaultThrowOnError = function defaultThrowOnError(_error, query) {
|
|
11
|
+
return query.state.data === undefined;
|
|
12
|
+
};
|
|
13
|
+
var useSuspenseQueryData = exports.useSuspenseQueryData = function useSuspenseQueryData(dataSource, params, options) {
|
|
14
|
+
return (0, _useQueryData.useQueryData)(dataSource, params, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, options), {}, {
|
|
15
|
+
suspense: true,
|
|
16
|
+
enabled: true,
|
|
17
|
+
throwOnError: defaultThrowOnError,
|
|
18
|
+
retryOnMount: true,
|
|
19
|
+
placeholderData: undefined
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
22
|
+
// #sourceMappingURL=useSuspenseQueryData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_useQueryData","require","_interopRequireDefault","e","__esModule","default","defaultThrowOnError","_error","query","state","data","undefined","useSuspenseQueryData","exports","dataSource","params","options","useQueryData","_objectSpread","suspense","enabled","throwOnError","retryOnMount","placeholderData"],"sources":["useSuspenseQueryData.ts"],"sourcesContent":["import type {Query} from '@tanstack/react-query';\nimport type {Overwrite} from 'utility-types';\n\nimport type {\n DataSourceData,\n DataSourceOptions,\n DataSourceParams,\n DataSourceState,\n idle,\n} from '../../core';\nimport type {AnyQueryDataSource} from '../types/base';\n\nimport {useQueryData} from './useQueryData';\n\ntype SuspenseQueryOptions<TDataSource extends AnyQueryDataSource> = Omit<\n Partial<DataSourceOptions<TDataSource>>,\n 'suspense' | 'enabled' | 'throwOnError' | 'retryOnMount' | 'placeholderData'\n>;\n\ntype SuspenseQueryResult<TDataSource extends AnyQueryDataSource> = Overwrite<\n DataSourceState<TDataSource>,\n {data: NonNullable<DataSourceData<TDataSource>>}\n>;\n\nconst defaultThrowOnError = (_error: unknown, query: Query) => query.state.data === undefined;\n\nexport const useSuspenseQueryData = <TDataSource extends AnyQueryDataSource>(\n dataSource: TDataSource,\n params: Exclude<DataSourceParams<TDataSource>, typeof idle>,\n options?: SuspenseQueryOptions<TDataSource>,\n): SuspenseQueryResult<TDataSource> => {\n return useQueryData(dataSource, params, {\n ...options,\n suspense: true,\n enabled: true,\n throwOnError: defaultThrowOnError,\n retryOnMount: true,\n placeholderData: undefined,\n } as Partial<DataSourceOptions<TDataSource>>) as SuspenseQueryResult<TDataSource>;\n};\n"],"mappings":";;;;;;;AAYA,IAAAA,aAAA,GAAAC,OAAA;AAA2C,SAAAC,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAY3C,IAAMG,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,MAAe,EAAEC,KAAY;EAAA,OAAKA,KAAK,CAACC,KAAK,CAACC,IAAI,KAAKC,SAAS;AAAA;AAEtF,IAAMC,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAG,SAAvBA,oBAAoBA,CAC7BE,UAAuB,EACvBC,MAA2D,EAC3DC,OAA2C,EACR;EACnC,OAAO,IAAAC,0BAAY,EAACH,UAAU,EAAEC,MAAM,MAAAG,sBAAA,MAAAA,sBAAA,MAC/BF,OAAO;IACVG,QAAQ,EAAE,IAAI;IACdC,OAAO,EAAE,IAAI;IACbC,YAAY,EAAEf,mBAAmB;IACjCgB,YAAY,EAAE,IAAI;IAClBC,eAAe,EAAEZ;EAAS,EACc,CAAC;AACjD,CAAC","ignoreList":[]}
|
|
@@ -10,6 +10,8 @@ var _react = require("react");
|
|
|
10
10
|
var _reactQuery = require("@tanstack/react-query");
|
|
11
11
|
var _useRefetchInterval2 = require("../../hooks/useRefetchInterval");
|
|
12
12
|
var _normalizeStatus = require("../../utils/normalizeStatus");
|
|
13
|
+
var _warnDisabledRefetch = require("../../utils/warnDisabledRefetch");
|
|
14
|
+
var _wrapRefetch = require("../../utils/wrapRefetch");
|
|
13
15
|
var _utils = require("./utils");
|
|
14
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
17
|
var _excluded = ["queryFn", "refetchInterval"];
|
|
@@ -33,11 +35,13 @@ var useInfiniteQueryData = exports.useInfiniteQueryData = function useInfiniteQu
|
|
|
33
35
|
var _state$data$pages$fla, _state$data;
|
|
34
36
|
return (_state$data$pages$fla = (_state$data = state.data) === null || _state$data === void 0 ? void 0 : _state$data.pages.flat(1)) !== null && _state$data$pages$fla !== void 0 ? _state$data$pages$fla : [];
|
|
35
37
|
}, [state.data]);
|
|
38
|
+
var isDisabled = composedOptions.enabled === false || composedOptions.queryFn === _reactQuery.skipToken;
|
|
36
39
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
|
|
37
40
|
status: (0, _normalizeStatus.normalizeStatus)(state.status, state.fetchStatus),
|
|
38
41
|
data: transformedData,
|
|
39
42
|
originalStatus: state.status,
|
|
40
|
-
originalData: state.data
|
|
43
|
+
originalData: state.data,
|
|
44
|
+
refetch: isDisabled ? _warnDisabledRefetch.warnDisabledRefetch : (0, _wrapRefetch.wrapRefetch)(state.refetch)
|
|
41
45
|
});
|
|
42
46
|
};
|
|
43
47
|
// #sourceMappingURL=hooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactQuery","_useRefetchInterval2","_normalizeStatus","_utils","_interopRequireDefault","e","__esModule","default","useInfiniteQueryDataOptions","composedOptions","queryFnOption","queryFn","refetchIntervalOption","refetchInterval","restOptions","_objectWithoutProperties","_excluded","_useRefetchInterval","useRefetchInterval","_objectSpread","useInfiniteQueryData","exports","context","dataSource","params","options","extendedOptions","composeOptions","state","useInfiniteQuery","transformedData","useMemo","_state$data$pages$fla","_state$data","data","pages","flat","status","normalizeStatus","fetchStatus","originalStatus","originalData"],"sources":["hooks.ts"],"sourcesContent":["import {useMemo} from 'react';\n\nimport {useInfiniteQuery} from '@tanstack/react-query';\nimport type {InfiniteData, InfiniteQueryObserverOptions} from '@tanstack/react-query';\n\nimport type {\n DataSourceContext,\n DataSourceData,\n DataSourceError,\n DataSourceKey,\n DataSourceOptions,\n DataSourceParams,\n DataSourceRequest,\n DataSourceResponse,\n DataSourceState,\n} from '../../../core';\nimport {useRefetchInterval} from '../../hooks/useRefetchInterval';\nimport {normalizeStatus} from '../../utils/normalizeStatus';\n\nimport type {AnyInfiniteQueryDataSource, InfiniteQueryObserverExtendedOptions} from './types';\nimport {composeOptions} from './utils';\n\nconst useInfiniteQueryDataOptions = <TDataSource extends AnyInfiniteQueryDataSource>(\n composedOptions: InfiniteQueryObserverExtendedOptions<\n DataSourceResponse<TDataSource>,\n DataSourceError<TDataSource>,\n InfiniteData<DataSourceData<TDataSource>, Partial<DataSourceRequest<TDataSource>>>,\n DataSourceResponse<TDataSource>,\n DataSourceKey,\n Partial<DataSourceRequest<TDataSource>>\n >,\n): InfiniteQueryObserverOptions<\n DataSourceResponse<TDataSource>,\n DataSourceError<TDataSource>,\n InfiniteData<DataSourceData<TDataSource>, Partial<DataSourceRequest<TDataSource>>>,\n DataSourceResponse<TDataSource>,\n DataSourceKey,\n Partial<DataSourceRequest<TDataSource>>\n> => {\n const {\n queryFn: queryFnOption,\n refetchInterval: refetchIntervalOption,\n ...restOptions\n } = composedOptions;\n\n const {queryFn, refetchInterval} = useRefetchInterval(refetchIntervalOption, queryFnOption);\n\n return {...restOptions, queryFn, refetchInterval};\n};\n\nexport const useInfiniteQueryData = <TDataSource extends AnyInfiniteQueryDataSource>(\n context: DataSourceContext<TDataSource>,\n dataSource: TDataSource,\n params: DataSourceParams<TDataSource>,\n options?: Partial<DataSourceOptions<TDataSource>>,\n): DataSourceState<TDataSource> => {\n const extendedOptions = composeOptions(context, dataSource, params, options);\n const composedOptions = useInfiniteQueryDataOptions(extendedOptions);\n const state = useInfiniteQuery(composedOptions);\n\n const transformedData = useMemo<DataSourceState<TDataSource>['data']>(\n () => state.data?.pages.flat(1) ?? [],\n [state.data],\n );\n\n return {\n ...state,\n status: normalizeStatus(state.status, state.fetchStatus),\n data: transformedData,\n originalStatus: state.status,\n originalData: state.data,\n } as DataSourceState<TDataSource>;\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAcA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;
|
|
1
|
+
{"version":3,"names":["_react","require","_reactQuery","_useRefetchInterval2","_normalizeStatus","_warnDisabledRefetch","_wrapRefetch","_utils","_interopRequireDefault","e","__esModule","default","useInfiniteQueryDataOptions","composedOptions","queryFnOption","queryFn","refetchIntervalOption","refetchInterval","restOptions","_objectWithoutProperties","_excluded","_useRefetchInterval","useRefetchInterval","_objectSpread","useInfiniteQueryData","exports","context","dataSource","params","options","extendedOptions","composeOptions","state","useInfiniteQuery","transformedData","useMemo","_state$data$pages$fla","_state$data","data","pages","flat","isDisabled","enabled","skipToken","status","normalizeStatus","fetchStatus","originalStatus","originalData","refetch","warnDisabledRefetch","wrapRefetch"],"sources":["hooks.ts"],"sourcesContent":["import {useMemo} from 'react';\n\nimport {skipToken, useInfiniteQuery} from '@tanstack/react-query';\nimport type {InfiniteData, InfiniteQueryObserverOptions} from '@tanstack/react-query';\n\nimport type {\n DataSourceContext,\n DataSourceData,\n DataSourceError,\n DataSourceKey,\n DataSourceOptions,\n DataSourceParams,\n DataSourceRequest,\n DataSourceResponse,\n DataSourceState,\n} from '../../../core';\nimport {useRefetchInterval} from '../../hooks/useRefetchInterval';\nimport {normalizeStatus} from '../../utils/normalizeStatus';\nimport {warnDisabledRefetch} from '../../utils/warnDisabledRefetch';\nimport {wrapRefetch} from '../../utils/wrapRefetch';\n\nimport type {AnyInfiniteQueryDataSource, InfiniteQueryObserverExtendedOptions} from './types';\nimport {composeOptions} from './utils';\n\nconst useInfiniteQueryDataOptions = <TDataSource extends AnyInfiniteQueryDataSource>(\n composedOptions: InfiniteQueryObserverExtendedOptions<\n DataSourceResponse<TDataSource>,\n DataSourceError<TDataSource>,\n InfiniteData<DataSourceData<TDataSource>, Partial<DataSourceRequest<TDataSource>>>,\n DataSourceResponse<TDataSource>,\n DataSourceKey,\n Partial<DataSourceRequest<TDataSource>>\n >,\n): InfiniteQueryObserverOptions<\n DataSourceResponse<TDataSource>,\n DataSourceError<TDataSource>,\n InfiniteData<DataSourceData<TDataSource>, Partial<DataSourceRequest<TDataSource>>>,\n DataSourceResponse<TDataSource>,\n DataSourceKey,\n Partial<DataSourceRequest<TDataSource>>\n> => {\n const {\n queryFn: queryFnOption,\n refetchInterval: refetchIntervalOption,\n ...restOptions\n } = composedOptions;\n\n const {queryFn, refetchInterval} = useRefetchInterval(refetchIntervalOption, queryFnOption);\n\n return {...restOptions, queryFn, refetchInterval};\n};\n\nexport const useInfiniteQueryData = <TDataSource extends AnyInfiniteQueryDataSource>(\n context: DataSourceContext<TDataSource>,\n dataSource: TDataSource,\n params: DataSourceParams<TDataSource>,\n options?: Partial<DataSourceOptions<TDataSource>>,\n): DataSourceState<TDataSource> => {\n const extendedOptions = composeOptions(context, dataSource, params, options);\n const composedOptions = useInfiniteQueryDataOptions(extendedOptions);\n const state = useInfiniteQuery(composedOptions);\n\n const transformedData = useMemo<DataSourceState<TDataSource>['data']>(\n () => state.data?.pages.flat(1) ?? [],\n [state.data],\n );\n\n const isDisabled = composedOptions.enabled === false || composedOptions.queryFn === skipToken;\n\n return {\n ...state,\n status: normalizeStatus(state.status, state.fetchStatus),\n data: transformedData,\n originalStatus: state.status,\n originalData: state.data,\n refetch: isDisabled ? warnDisabledRefetch : wrapRefetch(state.refetch),\n } as DataSourceState<TDataSource>;\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAD,OAAA;AAcA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAGA,IAAAM,MAAA,GAAAN,OAAA;AAAsC,SAAAO,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;;AAEtC,IAAMG,2BAA2B,GAAG,SAA9BA,2BAA2BA,CAC7BC,eAOC,EAQA;EACD,IACaC,aAAa,GAGtBD,eAAe,CAHfE,OAAO;IACUC,qBAAqB,GAEtCH,eAAe,CAFfI,eAAe;IACZC,WAAW,OAAAC,iCAAA,EACdN,eAAe,EAAAO,SAAA;EAEnB,IAAAC,mBAAA,GAAmC,IAAAC,uCAAkB,EAACN,qBAAqB,EAAEF,aAAa,CAAC;IAApFC,OAAO,GAAAM,mBAAA,CAAPN,OAAO;IAAEE,eAAe,GAAAI,mBAAA,CAAfJ,eAAe;EAE/B,WAAAM,sBAAA,MAAAA,sBAAA,MAAWL,WAAW;IAAEH,OAAO,EAAPA,OAAO;IAAEE,eAAe,EAAfA;EAAe;AACpD,CAAC;AAEM,IAAMO,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAG,SAAvBA,oBAAoBA,CAC7BE,OAAuC,EACvCC,UAAuB,EACvBC,MAAqC,EACrCC,OAAiD,EAClB;EAC/B,IAAMC,eAAe,GAAG,IAAAC,qBAAc,EAACL,OAAO,EAAEC,UAAU,EAAEC,MAAM,EAAEC,OAAO,CAAC;EAC5E,IAAMhB,eAAe,GAAGD,2BAA2B,CAACkB,eAAe,CAAC;EACpE,IAAME,KAAK,GAAG,IAAAC,4BAAgB,EAACpB,eAAe,CAAC;EAE/C,IAAMqB,eAAe,GAAG,IAAAC,cAAO,EAC3B;IAAA,IAAAC,qBAAA,EAAAC,WAAA;IAAA,QAAAD,qBAAA,IAAAC,WAAA,GAAML,KAAK,CAACM,IAAI,cAAAD,WAAA,uBAAVA,WAAA,CAAYE,KAAK,CAACC,IAAI,CAAC,CAAC,CAAC,cAAAJ,qBAAA,cAAAA,qBAAA,GAAI,EAAE;EAAA,GACrC,CAACJ,KAAK,CAACM,IAAI,CACf,CAAC;EAED,IAAMG,UAAU,GAAG5B,eAAe,CAAC6B,OAAO,KAAK,KAAK,IAAI7B,eAAe,CAACE,OAAO,KAAK4B,qBAAS;EAE7F,WAAApB,sBAAA,MAAAA,sBAAA,MACOS,KAAK;IACRY,MAAM,EAAE,IAAAC,gCAAe,EAACb,KAAK,CAACY,MAAM,EAAEZ,KAAK,CAACc,WAAW,CAAC;IACxDR,IAAI,EAAEJ,eAAe;IACrBa,cAAc,EAAEf,KAAK,CAACY,MAAM;IAC5BI,YAAY,EAAEhB,KAAK,CAACM,IAAI;IACxBW,OAAO,EAAER,UAAU,GAAGS,wCAAmB,GAAG,IAAAC,wBAAW,EAACnB,KAAK,CAACiB,OAAO;EAAC;AAE9E,CAAC","ignoreList":[]}
|