1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-23 03:33:54 +00:00

[PM-16791] introduce generator profile provider (#13588)

This commit is contained in:
✨ Audrey ✨
2025-03-03 12:43:34 -05:00
committed by GitHub
parent 92f027af5e
commit e10b5af9d3
7 changed files with 476 additions and 7 deletions

View File

@@ -12,6 +12,7 @@ export abstract class UserStateSubjectDependencyProvider {
/** Provides local object persistence */
abstract state: StateProvider;
// FIXME: remove `log` and inject the system provider into the USS instead
/** Provides semantic logging */
abstract log: <Context extends object>(_context: Jsonify<Context>) => SemanticLogger;
}

View File

@@ -81,7 +81,7 @@ const DEFAULT_FRAME_SIZE = 32;
export class UserStateSubject<
State extends object,
Secret = State,
Disclosed = never,
Disclosed = Record<string, never>,
Dependencies = null,
>
extends Observable<State>
@@ -243,7 +243,7 @@ export class UserStateSubject<
// `init$` becomes the accumulator for `scan`
init$.pipe(
first(),
map((init) => [init, null] as const),
map((init) => [init, null] as [State, Dependencies]),
),
input$.pipe(
map((constrained) => constrained.state),
@@ -256,7 +256,7 @@ export class UserStateSubject<
if (shouldUpdate) {
// actual update
const next = this.context.nextValue?.(prev, pending, dependencies) ?? pending;
return [next, dependencies];
return [next, dependencies] as const;
} else {
// false update
this.log.debug("shouldUpdate prevented write");