2022-08-30 16:11:19 +02:00
|
|
|
import { SearchService as AbstractSearchService } from "@bitwarden/common/abstractions/search.service";
|
|
|
|
import { SearchService } from "@bitwarden/common/services/search.service";
|
|
|
|
|
2023-01-31 22:08:37 +01:00
|
|
|
import {
|
|
|
|
cipherServiceFactory,
|
|
|
|
CipherServiceInitOptions,
|
|
|
|
} from "../../vault/background/service_factories/cipher-service.factory";
|
|
|
|
|
2022-08-30 16:11:19 +02:00
|
|
|
import { CachedServices, factory, FactoryOptions } from "./factory-options";
|
|
|
|
import { i18nServiceFactory, I18nServiceInitOptions } from "./i18n-service.factory";
|
|
|
|
import { logServiceFactory, LogServiceInitOptions } from "./log-service.factory";
|
|
|
|
|
|
|
|
type SearchServiceFactoryOptions = FactoryOptions;
|
|
|
|
|
|
|
|
export type SearchServiceInitOptions = SearchServiceFactoryOptions &
|
|
|
|
CipherServiceInitOptions &
|
|
|
|
LogServiceInitOptions &
|
|
|
|
I18nServiceInitOptions;
|
|
|
|
|
|
|
|
export function searchServiceFactory(
|
|
|
|
cache: { searchService?: AbstractSearchService } & CachedServices,
|
|
|
|
opts: SearchServiceInitOptions
|
|
|
|
): Promise<AbstractSearchService> {
|
|
|
|
return factory(
|
|
|
|
cache,
|
|
|
|
"searchService",
|
|
|
|
opts,
|
|
|
|
async () =>
|
|
|
|
new SearchService(
|
|
|
|
await cipherServiceFactory(cache, opts),
|
|
|
|
await logServiceFactory(cache, opts),
|
|
|
|
await i18nServiceFactory(cache, opts)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|