1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

[deps] Autofill: Update prettier to v3 (#7014)

* [deps] Autofill: Update prettier to v3

* prettier formatting updates

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Prusik <jprusik@classynemesis.com>
This commit is contained in:
renovate[bot]
2023-11-29 16:15:20 -05:00
committed by GitHub
parent 4ff5f38e89
commit 28de9439be
1145 changed files with 5898 additions and 5612 deletions

View File

@@ -10,14 +10,14 @@ export class DefaultDerivedUserState<TFrom, TTo> implements DerivedUserState<TTo
constructor(
private converter: Converter<TFrom, TTo>,
private encryptService: EncryptService,
private userState: UserState<TFrom>
private userState: UserState<TFrom>,
) {
this.state$ = userState.state$.pipe(
switchMap(async (from) => {
// TODO: How do I get the key?
const convertedData = await this.converter(from, new DeriveContext(null, encryptService));
return convertedData;
})
}),
);
}
}

View File

@@ -15,7 +15,7 @@ export class DefaultGlobalStateProvider implements GlobalStateProvider {
constructor(
private memoryStorage: AbstractMemoryStorageService & ObservableStorageService,
private diskStorage: AbstractStorageService & ObservableStorageService
private diskStorage: AbstractStorageService & ObservableStorageService,
) {}
get<T>(keyDefinition: KeyDefinition<T>): GlobalState<T> {
@@ -29,7 +29,7 @@ export class DefaultGlobalStateProvider implements GlobalStateProvider {
const newGlobalState = new DefaultGlobalState<T>(
keyDefinition,
this.getLocation(keyDefinition.stateDefinition.storageLocation)
this.getLocation(keyDefinition.stateDefinition.storageLocation),
);
this.globalStateCache[cacheKey] = newGlobalState;

View File

@@ -120,7 +120,7 @@ describe("DefaultGlobalState", () => {
},
{
combineLatestWith: of(combinedDependencies),
}
},
);
await awaitAsync();
@@ -140,7 +140,7 @@ describe("DefaultGlobalState", () => {
},
{
shouldUpdate: () => false,
}
},
);
expect(diskStorageService.mock.save).not.toHaveBeenCalled();

View File

@@ -32,7 +32,7 @@ export class DefaultGlobalState<T> implements GlobalState<T> {
constructor(
private keyDefinition: KeyDefinition<T>,
private chosenLocation: AbstractStorageService & ObservableStorageService
private chosenLocation: AbstractStorageService & ObservableStorageService,
) {
this.storageKey = globalKeyBuilder(this.keyDefinition);
@@ -45,10 +45,10 @@ export class DefaultGlobalState<T> implements GlobalState<T> {
return await getStoredValue(
this.storageKey,
this.chosenLocation,
this.keyDefinition.deserializer
this.keyDefinition.deserializer,
);
}),
shareReplay({ bufferSize: 1, refCount: false })
shareReplay({ bufferSize: 1, refCount: false }),
);
this.state$ = defer(() => {
@@ -65,17 +65,17 @@ export class DefaultGlobalState<T> implements GlobalState<T> {
complete: () => {
storageUpdateSubscription.unsubscribe();
},
})
}),
);
}).pipe(
shareReplay({ refCount: false, bufferSize: 1 }),
filter<T>((i) => i != FAKE_DEFAULT)
filter<T>((i) => i != FAKE_DEFAULT),
);
}
async update<TCombine>(
configureState: (state: T, dependency: TCombine) => T,
options: StateUpdateOptions<T, TCombine> = {}
options: StateUpdateOptions<T, TCombine> = {},
): Promise<T> {
options = populateOptionsWithDefault(options);
const currentState = await this.getGuaranteedState();
@@ -102,7 +102,7 @@ export class DefaultGlobalState<T> implements GlobalState<T> {
return await getStoredValue(
this.storageKey,
this.chosenLocation,
this.keyDefinition.deserializer
this.keyDefinition.deserializer,
);
}
}

View File

@@ -19,7 +19,7 @@ export class DefaultUserStateProvider implements UserStateProvider {
protected accountService: AccountService,
protected encryptService: EncryptService,
protected memoryStorage: AbstractMemoryStorageService & ObservableStorageService,
protected diskStorage: AbstractStorageService & ObservableStorageService
protected diskStorage: AbstractStorageService & ObservableStorageService,
) {}
get<T>(keyDefinition: KeyDefinition<T>): UserState<T> {
@@ -41,7 +41,7 @@ export class DefaultUserStateProvider implements UserStateProvider {
keyDefinition,
this.accountService,
this.encryptService,
this.getLocation(keyDefinition.stateDefinition.storageLocation)
this.getLocation(keyDefinition.stateDefinition.storageLocation),
);
}

View File

