2022-09-27 22:25:19 +02:00
|
|
|
import { OrganizationService as AbstractOrganizationService } from "@bitwarden/common/abstractions/organization/organization.service.abstraction";
|
|
|
|
import { OrganizationService } from "@bitwarden/common/services/organization/organization.service";
|
2022-08-29 20:46:42 +02:00
|
|
|
|
|
|
|
import { FactoryOptions, CachedServices, factory } from "./factory-options";
|
|
|
|
import { stateServiceFactory, StateServiceInitOptions } from "./state-service.factory";
|
|
|
|
|
|
|
|
type OrganizationServiceFactoryOptions = FactoryOptions;
|
|
|
|
|
|
|
|
export type OrganizationServiceInitOptions = OrganizationServiceFactoryOptions &
|
|
|
|
StateServiceInitOptions;
|
|
|
|
|
|
|
|
export function organizationServiceFactory(
|
|
|
|
cache: { organizationService?: AbstractOrganizationService } & CachedServices,
|
|
|
|
opts: OrganizationServiceInitOptions
|
|
|
|
): Promise<AbstractOrganizationService> {
|
|
|
|
return factory(
|
|
|
|
cache,
|
|
|
|
"organizationService",
|
|
|
|
opts,
|
2022-11-18 22:38:28 +01:00
|
|
|
async () => new OrganizationService(await stateServiceFactory(cache, opts))
|
2022-08-29 20:46:42 +02:00
|
|
|
);
|
|
|
|
}
|