@daffodil/search 0.94.1 → 0.95.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/fesm2022/daffodil-search-driver-federated.mjs +131 -128
- package/fesm2022/daffodil-search-driver-federated.mjs.map +1 -1
- package/fesm2022/daffodil-search-driver-in-memory.mjs +170 -158
- package/fesm2022/daffodil-search-driver-in-memory.mjs.map +1 -1
- package/fesm2022/daffodil-search-driver-testing.mjs +102 -69
- package/fesm2022/daffodil-search-driver-testing.mjs.map +1 -1
- package/fesm2022/daffodil-search-driver.mjs +22 -47
- package/fesm2022/daffodil-search-driver.mjs.map +1 -1
- package/fesm2022/daffodil-search-routing.mjs +123 -112
- package/fesm2022/daffodil-search-routing.mjs.map +1 -1
- package/fesm2022/daffodil-search-state-testing.mjs +91 -54
- package/fesm2022/daffodil-search-state-testing.mjs.map +1 -1
- package/fesm2022/daffodil-search-state.mjs +470 -469
- package/fesm2022/daffodil-search-state.mjs.map +1 -1
- package/fesm2022/daffodil-search-testing.mjs +141 -113
- package/fesm2022/daffodil-search-testing.mjs.map +1 -1
- package/fesm2022/daffodil-search.mjs +4 -12
- package/fesm2022/daffodil-search.mjs.map +1 -1
- package/package.json +1 -1
- package/types/daffodil-search-driver-federated.d.ts +39 -35
- package/types/daffodil-search-driver-in-memory.d.ts +61 -65
- package/types/daffodil-search-driver-testing.d.ts +26 -24
- package/types/daffodil-search-driver.d.ts +59 -70
- package/types/daffodil-search-routing.d.ts +31 -30
- package/types/daffodil-search-state-testing.d.ts +25 -22
- package/types/daffodil-search-state.d.ts +207 -217
- package/types/daffodil-search-testing.d.ts +33 -34
- package/types/daffodil-search.d.ts +4 -10
|
@@ -1,488 +1,489 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as i1 from
|
|
3
|
-
import {
|
|
4
|
-
import * as i0 from
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import * as i1
|
|
8
|
-
import { createEffect, ofType,
|
|
9
|
-
import { asyncScheduler, of } from
|
|
10
|
-
import {
|
|
11
|
-
import { DaffSearchDriver } from
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* The search action types enum.
|
|
15
|
-
*/
|
|
1
|
+
import { createConfigInjectionToken, createMultiInjectionToken, createSingleInjectionToken } from "@daffodil/core";
|
|
2
|
+
import * as i1$1 from "@ngrx/store";
|
|
3
|
+
import { StoreModule, combineReducers, createFeatureSelector, createSelector, defaultMemoize, provideState, select } from "@ngrx/store";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import { Inject, Injectable, NgModule, inject, makeEnvironmentProviders } from "@angular/core";
|
|
6
|
+
import { daffComposeReducers, daffTransformErrorToStateError } from "@daffodil/core/state";
|
|
7
|
+
import * as i1 from "@ngrx/effects";
|
|
8
|
+
import { EffectsModule, createEffect, ofType, provideEffects } from "@ngrx/effects";
|
|
9
|
+
import { asyncScheduler, of } from "rxjs";
|
|
10
|
+
import { catchError, debounceTime, map, switchMap } from "rxjs/operators";
|
|
11
|
+
import { DaffSearchDriver } from "@daffodil/search/driver";
|
|
16
12
|
var DaffSearchActionTypes;
|
|
17
|
-
(function
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
(function(DaffSearchActionTypes) {
|
|
14
|
+
DaffSearchActionTypes["SearchLoadAction"] = "[@daffodil/search] Search Load Action";
|
|
15
|
+
DaffSearchActionTypes["SearchLoadSuccessAction"] = "[@daffodil/search] Search Load Success Action";
|
|
16
|
+
DaffSearchActionTypes["SearchLoadFailureAction"] = "[@daffodil/search] Search Load Failure Action";
|
|
17
|
+
DaffSearchActionTypes["SearchIncrementalAction"] = "[@daffodil/search] Search Incremental Action";
|
|
18
|
+
DaffSearchActionTypes["SearchIncrementalSuccessAction"] = "[@daffodil/search] Search Incremental Success Action";
|
|
19
|
+
DaffSearchActionTypes["SearchIncrementalFailureAction"] = "[@daffodil/search] Search Incremental Failure Action";
|
|
24
20
|
})(DaffSearchActionTypes || (DaffSearchActionTypes = {}));
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
* Sets loading to true and stores the query in the list of recent searches.
|
|
98
|
-
* Resets the collection of results.
|
|
99
|
-
*/
|
|
100
|
-
search(query) {
|
|
101
|
-
// get unique values
|
|
102
|
-
const recent = [...new Set([
|
|
103
|
-
query,
|
|
104
|
-
...this.state.recent,
|
|
105
|
-
])];
|
|
106
|
-
return {
|
|
107
|
-
...this.state,
|
|
108
|
-
loading: true,
|
|
109
|
-
recent,
|
|
110
|
-
results: {},
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Stores the results of a completed search.
|
|
115
|
-
* Also sets loading to false and resets errors.
|
|
116
|
-
*/
|
|
117
|
-
storeResults(collection) {
|
|
118
|
-
const results = Object.keys(collection).reduce((acc, k) => {
|
|
119
|
-
if (Object.prototype.hasOwnProperty.call(collection, k)) {
|
|
120
|
-
acc[k] = collection[k].map(({ id }) => id);
|
|
121
|
-
}
|
|
122
|
-
return acc;
|
|
123
|
-
}, {});
|
|
124
|
-
return {
|
|
125
|
-
...this.state,
|
|
126
|
-
loading: false,
|
|
127
|
-
errors: [],
|
|
128
|
-
results,
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Stores the from a failed search.
|
|
133
|
-
* Also sets loading to false.
|
|
134
|
-
*/
|
|
135
|
-
storeError(error) {
|
|
136
|
-
return {
|
|
137
|
-
...this.state,
|
|
138
|
-
errors: [
|
|
139
|
-
...this.state.errors,
|
|
140
|
-
error,
|
|
141
|
-
],
|
|
142
|
-
loading: false,
|
|
143
|
-
results: {},
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* The initial state for the main search state, see {@link DaffSearchReducerState}.
|
|
150
|
-
*/
|
|
21
|
+
var DaffSearchLoad = class {
|
|
22
|
+
constructor(query, options = {}) {
|
|
23
|
+
this.query = query;
|
|
24
|
+
this.options = options;
|
|
25
|
+
this.type = DaffSearchActionTypes.SearchLoadAction;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var DaffSearchLoadSuccess = class {
|
|
29
|
+
constructor(payload) {
|
|
30
|
+
this.payload = payload;
|
|
31
|
+
this.type = DaffSearchActionTypes.SearchLoadSuccessAction;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var DaffSearchLoadFailure = class {
|
|
35
|
+
constructor(payload) {
|
|
36
|
+
this.payload = payload;
|
|
37
|
+
this.type = DaffSearchActionTypes.SearchLoadFailureAction;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var DaffSearchIncremental = class {
|
|
41
|
+
constructor(query, options = {}) {
|
|
42
|
+
this.query = query;
|
|
43
|
+
this.options = options;
|
|
44
|
+
this.type = DaffSearchActionTypes.SearchIncrementalAction;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var DaffSearchIncrementalSuccess = class {
|
|
48
|
+
constructor(payload) {
|
|
49
|
+
this.payload = payload;
|
|
50
|
+
this.type = DaffSearchActionTypes.SearchIncrementalSuccessAction;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var DaffSearchIncrementalFailure = class {
|
|
54
|
+
constructor(payload) {
|
|
55
|
+
this.payload = payload;
|
|
56
|
+
this.type = DaffSearchActionTypes.SearchIncrementalFailureAction;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var DaffSearchStateReducerAdapter = class {
|
|
60
|
+
constructor(state) {
|
|
61
|
+
this.state = state;
|
|
62
|
+
}
|
|
63
|
+
search(query) {
|
|
64
|
+
const recent = [.../* @__PURE__ */ new Set([query, ...this.state.recent])];
|
|
65
|
+
return {
|
|
66
|
+
...this.state,
|
|
67
|
+
loading: true,
|
|
68
|
+
recent,
|
|
69
|
+
results: {}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
storeResults(collection) {
|
|
73
|
+
const results = Object.keys(collection).reduce((acc, k) => {
|
|
74
|
+
if (Object.prototype.hasOwnProperty.call(collection, k)) acc[k] = collection[k].map(({ id }) => id);
|
|
75
|
+
return acc;
|
|
76
|
+
}, {});
|
|
77
|
+
return {
|
|
78
|
+
...this.state,
|
|
79
|
+
loading: false,
|
|
80
|
+
errors: [],
|
|
81
|
+
results
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
storeError(error) {
|
|
85
|
+
return {
|
|
86
|
+
...this.state,
|
|
87
|
+
errors: [...this.state.errors, error],
|
|
88
|
+
loading: false,
|
|
89
|
+
results: {}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
};
|
|
151
93
|
const daffSearchInitialState = {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
94
|
+
loading: false,
|
|
95
|
+
errors: [],
|
|
96
|
+
results: {},
|
|
97
|
+
recent: []
|
|
156
98
|
};
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* The reducer for the incremental part of search state, see {@link DaffSearchReducerState}.
|
|
160
|
-
*/
|
|
161
99
|
function daffSearchIncrementalReducer(state = daffSearchInitialState, action) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
return adapter.storeError(action.payload);
|
|
170
|
-
default:
|
|
171
|
-
return state;
|
|
172
|
-
}
|
|
100
|
+
const adapter = new DaffSearchStateReducerAdapter(state);
|
|
101
|
+
switch (action.type) {
|
|
102
|
+
case DaffSearchActionTypes.SearchIncrementalAction: return adapter.search(action.query);
|
|
103
|
+
case DaffSearchActionTypes.SearchIncrementalSuccessAction: return adapter.storeResults(action.payload);
|
|
104
|
+
case DaffSearchActionTypes.SearchIncrementalFailureAction: return adapter.storeError(action.payload);
|
|
105
|
+
default: return state;
|
|
106
|
+
}
|
|
173
107
|
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* The reducer for the search page state, see {@link DaffSearchReducerState}.
|
|
177
|
-
*/
|
|
178
108
|
function daffSearchPageReducer(state = daffSearchInitialState, action) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
return adapter.storeError(action.payload);
|
|
187
|
-
default:
|
|
188
|
-
return state;
|
|
189
|
-
}
|
|
109
|
+
const adapter = new DaffSearchStateReducerAdapter(state);
|
|
110
|
+
switch (action.type) {
|
|
111
|
+
case DaffSearchActionTypes.SearchLoadAction: return adapter.search(action.query);
|
|
112
|
+
case DaffSearchActionTypes.SearchLoadSuccessAction: return adapter.storeResults(action.payload.collection);
|
|
113
|
+
case DaffSearchActionTypes.SearchLoadFailureAction: return adapter.storeError(action.payload);
|
|
114
|
+
default: return state;
|
|
115
|
+
}
|
|
190
116
|
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* The reducers for the entire search feature state.
|
|
194
|
-
*/
|
|
195
117
|
const daffSearchReducers = {
|
|
196
|
-
|
|
197
|
-
|
|
118
|
+
search: daffSearchPageReducer,
|
|
119
|
+
incremental: daffSearchIncrementalReducer
|
|
198
120
|
};
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
* The key under which the search feature state will be stored.
|
|
202
|
-
*/
|
|
203
|
-
const DAFF_SEARCH_STORE_FEATURE_KEY = 'daffSearch';
|
|
204
|
-
|
|
205
|
-
const {
|
|
206
|
-
/**
|
|
207
|
-
* A token to hold the injectable extra reducers.
|
|
208
|
-
*
|
|
209
|
-
* Prefer using {@link daffSearchProvideExtraReducers}.
|
|
210
|
-
*/
|
|
211
|
-
token: DAFF_SEARCH_EXTRA_REDUCERS,
|
|
212
|
-
/**
|
|
213
|
-
* Provides additional reducers that run after the standard Daffodil cart reducers.
|
|
214
|
-
*
|
|
215
|
-
* @example
|
|
216
|
-
* ```ts
|
|
217
|
-
* providers: [
|
|
218
|
-
* ...daffSearchProvideExtraReducers(
|
|
219
|
-
* myReducer1,
|
|
220
|
-
* myReducer2
|
|
221
|
-
* )
|
|
222
|
-
* ]
|
|
223
|
-
* ```
|
|
224
|
-
*/
|
|
225
|
-
provider: daffSearchProvideExtraReducers, } = createMultiInjectionToken('DAFF_SEARCH_EXTRA_REDUCERS', { providedIn: 'any' });
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Creates a group of selectors for {@link DaffSearchReducerState} that use the passed state selector as the basis.
|
|
229
|
-
*/
|
|
121
|
+
const DAFF_SEARCH_STORE_FEATURE_KEY = "daffSearch";
|
|
122
|
+
const { token: DAFF_SEARCH_EXTRA_REDUCERS, provider: daffSearchProvideExtraReducers } = createMultiInjectionToken("DAFF_SEARCH_EXTRA_REDUCERS", { providedIn: "any" });
|
|
230
123
|
const daffSearchCreateSearchSelectors = (stateSelector) => {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
selectResultCount,
|
|
242
|
-
};
|
|
124
|
+
const selectSearchLoading = createSelector(stateSelector, (state) => state.loading);
|
|
125
|
+
const selectSearchErrors = createSelector(stateSelector, (state) => state.errors);
|
|
126
|
+
const selectSearchResultIds = createSelector(stateSelector, (state) => state.results);
|
|
127
|
+
return {
|
|
128
|
+
selectSearchLoading,
|
|
129
|
+
selectSearchErrors,
|
|
130
|
+
selectSearchResultIds,
|
|
131
|
+
selectRecent: createSelector(stateSelector, (state) => state.recent),
|
|
132
|
+
selectResultCount: createSelector(selectSearchResultIds, (ids) => Object.values(ids).reduce((sum, results) => sum + results.length, 0))
|
|
133
|
+
};
|
|
243
134
|
};
|
|
244
|
-
|
|
245
|
-
const getDaffSearchReducersStateSelector = defaultMemoize(() => ({
|
|
246
|
-
selectSearchFeatureState: createFeatureSelector(DAFF_SEARCH_STORE_FEATURE_KEY),
|
|
247
|
-
})).memoized;
|
|
248
|
-
|
|
135
|
+
const getDaffSearchReducersStateSelector = defaultMemoize(() => ({ selectSearchFeatureState: createFeatureSelector(DAFF_SEARCH_STORE_FEATURE_KEY) })).memoized;
|
|
249
136
|
const { selectSearchFeatureState: selectSearchFeatureState$1 } = getDaffSearchReducersStateSelector();
|
|
250
|
-
const selectSearchState = createSelector(selectSearchFeatureState$1, state => state.search);
|
|
137
|
+
const selectSearchState = createSelector(selectSearchFeatureState$1, (state) => state.search);
|
|
251
138
|
const daffSearchGetPageSelectors = defaultMemoize(() => daffSearchCreateSearchSelectors(selectSearchState)).memoized;
|
|
252
|
-
|
|
253
139
|
const { selectSearchFeatureState } = getDaffSearchReducersStateSelector();
|
|
254
|
-
const selectIncrementalState = createSelector(selectSearchFeatureState, state => state.incremental);
|
|
140
|
+
const selectIncrementalState = createSelector(selectSearchFeatureState, (state) => state.incremental);
|
|
255
141
|
const daffSearchGetIncrementalSelectors = defaultMemoize(() => daffSearchCreateSearchSelectors(selectIncrementalState)).memoized;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
this.searchResultIds$ = this.store.pipe(select(selectSearchResultIds));
|
|
270
|
-
this.recent$ = this.store.pipe(select(selectRecent));
|
|
271
|
-
this.resultCount$ = this.store.pipe(select(selectResultCount));
|
|
272
|
-
}
|
|
273
|
-
dispatch(action) {
|
|
274
|
-
this.store.dispatch(action);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* @inheritdoc
|
|
280
|
-
*
|
|
281
|
-
* A facade for the incremental search state.
|
|
282
|
-
*/
|
|
283
|
-
class DaffSearchIncrementalFacade extends DaffSearchFacadeBase {
|
|
284
|
-
constructor(store) {
|
|
285
|
-
super(store, daffSearchGetIncrementalSelectors());
|
|
286
|
-
}
|
|
287
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchIncrementalFacade, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
288
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchIncrementalFacade, providedIn: 'root' }); }
|
|
289
|
-
}
|
|
290
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchIncrementalFacade, decorators: [{
|
|
291
|
-
type: Injectable,
|
|
292
|
-
args: [{
|
|
293
|
-
providedIn: 'root',
|
|
294
|
-
}]
|
|
295
|
-
}], ctorParameters: () => [{ type: i1.Store }] });
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* @inheritdoc
|
|
299
|
-
*
|
|
300
|
-
* A facade for the search page state.
|
|
301
|
-
*/
|
|
302
|
-
class DaffSearchPageFacade extends DaffSearchFacadeBase {
|
|
303
|
-
constructor(store) {
|
|
304
|
-
super(store, daffSearchGetPageSelectors());
|
|
305
|
-
}
|
|
306
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchPageFacade, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
307
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchPageFacade, providedIn: 'root' }); }
|
|
308
|
-
}
|
|
309
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchPageFacade, decorators: [{
|
|
310
|
-
type: Injectable,
|
|
311
|
-
args: [{
|
|
312
|
-
providedIn: 'root',
|
|
313
|
-
}]
|
|
314
|
-
}], ctorParameters: () => [{ type: i1.Store }] });
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* The default configuration for the {@link DaffSearchStateConfig}.
|
|
318
|
-
*/
|
|
319
|
-
const DAFF_SEARCH_STATE_CONFIG_DEFAULT = {
|
|
320
|
-
incrementalResultLimit: 5,
|
|
321
|
-
// TODO: figure out how to implement
|
|
322
|
-
// recentSearchLimit: 10,
|
|
142
|
+
var DaffSearchFacadeBase = class {
|
|
143
|
+
constructor(store, selectors) {
|
|
144
|
+
this.store = store;
|
|
145
|
+
const { selectSearchLoading, selectSearchErrors, selectSearchResultIds, selectRecent, selectResultCount } = selectors;
|
|
146
|
+
this.loading$ = this.store.pipe(select(selectSearchLoading));
|
|
147
|
+
this.errors$ = this.store.pipe(select(selectSearchErrors));
|
|
148
|
+
this.searchResultIds$ = this.store.pipe(select(selectSearchResultIds));
|
|
149
|
+
this.recent$ = this.store.pipe(select(selectRecent));
|
|
150
|
+
this.resultCount$ = this.store.pipe(select(selectResultCount));
|
|
151
|
+
}
|
|
152
|
+
dispatch(action) {
|
|
153
|
+
this.store.dispatch(action);
|
|
154
|
+
}
|
|
323
155
|
};
|
|
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
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
providedIn: 'any',
|
|
359
|
-
factory: () => daffComposeReducers([
|
|
360
|
-
combineReducers(daffSearchReducers),
|
|
361
|
-
...inject(DAFF_SEARCH_EXTRA_REDUCERS),
|
|
362
|
-
]),
|
|
156
|
+
var DaffSearchIncrementalFacade = class DaffSearchIncrementalFacade extends DaffSearchFacadeBase {
|
|
157
|
+
constructor(store) {
|
|
158
|
+
super(store, daffSearchGetIncrementalSelectors());
|
|
159
|
+
}
|
|
160
|
+
static {
|
|
161
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
162
|
+
minVersion: "12.0.0",
|
|
163
|
+
version: "22.2.4",
|
|
164
|
+
ngImport: i0,
|
|
165
|
+
type: DaffSearchIncrementalFacade,
|
|
166
|
+
deps: [{ token: i1$1.Store }],
|
|
167
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
static {
|
|
171
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
172
|
+
minVersion: "12.0.0",
|
|
173
|
+
version: "22.2.4",
|
|
174
|
+
ngImport: i0,
|
|
175
|
+
type: DaffSearchIncrementalFacade,
|
|
176
|
+
providedIn: "root"
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
181
|
+
minVersion: "12.0.0",
|
|
182
|
+
version: "22.2.4",
|
|
183
|
+
ngImport: i0,
|
|
184
|
+
type: DaffSearchIncrementalFacade,
|
|
185
|
+
decorators: [{
|
|
186
|
+
type: Injectable,
|
|
187
|
+
args: [{ providedIn: "root" }]
|
|
188
|
+
}],
|
|
189
|
+
ctorParameters: () => [{ type: i1$1.Store }]
|
|
363
190
|
});
|
|
191
|
+
var DaffSearchPageFacade = class DaffSearchPageFacade extends DaffSearchFacadeBase {
|
|
192
|
+
constructor(store) {
|
|
193
|
+
super(store, daffSearchGetPageSelectors());
|
|
194
|
+
}
|
|
195
|
+
static {
|
|
196
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
197
|
+
minVersion: "12.0.0",
|
|
198
|
+
version: "22.2.4",
|
|
199
|
+
ngImport: i0,
|
|
200
|
+
type: DaffSearchPageFacade,
|
|
201
|
+
deps: [{ token: i1$1.Store }],
|
|
202
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
static {
|
|
206
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
207
|
+
minVersion: "12.0.0",
|
|
208
|
+
version: "22.2.4",
|
|
209
|
+
ngImport: i0,
|
|
210
|
+
type: DaffSearchPageFacade,
|
|
211
|
+
providedIn: "root"
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
216
|
+
minVersion: "12.0.0",
|
|
217
|
+
version: "22.2.4",
|
|
218
|
+
ngImport: i0,
|
|
219
|
+
type: DaffSearchPageFacade,
|
|
220
|
+
decorators: [{
|
|
221
|
+
type: Injectable,
|
|
222
|
+
args: [{ providedIn: "root" }]
|
|
223
|
+
}],
|
|
224
|
+
ctorParameters: () => [{ type: i1$1.Store }]
|
|
225
|
+
});
|
|
226
|
+
const DAFF_SEARCH_STATE_CONFIG_DEFAULT = { incrementalResultLimit: 5 };
|
|
227
|
+
const { token: DAFF_SEARCH_STATE_CONFIG, provider: provideDaffSearchStateConfig } = createConfigInjectionToken(DAFF_SEARCH_STATE_CONFIG_DEFAULT, "DAFF_SEARCH_STATE_CONFIG");
|
|
228
|
+
const { token: DAFF_SEARCH_ERROR_MATCHER, provider: provideDaffSearchErrorMatcher } = createSingleInjectionToken("DAFF_SEARCH_ERROR_MATCHER", { factory: () => daffTransformErrorToStateError });
|
|
229
|
+
const { token: DAFF_SEARCH_REDUCERS, provider: provideDaffSearchReducers, factoryProvider: provideDaffSearchReducersFactory } = createSingleInjectionToken("DAFF_SEARCH_REDUCERS");
|
|
230
|
+
var DaffSearchStateModule = class DaffSearchStateModule {
|
|
231
|
+
static {
|
|
232
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
233
|
+
minVersion: "12.0.0",
|
|
234
|
+
version: "22.2.4",
|
|
235
|
+
ngImport: i0,
|
|
236
|
+
type: DaffSearchStateModule,
|
|
237
|
+
deps: [],
|
|
238
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
static {
|
|
242
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
243
|
+
minVersion: "14.0.0",
|
|
244
|
+
version: "22.2.4",
|
|
245
|
+
ngImport: i0,
|
|
246
|
+
type: DaffSearchStateModule,
|
|
247
|
+
imports: [i1$1.StoreFeatureModule]
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
static {
|
|
251
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
252
|
+
minVersion: "12.0.0",
|
|
253
|
+
version: "22.2.4",
|
|
254
|
+
ngImport: i0,
|
|
255
|
+
type: DaffSearchStateModule,
|
|
256
|
+
providers: [provideDaffSearchReducersFactory((() => daffComposeReducers([combineReducers(daffSearchReducers), ...inject(DAFF_SEARCH_EXTRA_REDUCERS)])))],
|
|
257
|
+
imports: [StoreModule.forFeature(DAFF_SEARCH_STORE_FEATURE_KEY, DAFF_SEARCH_REDUCERS)]
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
262
|
+
minVersion: "12.0.0",
|
|
263
|
+
version: "22.2.4",
|
|
264
|
+
ngImport: i0,
|
|
265
|
+
type: DaffSearchStateModule,
|
|
266
|
+
decorators: [{
|
|
267
|
+
type: NgModule,
|
|
268
|
+
args: [{
|
|
269
|
+
imports: [StoreModule.forFeature(DAFF_SEARCH_STORE_FEATURE_KEY, DAFF_SEARCH_REDUCERS)],
|
|
270
|
+
providers: [provideDaffSearchReducersFactory((() => daffComposeReducers([combineReducers(daffSearchReducers), ...inject(DAFF_SEARCH_EXTRA_REDUCERS)])))]
|
|
271
|
+
}]
|
|
272
|
+
}]
|
|
273
|
+
});
|
|
274
|
+
var DaffSearchIncrementalEffects = class DaffSearchIncrementalEffects {
|
|
275
|
+
constructor(actions$, driver, errorMatcher, config) {
|
|
276
|
+
this.actions$ = actions$;
|
|
277
|
+
this.driver = driver;
|
|
278
|
+
this.errorMatcher = errorMatcher;
|
|
279
|
+
this.config = config;
|
|
280
|
+
this.incremental$ = createEffect(() => (throttleWindow = 200, scheduler = asyncScheduler) => this.actions$.pipe(ofType(DaffSearchActionTypes.SearchIncrementalAction), debounceTime(throttleWindow, scheduler), switchMap((action) => this.driver.incremental(action.query, {
|
|
281
|
+
limit: this.config.incrementalResultLimit,
|
|
282
|
+
...action.options
|
|
283
|
+
}).pipe(map((resp) => new DaffSearchIncrementalSuccess(resp)), catchError((error) => of(new DaffSearchIncrementalFailure(this.errorMatcher(error))))))));
|
|
284
|
+
}
|
|
285
|
+
static {
|
|
286
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
287
|
+
minVersion: "12.0.0",
|
|
288
|
+
version: "22.2.4",
|
|
289
|
+
ngImport: i0,
|
|
290
|
+
type: DaffSearchIncrementalEffects,
|
|
291
|
+
deps: [
|
|
292
|
+
{ token: i1.Actions },
|
|
293
|
+
{ token: DaffSearchDriver },
|
|
294
|
+
{ token: DAFF_SEARCH_ERROR_MATCHER },
|
|
295
|
+
{ token: DAFF_SEARCH_STATE_CONFIG }
|
|
296
|
+
],
|
|
297
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
static {
|
|
301
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
302
|
+
minVersion: "12.0.0",
|
|
303
|
+
version: "22.2.4",
|
|
304
|
+
ngImport: i0,
|
|
305
|
+
type: DaffSearchIncrementalEffects
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
310
|
+
minVersion: "12.0.0",
|
|
311
|
+
version: "22.2.4",
|
|
312
|
+
ngImport: i0,
|
|
313
|
+
type: DaffSearchIncrementalEffects,
|
|
314
|
+
decorators: [{ type: Injectable }],
|
|
315
|
+
ctorParameters: () => [
|
|
316
|
+
{ type: i1.Actions },
|
|
317
|
+
{
|
|
318
|
+
type: void 0,
|
|
319
|
+
decorators: [{
|
|
320
|
+
type: Inject,
|
|
321
|
+
args: [DaffSearchDriver]
|
|
322
|
+
}]
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
type: void 0,
|
|
326
|
+
decorators: [{
|
|
327
|
+
type: Inject,
|
|
328
|
+
args: [DAFF_SEARCH_ERROR_MATCHER]
|
|
329
|
+
}]
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
type: void 0,
|
|
333
|
+
decorators: [{
|
|
334
|
+
type: Inject,
|
|
335
|
+
args: [DAFF_SEARCH_STATE_CONFIG]
|
|
336
|
+
}]
|
|
337
|
+
}
|
|
338
|
+
]
|
|
339
|
+
});
|
|
340
|
+
var DaffSearchIncrementalStateModule = class DaffSearchIncrementalStateModule {
|
|
341
|
+
static withConfig(config = DAFF_SEARCH_STATE_CONFIG_DEFAULT) {
|
|
342
|
+
return {
|
|
343
|
+
ngModule: DaffSearchIncrementalStateModule,
|
|
344
|
+
providers: [provideDaffSearchStateConfig(config)]
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
static {
|
|
348
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
349
|
+
minVersion: "12.0.0",
|
|
350
|
+
version: "22.2.4",
|
|
351
|
+
ngImport: i0,
|
|
352
|
+
type: DaffSearchIncrementalStateModule,
|
|
353
|
+
deps: [],
|
|
354
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
static {
|
|
358
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
359
|
+
minVersion: "14.0.0",
|
|
360
|
+
version: "22.2.4",
|
|
361
|
+
ngImport: i0,
|
|
362
|
+
type: DaffSearchIncrementalStateModule,
|
|
363
|
+
imports: [i1.EffectsFeatureModule, DaffSearchStateModule]
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
static {
|
|
367
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
368
|
+
minVersion: "12.0.0",
|
|
369
|
+
version: "22.2.4",
|
|
370
|
+
ngImport: i0,
|
|
371
|
+
type: DaffSearchIncrementalStateModule,
|
|
372
|
+
imports: [EffectsModule.forFeature([DaffSearchIncrementalEffects]), DaffSearchStateModule]
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
377
|
+
minVersion: "12.0.0",
|
|
378
|
+
version: "22.2.4",
|
|
379
|
+
ngImport: i0,
|
|
380
|
+
type: DaffSearchIncrementalStateModule,
|
|
381
|
+
decorators: [{
|
|
382
|
+
type: NgModule,
|
|
383
|
+
args: [{ imports: [EffectsModule.forFeature([DaffSearchIncrementalEffects]), DaffSearchStateModule] }]
|
|
384
|
+
}]
|
|
385
|
+
});
|
|
386
|
+
var DaffSearchPageEffects = class DaffSearchPageEffects {
|
|
387
|
+
constructor(actions$, driver, errorMatcher) {
|
|
388
|
+
this.actions$ = actions$;
|
|
389
|
+
this.driver = driver;
|
|
390
|
+
this.errorMatcher = errorMatcher;
|
|
391
|
+
this.search$ = createEffect(() => this.actions$.pipe(ofType(DaffSearchActionTypes.SearchLoadAction), switchMap((action) => this.driver.search(action.query, action.options).pipe(map((resp) => new DaffSearchLoadSuccess(resp)), catchError((error) => of(new DaffSearchLoadFailure(this.errorMatcher(error))))))));
|
|
392
|
+
}
|
|
393
|
+
static {
|
|
394
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
395
|
+
minVersion: "12.0.0",
|
|
396
|
+
version: "22.2.4",
|
|
397
|
+
ngImport: i0,
|
|
398
|
+
type: DaffSearchPageEffects,
|
|
399
|
+
deps: [
|
|
400
|
+
{ token: i1.Actions },
|
|
401
|
+
{ token: DaffSearchDriver },
|
|
402
|
+
{ token: DAFF_SEARCH_ERROR_MATCHER }
|
|
403
|
+
],
|
|
404
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
static {
|
|
408
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
409
|
+
minVersion: "12.0.0",
|
|
410
|
+
version: "22.2.4",
|
|
411
|
+
ngImport: i0,
|
|
412
|
+
type: DaffSearchPageEffects
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
417
|
+
minVersion: "12.0.0",
|
|
418
|
+
version: "22.2.4",
|
|
419
|
+
ngImport: i0,
|
|
420
|
+
type: DaffSearchPageEffects,
|
|
421
|
+
decorators: [{ type: Injectable }],
|
|
422
|
+
ctorParameters: () => [
|
|
423
|
+
{ type: i1.Actions },
|
|
424
|
+
{
|
|
425
|
+
type: void 0,
|
|
426
|
+
decorators: [{
|
|
427
|
+
type: Inject,
|
|
428
|
+
args: [DaffSearchDriver]
|
|
429
|
+
}]
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
type: void 0,
|
|
433
|
+
decorators: [{
|
|
434
|
+
type: Inject,
|
|
435
|
+
args: [DAFF_SEARCH_ERROR_MATCHER]
|
|
436
|
+
}]
|
|
437
|
+
}
|
|
438
|
+
]
|
|
439
|
+
});
|
|
440
|
+
var DaffSearchPageStateModule = class DaffSearchPageStateModule {
|
|
441
|
+
static {
|
|
442
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
443
|
+
minVersion: "12.0.0",
|
|
444
|
+
version: "22.2.4",
|
|
445
|
+
ngImport: i0,
|
|
446
|
+
type: DaffSearchPageStateModule,
|
|
447
|
+
deps: [],
|
|
448
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
static {
|
|
452
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
453
|
+
minVersion: "14.0.0",
|
|
454
|
+
version: "22.2.4",
|
|
455
|
+
ngImport: i0,
|
|
456
|
+
type: DaffSearchPageStateModule,
|
|
457
|
+
imports: [i1.EffectsFeatureModule, DaffSearchStateModule]
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
static {
|
|
461
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
462
|
+
minVersion: "12.0.0",
|
|
463
|
+
version: "22.2.4",
|
|
464
|
+
ngImport: i0,
|
|
465
|
+
type: DaffSearchPageStateModule,
|
|
466
|
+
imports: [EffectsModule.forFeature([DaffSearchPageEffects]), DaffSearchStateModule]
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
471
|
+
minVersion: "12.0.0",
|
|
472
|
+
version: "22.2.4",
|
|
473
|
+
ngImport: i0,
|
|
474
|
+
type: DaffSearchPageStateModule,
|
|
475
|
+
decorators: [{
|
|
476
|
+
type: NgModule,
|
|
477
|
+
args: [{ imports: [EffectsModule.forFeature([DaffSearchPageEffects]), DaffSearchStateModule] }]
|
|
478
|
+
}]
|
|
479
|
+
});
|
|
480
|
+
const provideDaffSearchState = () => makeEnvironmentProviders([provideState(DAFF_SEARCH_STORE_FEATURE_KEY, DAFF_SEARCH_REDUCERS), provideDaffSearchReducersFactory(() => daffComposeReducers([combineReducers(daffSearchReducers), ...inject(DAFF_SEARCH_EXTRA_REDUCERS)]))]);
|
|
481
|
+
const provideDaffSearchIncrementalState = (config = DAFF_SEARCH_STATE_CONFIG_DEFAULT) => makeEnvironmentProviders([
|
|
482
|
+
provideEffects(DaffSearchIncrementalEffects),
|
|
483
|
+
provideDaffSearchState(),
|
|
484
|
+
provideDaffSearchStateConfig(config)
|
|
485
|
+
]);
|
|
486
|
+
const provideDaffSearchPageState = () => makeEnvironmentProviders([provideEffects(DaffSearchPageEffects), provideDaffSearchState()]);
|
|
487
|
+
export { DAFF_SEARCH_ERROR_MATCHER, DAFF_SEARCH_EXTRA_REDUCERS, DAFF_SEARCH_STATE_CONFIG, DAFF_SEARCH_STATE_CONFIG_DEFAULT, DAFF_SEARCH_STORE_FEATURE_KEY, DaffSearchActionTypes, DaffSearchFacadeBase, DaffSearchIncremental, DaffSearchIncrementalFacade, DaffSearchIncrementalFailure, DaffSearchIncrementalStateModule, DaffSearchIncrementalSuccess, DaffSearchLoad, DaffSearchLoadFailure, DaffSearchLoadSuccess, DaffSearchPageFacade, DaffSearchPageStateModule, DaffSearchStateModule, DaffSearchStateReducerAdapter, daffSearchCreateSearchSelectors, daffSearchGetIncrementalSelectors, daffSearchGetPageSelectors, daffSearchIncrementalReducer, daffSearchInitialState, daffSearchPageReducer, daffSearchProvideExtraReducers, daffSearchReducers, getDaffSearchReducersStateSelector, provideDaffSearchErrorMatcher, provideDaffSearchIncrementalState, provideDaffSearchPageState, provideDaffSearchState, provideDaffSearchStateConfig };
|
|
364
488
|
|
|
365
|
-
|
|
366
|
-
* Creates the search feature store.
|
|
367
|
-
*/
|
|
368
|
-
class DaffSearchStateModule {
|
|
369
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
370
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchStateModule, imports: [i1.StoreFeatureModule] }); }
|
|
371
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchStateModule, imports: [StoreModule.forFeature(DAFF_SEARCH_STORE_FEATURE_KEY, DAFF_SEARCH_REDUCERS)] }); }
|
|
372
|
-
}
|
|
373
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchStateModule, decorators: [{
|
|
374
|
-
type: NgModule,
|
|
375
|
-
args: [{
|
|
376
|
-
imports: [
|
|
377
|
-
StoreModule.forFeature(DAFF_SEARCH_STORE_FEATURE_KEY, DAFF_SEARCH_REDUCERS),
|
|
378
|
-
],
|
|
379
|
-
}]
|
|
380
|
-
}] });
|
|
381
|
-
|
|
382
|
-
class DaffSearchIncrementalEffects {
|
|
383
|
-
constructor(actions$, driver, errorMatcher, config) {
|
|
384
|
-
this.actions$ = actions$;
|
|
385
|
-
this.driver = driver;
|
|
386
|
-
this.errorMatcher = errorMatcher;
|
|
387
|
-
this.config = config;
|
|
388
|
-
/**
|
|
389
|
-
* An effect for incremental searching with the provided driver.
|
|
390
|
-
*/
|
|
391
|
-
this.incremental$ = createEffect(() => (throttleWindow = 200, scheduler = asyncScheduler) => this.actions$.pipe(ofType(DaffSearchActionTypes.SearchIncrementalAction), debounceTime(throttleWindow, scheduler), switchMap((action) => this.driver.incremental(action.query, {
|
|
392
|
-
limit: this.config.incrementalResultLimit,
|
|
393
|
-
...action.options,
|
|
394
|
-
}).pipe(map(resp => new DaffSearchIncrementalSuccess(resp)), catchError((error) => of(new DaffSearchIncrementalFailure(this.errorMatcher(error))))))));
|
|
395
|
-
}
|
|
396
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchIncrementalEffects, deps: [{ token: i1$1.Actions }, { token: DaffSearchDriver }, { token: DAFF_SEARCH_ERROR_MATCHER }, { token: DAFF_SEARCH_STATE_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
397
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchIncrementalEffects }); }
|
|
398
|
-
}
|
|
399
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchIncrementalEffects, decorators: [{
|
|
400
|
-
type: Injectable
|
|
401
|
-
}], ctorParameters: () => [{ type: i1$1.Actions }, { type: undefined, decorators: [{
|
|
402
|
-
type: Inject,
|
|
403
|
-
args: [DaffSearchDriver]
|
|
404
|
-
}] }, { type: undefined, decorators: [{
|
|
405
|
-
type: Inject,
|
|
406
|
-
args: [DAFF_SEARCH_ERROR_MATCHER]
|
|
407
|
-
}] }, { type: undefined, decorators: [{
|
|
408
|
-
type: Inject,
|
|
409
|
-
args: [DAFF_SEARCH_STATE_CONFIG]
|
|
410
|
-
}] }] });
|
|
411
|
-
|
|
412
|
-
class DaffSearchIncrementalStateModule {
|
|
413
|
-
static withConfig(config = DAFF_SEARCH_STATE_CONFIG_DEFAULT) {
|
|
414
|
-
return {
|
|
415
|
-
ngModule: DaffSearchIncrementalStateModule,
|
|
416
|
-
providers: [
|
|
417
|
-
provideDaffSearchStateConfig(config),
|
|
418
|
-
],
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchIncrementalStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
422
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchIncrementalStateModule, imports: [i1$1.EffectsFeatureModule, DaffSearchStateModule] }); }
|
|
423
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchIncrementalStateModule, imports: [EffectsModule.forFeature([
|
|
424
|
-
DaffSearchIncrementalEffects,
|
|
425
|
-
]),
|
|
426
|
-
DaffSearchStateModule] }); }
|
|
427
|
-
}
|
|
428
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchIncrementalStateModule, decorators: [{
|
|
429
|
-
type: NgModule,
|
|
430
|
-
args: [{
|
|
431
|
-
imports: [
|
|
432
|
-
EffectsModule.forFeature([
|
|
433
|
-
DaffSearchIncrementalEffects,
|
|
434
|
-
]),
|
|
435
|
-
DaffSearchStateModule,
|
|
436
|
-
],
|
|
437
|
-
}]
|
|
438
|
-
}] });
|
|
439
|
-
|
|
440
|
-
class DaffSearchPageEffects {
|
|
441
|
-
constructor(actions$, driver, errorMatcher) {
|
|
442
|
-
this.actions$ = actions$;
|
|
443
|
-
this.driver = driver;
|
|
444
|
-
this.errorMatcher = errorMatcher;
|
|
445
|
-
/**
|
|
446
|
-
* An effect for searching with the provided driver.
|
|
447
|
-
*/
|
|
448
|
-
this.search$ = createEffect(() => this.actions$.pipe(ofType(DaffSearchActionTypes.SearchLoadAction), switchMap((action) => this.driver.search(action.query, action.options).pipe(map(resp => new DaffSearchLoadSuccess(resp)), catchError((error) => of(new DaffSearchLoadFailure(this.errorMatcher(error))))))));
|
|
449
|
-
}
|
|
450
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchPageEffects, deps: [{ token: i1$1.Actions }, { token: DaffSearchDriver }, { token: DAFF_SEARCH_ERROR_MATCHER }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
451
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchPageEffects }); }
|
|
452
|
-
}
|
|
453
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchPageEffects, decorators: [{
|
|
454
|
-
type: Injectable
|
|
455
|
-
}], ctorParameters: () => [{ type: i1$1.Actions }, { type: undefined, decorators: [{
|
|
456
|
-
type: Inject,
|
|
457
|
-
args: [DaffSearchDriver]
|
|
458
|
-
}] }, { type: undefined, decorators: [{
|
|
459
|
-
type: Inject,
|
|
460
|
-
args: [DAFF_SEARCH_ERROR_MATCHER]
|
|
461
|
-
}] }] });
|
|
462
|
-
|
|
463
|
-
class DaffSearchPageStateModule {
|
|
464
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchPageStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
465
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchPageStateModule, imports: [i1$1.EffectsFeatureModule, DaffSearchStateModule] }); }
|
|
466
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchPageStateModule, imports: [EffectsModule.forFeature([
|
|
467
|
-
DaffSearchPageEffects,
|
|
468
|
-
]),
|
|
469
|
-
DaffSearchStateModule] }); }
|
|
470
|
-
}
|
|
471
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSearchPageStateModule, decorators: [{
|
|
472
|
-
type: NgModule,
|
|
473
|
-
args: [{
|
|
474
|
-
imports: [
|
|
475
|
-
EffectsModule.forFeature([
|
|
476
|
-
DaffSearchPageEffects,
|
|
477
|
-
]),
|
|
478
|
-
DaffSearchStateModule,
|
|
479
|
-
],
|
|
480
|
-
}]
|
|
481
|
-
}] });
|
|
482
|
-
|
|
483
|
-
/**
|
|
484
|
-
* Generated bundle index. Do not edit.
|
|
485
|
-
*/
|
|
486
|
-
|
|
487
|
-
export { DAFF_SEARCH_ERROR_MATCHER, DAFF_SEARCH_EXTRA_REDUCERS, DAFF_SEARCH_STATE_CONFIG, DAFF_SEARCH_STATE_CONFIG_DEFAULT, DAFF_SEARCH_STORE_FEATURE_KEY, DaffSearchActionTypes, DaffSearchFacadeBase, DaffSearchIncremental, DaffSearchIncrementalFacade, DaffSearchIncrementalFailure, DaffSearchIncrementalStateModule, DaffSearchIncrementalSuccess, DaffSearchLoad, DaffSearchLoadFailure, DaffSearchLoadSuccess, DaffSearchPageFacade, DaffSearchPageStateModule, DaffSearchStateModule, DaffSearchStateReducerAdapter, daffSearchCreateSearchSelectors, daffSearchGetIncrementalSelectors, daffSearchGetPageSelectors, daffSearchIncrementalReducer, daffSearchInitialState, daffSearchPageReducer, daffSearchProvideExtraReducers, daffSearchReducers, getDaffSearchReducersStateSelector, provideDaffSearchErrorMatcher, provideDaffSearchStateConfig };
|
|
488
|
-
//# sourceMappingURL=daffodil-search-state.mjs.map
|
|
489
|
+
//# sourceMappingURL=daffodil-search-state.mjs.map
|