@jscutlery/operators 1.0.0 → 1.0.2

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 CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.0.2](https://github.com/jscutlery/devkit/compare/operators-1.0.1...operators-1.0.2) (2023-04-18)
6
+
7
+
8
+
9
+ ## [1.0.1](https://github.com/jscutlery/devkit/compare/operators-1.0.0...operators-1.0.1) (2023-04-18)
10
+
11
+
12
+
5
13
  # [1.0.0](https://github.com/jscutlery/devkit/compare/operators-0.2.1...operators-1.0.0) (2023-04-18)
6
14
 
7
15
 
package/index.cjs CHANGED
@@ -1076,14 +1076,9 @@ $({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign },
1076
1076
  assign: assign
1077
1077
  });
1078
1078
 
1079
- /**
1080
- * @description creates a derivated state from the source observable.
1081
- *
1082
- * @example source$.pipe(suspensify())
1083
- *
1084
- * @returns Observable<Suspense<T>>
1085
- */
1086
- function suspensify() {
1079
+ function suspensify(
1080
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1081
+ options) {
1087
1082
  return source$ => {
1088
1083
  return source$.pipe(_suspensify(), _coalesceFirstEmittedValue());
1089
1084
  };
package/index.js CHANGED
@@ -1072,14 +1072,9 @@ $({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign },
1072
1072
  assign: assign
1073
1073
  });
1074
1074
 
1075
- /**
1076
- * @description creates a derivated state from the source observable.
1077
- *
1078
- * @example source$.pipe(suspensify())
1079
- *
1080
- * @returns Observable<Suspense<T>>
1081
- */
1082
- function suspensify() {
1075
+ function suspensify(
1076
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1077
+ options) {
1083
1078
  return source$ => {
1084
1079
  return source$.pipe(_suspensify(), _coalesceFirstEmittedValue());
1085
1080
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jscutlery/operators",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "repository": {
5
5
  "url": "https://github.com/jscutlery/devkit"
6
6
  },
@@ -1,15 +1,51 @@
1
1
  import { OperatorFunction } from 'rxjs';
2
- export interface Suspense<T> {
2
+ export interface SuspenseLax<T> {
3
3
  value: undefined | T;
4
4
  error: undefined | any;
5
5
  finalized: boolean;
6
6
  pending: boolean;
7
7
  }
8
+ export interface SuspensePending {
9
+ finalized: false;
10
+ hasError: false;
11
+ hasValue: false;
12
+ pending: true;
13
+ }
14
+ export interface SuspenseWithValue<T> {
15
+ finalized: boolean;
16
+ hasError: false;
17
+ hasValue: true;
18
+ pending: false;
19
+ value: T;
20
+ }
21
+ export interface SuspenseWithError {
22
+ finalized: true;
23
+ hasError: true;
24
+ hasValue: false;
25
+ pending: false;
26
+ error: unknown;
27
+ }
28
+ export declare type SuspenseStrict<T> = SuspensePending | SuspenseWithValue<T> | SuspenseWithError;
29
+ /**
30
+ * @todo 3.0.0: Make `Suspense` an alias for `SuspenseStrict`.
31
+ */
32
+ export declare type Suspense<T> = SuspenseLax<T>;
33
+ export interface SuspensifyOptions {
34
+ /**
35
+ * @deprecated 🚧 Work in progress.
36
+ */
37
+ strict?: boolean;
38
+ }
8
39
  /**
9
40
  * @description creates a derivated state from the source observable.
10
41
  *
11
42
  * @example source$.pipe(suspensify())
12
43
  *
13
- * @returns Observable<Suspense<T>>
44
+ * @returns Observable<SuspenseLax<T> | SuspenseStrict<T>>
14
45
  */
15
- export declare function suspensify<T>(): OperatorFunction<T, Suspense<T>>;
46
+ export declare function suspensify<T>(options?: {
47
+ strict: false;
48
+ }): OperatorFunction<T, SuspenseLax<T>>;
49
+ export declare function suspensify<T>(options: {
50
+ strict: true;
51
+ }): OperatorFunction<T, SuspenseStrict<T>>;