@astral/mobx-query 1.3.0 → 1.3.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.
@@ -1,4 +1,4 @@
1
- import { CacheKey } from '../types';
1
+ import type { CacheKey } from '../types';
2
2
  /**
3
3
  * @description хранилище данных, предназначено для обеспечения единого интерфейса при работе с данными
4
4
  */
@@ -1,5 +1,5 @@
1
- import { FetchPolicy, QueryBaseActions, Sync, SyncParams } from '../types';
2
- import { DataStorage } from '../DataStorage';
1
+ import type { FetchPolicy, QueryBaseActions, Sync, SyncParams } from '../types';
2
+ import type { DataStorage } from '../DataStorage';
3
3
  export declare const DEFAULT_INFINITE_ITEMS_COUNT = 30;
4
4
  export type InfiniteParams = {
5
5
  offset: number;
@@ -1,7 +1,10 @@
1
- import { Query, QueryExecutor, QueryParams } from '../Query';
2
- import { InfiniteExecutor, InfiniteQuery, InfiniteQueryParams } from '../InfiniteQuery';
3
- import { Mutation, MutationExecutor, MutationParams } from '../Mutation';
4
- import { CacheKey, FetchPolicy } from '../types';
1
+ import type { QueryExecutor, QueryParams } from '../Query';
2
+ import { Query } from '../Query';
3
+ import type { InfiniteExecutor, InfiniteQueryParams } from '../InfiniteQuery';
4
+ import { InfiniteQuery } from '../InfiniteQuery';
5
+ import type { MutationExecutor, MutationParams } from '../Mutation';
6
+ import { Mutation } from '../Mutation';
7
+ import type { CacheKey, FetchPolicy } from '../types';
5
8
  /**
6
9
  * @description стандартный обработчик ошибки запроса,
7
10
  * будет вызван, если при вызове sync не был передан отдельный onError параметр
@@ -1,5 +1,5 @@
1
1
  import { Query } from '../Query';
2
- import { InfiniteQuery, } from '../InfiniteQuery';
2
+ import { InfiniteQuery } from '../InfiniteQuery';
3
3
  import { Mutation } from '../Mutation';
4
4
  import { DataStorageFactory } from '../DataStorage';
5
5
  /**
@@ -95,8 +95,11 @@ export class MobxQuery {
95
95
  */
96
96
  this.createInfiniteQuery = (key, executor, params) => {
97
97
  const fetchPolicy = (params === null || params === void 0 ? void 0 : params.fetchPolicy) || this.defaultFetchPolicy || '';
98
- return this.getCachedQuery(key, () => new InfiniteQuery(executor, Object.assign(Object.assign({}, params), { onError: ((params === null || params === void 0 ? void 0 : params.onError) ||
99
- this.defaultErrorHandler), enabledAutoFetch: (params === null || params === void 0 ? void 0 : params.enabledAutoFetch) || this.defaultEnabledAutoFetch, dataStorage: this.infiniteQueryDataStorageFactory.getStorage(key), fetchPolicy: fetchPolicy })), fetchPolicy);
98
+ return this.getCachedQuery(key, () => {
99
+ var _a;
100
+ return new InfiniteQuery(executor, Object.assign(Object.assign({}, params), { onError: ((params === null || params === void 0 ? void 0 : params.onError) ||
101
+ this.defaultErrorHandler), enabledAutoFetch: (_a = params === null || params === void 0 ? void 0 : params.enabledAutoFetch) !== null && _a !== void 0 ? _a : this.defaultEnabledAutoFetch, dataStorage: this.infiniteQueryDataStorageFactory.getStorage(key), fetchPolicy: fetchPolicy }));
102
+ }, fetchPolicy);
100
103
  };
101
104
  /**
102
105
  * @description метод создания мутации, не кешируется
@@ -1,4 +1,4 @@
1
- import { QueryBaseActions, Sync, SyncParams } from '../types';
1
+ import type { QueryBaseActions, Sync, SyncParams } from '../types';
2
2
  /**
3
3
  * @description исполнитель запроса
4
4
  */
package/Query/Query.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { FetchPolicy, QueryBaseActions, Sync, SyncParams } from '../types';
2
- import { DataStorage } from '../DataStorage';
1
+ import type { FetchPolicy, QueryBaseActions, Sync, SyncParams } from '../types';
2
+ import type { DataStorage } from '../DataStorage';
3
3
  /**
4
4
  * @description исполнитель запроса
5
5
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/mobx-query",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "browser": "./index.js",
5
5
  "main": "./index.js",
6
6
  "dependencies": {