@gravity-ui/data-source 0.5.0 → 0.5.1
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/DataManger.js.map +1 -1
- package/build/cjs/core/utils/getError.js.map +1 -1
- package/build/cjs/core/utils/getStatus.js.map +1 -1
- package/build/cjs/core/utils/hasTag.js.map +1 -1
- package/build/cjs/react-query/ClientDataManager.d.ts +4 -4
- package/build/cjs/react-query/ClientDataManager.js +3 -7
- package/build/cjs/react-query/ClientDataManager.js.map +1 -1
- package/build/cjs/react-query/hooks/useQueryContext.d.ts +1 -1
- package/build/cjs/react-query/hooks/useQueryContext.js.map +1 -1
- package/build/cjs/react-query/hooks/useQueryData.d.ts +1 -1
- package/build/cjs/react-query/hooks/useQueryData.js.map +1 -1
- package/build/cjs/react-query/hooks/useRefetchInterval.d.ts +7 -7
- package/build/cjs/react-query/hooks/useRefetchInterval.js +14 -14
- package/build/cjs/react-query/hooks/useRefetchInterval.js.map +1 -1
- package/build/cjs/react-query/impl/infinite/hooks.d.ts +2 -4
- package/build/cjs/react-query/impl/infinite/hooks.js +24 -26
- package/build/cjs/react-query/impl/infinite/hooks.js.map +1 -1
- package/build/cjs/react-query/impl/infinite/types.d.ts +4 -5
- package/build/cjs/react-query/impl/infinite/types.js.map +1 -1
- package/build/cjs/react-query/impl/plain/hooks.d.ts +2 -5
- package/build/cjs/react-query/impl/plain/hooks.js +20 -22
- package/build/cjs/react-query/impl/plain/hooks.js.map +1 -1
- package/build/cjs/react-query/impl/plain/types.d.ts +3 -2
- package/build/cjs/react-query/impl/plain/types.js.map +1 -1
- package/build/cjs/react-query/index.d.ts +3 -1
- 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 +6 -0
- package/build/cjs/react-query/types/options.js.map +1 -0
- package/build/cjs/react-query/types/refetch-interval.d.ts +0 -7
- package/build/cjs/react-query/types/refetch-interval.js.map +1 -1
- package/build/cjs/react-query/utils/getProgressiveRefetch.d.ts +7 -2
- package/build/cjs/react-query/utils/getProgressiveRefetch.js +5 -4
- package/build/cjs/react-query/utils/getProgressiveRefetch.js.map +1 -1
- package/build/esm/core/types/DataManger.js.map +1 -1
- package/build/esm/core/utils/getError.js.map +1 -1
- package/build/esm/core/utils/getStatus.js.map +1 -1
- package/build/esm/core/utils/hasTag.js.map +1 -1
- package/build/esm/react-query/ClientDataManager.d.ts +4 -4
- package/build/esm/react-query/ClientDataManager.js +3 -7
- package/build/esm/react-query/ClientDataManager.js.map +1 -1
- package/build/esm/react-query/hooks/useQueryContext.d.ts +1 -1
- package/build/esm/react-query/hooks/useQueryContext.js.map +1 -1
- package/build/esm/react-query/hooks/useQueryData.d.ts +1 -1
- package/build/esm/react-query/hooks/useQueryData.js.map +1 -1
- package/build/esm/react-query/hooks/useRefetchInterval.d.ts +7 -7
- package/build/esm/react-query/hooks/useRefetchInterval.js +14 -14
- package/build/esm/react-query/hooks/useRefetchInterval.js.map +1 -1
- package/build/esm/react-query/impl/infinite/hooks.d.ts +2 -4
- package/build/esm/react-query/impl/infinite/hooks.js +24 -25
- package/build/esm/react-query/impl/infinite/hooks.js.map +1 -1
- package/build/esm/react-query/impl/infinite/types.d.ts +4 -5
- package/build/esm/react-query/impl/infinite/types.js.map +1 -1
- package/build/esm/react-query/impl/plain/hooks.d.ts +2 -5
- package/build/esm/react-query/impl/plain/hooks.js +20 -21
- package/build/esm/react-query/impl/plain/hooks.js.map +1 -1
- package/build/esm/react-query/impl/plain/types.d.ts +3 -2
- package/build/esm/react-query/impl/plain/types.js.map +1 -1
- package/build/esm/react-query/index.d.ts +3 -1
- 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 +2 -0
- package/build/esm/react-query/types/options.js.map +1 -0
- package/build/esm/react-query/types/refetch-interval.d.ts +0 -7
- package/build/esm/react-query/types/refetch-interval.js.map +1 -1
- package/build/esm/react-query/utils/getProgressiveRefetch.d.ts +7 -2
- package/build/esm/react-query/utils/getProgressiveRefetch.js +5 -4
- package/build/esm/react-query/utils/getProgressiveRefetch.js.map +1 -1
- package/package.json +1 -1
- package/build/cjs/react-query/types/index.d.ts +0 -2
- package/build/cjs/react-query/types/index.js +0 -28
- package/build/cjs/react-query/types/index.js.map +0 -1
- package/build/esm/react-query/types/index.d.ts +0 -2
- package/build/esm/react-query/types/index.js +0 -3
- package/build/esm/react-query/types/index.js.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export type { QueryDataSourceContext, AnyQueryDataSource
|
|
1
|
+
export type { QueryDataSourceContext, AnyQueryDataSource } from './types/base';
|
|
2
|
+
export type { RefetchIntervalFunction, RefetchInterval } from './types/refetch-interval';
|
|
2
3
|
export { useQueryContext } from './hooks/useQueryContext';
|
|
3
4
|
export { useQueryData } from './hooks/useQueryData';
|
|
4
5
|
export { useQueryResponses } from './hooks/useQueryResponses';
|
|
@@ -11,6 +12,7 @@ export type { PlainQueryDataSource, AnyPlainQueryDataSource } from './impl/plain
|
|
|
11
12
|
export { makePlainQueryDataSource } from './impl/plain/factory';
|
|
12
13
|
export { composeOptions as composePlainQueryOptions } from './impl/plain/utils';
|
|
13
14
|
export { normalizeStatus } from './utils/normalizeStatus';
|
|
15
|
+
export type { ProgressiveRefetchOptions } from './utils/getProgressiveRefetch';
|
|
14
16
|
export { getProgressiveRefetch } from './utils/getProgressiveRefetch';
|
|
15
17
|
export type { ClientDataManagerConfig } from './ClientDataManager';
|
|
16
18
|
export { ClientDataManager } from './ClientDataManager';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useQueryContext","useQueryData","useQueryResponses","useRefetchAll","useRefetchErrored","makeInfiniteQueryDataSource","composeOptions","composeInfiniteQueryOptions","makePlainQueryDataSource","composePlainQueryOptions","normalizeStatus","getProgressiveRefetch","ClientDataManager"],"sources":["index.ts"],"sourcesContent":["export type {
|
|
1
|
+
{"version":3,"names":["useQueryContext","useQueryData","useQueryResponses","useRefetchAll","useRefetchErrored","makeInfiniteQueryDataSource","composeOptions","composeInfiniteQueryOptions","makePlainQueryDataSource","composePlainQueryOptions","normalizeStatus","getProgressiveRefetch","ClientDataManager"],"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"],"mappings":"AAGA,SAAQA,eAAe,QAAO,yBAAyB;AACvD,SAAQC,YAAY,QAAO,sBAAsB;AACjD,SAAQC,iBAAiB,QAAO,2BAA2B;AAC3D,SAAQC,aAAa,QAAO,uBAAuB;AACnD,SAAQC,iBAAiB,QAAO,2BAA2B;AAG3D,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","ignoreList":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DefaultError, QueryKey } from '@tanstack/react-query';
|
|
2
|
+
import type { RefetchInterval } from './refetch-interval';
|
|
3
|
+
export interface QueryDataAdditionalOptions<TQueryFnData = unknown, TError = DefaultError, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> {
|
|
4
|
+
refetchInterval?: RefetchInterval<TQueryFnData, TError, TQueryData, TQueryKey>;
|
|
5
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["options.ts"],"sourcesContent":["import type {DefaultError, QueryKey} from '@tanstack/react-query';\n\nimport type {RefetchInterval} from './refetch-interval';\n\nexport interface QueryDataAdditionalOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> {\n refetchInterval?: RefetchInterval<TQueryFnData, TError, TQueryData, TQueryKey>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
1
|
import type { DefaultError, Query, QueryKey } from '@tanstack/react-query';
|
|
2
2
|
export type RefetchIntervalFunction<TQueryFnData = unknown, TError = DefaultError, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = (query: Query<TQueryFnData, TError, TQueryData, TQueryKey>, count: number) => number | false | undefined;
|
|
3
3
|
export type RefetchInterval<TQueryFnData = unknown, TError = DefaultError, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = number | false | RefetchIntervalFunction<TQueryFnData, TError, TQueryData, TQueryKey>;
|
|
4
|
-
export interface ProgressiveRefetchInterval {
|
|
5
|
-
minInterval: number;
|
|
6
|
-
maxInterval: number;
|
|
7
|
-
}
|
|
8
|
-
export interface QueryDataExtendedOptions<TQueryFnData = unknown, TError = DefaultError, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> {
|
|
9
|
-
refetchInterval?: RefetchInterval<TQueryFnData, TError, TQueryData, TQueryKey>;
|
|
10
|
-
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["refetch-interval.ts"],"sourcesContent":["import type {DefaultError, Query, QueryKey} from '@tanstack/react-query';\n\nexport type RefetchIntervalFunction<\n TQueryFnData = unknown,\n TError = DefaultError,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = (\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey>,\n count: number,\n) => number | false | undefined;\n\nexport type RefetchInterval<\n TQueryFnData = unknown,\n TError = DefaultError,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = number | false | RefetchIntervalFunction<TQueryFnData, TError, TQueryData, TQueryKey>;\n
|
|
1
|
+
{"version":3,"names":[],"sources":["refetch-interval.ts"],"sourcesContent":["import type {DefaultError, Query, QueryKey} from '@tanstack/react-query';\n\nexport type RefetchIntervalFunction<\n TQueryFnData = unknown,\n TError = DefaultError,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = (\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey>,\n count: number,\n) => number | false | undefined;\n\nexport type RefetchInterval<\n TQueryFnData = unknown,\n TError = DefaultError,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = number | false | RefetchIntervalFunction<TQueryFnData, TError, TQueryData, TQueryKey>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { QueryKey } from '@tanstack/react-query';
|
|
2
|
-
import type {
|
|
3
|
-
export
|
|
2
|
+
import type { RefetchIntervalFunction } from '../types/refetch-interval';
|
|
3
|
+
export interface ProgressiveRefetchOptions {
|
|
4
|
+
minInterval: number;
|
|
5
|
+
maxInterval: number;
|
|
6
|
+
multiplier?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const getProgressiveRefetch: <TQueryFnData = unknown, TError = Error, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>({ minInterval, maxInterval, multiplier, }: ProgressiveRefetchOptions) => RefetchIntervalFunction<TQueryFnData, TError, TData, TQueryKey>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
var BASE = 2;
|
|
2
1
|
export var getProgressiveRefetch = function getProgressiveRefetch(_ref) {
|
|
3
2
|
var minInterval = _ref.minInterval,
|
|
4
|
-
maxInterval = _ref.maxInterval
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
maxInterval = _ref.maxInterval,
|
|
4
|
+
_ref$multiplier = _ref.multiplier,
|
|
5
|
+
multiplier = _ref$multiplier === void 0 ? 2 : _ref$multiplier;
|
|
6
|
+
return function (_query, count) {
|
|
7
|
+
return Math.min(minInterval * Math.pow(multiplier, count), maxInterval);
|
|
7
8
|
};
|
|
8
9
|
};
|
|
9
10
|
// #sourceMappingURL=getProgressiveRefetch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["getProgressiveRefetch","_ref","minInterval","maxInterval","_ref$multiplier","multiplier","_query","count","Math","min","pow"],"sources":["getProgressiveRefetch.ts"],"sourcesContent":["import type {DefaultError, QueryKey} from '@tanstack/react-query';\n\nimport type {RefetchIntervalFunction} from '../types/refetch-interval';\n\nexport interface ProgressiveRefetchOptions {\n minInterval: number;\n maxInterval: number;\n multiplier?: number;\n}\n\nexport const getProgressiveRefetch = <\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>({\n minInterval,\n maxInterval,\n multiplier = 2,\n}: ProgressiveRefetchOptions): RefetchIntervalFunction<TQueryFnData, TError, TData, TQueryKey> => {\n return (_query, count) => {\n return Math.min(minInterval * multiplier ** count, maxInterval);\n };\n};\n"],"mappings":"AAUA,OAAO,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAAC,IAAA,EASgE;EAAA,IAH9FC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IACXC,WAAW,GAAAF,IAAA,CAAXE,WAAW;IAAAC,eAAA,GAAAH,IAAA,CACXI,UAAU;IAAVA,UAAU,GAAAD,eAAA,cAAG,CAAC,GAAAA,eAAA;EAEd,OAAO,UAACE,MAAM,EAAEC,KAAK,EAAK;IACtB,OAAOC,IAAI,CAACC,GAAG,CAACP,WAAW,GAAAM,IAAA,CAAAE,GAAA,CAAGL,UAAU,EAAIE,KAAK,GAAEJ,WAAW,CAAC;EACnE,CAAC;AACL,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _base = require("./base");
|
|
7
|
-
Object.keys(_base).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _base[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _base[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _refetchInterval = require("./refetch-interval");
|
|
18
|
-
Object.keys(_refetchInterval).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _refetchInterval[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _refetchInterval[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
// #sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_base","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_refetchInterval"],"sources":["index.ts"],"sourcesContent":["export * from './base';\nexport * from './refetch-interval';\n"],"mappings":";;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,gBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,gBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,gBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,gBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './base';\nexport * from './refetch-interval';\n"],"mappings":"AAAA,cAAc,QAAQ;AACtB,cAAc,oBAAoB","ignoreList":[]}
|