@@ -52,7 +52,7 @@ describe("DefaultUserState", () => {
testKeyDefinition,
accountService,
null, // Not testing anything with encrypt service
diskStorageService
diskStorageService,
);
});
@@ -111,17 +111,17 @@ describe("DefaultUserState", () => {
expect(diskStorageService.mock.get).toHaveBeenNthCalledWith(
1,
"user_00000000-0000-1000-a000-000000000001_fake_fake",
any()
any(),
);
expect(diskStorageService.mock.get).toHaveBeenNthCalledWith(
2,
"user_00000000-0000-1000-a000-000000000001_fake_fake",
any()
any(),
);
expect(diskStorageService.mock.get).toHaveBeenNthCalledWith(
3,
"user_00000000-0000-1000-a000-000000000002_fake_fake",
any()
any(),
);
// Should only have saved data for the first user
@@ -129,7 +129,7 @@ describe("DefaultUserState", () => {
expect(diskStorageService.mock.save).toHaveBeenNthCalledWith(
1,
"user_00000000-0000-1000-a000-000000000001_fake_fake",
any()
any(),
);
});
@@ -275,7 +275,7 @@ describe("DefaultUserState", () => {
},
{
combineLatestWith: of(combinedDependencies),
}
},
);
await awaitAsync();
@@ -295,7 +295,7 @@ describe("DefaultUserState", () => {
},
{
shouldUpdate: () => false,
}
},
);
await awaitAsync();

View File

@@ -43,15 +43,15 @@ export class DefaultUserState<T> implements UserState<T> {
protected keyDefinition: KeyDefinition<T>,
private accountService: AccountService,
private encryptService: EncryptService,
private chosenStorageLocation: AbstractStorageService & ObservableStorageService
private chosenStorageLocation: AbstractStorageService & ObservableStorageService,
) {
this.formattedKey$ = this.accountService.activeAccount$.pipe(
map((account) =>
account != null && account.id != null
? userKeyBuilder(account.id, this.keyDefinition)
: null
: null,
),
shareReplay({ bufferSize: 1, refCount: false })
shareReplay({ bufferSize: 1, refCount: false }),
);
const activeAccountData$ = this.formattedKey$.pipe(
@@ -62,11 +62,11 @@ export class DefaultUserState<T> implements UserState<T> {
return await getStoredValue(
key,
this.chosenStorageLocation,
this.keyDefinition.deserializer
this.keyDefinition.deserializer,
);
}),
// Share the execution
shareReplay({ refCount: false, bufferSize: 1 })
shareReplay({ refCount: false, bufferSize: 1 }),
);
const storageUpdates$ = this.chosenStorageLocation.updates$.pipe(
@@ -79,10 +79,10 @@ export class DefaultUserState<T> implements UserState<T> {
const data = await getStoredValue(
key,
this.chosenStorageLocation,
this.keyDefinition.deserializer
this.keyDefinition.deserializer,
);
return data;
})
}),
);
// Whomever subscribes to this data, should be notified of updated data
@@ -101,7 +101,7 @@ export class DefaultUserState<T> implements UserState<T> {
accountChangeSubscription.unsubscribe();
storageUpdateSubscription.unsubscribe();
},
})
}),
);
})
// I fake the generic here because I am filtering out the other union type
@@ -111,7 +111,7 @@ export class DefaultUserState<T> implements UserState<T> {
async update<TCombine>(
configureState: (state: T, dependency: TCombine) => T,
options: StateUpdateOptions<T, TCombine> = {}
options: StateUpdateOptions<T, TCombine> = {},
): Promise<T> {
options = populateOptionsWithDefault(options);
const key = await this.createKey();
@@ -133,7 +133,7 @@ export class DefaultUserState<T> implements UserState<T> {
async updateFor<TCombine>(
userId: UserId,
configureState: (state: T, dependencies: TCombine) => T,
options: StateUpdateOptions<T, TCombine> = {}
options: StateUpdateOptions<T, TCombine> = {},
): Promise<T> {
if (userId == null) {
throw new Error("Attempting to update user state, but no userId has been supplied.");
@@ -144,7 +144,7 @@ export class DefaultUserState<T> implements UserState<T> {
const currentState = await getStoredValue(
key,
this.chosenStorageLocation,
this.keyDefinition.deserializer
this.keyDefinition.deserializer,
);
const combinedDependencies =
options.combineLatestWith != null
@@ -187,7 +187,7 @@ export class DefaultUserState<T> implements UserState<T> {
const value = await getStoredValue(
key,
this.chosenStorageLocation,
this.keyDefinition.deserializer
this.keyDefinition.deserializer,
);
this.stateSubject.next(value);
return value;

View File

@@ -5,7 +5,7 @@ import { AbstractStorageService } from "../../abstractions/storage.service";
export async function getStoredValue<T>(
key: string,
storage: AbstractStorageService,
deserializer: (jsonValue: Jsonify<T>) => T
deserializer: (jsonValue: Jsonify<T>) => T,
) {
if (storage.valuesRequireDeserialization) {
const jsonValue = await storage.get<Jsonify<T>>(key);