@gravity-ui/data-source 0.3.0-alpha.0 → 0.3.0-alpha.2
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 +1 -1
- package/build/cjs/core/types/DataSource.js.map +1 -1
- package/build/cjs/react-query/impl/infinite/factory.d.ts +1 -1
- package/build/cjs/react-query/impl/infinite/factory.js.map +1 -1
- package/build/cjs/react-query/impl/infinite/types.d.ts +1 -1
- package/build/cjs/react-query/impl/infinite/types.js.map +1 -1
- package/build/cjs/react-query/impl/plain/factory.d.ts +1 -1
- package/build/cjs/react-query/impl/plain/factory.js.map +1 -1
- package/build/cjs/react-query/impl/plain/types.d.ts +2 -2
- package/build/cjs/react-query/impl/plain/types.js.map +1 -1
- package/build/esm/core/types/DataSource.d.ts +1 -1
- package/build/esm/core/types/DataSource.js.map +1 -1
- package/build/esm/react-query/impl/infinite/factory.d.ts +1 -1
- package/build/esm/react-query/impl/infinite/factory.js.map +1 -1
- package/build/esm/react-query/impl/infinite/types.d.ts +1 -1
- package/build/esm/react-query/impl/infinite/types.js.map +1 -1
- package/build/esm/react-query/impl/plain/factory.d.ts +1 -1
- package/build/esm/react-query/impl/plain/factory.js.map +1 -1
- package/build/esm/react-query/impl/plain/types.d.ts +2 -2
- package/build/esm/react-query/impl/plain/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ export type DataSourceKey = ReadonlyArray<unknown>;
|
|
|
3
3
|
export type DataSourceTag = string;
|
|
4
4
|
declare const errorHintSymbol: unique symbol;
|
|
5
5
|
declare const stateHintSymbol: unique symbol;
|
|
6
|
-
export interface DataSource<TContext, TParams, TRequest
|
|
6
|
+
export interface DataSource<TContext, TParams, TRequest, TResponse, TData, TError, TOptions, TState, TFetchContext> {
|
|
7
7
|
readonly name: string;
|
|
8
8
|
fetch: (context: TContext, fetchContext: TFetchContext, request: TRequest) => Promise<TResponse> | TResponse;
|
|
9
9
|
tags?: (params: ActualParams<TParams, TRequest>) => DataSourceTag[];
|
|
@@ -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
|
|
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<TParams, TRequest>) => DataSourceTag[];\n\n transformParams?: (params: TParams) => TRequest;\n transformResponse?: (response: TResponse) => TData;\n\n [errorHintSymbol]?: TError;\n\n options?: Partial<TOptions>;\n [stateHintSymbol]?: TState;\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 _TContenxt,\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 _TContenxt,\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 _TContenxt,\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 _TContenxt,\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 _TContenxt,\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 _TContenxt,\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 _TContenxt,\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 _TContenxt,\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":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { InfiniteQueryDataSource } from './types';
|
|
2
|
-
export declare const makeInfiniteQueryDataSource: <TParams, TRequest
|
|
2
|
+
export declare const makeInfiniteQueryDataSource: <TParams, TRequest, TResponse, TData, TError>(config: Omit<InfiniteQueryDataSource<TParams, TRequest, TResponse, TData, TError>, "type">) => InfiniteQueryDataSource<TParams, TRequest, TResponse, TData, TError>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["makeInfiniteQueryDataSource","exports","config","_objectSpread","type"],"sources":["factory.ts"],"sourcesContent":["import type {InfiniteQueryDataSource} from './types';\n\nexport const makeInfiniteQueryDataSource =
|
|
1
|
+
{"version":3,"names":["makeInfiniteQueryDataSource","exports","config","_objectSpread","type"],"sources":["factory.ts"],"sourcesContent":["import type {InfiniteQueryDataSource} from './types';\n\nexport const makeInfiniteQueryDataSource = <TParams, TRequest, TResponse, TData, TError>(\n config: Omit<InfiniteQueryDataSource<TParams, TRequest, TResponse, TData, TError>, 'type'>,\n): InfiniteQueryDataSource<TParams, TRequest, TResponse, TData, TError> => ({\n ...config,\n type: 'infinite',\n});\n"],"mappings":";;;;;;;;AAEO,IAAMA,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,GAAG,SAA9BA,2BAA2BA,CACpCE,MAA0F;EAAA,WAAAC,sBAAA,MAAAA,sBAAA,MAEvFD,MAAM;IACTE,IAAI,EAAE;EAAU;AAAA,CAClB","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ import type { InfiniteData, InfiniteQueryObserverOptions, InfiniteQueryObserverR
|
|
|
2
2
|
import type { Overwrite } from 'utility-types';
|
|
3
3
|
import type { ActualData, DataLoaderStatus, DataSource, DataSourceKey } from '../../../core';
|
|
4
4
|
import type { QueryDataSourceContext } from '../../types';
|
|
5
|
-
export type InfiniteQueryDataSource<TParams, TRequest
|
|
5
|
+
export type InfiniteQueryDataSource<TParams, TRequest, TResponse, TData, TError> = DataSource<QueryDataSourceContext, TParams, TRequest, TResponse, TData, TError, InfiniteQueryObserverOptions<TResponse, TError, InfiniteData<ActualData<TData, TResponse>, Partial<TRequest>>, TResponse, DataSourceKey, Partial<TRequest>>, ResultWrapper<InfiniteQueryObserverResult<InfiniteData<ActualData<TData, TResponse>, Partial<TRequest>>, TError>, TRequest, TResponse, TData, TError>, QueryFunctionContext<DataSourceKey, Partial<TRequest>>> & {
|
|
6
6
|
type: 'infinite';
|
|
7
7
|
next: (lastPage: TResponse, allPages: TResponse[]) => Partial<TRequest> | null | undefined;
|
|
8
8
|
prev?: (firstPage: TResponse, allPages: TResponse[]) => Partial<TRequest> | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n InfiniteData,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n QueryFunctionContext,\n} from '@tanstack/react-query';\nimport type {Overwrite} from 'utility-types';\n\nimport type {ActualData, DataLoaderStatus, DataSource, DataSourceKey} from '../../../core';\nimport type {QueryDataSourceContext} from '../../types';\n\nexport type InfiniteQueryDataSource
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n InfiniteData,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n QueryFunctionContext,\n} from '@tanstack/react-query';\nimport type {Overwrite} from 'utility-types';\n\nimport type {ActualData, DataLoaderStatus, DataSource, DataSourceKey} from '../../../core';\nimport type {QueryDataSourceContext} from '../../types';\n\nexport type InfiniteQueryDataSource<TParams, TRequest, TResponse, TData, TError> = DataSource<\n QueryDataSourceContext,\n TParams,\n TRequest,\n TResponse,\n TData,\n TError,\n InfiniteQueryObserverOptions<\n TResponse,\n TError,\n InfiniteData<ActualData<TData, TResponse>, Partial<TRequest>>,\n TResponse,\n DataSourceKey,\n Partial<TRequest>\n >,\n ResultWrapper<\n InfiniteQueryObserverResult<\n InfiniteData<ActualData<TData, TResponse>, Partial<TRequest>>,\n TError\n >,\n TRequest,\n TResponse,\n TData,\n TError\n >,\n QueryFunctionContext<DataSourceKey, Partial<TRequest>>\n> & {\n type: 'infinite';\n next: (lastPage: TResponse, allPages: TResponse[]) => Partial<TRequest> | null | undefined;\n prev?: (firstPage: TResponse, allPages: TResponse[]) => Partial<TRequest> | null | undefined;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyInfiniteQueryDataSource = InfiniteQueryDataSource<any, any, any, any, any>;\n\n// It is used instead of `Partial<DataSourceRequest<TDataSource>>` because TS can't calculate type\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyPageParam = Partial<any>;\n\ntype ResultWrapper<TResult, TRequest, TResponse, TData, TError> =\n TResult extends InfiniteQueryObserverResult<\n InfiniteData<ActualData<TData, TResponse>, Partial<TRequest>>,\n TError\n >\n ? Overwrite<\n TResult,\n {status: DataLoaderStatus; data: DataWrapper<ActualData<TData, TResponse>>}\n > & {\n originalStatus: TResult['status'];\n originalData: TResult['data'];\n }\n : never;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype DataWrapper<TActualData> = TActualData extends any[] ? TActualData : TActualData[];\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { PlainQueryDataSource } from './types';
|
|
2
|
-
export declare const makePlainQueryDataSource: <TParams, TRequest
|
|
2
|
+
export declare const makePlainQueryDataSource: <TParams, TRequest, TResponse, TData, TError>(config: Omit<PlainQueryDataSource<TParams, TRequest, TResponse, TData, TError>, "type">) => PlainQueryDataSource<TParams, TRequest, TResponse, TData, TError>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["makePlainQueryDataSource","exports","config","_objectSpread","type"],"sources":["factory.ts"],"sourcesContent":["import type {PlainQueryDataSource} from './types';\n\nexport const makePlainQueryDataSource =
|
|
1
|
+
{"version":3,"names":["makePlainQueryDataSource","exports","config","_objectSpread","type"],"sources":["factory.ts"],"sourcesContent":["import type {PlainQueryDataSource} from './types';\n\nexport const makePlainQueryDataSource = <TParams, TRequest, TResponse, TData, TError>(\n config: Omit<PlainQueryDataSource<TParams, TRequest, TResponse, TData, TError>, 'type'>,\n): PlainQueryDataSource<TParams, TRequest, TResponse, TData, TError> => ({\n ...config,\n type: 'plain',\n});\n"],"mappings":";;;;;;;;AAEO,IAAMA,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GAAG,SAA3BA,wBAAwBA,CACjCE,MAAuF;EAAA,WAAAC,sBAAA,MAAAA,sBAAA,MAEpFD,MAAM;IACTE,IAAI,EAAE;EAAO;AAAA,CACf","ignoreList":[]}
|
|
@@ -2,11 +2,11 @@ import type { QueryFunctionContext, QueryObserverOptions, QueryObserverResult }
|
|
|
2
2
|
import type { Overwrite } from 'utility-types';
|
|
3
3
|
import type { ActualData, DataLoaderStatus, DataSource, DataSourceKey } from '../../../core';
|
|
4
4
|
import type { QueryDataSourceContext } from '../../types';
|
|
5
|
-
export type PlainQueryDataSource<TParams, TRequest
|
|
5
|
+
export type PlainQueryDataSource<TParams, TRequest, TResponse, TData, TError> = DataSource<QueryDataSourceContext, TParams, TRequest, TResponse, TData, TError, QueryObserverOptions<TResponse, TError, ActualData<TData, TResponse>, TResponse, DataSourceKey>, ResultWrapper<QueryObserverResult<ActualData<TData, TResponse>, TError>, TResponse, TData, TError>, QueryFunctionContext<DataSourceKey>> & {
|
|
6
6
|
type: 'plain';
|
|
7
7
|
};
|
|
8
8
|
export type AnyPlainQueryDataSource = PlainQueryDataSource<any, any, any, any, any>;
|
|
9
|
-
type ResultWrapper<TResult> = TResult extends QueryObserverResult ? Overwrite<TResult, {
|
|
9
|
+
type ResultWrapper<TResult, TResponse, TData, TError> = TResult extends QueryObserverResult<ActualData<TData, TResponse>, TError> ? Overwrite<TResult, {
|
|
10
10
|
status: DataLoaderStatus;
|
|
11
11
|
}> & {
|
|
12
12
|
originalStatus: TResult['status'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n QueryFunctionContext,\n QueryObserverOptions,\n QueryObserverResult,\n} from '@tanstack/react-query';\nimport type {Overwrite} from 'utility-types';\n\nimport type {ActualData, DataLoaderStatus, DataSource, DataSourceKey} from '../../../core';\nimport type {QueryDataSourceContext} from '../../types';\n\nexport type PlainQueryDataSource
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n QueryFunctionContext,\n QueryObserverOptions,\n QueryObserverResult,\n} from '@tanstack/react-query';\nimport type {Overwrite} from 'utility-types';\n\nimport type {ActualData, DataLoaderStatus, DataSource, DataSourceKey} from '../../../core';\nimport type {QueryDataSourceContext} from '../../types';\n\nexport type PlainQueryDataSource<TParams, TRequest, TResponse, TData, TError> = DataSource<\n QueryDataSourceContext,\n TParams,\n TRequest,\n TResponse,\n TData,\n TError,\n QueryObserverOptions<TResponse, TError, ActualData<TData, TResponse>, TResponse, DataSourceKey>,\n ResultWrapper<\n QueryObserverResult<ActualData<TData, TResponse>, TError>,\n TResponse,\n TData,\n TError\n >,\n QueryFunctionContext<DataSourceKey>\n> & {\n type: 'plain';\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyPlainQueryDataSource = PlainQueryDataSource<any, any, any, any, any>;\n\ntype ResultWrapper<TResult, TResponse, TData, TError> =\n TResult extends QueryObserverResult<ActualData<TData, TResponse>, TError>\n ? Overwrite<TResult, {status: DataLoaderStatus}> & {originalStatus: TResult['status']}\n : never;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@ export type DataSourceKey = ReadonlyArray<unknown>;
|
|
|
3
3
|
export type DataSourceTag = string;
|
|
4
4
|
declare const errorHintSymbol: unique symbol;
|
|
5
5
|
declare const stateHintSymbol: unique symbol;
|
|
6
|
-
export interface DataSource<TContext, TParams, TRequest
|
|
6
|
+
export interface DataSource<TContext, TParams, TRequest, TResponse, TData, TError, TOptions, TState, TFetchContext> {
|
|
7
7
|
readonly name: string;
|
|
8
8
|
fetch: (context: TContext, fetchContext: TFetchContext, request: TRequest) => Promise<TResponse> | TResponse;
|
|
9
9
|
tags?: (params: ActualParams<TParams, TRequest>) => DataSourceTag[];
|
|
@@ -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
|
|
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<TParams, TRequest>) => DataSourceTag[];\n\n transformParams?: (params: TParams) => TRequest;\n transformResponse?: (response: TResponse) => TData;\n\n [errorHintSymbol]?: TError;\n\n options?: Partial<TOptions>;\n [stateHintSymbol]?: TState;\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 _TContenxt,\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 _TContenxt,\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 _TContenxt,\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 _TContenxt,\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 _TContenxt,\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 _TContenxt,\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 _TContenxt,\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 _TContenxt,\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":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { InfiniteQueryDataSource } from './types';
|
|
2
|
-
export declare const makeInfiniteQueryDataSource: <TParams, TRequest
|
|
2
|
+
export declare const makeInfiniteQueryDataSource: <TParams, TRequest, TResponse, TData, TError>(config: Omit<InfiniteQueryDataSource<TParams, TRequest, TResponse, TData, TError>, "type">) => InfiniteQueryDataSource<TParams, TRequest, TResponse, TData, TError>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["makeInfiniteQueryDataSource","config","_objectSpread","type"],"sources":["factory.ts"],"sourcesContent":["import type {InfiniteQueryDataSource} from './types';\n\nexport const makeInfiniteQueryDataSource =
|
|
1
|
+
{"version":3,"names":["makeInfiniteQueryDataSource","config","_objectSpread","type"],"sources":["factory.ts"],"sourcesContent":["import type {InfiniteQueryDataSource} from './types';\n\nexport const makeInfiniteQueryDataSource = <TParams, TRequest, TResponse, TData, TError>(\n config: Omit<InfiniteQueryDataSource<TParams, TRequest, TResponse, TData, TError>, 'type'>,\n): InfiniteQueryDataSource<TParams, TRequest, TResponse, TData, TError> => ({\n ...config,\n type: 'infinite',\n});\n"],"mappings":";AAEA,OAAO,IAAMA,2BAA2B,GAAG,SAA9BA,2BAA2BA,CACpCC,MAA0F;EAAA,OAAAC,aAAA,CAAAA,aAAA,KAEvFD,MAAM;IACTE,IAAI,EAAE;EAAU;AAAA,CAClB","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ import type { InfiniteData, InfiniteQueryObserverOptions, InfiniteQueryObserverR
|
|
|
2
2
|
import type { Overwrite } from 'utility-types';
|
|
3
3
|
import type { ActualData, DataLoaderStatus, DataSource, DataSourceKey } from '../../../core';
|
|
4
4
|
import type { QueryDataSourceContext } from '../../types';
|
|
5
|
-
export type InfiniteQueryDataSource<TParams, TRequest
|
|
5
|
+
export type InfiniteQueryDataSource<TParams, TRequest, TResponse, TData, TError> = DataSource<QueryDataSourceContext, TParams, TRequest, TResponse, TData, TError, InfiniteQueryObserverOptions<TResponse, TError, InfiniteData<ActualData<TData, TResponse>, Partial<TRequest>>, TResponse, DataSourceKey, Partial<TRequest>>, ResultWrapper<InfiniteQueryObserverResult<InfiniteData<ActualData<TData, TResponse>, Partial<TRequest>>, TError>, TRequest, TResponse, TData, TError>, QueryFunctionContext<DataSourceKey, Partial<TRequest>>> & {
|
|
6
6
|
type: 'infinite';
|
|
7
7
|
next: (lastPage: TResponse, allPages: TResponse[]) => Partial<TRequest> | null | undefined;
|
|
8
8
|
prev?: (firstPage: TResponse, allPages: TResponse[]) => Partial<TRequest> | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n InfiniteData,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n QueryFunctionContext,\n} from '@tanstack/react-query';\nimport type {Overwrite} from 'utility-types';\n\nimport type {ActualData, DataLoaderStatus, DataSource, DataSourceKey} from '../../../core';\nimport type {QueryDataSourceContext} from '../../types';\n\nexport type InfiniteQueryDataSource
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n InfiniteData,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n QueryFunctionContext,\n} from '@tanstack/react-query';\nimport type {Overwrite} from 'utility-types';\n\nimport type {ActualData, DataLoaderStatus, DataSource, DataSourceKey} from '../../../core';\nimport type {QueryDataSourceContext} from '../../types';\n\nexport type InfiniteQueryDataSource<TParams, TRequest, TResponse, TData, TError> = DataSource<\n QueryDataSourceContext,\n TParams,\n TRequest,\n TResponse,\n TData,\n TError,\n InfiniteQueryObserverOptions<\n TResponse,\n TError,\n InfiniteData<ActualData<TData, TResponse>, Partial<TRequest>>,\n TResponse,\n DataSourceKey,\n Partial<TRequest>\n >,\n ResultWrapper<\n InfiniteQueryObserverResult<\n InfiniteData<ActualData<TData, TResponse>, Partial<TRequest>>,\n TError\n >,\n TRequest,\n TResponse,\n TData,\n TError\n >,\n QueryFunctionContext<DataSourceKey, Partial<TRequest>>\n> & {\n type: 'infinite';\n next: (lastPage: TResponse, allPages: TResponse[]) => Partial<TRequest> | null | undefined;\n prev?: (firstPage: TResponse, allPages: TResponse[]) => Partial<TRequest> | null | undefined;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyInfiniteQueryDataSource = InfiniteQueryDataSource<any, any, any, any, any>;\n\n// It is used instead of `Partial<DataSourceRequest<TDataSource>>` because TS can't calculate type\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyPageParam = Partial<any>;\n\ntype ResultWrapper<TResult, TRequest, TResponse, TData, TError> =\n TResult extends InfiniteQueryObserverResult<\n InfiniteData<ActualData<TData, TResponse>, Partial<TRequest>>,\n TError\n >\n ? Overwrite<\n TResult,\n {status: DataLoaderStatus; data: DataWrapper<ActualData<TData, TResponse>>}\n > & {\n originalStatus: TResult['status'];\n originalData: TResult['data'];\n }\n : never;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype DataWrapper<TActualData> = TActualData extends any[] ? TActualData : TActualData[];\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { PlainQueryDataSource } from './types';
|
|
2
|
-
export declare const makePlainQueryDataSource: <TParams, TRequest
|
|
2
|
+
export declare const makePlainQueryDataSource: <TParams, TRequest, TResponse, TData, TError>(config: Omit<PlainQueryDataSource<TParams, TRequest, TResponse, TData, TError>, "type">) => PlainQueryDataSource<TParams, TRequest, TResponse, TData, TError>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["makePlainQueryDataSource","config","_objectSpread","type"],"sources":["factory.ts"],"sourcesContent":["import type {PlainQueryDataSource} from './types';\n\nexport const makePlainQueryDataSource =
|
|
1
|
+
{"version":3,"names":["makePlainQueryDataSource","config","_objectSpread","type"],"sources":["factory.ts"],"sourcesContent":["import type {PlainQueryDataSource} from './types';\n\nexport const makePlainQueryDataSource = <TParams, TRequest, TResponse, TData, TError>(\n config: Omit<PlainQueryDataSource<TParams, TRequest, TResponse, TData, TError>, 'type'>,\n): PlainQueryDataSource<TParams, TRequest, TResponse, TData, TError> => ({\n ...config,\n type: 'plain',\n});\n"],"mappings":";AAEA,OAAO,IAAMA,wBAAwB,GAAG,SAA3BA,wBAAwBA,CACjCC,MAAuF;EAAA,OAAAC,aAAA,CAAAA,aAAA,KAEpFD,MAAM;IACTE,IAAI,EAAE;EAAO;AAAA,CACf","ignoreList":[]}
|
|
@@ -2,11 +2,11 @@ import type { QueryFunctionContext, QueryObserverOptions, QueryObserverResult }
|
|
|
2
2
|
import type { Overwrite } from 'utility-types';
|
|
3
3
|
import type { ActualData, DataLoaderStatus, DataSource, DataSourceKey } from '../../../core';
|
|
4
4
|
import type { QueryDataSourceContext } from '../../types';
|
|
5
|
-
export type PlainQueryDataSource<TParams, TRequest
|
|
5
|
+
export type PlainQueryDataSource<TParams, TRequest, TResponse, TData, TError> = DataSource<QueryDataSourceContext, TParams, TRequest, TResponse, TData, TError, QueryObserverOptions<TResponse, TError, ActualData<TData, TResponse>, TResponse, DataSourceKey>, ResultWrapper<QueryObserverResult<ActualData<TData, TResponse>, TError>, TResponse, TData, TError>, QueryFunctionContext<DataSourceKey>> & {
|
|
6
6
|
type: 'plain';
|
|
7
7
|
};
|
|
8
8
|
export type AnyPlainQueryDataSource = PlainQueryDataSource<any, any, any, any, any>;
|
|
9
|
-
type ResultWrapper<TResult> = TResult extends QueryObserverResult ? Overwrite<TResult, {
|
|
9
|
+
type ResultWrapper<TResult, TResponse, TData, TError> = TResult extends QueryObserverResult<ActualData<TData, TResponse>, TError> ? Overwrite<TResult, {
|
|
10
10
|
status: DataLoaderStatus;
|
|
11
11
|
}> & {
|
|
12
12
|
originalStatus: TResult['status'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n QueryFunctionContext,\n QueryObserverOptions,\n QueryObserverResult,\n} from '@tanstack/react-query';\nimport type {Overwrite} from 'utility-types';\n\nimport type {ActualData, DataLoaderStatus, DataSource, DataSourceKey} from '../../../core';\nimport type {QueryDataSourceContext} from '../../types';\n\nexport type PlainQueryDataSource
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n QueryFunctionContext,\n QueryObserverOptions,\n QueryObserverResult,\n} from '@tanstack/react-query';\nimport type {Overwrite} from 'utility-types';\n\nimport type {ActualData, DataLoaderStatus, DataSource, DataSourceKey} from '../../../core';\nimport type {QueryDataSourceContext} from '../../types';\n\nexport type PlainQueryDataSource<TParams, TRequest, TResponse, TData, TError> = DataSource<\n QueryDataSourceContext,\n TParams,\n TRequest,\n TResponse,\n TData,\n TError,\n QueryObserverOptions<TResponse, TError, ActualData<TData, TResponse>, TResponse, DataSourceKey>,\n ResultWrapper<\n QueryObserverResult<ActualData<TData, TResponse>, TError>,\n TResponse,\n TData,\n TError\n >,\n QueryFunctionContext<DataSourceKey>\n> & {\n type: 'plain';\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyPlainQueryDataSource = PlainQueryDataSource<any, any, any, any, any>;\n\ntype ResultWrapper<TResult, TResponse, TData, TError> =\n TResult extends QueryObserverResult<ActualData<TData, TResponse>, TError>\n ? Overwrite<TResult, {status: DataLoaderStatus}> & {originalStatus: TResult['status']}\n : never;\n"],"mappings":"","ignoreList":[]}
|