@jscutlery/operators 1.1.1 → 2.0.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/CHANGELOG.md +23 -0
- package/README.md +6 -6
- package/index.cjs +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/src/lib/suspensify.d.ts +4 -8
- package/src/lib/testing/observer.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [2.0.1](https://github.com/jscutlery/devkit/compare/operators-2.0.0...operators-2.0.1) (2023-04-27)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **operators:** 🐞 fix suspensify type to be strict by default too ([c5d424c](https://github.com/jscutlery/devkit/commit/c5d424cea4faee0df5ab112851565a36fb575ebe))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [2.0.0](https://github.com/jscutlery/devkit/compare/operators-1.1.1...operators-2.0.0) (2023-04-18)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Tests
|
|
18
|
+
|
|
19
|
+
* **operators:** make suspensify strict by default ([93b8c05](https://github.com/jscutlery/devkit/commit/93b8c0576086ff476e9239ead6175c8832f39c0e))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### BREAKING CHANGES
|
|
23
|
+
|
|
24
|
+
* **operators:** suspensify() without options will return a strict suspense object
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
5
28
|
## [1.1.1](https://github.com/jscutlery/devkit/compare/operators-1.1.0...operators-1.1.1) (2023-04-18)
|
|
6
29
|
|
|
7
30
|
|
package/README.md
CHANGED
|
@@ -7,8 +7,8 @@ This package regroups a couple of RxJS operators meant to simplify some common p
|
|
|
7
7
|
- [`suspensify`](#suspensify)
|
|
8
8
|
- [Goals](#goals)
|
|
9
9
|
- [Usage](#usage)
|
|
10
|
-
- [Strict mode (
|
|
11
|
-
- [Lax mode
|
|
10
|
+
- [Strict mode (default)](#strict-mode-default)
|
|
11
|
+
- [Lax mode](#lax-mode)
|
|
12
12
|
- [With Angular](#with-angular)
|
|
13
13
|
- [With `@rx-angular/state`](#with-rx-angularstate)
|
|
14
14
|
- [Alternatives](#alternatives)
|
|
@@ -48,13 +48,13 @@ The `suspensify` operator is meant to provide a simple and efficient way of deal
|
|
|
48
48
|
|
|
49
49
|
## Usage
|
|
50
50
|
|
|
51
|
-
### Strict mode (
|
|
51
|
+
### Strict mode (default)
|
|
52
52
|
|
|
53
53
|
Thanks to strict mode the emitted suspense can be narrowed down.
|
|
54
54
|
|
|
55
55
|
```ts
|
|
56
56
|
interval(1000)
|
|
57
|
-
.pipe(take(2), suspensify(
|
|
57
|
+
.pipe(take(2), suspensify())
|
|
58
58
|
.subscribe((suspense) => {
|
|
59
59
|
suspense.value; // 💥
|
|
60
60
|
suspense.error; // 💥
|
|
@@ -93,11 +93,11 @@ interval(1000)
|
|
|
93
93
|
}
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
### Lax mode
|
|
96
|
+
### Lax mode
|
|
97
97
|
|
|
98
98
|
```ts
|
|
99
99
|
interval(1000)
|
|
100
|
-
.pipe(take(2), suspensify())
|
|
100
|
+
.pipe(take(2), suspensify({strict: false}))
|
|
101
101
|
.subscribe((data) => console.log(data));
|
|
102
102
|
```
|
|
103
103
|
|
package/index.cjs
CHANGED
|
@@ -1077,7 +1077,7 @@ $({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign },
|
|
|
1077
1077
|
});
|
|
1078
1078
|
|
|
1079
1079
|
function suspensify({
|
|
1080
|
-
strict =
|
|
1080
|
+
strict = true
|
|
1081
1081
|
} = {}) {
|
|
1082
1082
|
return source$ => {
|
|
1083
1083
|
const strictSuspense$ = source$.pipe(_suspensify(), _coalesceFirstEmittedValue());
|
package/index.js
CHANGED
|
@@ -1073,7 +1073,7 @@ $({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign },
|
|
|
1073
1073
|
});
|
|
1074
1074
|
|
|
1075
1075
|
function suspensify({
|
|
1076
|
-
strict =
|
|
1076
|
+
strict = true
|
|
1077
1077
|
} = {}) {
|
|
1078
1078
|
return source$ => {
|
|
1079
1079
|
const strictSuspense$ = source$.pipe(_suspensify(), _coalesceFirstEmittedValue());
|
package/package.json
CHANGED
package/src/lib/suspensify.d.ts
CHANGED
|
@@ -33,11 +33,7 @@ export interface SuspenseEmpty {
|
|
|
33
33
|
hasValue: false;
|
|
34
34
|
pending: false;
|
|
35
35
|
}
|
|
36
|
-
export declare type
|
|
37
|
-
/**
|
|
38
|
-
* @todo 3.0.0: Make `Suspense` an alias for `SuspenseStrict`.
|
|
39
|
-
*/
|
|
40
|
-
export declare type Suspense<T> = SuspenseLax<T>;
|
|
36
|
+
export declare type Suspense<T> = SuspensePending | SuspenseWithValue<T> | SuspenseWithError | SuspenseEmpty;
|
|
41
37
|
export interface SuspensifyOptions {
|
|
42
38
|
strict?: boolean;
|
|
43
39
|
}
|
|
@@ -48,9 +44,9 @@ export interface SuspensifyOptions {
|
|
|
48
44
|
*
|
|
49
45
|
* @returns Observable<SuspenseLax<T> | SuspenseStrict<T>>
|
|
50
46
|
*/
|
|
51
|
-
export declare function suspensify<T>(options
|
|
47
|
+
export declare function suspensify<T>(options: {
|
|
52
48
|
strict: false;
|
|
53
49
|
}): OperatorFunction<T, SuspenseLax<T>>;
|
|
54
|
-
export declare function suspensify<T>(options
|
|
50
|
+
export declare function suspensify<T>(options?: {
|
|
55
51
|
strict: true;
|
|
56
|
-
}): OperatorFunction<T,
|
|
52
|
+
}): OperatorFunction<T, Suspense<T>>;
|