@gravity-ui/data-source 0.7.0 → 0.8.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/README.md +752 -15
- package/build/cjs/core/index.d.ts +1 -0
- package/build/cjs/core/index.js.map +1 -1
- package/build/cjs/core/types/DataManager.d.ts +5 -0
- package/build/cjs/core/types/DataManager.js.map +1 -1
- package/build/cjs/core/types/Normalizer.d.ts +29 -0
- package/build/cjs/core/types/Normalizer.js +6 -0
- package/build/cjs/core/types/Normalizer.js.map +1 -0
- package/build/cjs/react/DataManagerProvider.d.ts +7 -0
- package/build/cjs/react/DataManagerProvider.js +19 -0
- package/build/cjs/react/DataManagerProvider.js.map +1 -0
- package/build/cjs/react/__tests__/DataManagerContext.test.js +7 -6
- package/build/cjs/react/__tests__/DataManagerContext.test.js.map +1 -1
- package/build/cjs/react/__tests__/withDataManager.test.js +3 -0
- package/build/cjs/react/__tests__/withDataManager.test.js.map +1 -1
- package/build/cjs/react/index.d.ts +2 -0
- package/build/cjs/react/index.js +8 -0
- package/build/cjs/react/index.js.map +1 -1
- package/build/cjs/react-query/ClientDataManager.d.ts +16 -3
- package/build/cjs/react-query/ClientDataManager.js +158 -13
- package/build/cjs/react-query/ClientDataManager.js.map +1 -1
- package/build/cjs/react-query/DataSourceProvider.d.ts +7 -0
- package/build/cjs/react-query/DataSourceProvider.js +35 -0
- package/build/cjs/react-query/DataSourceProvider.js.map +1 -0
- package/build/cjs/react-query/__tests__/createQueryNormalizer.test.js +177 -0
- package/build/cjs/react-query/__tests__/createQueryNormalizer.test.js.map +1 -0
- package/build/cjs/react-query/__tests__/normalizationEdgeCases.test.js +100 -0
- package/build/cjs/react-query/__tests__/normalizationEdgeCases.test.js.map +1 -0
- package/build/cjs/react-query/__tests__/subscriptions.test.js +1180 -0
- package/build/cjs/react-query/__tests__/subscriptions.test.js.map +1 -0
- package/build/cjs/react-query/__tests__/threeLevelIntegration.test.js +659 -0
- package/build/cjs/react-query/__tests__/threeLevelIntegration.test.js.map +1 -0
- package/build/cjs/react-query/__tests__/updateQueriesFromMutationData.test.js +229 -0
- package/build/cjs/react-query/__tests__/updateQueriesFromMutationData.test.js.map +1 -0
- package/build/cjs/react-query/hooks/__tests__/useQueryData.refetch.test.js +195 -0
- package/build/cjs/react-query/hooks/__tests__/useQueryData.refetch.test.js.map +1 -0
- package/build/cjs/react-query/impl/infinite/hooks.js +4 -1
- package/build/cjs/react-query/impl/infinite/hooks.js.map +1 -1
- package/build/cjs/react-query/impl/infinite/types.d.ts +2 -2
- package/build/cjs/react-query/impl/infinite/types.js.map +1 -1
- package/build/cjs/react-query/impl/infinite/utils.js +6 -1
- package/build/cjs/react-query/impl/infinite/utils.js.map +1 -1
- package/build/cjs/react-query/impl/plain/hooks.js +4 -1
- package/build/cjs/react-query/impl/plain/hooks.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/cjs/react-query/impl/plain/utils.js +6 -1
- package/build/cjs/react-query/impl/plain/utils.js.map +1 -1
- package/build/cjs/react-query/index.d.ts +2 -0
- package/build/cjs/react-query/index.js +7 -0
- package/build/cjs/react-query/index.js.map +1 -1
- package/build/cjs/react-query/types/normalizer.d.ts +21 -0
- package/build/cjs/react-query/types/normalizer.js +6 -0
- package/build/cjs/react-query/types/normalizer.js.map +1 -0
- package/build/cjs/react-query/types/options.d.ts +12 -0
- package/build/cjs/react-query/types/options.js.map +1 -1
- package/build/cjs/react-query/types/query-meta.d.ts +12 -0
- package/build/cjs/react-query/utils/__tests__/checkMutationObjectsKeys.test.js +295 -0
- package/build/cjs/react-query/utils/__tests__/checkMutationObjectsKeys.test.js.map +1 -0
- package/build/cjs/react-query/utils/checkMutationObjectsKeys.d.ts +17 -0
- package/build/cjs/react-query/utils/checkMutationObjectsKeys.js +88 -0
- package/build/cjs/react-query/utils/checkMutationObjectsKeys.js.map +1 -0
- package/build/cjs/react-query/utils/normalize.d.ts +22 -0
- package/build/cjs/react-query/utils/normalize.js +150 -0
- package/build/cjs/react-query/utils/normalize.js.map +1 -0
- package/build/cjs/react-query/utils/parseQueryKey.d.ts +2 -0
- package/build/cjs/react-query/utils/parseQueryKey.js +10 -0
- package/build/cjs/react-query/utils/parseQueryKey.js.map +1 -0
- package/build/cjs/react-query/utils/warn.d.ts +1 -0
- package/build/cjs/react-query/utils/warn.js +15 -0
- package/build/cjs/react-query/utils/warn.js.map +1 -0
- package/build/cjs/react-query/utils/warnDisabledRefetch.d.ts +1 -0
- package/build/cjs/react-query/utils/warnDisabledRefetch.js +11 -0
- package/build/cjs/react-query/utils/warnDisabledRefetch.js.map +1 -0
- package/build/esm/core/index.d.ts +1 -0
- package/build/esm/core/index.js.map +1 -1
- package/build/esm/core/types/DataManager.d.ts +5 -0
- package/build/esm/core/types/DataManager.js.map +1 -1
- package/build/esm/core/types/Normalizer.d.ts +29 -0
- package/build/esm/core/types/Normalizer.js +2 -0
- package/build/esm/core/types/Normalizer.js.map +1 -0
- package/build/esm/react/DataManagerProvider.d.ts +7 -0
- package/build/esm/react/DataManagerProvider.js +12 -0
- package/build/esm/react/DataManagerProvider.js.map +1 -0
- package/build/esm/react/__tests__/DataManagerContext.test.js +7 -6
- package/build/esm/react/__tests__/DataManagerContext.test.js.map +1 -1
- package/build/esm/react/__tests__/withDataManager.test.js +3 -0
- package/build/esm/react/__tests__/withDataManager.test.js.map +1 -1
- package/build/esm/react/index.d.ts +2 -0
- package/build/esm/react/index.js +1 -0
- package/build/esm/react/index.js.map +1 -1
- package/build/esm/react-query/ClientDataManager.d.ts +16 -3
- package/build/esm/react-query/ClientDataManager.js +152 -7
- package/build/esm/react-query/ClientDataManager.js.map +1 -1
- package/build/esm/react-query/DataSourceProvider.d.ts +7 -0
- package/build/esm/react-query/DataSourceProvider.js +28 -0
- package/build/esm/react-query/DataSourceProvider.js.map +1 -0
- package/build/esm/react-query/__tests__/createQueryNormalizer.test.js +174 -0
- package/build/esm/react-query/__tests__/createQueryNormalizer.test.js.map +1 -0
- package/build/esm/react-query/__tests__/normalizationEdgeCases.test.js +98 -0
- package/build/esm/react-query/__tests__/normalizationEdgeCases.test.js.map +1 -0
- package/build/esm/react-query/__tests__/subscriptions.test.js +1176 -0
- package/build/esm/react-query/__tests__/subscriptions.test.js.map +1 -0
- package/build/esm/react-query/__tests__/threeLevelIntegration.test.js +656 -0
- package/build/esm/react-query/__tests__/threeLevelIntegration.test.js.map +1 -0
- package/build/esm/react-query/__tests__/updateQueriesFromMutationData.test.js +227 -0
- package/build/esm/react-query/__tests__/updateQueriesFromMutationData.test.js.map +1 -0
- package/build/esm/react-query/hooks/__tests__/useQueryData.refetch.test.js +192 -0
- package/build/esm/react-query/hooks/__tests__/useQueryData.refetch.test.js.map +1 -0
- package/build/esm/react-query/impl/infinite/hooks.js +5 -2
- package/build/esm/react-query/impl/infinite/hooks.js.map +1 -1
- package/build/esm/react-query/impl/infinite/types.d.ts +2 -2
- package/build/esm/react-query/impl/infinite/types.js.map +1 -1
- package/build/esm/react-query/impl/infinite/utils.js +6 -1
- package/build/esm/react-query/impl/infinite/utils.js.map +1 -1
- package/build/esm/react-query/impl/plain/hooks.js +5 -2
- package/build/esm/react-query/impl/plain/hooks.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/build/esm/react-query/impl/plain/utils.js +6 -1
- package/build/esm/react-query/impl/plain/utils.js.map +1 -1
- package/build/esm/react-query/index.d.ts +2 -0
- package/build/esm/react-query/index.js +1 -0
- package/build/esm/react-query/index.js.map +1 -1
- package/build/esm/react-query/types/normalizer.d.ts +21 -0
- package/build/esm/react-query/types/normalizer.js +2 -0
- package/build/esm/react-query/types/normalizer.js.map +1 -0
- package/build/esm/react-query/types/options.d.ts +12 -0
- package/build/esm/react-query/types/options.js.map +1 -1
- package/build/esm/react-query/types/query-meta.d.ts +12 -0
- package/build/esm/react-query/utils/__tests__/checkMutationObjectsKeys.test.js +292 -0
- package/build/esm/react-query/utils/__tests__/checkMutationObjectsKeys.test.js.map +1 -0
- package/build/esm/react-query/utils/checkMutationObjectsKeys.d.ts +17 -0
- package/build/esm/react-query/utils/checkMutationObjectsKeys.js +81 -0
- package/build/esm/react-query/utils/checkMutationObjectsKeys.js.map +1 -0
- package/build/esm/react-query/utils/normalize.d.ts +22 -0
- package/build/esm/react-query/utils/normalize.js +143 -0
- package/build/esm/react-query/utils/normalize.js.map +1 -0
- package/build/esm/react-query/utils/parseQueryKey.d.ts +2 -0
- package/build/esm/react-query/utils/parseQueryKey.js +4 -0
- package/build/esm/react-query/utils/parseQueryKey.js.map +1 -0
- package/build/esm/react-query/utils/warn.d.ts +1 -0
- package/build/esm/react-query/utils/warn.js +9 -0
- package/build/esm/react-query/utils/warn.js.map +1 -0
- package/build/esm/react-query/utils/warnDisabledRefetch.d.ts +1 -0
- package/build/esm/react-query/utils/warnDisabledRefetch.js +5 -0
- package/build/esm/react-query/utils/warnDisabledRefetch.js.map +1 -0
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n DefaultError,\n InfiniteData,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n QueryFunctionContext,\n QueryKey,\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/base';\nimport type {QueryDataAdditionalOptions} from '../../types/options';\n\nexport type InfiniteQueryObserverExtendedOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> =
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n DefaultError,\n InfiniteData,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n QueryFunctionContext,\n QueryKey,\n} from '@tanstack/react-query';\nimport type {Assign, Overwrite} from 'utility-types';\n\nimport type {ActualData, DataLoaderStatus, DataSource, DataSourceKey} from '../../../core';\nimport type {QueryDataSourceContext} from '../../types/base';\nimport type {QueryDataAdditionalOptions} from '../../types/options';\n\nexport type InfiniteQueryObserverExtendedOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = Assign<\n InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, TPageParam>,\n QueryDataAdditionalOptions<\n TQueryFnData,\n TError,\n InfiniteData<TQueryData, TPageParam>,\n TQueryKey\n >\n>;\n\nexport type InfiniteQueryDataSource<TParams, TRequest, TResponse, TData, TError> = DataSource<\n QueryDataSourceContext,\n TParams,\n TRequest,\n TResponse,\n TData,\n TError,\n InfiniteQueryObserverExtendedOptions<\n NoInfer<TResponse>,\n NoInfer<TError>,\n InfiniteData<ActualData<NoInfer<TData>, NoInfer<TResponse>>, Partial<TRequest>>,\n NoInfer<TResponse>,\n DataSourceKey,\n Partial<NoInfer<TRequest>>\n >,\n ResultWrapper<\n InfiniteQueryObserverResult<\n InfiniteData<ActualData<NoInfer<TData>, NoInfer<TResponse>>, Partial<TRequest>>,\n NoInfer<TError>\n >,\n NoInfer<TRequest>,\n NoInfer<TResponse>,\n NoInfer<TData>,\n NoInfer<TError>\n >,\n QueryFunctionContext<DataSourceKey, Partial<NoInfer<TRequest>>>\n> & {\n type: 'infinite';\n next: (\n lastPage: NoInfer<TResponse>,\n allPages: NoInfer<TResponse>[],\n ) => Partial<NoInfer<TRequest>> | null | undefined;\n prev?: (\n firstPage: NoInfer<TResponse>,\n allPages: NoInfer<TResponse>[],\n ) => Partial<NoInfer<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 {\n status: DataLoaderStatus;\n data: Array<FlatArray<Array<ActualData<TData, TResponse>>, 1>>;\n }\n > & {\n originalStatus: TResult['status'];\n originalData: TResult['data'];\n }\n : never;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -38,6 +38,10 @@ export var composeOptions = function composeOptions(context, dataSource, params,
|
|
|
38
38
|
var actualResponse = parseNullableValue(response);
|
|
39
39
|
return transformResponse ? transformResponse(actualResponse) : actualResponse;
|
|
40
40
|
};
|
|
41
|
+
var meta = {
|
|
42
|
+
invalidate: options === null || options === void 0 ? void 0 : options.invalidate,
|
|
43
|
+
optimistic: options === null || options === void 0 ? void 0 : options.optimistic
|
|
44
|
+
};
|
|
41
45
|
return _objectSpread(_objectSpread({
|
|
42
46
|
queryKey: composeFullKey(dataSource, params),
|
|
43
47
|
queryFn: params === idle ? skipToken : queryFn,
|
|
@@ -48,7 +52,8 @@ export var composeOptions = function composeOptions(context, dataSource, params,
|
|
|
48
52
|
},
|
|
49
53
|
initialPageParam: EMPTY_OBJECT,
|
|
50
54
|
getNextPageParam: next,
|
|
51
|
-
getPreviousPageParam: prev
|
|
55
|
+
getPreviousPageParam: prev,
|
|
56
|
+
meta: meta
|
|
52
57
|
}, dataSource.options), options);
|
|
53
58
|
};
|
|
54
59
|
// #sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["skipToken","composeFullKey","idle","formatNullableValue","parseNullableValue","EMPTY_OBJECT","composeOptions","context","dataSource","params","options","transformParams","transformResponse","next","prev","queryFn","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","fetchContext","request","paginatedRequest","response","wrap","_callee$","_context","_objectSpread","pageParam","fetch","sent","abrupt","stop","_x","apply","arguments","selectPage","actualResponse","queryKey","select","data","pages","map","initialPageParam","getNextPageParam","getPreviousPageParam"],"sources":["utils.ts"],"sourcesContent":["import {skipToken} from '@tanstack/react-query';\nimport type {InfiniteData, QueryFunctionContext} from '@tanstack/react-query';\n\nimport {composeFullKey, idle} from '../../../core';\nimport type {\n DataSourceContext,\n DataSourceData,\n DataSourceError,\n DataSourceKey,\n DataSourceOptions,\n DataSourceParams,\n DataSourceResponse,\n} from '../../../core';\nimport type {nullSymbol, undefinedSymbol} from '../../constants';\nimport {formatNullableValue} from '../../utils/formatNullableValue';\nimport {parseNullableValue} from '../../utils/parseNullableValue';\n\nimport type {\n AnyInfiniteQueryDataSource,\n AnyPageParam,\n InfiniteQueryObserverExtendedOptions,\n} from './types';\n\nconst EMPTY_OBJECT = {};\n\nexport const composeOptions = <TDataSource extends AnyInfiniteQueryDataSource>(\n context: DataSourceContext<TDataSource>,\n dataSource: TDataSource,\n params: DataSourceParams<TDataSource>,\n options?: Partial<DataSourceOptions<TDataSource>>,\n): InfiniteQueryObserverExtendedOptions<\n DataSourceResponse<TDataSource>,\n DataSourceError<TDataSource>,\n InfiniteData<DataSourceData<TDataSource>, AnyPageParam>,\n DataSourceResponse<TDataSource>,\n DataSourceKey,\n AnyPageParam\n> => {\n const {transformParams, transformResponse, next, prev} = dataSource;\n\n const queryFn = async (\n fetchContext: QueryFunctionContext<DataSourceKey, AnyPageParam>,\n ): Promise<DataSourceResponse<TDataSource> | typeof undefinedSymbol | typeof nullSymbol> => {\n const request = transformParams ? transformParams(params) : params;\n const paginatedRequest = {...request, ...fetchContext.pageParam};\n\n const response = await dataSource.fetch(context, fetchContext, paginatedRequest);\n\n return formatNullableValue(response);\n };\n\n const selectPage = (\n response: DataSourceResponse<TDataSource> | typeof undefinedSymbol | typeof nullSymbol,\n ): DataSourceData<TDataSource> => {\n const actualResponse = parseNullableValue(response) as DataSourceData<TDataSource>;\n\n return transformResponse ? transformResponse(actualResponse) : actualResponse;\n };\n\n return {\n queryKey: composeFullKey(dataSource, params),\n queryFn: params === idle ? skipToken : queryFn,\n select: (data) => ({...data, pages: data.pages.map(selectPage)}),\n initialPageParam: EMPTY_OBJECT,\n getNextPageParam: next,\n getPreviousPageParam: prev,\n ...dataSource.options,\n ...options,\n };\n};\n"],"mappings":";;;AAAA,SAAQA,SAAS,QAAO,uBAAuB;AAG/C,SAAQC,cAAc,EAAEC,IAAI,QAAO,eAAe;AAWlD,SAAQC,mBAAmB,QAAO,iCAAiC;AACnE,SAAQC,kBAAkB,QAAO,gCAAgC;AAQjE,IAAMC,YAAY,GAAG,CAAC,CAAC;AAEvB,OAAO,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CACvBC,OAAuC,EACvCC,UAAuB,EACvBC,MAAqC,EACrCC,OAAiD,EAQhD;EACD,IAAOC,eAAe,GAAmCH,UAAU,CAA5DG,eAAe;IAAEC,iBAAiB,GAAgBJ,UAAU,CAA3CI,iBAAiB;IAAEC,IAAI,GAAUL,UAAU,CAAxBK,IAAI;IAAEC,IAAI,GAAIN,UAAU,CAAlBM,IAAI;EAErD,IAAMC,OAAO;IAAA,IAAAC,IAAA,GAAAC,iBAAA,cAAAC,mBAAA,GAAAC,IAAA,CAAG,SAAAC,QACZC,YAA+D;MAAA,IAAAC,OAAA,EAAAC,gBAAA,EAAAC,QAAA;MAAA,OAAAN,mBAAA,GAAAO,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAb,IAAA,GAAAa,QAAA,CAAAd,IAAA;UAAA;YAEzDS,OAAO,GAAGX,eAAe,GAAGA,eAAe,CAACF,MAAM,CAAC,GAAGA,MAAM;YAC5Dc,gBAAgB,GAAAK,aAAA,CAAAA,aAAA,KAAON,OAAO,GAAKD,YAAY,CAACQ,SAAS;YAAAF,QAAA,CAAAd,IAAA;YAAA,OAExCL,UAAU,CAACsB,KAAK,CAACvB,OAAO,EAAEc,YAAY,EAAEE,gBAAgB,CAAC;UAAA;YAA1EC,QAAQ,GAAAG,QAAA,CAAAI,IAAA;YAAA,OAAAJ,QAAA,CAAAK,MAAA,WAEP7B,mBAAmB,CAACqB,QAAQ,CAAC;UAAA;UAAA;YAAA,OAAAG,QAAA,CAAAM,IAAA;QAAA;MAAA,GAAAb,OAAA;IAAA,CACvC;IAAA,gBATKL,OAAOA,CAAAmB,EAAA;MAAA,OAAAlB,IAAA,CAAAmB,KAAA,OAAAC,SAAA;IAAA;EAAA,GASZ;EAED,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CACZb,QAAsF,EACxD;IAC9B,IAAMc,cAAc,GAAGlC,kBAAkB,CAACoB,QAAQ,CAAgC;IAElF,OAAOZ,iBAAiB,GAAGA,iBAAiB,CAAC0B,cAAc,CAAC,GAAGA,cAAc;EACjF,CAAC;EAED,
|
|
1
|
+
{"version":3,"names":["skipToken","composeFullKey","idle","formatNullableValue","parseNullableValue","EMPTY_OBJECT","composeOptions","context","dataSource","params","options","transformParams","transformResponse","next","prev","queryFn","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","fetchContext","request","paginatedRequest","response","wrap","_callee$","_context","_objectSpread","pageParam","fetch","sent","abrupt","stop","_x","apply","arguments","selectPage","actualResponse","meta","invalidate","optimistic","queryKey","select","data","pages","map","initialPageParam","getNextPageParam","getPreviousPageParam"],"sources":["utils.ts"],"sourcesContent":["import {skipToken} from '@tanstack/react-query';\nimport type {InfiniteData, QueryFunctionContext} from '@tanstack/react-query';\n\nimport {composeFullKey, idle} from '../../../core';\nimport type {\n DataSourceContext,\n DataSourceData,\n DataSourceError,\n DataSourceKey,\n DataSourceOptions,\n DataSourceParams,\n DataSourceResponse,\n} from '../../../core';\nimport type {nullSymbol, undefinedSymbol} from '../../constants';\nimport {formatNullableValue} from '../../utils/formatNullableValue';\nimport {parseNullableValue} from '../../utils/parseNullableValue';\n\nimport type {\n AnyInfiniteQueryDataSource,\n AnyPageParam,\n InfiniteQueryObserverExtendedOptions,\n} from './types';\n\nconst EMPTY_OBJECT = {};\n\nexport const composeOptions = <TDataSource extends AnyInfiniteQueryDataSource>(\n context: DataSourceContext<TDataSource>,\n dataSource: TDataSource,\n params: DataSourceParams<TDataSource>,\n options?: Partial<DataSourceOptions<TDataSource>>,\n): InfiniteQueryObserverExtendedOptions<\n DataSourceResponse<TDataSource>,\n DataSourceError<TDataSource>,\n InfiniteData<DataSourceData<TDataSource>, AnyPageParam>,\n DataSourceResponse<TDataSource>,\n DataSourceKey,\n AnyPageParam\n> => {\n const {transformParams, transformResponse, next, prev} = dataSource;\n\n const queryFn = async (\n fetchContext: QueryFunctionContext<DataSourceKey, AnyPageParam>,\n ): Promise<DataSourceResponse<TDataSource> | typeof undefinedSymbol | typeof nullSymbol> => {\n const request = transformParams ? transformParams(params) : params;\n const paginatedRequest = {...request, ...fetchContext.pageParam};\n\n const response = await dataSource.fetch(context, fetchContext, paginatedRequest);\n\n return formatNullableValue(response);\n };\n\n const selectPage = (\n response: DataSourceResponse<TDataSource> | typeof undefinedSymbol | typeof nullSymbol,\n ): DataSourceData<TDataSource> => {\n const actualResponse = parseNullableValue(response) as DataSourceData<TDataSource>;\n\n return transformResponse ? transformResponse(actualResponse) : actualResponse;\n };\n\n const meta = {\n invalidate: options?.invalidate,\n optimistic: options?.optimistic,\n };\n\n return {\n queryKey: composeFullKey(dataSource, params),\n queryFn: params === idle ? skipToken : queryFn,\n select: (data) => ({...data, pages: data.pages.map(selectPage)}),\n initialPageParam: EMPTY_OBJECT,\n getNextPageParam: next,\n getPreviousPageParam: prev,\n meta,\n ...dataSource.options,\n ...options,\n };\n};\n"],"mappings":";;;AAAA,SAAQA,SAAS,QAAO,uBAAuB;AAG/C,SAAQC,cAAc,EAAEC,IAAI,QAAO,eAAe;AAWlD,SAAQC,mBAAmB,QAAO,iCAAiC;AACnE,SAAQC,kBAAkB,QAAO,gCAAgC;AA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AMc,cAAc,GAAGlC,kBAAkB,CAACoB,QAAQ,CAAgC;IAElF,OAAOZ,iBAAiB,GAAGA,iBAAiB,CAAC0B,cAAc,CAAC,GAAGA,cAAc;EACjF,CAAC;EAED,IAAMC,IAAI,GAAG;IACTC,UAAU,EAAE9B,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAE8B,UAAU;IAC/BC,UAAU,EAAE/B,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAE+B;EACzB,CAAC;EAED,OAAAb,aAAA,CAAAA,aAAA;IACIc,QAAQ,EAAEzC,cAAc,CAACO,UAAU,EAAEC,MAAM,CAAC;IAC5CM,OAAO,EAAEN,MAAM,KAAKP,IAAI,GAAGF,SAAS,GAAGe,OAAO;IAC9C4B,MAAM,EAAE,SAARA,MAAMA,CAAGC,IAAI;MAAA,OAAAhB,aAAA,CAAAA,aAAA,KAAUgB,IAAI;QAAEC,KAAK,EAAED,IAAI,CAACC,KAAK,CAACC,GAAG,CAACT,UAAU;MAAC;IAAA,CAAE;IAChEU,gBAAgB,EAAE1C,YAAY;IAC9B2C,gBAAgB,EAAEnC,IAAI;IACtBoC,oBAAoB,EAAEnC,IAAI;IAC1ByB,IAAI,EAAJA;EAAI,GACD/B,UAAU,CAACE,OAAO,GAClBA,OAAO;AAElB,CAAC","ignoreList":[]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["queryFn", "refetchInterval"];
|
|
4
|
-
import { useQuery } from '@tanstack/react-query';
|
|
4
|
+
import { skipToken, useQuery } from '@tanstack/react-query';
|
|
5
5
|
import { useRefetchInterval } from '../../hooks/useRefetchInterval';
|
|
6
6
|
import { normalizeStatus } from '../../utils/normalizeStatus';
|
|
7
|
+
import { warnDisabledRefetch } from '../../utils/warnDisabledRefetch';
|
|
7
8
|
import { composeOptions } from './utils';
|
|
8
9
|
var usePlainQueryDataOptions = function usePlainQueryDataOptions(composedOptions) {
|
|
9
10
|
var queryFnOption = composedOptions.queryFn,
|
|
@@ -21,9 +22,11 @@ export var usePlainQueryData = function usePlainQueryData(context, dataSource, p
|
|
|
21
22
|
var extendedOptions = composeOptions(context, dataSource, params, options);
|
|
22
23
|
var composedOptions = usePlainQueryDataOptions(extendedOptions);
|
|
23
24
|
var state = useQuery(composedOptions);
|
|
25
|
+
var isDisabled = composedOptions.enabled === false || composedOptions.queryFn === skipToken;
|
|
24
26
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
25
27
|
status: normalizeStatus(state.status, state.fetchStatus),
|
|
26
|
-
originalStatus: state.status
|
|
28
|
+
originalStatus: state.status,
|
|
29
|
+
refetch: isDisabled ? warnDisabledRefetch : state.refetch
|
|
27
30
|
});
|
|
28
31
|
};
|
|
29
32
|
// #sourceMappingURL=hooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useQuery","useRefetchInterval","normalizeStatus","composeOptions","usePlainQueryDataOptions","composedOptions","queryFnOption","queryFn","refetchIntervalOption","refetchInterval","restOptions","_objectWithoutProperties","_excluded","_useRefetchInterval","_objectSpread","usePlainQueryData","context","dataSource","params","options","extendedOptions","state","status","fetchStatus","originalStatus"],"sources":["hooks.ts"],"sourcesContent":["import {type QueryObserverOptions, useQuery} from '@tanstack/react-query';\n\nimport type {\n DataSourceContext,\n DataSourceData,\n DataSourceError,\n DataSourceKey,\n DataSourceOptions,\n DataSourceParams,\n DataSourceResponse,\n DataSourceState,\n} from '../../../core';\nimport {useRefetchInterval} from '../../hooks/useRefetchInterval';\nimport {normalizeStatus} from '../../utils/normalizeStatus';\n\nimport type {AnyPlainQueryDataSource, QueryObserverExtendedOptions} from './types';\nimport {composeOptions} from './utils';\n\nconst usePlainQueryDataOptions = <TDataSource extends AnyPlainQueryDataSource>(\n composedOptions: QueryObserverExtendedOptions<\n DataSourceResponse<TDataSource>,\n DataSourceError<TDataSource>,\n DataSourceData<TDataSource>,\n DataSourceResponse<TDataSource>,\n DataSourceKey\n >,\n): QueryObserverOptions<\n DataSourceResponse<TDataSource>,\n DataSourceError<TDataSource>,\n DataSourceData<TDataSource>,\n DataSourceResponse<TDataSource>,\n DataSourceKey\n> => {\n const {\n queryFn: queryFnOption,\n refetchInterval: refetchIntervalOption,\n ...restOptions\n } = composedOptions;\n\n const {queryFn, refetchInterval} = useRefetchInterval(refetchIntervalOption, queryFnOption);\n\n return {...restOptions, queryFn, refetchInterval};\n};\n\nexport const usePlainQueryData = <TDataSource extends AnyPlainQueryDataSource>(\n context: DataSourceContext<TDataSource>,\n dataSource: TDataSource,\n params: DataSourceParams<TDataSource>,\n options?: Partial<DataSourceOptions<TDataSource>>,\n): DataSourceState<TDataSource> => {\n const extendedOptions = composeOptions(context, dataSource, params, options);\n const composedOptions = usePlainQueryDataOptions(extendedOptions);\n const state = useQuery(composedOptions);\n\n return {\n ...state,\n status: normalizeStatus(state.status, state.fetchStatus),\n originalStatus: state.status,\n } as DataSourceState<TDataSource>;\n};\n"],"mappings":";;;AAAA,SAAmCA,QAAQ,QAAO,uBAAuB;
|
|
1
|
+
{"version":3,"names":["skipToken","useQuery","useRefetchInterval","normalizeStatus","warnDisabledRefetch","composeOptions","usePlainQueryDataOptions","composedOptions","queryFnOption","queryFn","refetchIntervalOption","refetchInterval","restOptions","_objectWithoutProperties","_excluded","_useRefetchInterval","_objectSpread","usePlainQueryData","context","dataSource","params","options","extendedOptions","state","isDisabled","enabled","status","fetchStatus","originalStatus","refetch"],"sources":["hooks.ts"],"sourcesContent":["import {type QueryObserverOptions, skipToken, useQuery} from '@tanstack/react-query';\n\nimport type {\n DataSourceContext,\n DataSourceData,\n DataSourceError,\n DataSourceKey,\n DataSourceOptions,\n DataSourceParams,\n DataSourceResponse,\n DataSourceState,\n} from '../../../core';\nimport {useRefetchInterval} from '../../hooks/useRefetchInterval';\nimport {normalizeStatus} from '../../utils/normalizeStatus';\nimport {warnDisabledRefetch} from '../../utils/warnDisabledRefetch';\n\nimport type {AnyPlainQueryDataSource, QueryObserverExtendedOptions} from './types';\nimport {composeOptions} from './utils';\n\nconst usePlainQueryDataOptions = <TDataSource extends AnyPlainQueryDataSource>(\n composedOptions: QueryObserverExtendedOptions<\n DataSourceResponse<TDataSource>,\n DataSourceError<TDataSource>,\n DataSourceData<TDataSource>,\n DataSourceResponse<TDataSource>,\n DataSourceKey\n >,\n): QueryObserverOptions<\n DataSourceResponse<TDataSource>,\n DataSourceError<TDataSource>,\n DataSourceData<TDataSource>,\n DataSourceResponse<TDataSource>,\n DataSourceKey\n> => {\n const {\n queryFn: queryFnOption,\n refetchInterval: refetchIntervalOption,\n ...restOptions\n } = composedOptions;\n\n const {queryFn, refetchInterval} = useRefetchInterval(refetchIntervalOption, queryFnOption);\n\n return {...restOptions, queryFn, refetchInterval};\n};\n\nexport const usePlainQueryData = <TDataSource extends AnyPlainQueryDataSource>(\n context: DataSourceContext<TDataSource>,\n dataSource: TDataSource,\n params: DataSourceParams<TDataSource>,\n options?: Partial<DataSourceOptions<TDataSource>>,\n): DataSourceState<TDataSource> => {\n const extendedOptions = composeOptions(context, dataSource, params, options);\n const composedOptions = usePlainQueryDataOptions(extendedOptions);\n const state = useQuery(composedOptions);\n\n const isDisabled = composedOptions.enabled === false || composedOptions.queryFn === skipToken;\n\n return {\n ...state,\n status: normalizeStatus(state.status, state.fetchStatus),\n originalStatus: state.status,\n refetch: isDisabled ? warnDisabledRefetch : state.refetch,\n } as DataSourceState<TDataSource>;\n};\n"],"mappings":";;;AAAA,SAAmCA,SAAS,EAAEC,QAAQ,QAAO,uBAAuB;AAYpF,SAAQC,kBAAkB,QAAO,gCAAgC;AACjE,SAAQC,eAAe,QAAO,6BAA6B;AAC3D,SAAQC,mBAAmB,QAAO,iCAAiC;AAGnE,SAAQC,cAAc,QAAO,SAAS;AAEtC,IAAMC,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAC1BC,eAMC,EAOA;EACD,IACaC,aAAa,GAGtBD,eAAe,CAHfE,OAAO;IACUC,qBAAqB,GAEtCH,eAAe,CAFfI,eAAe;IACZC,WAAW,GAAAC,wBAAA,CACdN,eAAe,EAAAO,SAAA;EAEnB,IAAAC,mBAAA,GAAmCb,kBAAkB,CAACQ,qBAAqB,EAAEF,aAAa,CAAC;IAApFC,OAAO,GAAAM,mBAAA,CAAPN,OAAO;IAAEE,eAAe,GAAAI,mBAAA,CAAfJ,eAAe;EAE/B,OAAAK,aAAA,CAAAA,aAAA,KAAWJ,WAAW;IAAEH,OAAO,EAAPA,OAAO;IAAEE,eAAe,EAAfA;EAAe;AACpD,CAAC;AAED,OAAO,IAAMM,iBAAiB,GAAG,SAApBA,iBAAiBA,CAC1BC,OAAuC,EACvCC,UAAuB,EACvBC,MAAqC,EACrCC,OAAiD,EAClB;EAC/B,IAAMC,eAAe,GAAGjB,cAAc,CAACa,OAAO,EAAEC,UAAU,EAAEC,MAAM,EAAEC,OAAO,CAAC;EAC5E,IAAMd,eAAe,GAAGD,wBAAwB,CAACgB,eAAe,CAAC;EACjE,IAAMC,KAAK,GAAGtB,QAAQ,CAACM,eAAe,CAAC;EAEvC,IAAMiB,UAAU,GAAGjB,eAAe,CAACkB,OAAO,KAAK,KAAK,IAAIlB,eAAe,CAACE,OAAO,KAAKT,SAAS;EAE7F,OAAAgB,aAAA,CAAAA,aAAA,KACOO,KAAK;IACRG,MAAM,EAAEvB,eAAe,CAACoB,KAAK,CAACG,MAAM,EAAEH,KAAK,CAACI,WAAW,CAAC;IACxDC,cAAc,EAAEL,KAAK,CAACG,MAAM;IAC5BG,OAAO,EAAEL,UAAU,GAAGpB,mBAAmB,GAAGmB,KAAK,CAACM;EAAO;AAEjE,CAAC","ignoreList":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { DefaultError, QueryFunctionContext, QueryKey, QueryObserverOptions, QueryObserverResult } from '@tanstack/react-query';
|
|
2
|
-
import type { Overwrite } from 'utility-types';
|
|
2
|
+
import type { Assign, Overwrite } from 'utility-types';
|
|
3
3
|
import type { ActualData, DataLoaderStatus, DataSource, DataSourceKey } from '../../../core';
|
|
4
4
|
import type { QueryDataSourceContext } from '../../types/base';
|
|
5
5
|
import type { QueryDataAdditionalOptions } from '../../types/options';
|
|
6
|
-
export type QueryObserverExtendedOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = never> =
|
|
6
|
+
export type QueryObserverExtendedOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = never> = Assign<QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, TPageParam>, QueryDataAdditionalOptions<TQueryFnData, TError, TQueryData, TQueryKey>>;
|
|
7
7
|
export type PlainQueryDataSource<TParams, TRequest, TResponse, TData, TError> = DataSource<QueryDataSourceContext, TParams, TRequest, TResponse, TData, TError, QueryObserverExtendedOptions<NoInfer<TResponse>, NoInfer<TError>, ActualData<NoInfer<TData>, NoInfer<TResponse>>, NoInfer<TResponse>, DataSourceKey>, ResultWrapper<QueryObserverResult<ActualData<NoInfer<TData>, NoInfer<TResponse>>, NoInfer<TError>>, NoInfer<TResponse>, NoInfer<TData>, NoInfer<TError>>, QueryFunctionContext<DataSourceKey>> & {
|
|
8
8
|
type: 'plain';
|
|
9
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n DefaultError,\n QueryFunctionContext,\n QueryKey,\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/base';\nimport type {QueryDataAdditionalOptions} from '../../types/options';\n\nexport type QueryObserverExtendedOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n> =
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {\n DefaultError,\n QueryFunctionContext,\n QueryKey,\n QueryObserverOptions,\n QueryObserverResult,\n} from '@tanstack/react-query';\nimport type {Assign, Overwrite} from 'utility-types';\n\nimport type {ActualData, DataLoaderStatus, DataSource, DataSourceKey} from '../../../core';\nimport type {QueryDataSourceContext} from '../../types/base';\nimport type {QueryDataAdditionalOptions} from '../../types/options';\n\nexport type QueryObserverExtendedOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = never,\n> = Assign<\n QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, TPageParam>,\n QueryDataAdditionalOptions<TQueryFnData, TError, TQueryData, TQueryKey>\n>;\n\nexport type PlainQueryDataSource<TParams, TRequest, TResponse, TData, TError> = DataSource<\n QueryDataSourceContext,\n TParams,\n TRequest,\n TResponse,\n TData,\n TError,\n QueryObserverExtendedOptions<\n NoInfer<TResponse>,\n NoInfer<TError>,\n ActualData<NoInfer<TData>, NoInfer<TResponse>>,\n NoInfer<TResponse>,\n DataSourceKey\n >,\n ResultWrapper<\n QueryObserverResult<ActualData<NoInfer<TData>, NoInfer<TResponse>>, NoInfer<TError>>,\n NoInfer<TResponse>,\n NoInfer<TData>,\n NoInfer<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":[]}
|
|
@@ -33,10 +33,15 @@ export var composeOptions = function composeOptions(context, dataSource, params,
|
|
|
33
33
|
var actualResponse = parseNullableValue(response);
|
|
34
34
|
return transformResponse ? transformResponse(actualResponse) : actualResponse;
|
|
35
35
|
};
|
|
36
|
+
var meta = {
|
|
37
|
+
invalidate: options === null || options === void 0 ? void 0 : options.invalidate,
|
|
38
|
+
optimistic: options === null || options === void 0 ? void 0 : options.optimistic
|
|
39
|
+
};
|
|
36
40
|
return _objectSpread(_objectSpread({
|
|
37
41
|
queryKey: composeFullKey(dataSource, params),
|
|
38
42
|
queryFn: params === idle ? skipToken : queryFn,
|
|
39
|
-
select: select
|
|
43
|
+
select: select,
|
|
44
|
+
meta: meta
|
|
40
45
|
}, dataSource.options), options);
|
|
41
46
|
};
|
|
42
47
|
// #sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["skipToken","composeFullKey","idle","formatNullableValue","parseNullableValue","composeOptions","context","dataSource","params","options","transformParams","transformResponse","queryFn","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","fetchContext","response","wrap","_callee$","_context","prev","next","fetch","sent","abrupt","stop","_x","apply","arguments","select","actualResponse","_objectSpread","queryKey"],"sources":["utils.ts"],"sourcesContent":["import {type QueryFunctionContext, skipToken} from '@tanstack/react-query';\n\nimport {composeFullKey, idle} from '../../../core';\nimport type {\n DataSourceContext,\n DataSourceData,\n DataSourceError,\n DataSourceKey,\n DataSourceOptions,\n DataSourceParams,\n DataSourceResponse,\n} from '../../../core';\nimport type {nullSymbol, undefinedSymbol} from '../../constants';\nimport {formatNullableValue} from '../../utils/formatNullableValue';\nimport {parseNullableValue} from '../../utils/parseNullableValue';\n\nimport type {AnyPlainQueryDataSource, QueryObserverExtendedOptions} from './types';\n\nexport const composeOptions = <TDataSource extends AnyPlainQueryDataSource>(\n context: DataSourceContext<TDataSource>,\n dataSource: TDataSource,\n params: DataSourceParams<TDataSource>,\n options?: Partial<DataSourceOptions<TDataSource>>,\n): QueryObserverExtendedOptions<\n DataSourceResponse<TDataSource>,\n DataSourceError<TDataSource>,\n DataSourceData<TDataSource>,\n DataSourceResponse<TDataSource>,\n DataSourceKey\n> => {\n const {transformParams, transformResponse} = dataSource;\n\n const queryFn = async (\n fetchContext: QueryFunctionContext<DataSourceKey>,\n ): Promise<DataSourceResponse<TDataSource> | typeof undefinedSymbol | typeof nullSymbol> => {\n const response = await dataSource.fetch(\n context,\n fetchContext,\n transformParams ? transformParams(params) : params,\n );\n\n return formatNullableValue(response);\n };\n\n const select = (\n response: DataSourceResponse<TDataSource> | typeof undefinedSymbol | typeof nullSymbol,\n ): DataSourceData<TDataSource> => {\n const actualResponse = parseNullableValue(response) as DataSourceData<TDataSource>;\n\n return transformResponse ? transformResponse(actualResponse) : actualResponse;\n };\n\n return {\n queryKey: composeFullKey(dataSource, params),\n queryFn: params === idle ? skipToken : queryFn,\n select,\n ...dataSource.options,\n ...options,\n };\n};\n"],"mappings":";;;AAAA,SAAmCA,SAAS,QAAO,uBAAuB;AAE1E,SAAQC,cAAc,EAAEC,IAAI,QAAO,eAAe;AAWlD,SAAQC,mBAAmB,QAAO,iCAAiC;AACnE,SAAQC,kBAAkB,QAAO,gCAAgC;AAIjE,OAAO,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CACvBC,OAAuC,EACvCC,UAAuB,EACvBC,MAAqC,EACrCC,OAAiD,EAOhD;EACD,IAAOC,eAAe,GAAuBH,UAAU,CAAhDG,eAAe;IAAEC,iBAAiB,GAAIJ,UAAU,CAA/BI,iBAAiB;EAEzC,IAAMC,OAAO;IAAA,IAAAC,IAAA,GAAAC,iBAAA,cAAAC,mBAAA,GAAAC,IAAA,CAAG,SAAAC,QACZC,YAAiD;MAAA,IAAAC,QAAA;MAAA,OAAAJ,mBAAA,GAAAK,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YAAAF,QAAA,CAAAE,IAAA;YAAA,OAE1BjB,UAAU,CAACkB,KAAK,CACnCnB,OAAO,EACPY,YAAY,EACZR,eAAe,GAAGA,eAAe,CAACF,MAAM,CAAC,GAAGA,MAChD,CAAC;UAAA;YAJKW,QAAQ,GAAAG,QAAA,CAAAI,IAAA;YAAA,OAAAJ,QAAA,CAAAK,MAAA,WAMPxB,mBAAmB,CAACgB,QAAQ,CAAC;UAAA;UAAA;YAAA,OAAAG,QAAA,CAAAM,IAAA;QAAA;MAAA,GAAAX,OAAA;IAAA,CACvC;IAAA,gBAVKL,OAAOA,CAAAiB,EAAA;MAAA,OAAAhB,IAAA,CAAAiB,KAAA,OAAAC,SAAA;IAAA;EAAA,GAUZ;EAED,IAAMC,MAAM,GAAG,SAATA,MAAMA,CACRb,QAAsF,EACxD;IAC9B,IAAMc,cAAc,GAAG7B,kBAAkB,CAACe,QAAQ,CAAgC;IAElF,OAAOR,iBAAiB,GAAGA,iBAAiB,CAACsB,cAAc,CAAC,GAAGA,cAAc;EACjF,CAAC;EAED,OAAAC,aAAA,CAAAA,aAAA;IACIC,QAAQ,
|
|
1
|
+
{"version":3,"names":["skipToken","composeFullKey","idle","formatNullableValue","parseNullableValue","composeOptions","context","dataSource","params","options","transformParams","transformResponse","queryFn","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","fetchContext","response","wrap","_callee$","_context","prev","next","fetch","sent","abrupt","stop","_x","apply","arguments","select","actualResponse","meta","invalidate","optimistic","_objectSpread","queryKey"],"sources":["utils.ts"],"sourcesContent":["import {type QueryFunctionContext, skipToken} from '@tanstack/react-query';\n\nimport {composeFullKey, idle} from '../../../core';\nimport type {\n DataSourceContext,\n DataSourceData,\n DataSourceError,\n DataSourceKey,\n DataSourceOptions,\n DataSourceParams,\n DataSourceResponse,\n} from '../../../core';\nimport type {nullSymbol, undefinedSymbol} from '../../constants';\nimport {formatNullableValue} from '../../utils/formatNullableValue';\nimport {parseNullableValue} from '../../utils/parseNullableValue';\n\nimport type {AnyPlainQueryDataSource, QueryObserverExtendedOptions} from './types';\n\nexport const composeOptions = <TDataSource extends AnyPlainQueryDataSource>(\n context: DataSourceContext<TDataSource>,\n dataSource: TDataSource,\n params: DataSourceParams<TDataSource>,\n options?: Partial<DataSourceOptions<TDataSource>>,\n): QueryObserverExtendedOptions<\n DataSourceResponse<TDataSource>,\n DataSourceError<TDataSource>,\n DataSourceData<TDataSource>,\n DataSourceResponse<TDataSource>,\n DataSourceKey\n> => {\n const {transformParams, transformResponse} = dataSource;\n\n const queryFn = async (\n fetchContext: QueryFunctionContext<DataSourceKey>,\n ): Promise<DataSourceResponse<TDataSource> | typeof undefinedSymbol | typeof nullSymbol> => {\n const response = await dataSource.fetch(\n context,\n fetchContext,\n transformParams ? transformParams(params) : params,\n );\n\n return formatNullableValue(response);\n };\n\n const select = (\n response: DataSourceResponse<TDataSource> | typeof undefinedSymbol | typeof nullSymbol,\n ): DataSourceData<TDataSource> => {\n const actualResponse = parseNullableValue(response) as DataSourceData<TDataSource>;\n\n return transformResponse ? transformResponse(actualResponse) : actualResponse;\n };\n\n const meta = {\n invalidate: options?.invalidate,\n optimistic: options?.optimistic,\n };\n\n return {\n queryKey: composeFullKey(dataSource, params),\n queryFn: params === idle ? skipToken : queryFn,\n select,\n meta,\n ...dataSource.options,\n ...options,\n };\n};\n"],"mappings":";;;AAAA,SAAmCA,SAAS,QAAO,uBAAuB;AAE1E,SAAQC,cAAc,EAAEC,IAAI,QAAO,eAAe;AAWlD,SAAQC,mBAAmB,QAAO,iCAAiC;AACnE,SAAQC,kBAAkB,QAAO,gCAAgC;AAIjE,OAAO,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CACvBC,OAAuC,EACvCC,UAAuB,EACvBC,MAAqC,EACrCC,OAAiD,EAOhD;EACD,IAAOC,eAAe,GAAuBH,UAAU,CAAhDG,eAAe;IAAEC,iBAAiB,GAAIJ,UAAU,CAA/BI,iBAAiB;EAEzC,IAAMC,OAAO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M;IACNE,IAAI,EAAJA;EAAI,GACD3B,UAAU,CAACE,OAAO,GAClBA,OAAO;AAElB,CAAC","ignoreList":[]}
|
|
@@ -16,3 +16,5 @@ export type { ProgressiveRefetchOptions } from './utils/getProgressiveRefetch';
|
|
|
16
16
|
export { getProgressiveRefetch } from './utils/getProgressiveRefetch';
|
|
17
17
|
export type { ClientDataManagerConfig } from './ClientDataManager';
|
|
18
18
|
export { ClientDataManager } from './ClientDataManager';
|
|
19
|
+
export { DataSourceProvider } from './DataSourceProvider';
|
|
20
|
+
export type { QueryNormalizer } from './types/normalizer';
|
|
@@ -10,4 +10,5 @@ export { composeOptions as composePlainQueryOptions } from './impl/plain/utils';
|
|
|
10
10
|
export { normalizeStatus } from './utils/normalizeStatus';
|
|
11
11
|
export { getProgressiveRefetch } from './utils/getProgressiveRefetch';
|
|
12
12
|
export { ClientDataManager } from './ClientDataManager';
|
|
13
|
+
export { DataSourceProvider } from './DataSourceProvider';
|
|
13
14
|
// #sourceMappingURL=index.js.map
|
|
@@ -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 {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":[]}
|
|
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":"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;AAErD,SAAQC,kBAAkB,QAAO,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Data, NormalizedData } from '@normy/core/types/types';
|
|
2
|
+
export interface QueryNormalizer {
|
|
3
|
+
/** Get normalized data */
|
|
4
|
+
getNormalizedData: () => NormalizedData;
|
|
5
|
+
/** Set normalized data (for manual updates, WebSocket, etc.) */
|
|
6
|
+
setNormalizedData: (data: Data) => void;
|
|
7
|
+
/** Clear all normalized data */
|
|
8
|
+
clear: () => void;
|
|
9
|
+
/** Get object by ID */
|
|
10
|
+
getObjectById: <T extends Data>(id: string, exampleObject?: T) => T | undefined;
|
|
11
|
+
/** Get query fragment */
|
|
12
|
+
getQueryFragment: <T extends Data>(fragment: Data, exampleObject?: T) => T | undefined;
|
|
13
|
+
/** Get dependent queries by data */
|
|
14
|
+
getDependentQueries: (mutationData: Data) => ReadonlyArray<readonly unknown[]>;
|
|
15
|
+
/** Get dependent queries by IDs */
|
|
16
|
+
getDependentQueriesByIds: (ids: ReadonlyArray<string>) => ReadonlyArray<readonly unknown[]>;
|
|
17
|
+
/** Subscribe to QueryCache changes */
|
|
18
|
+
subscribe: () => void;
|
|
19
|
+
/** Unsubscribe from QueryCache changes */
|
|
20
|
+
unsubscribe: () => void;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["normalizer.ts"],"sourcesContent":["import type {Data, NormalizedData} from '@normy/core/types/types';\n\nexport interface QueryNormalizer {\n /** Get normalized data */\n getNormalizedData: () => NormalizedData;\n /** Set normalized data (for manual updates, WebSocket, etc.) */\n setNormalizedData: (data: Data) => void;\n /** Clear all normalized data */\n clear: () => void;\n /** Get object by ID */\n getObjectById: <T extends Data>(id: string, exampleObject?: T) => T | undefined;\n /** Get query fragment */\n getQueryFragment: <T extends Data>(fragment: Data, exampleObject?: T) => T | undefined;\n /** Get dependent queries by data */\n getDependentQueries: (mutationData: Data) => ReadonlyArray<readonly unknown[]>;\n /** Get dependent queries by IDs */\n getDependentQueriesByIds: (ids: ReadonlyArray<string>) => ReadonlyArray<readonly unknown[]>;\n /** Subscribe to QueryCache changes */\n subscribe: () => void;\n /** Unsubscribe from QueryCache changes */\n unsubscribe: () => void;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import type { DefaultError, QueryKey } from '@tanstack/react-query';
|
|
2
|
+
import type { OptimisticConfig } from '../../core/types/Normalizer';
|
|
2
3
|
import type { RefetchInterval } from './refetch-interval';
|
|
3
4
|
export interface QueryDataAdditionalOptions<TQueryFnData = unknown, TError = DefaultError, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> {
|
|
4
5
|
refetchInterval?: RefetchInterval<TQueryFnData, TError, TQueryData, TQueryKey>;
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated The use of the enabled option is deprecated.
|
|
8
|
+
* It is recommended to use idle as query parameters to control query state.
|
|
9
|
+
*/
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
/** Normalization configuration (enable/disable) */
|
|
12
|
+
normalize?: boolean;
|
|
13
|
+
/** Optimistic data update configuration */
|
|
14
|
+
optimistic?: boolean | OptimisticConfig;
|
|
15
|
+
/** Invalidate data configuration */
|
|
16
|
+
invalidate?: boolean;
|
|
5
17
|
}
|
|
@@ -1 +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
|
+
{"version":3,"names":[],"sources":["options.ts"],"sourcesContent":["import type {DefaultError, QueryKey} from '@tanstack/react-query';\n\nimport type {OptimisticConfig} from '../../core/types/Normalizer';\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 * @deprecated The use of the enabled option is deprecated.\n * It is recommended to use idle as query parameters to control query state.\n */\n enabled?: boolean;\n /** Normalization configuration (enable/disable) */\n normalize?: boolean;\n /** Optimistic data update configuration */\n optimistic?: boolean | OptimisticConfig;\n /** Invalidate data configuration */\n invalidate?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import '@tanstack/react-query';
|
|
2
|
+
|
|
3
|
+
import type {OptimisticConfig} from '../../core/types/Normalizer';
|
|
4
|
+
|
|
5
|
+
declare module '@tanstack/react-query' {
|
|
6
|
+
interface Register {
|
|
7
|
+
queryMeta: {
|
|
8
|
+
optimistic?: boolean | OptimisticConfig;
|
|
9
|
+
invalidate?: boolean;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
import { createNormalizer } from '@normy/core';
|
|
3
|
+
import { checkMutationObjectsKeys } from '../checkMutationObjectsKeys';
|
|
4
|
+
var createMockNormalizer = function createMockNormalizer(objects) {
|
|
5
|
+
var normalizer = createNormalizer({});
|
|
6
|
+
|
|
7
|
+
// Manually set normalized data for testing
|
|
8
|
+
Object.keys(objects).forEach(function (key) {
|
|
9
|
+
var id = key.replace('@@', '');
|
|
10
|
+
// Use object as-is, id is already included in objects[key]
|
|
11
|
+
normalizer.setQuery("test-".concat(id), objects[key]);
|
|
12
|
+
});
|
|
13
|
+
return normalizer;
|
|
14
|
+
};
|
|
15
|
+
describe('checkMutationObjectsKeys', function () {
|
|
16
|
+
describe('when mutation data has no normalizable objects', function () {
|
|
17
|
+
it('should return needsRefetch: false for primitive values', function () {
|
|
18
|
+
var normalizer = createMockNormalizer({});
|
|
19
|
+
var result = checkMutationObjectsKeys('string value', normalizer);
|
|
20
|
+
expect(result).toEqual({
|
|
21
|
+
needsRefetch: false,
|
|
22
|
+
details: []
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
it('should return needsRefetch: false for null', function () {
|
|
26
|
+
var normalizer = createMockNormalizer({});
|
|
27
|
+
var result = checkMutationObjectsKeys(null, normalizer);
|
|
28
|
+
expect(result).toEqual({
|
|
29
|
+
needsRefetch: false,
|
|
30
|
+
details: []
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
it('should return needsRefetch: false for empty array', function () {
|
|
34
|
+
var normalizer = createMockNormalizer({});
|
|
35
|
+
var result = checkMutationObjectsKeys([], normalizer);
|
|
36
|
+
expect(result).toEqual({
|
|
37
|
+
needsRefetch: false,
|
|
38
|
+
details: []
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
it('should return needsRefetch: false for object without id', function () {
|
|
42
|
+
var normalizer = createMockNormalizer({});
|
|
43
|
+
var result = checkMutationObjectsKeys({
|
|
44
|
+
name: 'test'
|
|
45
|
+
}, normalizer);
|
|
46
|
+
expect(result).toEqual({
|
|
47
|
+
needsRefetch: false,
|
|
48
|
+
details: []
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
describe('when mutation object is not in normalized store', function () {
|
|
53
|
+
it('should return needsRefetch: false for new object', function () {
|
|
54
|
+
var normalizer = createMockNormalizer({});
|
|
55
|
+
var result = checkMutationObjectsKeys({
|
|
56
|
+
id: 'new-id',
|
|
57
|
+
name: 'test'
|
|
58
|
+
}, normalizer);
|
|
59
|
+
expect(result).toEqual({
|
|
60
|
+
needsRefetch: false,
|
|
61
|
+
details: []
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
describe('when mutation has same keys as normalized data', function () {
|
|
66
|
+
it('should return needsRefetch: false for identical keys', function () {
|
|
67
|
+
var normalizer = createMockNormalizer({
|
|
68
|
+
'@@1': {
|
|
69
|
+
id: '1',
|
|
70
|
+
name: 'test',
|
|
71
|
+
value: 100
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
var result = checkMutationObjectsKeys({
|
|
75
|
+
id: '1',
|
|
76
|
+
name: 'updated',
|
|
77
|
+
value: 200
|
|
78
|
+
}, normalizer);
|
|
79
|
+
expect(result).toEqual({
|
|
80
|
+
needsRefetch: false,
|
|
81
|
+
details: []
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
it('should return needsRefetch: false when keys are same but in different order', function () {
|
|
85
|
+
var normalizer = createMockNormalizer({
|
|
86
|
+
'@@1': {
|
|
87
|
+
id: '1',
|
|
88
|
+
a: 1,
|
|
89
|
+
b: 2,
|
|
90
|
+
c: 3
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
var result = checkMutationObjectsKeys({
|
|
94
|
+
c: 30,
|
|
95
|
+
a: 10,
|
|
96
|
+
b: 20,
|
|
97
|
+
id: '1'
|
|
98
|
+
}, normalizer);
|
|
99
|
+
expect(result).toEqual({
|
|
100
|
+
needsRefetch: false,
|
|
101
|
+
details: []
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
describe('when mutation has fewer keys than normalized data', function () {
|
|
106
|
+
it('should return needsRefetch: true with missing keys', function () {
|
|
107
|
+
var normalizer = createMockNormalizer({
|
|
108
|
+
'@@1': {
|
|
109
|
+
id: '1',
|
|
110
|
+
name: 'test',
|
|
111
|
+
email: 'test@example.com',
|
|
112
|
+
age: 25
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
var result = checkMutationObjectsKeys({
|
|
116
|
+
id: '1',
|
|
117
|
+
name: 'updated'
|
|
118
|
+
}, normalizer);
|
|
119
|
+
expect(result.needsRefetch).toBe(true);
|
|
120
|
+
expect(result.details).toHaveLength(1);
|
|
121
|
+
expect(result.details[0].id).toBe('1');
|
|
122
|
+
expect(result.details[0].missingKeys).toContain('email');
|
|
123
|
+
expect(result.details[0].missingKeys).toContain('age');
|
|
124
|
+
});
|
|
125
|
+
it('should return needsRefetch: true when only id is present', function () {
|
|
126
|
+
var normalizer = createMockNormalizer({
|
|
127
|
+
'@@1': {
|
|
128
|
+
id: '1',
|
|
129
|
+
field1: 'a',
|
|
130
|
+
field2: 'b',
|
|
131
|
+
field3: 'c'
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
var result = checkMutationObjectsKeys({
|
|
135
|
+
id: '1'
|
|
136
|
+
}, normalizer);
|
|
137
|
+
expect(result.needsRefetch).toBe(true);
|
|
138
|
+
expect(result.details[0].missingKeys).toEqual(expect.arrayContaining(['field1', 'field2', 'field3']));
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
describe('when mutation has different keys than normalized data', function () {
|
|
142
|
+
it('should return needsRefetch: true when mutation has fewer keys even if some are different', function () {
|
|
143
|
+
var normalizer = createMockNormalizer({
|
|
144
|
+
'@@1': {
|
|
145
|
+
id: '1',
|
|
146
|
+
oldField: 'old',
|
|
147
|
+
anotherField: 'value'
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// Mutation has fewer keys (2 vs 3), so needsRefetch should be true
|
|
152
|
+
var result = checkMutationObjectsKeys({
|
|
153
|
+
id: '1',
|
|
154
|
+
newField: 'new'
|
|
155
|
+
}, normalizer);
|
|
156
|
+
expect(result.needsRefetch).toBe(true);
|
|
157
|
+
expect(result.details[0].missingKeys).toContain('oldField');
|
|
158
|
+
expect(result.details[0].missingKeys).toContain('anotherField');
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
describe('with array of objects', function () {
|
|
162
|
+
it('should check all objects in array', function () {
|
|
163
|
+
var normalizer = createMockNormalizer({
|
|
164
|
+
'@@1': {
|
|
165
|
+
id: '1',
|
|
166
|
+
name: 'first',
|
|
167
|
+
extra: 'data'
|
|
168
|
+
},
|
|
169
|
+
'@@2': {
|
|
170
|
+
id: '2',
|
|
171
|
+
name: 'second',
|
|
172
|
+
extra: 'data'
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
var result = checkMutationObjectsKeys([{
|
|
176
|
+
id: '1',
|
|
177
|
+
name: 'updated'
|
|
178
|
+
}, {
|
|
179
|
+
id: '2',
|
|
180
|
+
name: 'updated'
|
|
181
|
+
}], normalizer);
|
|
182
|
+
expect(result.needsRefetch).toBe(true);
|
|
183
|
+
expect(result.details).toHaveLength(2);
|
|
184
|
+
expect(result.details[0].id).toBe('1');
|
|
185
|
+
expect(result.details[1].id).toBe('2');
|
|
186
|
+
});
|
|
187
|
+
it('should handle nested arrays', function () {
|
|
188
|
+
var normalizer = createMockNormalizer({
|
|
189
|
+
'@@1': {
|
|
190
|
+
id: '1',
|
|
191
|
+
field: 'a',
|
|
192
|
+
extra: 'b'
|
|
193
|
+
},
|
|
194
|
+
'@@2': {
|
|
195
|
+
id: '2',
|
|
196
|
+
field: 'c',
|
|
197
|
+
extra: 'd'
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
var result = checkMutationObjectsKeys([[{
|
|
201
|
+
id: '1',
|
|
202
|
+
field: 'updated'
|
|
203
|
+
}], [{
|
|
204
|
+
id: '2',
|
|
205
|
+
field: 'updated'
|
|
206
|
+
}]], normalizer);
|
|
207
|
+
expect(result.needsRefetch).toBe(true);
|
|
208
|
+
expect(result.details).toHaveLength(2);
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
describe('with custom getNormalizationObjectKey', function () {
|
|
212
|
+
it('should use custom key function', function () {
|
|
213
|
+
var normalizer = createNormalizer({
|
|
214
|
+
getNormalizationObjectKey: function getNormalizationObjectKey(obj) {
|
|
215
|
+
return obj && _typeof(obj) === 'object' && '_id' in obj ? String(obj._id) : undefined;
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
// Set query with custom key
|
|
220
|
+
normalizer.setQuery('test', {
|
|
221
|
+
_id: 'custom-1',
|
|
222
|
+
name: 'test',
|
|
223
|
+
extra: 'field'
|
|
224
|
+
});
|
|
225
|
+
var result = checkMutationObjectsKeys({
|
|
226
|
+
_id: 'custom-1',
|
|
227
|
+
name: 'updated'
|
|
228
|
+
}, normalizer, {
|
|
229
|
+
getNormalizationObjectKey: function getNormalizationObjectKey(obj) {
|
|
230
|
+
return '_id' in obj ? String(obj._id) : undefined;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
expect(result.needsRefetch).toBe(true);
|
|
234
|
+
expect(result.details[0].id).toBe('custom-1');
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
describe('edge cases', function () {
|
|
238
|
+
it('should handle object with undefined id', function () {
|
|
239
|
+
var normalizer = createMockNormalizer({});
|
|
240
|
+
var result = checkMutationObjectsKeys({
|
|
241
|
+
id: undefined,
|
|
242
|
+
name: 'test'
|
|
243
|
+
}, normalizer);
|
|
244
|
+
expect(result).toEqual({
|
|
245
|
+
needsRefetch: false,
|
|
246
|
+
details: []
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
it('should handle object with numeric id', function () {
|
|
250
|
+
var normalizer = createMockNormalizer({
|
|
251
|
+
'@@123': {
|
|
252
|
+
id: '123',
|
|
253
|
+
value: 'test',
|
|
254
|
+
extra: 'field'
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
var result = checkMutationObjectsKeys({
|
|
258
|
+
id: '123',
|
|
259
|
+
value: 'updated'
|
|
260
|
+
}, normalizer);
|
|
261
|
+
expect(result.needsRefetch).toBe(true);
|
|
262
|
+
});
|
|
263
|
+
it('should handle large number of objects', function () {
|
|
264
|
+
var objects = {};
|
|
265
|
+
var mutationData = [];
|
|
266
|
+
for (var i = 0; i < 100; i++) {
|
|
267
|
+
objects["@@".concat(i)] = {
|
|
268
|
+
id: String(i),
|
|
269
|
+
name: "item-".concat(i),
|
|
270
|
+
extra: 'field'
|
|
271
|
+
};
|
|
272
|
+
mutationData.push({
|
|
273
|
+
id: String(i),
|
|
274
|
+
name: "updated-".concat(i)
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
var normalizer = createMockNormalizer(objects);
|
|
278
|
+
var result = checkMutationObjectsKeys(mutationData, normalizer);
|
|
279
|
+
expect(result.needsRefetch).toBe(true);
|
|
280
|
+
expect(result.details).toHaveLength(100);
|
|
281
|
+
});
|
|
282
|
+
it('should handle empty object', function () {
|
|
283
|
+
var normalizer = createMockNormalizer({});
|
|
284
|
+
var result = checkMutationObjectsKeys({}, normalizer);
|
|
285
|
+
expect(result).toEqual({
|
|
286
|
+
needsRefetch: false,
|
|
287
|
+
details: []
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
// #sourceMappingURL=checkMutationObjectsKeys.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createNormalizer","checkMutationObjectsKeys","createMockNormalizer","objects","normalizer","Object","keys","forEach","key","id","replace","setQuery","concat","describe","it","result","expect","toEqual","needsRefetch","details","name","value","a","b","c","email","age","toBe","toHaveLength","missingKeys","toContain","field1","field2","field3","arrayContaining","oldField","anotherField","newField","extra","field","getNormalizationObjectKey","obj","_typeof","String","_id","undefined","mutationData","i","push"],"sources":["checkMutationObjectsKeys.test.ts"],"sourcesContent":["import type {Data} from '@normy/core';\nimport {createNormalizer} from '@normy/core';\n\nimport {checkMutationObjectsKeys} from '../checkMutationObjectsKeys';\n\nconst createMockNormalizer = (objects: Record<string, Record<string, unknown>>) => {\n const normalizer = createNormalizer({});\n\n // Manually set normalized data for testing\n Object.keys(objects).forEach((key) => {\n const id = key.replace('@@', '');\n // Use object as-is, id is already included in objects[key]\n normalizer.setQuery(`test-${id}`, objects[key] as Data);\n });\n\n return normalizer;\n};\n\ndescribe('checkMutationObjectsKeys', () => {\n describe('when mutation data has no normalizable objects', () => {\n it('should return needsRefetch: false for primitive values', () => {\n const normalizer = createMockNormalizer({});\n\n const result = checkMutationObjectsKeys('string value', normalizer);\n\n expect(result).toEqual({\n needsRefetch: false,\n details: [],\n });\n });\n\n it('should return needsRefetch: false for null', () => {\n const normalizer = createMockNormalizer({});\n\n const result = checkMutationObjectsKeys(null, normalizer);\n\n expect(result).toEqual({\n needsRefetch: false,\n details: [],\n });\n });\n\n it('should return needsRefetch: false for empty array', () => {\n const normalizer = createMockNormalizer({});\n\n const result = checkMutationObjectsKeys([], normalizer);\n\n expect(result).toEqual({\n needsRefetch: false,\n details: [],\n });\n });\n\n it('should return needsRefetch: false for object without id', () => {\n const normalizer = createMockNormalizer({});\n\n const result = checkMutationObjectsKeys({name: 'test'}, normalizer);\n\n expect(result).toEqual({\n needsRefetch: false,\n details: [],\n });\n });\n });\n\n describe('when mutation object is not in normalized store', () => {\n it('should return needsRefetch: false for new object', () => {\n const normalizer = createMockNormalizer({});\n\n const result = checkMutationObjectsKeys({id: 'new-id', name: 'test'}, normalizer);\n\n expect(result).toEqual({\n needsRefetch: false,\n details: [],\n });\n });\n });\n\n describe('when mutation has same keys as normalized data', () => {\n it('should return needsRefetch: false for identical keys', () => {\n const normalizer = createMockNormalizer({\n '@@1': {id: '1', name: 'test', value: 100},\n });\n\n const result = checkMutationObjectsKeys(\n {id: '1', name: 'updated', value: 200},\n normalizer,\n );\n\n expect(result).toEqual({\n needsRefetch: false,\n details: [],\n });\n });\n\n it('should return needsRefetch: false when keys are same but in different order', () => {\n const normalizer = createMockNormalizer({\n '@@1': {id: '1', a: 1, b: 2, c: 3},\n });\n\n const result = checkMutationObjectsKeys({c: 30, a: 10, b: 20, id: '1'}, normalizer);\n\n expect(result).toEqual({\n needsRefetch: false,\n details: [],\n });\n });\n });\n\n describe('when mutation has fewer keys than normalized data', () => {\n it('should return needsRefetch: true with missing keys', () => {\n const normalizer = createMockNormalizer({\n '@@1': {id: '1', name: 'test', email: 'test@example.com', age: 25},\n });\n\n const result = checkMutationObjectsKeys({id: '1', name: 'updated'}, normalizer);\n\n expect(result.needsRefetch).toBe(true);\n expect(result.details).toHaveLength(1);\n expect(result.details[0].id).toBe('1');\n expect(result.details[0].missingKeys).toContain('email');\n expect(result.details[0].missingKeys).toContain('age');\n });\n\n it('should return needsRefetch: true when only id is present', () => {\n const normalizer = createMockNormalizer({\n '@@1': {id: '1', field1: 'a', field2: 'b', field3: 'c'},\n });\n\n const result = checkMutationObjectsKeys({id: '1'}, normalizer);\n\n expect(result.needsRefetch).toBe(true);\n expect(result.details[0].missingKeys).toEqual(\n expect.arrayContaining(['field1', 'field2', 'field3']),\n );\n });\n });\n\n describe('when mutation has different keys than normalized data', () => {\n it('should return needsRefetch: true when mutation has fewer keys even if some are different', () => {\n const normalizer = createMockNormalizer({\n '@@1': {id: '1', oldField: 'old', anotherField: 'value'},\n });\n\n // Mutation has fewer keys (2 vs 3), so needsRefetch should be true\n const result = checkMutationObjectsKeys({id: '1', newField: 'new'}, normalizer);\n\n expect(result.needsRefetch).toBe(true);\n expect(result.details[0].missingKeys).toContain('oldField');\n expect(result.details[0].missingKeys).toContain('anotherField');\n });\n });\n\n describe('with array of objects', () => {\n it('should check all objects in array', () => {\n const normalizer = createMockNormalizer({\n '@@1': {id: '1', name: 'first', extra: 'data'},\n '@@2': {id: '2', name: 'second', extra: 'data'},\n });\n\n const result = checkMutationObjectsKeys(\n [\n {id: '1', name: 'updated'},\n {id: '2', name: 'updated'},\n ],\n normalizer,\n );\n\n expect(result.needsRefetch).toBe(true);\n expect(result.details).toHaveLength(2);\n expect(result.details[0].id).toBe('1');\n expect(result.details[1].id).toBe('2');\n });\n\n it('should handle nested arrays', () => {\n const normalizer = createMockNormalizer({\n '@@1': {id: '1', field: 'a', extra: 'b'},\n '@@2': {id: '2', field: 'c', extra: 'd'},\n });\n\n const result = checkMutationObjectsKeys(\n [[{id: '1', field: 'updated'}], [{id: '2', field: 'updated'}]],\n normalizer,\n );\n\n expect(result.needsRefetch).toBe(true);\n expect(result.details).toHaveLength(2);\n });\n });\n\n describe('with custom getNormalizationObjectKey', () => {\n it('should use custom key function', () => {\n const normalizer = createNormalizer({\n getNormalizationObjectKey: (obj) =>\n obj && typeof obj === 'object' && '_id' in obj\n ? String((obj as {_id: unknown})._id)\n : undefined,\n });\n\n // Set query with custom key\n normalizer.setQuery('test', {_id: 'custom-1', name: 'test', extra: 'field'});\n\n const result = checkMutationObjectsKeys(\n {_id: 'custom-1', name: 'updated'},\n normalizer,\n {\n getNormalizationObjectKey: (obj) =>\n '_id' in obj ? String(obj._id) : undefined,\n },\n );\n\n expect(result.needsRefetch).toBe(true);\n expect(result.details[0].id).toBe('custom-1');\n });\n });\n\n describe('edge cases', () => {\n it('should handle object with undefined id', () => {\n const normalizer = createMockNormalizer({});\n\n const result = checkMutationObjectsKeys({id: undefined, name: 'test'}, normalizer);\n\n expect(result).toEqual({\n needsRefetch: false,\n details: [],\n });\n });\n\n it('should handle object with numeric id', () => {\n const normalizer = createMockNormalizer({\n '@@123': {id: '123', value: 'test', extra: 'field'},\n });\n\n const result = checkMutationObjectsKeys({id: '123', value: 'updated'}, normalizer);\n\n expect(result.needsRefetch).toBe(true);\n });\n\n it('should handle large number of objects', () => {\n const objects: Record<string, Record<string, unknown>> = {};\n const mutationData: Array<{id: string; name: string}> = [];\n\n for (let i = 0; i < 100; i++) {\n objects[`@@${i}`] = {id: String(i), name: `item-${i}`, extra: 'field'};\n mutationData.push({id: String(i), name: `updated-${i}`});\n }\n\n const normalizer = createMockNormalizer(objects);\n\n const result = checkMutationObjectsKeys(mutationData, normalizer);\n\n expect(result.needsRefetch).toBe(true);\n expect(result.details).toHaveLength(100);\n });\n\n it('should handle empty object', () => {\n const normalizer = createMockNormalizer({});\n\n const result = checkMutationObjectsKeys({}, normalizer);\n\n expect(result).toEqual({\n needsRefetch: false,\n details: [],\n });\n });\n });\n});\n"],"mappings":";AACA,SAAQA,gBAAgB,QAAO,aAAa;AAE5C,SAAQC,wBAAwB,QAAO,6BAA6B;AAEpE,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAIC,OAAgD,EAAK;EAC/E,IAAMC,UAAU,GAAGJ,gBAAgB,CAAC,CAAC,CAAC,CAAC;;EAEvC;EACAK,MAAM,CAACC,IAAI,CAACH,OAAO,CAAC,CAACI,OAAO,CAAC,UAACC,GAAG,EAAK;IAClC,IAAMC,EAAE,GAAGD,GAAG,CA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