@gravity-ui/data-source 0.9.0 → 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/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/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/esm/core/types/DataSource.d.ts +8 -8
- package/build/esm/core/types/DataSource.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/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/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.refetch.test.js +0 -230
- package/build/cjs/react-query/hooks/__tests__/useQueryData.refetch.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.refetch.test.js +0 -227
- package/build/esm/react-query/hooks/__tests__/useQueryData.refetch.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":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ErrorBoundary } from 'react-error-boundary';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
export var AsyncBoundary = function AsyncBoundary(_ref) {
|
|
5
|
+
var LoadingView = _ref.LoadingView,
|
|
6
|
+
ErrorView = _ref.ErrorView,
|
|
7
|
+
onReset = _ref.onReset,
|
|
8
|
+
children = _ref.children;
|
|
9
|
+
var fallbackRender = React.useCallback(function (_ref2) {
|
|
10
|
+
var error = _ref2.error,
|
|
11
|
+
resetErrorBoundary = _ref2.resetErrorBoundary;
|
|
12
|
+
return /*#__PURE__*/_jsx(ErrorView, {
|
|
13
|
+
error: error,
|
|
14
|
+
action: {
|
|
15
|
+
handler: resetErrorBoundary
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}, [ErrorView]);
|
|
19
|
+
return /*#__PURE__*/_jsx(ErrorBoundary, {
|
|
20
|
+
fallbackRender: fallbackRender,
|
|
21
|
+
onReset: onReset,
|
|
22
|
+
children: /*#__PURE__*/_jsx(React.Suspense, {
|
|
23
|
+
fallback: /*#__PURE__*/_jsx(LoadingView, {}),
|
|
24
|
+
children: children
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
// #sourceMappingURL=AsyncBoundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","ErrorBoundary","jsx","_jsx","AsyncBoundary","_ref","LoadingView","ErrorView","onReset","children","fallbackRender","useCallback","_ref2","error","resetErrorBoundary","action","handler","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,OAAOA,KAAK,MAAM,OAAO;AAGzB,SAAQC,aAAa,QAAO,sBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAInD,OAAO,IAAMC,aAA2C,GAAG,SAA9CA,aAA2CA,CAAAC,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,GAAGV,KAAK,CAACW,WAAW,CACpC,UAAAC,KAAA;IAAA,IAAEC,KAAK,GAAAD,KAAA,CAALC,KAAK;MAAEC,kBAAkB,GAAAF,KAAA,CAAlBE,kBAAkB;IAAA,oBACvBX,IAAA,CAACI,SAAS;MAACM,KAAK,EAAEA,KAAM;MAACE,MAAM,EAAE;QAACC,OAAO,EAAEF;MAAkB;IAAE,CAAE,CAAC;EAAA,CACrE,EACD,CAACP,SAAS,CACd,CAAC;EAED,oBACIJ,IAAA,CAACF,aAAa;IAACS,cAAc,EAAEA,cAAe;IAACF,OAAO,EAAEA,OAAQ;IAAAC,QAAA,eAC5DN,IAAA,CAACH,KAAK,CAACiB,QAAQ;MAACC,QAAQ,eAAEf,IAAA,CAACG,WAAW,IAAE,CAAE;MAAAG,QAAA,EAAEA;IAAQ,CAAiB;EAAC,CAC3D,CAAC;AAExB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AsyncBoundary","withAsyncBoundary"],"sources":["index.ts"],"sourcesContent":["export type {AsyncBoundaryProps, AsyncBoundaryComponent} from './types';\nexport {AsyncBoundary} from './AsyncBoundary';\nexport {withAsyncBoundary} from './withAsyncBoundary';\n"],"mappings":"AACA,SAAQA,aAAa,QAAO,iBAAiB;AAC7C,SAAQC,iBAAiB,QAAO,qBAAqB","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,19 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AsyncBoundary } from './AsyncBoundary';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
export var withAsyncBoundary = function withAsyncBoundary(Component, LoadingView, ErrorView) {
|
|
6
|
+
var WrappedComponent = function WrappedComponent(props) {
|
|
7
|
+
return /*#__PURE__*/_jsx(AsyncBoundary, {
|
|
8
|
+
LoadingView: LoadingView,
|
|
9
|
+
ErrorView: ErrorView,
|
|
10
|
+
children: /*#__PURE__*/_jsx(Component, _objectSpread({}, props))
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
WrappedComponent.displayName = "WithAsyncBoundary(".concat(Component.displayName || Component.name, ")");
|
|
14
|
+
WrappedComponent.Content = Component;
|
|
15
|
+
WrappedComponent.Loading = LoadingView;
|
|
16
|
+
WrappedComponent.Error = ErrorView;
|
|
17
|
+
return WrappedComponent;
|
|
18
|
+
};
|
|
19
|
+
// #sourceMappingURL=withAsyncBoundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","AsyncBoundary","jsx","_jsx","withAsyncBoundary","Component","LoadingView","ErrorView","WrappedComponent","props","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,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAAQC,aAAa,QAAO,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAG9C,OAAO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiBA,CAC1BC,SAAsC,EACtCC,WAA8C,EAC9CC,SAA0C,EACzC;EACD,IAAMC,gBAAgB,GAAI,SAApBA,gBAAgBA,CAAKC,KAAa;IAAA,oBACpCN,IAAA,CAACF,aAAa;MAACK,WAAW,EAAEA,WAAY;MAACC,SAAS,EAAEA,SAAU;MAAAG,QAAA,eAC1DP,IAAA,CAACE,SAAS,EAAAM,aAAA,KAAKF,KAAK,CAAG;IAAC,CACb,CAAC;EAAA,CACgB;EAEpCD,gBAAgB,CAACI,WAAW,wBAAAC,MAAA,CAAwBR,SAAS,CAACO,WAAW,IAAIP,SAAS,CAACS,IAAI,MAAG;EAE9FN,gBAAgB,CAACO,OAAO,GAAGV,SAAS;EACpCG,gBAAgB,CAACQ,OAAO,GAAGV,WAAW;EACtCE,gBAAgB,CAACS,KAAK,GAAGV,SAAS;EAElC,OAAOC,gBAAgB;AAC3B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["EmptyView"],"sources":["EmptyView.tsx"],"sourcesContent":["import type React from 'react';\n\nexport const EmptyView: React.FC = () => {\n return null;\n};\n"],"mappings":"AAEA,OAAO,IAAMA,SAAmB,GAAG,SAAtBA,SAAmBA,CAAA,EAAS;EACrC,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EmptyView } from './EmptyView';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["EmptyView"],"sources":["index.ts"],"sourcesContent":["export {EmptyView} from './EmptyView';\n"],"mappings":"AAAA,SAAQA,SAAS,QAAO,aAAa","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/esm/react/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
export * from './components/AsyncBoundary';
|
|
2
|
+
export * from './components/DataLoader';
|
|
3
|
+
export * from './components/DataInfiniteLoader';
|
|
4
|
+
export * from './components/EmptyView';
|
|
1
5
|
export { DataManagerContext, useDataManager } from './DataManagerContext';
|
|
2
6
|
export { DataManagerProvider } from './DataManagerProvider';
|
|
3
7
|
export { withDataManager } from './withDataManager';
|
|
4
|
-
export * from './components/DataLoader';
|
|
5
|
-
export * from './components/DataInfiniteLoader';
|
|
6
8
|
// #sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DataManagerContext","useDataManager","DataManagerProvider","withDataManager"],"sources":["index.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"names":["DataManagerContext","useDataManager","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,cAAc,4BAA4B;AAC1C,cAAc,yBAAyB;AACvC,cAAc,iCAAiC;AAC/C,cAAc,wBAAwB;AAGtC,SAAQA,kBAAkB,EAAEC,cAAc,QAAO,sBAAsB;AACvE,SAAQC,mBAAmB,QAAO,uBAAuB;AAGzD,SAAQC,eAAe,QAAO,mBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { QueryErrorResetBoundary } from '@tanstack/react-query';
|
|
4
|
+
import { AsyncBoundary } from '../../../react';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
export var QueryAsyncBoundary = function QueryAsyncBoundary(props) {
|
|
7
|
+
return /*#__PURE__*/_jsx(QueryErrorResetBoundary, {
|
|
8
|
+
children: function children(_ref) {
|
|
9
|
+
var reset = _ref.reset;
|
|
10
|
+
return /*#__PURE__*/_jsx(AsyncBoundary, _objectSpread({
|
|
11
|
+
onReset: reset
|
|
12
|
+
}, props));
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
// #sourceMappingURL=QueryAsyncBoundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","QueryErrorResetBoundary","AsyncBoundary","jsx","_jsx","QueryAsyncBoundary","props","children","_ref","reset","_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,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAAQC,uBAAuB,QAAO,uBAAuB;AAE7D,SAAQC,aAAa,QAAO,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAI7C,OAAO,IAAMC,kBAAqD,GAAG,SAAxDA,kBAAqDA,CAAIC,KAAK;EAAA,oBACvEF,IAAA,CAACH,uBAAuB;IAAAM,QAAA,EACnB,SAAAA,SAAAC,IAAA;MAAA,IAAEC,KAAK,GAAAD,IAAA,CAALC,KAAK;MAAA,oBAAML,IAAA,CAACF,aAAa,EAAAQ,aAAA;QAACC,OAAO,EAAEF;MAAM,GAAKH,KAAK,CAAG,CAAC;IAAA;EAAA,CACrC,CAAC;AAAA,CAC7B","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["QueryAsyncBoundary","withQueryAsyncBoundary"],"sources":["index.ts"],"sourcesContent":["export {QueryAsyncBoundary} from './QueryAsyncBoundary';\nexport type {QueryAsyncBoundaryProps, QueryAsyncBoundaryComponent} from './types';\nexport {withQueryAsyncBoundary} from './withQueryAsyncBoundary';\n"],"mappings":"AAAA,SAAQA,kBAAkB,QAAO,sBAAsB;AAEvD,SAAQC,sBAAsB,QAAO,0BAA0B","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,19 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { QueryAsyncBoundary } from './QueryAsyncBoundary';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
export var withQueryAsyncBoundary = function withQueryAsyncBoundary(Component, LoadingView, ErrorView) {
|
|
6
|
+
var WrappedComponent = function WrappedComponent(props) {
|
|
7
|
+
return /*#__PURE__*/_jsx(QueryAsyncBoundary, {
|
|
8
|
+
LoadingView: LoadingView,
|
|
9
|
+
ErrorView: ErrorView,
|
|
10
|
+
children: /*#__PURE__*/_jsx(Component, _objectSpread({}, props))
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
WrappedComponent.displayName = "WithQueryAsyncBoundary(".concat(Component.displayName || Component.name, ")");
|
|
14
|
+
WrappedComponent.Content = Component;
|
|
15
|
+
WrappedComponent.Loading = LoadingView;
|
|
16
|
+
WrappedComponent.Error = ErrorView;
|
|
17
|
+
return WrappedComponent;
|
|
18
|
+
};
|
|
19
|
+
// #sourceMappingURL=withQueryAsyncBoundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","QueryAsyncBoundary","jsx","_jsx","withQueryAsyncBoundary","Component","LoadingView","ErrorView","WrappedComponent","props","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,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAAQC,kBAAkB,QAAO,sBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGxD,OAAO,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAC/BC,SAAsC,EACtCC,WAAmD,EACnDC,SAA+C,EAC9C;EACD,IAAMC,gBAAgB,GAAI,SAApBA,gBAAgBA,CAAKC,KAAa;IAAA,oBACpCN,IAAA,CAACF,kBAAkB;MAACK,WAAW,EAAEA,WAAY;MAACC,SAAS,EAAEA,SAAU;MAAAG,QAAA,eAC/DP,IAAA,CAACE,SAAS,EAAAM,aAAA,KAAKF,KAAK,CAAG;IAAC,CACR,CAAC;EAAA,CACgB;EAEzCD,gBAAgB,CAACI,WAAW,6BAAAC,MAAA,CACxBR,SAAS,CAACO,WAAW,IAAIP,SAAS,CAACS,IAAI,MACxC;EAEHN,gBAAgB,CAACO,OAAO,GAAGV,SAAS;EACpCG,gBAAgB,CAACQ,OAAO,GAAGV,WAAW;EACtCE,gBAAgB,CAACS,KAAK,GAAGV,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,15 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import { useQueryData } from './useQueryData';
|
|
3
|
+
var defaultThrowOnError = function defaultThrowOnError(_error, query) {
|
|
4
|
+
return query.state.data === undefined;
|
|
5
|
+
};
|
|
6
|
+
export var useSuspenseQueryData = function useSuspenseQueryData(dataSource, params, options) {
|
|
7
|
+
return useQueryData(dataSource, params, _objectSpread(_objectSpread({}, options), {}, {
|
|
8
|
+
suspense: true,
|
|
9
|
+
enabled: true,
|
|
10
|
+
throwOnError: defaultThrowOnError,
|
|
11
|
+
retryOnMount: true,
|
|
12
|
+
placeholderData: undefined
|
|
13
|
+
}));
|
|
14
|
+
};
|
|
15
|
+
// #sourceMappingURL=useSuspenseQueryData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useQueryData","defaultThrowOnError","_error","query","state","data","undefined","useSuspenseQueryData","dataSource","params","options","_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,SAAQA,YAAY,QAAO,gBAAgB;AAY3C,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,MAAe,EAAEC,KAAY;EAAA,OAAKA,KAAK,CAACC,KAAK,CAACC,IAAI,KAAKC,SAAS;AAAA;AAE7F,OAAO,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAC7BC,UAAuB,EACvBC,MAA2D,EAC3DC,OAA2C,EACR;EACnC,OAAOV,YAAY,CAACQ,UAAU,EAAEC,MAAM,EAAAE,aAAA,CAAAA,aAAA,KAC/BD,OAAO;IACVE,QAAQ,EAAE,IAAI;IACdC,OAAO,EAAE,IAAI;IACbC,YAAY,EAAEb,mBAAmB;IACjCc,YAAY,EAAE,IAAI;IAClBC,eAAe,EAAEV;EAAS,EACc,CAAC;AACjD,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './components/QueryAsyncBoundary';
|
|
1
2
|
export type { QueryDataSourceContext, AnyQueryDataSource } from './types/base';
|
|
2
3
|
export type { RefetchIntervalFunction, RefetchInterval } from './types/refetch-interval';
|
|
3
4
|
export { useQueryContext } from './hooks/useQueryContext';
|
|
@@ -5,6 +6,7 @@ export { useQueryData } from './hooks/useQueryData';
|
|
|
5
6
|
export { useQueryResponses } from './hooks/useQueryResponses';
|
|
6
7
|
export { useRefetchAll } from './hooks/useRefetchAll';
|
|
7
8
|
export { useRefetchErrored } from './hooks/useRefetchErrored';
|
|
9
|
+
export { useSuspenseQueryData } from './hooks/useSuspenseQueryData';
|
|
8
10
|
export type { InfiniteQueryDataSource, AnyInfiniteQueryDataSource } from './impl/infinite/types';
|
|
9
11
|
export { makeInfiniteQueryDataSource } from './impl/infinite/factory';
|
|
10
12
|
export { composeOptions as composeInfiniteQueryOptions } from './impl/infinite/utils';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
export * from './components/QueryAsyncBoundary';
|
|
1
2
|
export { useQueryContext } from './hooks/useQueryContext';
|
|
2
3
|
export { useQueryData } from './hooks/useQueryData';
|
|
3
4
|
export { useQueryResponses } from './hooks/useQueryResponses';
|
|
4
5
|
export { useRefetchAll } from './hooks/useRefetchAll';
|
|
5
6
|
export { useRefetchErrored } from './hooks/useRefetchErrored';
|
|
7
|
+
export { useSuspenseQueryData } from './hooks/useSuspenseQueryData';
|
|
6
8
|
export { makeInfiniteQueryDataSource } from './impl/infinite/factory';
|
|
7
9
|
export { composeOptions as composeInfiniteQueryOptions } from './impl/infinite/utils';
|
|
8
10
|
export { makePlainQueryDataSource } from './impl/plain/factory';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useQueryContext","useQueryData","useQueryResponses","useRefetchAll","useRefetchErrored","makeInfiniteQueryDataSource","composeOptions","composeInfiniteQueryOptions","makePlainQueryDataSource","composePlainQueryOptions","normalizeStatus","getProgressiveRefetch","ClientDataManager","DataSourceProvider"],"sources":["index.ts"],"sourcesContent":["export type {QueryDataSourceContext, AnyQueryDataSource} from './types/base';\nexport type {RefetchIntervalFunction, RefetchInterval} from './types/refetch-interval';\n\nexport {useQueryContext} from './hooks/useQueryContext';\nexport {useQueryData} from './hooks/useQueryData';\nexport {useQueryResponses} from './hooks/useQueryResponses';\nexport {useRefetchAll} from './hooks/useRefetchAll';\nexport {useRefetchErrored} from './hooks/useRefetchErrored';\n\nexport type {InfiniteQueryDataSource, AnyInfiniteQueryDataSource} from './impl/infinite/types';\nexport {makeInfiniteQueryDataSource} from './impl/infinite/factory';\nexport {composeOptions as composeInfiniteQueryOptions} from './impl/infinite/utils';\n\nexport type {PlainQueryDataSource, AnyPlainQueryDataSource} from './impl/plain/types';\nexport {makePlainQueryDataSource} from './impl/plain/factory';\nexport {composeOptions as composePlainQueryOptions} from './impl/plain/utils';\n\nexport {normalizeStatus} from './utils/normalizeStatus';\nexport type {ProgressiveRefetchOptions} from './utils/getProgressiveRefetch';\nexport {getProgressiveRefetch} from './utils/getProgressiveRefetch';\n\nexport type {ClientDataManagerConfig} from './ClientDataManager';\nexport {ClientDataManager} from './ClientDataManager';\n\nexport {DataSourceProvider} from './DataSourceProvider';\n\nexport type {QueryNormalizer} from './types/normalizer';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["useQueryContext","useQueryData","useQueryResponses","useRefetchAll","useRefetchErrored","useSuspenseQueryData","makeInfiniteQueryDataSource","composeOptions","composeInfiniteQueryOptions","makePlainQueryDataSource","composePlainQueryOptions","normalizeStatus","getProgressiveRefetch","ClientDataManager","DataSourceProvider"],"sources":["index.ts"],"sourcesContent":["export * from './components/QueryAsyncBoundary';\n\nexport type {QueryDataSourceContext, AnyQueryDataSource} from './types/base';\nexport type {RefetchIntervalFunction, RefetchInterval} from './types/refetch-interval';\n\nexport {useQueryContext} from './hooks/useQueryContext';\nexport {useQueryData} from './hooks/useQueryData';\nexport {useQueryResponses} from './hooks/useQueryResponses';\nexport {useRefetchAll} from './hooks/useRefetchAll';\nexport {useRefetchErrored} from './hooks/useRefetchErrored';\nexport {useSuspenseQueryData} from './hooks/useSuspenseQueryData';\n\nexport type {InfiniteQueryDataSource, AnyInfiniteQueryDataSource} from './impl/infinite/types';\nexport {makeInfiniteQueryDataSource} from './impl/infinite/factory';\nexport {composeOptions as composeInfiniteQueryOptions} from './impl/infinite/utils';\n\nexport type {PlainQueryDataSource, AnyPlainQueryDataSource} from './impl/plain/types';\nexport {makePlainQueryDataSource} from './impl/plain/factory';\nexport {composeOptions as composePlainQueryOptions} from './impl/plain/utils';\n\nexport {normalizeStatus} from './utils/normalizeStatus';\nexport type {ProgressiveRefetchOptions} from './utils/getProgressiveRefetch';\nexport {getProgressiveRefetch} from './utils/getProgressiveRefetch';\n\nexport type {ClientDataManagerConfig} from './ClientDataManager';\nexport {ClientDataManager} from './ClientDataManager';\n\nexport {DataSourceProvider} from './DataSourceProvider';\n\nexport type {QueryNormalizer} from './types/normalizer';\n"],"mappings":"AAAA,cAAc,iCAAiC;AAK/C,SAAQA,eAAe,QAAO,yBAAyB;AACvD,SAAQC,YAAY,QAAO,sBAAsB;AACjD,SAAQC,iBAAiB,QAAO,2BAA2B;AAC3D,SAAQC,aAAa,QAAO,uBAAuB;AACnD,SAAQC,iBAAiB,QAAO,2BAA2B;AAC3D,SAAQC,oBAAoB,QAAO,8BAA8B;AAGjE,SAAQC,2BAA2B,QAAO,yBAAyB;AACnE,SAAQC,cAAc,IAAIC,2BAA2B,QAAO,uBAAuB;AAGnF,SAAQC,wBAAwB,QAAO,sBAAsB;AAC7D,SAAQF,cAAc,IAAIG,wBAAwB,QAAO,oBAAoB;AAE7E,SAAQC,eAAe,QAAO,yBAAyB;AAEvD,SAAQC,qBAAqB,QAAO,+BAA+B;AAGnE,SAAQC,iBAAiB,QAAO,qBAAqB;AAErD,SAAQC,kBAAkB,QAAO,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { r as DataSourceLazyPluginOptions } from "./index-mY40Sgl5.mjs";
|
|
2
|
+
import * as _$esbuild from "esbuild";
|
|
3
|
+
|
|
4
|
+
//#region src/plugin/esbuild.d.ts
|
|
5
|
+
declare const _default: (options?: DataSourceLazyPluginOptions | undefined) => _$esbuild.Plugin;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { _default as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { n as dataSourceLazyUnpluginFactory } from "./factory-2tSt4Rte.mjs";
|
|
2
|
+
import { createEsbuildPlugin } from "unplugin";
|
|
3
|
+
//#region src/plugin/esbuild.ts
|
|
4
|
+
var esbuild_default = createEsbuildPlugin(dataSourceLazyUnpluginFactory);
|
|
5
|
+
//#endregion
|
|
6
|
+
export { esbuild_default as default };
|