@jscutlery/operators 2.1.1 → 2.1.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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@jscutlery/operators",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "repository": {
5
5
  "url": "https://github.com/jscutlery/devkit"
6
6
  },
7
7
  "peerDependencies": {
8
8
  "rxjs": ">=6.0.0",
9
- "@jest/globals": "28.1.3"
9
+ "@jest/globals": "29.5.0"
10
10
  },
11
11
  "module": "./index.js",
12
12
  "main": "./index.cjs",
package/src/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { pending, suspensify } from './lib/suspensify';
2
- export type { SuspenseLax, Suspense, SuspenseEmpty, SuspensePending, SuspenseWithError, SuspenseWithValue, SuspensifyOptions, } from './lib/suspensify';
1
+ export { pending, suspensify } from './lib/suspensify';
2
+ export type { SuspenseLax, Suspense, SuspenseEmpty, SuspensePending, SuspenseWithError, SuspenseWithValue, SuspensifyOptions, } from './lib/suspensify';
@@ -1,59 +1,59 @@
1
- import { OperatorFunction } from 'rxjs';
2
- export interface SuspenseLax<T> {
3
- finalized: boolean;
4
- hasError: boolean;
5
- hasValue: boolean;
6
- pending: boolean;
7
- error: undefined | any;
8
- value: undefined | T;
9
- }
10
- export interface SuspensePending {
11
- finalized: false;
12
- hasError: false;
13
- hasValue: false;
14
- pending: true;
15
- }
16
- export interface SuspenseWithValue<T> {
17
- finalized: boolean;
18
- hasError: false;
19
- hasValue: true;
20
- pending: false;
21
- value: T;
22
- }
23
- export interface SuspenseWithError {
24
- finalized: true;
25
- hasError: true;
26
- hasValue: false;
27
- pending: false;
28
- error: unknown;
29
- }
30
- export interface SuspenseEmpty {
31
- finalized: true;
32
- hasError: false;
33
- hasValue: false;
34
- pending: false;
35
- }
36
- export declare type Suspense<T> = SuspensePending | SuspenseWithValue<T> | SuspenseWithError | SuspenseEmpty;
37
- export interface SuspensifyOptions {
38
- strict?: boolean;
39
- }
40
- /**
41
- * @description creates a derivated state from the source observable.
42
- *
43
- * @example source$.pipe(suspensify())
44
- *
45
- * @returns Observable<SuspenseLax<T> | SuspenseStrict<T>>
46
- */
47
- export declare function suspensify<T>(options: {
48
- strict: false;
49
- }): OperatorFunction<T, SuspenseLax<T>>;
50
- export declare function suspensify<T>(options?: {
51
- strict: true;
52
- }): OperatorFunction<T, Suspense<T>>;
53
- /**
54
- * This is the initial state of the Suspense.
55
- * It is exposed for convenience and edge cases where the initial state must be set initially.
56
- * e.g. when using {@link suspensify} on inner observables.
57
- * @example toSignal(source$.pipe(switchMap(() => fetchData().pipe(suspensify()))), {initialValue: pending});
58
- */
59
- export declare const pending: SuspensePending;
1
+ import { OperatorFunction } from 'rxjs';
2
+ export interface SuspenseLax<T> {
3
+ finalized: boolean;
4
+ hasError: boolean;
5
+ hasValue: boolean;
6
+ pending: boolean;
7
+ error: undefined | any;
8
+ value: undefined | T;
9
+ }
10
+ export interface SuspensePending {
11
+ finalized: false;
12
+ hasError: false;
13
+ hasValue: false;
14
+ pending: true;
15
+ }
16
+ export interface SuspenseWithValue<T> {
17
+ finalized: boolean;
18
+ hasError: false;
19
+ hasValue: true;
20
+ pending: false;
21
+ value: T;
22
+ }
23
+ export interface SuspenseWithError {
24
+ finalized: true;
25
+ hasError: true;
26
+ hasValue: false;
27
+ pending: false;
28
+ error: unknown;
29
+ }
30
+ export interface SuspenseEmpty {
31
+ finalized: true;
32
+ hasError: false;
33
+ hasValue: false;
34
+ pending: false;
35
+ }
36
+ export type Suspense<T> = SuspensePending | SuspenseWithValue<T> | SuspenseWithError | SuspenseEmpty;
37
+ export interface SuspensifyOptions {
38
+ strict?: boolean;
39
+ }
40
+ /**
41
+ * @description creates a derivated state from the source observable.
42
+ *
43
+ * @example source$.pipe(suspensify())
44
+ *
45
+ * @returns Observable<SuspenseLax<T> | SuspenseStrict<T>>
46
+ */
47
+ export declare function suspensify<T>(options: {
48
+ strict: false;
49
+ }): OperatorFunction<T, SuspenseLax<T>>;
50
+ export declare function suspensify<T>(options?: {
51
+ strict: true;
52
+ }): OperatorFunction<T, Suspense<T>>;
53
+ /**
54
+ * This is the initial state of the Suspense.
55
+ * It is exposed for convenience and edge cases where the initial state must be set initially.
56
+ * e.g. when using {@link suspensify} on inner observables.
57
+ * @example toSignal(source$.pipe(switchMap(() => fetchData().pipe(suspensify()))), {initialValue: pending});
58
+ */
59
+ export declare const pending: SuspensePending;
@@ -1,11 +1,11 @@
1
- /// <reference types="jest" />
2
- import { Observable } from 'rxjs';
3
- export declare function createObserver(): {
4
- observe<T>(observable: Observable<T>): {
5
- mockClear(): void;
6
- mockReset(): void;
7
- next: jest.MockInstance<void, [value: T]> & ((value: T) => void);
8
- error: jest.MockInstance<void, [err: any]> & ((err: any) => void);
9
- complete: jest.MockInstance<void, []> & (() => void);
10
- };
11
- };
1
+ /// <reference types="jest" />
2
+ import { Observable } from 'rxjs';
3
+ export declare function createObserver(): {
4
+ observe<T>(observable: Observable<T>): {
5
+ mockClear(): void;
6
+ mockReset(): void;
7
+ next: jest.MockInstance<void, [value: T], unknown> & ((value: T) => void);
8
+ error: jest.MockInstance<void, [err: any], unknown> & ((err: any) => void);
9
+ complete: jest.MockInstance<void, [], unknown> & (() => void);
10
+ };
11
+ };