@tstdl/base 0.90.40 → 0.90.42
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.
|
@@ -18,6 +18,8 @@ export declare class AuthenticationClientService<AdditionalTokenPayload extends
|
|
|
18
18
|
readonly isLoggedIn: import("../../signals/api.js").Signal<boolean>;
|
|
19
19
|
readonly subject: import("../../signals/api.js").Signal<string | undefined>;
|
|
20
20
|
readonly sessionId: import("../../signals/api.js").Signal<string | undefined>;
|
|
21
|
+
readonly impersonator: import("../../signals/api.js").Signal<string | undefined>;
|
|
22
|
+
readonly impersonated: import("../../signals/api.js").Signal<boolean>;
|
|
21
23
|
readonly token$: import("rxjs").Observable<TokenPayload<AdditionalTokenPayload> | undefined>;
|
|
22
24
|
readonly definedToken$: import("rxjs").Observable<Exclude<TokenPayload<AdditionalTokenPayload>, void | undefined>>;
|
|
23
25
|
readonly validToken$: import("rxjs").Observable<Exclude<TokenPayload<AdditionalTokenPayload>, void | undefined>>;
|
|
@@ -48,6 +48,8 @@ let AuthenticationClientService = class AuthenticationClientService {
|
|
|
48
48
|
isLoggedIn = computed(() => isDefined(this.token()));
|
|
49
49
|
subject = computed(() => this.token()?.subject);
|
|
50
50
|
sessionId = computed(() => this.token()?.sessionId);
|
|
51
|
+
impersonator = computed(() => this.token()?.impersonator);
|
|
52
|
+
impersonated = computed(() => isDefined(this.impersonator()));
|
|
51
53
|
token$ = toObservable(this.token);
|
|
52
54
|
definedToken$ = this.token$.pipe(filter(isDefined));
|
|
53
55
|
validToken$ = this.definedToken$.pipe(filter((token) => token.exp > currentTimestampSeconds()));
|
package/package.json
CHANGED
package/signals/pipe.d.ts
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import { type OperatorFunction } from 'rxjs';
|
|
2
|
-
import type { Signal } from './api.js';
|
|
2
|
+
import type { Signal, ToSignalOptions } from './api.js';
|
|
3
|
+
export type PipeOptions = Pick<ToSignalOptions, 'rejectErrors'>;
|
|
3
4
|
/**
|
|
4
5
|
* As we need an synchronous value for the resulting signal and effect scheduling is async, it uses the source signals value as the initial value for the pipe.
|
|
5
6
|
* This would normally result in double emission inside the pipe, but is mitigated by using {@link SignalPipeOptions.distinctUntilChanged}. Because of this, mutating source signals are not supported.
|
|
6
7
|
* If you have an mutating signal or require more control for whatever reason, use {@link rawPipe} instead.
|
|
7
8
|
*/
|
|
8
|
-
export declare function pipe<T, A>(source: Signal<T>, op1: OperatorFunction<T, A
|
|
9
|
-
export declare function pipe<T, A, B>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B
|
|
10
|
-
export declare function pipe<T, A, B, C>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C
|
|
11
|
-
export declare function pipe<T, A, B, C, D>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D
|
|
12
|
-
export declare function pipe<T, A, B, C, D, E>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E
|
|
13
|
-
export declare function pipe<T, A, B, C, D, E, F>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F
|
|
14
|
-
export declare function pipe<T, A, B, C, D, E, F, G>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G
|
|
15
|
-
export declare function pipe<T, A, B, C, D, E, F, G, H>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H
|
|
16
|
-
export declare function pipe<T, A, B, C, D, E, F, G, H, I>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I
|
|
17
|
-
export declare function pipe(source: Signal<unknown>, ...
|
|
9
|
+
export declare function pipe<T, A>(source: Signal<T>, op1: OperatorFunction<T, A>, options?: PipeOptions): Signal<A>;
|
|
10
|
+
export declare function pipe<T, A, B>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, options?: PipeOptions): Signal<B>;
|
|
11
|
+
export declare function pipe<T, A, B, C>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, options?: PipeOptions): Signal<C>;
|
|
12
|
+
export declare function pipe<T, A, B, C, D>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, options?: PipeOptions): Signal<D>;
|
|
13
|
+
export declare function pipe<T, A, B, C, D, E>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, options?: PipeOptions): Signal<E>;
|
|
14
|
+
export declare function pipe<T, A, B, C, D, E, F>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, options?: PipeOptions): Signal<F>;
|
|
15
|
+
export declare function pipe<T, A, B, C, D, E, F, G>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, options?: PipeOptions): Signal<G>;
|
|
16
|
+
export declare function pipe<T, A, B, C, D, E, F, G, H>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, options?: PipeOptions): Signal<H>;
|
|
17
|
+
export declare function pipe<T, A, B, C, D, E, F, G, H, I>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>, options?: PipeOptions): Signal<I>;
|
|
18
|
+
export declare function pipe(source: Signal<unknown>, ...operatorsAndOptions: (OperatorFunction<unknown, unknown> | PipeOptions | undefined)[]): Signal<unknown>;
|
|
18
19
|
/**
|
|
19
20
|
* As we need an synchronous value for the resulting signal and effect scheduling is async, you have to provide an immediate value on subscription, for example via the `startWith` operator, otherwise an error is thrown.
|
|
20
21
|
*/
|
|
21
|
-
export declare function rawPipe<T, A>(source: Signal<T>, op1: OperatorFunction<T, A
|
|
22
|
-
export declare function rawPipe<T, A, B>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B
|
|
23
|
-
export declare function rawPipe<T, A, B, C>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C
|
|
24
|
-
export declare function rawPipe<T, A, B, C, D>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D
|
|
25
|
-
export declare function rawPipe<T, A, B, C, D, E>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E
|
|
26
|
-
export declare function rawPipe<T, A, B, C, D, E, F>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F
|
|
27
|
-
export declare function rawPipe<T, A, B, C, D, E, F, G>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G
|
|
28
|
-
export declare function rawPipe<T, A, B, C, D, E, F, G, H>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H
|
|
29
|
-
export declare function rawPipe<T, A, B, C, D, E, F, G, H, I>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I
|
|
30
|
-
export declare function rawPipe(source: Signal<unknown>, ...
|
|
22
|
+
export declare function rawPipe<T, A>(source: Signal<T>, op1: OperatorFunction<T, A>, options?: PipeOptions): Signal<A>;
|
|
23
|
+
export declare function rawPipe<T, A, B>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, options?: PipeOptions): Signal<B>;
|
|
24
|
+
export declare function rawPipe<T, A, B, C>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, options?: PipeOptions): Signal<C>;
|
|
25
|
+
export declare function rawPipe<T, A, B, C, D>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, options?: PipeOptions): Signal<D>;
|
|
26
|
+
export declare function rawPipe<T, A, B, C, D, E>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, options?: PipeOptions): Signal<E>;
|
|
27
|
+
export declare function rawPipe<T, A, B, C, D, E, F>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, options?: PipeOptions): Signal<F>;
|
|
28
|
+
export declare function rawPipe<T, A, B, C, D, E, F, G>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, options?: PipeOptions): Signal<G>;
|
|
29
|
+
export declare function rawPipe<T, A, B, C, D, E, F, G, H>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, options?: PipeOptions): Signal<H>;
|
|
30
|
+
export declare function rawPipe<T, A, B, C, D, E, F, G, H, I>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>, options?: PipeOptions): Signal<I>;
|
|
31
|
+
export declare function rawPipe(source: Signal<unknown>, ...operatorsAndOptions: (OperatorFunction<unknown, unknown> | PipeOptions | undefined)[]): Signal<unknown>;
|
package/signals/pipe.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { distinctUntilChanged } from 'rxjs';
|
|
2
2
|
import { startWithProvider } from '../rxjs/start-with-provider.js';
|
|
3
3
|
import { untrack } from '../rxjs/untrack.js';
|
|
4
|
+
import { isNotFunction } from '../utils/type-guards.js';
|
|
4
5
|
import { toObservable, toSignal } from './api.js';
|
|
5
|
-
export function pipe(source, ...
|
|
6
|
-
return rawPipe(source, startWithProvider(source), distinctUntilChanged(), ...
|
|
6
|
+
export function pipe(source, ...operatorsAndOptions) {
|
|
7
|
+
return rawPipe(source, startWithProvider(source), distinctUntilChanged(), ...operatorsAndOptions);
|
|
7
8
|
}
|
|
8
|
-
export function rawPipe(source, ...
|
|
9
|
+
export function rawPipe(source, ...operatorsAndOptions) {
|
|
10
|
+
const last = operatorsAndOptions.at(-1);
|
|
11
|
+
const lastIsOptions = isNotFunction(last);
|
|
12
|
+
const options = lastIsOptions ? last : undefined;
|
|
13
|
+
const operators = (lastIsOptions ? operatorsAndOptions.slice(0, -1) : operatorsAndOptions);
|
|
9
14
|
const piped = toObservable(source).pipe(...operators, untrack());
|
|
10
|
-
return toSignal(piped, { requireSync: true });
|
|
15
|
+
return toSignal(piped, { ...options, requireSync: true });
|
|
11
16
|
}
|