@dereekb/rxjs 2.0.0 → 4.0.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/CHANGELOG.md +47 -0
- package/package.json +10 -8
- package/src/index.js +1 -1
- package/src/index.js.map +1 -1
- package/src/lib/filter/filter.map.d.ts +4 -3
- package/src/lib/filter/filter.map.js.map +1 -1
- package/src/lib/filter/filter.source.d.ts +4 -4
- package/src/lib/filter/filter.source.js.map +1 -1
- package/src/lib/filter/index.js +4 -4
- package/src/lib/filter/index.js.map +1 -1
- package/src/lib/index.d.ts +1 -0
- package/src/lib/index.js +8 -7
- package/src/lib/index.js.map +1 -1
- package/src/lib/iterator/index.d.ts +1 -0
- package/src/lib/iterator/index.js +7 -6
- package/src/lib/iterator/index.js.map +1 -1
- package/src/lib/iterator/iteration.accumulator.d.ts +8 -4
- package/src/lib/iterator/iteration.accumulator.js +18 -21
- package/src/lib/iterator/iteration.accumulator.js.map +1 -1
- package/src/lib/iterator/iteration.accumulator.rxjs.d.ts +7 -3
- package/src/lib/iterator/iteration.accumulator.rxjs.js +21 -10
- package/src/lib/iterator/iteration.accumulator.rxjs.js.map +1 -1
- package/src/lib/iterator/iteration.d.ts +7 -3
- package/src/lib/iterator/iteration.mapped.page.d.ts +3 -2
- package/src/lib/iterator/iteration.mapped.page.js.map +1 -1
- package/src/lib/iterator/iteration.next.d.ts +8 -3
- package/src/lib/iterator/iteration.next.js +19 -6
- package/src/lib/iterator/iteration.next.js.map +1 -1
- package/src/lib/iterator/iterator.page.d.ts +22 -6
- package/src/lib/iterator/iterator.page.js +17 -5
- package/src/lib/iterator/iterator.page.js.map +1 -1
- package/src/lib/loading/index.js +8 -8
- package/src/lib/loading/index.js.map +1 -1
- package/src/lib/loading/loading.state.d.ts +4 -1
- package/src/lib/loading/loading.state.js +12 -2
- package/src/lib/loading/loading.state.js.map +1 -1
- package/src/lib/lock.d.ts +13 -7
- package/src/lib/lock.js +38 -14
- package/src/lib/lock.js.map +1 -1
- package/src/lib/object.js +2 -2
- package/src/lib/object.js.map +1 -1
- package/src/lib/rxjs/array.d.ts +17 -0
- package/src/lib/rxjs/array.js +23 -9
- package/src/lib/rxjs/array.js.map +1 -1
- package/src/lib/rxjs/boolean.d.ts +13 -1
- package/src/lib/rxjs/boolean.js +31 -1
- package/src/lib/rxjs/boolean.js.map +1 -1
- package/src/lib/rxjs/delta.d.ts +32 -0
- package/src/lib/rxjs/delta.js +51 -0
- package/src/lib/rxjs/delta.js.map +1 -0
- package/src/lib/rxjs/factory.d.ts +31 -0
- package/src/lib/rxjs/factory.js +21 -0
- package/src/lib/rxjs/factory.js.map +1 -0
- package/src/lib/rxjs/getter.d.ts +4 -4
- package/src/lib/rxjs/getter.js +3 -3
- package/src/lib/rxjs/getter.js.map +1 -1
- package/src/lib/rxjs/index.d.ts +9 -1
- package/src/lib/rxjs/index.js +16 -8
- package/src/lib/rxjs/index.js.map +1 -1
- package/src/lib/rxjs/lifecycle.d.ts +18 -0
- package/src/lib/rxjs/lifecycle.js +55 -0
- package/src/lib/rxjs/lifecycle.js.map +1 -0
- package/src/lib/rxjs/map.d.ts +10 -0
- package/src/lib/rxjs/map.js +17 -0
- package/src/lib/rxjs/map.js.map +1 -0
- package/src/lib/rxjs/number.d.ts +16 -1
- package/src/lib/rxjs/number.js +15 -3
- package/src/lib/rxjs/number.js.map +1 -1
- package/src/lib/rxjs/rxjs.async.d.ts +57 -0
- package/src/lib/rxjs/rxjs.async.js +69 -0
- package/src/lib/rxjs/rxjs.async.js.map +1 -0
- package/src/lib/rxjs/rxjs.d.ts +10 -2
- package/src/lib/rxjs/rxjs.js +17 -16
- package/src/lib/rxjs/rxjs.js.map +1 -1
- package/src/lib/rxjs/rxjs.map.d.ts +9 -0
- package/src/lib/rxjs/rxjs.map.js +26 -0
- package/src/lib/rxjs/rxjs.map.js.map +1 -0
- package/src/lib/rxjs/set.d.ts +4 -0
- package/src/lib/rxjs/set.js +14 -0
- package/src/lib/rxjs/set.js.map +1 -0
- package/src/lib/rxjs/use.d.ts +7 -0
- package/src/lib/rxjs/use.js +14 -0
- package/src/lib/rxjs/use.js.map +1 -0
- package/src/lib/rxjs/value.d.ts +28 -5
- package/src/lib/rxjs/value.js +54 -3
- package/src/lib/rxjs/value.js.map +1 -1
- package/src/lib/work/index.d.ts +2 -0
- package/src/lib/work/index.js +6 -0
- package/src/lib/work/index.js.map +1 -0
- package/src/lib/work/work.factory.d.ts +35 -0
- package/src/lib/work/work.factory.js +43 -0
- package/src/lib/work/work.factory.js.map +1 -0
- package/src/lib/work/work.instance.d.ts +60 -0
- package/src/lib/work/work.instance.js +129 -0
- package/src/lib/work/work.instance.js.map +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,53 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
# [4.0.0](https://github.com/dereekb/dbx-components/compare/v3.0.0...v4.0.0) (2022-05-14)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# [3.0.0](https://github.com/dereekb/dbx-components/compare/v2.1.0...v3.0.0) (2022-05-13)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* cleanup() now calls the destroy function on complete ([dc8f06b](https://github.com/dereekb/dbx-components/commit/dc8f06b7a5b9f62973356a967867400abb9049e3))
|
|
15
|
+
* fixed issue with allSuccessfulStates$ in itemAccumulatorInstance ([0396ac5](https://github.com/dereekb/dbx-components/commit/0396ac58fec1a24b703da520063e09c36bbfbf0a))
|
|
16
|
+
* itemAccumulatorInstance fix ([d67c9d1](https://github.com/dereekb/dbx-components/commit/d67c9d197934e0c4dee2070a2eea105a7114a56c))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* added AsyncPusher ([8cb2052](https://github.com/dereekb/dbx-components/commit/8cb2052577e0901d2acafa3db724b94ab0035b0a))
|
|
22
|
+
* added cleanup() ([1885463](https://github.com/dereekb/dbx-components/commit/18854634041fcdf613ea8f8b0640db9fb218bbce))
|
|
23
|
+
* added dbxFirebaseCollectionChangeDirective ([93a38a2](https://github.com/dereekb/dbx-components/commit/93a38a2be5da3ab5d1bf7905467441fc8b2d563e))
|
|
24
|
+
* added dbxFirebaseCollectionStore ([9704c83](https://github.com/dereekb/dbx-components/commit/9704c83603079fe1c58c3961f64d8472ff90bf6d))
|
|
25
|
+
* added dbxFirebaseDocumentStore ([43da785](https://github.com/dereekb/dbx-components/commit/43da785b1b271549f65273a56a0c333a0a23bb2e))
|
|
26
|
+
* added dbxFirebaseDocumentWithParentStore ([f055d81](https://github.com/dereekb/dbx-components/commit/f055d81aadc8df852640e7997368af73be05b654))
|
|
27
|
+
* added dbxFirebaseModelLoaderModule ([15a8052](https://github.com/dereekb/dbx-components/commit/15a8052e057fa6e5691915ab81b5fe8b4afdfa95))
|
|
28
|
+
* added dbxFormWorkingWrapperComponent ([fd32cd4](https://github.com/dereekb/dbx-components/commit/fd32cd4c2933e79c255f07f86fdc8fc3029b0858))
|
|
29
|
+
* added firebaseQueryItemAccumulator ([1e4e0f3](https://github.com/dereekb/dbx-components/commit/1e4e0f367a4bdc9dac7366ae9421e9ec48279b92))
|
|
30
|
+
* added IterationQueryChangeWatcher ([f5b2474](https://github.com/dereekb/dbx-components/commit/f5b2474f9a2cf659cdebf19ba49055e5bd2f1c90))
|
|
31
|
+
* added mapKeysIntersection utility functions ([f694f86](https://github.com/dereekb/dbx-components/commit/f694f86b87e646e00e446236bb1c94a28652aa70))
|
|
32
|
+
* added onMatchDelta ([e36fb4c](https://github.com/dereekb/dbx-components/commit/e36fb4c47c82ef7a616b7d3b12888e370206a2e5))
|
|
33
|
+
* added setContainsAllValues ([737c1e7](https://github.com/dereekb/dbx-components/commit/737c1e750a9c656406043e2a69bdceaf941750b6))
|
|
34
|
+
* refactored dbxFormSource ([aad115d](https://github.com/dereekb/dbx-components/commit/aad115d9809ed765ddadc63c9f56ac2a4ab5ce5a))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### BREAKING CHANGES
|
|
38
|
+
|
|
39
|
+
* - renamed flattenIterationResultItemArray to flattenAccumulatorResultItemArray since the input is an accumulator and not an iteration
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# [2.1.0](https://github.com/dereekb/dbx-components/compare/v2.0.0...v2.1.0) (2022-03-17)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
* dbxActionPopoverDirective ([a808ac9](https://github.com/dereekb/dbx-components/commit/a808ac9a7b62841311d63df1d1ee55e57876f47f))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
5
52
|
# [2.0.0](https://github.com/dereekb/dbx-components/compare/v1.2.0...v2.0.0) (2022-03-13)
|
|
6
53
|
|
|
7
54
|
|
package/package.json
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/rxjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./src/index.d.ts",
|
|
7
|
-
"dependencies": {
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
"
|
|
7
|
+
"dependencies": {},
|
|
8
|
+
"peerDependencies": {
|
|
9
|
+
"rxjs": "^7.0.0",
|
|
10
|
+
"@dereekb/util": "4.0.0",
|
|
11
11
|
"make-error": "^1.3.0",
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
"extra-set": "^2.2.11",
|
|
13
|
+
"change-case": "^4.1.2",
|
|
14
|
+
"ms": "^3.0.0-canary.1",
|
|
15
|
+
"tslib": "^2.0.0"
|
|
16
|
+
}
|
|
15
17
|
}
|
package/src/index.js
CHANGED
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/rxjs/src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/rxjs/src/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ObservableOrValue } from '../rxjs/getter';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { FilterSource, FilterSourceConnector } from './filter';
|
|
4
|
+
import { Destroyable } from '@dereekb/util';
|
|
4
5
|
export declare type FilterMapKey = string;
|
|
5
6
|
/**
|
|
6
7
|
* Class used to keep track of filters keyed by a specific string identifier.
|
|
7
8
|
*/
|
|
8
|
-
export declare class FilterMap<F> {
|
|
9
|
+
export declare class FilterMap<F> implements Destroyable {
|
|
9
10
|
private readonly _map;
|
|
10
11
|
filterForKey(key: FilterMapKey): Observable<F>;
|
|
11
|
-
addDefaultFilterObs(key: FilterMapKey, obs:
|
|
12
|
+
addDefaultFilterObs(key: FilterMapKey, obs: ObservableOrValue<F>): void;
|
|
12
13
|
addFilterObs(key: FilterMapKey, obs: Observable<F>): void;
|
|
13
14
|
makeInstance(key: FilterMapKey): FilterMapKeyInstance<F>;
|
|
14
15
|
instanceObsForKeyObs(keyObs: Observable<FilterMapKey>): Observable<FilterMapKeyInstance<F>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.map.js","sourceRoot":"","sources":["../../../../../../packages/rxjs/src/lib/filter/filter.map.ts"],"names":[],"mappings":";;;AAAA,yCAA4C;AAE5C,mDAAuD;AACvD,+BAA6G;
|
|
1
|
+
{"version":3,"file":"filter.map.js","sourceRoot":"","sources":["../../../../../../packages/rxjs/src/lib/filter/filter.map.ts"],"names":[],"mappings":";;;AAAA,yCAA4C;AAE5C,mDAAuD;AACvD,+BAA6G;AAM7G;;GAEG;AACH,MAAa,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,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;IAED,YAAY,CAAC,GAAkB;QAE7B;;WAEG;QACH,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED,OAAO;QACL,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;CAEF"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { FilterSource } from './filter';
|
|
3
|
-
import {
|
|
4
|
-
import { Maybe } from '@dereekb/util';
|
|
3
|
+
import { ObservableOrValue } from '../rxjs/getter';
|
|
4
|
+
import { Destroyable, Maybe } from '@dereekb/util';
|
|
5
5
|
/**
|
|
6
6
|
* A basic FilterSource implementation.
|
|
7
7
|
*/
|
|
8
|
-
export declare class FilterSourceInstance<F> implements FilterSource<F
|
|
8
|
+
export declare class FilterSourceInstance<F> implements FilterSource<F>, Destroyable {
|
|
9
9
|
private _filter;
|
|
10
10
|
private _initialFilter;
|
|
11
11
|
private _defaultFilter;
|
|
@@ -16,7 +16,7 @@ export declare class FilterSourceInstance<F> implements FilterSource<F> {
|
|
|
16
16
|
*/
|
|
17
17
|
readonly filter$: Observable<F>;
|
|
18
18
|
initWithFilter(filterObs: Observable<F>): void;
|
|
19
|
-
setDefaultFilter(filter: Maybe<
|
|
19
|
+
setDefaultFilter(filter: Maybe<ObservableOrValue<Maybe<F>>>): void;
|
|
20
20
|
setFilter(filter: F): void;
|
|
21
21
|
/**
|
|
22
22
|
* Resets the current filter to be the default filter.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.source.js","sourceRoot":"","sources":["../../../../../../packages/rxjs/src/lib/filter/filter.source.ts"],"names":[],"mappings":";;;AAAA,+BAAgI;AAEhI,sCAA6D;AAC7D,
|
|
1
|
+
{"version":3,"file":"filter.source.js","sourceRoot":"","sources":["../../../../../../packages/rxjs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AAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAA,qBAAY,EAAC,MAAM,CAAC,CAAC,CAAC;IACjD,CAAC;IAED,SAAS,CAAC,MAAS;QACjB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,WAAW;QACT,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAA,YAAK,GAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE;YAChD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB;IAChB,OAAO;QACL,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACxB,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;CAEF;AApDD,oDAoDC"}
|
package/src/lib/filter/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./filter.map"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./filter.preset"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./filter.source"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./filter"), exports);
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/rxjs/src/lib/filter/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/rxjs/src/lib/filter/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,0DAAgC;AAChC,0DAAgC;AAChC,mDAAyB"}
|
package/src/lib/index.d.ts
CHANGED
package/src/lib/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./filter"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./iterator"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./loading"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./lock"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./object"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./rxjs"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./work"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./subscription"), exports);
|
|
11
12
|
//# sourceMappingURL=index.js.map
|
package/src/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/rxjs/src/lib/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/rxjs/src/lib/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB;AACzB,qDAA2B;AAC3B,oDAA0B;AAC1B,iDAAuB;AACvB,mDAAyB;AACzB,iDAAuB;AACvB,iDAAuB;AACvB,yDAA+B"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./iteration.next"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./iteration.accumulator"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./iteration.accumulator.rxjs"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./iteration"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./iteration.mapped"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./iteration.mapped.page"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./iterator.page"), exports);
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/rxjs/src/lib/iterator/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/rxjs/src/lib/iterator/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC;AACjC,kEAAwC;AACxC,uEAA6C;AAC7C,sDAA4B;AAC5B,6DAAmC;AACnC,kEAAwC;AACxC,0DAAgC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { Destroyable } from "@dereekb/util";
|
|
3
3
|
import { ItemIteration, PageItemIteration } from "./iteration";
|
|
4
|
-
import { LoadingState } from '../loading';
|
|
4
|
+
import { LoadingState, MapLoadingStateValueMapFunction } from '../loading';
|
|
5
|
+
export declare type ItemAccumulatorMapFunction<O, I> = MapLoadingStateValueMapFunction<O, I>;
|
|
5
6
|
/**
|
|
6
7
|
* An object that accumulates and exposes values from an ItemIteration.
|
|
7
8
|
*/
|
|
@@ -14,6 +15,10 @@ export interface ItemAccumulator<O, I = any, N extends ItemIteration<I> = ItemIt
|
|
|
14
15
|
* Returns all items loaded so far in the iteration in a single array.
|
|
15
16
|
*/
|
|
16
17
|
readonly allItems$: Observable<O[]>;
|
|
18
|
+
/**
|
|
19
|
+
* The item mapping function for this accumulator.
|
|
20
|
+
*/
|
|
21
|
+
mapItemFunction: ItemAccumulatorMapFunction<O, I>;
|
|
17
22
|
}
|
|
18
23
|
/**
|
|
19
24
|
* An object that accumulates and exposes values from a PageItemIteration.
|
|
@@ -27,7 +32,6 @@ export declare type MonotypeItemAccumulator<I, N extends ItemIteration<I> = Item
|
|
|
27
32
|
* A page accumulator with no mapping.
|
|
28
33
|
*/
|
|
29
34
|
export declare type MonotypePageItemAccumulator<I, N extends PageItemIteration<I> = PageItemIteration<I>> = ItemAccumulator<I, I, N>;
|
|
30
|
-
export declare type ItemAccumulatorMapFunction<O, I> = ((item: I) => Maybe<O>) | ((item: I, state: LoadingState<I>) => Maybe<O>);
|
|
31
35
|
/**
|
|
32
36
|
* ItemAccumulator implementation.
|
|
33
37
|
*/
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.itemAccumulator = exports.ItemAccumulatorInstance = void 0;
|
|
4
4
|
const subscription_1 = require("../subscription");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const rxjs_1 = require("rxjs");
|
|
6
|
+
const rxjs_2 = require("../rxjs");
|
|
7
7
|
const util_1 = require("@dereekb/util");
|
|
8
|
-
const rxjs_2 = require("rxjs");
|
|
9
8
|
const loading_1 = require("../loading");
|
|
10
9
|
/**
|
|
11
10
|
* ItemAccumulator implementation.
|
|
@@ -14,23 +13,21 @@ class ItemAccumulatorInstance {
|
|
|
14
13
|
constructor(itemIteration, mapItemFunction) {
|
|
15
14
|
this.itemIteration = itemIteration;
|
|
16
15
|
this.mapItemFunction = mapItemFunction;
|
|
17
|
-
this.latestSuccessfulState$ = this.itemIteration.latestState$.pipe((0,
|
|
16
|
+
this.latestSuccessfulState$ = this.itemIteration.latestState$.pipe((0, rxjs_1.filter)(x => !(0, loading_1.loadingStateHasError)(x)), (0, rxjs_1.distinctUntilChanged)(), (0, rxjs_1.shareReplay)(1));
|
|
18
17
|
/**
|
|
19
18
|
* All successful page results in a single array.
|
|
20
19
|
*/
|
|
21
|
-
this.allSuccessfulStates$ = this.latestSuccessfulState$.pipe((0,
|
|
22
|
-
|
|
20
|
+
this.allSuccessfulStates$ = this.latestSuccessfulState$.pipe((0, rxjs_2.scanIntoArray)({ immutable: false }),
|
|
21
|
+
/**
|
|
22
|
+
* Don't wait for the first successful state in order to avoid never returning a value on immediate failures.
|
|
23
|
+
*/
|
|
24
|
+
(0, rxjs_1.startWith)([]), (0, rxjs_2.distinctUntilArrayLengthChanges)(), (0, rxjs_1.shareReplay)(1));
|
|
25
|
+
this.successfulLoadCount$ = this.allSuccessfulStates$.pipe((0, rxjs_1.map)(x => x.length), (0, rxjs_1.shareReplay)(1));
|
|
23
26
|
// MARK: ItemAccumulator
|
|
24
|
-
this.allItems$ = this.allSuccessfulStates$.pipe((0,
|
|
25
|
-
const mapStateToItem = (
|
|
26
|
-
let result;
|
|
27
|
-
if (state.value != null) {
|
|
28
|
-
result = this.mapItemFunction(state.value, state);
|
|
29
|
-
}
|
|
30
|
-
return result;
|
|
31
|
-
};
|
|
27
|
+
this.allItems$ = this.allSuccessfulStates$.pipe((0, rxjs_2.scanBuildArray)((allSuccessfulStates) => {
|
|
28
|
+
const mapStateToItem = (0, loading_1.mapLoadingStateValueFunction)(this.mapItemFunction);
|
|
32
29
|
/*
|
|
33
|
-
|
|
30
|
+
Start with allSuccessfulPageResults$ since it contains all page results since the start of the iterator,
|
|
34
31
|
and subscription to allItems may not have started at the same time.
|
|
35
32
|
|
|
36
33
|
We use scan to add in all models coming in afterwards by pushing them into the accumulator.
|
|
@@ -40,12 +37,12 @@ class ItemAccumulatorInstance {
|
|
|
40
37
|
const allPageResultsUpToFirstSubscription = allSuccessfulStates;
|
|
41
38
|
const firstLatestState = (0, util_1.lastValue)(allPageResultsUpToFirstSubscription);
|
|
42
39
|
const seed = (0, util_1.filterMaybeValues)(allPageResultsUpToFirstSubscription.map(mapStateToItem));
|
|
43
|
-
const accumulatorObs = this.latestSuccessfulState$.pipe((0,
|
|
40
|
+
const accumulatorObs = this.latestSuccessfulState$.pipe((0, rxjs_1.skipWhile)(x => x === firstLatestState), (0, rxjs_1.map)(mapStateToItem), (0, rxjs_2.filterMaybe)());
|
|
44
41
|
return {
|
|
45
42
|
seed,
|
|
46
43
|
accumulatorObs
|
|
47
44
|
};
|
|
48
|
-
}));
|
|
45
|
+
}), (0, rxjs_1.shareReplay)(1));
|
|
49
46
|
this._sub = new subscription_1.SubscriptionObject(this.allSuccessfulStates$.subscribe());
|
|
50
47
|
}
|
|
51
48
|
destroy() {
|
|
@@ -53,11 +50,11 @@ class ItemAccumulatorInstance {
|
|
|
53
50
|
}
|
|
54
51
|
}
|
|
55
52
|
exports.ItemAccumulatorInstance = ItemAccumulatorInstance;
|
|
56
|
-
function itemAccumulator(itemIteration,
|
|
57
|
-
if (!
|
|
58
|
-
|
|
53
|
+
function itemAccumulator(itemIteration, mapItem) {
|
|
54
|
+
if (!mapItem) {
|
|
55
|
+
mapItem = (a) => a;
|
|
59
56
|
}
|
|
60
|
-
return new ItemAccumulatorInstance(itemIteration,
|
|
57
|
+
return new ItemAccumulatorInstance(itemIteration, mapItem);
|
|
61
58
|
}
|
|
62
59
|
exports.itemAccumulator = itemAccumulator;
|
|
63
60
|
//# sourceMappingURL=iteration.accumulator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iteration.accumulator.js","sourceRoot":"","sources":["../../../../../../packages/rxjs/src/lib/iterator/iteration.accumulator.ts"],"names":[],"mappings":";;;AAAA,kDAAqD;AACrD
|
|
1
|
+
{"version":3,"file":"iteration.accumulator.js","sourceRoot":"","sources":["../../../../../../packages/rxjs/src/lib/iterator/iteration.accumulator.ts"],"names":[],"mappings":";;;AAAA,kDAAqD;AACrD,+BAAwG;AACxG,kCAAsG;AACtG,wCAAiF;AAEjF,wCAA+H;AAyC/H;;GAEG;AACH,MAAa,uBAAuB;IAElC,YAAqB,aAAgB,EAAW,eAAiD;QAA5E,k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CAAC,CAAC,KAAK,gBAAgB,CAAC,EACtC,IAAA,UAAG,EAAC,cAAc,CAAC,EACnB,IAAA,kBAAW,GAAE,CACd,CAAC;YAEF,OAAO;gBACL,IAAI;gBACJ,cAAc;aACf,CAAC;QACJ,CAAC,CAAC,EACF,IAAA,kBAAW,EAAC,CAAC,CAAC,CACf,CAAC;QAEM,SAAI,GAAG,IAAI,iCAAkB,CAAC,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE,CAAC,CAAC;IAzDwB,CAAC;IA2DtG,OAAO;QACL,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC;CAEF;AAjED,0DAiEC;AAWD,SAAgB,eAAe,CAAmC,aAAgB,EAAE,OAA0C;IAC5H,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,GAAG,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC;KACzB;IAED,OAAO,IAAI,uBAAuB,CAAU,aAAa,EAAE,OAAO,CAAC,CAAC;AACtE,CAAC;AAND,0CAMC"}
|
|
@@ -4,11 +4,15 @@ import { ItemAccumulator, PageItemAccumulator } from './iteration.accumulator';
|
|
|
4
4
|
/**
|
|
5
5
|
* Used for ItemAccumulators that have an array of results returned per page instead of a single item.
|
|
6
6
|
*
|
|
7
|
-
* @param
|
|
7
|
+
* @param accumulator
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function flattenAccumulatorResultItemArray<T>(accumulator: ItemAccumulator<T[]>): Observable<T[]>;
|
|
11
|
+
/**
|
|
12
|
+
* A PageListLoadingState that captures all the values that have been loaded so far, flattens them as an array, and the current loading state of currentPageResult$.
|
|
13
|
+
*/
|
|
14
|
+
export declare function accumulatorFlattenPageListLoadingState<T>(accumulator: PageItemAccumulator<T[]>): Observable<PageListLoadingState<T>>;
|
|
11
15
|
/**
|
|
12
16
|
* A PageListLoadingState that captures all the values that have been loaded so far, and the current loading state of currentPageResult$.
|
|
13
17
|
*/
|
|
14
|
-
export declare function
|
|
18
|
+
export declare function accumulatorCurrentPageListLoadingState<V>(accumulator: PageItemAccumulator<V>): Observable<PageListLoadingState<V>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.accumulatorCurrentPageListLoadingState = exports.accumulatorFlattenPageListLoadingState = exports.flattenAccumulatorResultItemArray = void 0;
|
|
4
4
|
const util_1 = require("@dereekb/util");
|
|
5
5
|
const rxjs_1 = require("../rxjs");
|
|
6
6
|
const rxjs_2 = require("rxjs");
|
|
@@ -8,28 +8,39 @@ const loading_1 = require("../loading");
|
|
|
8
8
|
/**
|
|
9
9
|
* Used for ItemAccumulators that have an array of results returned per page instead of a single item.
|
|
10
10
|
*
|
|
11
|
-
* @param
|
|
11
|
+
* @param accumulator
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
|
-
function
|
|
15
|
-
return
|
|
14
|
+
function flattenAccumulatorResultItemArray(accumulator) {
|
|
15
|
+
return accumulator.allItems$.pipe((0, rxjs_1.scanBuildArray)((allItems) => {
|
|
16
16
|
const seed = (0, util_1.flattenArray)(allItems);
|
|
17
17
|
const latestItem = (0, util_1.lastValue)(allItems);
|
|
18
|
-
const
|
|
18
|
+
const mapStateToItem = (0, loading_1.mapLoadingStateValueFunction)(accumulator.mapItemFunction);
|
|
19
|
+
const accumulatorObs = accumulator.itemIteration.latestState$.pipe((0, rxjs_2.skipWhile)(x => x.value === latestItem), (0, rxjs_2.map)(mapStateToItem), (0, rxjs_1.filterMaybe)());
|
|
19
20
|
return {
|
|
20
21
|
seed,
|
|
21
|
-
accumulatorObs
|
|
22
|
+
accumulatorObs,
|
|
23
|
+
flattenArray: true
|
|
22
24
|
};
|
|
23
25
|
}));
|
|
24
26
|
}
|
|
25
|
-
exports.
|
|
27
|
+
exports.flattenAccumulatorResultItemArray = flattenAccumulatorResultItemArray;
|
|
28
|
+
/**
|
|
29
|
+
* A PageListLoadingState that captures all the values that have been loaded so far, flattens them as an array, and the current loading state of currentPageResult$.
|
|
30
|
+
*/
|
|
31
|
+
function accumulatorFlattenPageListLoadingState(accumulator) {
|
|
32
|
+
return (0, rxjs_2.combineLatest)([accumulator.itemIteration.currentState$, flattenAccumulatorResultItemArray(accumulator)]).pipe((0, rxjs_2.map)(([state, values]) => (0, loading_1.mapLoadingStateResults)(state, {
|
|
33
|
+
mapValue: () => values
|
|
34
|
+
})), (0, rxjs_2.shareReplay)(1));
|
|
35
|
+
}
|
|
36
|
+
exports.accumulatorFlattenPageListLoadingState = accumulatorFlattenPageListLoadingState;
|
|
26
37
|
/**
|
|
27
38
|
* A PageListLoadingState that captures all the values that have been loaded so far, and the current loading state of currentPageResult$.
|
|
28
39
|
*/
|
|
29
|
-
function
|
|
30
|
-
return (0, rxjs_2.combineLatest)([
|
|
40
|
+
function accumulatorCurrentPageListLoadingState(accumulator) {
|
|
41
|
+
return (0, rxjs_2.combineLatest)([accumulator.itemIteration.currentState$, accumulator.allItems$]).pipe((0, rxjs_2.map)(([state, values]) => (0, loading_1.mapLoadingStateResults)(state, {
|
|
31
42
|
mapValue: () => values
|
|
32
43
|
})), (0, rxjs_2.shareReplay)(1));
|
|
33
44
|
}
|
|
34
|
-
exports.
|
|
45
|
+
exports.accumulatorCurrentPageListLoadingState = accumulatorCurrentPageListLoadingState;
|
|
35
46
|
//# sourceMappingURL=iteration.accumulator.rxjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iteration.accumulator.rxjs.js","sourceRoot":"","sources":["../../../../../../packages/rxjs/src/lib/iterator/iteration.accumulator.rxjs.ts"],"names":[],"mappings":";;;AAAA,wCAAwD;AACxD,kCAAsD;AACtD,+BAA8E;AAC9E,
|
|
1
|
+
{"version":3,"file":"iteration.accumulator.rxjs.js","sourceRoot":"","sources":["../../../../../../packages/rxjs/src/lib/iterator/iteration.accumulator.rxjs.ts"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C;IAC3F,OAAO,IAAA,oBAAa,EAAC,CAAC,WAAW,CAAC,aAAa,CAAC,aAAa,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CACzF,IAAA,UAAG,EAAC,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,IAAA,gCAAsB,EAAC,KAAK,EAAE;QACrD,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM;KACvB,CAA4B,CAAC,EAC9B,IAAA,kBAAW,EAAC,CAAC,CAAC,CACf,CAAC;AACJ,CAAC;AAPD,wFAOC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import { Destroyable, PageNumber } from "@dereekb/util";
|
|
2
|
+
import { Destroyable, Maybe, PageNumber } from "@dereekb/util";
|
|
3
3
|
import { LoadingState, PageLoadingState } from '../loading';
|
|
4
4
|
export interface ItemIteratorNextRequest {
|
|
5
5
|
/**
|
|
@@ -25,7 +25,7 @@ export interface ItemIteration<V = any, L extends LoadingState<V> = LoadingState
|
|
|
25
25
|
*/
|
|
26
26
|
readonly currentState$: Observable<L>;
|
|
27
27
|
/**
|
|
28
|
-
* Triggers a loading of the next
|
|
28
|
+
* Triggers a loading of the next set of items.
|
|
29
29
|
*/
|
|
30
30
|
next(request?: ItemIteratorNextRequest): void;
|
|
31
31
|
}
|
|
@@ -37,8 +37,12 @@ export interface PageItemIteration<V = any, L extends PageLoadingState<V> = Page
|
|
|
37
37
|
* The maximum number of pages allowed to be loaded.
|
|
38
38
|
*
|
|
39
39
|
* A page of 15 means that pages 0-14 can be loaded, but not page 15.
|
|
40
|
+
*
|
|
41
|
+
* If this value is unset, there is no limit to the number of pages that can be loaded.
|
|
42
|
+
*
|
|
43
|
+
* For most cases you should always have a maxPageLoadLimit set to avoid iterating too many unused items.
|
|
40
44
|
*/
|
|
41
|
-
maxPageLoadLimit: PageNumber
|
|
45
|
+
maxPageLoadLimit: Maybe<PageNumber>;
|
|
42
46
|
/**
|
|
43
47
|
* Attempts to loads the next page of results and returns a promise.
|
|
44
48
|
*
|
|
@@ -2,6 +2,7 @@ import { PageLoadingState } from '../loading';
|
|
|
2
2
|
import { Observable } from "rxjs";
|
|
3
3
|
import { ItemIteratorNextRequest, PageItemIteration } from "./iteration";
|
|
4
4
|
import { MappedItemIteration, MappedItemIterationInstance, MappedItemIterationInstanceMapConfig } from './iteration.mapped';
|
|
5
|
+
import { Maybe } from '@dereekb/util';
|
|
5
6
|
/**
|
|
6
7
|
* MappedItemIteration for PageItemIteration
|
|
7
8
|
*/
|
|
@@ -10,8 +11,8 @@ export declare type MappedPageItemIteration<O, I = any, M extends PageLoadingSta
|
|
|
10
11
|
* MappedItemIterationInstance extension that implements PageItemIteration.
|
|
11
12
|
*/
|
|
12
13
|
export declare class MappedPageItemIterationInstance<O, I = any, M extends PageLoadingState<O> = PageLoadingState<O>, L extends PageLoadingState<I> = PageLoadingState<I>, N extends PageItemIteration<I, L> = PageItemIteration<I, L>> extends MappedItemIterationInstance<O, I, M, L, N> implements PageItemIteration<O, M> {
|
|
13
|
-
get maxPageLoadLimit(): number
|
|
14
|
-
set maxPageLoadLimit(maxPageLoadLimit: number);
|
|
14
|
+
get maxPageLoadLimit(): Maybe<number>;
|
|
15
|
+
set maxPageLoadLimit(maxPageLoadLimit: Maybe<number>);
|
|
15
16
|
readonly latestLoadedPage$: Observable<number>;
|
|
16
17
|
nextPage(request?: ItemIteratorNextRequest): Promise<number>;
|
|
17
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iteration.mapped.page.js","sourceRoot":"","sources":["../../../../../../packages/rxjs/src/lib/iterator/iteration.mapped.page.ts"],"names":[],"mappings":";;;AAGA,yDAA4H;
|
|
1
|
+
{"version":3,"file":"iteration.mapped.page.js","sourceRoot":"","sources":["../../../../../../packages/rxjs/src/lib/iterator/iteration.mapped.page.ts"],"names":[],"mappings":";;;AAGA,yDAA4H;AAe5H;;GAEG;AACH,MAAa,+BAMT,SAAQ,8CAA0C;IANtD;;QAiBW,sBAAiB,GAAuB,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC;IAMvF,CAAC;IAfC,0BAA0B;IAC1B,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC;IAC5C,CAAC;IAED,IAAI,gBAAgB,CAAC,gBAA+B;QAClD,IAAI,CAAC,YAAY,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IACxD,CAAC;IAID,QAAQ,CAAC,OAAiC;QACxC,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;CAEF;AAvBD,0EAuBC;AAED;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAMlC,aAAgB,EAAE,MAAwD;IAC1E,OAAO,IAAI,+BAA+B,CAAgB,aAAa,EAAE,MAAM,CAAC,CAAC;AACnF,CAAC;AARD,oDAQC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Observable } from "rxjs";
|
|
2
2
|
import { ItemIteration, PageItemIteration } from "./iteration";
|
|
3
|
+
import { Maybe, GetterOrValue } from '@dereekb/util';
|
|
3
4
|
/**
|
|
4
5
|
* Creates an observable from the input iteration that checks both the hasNext$ and canLoadMore$ states.
|
|
5
6
|
*
|
|
@@ -8,13 +9,17 @@ import { ItemIteration, PageItemIteration } from "./iteration";
|
|
|
8
9
|
*/
|
|
9
10
|
export declare function iterationHasNextAndCanLoadMore<V>(iteration: ItemIteration<V>): Observable<boolean>;
|
|
10
11
|
/**
|
|
11
|
-
* Automatically calls next up to the current maxPageLoadLimit.
|
|
12
|
+
* Automatically calls next up to the current maxPageLoadLimit configured on the iterator.
|
|
13
|
+
*
|
|
14
|
+
* If no maximum limit is defined, uses the defaultLimit. If default limit is not defined or null, this will result in an error.
|
|
12
15
|
*
|
|
13
16
|
* The promise will reject with an error if an error is encountered.
|
|
14
17
|
*
|
|
18
|
+
* @param iterator
|
|
19
|
+
* @param defaultLimit
|
|
15
20
|
* @returns
|
|
16
21
|
*/
|
|
17
|
-
export declare function iteratorNextPageUntilMaxPageLoadLimit(iterator: PageItemIteration): Promise<number>;
|
|
22
|
+
export declare function iteratorNextPageUntilMaxPageLoadLimit(iterator: PageItemIteration, defaultLimit?: Maybe<number>): Promise<number>;
|
|
18
23
|
/**
|
|
19
24
|
* Automatically calls next on the PageItemIteration up to the target page, the number of total pages that should be loaded.
|
|
20
25
|
*
|
|
@@ -24,4 +29,4 @@ export declare function iteratorNextPageUntilMaxPageLoadLimit(iterator: PageItem
|
|
|
24
29
|
* @param page
|
|
25
30
|
* @returns
|
|
26
31
|
*/
|
|
27
|
-
export declare function iteratorNextPageUntilPage(iteration: PageItemIteration, page: number
|
|
32
|
+
export declare function iteratorNextPageUntilPage(iteration: PageItemIteration, page: GetterOrValue<number>): Promise<number>;
|
|
@@ -15,14 +15,25 @@ function iterationHasNextAndCanLoadMore(iteration) {
|
|
|
15
15
|
}
|
|
16
16
|
exports.iterationHasNextAndCanLoadMore = iterationHasNextAndCanLoadMore;
|
|
17
17
|
/**
|
|
18
|
-
* Automatically calls next up to the current maxPageLoadLimit.
|
|
18
|
+
* Automatically calls next up to the current maxPageLoadLimit configured on the iterator.
|
|
19
|
+
*
|
|
20
|
+
* If no maximum limit is defined, uses the defaultLimit. If default limit is not defined or null, this will result in an error.
|
|
19
21
|
*
|
|
20
22
|
* The promise will reject with an error if an error is encountered.
|
|
21
23
|
*
|
|
24
|
+
* @param iterator
|
|
25
|
+
* @param defaultLimit
|
|
22
26
|
* @returns
|
|
23
27
|
*/
|
|
24
|
-
function iteratorNextPageUntilMaxPageLoadLimit(iterator) {
|
|
25
|
-
return iteratorNextPageUntilPage(iterator, () =>
|
|
28
|
+
function iteratorNextPageUntilMaxPageLoadLimit(iterator, defaultLimit = 100) {
|
|
29
|
+
return iteratorNextPageUntilPage(iterator, () => {
|
|
30
|
+
var _a;
|
|
31
|
+
const limit = (_a = iterator.maxPageLoadLimit) !== null && _a !== void 0 ? _a : defaultLimit;
|
|
32
|
+
if ((0, util_1.isMaybeNot)(limit)) {
|
|
33
|
+
throw new Error('iteratorNextPageUntilMaxPageLoadLimit() failed. There was no maximum defined.');
|
|
34
|
+
}
|
|
35
|
+
return limit;
|
|
36
|
+
});
|
|
26
37
|
}
|
|
27
38
|
exports.iteratorNextPageUntilMaxPageLoadLimit = iteratorNextPageUntilMaxPageLoadLimit;
|
|
28
39
|
/**
|
|
@@ -35,17 +46,19 @@ exports.iteratorNextPageUntilMaxPageLoadLimit = iteratorNextPageUntilMaxPageLoad
|
|
|
35
46
|
* @returns
|
|
36
47
|
*/
|
|
37
48
|
function iteratorNextPageUntilPage(iteration, page) {
|
|
38
|
-
const getPageLimit = (
|
|
49
|
+
const getPageLimit = (0, util_1.asGetter)(page);
|
|
39
50
|
function checkPageLimit(page) {
|
|
51
|
+
var _a;
|
|
40
52
|
const pageLimit = getPageLimit();
|
|
41
|
-
|
|
53
|
+
const maxLimit = Math.min(pageLimit, (_a = iteration.maxPageLoadLimit) !== null && _a !== void 0 ? _a : Number.MAX_SAFE_INTEGER);
|
|
54
|
+
return (page + 1) < maxLimit;
|
|
42
55
|
}
|
|
43
56
|
return new Promise((resolve) => {
|
|
44
57
|
iteration.latestLoadedPage$.pipe((0, rxjs_1.first)()).subscribe((firstLatestPage) => {
|
|
45
58
|
const promise = (0, util_1.performTaskLoop)({
|
|
46
59
|
initValue: firstLatestPage,
|
|
47
60
|
checkContinue: (latestPage) => checkPageLimit(latestPage),
|
|
48
|
-
next: () =>
|
|
61
|
+
next: () => tslib_1.__awaiter(this, void 0, void 0, function* () { return yield iteration.nextPage(); })
|
|
49
62
|
});
|
|
50
63
|
resolve(promise);
|
|
51
64
|
});
|