@astral/mobx-query 1.13.1 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AuxiliaryQuery/AuxiliaryQuery.js +1 -1
- package/InfiniteQuery/InfiniteQuery.d.ts +4 -4
- package/MobxQuery/MobxQuery.d.ts +2 -2
- package/MobxQuery/MobxQuery.js +7 -9
- package/Mutation/Mutation.d.ts +1 -1
- package/Query/Query.d.ts +1 -1
- package/QueryContainer/QueryContainer.d.ts +7 -0
- package/QueryContainer/QueryContainer.js +9 -0
- package/README.md +13 -1
- package/Sets/InfiniteQuerySet/InfiniteQuerySet.d.ts +1 -1
- package/Sets/QuerySet/QuerySet.d.ts +2 -2
- package/Sets/index.d.ts +1 -1
- package/Sets/index.js +1 -1
- package/Sets/utils/index.d.ts +1 -1
- package/Sets/utils/index.js +1 -1
- package/index.d.ts +4 -4
- package/index.js +2 -2
- package/node/AuxiliaryQuery/AuxiliaryQuery.js +1 -1
- package/node/InfiniteQuery/InfiniteQuery.d.ts +4 -4
- package/node/MobxQuery/MobxQuery.d.ts +2 -2
- package/node/MobxQuery/MobxQuery.js +7 -9
- package/node/Mutation/Mutation.d.ts +1 -1
- package/node/Query/Query.d.ts +1 -1
- package/node/QueryContainer/QueryContainer.d.ts +7 -0
- package/node/QueryContainer/QueryContainer.js +9 -0
- package/node/Sets/InfiniteQuerySet/InfiniteQuerySet.d.ts +1 -1
- package/node/Sets/QuerySet/QuerySet.d.ts +2 -2
- package/node/Sets/index.d.ts +1 -1
- package/node/Sets/index.js +1 -1
- package/node/Sets/utils/index.d.ts +1 -1
- package/node/Sets/utils/index.js +1 -1
- package/node/index.d.ts +4 -4
- package/node/index.js +5 -5
- package/package.json +1 -1
|
@@ -24,7 +24,7 @@ export class AuxiliaryQuery {
|
|
|
24
24
|
*/
|
|
25
25
|
this.getUnifiedPromise = (executor, onSuccess) => {
|
|
26
26
|
// проверяем, если синглтона нет, то надо создать
|
|
27
|
-
if (!
|
|
27
|
+
if (!this.unifiedPromise) {
|
|
28
28
|
this.startLoading();
|
|
29
29
|
this.unifiedPromise = executor()
|
|
30
30
|
.then((resData) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { FetchPolicy, QueryBaseActions, Sync, SyncParams } from '../types';
|
|
2
1
|
import { AuxiliaryQuery } from '../AuxiliaryQuery';
|
|
3
2
|
import type { DataStorage } from '../DataStorage';
|
|
4
3
|
import { QueryContainer } from '../QueryContainer';
|
|
5
4
|
import { type StatusStorage } from '../StatusStorage';
|
|
5
|
+
import type { FetchPolicy, QueryBaseActions, Sync, SyncParams } from '../types';
|
|
6
6
|
export declare const DEFAULT_INFINITE_ITEMS_COUNT = 30;
|
|
7
7
|
export type InfiniteParams = {
|
|
8
8
|
offset: number;
|
|
@@ -16,7 +16,7 @@ export type InfiniteDataStorage<TResult> = DataStorage<{
|
|
|
16
16
|
* Исполнитель запроса, ожидается,
|
|
17
17
|
* что будет использоваться что-то возвращающее массив данных
|
|
18
18
|
*/
|
|
19
|
-
export type InfiniteExecutor<TResult> = (params: InfiniteParams) => Promise<
|
|
19
|
+
export type InfiniteExecutor<TResult> = (params: InfiniteParams) => Promise<TResult[]>;
|
|
20
20
|
export type InfiniteQueryParams<TResult, TError, TIsBackground extends boolean = false> = {
|
|
21
21
|
/**
|
|
22
22
|
* Количество запрашиваемых элементов
|
|
@@ -58,7 +58,7 @@ export type InfiniteQueryParams<TResult, TError, TIsBackground extends boolean =
|
|
|
58
58
|
* Квери для работы с инфинити запросами,
|
|
59
59
|
* которые должны быть закешированы,
|
|
60
60
|
*/
|
|
61
|
-
export declare class InfiniteQuery<TResult, TError = void, TIsBackground extends boolean = false> extends QueryContainer<TError, AuxiliaryQuery<
|
|
61
|
+
export declare class InfiniteQuery<TResult, TError = void, TIsBackground extends boolean = false> extends QueryContainer<TError, AuxiliaryQuery<TResult[], TError>, TIsBackground> implements QueryBaseActions<TResult[], TError> {
|
|
62
62
|
private readonly executor;
|
|
63
63
|
/**
|
|
64
64
|
* Количество запрашиваемых элементов
|
|
@@ -117,7 +117,7 @@ export declare class InfiniteQuery<TResult, TError = void, TIsBackground extends
|
|
|
117
117
|
/**
|
|
118
118
|
* Синхронный метод получения данных
|
|
119
119
|
*/
|
|
120
|
-
sync: Sync<
|
|
120
|
+
sync: Sync<TResult[], TError>;
|
|
121
121
|
/**
|
|
122
122
|
* Метод для переиспользования синхронной логики запроса
|
|
123
123
|
*/
|
package/MobxQuery/MobxQuery.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Query, type QueryExecutor, type QueryParams } from '../Query';
|
|
2
1
|
import { type InfiniteExecutor, InfiniteQuery, type InfiniteQueryParams } from '../InfiniteQuery';
|
|
3
2
|
import { Mutation, type MutationExecutor, type MutationParams } from '../Mutation';
|
|
4
|
-
import
|
|
3
|
+
import { Query, type QueryExecutor, type QueryParams } from '../Query';
|
|
5
4
|
import { InfiniteQuerySet, type InfiniteQuerySetConfig, type InfiniteQuerySetConfigurator, MutationSet, QuerySet, type QuerySetConfig, type QuerySetConfigurator } from '../Sets';
|
|
5
|
+
import type { CacheKey, FetchPolicy } from '../types';
|
|
6
6
|
/**
|
|
7
7
|
* Стандартный обработчик ошибки запроса,
|
|
8
8
|
* будет вызван, если при вызове sync не был передан отдельный onError параметр
|
package/MobxQuery/MobxQuery.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AdaptableMap } from '../AdaptableMap';
|
|
2
|
+
import { DataStorageFactory } from '../DataStorage';
|
|
2
3
|
import { InfiniteQuery, } from '../InfiniteQuery';
|
|
3
4
|
import { Mutation, } from '../Mutation';
|
|
4
|
-
import {
|
|
5
|
-
import { StatusStorageFactory } from '../StatusStorage';
|
|
6
|
-
import { AdaptableMap } from '../AdaptableMap';
|
|
5
|
+
import { Query } from '../Query';
|
|
7
6
|
import { InfiniteQuerySet, MutationSet, QuerySet, } from '../Sets';
|
|
7
|
+
import { StatusStorageFactory } from '../StatusStorage';
|
|
8
8
|
/**
|
|
9
9
|
* Сервис, позволяющий кэшировать данные.
|
|
10
10
|
*/
|
|
@@ -108,7 +108,7 @@ export class MobxQuery {
|
|
|
108
108
|
onError: ((createParams === null || createParams === void 0 ? void 0 : createParams.onError) ||
|
|
109
109
|
this.defaultErrorHandler),
|
|
110
110
|
enabledAutoFetch: (_b = createParams === null || createParams === void 0 ? void 0 : createParams.enabledAutoFetch) !== null && _b !== void 0 ? _b : this.defaultEnabledAutoFetch,
|
|
111
|
-
fetchPolicy
|
|
111
|
+
fetchPolicy,
|
|
112
112
|
dataStorage: this.queryDataStorageFactory.getStorage(keys.dataKeyHash),
|
|
113
113
|
statusStorage: this.statusStorageFactory.getStorage(keys.statusKeyHash),
|
|
114
114
|
backgroundStatusStorage: this.getBackgroundStatusStorage(keys.backgroundStatusKeyHash, Boolean(createParams === null || createParams === void 0 ? void 0 : createParams.isBackground)),
|
|
@@ -186,8 +186,7 @@ export class MobxQuery {
|
|
|
186
186
|
*
|
|
187
187
|
* docQuery.data // { data: [id, count] }
|
|
188
188
|
*/
|
|
189
|
-
// any нужен для вывода типов
|
|
190
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
189
|
+
// biome-ignore lint/suspicious/noExplicitAny: any нужен для вывода типов
|
|
191
190
|
this.createQuerySet = (configurator, config) => new QuerySet(this, configurator, config);
|
|
192
191
|
/**
|
|
193
192
|
* Создает набор infinite queries под одним ключем
|
|
@@ -203,8 +202,7 @@ export class MobxQuery {
|
|
|
203
202
|
*
|
|
204
203
|
* docListInfiniteQuery.data
|
|
205
204
|
*/
|
|
206
|
-
// any нужен для вывода типов
|
|
207
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
205
|
+
// biome-ignore lint/suspicious/noExplicitAny: any нужен для вывода типов
|
|
208
206
|
this.createInfiniteQuerySet = (configurator, config) => new InfiniteQuerySet(this, configurator, config);
|
|
209
207
|
/**
|
|
210
208
|
* Создает набор мутаций для единого интерфейса с query sets
|
package/Mutation/Mutation.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AuxiliaryQuery } from '../AuxiliaryQuery';
|
|
2
|
-
import type { QueryBaseActions, Sync, SyncParams } from '../types';
|
|
3
2
|
import { QueryContainer } from '../QueryContainer';
|
|
3
|
+
import type { QueryBaseActions, Sync, SyncParams } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Исполнитель запроса
|
|
6
6
|
*/
|
package/Query/Query.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AuxiliaryQuery } from '../AuxiliaryQuery';
|
|
2
|
-
import type { FetchPolicy, QueryBaseActions, Sync, SyncParams } from '../types';
|
|
3
2
|
import type { DataStorage } from '../DataStorage';
|
|
4
3
|
import { QueryContainer } from '../QueryContainer';
|
|
5
4
|
import { type StatusStorage } from '../StatusStorage';
|
|
5
|
+
import type { FetchPolicy, QueryBaseActions, Sync, SyncParams } from '../types';
|
|
6
6
|
/**
|
|
7
7
|
* Исполнитель запроса
|
|
8
8
|
*/
|
|
@@ -32,6 +32,13 @@ export declare abstract class QueryContainer<TError, TAuxiliary extends QueryCon
|
|
|
32
32
|
* Флаг, обозначающий простаивание, т.е. запроса еще не было
|
|
33
33
|
*/
|
|
34
34
|
get isIdle(): boolean;
|
|
35
|
+
get status(): {
|
|
36
|
+
isLoading: boolean;
|
|
37
|
+
isError: boolean;
|
|
38
|
+
error: TError | undefined;
|
|
39
|
+
isSuccess: boolean;
|
|
40
|
+
isIdle: boolean;
|
|
41
|
+
};
|
|
35
42
|
/**
|
|
36
43
|
* Статусы, изменяющиеся после первого успешного запроса в режиме isBackground: true
|
|
37
44
|
* @example
|
|
@@ -46,6 +46,15 @@ export class QueryContainer {
|
|
|
46
46
|
get isIdle() {
|
|
47
47
|
return this.auxiliary.isIdle;
|
|
48
48
|
}
|
|
49
|
+
get status() {
|
|
50
|
+
return {
|
|
51
|
+
isLoading: this.isLoading,
|
|
52
|
+
isError: this.isError,
|
|
53
|
+
error: this.error,
|
|
54
|
+
isSuccess: this.isSuccess,
|
|
55
|
+
isIdle: this.isIdle,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
49
58
|
/**
|
|
50
59
|
* Статусы, изменяющиеся после первого успешного запроса в режиме isBackground: true
|
|
51
60
|
* @example
|
package/README.md
CHANGED
|
@@ -137,6 +137,10 @@ class DocStore {
|
|
|
137
137
|
public get isLoading() {
|
|
138
138
|
return this.docQuery.isLoading;
|
|
139
139
|
}
|
|
140
|
+
|
|
141
|
+
public get status() {
|
|
142
|
+
return this.docQuery.status;
|
|
143
|
+
}
|
|
140
144
|
}
|
|
141
145
|
```
|
|
142
146
|
|
|
@@ -824,12 +828,20 @@ export type Query<TResult = unknown, TError = unknown, TIsBackground = boolean>
|
|
|
824
828
|
/**
|
|
825
829
|
* Текущая ошибка
|
|
826
830
|
*/
|
|
827
|
-
error: TError |
|
|
831
|
+
error: TError | undefined;
|
|
828
832
|
|
|
829
833
|
/**
|
|
830
834
|
* Флаг, обозначающий простаивание, т.е. запроса еще не было
|
|
831
835
|
*/
|
|
832
836
|
isIdle: boolean;
|
|
837
|
+
|
|
838
|
+
status: {
|
|
839
|
+
isLoading: boolean;
|
|
840
|
+
isSuccess: boolean;
|
|
841
|
+
isError: boolean;
|
|
842
|
+
error: TError | undefined;
|
|
843
|
+
isIdle: boolean;
|
|
844
|
+
}
|
|
833
845
|
|
|
834
846
|
/**
|
|
835
847
|
* Синхронизирует данные с сервером
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type DeepPartial } from 'utility-types';
|
|
2
|
-
import { type CacheKey } from '../../types';
|
|
3
2
|
import { type InfiniteParams, type InfiniteQuery } from '../../InfiniteQuery';
|
|
4
3
|
import { type CreateInfiniteQueryParams, type MobxQuery } from '../../MobxQuery';
|
|
4
|
+
import { type CacheKey } from '../../types';
|
|
5
5
|
export type InfiniteQuerySetConfig = {
|
|
6
6
|
name?: string;
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type DeepPartial } from 'utility-types';
|
|
2
|
-
import { type CacheKey } from '../../types';
|
|
3
|
-
import { type Query } from '../../Query';
|
|
4
2
|
import { type CreateQueryParams, type MobxQuery } from '../../MobxQuery';
|
|
3
|
+
import { type Query } from '../../Query';
|
|
4
|
+
import { type CacheKey } from '../../types';
|
|
5
5
|
export type QuerySetConfig = {
|
|
6
6
|
name?: string;
|
|
7
7
|
};
|
package/Sets/index.d.ts
CHANGED
package/Sets/index.js
CHANGED
package/Sets/utils/index.d.ts
CHANGED
package/Sets/utils/index.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
export { type InfiniteParams, InfiniteQuery } from './InfiniteQuery';
|
|
2
|
+
export { type CreateInfiniteQueryParams, type CreateMutationParams, type CreateQueryParams, MobxQuery, } from './MobxQuery';
|
|
1
3
|
export { Mutation } from './Mutation';
|
|
2
4
|
export { Query } from './Query';
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
5
|
-
export { type QuerySet, type InfiniteQuerySet, type MutationSet } from './Sets';
|
|
6
|
-
export { type CacheKey, type FetchPolicy } from './types';
|
|
5
|
+
export type { InfiniteQuerySet, MutationSet, QuerySet } from './Sets';
|
|
6
|
+
export type { CacheKey, FetchPolicy } from './types';
|
package/index.js
CHANGED
|
@@ -27,7 +27,7 @@ class AuxiliaryQuery {
|
|
|
27
27
|
*/
|
|
28
28
|
this.getUnifiedPromise = (executor, onSuccess) => {
|
|
29
29
|
// проверяем, если синглтона нет, то надо создать
|
|
30
|
-
if (!
|
|
30
|
+
if (!this.unifiedPromise) {
|
|
31
31
|
this.startLoading();
|
|
32
32
|
this.unifiedPromise = executor()
|
|
33
33
|
.then((resData) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { FetchPolicy, QueryBaseActions, Sync, SyncParams } from '../types';
|
|
2
1
|
import { AuxiliaryQuery } from '../AuxiliaryQuery';
|
|
3
2
|
import type { DataStorage } from '../DataStorage';
|
|
4
3
|
import { QueryContainer } from '../QueryContainer';
|
|
5
4
|
import { type StatusStorage } from '../StatusStorage';
|
|
5
|
+
import type { FetchPolicy, QueryBaseActions, Sync, SyncParams } from '../types';
|
|
6
6
|
export declare const DEFAULT_INFINITE_ITEMS_COUNT = 30;
|
|
7
7
|
export type InfiniteParams = {
|
|
8
8
|
offset: number;
|
|
@@ -16,7 +16,7 @@ export type InfiniteDataStorage<TResult> = DataStorage<{
|
|
|
16
16
|
* Исполнитель запроса, ожидается,
|
|
17
17
|
* что будет использоваться что-то возвращающее массив данных
|
|
18
18
|
*/
|
|
19
|
-
export type InfiniteExecutor<TResult> = (params: InfiniteParams) => Promise<
|
|
19
|
+
export type InfiniteExecutor<TResult> = (params: InfiniteParams) => Promise<TResult[]>;
|
|
20
20
|
export type InfiniteQueryParams<TResult, TError, TIsBackground extends boolean = false> = {
|
|
21
21
|
/**
|
|
22
22
|
* Количество запрашиваемых элементов
|
|
@@ -58,7 +58,7 @@ export type InfiniteQueryParams<TResult, TError, TIsBackground extends boolean =
|
|
|
58
58
|
* Квери для работы с инфинити запросами,
|
|
59
59
|
* которые должны быть закешированы,
|
|
60
60
|
*/
|
|
61
|
-
export declare class InfiniteQuery<TResult, TError = void, TIsBackground extends boolean = false> extends QueryContainer<TError, AuxiliaryQuery<
|
|
61
|
+
export declare class InfiniteQuery<TResult, TError = void, TIsBackground extends boolean = false> extends QueryContainer<TError, AuxiliaryQuery<TResult[], TError>, TIsBackground> implements QueryBaseActions<TResult[], TError> {
|
|
62
62
|
private readonly executor;
|
|
63
63
|
/**
|
|
64
64
|
* Количество запрашиваемых элементов
|
|
@@ -117,7 +117,7 @@ export declare class InfiniteQuery<TResult, TError = void, TIsBackground extends
|
|
|
117
117
|
/**
|
|
118
118
|
* Синхронный метод получения данных
|
|
119
119
|
*/
|
|
120
|
-
sync: Sync<
|
|
120
|
+
sync: Sync<TResult[], TError>;
|
|
121
121
|
/**
|
|
122
122
|
* Метод для переиспользования синхронной логики запроса
|
|
123
123
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Query, type QueryExecutor, type QueryParams } from '../Query';
|
|
2
1
|
import { type InfiniteExecutor, InfiniteQuery, type InfiniteQueryParams } from '../InfiniteQuery';
|
|
3
2
|
import { Mutation, type MutationExecutor, type MutationParams } from '../Mutation';
|
|
4
|
-
import
|
|
3
|
+
import { Query, type QueryExecutor, type QueryParams } from '../Query';
|
|
5
4
|
import { InfiniteQuerySet, type InfiniteQuerySetConfig, type InfiniteQuerySetConfigurator, MutationSet, QuerySet, type QuerySetConfig, type QuerySetConfigurator } from '../Sets';
|
|
5
|
+
import type { CacheKey, FetchPolicy } from '../types';
|
|
6
6
|
/**
|
|
7
7
|
* Стандартный обработчик ошибки запроса,
|
|
8
8
|
* будет вызван, если при вызове sync не был передан отдельный onError параметр
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MobxQuery = void 0;
|
|
4
|
-
const
|
|
4
|
+
const AdaptableMap_1 = require("../AdaptableMap");
|
|
5
|
+
const DataStorage_1 = require("../DataStorage");
|
|
5
6
|
const InfiniteQuery_1 = require("../InfiniteQuery");
|
|
6
7
|
const Mutation_1 = require("../Mutation");
|
|
7
|
-
const
|
|
8
|
-
const StatusStorage_1 = require("../StatusStorage");
|
|
9
|
-
const AdaptableMap_1 = require("../AdaptableMap");
|
|
8
|
+
const Query_1 = require("../Query");
|
|
10
9
|
const Sets_1 = require("../Sets");
|
|
10
|
+
const StatusStorage_1 = require("../StatusStorage");
|
|
11
11
|
/**
|
|
12
12
|
* Сервис, позволяющий кэшировать данные.
|
|
13
13
|
*/
|
|
@@ -111,7 +111,7 @@ class MobxQuery {
|
|
|
111
111
|
onError: ((createParams === null || createParams === void 0 ? void 0 : createParams.onError) ||
|
|
112
112
|
this.defaultErrorHandler),
|
|
113
113
|
enabledAutoFetch: (_b = createParams === null || createParams === void 0 ? void 0 : createParams.enabledAutoFetch) !== null && _b !== void 0 ? _b : this.defaultEnabledAutoFetch,
|
|
114
|
-
fetchPolicy
|
|
114
|
+
fetchPolicy,
|
|
115
115
|
dataStorage: this.queryDataStorageFactory.getStorage(keys.dataKeyHash),
|
|
116
116
|
statusStorage: this.statusStorageFactory.getStorage(keys.statusKeyHash),
|
|
117
117
|
backgroundStatusStorage: this.getBackgroundStatusStorage(keys.backgroundStatusKeyHash, Boolean(createParams === null || createParams === void 0 ? void 0 : createParams.isBackground)),
|
|
@@ -189,8 +189,7 @@ class MobxQuery {
|
|
|
189
189
|
*
|
|
190
190
|
* docQuery.data // { data: [id, count] }
|
|
191
191
|
*/
|
|
192
|
-
// any нужен для вывода типов
|
|
193
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
192
|
+
// biome-ignore lint/suspicious/noExplicitAny: any нужен для вывода типов
|
|
194
193
|
this.createQuerySet = (configurator, config) => new Sets_1.QuerySet(this, configurator, config);
|
|
195
194
|
/**
|
|
196
195
|
* Создает набор infinite queries под одним ключем
|
|
@@ -206,8 +205,7 @@ class MobxQuery {
|
|
|
206
205
|
*
|
|
207
206
|
* docListInfiniteQuery.data
|
|
208
207
|
*/
|
|
209
|
-
// any нужен для вывода типов
|
|
210
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
208
|
+
// biome-ignore lint/suspicious/noExplicitAny: any нужен для вывода типов
|
|
211
209
|
this.createInfiniteQuerySet = (configurator, config) => new Sets_1.InfiniteQuerySet(this, configurator, config);
|
|
212
210
|
/**
|
|
213
211
|
* Создает набор мутаций для единого интерфейса с query sets
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AuxiliaryQuery } from '../AuxiliaryQuery';
|
|
2
|
-
import type { QueryBaseActions, Sync, SyncParams } from '../types';
|
|
3
2
|
import { QueryContainer } from '../QueryContainer';
|
|
3
|
+
import type { QueryBaseActions, Sync, SyncParams } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Исполнитель запроса
|
|
6
6
|
*/
|
package/node/Query/Query.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AuxiliaryQuery } from '../AuxiliaryQuery';
|
|
2
|
-
import type { FetchPolicy, QueryBaseActions, Sync, SyncParams } from '../types';
|
|
3
2
|
import type { DataStorage } from '../DataStorage';
|
|
4
3
|
import { QueryContainer } from '../QueryContainer';
|
|
5
4
|
import { type StatusStorage } from '../StatusStorage';
|
|
5
|
+
import type { FetchPolicy, QueryBaseActions, Sync, SyncParams } from '../types';
|
|
6
6
|
/**
|
|
7
7
|
* Исполнитель запроса
|
|
8
8
|
*/
|
|
@@ -32,6 +32,13 @@ export declare abstract class QueryContainer<TError, TAuxiliary extends QueryCon
|
|
|
32
32
|
* Флаг, обозначающий простаивание, т.е. запроса еще не было
|
|
33
33
|
*/
|
|
34
34
|
get isIdle(): boolean;
|
|
35
|
+
get status(): {
|
|
36
|
+
isLoading: boolean;
|
|
37
|
+
isError: boolean;
|
|
38
|
+
error: TError | undefined;
|
|
39
|
+
isSuccess: boolean;
|
|
40
|
+
isIdle: boolean;
|
|
41
|
+
};
|
|
35
42
|
/**
|
|
36
43
|
* Статусы, изменяющиеся после первого успешного запроса в режиме isBackground: true
|
|
37
44
|
* @example
|
|
@@ -49,6 +49,15 @@ class QueryContainer {
|
|
|
49
49
|
get isIdle() {
|
|
50
50
|
return this.auxiliary.isIdle;
|
|
51
51
|
}
|
|
52
|
+
get status() {
|
|
53
|
+
return {
|
|
54
|
+
isLoading: this.isLoading,
|
|
55
|
+
isError: this.isError,
|
|
56
|
+
error: this.error,
|
|
57
|
+
isSuccess: this.isSuccess,
|
|
58
|
+
isIdle: this.isIdle,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
52
61
|
/**
|
|
53
62
|
* Статусы, изменяющиеся после первого успешного запроса в режиме isBackground: true
|
|
54
63
|
* @example
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type DeepPartial } from 'utility-types';
|
|
2
|
-
import { type CacheKey } from '../../types';
|
|
3
2
|
import { type InfiniteParams, type InfiniteQuery } from '../../InfiniteQuery';
|
|
4
3
|
import { type CreateInfiniteQueryParams, type MobxQuery } from '../../MobxQuery';
|
|
4
|
+
import { type CacheKey } from '../../types';
|
|
5
5
|
export type InfiniteQuerySetConfig = {
|
|
6
6
|
name?: string;
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type DeepPartial } from 'utility-types';
|
|
2
|
-
import { type CacheKey } from '../../types';
|
|
3
|
-
import { type Query } from '../../Query';
|
|
4
2
|
import { type CreateQueryParams, type MobxQuery } from '../../MobxQuery';
|
|
3
|
+
import { type Query } from '../../Query';
|
|
4
|
+
import { type CacheKey } from '../../types';
|
|
5
5
|
export type QuerySetConfig = {
|
|
6
6
|
name?: string;
|
|
7
7
|
};
|
package/node/Sets/index.d.ts
CHANGED
package/node/Sets/index.js
CHANGED
|
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./InfiniteQuerySet"), exports);
|
|
17
18
|
__exportStar(require("./MutationSet"), exports);
|
|
18
19
|
__exportStar(require("./QuerySet"), exports);
|
|
19
|
-
__exportStar(require("./InfiniteQuerySet"), exports);
|
package/node/Sets/utils/index.js
CHANGED
|
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./generateQuerySetKeys"), exports);
|
|
18
17
|
__exportStar(require("./generateQuerySetBaseKey"), exports);
|
|
18
|
+
__exportStar(require("./generateQuerySetKeys"), exports);
|
package/node/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
export { type InfiniteParams, InfiniteQuery } from './InfiniteQuery';
|
|
2
|
+
export { type CreateInfiniteQueryParams, type CreateMutationParams, type CreateQueryParams, MobxQuery, } from './MobxQuery';
|
|
1
3
|
export { Mutation } from './Mutation';
|
|
2
4
|
export { Query } from './Query';
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
5
|
-
export { type QuerySet, type InfiniteQuerySet, type MutationSet } from './Sets';
|
|
6
|
-
export { type CacheKey, type FetchPolicy } from './types';
|
|
5
|
+
export type { InfiniteQuerySet, MutationSet, QuerySet } from './Sets';
|
|
6
|
+
export type { CacheKey, FetchPolicy } from './types';
|
package/node/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var Mutation_1 = require("./Mutation");
|
|
5
|
-
Object.defineProperty(exports, "Mutation", { enumerable: true, get: function () { return Mutation_1.Mutation; } });
|
|
6
|
-
var Query_1 = require("./Query");
|
|
7
|
-
Object.defineProperty(exports, "Query", { enumerable: true, get: function () { return Query_1.Query; } });
|
|
3
|
+
exports.Query = exports.Mutation = exports.MobxQuery = exports.InfiniteQuery = void 0;
|
|
8
4
|
var InfiniteQuery_1 = require("./InfiniteQuery");
|
|
9
5
|
Object.defineProperty(exports, "InfiniteQuery", { enumerable: true, get: function () { return InfiniteQuery_1.InfiniteQuery; } });
|
|
10
6
|
var MobxQuery_1 = require("./MobxQuery");
|
|
11
7
|
Object.defineProperty(exports, "MobxQuery", { enumerable: true, get: function () { return MobxQuery_1.MobxQuery; } });
|
|
8
|
+
var Mutation_1 = require("./Mutation");
|
|
9
|
+
Object.defineProperty(exports, "Mutation", { enumerable: true, get: function () { return Mutation_1.Mutation; } });
|
|
10
|
+
var Query_1 = require("./Query");
|
|
11
|
+
Object.defineProperty(exports, "Query", { enumerable: true, get: function () { return Query_1.Query; } });
|