@daffodil/core 0.94.1-rc.0 → 0.95.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/fesm2022/daffodil-core-external-script-testing.mjs +42 -56
- package/fesm2022/daffodil-core-external-script-testing.mjs.map +1 -1
- package/fesm2022/daffodil-core-external-script.mjs +77 -95
- package/fesm2022/daffodil-core-external-script.mjs.map +1 -1
- package/fesm2022/daffodil-core-graphql.mjs +94 -145
- package/fesm2022/daffodil-core-graphql.mjs.map +1 -1
- package/fesm2022/daffodil-core-routing.mjs +53 -85
- package/fesm2022/daffodil-core-routing.mjs.map +1 -1
- package/fesm2022/daffodil-core-state-testing.mjs +90 -62
- package/fesm2022/daffodil-core-state-testing.mjs.map +1 -1
- package/fesm2022/daffodil-core-state.mjs +282 -456
- package/fesm2022/daffodil-core-state.mjs.map +1 -1
- package/fesm2022/daffodil-core-testing.mjs +1077 -657
- package/fesm2022/daffodil-core-testing.mjs.map +1 -1
- package/fesm2022/daffodil-core.mjs +720 -1342
- package/fesm2022/daffodil-core.mjs.map +1 -1
- package/package.json +1 -1
- package/types/daffodil-core-external-script-testing.d.ts +14 -18
- package/types/daffodil-core-external-script.d.ts +42 -47
- package/types/daffodil-core-graphql.d.ts +35 -51
- package/types/daffodil-core-routing.d.ts +40 -51
- package/types/daffodil-core-state-testing.d.ts +31 -35
- package/types/daffodil-core-state.d.ts +429 -465
- package/types/daffodil-core-testing.d.ts +220 -245
- package/types/daffodil-core.d.ts +518 -641
|
@@ -1,265 +1,253 @@
|
|
|
1
|
-
import { Action, MemoizedSelector,
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import * as _ngrx_entity from '@ngrx/entity';
|
|
6
|
-
import { EntityAdapter, EntityState } from '@ngrx/entity';
|
|
7
|
-
|
|
1
|
+
import { Action, ActionReducer, MemoizedSelector, MetaReducer, Selector, Store, StoreConfig } from "@ngrx/store";
|
|
2
|
+
import { DaffCollectionMetadata, DaffCollectionRequest, DaffError, DaffFilterRequest, DaffFilterToggleRequest, DaffFilters, DaffIdentifiable, DaffMultiInjectionToken, DaffSingleInjectionToken, DaffSortDirectionEnum, DaffSortOption } from "@daffodil/core";
|
|
3
|
+
import { Observable } from "rxjs";
|
|
4
|
+
import { EntityAdapter, EntityState } from "@ngrx/entity";
|
|
8
5
|
/**
|
|
9
6
|
* An error object that can be serialized in state.
|
|
10
7
|
*/
|
|
11
|
-
interface DaffStateError {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
8
|
+
export interface DaffStateError {
|
|
9
|
+
/**
|
|
10
|
+
* The error code that uniquely identifies the type of error.
|
|
11
|
+
*/
|
|
12
|
+
code: string;
|
|
13
|
+
/**
|
|
14
|
+
* A message that describes the error.
|
|
15
|
+
*/
|
|
16
|
+
message: string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the error is non-critical and recoverable or catastrophic and unrecoverable.
|
|
19
|
+
* This field is optional. If omitted, the error is assumed to be unrecoverable.
|
|
20
|
+
*/
|
|
21
|
+
recoverable?: boolean;
|
|
25
22
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
readonly payload: DaffStateError[];
|
|
23
|
+
export interface DaffFailable {
|
|
24
|
+
/**
|
|
25
|
+
* A list of errors that occured during the operation.
|
|
26
|
+
*/
|
|
27
|
+
readonly payload: DaffStateError[];
|
|
32
28
|
}
|
|
33
29
|
/**
|
|
34
30
|
* An action that represents a failure of an operation.
|
|
35
31
|
*/
|
|
36
|
-
interface DaffFailureAction extends DaffFailable, Action {
|
|
37
|
-
}
|
|
38
|
-
|
|
32
|
+
export interface DaffFailureAction extends DaffFailable, Action {}
|
|
39
33
|
/**
|
|
40
34
|
* An action for changing the number of items shown on each page for this collection.
|
|
41
35
|
*/
|
|
42
|
-
interface DaffCollectionChangePageSize extends Action {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
export interface DaffCollectionChangePageSize extends Action {
|
|
37
|
+
/**
|
|
38
|
+
* The number of items per page.
|
|
39
|
+
*/
|
|
40
|
+
readonly pageSize: DaffCollectionMetadata['pageSize'];
|
|
47
41
|
}
|
|
48
42
|
/**
|
|
49
43
|
* An action for changing the current page of items for this collection.
|
|
50
44
|
*/
|
|
51
|
-
interface DaffCollectionChangeCurrentPage extends Action {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
export interface DaffCollectionChangeCurrentPage extends Action {
|
|
46
|
+
/**
|
|
47
|
+
* The current page of items for this collection.
|
|
48
|
+
*/
|
|
49
|
+
readonly currentPage: DaffCollectionMetadata['currentPage'];
|
|
56
50
|
}
|
|
57
51
|
/**
|
|
58
52
|
* An action for changing the sorting option for this collection.
|
|
59
53
|
*/
|
|
60
|
-
interface DaffCollectionChangeSortingOption extends Action {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
54
|
+
export interface DaffCollectionChangeSortingOption extends Action {
|
|
55
|
+
/**
|
|
56
|
+
* The sort option to be applied.
|
|
57
|
+
*/
|
|
58
|
+
readonly sort: {
|
|
59
|
+
option: DaffCollectionMetadata['appliedSortOption'];
|
|
60
|
+
direction: DaffCollectionMetadata['appliedSortDirection'];
|
|
61
|
+
};
|
|
68
62
|
}
|
|
69
63
|
/**
|
|
70
64
|
* An action for replacing the filters for the collection.
|
|
71
65
|
* All existing filters will be removed and the specified filters will be applied.
|
|
72
66
|
*/
|
|
73
|
-
interface DaffCollectionReplaceFilters extends Action {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
export interface DaffCollectionReplaceFilters extends Action {
|
|
68
|
+
/**
|
|
69
|
+
* Filters to be set on the collection.
|
|
70
|
+
*/
|
|
71
|
+
readonly filters: DaffFilterRequest[];
|
|
78
72
|
}
|
|
79
73
|
/**
|
|
80
74
|
* An action for applying the specified filters for the collection.
|
|
81
75
|
*/
|
|
82
|
-
interface DaffCollectionApplyFilters extends Action {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
76
|
+
export interface DaffCollectionApplyFilters extends Action {
|
|
77
|
+
/**
|
|
78
|
+
* Filters to be applied to the collection.
|
|
79
|
+
*/
|
|
80
|
+
readonly filters: DaffFilterRequest[];
|
|
87
81
|
}
|
|
88
82
|
/**
|
|
89
83
|
* An action for removing the specified filters for the collection.
|
|
90
84
|
*/
|
|
91
|
-
interface DaffCollectionRemoveFilters extends Action {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
85
|
+
export interface DaffCollectionRemoveFilters extends Action {
|
|
86
|
+
/**
|
|
87
|
+
* Filters to be removed from the collection.
|
|
88
|
+
*/
|
|
89
|
+
readonly filters: DaffFilterRequest[];
|
|
96
90
|
}
|
|
97
91
|
/**
|
|
98
92
|
* An action for removing all the filters for the collection.
|
|
99
93
|
*/
|
|
100
|
-
type DaffCollectionClearFilters = Action;
|
|
94
|
+
export type DaffCollectionClearFilters = Action;
|
|
101
95
|
/**
|
|
102
96
|
* An action for toggling a filters for the collection.
|
|
103
97
|
*/
|
|
104
|
-
interface DaffCollectionToggleFilter extends Action {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
export interface DaffCollectionToggleFilter extends Action {
|
|
99
|
+
/**
|
|
100
|
+
* Filter to be toggled on the collection.
|
|
101
|
+
*/
|
|
102
|
+
readonly filter: DaffFilterToggleRequest;
|
|
109
103
|
}
|
|
110
|
-
|
|
111
104
|
/**
|
|
112
105
|
* Provides an abstracted way to manage a collection state.
|
|
113
106
|
*/
|
|
114
|
-
declare class DaffCollectionStateAdapter<T extends DaffCollectionMetadata = DaffCollectionMetadata> {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
107
|
+
export declare class DaffCollectionStateAdapter<T extends DaffCollectionMetadata = DaffCollectionMetadata> {
|
|
108
|
+
/**
|
|
109
|
+
* Stores a collection request in state.
|
|
110
|
+
* This is useful when you want to preemptively reduce a request before waiting for a response.
|
|
111
|
+
*/
|
|
112
|
+
storeRequest(request: DaffCollectionRequest, state: T): T;
|
|
113
|
+
/**
|
|
114
|
+
* Sets the page size.
|
|
115
|
+
*/
|
|
116
|
+
setPageSize(size: number, state: T): T;
|
|
117
|
+
/**
|
|
118
|
+
* Sets the current page.
|
|
119
|
+
*/
|
|
120
|
+
setCurrentPage(page: number, state: T): T;
|
|
121
|
+
/**
|
|
122
|
+
* Sets the sorting option and direction.
|
|
123
|
+
*/
|
|
124
|
+
setSort(option: string, direction: string, state: T): T;
|
|
125
|
+
/**
|
|
126
|
+
* Sets the collection filters.
|
|
127
|
+
*/
|
|
128
|
+
setFilters(filters: DaffFilters, state: T): T;
|
|
129
|
+
/**
|
|
130
|
+
* Set the entire collection metadata at once.
|
|
131
|
+
*/
|
|
132
|
+
setMetadata(metadata: DaffCollectionMetadata, state: T): T;
|
|
140
133
|
}
|
|
141
134
|
/**
|
|
142
135
|
* Create the adapter for the collection state.
|
|
143
136
|
*/
|
|
144
|
-
declare const getCollectionStateAdapter: <T extends DaffCollectionMetadata = DaffCollectionMetadata>() => DaffCollectionStateAdapter<T>;
|
|
145
|
-
|
|
146
|
-
declare const daffCollectionReducerInitialState: DaffCollectionMetadata;
|
|
147
|
-
|
|
137
|
+
export declare const getCollectionStateAdapter: <T extends DaffCollectionMetadata = DaffCollectionMetadata>() => DaffCollectionStateAdapter<T>;
|
|
138
|
+
export declare const daffCollectionReducerInitialState: DaffCollectionMetadata;
|
|
148
139
|
/**
|
|
149
140
|
* An interface to describe all selectors related to the collection metadata.
|
|
150
141
|
*/
|
|
151
|
-
interface DaffCollectionMemoizedSelectors<TState, TMetadata extends DaffCollectionMetadata = DaffCollectionMetadata> {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
142
|
+
export interface DaffCollectionMemoizedSelectors<TState, TMetadata extends DaffCollectionMetadata = DaffCollectionMetadata> {
|
|
143
|
+
/**
|
|
144
|
+
* Selects the metadata for the collection.
|
|
145
|
+
*/
|
|
146
|
+
selectCollectionMetadata: MemoizedSelector<TState, TMetadata>;
|
|
147
|
+
/**
|
|
148
|
+
* Builds a request that matches the current collection.
|
|
149
|
+
*/
|
|
150
|
+
selectCollectionRequest: MemoizedSelector<TState, DaffCollectionRequest>;
|
|
151
|
+
/**
|
|
152
|
+
* Selects the total number of items of the collection.
|
|
153
|
+
*/
|
|
154
|
+
selectCollectionCount: MemoizedSelector<TState, TMetadata['count']>;
|
|
155
|
+
/**
|
|
156
|
+
* Selects the current page of items of the collection.
|
|
157
|
+
*/
|
|
158
|
+
selectCollectionCurrentPage: MemoizedSelector<TState, TMetadata['currentPage']>;
|
|
159
|
+
/**
|
|
160
|
+
* Selects the total number of pages of items that exist in the collection.
|
|
161
|
+
*/
|
|
162
|
+
selectCollectionTotalPages: MemoizedSelector<TState, TMetadata['totalPages']>;
|
|
163
|
+
/**
|
|
164
|
+
* Selects the number of items on each collection.
|
|
165
|
+
*/
|
|
166
|
+
selectCollectionPageSize: MemoizedSelector<TState, TMetadata['pageSize']>;
|
|
167
|
+
/**
|
|
168
|
+
* Selects the sort options that may be applied to the collection.
|
|
169
|
+
*/
|
|
170
|
+
selectCollectionSortOptions: MemoizedSelector<TState, TMetadata['sortOptions']['options']>;
|
|
171
|
+
/**
|
|
172
|
+
* Selects the applied sorting option if one is applied.
|
|
173
|
+
*/
|
|
174
|
+
selectCollectionAppliedSortOption: MemoizedSelector<TState, TMetadata['appliedSortOption']>;
|
|
175
|
+
/**
|
|
176
|
+
* Selects the applied sorting direction if a sorting option is applied.
|
|
177
|
+
*/
|
|
178
|
+
selectCollectionAppliedSortDirection: MemoizedSelector<TState, TMetadata['appliedSortDirection']>;
|
|
179
|
+
/**
|
|
180
|
+
* Selects the applied sorting direction if a sorting option is applied.
|
|
181
|
+
*/
|
|
182
|
+
selectCollectionIds: MemoizedSelector<TState, TMetadata['ids']>;
|
|
183
|
+
/**
|
|
184
|
+
* Selects the filters that may be applied to the collection.
|
|
185
|
+
*/
|
|
186
|
+
selectCollectionFilters: MemoizedSelector<TState, TMetadata['filters']>;
|
|
187
|
+
/**
|
|
188
|
+
* Returns a dict of filters and only their applied options.
|
|
189
|
+
* Filters with no applied options will be omitted.
|
|
190
|
+
*/
|
|
191
|
+
selectCollectionAppliedFilters: MemoizedSelector<TState, DaffFilters>;
|
|
201
192
|
}
|
|
202
193
|
/**
|
|
203
194
|
* Creates collection selectors.
|
|
204
195
|
*
|
|
205
196
|
* @param selectCollectionState A selector for the particular collection state upon which the returned selectors should operate.
|
|
206
197
|
*/
|
|
207
|
-
declare const daffCollectionSelectorFactory: <TState, TMetadata extends DaffCollectionMetadata = DaffCollectionMetadata>(selectCollectionState: MemoizedSelector<TState, TMetadata>) => DaffCollectionMemoizedSelectors<TState, TMetadata>;
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
dispatch(action: T): any;
|
|
198
|
+
export declare const daffCollectionSelectorFactory: <TState, TMetadata extends DaffCollectionMetadata = DaffCollectionMetadata>(selectCollectionState: MemoizedSelector<TState, TMetadata>) => DaffCollectionMemoizedSelectors<TState, TMetadata>;
|
|
199
|
+
export interface DaffStoreFacade<T> {
|
|
200
|
+
dispatch(action: T): any;
|
|
211
201
|
}
|
|
212
|
-
|
|
213
202
|
/**
|
|
214
203
|
* A facade for interacting with a collection state.
|
|
215
204
|
*/
|
|
216
|
-
interface DaffCollectionFacadeInterface<TMetadata extends DaffCollectionMetadata = DaffCollectionMetadata> extends DaffStoreFacade<Action> {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
205
|
+
export interface DaffCollectionFacadeInterface<TMetadata extends DaffCollectionMetadata = DaffCollectionMetadata> extends DaffStoreFacade<Action> {
|
|
206
|
+
/**
|
|
207
|
+
* The page metadata for the collection.
|
|
208
|
+
*/
|
|
209
|
+
metadata$: Observable<TMetadata>;
|
|
210
|
+
/**
|
|
211
|
+
* Builds a request that matches the current collection.
|
|
212
|
+
*/
|
|
213
|
+
request$: Observable<DaffCollectionRequest>;
|
|
214
|
+
/**
|
|
215
|
+
* The number of items in the collection.
|
|
216
|
+
*/
|
|
217
|
+
count$: Observable<number>;
|
|
218
|
+
/**
|
|
219
|
+
* The current page of items for the collection.
|
|
220
|
+
*/
|
|
221
|
+
currentPage$: Observable<number>;
|
|
222
|
+
/**
|
|
223
|
+
* The number of pages of items available in the collection.
|
|
224
|
+
*/
|
|
225
|
+
totalPages$: Observable<number>;
|
|
226
|
+
/**
|
|
227
|
+
* The number of items per page for the collection.
|
|
228
|
+
*/
|
|
229
|
+
pageSize$: Observable<number>;
|
|
230
|
+
/**
|
|
231
|
+
* The sort options available for the items of the collection.
|
|
232
|
+
*/
|
|
233
|
+
sortOptions$: Observable<DaffSortOption[]>;
|
|
234
|
+
/**
|
|
235
|
+
* The sort options available for the items of the collection.
|
|
236
|
+
*/
|
|
237
|
+
appliedSortOption$: Observable<string>;
|
|
238
|
+
/**
|
|
239
|
+
* The sort options available for the items of the collection.
|
|
240
|
+
*/
|
|
241
|
+
appliedSortDirection$: Observable<DaffSortDirectionEnum>;
|
|
242
|
+
/**
|
|
243
|
+
* The filters available for the entities of the collection.
|
|
244
|
+
*/
|
|
245
|
+
filters$: Observable<DaffFilters>;
|
|
246
|
+
/**
|
|
247
|
+
* The sort options available for the entities of the collection.
|
|
248
|
+
*/
|
|
249
|
+
appliedFilters$: Observable<DaffFilters>;
|
|
261
250
|
}
|
|
262
|
-
|
|
263
251
|
/**
|
|
264
252
|
* An abstract class for a collection facade.
|
|
265
253
|
* It is configurable via its constructor parameters.
|
|
@@ -268,349 +256,331 @@ interface DaffCollectionFacadeInterface<TMetadata extends DaffCollectionMetadata
|
|
|
268
256
|
*
|
|
269
257
|
* @inheritdoc
|
|
270
258
|
*/
|
|
271
|
-
declare abstract class DaffCollectionFacade<TState, TMetadata extends DaffCollectionMetadata = DaffCollectionMetadata> implements DaffCollectionFacadeInterface<TMetadata> {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
259
|
+
export declare abstract class DaffCollectionFacade<TState, TMetadata extends DaffCollectionMetadata = DaffCollectionMetadata> implements DaffCollectionFacadeInterface<TMetadata> {
|
|
260
|
+
protected store: Store<TState>;
|
|
261
|
+
metadata$: Observable<TMetadata>;
|
|
262
|
+
request$: Observable<DaffCollectionRequest>;
|
|
263
|
+
count$: Observable<number>;
|
|
264
|
+
currentPage$: Observable<number>;
|
|
265
|
+
totalPages$: Observable<number>;
|
|
266
|
+
pageSize$: Observable<number>;
|
|
267
|
+
sortOptions$: Observable<DaffSortOption[]>;
|
|
268
|
+
appliedSortOption$: Observable<string>;
|
|
269
|
+
appliedSortDirection$: Observable<DaffSortDirectionEnum>;
|
|
270
|
+
filters$: Observable<DaffFilters>;
|
|
271
|
+
appliedFilters$: Observable<DaffFilters>;
|
|
272
|
+
constructor(store: Store<TState>, selectors: DaffCollectionMemoizedSelectors<TState, TMetadata>);
|
|
273
|
+
/**
|
|
274
|
+
* Dispatches the given action.
|
|
275
|
+
*
|
|
276
|
+
* @param action action to dispatch.
|
|
277
|
+
*/
|
|
278
|
+
dispatch(action: Action): void;
|
|
291
279
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
daffErrors: DaffStateError[];
|
|
280
|
+
export interface DaffErrorable {
|
|
281
|
+
/**
|
|
282
|
+
* A list of errors applicable only to this entity.
|
|
283
|
+
*/
|
|
284
|
+
daffErrors: DaffStateError[];
|
|
298
285
|
}
|
|
299
|
-
|
|
300
|
-
type ErrorTransformer = (DaffError: any) => DaffStateError;
|
|
286
|
+
export type ErrorTransformer = (DaffError: any) => DaffStateError;
|
|
301
287
|
/**
|
|
302
288
|
* Transforms an error instance to a state error object.
|
|
303
289
|
*/
|
|
304
|
-
declare function daffTransformErrorToStateError({ code, message, recoverable }: DaffError): DaffStateError;
|
|
305
|
-
|
|
290
|
+
export declare function daffTransformErrorToStateError({ code, message, recoverable }: DaffError): DaffStateError;
|
|
306
291
|
/**
|
|
307
292
|
* The DaffState enumerates the vast majority of state modifications that can exist
|
|
308
293
|
* in UI applications.
|
|
309
294
|
*/
|
|
310
|
-
declare const enum DaffState {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
295
|
+
export declare const enum DaffState {
|
|
296
|
+
/**
|
|
297
|
+
* The 'Stable' state represents when no action is being taken upon an object.
|
|
298
|
+
*/
|
|
299
|
+
Stable = "Stable",
|
|
300
|
+
/**
|
|
301
|
+
* The 'Resolving' state represents when there's uncertainty in the current status
|
|
302
|
+
* of a state, e.g. when we're loading something that hasn't been loaded into
|
|
303
|
+
* state before.
|
|
304
|
+
*/
|
|
305
|
+
Resolving = "Resolving",
|
|
306
|
+
/**
|
|
307
|
+
* The 'Adding' state represents a temporary period while an item is being
|
|
308
|
+
* added to state.
|
|
309
|
+
*/
|
|
310
|
+
Adding = "Adding",
|
|
311
|
+
/**
|
|
312
|
+
* The 'Added' state represents when an object was recently added to state.
|
|
313
|
+
* This typically is associated with a subsequent decay to a 'Stable' state.
|
|
314
|
+
*/
|
|
315
|
+
Added = "Added",
|
|
316
|
+
/**
|
|
317
|
+
* The 'Updating' state describes when an object that currently exists in state
|
|
318
|
+
* is being changed in some way.
|
|
319
|
+
*
|
|
320
|
+
* Disambiguation: This has nothing to do with immutability.
|
|
321
|
+
*/
|
|
322
|
+
Updating = "Updating",
|
|
323
|
+
/**
|
|
324
|
+
* The 'Mutated' state describes when an object has recently been modified in
|
|
325
|
+
* state. This state is typically associated with a subsequent decay into a
|
|
326
|
+
* 'Stable' state.
|
|
327
|
+
*/
|
|
328
|
+
Updated = "Updated",
|
|
329
|
+
/**
|
|
330
|
+
* The "Deleting" state occurs when an object is in the process of being
|
|
331
|
+
* removed from state.
|
|
332
|
+
*/
|
|
333
|
+
Deleting = "Deleting",
|
|
334
|
+
/**
|
|
335
|
+
* Indicates that the most recent operation specififc to this entity has failed.
|
|
336
|
+
*/
|
|
337
|
+
Error = "Error"
|
|
353
338
|
}
|
|
354
|
-
|
|
355
339
|
/**
|
|
356
340
|
* A state description for an object that is read-only.
|
|
357
341
|
*/
|
|
358
|
-
type DaffLoadingState = DaffState.Resolving | DaffState.Stable;
|
|
359
|
-
|
|
342
|
+
export type DaffLoadingState = DaffState.Resolving | DaffState.Stable;
|
|
360
343
|
/**
|
|
361
344
|
* A description for an object that is both readable and writable.
|
|
362
345
|
*/
|
|
363
|
-
type DaffMutableLoadingState = DaffLoadingState | DaffState.Updating;
|
|
364
|
-
|
|
346
|
+
export type DaffMutableLoadingState = DaffLoadingState | DaffState.Updating;
|
|
365
347
|
/**
|
|
366
348
|
* The interface an object must implement to consistently describe its current
|
|
367
349
|
* state.
|
|
368
350
|
*/
|
|
369
|
-
interface DaffStateable<T extends DaffState = DaffState> {
|
|
370
|
-
|
|
351
|
+
export interface DaffStateable<T extends DaffState = DaffState> {
|
|
352
|
+
daffState: T;
|
|
371
353
|
}
|
|
372
|
-
|
|
373
354
|
/**
|
|
374
355
|
* Returns whether the state is one that represents an operation in progress.
|
|
375
356
|
*/
|
|
376
|
-
declare function daffStateIsLoading(daffState: DaffState): boolean;
|
|
357
|
+
export declare function daffStateIsLoading(daffState: DaffState): boolean;
|
|
377
358
|
/**
|
|
378
359
|
* Returns whether the state is one that represents a mutable operation in progress.
|
|
379
360
|
*/
|
|
380
|
-
declare function daffStateIsMutating(daffState: DaffState): boolean;
|
|
381
|
-
|
|
361
|
+
export declare function daffStateIsMutating(daffState: DaffState): boolean;
|
|
382
362
|
/**
|
|
383
363
|
* A basic operation state.
|
|
384
364
|
* Represents the current state of an operation and any associated errors.
|
|
385
365
|
*/
|
|
386
|
-
interface DaffOperationState extends DaffErrorable, DaffStateable {
|
|
387
|
-
|
|
388
|
-
declare const daffOperationInitialState: DaffOperationState;
|
|
389
|
-
|
|
366
|
+
export interface DaffOperationState extends DaffErrorable, DaffStateable {}
|
|
367
|
+
export declare const daffOperationInitialState: DaffOperationState;
|
|
390
368
|
/**
|
|
391
369
|
* Puts the state in a "resolving" state that correspondes to loading platform data in a GET fashion.
|
|
392
370
|
* Sets loading to `DaffState.Resolving`
|
|
393
371
|
*/
|
|
394
|
-
declare function daffStartResolution<T extends DaffOperationState = DaffOperationState>(state: T): T;
|
|
372
|
+
export declare function daffStartResolution<T extends DaffOperationState = DaffOperationState>(state: T): T;
|
|
395
373
|
/**
|
|
396
374
|
* Puts the state in a "mutating" state that correspondes to loading platform data in a POST or PUT fashion.
|
|
397
375
|
*/
|
|
398
|
-
declare function daffStartMutation<T extends DaffOperationState = DaffOperationState>(state: T): T;
|
|
376
|
+
export declare function daffStartMutation<T extends DaffOperationState = DaffOperationState>(state: T): T;
|
|
399
377
|
/**
|
|
400
378
|
* Indicates a successfully completed operation.
|
|
401
379
|
* Sets loading to stable and resets errors.
|
|
402
380
|
*/
|
|
403
|
-
declare function daffCompleteOperation<T extends DaffOperationState = DaffOperationState>(state: T): T;
|
|
381
|
+
export declare function daffCompleteOperation<T extends DaffOperationState = DaffOperationState>(state: T): T;
|
|
404
382
|
/**
|
|
405
383
|
* Indicates a failed operation.
|
|
406
384
|
* Sets loading to stable and stores errors.
|
|
407
385
|
*/
|
|
408
|
-
declare function daffOperationFailed<T extends DaffOperationState = DaffOperationState>(errors: T['daffErrors'], state: T): T;
|
|
386
|
+
export declare function daffOperationFailed<T extends DaffOperationState = DaffOperationState>(errors: T['daffErrors'], state: T): T;
|
|
409
387
|
/**
|
|
410
388
|
* Resets errors.
|
|
411
389
|
*/
|
|
412
|
-
declare function daffClearErrors<T extends DaffOperationState = DaffOperationState>(state: T): T;
|
|
413
|
-
|
|
390
|
+
export declare function daffClearErrors<T extends DaffOperationState = DaffOperationState>(state: T): T;
|
|
414
391
|
/**
|
|
415
392
|
* Selectors for an operation state.
|
|
416
393
|
*/
|
|
417
|
-
interface DaffOperationStateSelectors<TRootState, TState extends DaffOperationState = DaffOperationState> {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
394
|
+
export interface DaffOperationStateSelectors<TRootState, TState extends DaffOperationState = DaffOperationState> {
|
|
395
|
+
/**
|
|
396
|
+
* Selects the loading state enum.
|
|
397
|
+
*/
|
|
398
|
+
selectLoadingState: MemoizedSelector<TRootState, TState['daffState']>;
|
|
399
|
+
/**
|
|
400
|
+
* Selects whether the operation state is in any of the loading states.
|
|
401
|
+
*/
|
|
402
|
+
selectLoading: MemoizedSelector<TRootState, boolean>;
|
|
403
|
+
/**
|
|
404
|
+
* Selects whether the operation state is resolving.
|
|
405
|
+
*/
|
|
406
|
+
selectResolving: MemoizedSelector<TRootState, boolean>;
|
|
407
|
+
/**
|
|
408
|
+
* Selects whether the operation state is mutating.
|
|
409
|
+
*/
|
|
410
|
+
selectMutating: MemoizedSelector<TRootState, boolean>;
|
|
411
|
+
/**
|
|
412
|
+
* Selects the errors in the operation state.
|
|
413
|
+
*/
|
|
414
|
+
selectErrors: MemoizedSelector<TRootState, TState['daffErrors']>;
|
|
415
|
+
/**
|
|
416
|
+
* Selects whether the operation state has any errors.
|
|
417
|
+
* If so, it should be considered to be in an "error" state.
|
|
418
|
+
*/
|
|
419
|
+
selectHasErrors: MemoizedSelector<TRootState, boolean>;
|
|
443
420
|
}
|
|
444
421
|
/**
|
|
445
422
|
* Creates a set of selectors for an operation state.
|
|
446
423
|
*
|
|
447
424
|
* @param selectState The feature selector for the operation state.
|
|
448
425
|
*/
|
|
449
|
-
declare function daffOperationStateSelectorFactory<TRootState, TState extends DaffOperationState = DaffOperationState>(selectState: Selector<TRootState, TState>): DaffOperationStateSelectors<TRootState, TState>;
|
|
450
|
-
|
|
426
|
+
export declare function daffOperationStateSelectorFactory<TRootState, TState extends DaffOperationState = DaffOperationState>(selectState: Selector<TRootState, TState>): DaffOperationStateSelectors<TRootState, TState>;
|
|
451
427
|
/**
|
|
452
428
|
* A facade for an operation state.
|
|
453
429
|
*/
|
|
454
|
-
interface DaffOperationStateFacadeInterface<TState extends DaffOperationState = DaffOperationState> extends DaffStoreFacade<Action> {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
430
|
+
export interface DaffOperationStateFacadeInterface<TState extends DaffOperationState = DaffOperationState> extends DaffStoreFacade<Action> {
|
|
431
|
+
/**
|
|
432
|
+
* The loading state enum.
|
|
433
|
+
*/
|
|
434
|
+
loadingState$: Observable<TState['daffState']>;
|
|
435
|
+
/**
|
|
436
|
+
* Whether the operation state is in any of the loading states.
|
|
437
|
+
*/
|
|
438
|
+
loading$: Observable<boolean>;
|
|
439
|
+
/**
|
|
440
|
+
* Whether the operation state is resolving.
|
|
441
|
+
*/
|
|
442
|
+
resolving$: Observable<boolean>;
|
|
443
|
+
/**
|
|
444
|
+
* Whether the operation state is mutating.
|
|
445
|
+
*/
|
|
446
|
+
mutating$: Observable<boolean>;
|
|
447
|
+
/**
|
|
448
|
+
* The errors in the operation state.
|
|
449
|
+
*/
|
|
450
|
+
errors$: Observable<TState['daffErrors']>;
|
|
451
|
+
/**
|
|
452
|
+
* Whether the operation state has any errors.
|
|
453
|
+
* If so, it should be considered to be in an "error" state.
|
|
454
|
+
*/
|
|
455
|
+
hasErrors$: Observable<boolean>;
|
|
480
456
|
}
|
|
481
|
-
|
|
482
457
|
/**
|
|
483
458
|
* An entity that is responsible for storing its own errors and loading state.
|
|
484
459
|
* Its possible to be an "optimistic" entity, i.e. only temporary while the real entity is in some loading state.
|
|
485
460
|
*/
|
|
486
|
-
type DaffOperationEntity<T extends DaffIdentifiable = DaffIdentifiable> = DaffStateable & DaffErrorable & T & {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
461
|
+
export type DaffOperationEntity<T extends DaffIdentifiable = DaffIdentifiable> = DaffStateable & DaffErrorable & T & {
|
|
462
|
+
/**
|
|
463
|
+
* Whether this entity is temporary.
|
|
464
|
+
* A temporary entity is a placeholder for the optimistic success of an entity operation
|
|
465
|
+
* and will appear in entity state during `get` and `add` operations, if necessary.
|
|
466
|
+
*/
|
|
467
|
+
daffTemp: boolean;
|
|
493
468
|
};
|
|
494
|
-
|
|
495
|
-
declare const giveMeType: <T, V>(adapter: EntityAdapter<T>) => _ngrx_entity.MemoizedEntitySelectors<T, V>;
|
|
469
|
+
declare const giveMeType: <T, V>(adapter: EntityAdapter<T>) => import("@ngrx/entity").MemoizedEntitySelectors<T, V>;
|
|
496
470
|
type EntitySelectors<T, V> = ReturnType<typeof giveMeType<T, V>>;
|
|
497
471
|
/**
|
|
498
472
|
* Selectors for an operation state.
|
|
499
473
|
*/
|
|
500
|
-
interface DaffOperationEntityStateSelectors<TRootState, T extends DaffIdentifiable = DaffIdentifiable> extends EntitySelectors<DaffOperationEntity<T>, TRootState> {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
474
|
+
export interface DaffOperationEntityStateSelectors<TRootState, T extends DaffIdentifiable = DaffIdentifiable> extends EntitySelectors<DaffOperationEntity<T>, TRootState> {
|
|
475
|
+
/**
|
|
476
|
+
* Selects an entity by ID.
|
|
477
|
+
*/
|
|
478
|
+
selectEntity: (id: T['id']) => MemoizedSelector<TRootState, DaffOperationEntity<T>>;
|
|
479
|
+
/**
|
|
480
|
+
* Optimistically selects the list of entities.
|
|
481
|
+
* This excludes temporary entities with errors.
|
|
482
|
+
*/
|
|
483
|
+
selectOptimisticList: MemoizedSelector<TRootState, DaffOperationEntity<T>[]>;
|
|
510
484
|
}
|
|
511
485
|
/**
|
|
512
486
|
* Creates a set of selectors for an entity operation state.
|
|
513
487
|
*
|
|
514
488
|
* @param selectState The feature selector for the entity operation state.
|
|
515
489
|
*/
|
|
516
|
-
declare function daffOperationEntityStateSelectorFactory<TRootState, T extends DaffIdentifiable = DaffIdentifiable>(entitySelectors: EntitySelectors<DaffOperationEntity<T>, TRootState>): DaffOperationEntityStateSelectors<TRootState, T>;
|
|
517
|
-
|
|
490
|
+
export declare function daffOperationEntityStateSelectorFactory<TRootState, T extends DaffIdentifiable = DaffIdentifiable>(entitySelectors: EntitySelectors<DaffOperationEntity<T>, TRootState>): DaffOperationEntityStateSelectors<TRootState, T>;
|
|
518
491
|
/**
|
|
519
492
|
* An operation entity state.
|
|
520
493
|
* Stores the current state of an operation and any associated errors directly on the entity for context.
|
|
521
494
|
*/
|
|
522
|
-
type DaffOperationEntityState<T extends DaffIdentifiable = DaffIdentifiable> = EntityState<DaffOperationEntity<T>>;
|
|
523
|
-
|
|
495
|
+
export type DaffOperationEntityState<T extends DaffIdentifiable = DaffIdentifiable> = EntityState<DaffOperationEntity<T>>;
|
|
524
496
|
/**
|
|
525
497
|
* An entity state adapter that takes care of managing contextual operation and error state for entities.
|
|
526
498
|
*/
|
|
527
|
-
interface DaffOperationEntityStateAdapterInterface<T extends DaffIdentifiable = DaffIdentifiable> {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
499
|
+
export interface DaffOperationEntityStateAdapterInterface<T extends DaffIdentifiable = DaffIdentifiable> {
|
|
500
|
+
/**
|
|
501
|
+
* Stores a list of entities in state and resets them all to stable.
|
|
502
|
+
*/
|
|
503
|
+
list<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entities: T[], state: S): S;
|
|
504
|
+
/**
|
|
505
|
+
* Optimistically adds a placeholder entity into state if necessary and sets the entity to resolving.
|
|
506
|
+
*/
|
|
507
|
+
preload<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(id: string, state: S): S;
|
|
508
|
+
/**
|
|
509
|
+
* Upserts the entity into state and resets operation state and errors.
|
|
510
|
+
*/
|
|
511
|
+
load<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: T, state: S): S;
|
|
512
|
+
/**
|
|
513
|
+
* Adds a placeholder entity into state if `placeholderId` is specified and sets state to adding.
|
|
514
|
+
*/
|
|
515
|
+
preadd<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: T, state: S, placeholderId?: string): S;
|
|
516
|
+
/**
|
|
517
|
+
* Adds the entity into state, sets operation state to added, and resets errors.
|
|
518
|
+
*/
|
|
519
|
+
add<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: T, state: S, placeholderId?: string): S;
|
|
520
|
+
/**
|
|
521
|
+
* Sets the entity's operation state to mutating.
|
|
522
|
+
*/
|
|
523
|
+
preupdate<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: Partial<T> & DaffIdentifiable, state: S): S;
|
|
524
|
+
/**
|
|
525
|
+
* Upserts the entity into state, sets operation state to mutated, and resets errors.
|
|
526
|
+
*/
|
|
527
|
+
update<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: Partial<T> & DaffIdentifiable, state: S): S;
|
|
528
|
+
/**
|
|
529
|
+
* Sets the entity's operation state to deleting.
|
|
530
|
+
*/
|
|
531
|
+
preremove<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(key: string, state: S): S;
|
|
532
|
+
/**
|
|
533
|
+
* Removes the entity from state.
|
|
534
|
+
*/
|
|
535
|
+
remove<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(key: string, state: S): S;
|
|
536
|
+
/**
|
|
537
|
+
* Resets the entity's operation state and stores errors on the entity.
|
|
538
|
+
*/
|
|
539
|
+
operationFailed<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(key: string, errors: DaffStateError[], state: S): S;
|
|
540
|
+
/**
|
|
541
|
+
* Resets the entity's operation state to stable.
|
|
542
|
+
*/
|
|
543
|
+
resetState<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(key: string, state: S): S;
|
|
544
|
+
/**
|
|
545
|
+
* Gets an empty entity state.
|
|
546
|
+
*/
|
|
547
|
+
getInitialState<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(state?: S): S;
|
|
548
|
+
/**
|
|
549
|
+
* Gets entity selectors.
|
|
550
|
+
*/
|
|
551
|
+
getSelectors<TRootState>(selectState: (state: TRootState) => DaffOperationEntityState<T>): DaffOperationEntityStateSelectors<TRootState, T>;
|
|
580
552
|
}
|
|
581
553
|
/**
|
|
582
554
|
* @inheritdoc
|
|
583
555
|
*/
|
|
584
|
-
declare class DaffOperationEntityStateAdapter<T extends DaffIdentifiable = DaffIdentifiable> implements DaffOperationEntityStateAdapterInterface<T> {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
556
|
+
export declare class DaffOperationEntityStateAdapter<T extends DaffIdentifiable = DaffIdentifiable> implements DaffOperationEntityStateAdapterInterface<T> {
|
|
557
|
+
protected adapter: EntityAdapter<DaffOperationEntity<T>>;
|
|
558
|
+
constructor(adapter?: EntityAdapter<DaffOperationEntity<T>>);
|
|
559
|
+
list<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entities: T[], state: S): S;
|
|
560
|
+
preload<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(id: string, state: S): S;
|
|
561
|
+
load<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: T, state: S): S;
|
|
562
|
+
preadd<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: T, state: S, placeholderId?: string): S;
|
|
563
|
+
add<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: T, state: S, placeholderId?: string): S;
|
|
564
|
+
preupdate<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: Partial<T> & DaffIdentifiable, state: S): S;
|
|
565
|
+
update<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: Partial<T> & DaffIdentifiable, state: S): S;
|
|
566
|
+
preremove<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(key: string, state: S): S;
|
|
567
|
+
remove<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(key: string, state: S): S;
|
|
568
|
+
operationFailed<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(key: string, errors: DaffStateError[], state: S): S;
|
|
569
|
+
resetState<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(key: string, state: S): S;
|
|
570
|
+
getInitialState<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(state?: S): S;
|
|
571
|
+
getSelectors<TRootState>(selectState: (state: TRootState) => DaffOperationEntityState<T>): DaffOperationEntityStateSelectors<TRootState, T>;
|
|
600
572
|
}
|
|
601
|
-
declare function daffCreateOperationEntityStateAdapter<T extends DaffIdentifiable = DaffIdentifiable>(adapter?: EntityAdapter<DaffOperationEntity<T>>): DaffOperationEntityStateAdapter<T>;
|
|
602
|
-
|
|
573
|
+
export declare function daffCreateOperationEntityStateAdapter<T extends DaffIdentifiable = DaffIdentifiable>(adapter?: EntityAdapter<DaffOperationEntity<T>>): DaffOperationEntityStateAdapter<T>;
|
|
603
574
|
/**
|
|
604
575
|
* Generate a fake ID for use with placeholder entities.
|
|
605
576
|
*
|
|
606
577
|
* @param key An optional key that can augment the randomly generated ID.
|
|
607
578
|
* @returns A string cont
|
|
608
579
|
*/
|
|
609
|
-
declare function daffOperationEntityCreateFakeId(key?: string): string;
|
|
610
|
-
|
|
611
|
-
type
|
|
612
|
-
type
|
|
613
|
-
type ActionSequence = ActionSequenceStep[];
|
|
580
|
+
export declare function daffOperationEntityCreateFakeId(key?: string): string;
|
|
581
|
+
export type ActionType = Action['type'];
|
|
582
|
+
export type ActionSequenceStep = ActionType | ActionType[];
|
|
583
|
+
export type ActionSequence = ActionSequenceStep[];
|
|
614
584
|
/**
|
|
615
585
|
* Watches for a particular stream of actions in the specified order and
|
|
616
586
|
* emits a list of those actions once all sequence steps have been matched.
|
|
@@ -632,27 +602,21 @@ type ActionSequence = ActionSequenceStep[];
|
|
|
632
602
|
* @param sequence The sequence of action types that define the substream to listen for.
|
|
633
603
|
* @param terminators A list of terminators, any of which interrupt and reset a partially matched substream.
|
|
634
604
|
*/
|
|
635
|
-
declare const substream: (sequence: ActionSequence, ...terminators: ActionType[]) => rxjs.UnaryFunction<rxjs.Observable<Action<string>>, rxjs.Observable<any>>;
|
|
636
|
-
|
|
605
|
+
export declare const substream: (sequence: ActionSequence, ...terminators: ActionType[]) => import("rxjs").UnaryFunction<import("rxjs").Observable<Action<string>>, import("rxjs").Observable<any>>;
|
|
637
606
|
/**
|
|
638
607
|
* Creates and returns a composite reducer that invokes each of the passed reducers in turn.
|
|
639
608
|
*/
|
|
640
|
-
declare function daffComposeReducers<T, V extends Action = Action>(reducers: ActionReducer<T, V>[]): ActionReducer<T, V>;
|
|
641
|
-
|
|
609
|
+
export declare function daffComposeReducers<T, V extends Action = Action>(reducers: ActionReducer<T, V>[]): ActionReducer<T, V>;
|
|
642
610
|
/**
|
|
643
611
|
* A simple reducer that simply returns the passed state.
|
|
644
612
|
* This is useful for stubbing out parts of state that are not covered in an injected extra reducer map.
|
|
645
613
|
*/
|
|
646
|
-
declare const daffIdentityReducer: <T = unknown>(state: T, action: Action) => T;
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
config: DaffSingleInjectionToken<StoreConfig<T>>;
|
|
614
|
+
export declare const daffIdentityReducer: <T = unknown>(state: T, action: Action) => T;
|
|
615
|
+
export interface InjectableReducersTokens<T> {
|
|
616
|
+
extra: DaffMultiInjectionToken<ActionReducer<T>>;
|
|
617
|
+
reducers: DaffSingleInjectionToken<ActionReducer<T>>;
|
|
618
|
+
meta: DaffMultiInjectionToken<MetaReducer<T>>;
|
|
619
|
+
config: DaffSingleInjectionToken<StoreConfig<T>>;
|
|
653
620
|
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
export { DaffCollectionFacade, DaffCollectionStateAdapter, DaffOperationEntityStateAdapter, DaffState, createInjectableReducersTokens, daffClearErrors, daffCollectionReducerInitialState, daffCollectionSelectorFactory, daffCompleteOperation, daffComposeReducers, daffCreateOperationEntityStateAdapter, daffIdentityReducer, daffOperationEntityCreateFakeId, daffOperationEntityStateSelectorFactory, daffOperationFailed, daffOperationInitialState, daffOperationStateSelectorFactory, daffStartMutation, daffStartResolution, daffStateIsLoading, daffStateIsMutating, daffTransformErrorToStateError, getCollectionStateAdapter, substream };
|
|
658
|
-
export type { ActionSequence, ActionSequenceStep, ActionType, DaffCollectionApplyFilters, DaffCollectionChangeCurrentPage, DaffCollectionChangePageSize, DaffCollectionChangeSortingOption, DaffCollectionClearFilters, DaffCollectionFacadeInterface, DaffCollectionMemoizedSelectors, DaffCollectionRemoveFilters, DaffCollectionReplaceFilters, DaffCollectionToggleFilter, DaffErrorable, DaffFailable, DaffFailureAction, DaffLoadingState, DaffMutableLoadingState, DaffOperationEntity, DaffOperationEntityState, DaffOperationEntityStateAdapterInterface, DaffOperationEntityStateSelectors, DaffOperationState, DaffOperationStateFacadeInterface, DaffOperationStateSelectors, DaffStateError, DaffStateable, DaffStoreFacade, ErrorTransformer, InjectableReducersTokens };
|
|
621
|
+
export declare const createInjectableReducersTokens: <T>(feature: string, createReducers: () => ActionReducer<T>) => InjectableReducersTokens<T>;
|
|
622
|
+
export {};
|