mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-22 16:29:09 +01:00
[AC-2278] [BEEEP] Typesafe Angular DI (#8206)
Use SafeProvider as a factory for all our providers to ensure that the DI token, implementation, and deps all match. --------- Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
This commit is contained in:
parent
8f8385d822
commit
29b5643310
@ -1,9 +1,6 @@
|
|||||||
import { Injectable } from "@angular/core";
|
|
||||||
|
|
||||||
import { ThemingService } from "@bitwarden/angular/platform/services/theming/theming.service";
|
import { ThemingService } from "@bitwarden/angular/platform/services/theming/theming.service";
|
||||||
import { ThemeType } from "@bitwarden/common/platform/enums";
|
import { ThemeType } from "@bitwarden/common/platform/enums";
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class DesktopThemingService extends ThemingService {
|
export class DesktopThemingService extends ThemingService {
|
||||||
protected async getSystemTheme(): Promise<ThemeType> {
|
protected async getSystemTheme(): Promise<ThemeType> {
|
||||||
return await ipc.platform.getSystemTheme();
|
return await ipc.platform.getSystemTheme();
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
import { DOCUMENT } from "@angular/common";
|
||||||
import { APP_INITIALIZER, InjectionToken, NgModule } from "@angular/core";
|
import { APP_INITIALIZER, InjectionToken, NgModule } from "@angular/core";
|
||||||
|
|
||||||
import { AbstractThemingService } from "@bitwarden/angular/platform/services/theming/theming.service.abstraction";
|
import { AbstractThemingService } from "@bitwarden/angular/platform/services/theming/theming.service.abstraction";
|
||||||
|
import { safeProvider } from "@bitwarden/angular/platform/utils/safe-provider";
|
||||||
import {
|
import {
|
||||||
SECURE_STORAGE,
|
SECURE_STORAGE,
|
||||||
STATE_FACTORY,
|
STATE_FACTORY,
|
||||||
@ -11,6 +13,7 @@ import {
|
|||||||
OBSERVABLE_MEMORY_STORAGE,
|
OBSERVABLE_MEMORY_STORAGE,
|
||||||
OBSERVABLE_DISK_STORAGE,
|
OBSERVABLE_DISK_STORAGE,
|
||||||
WINDOW,
|
WINDOW,
|
||||||
|
SafeInjectionToken,
|
||||||
} from "@bitwarden/angular/services/injection-tokens";
|
} from "@bitwarden/angular/services/injection-tokens";
|
||||||
import { JslibServicesModule } from "@bitwarden/angular/services/jslib-services.module";
|
import { JslibServicesModule } from "@bitwarden/angular/services/jslib-services.module";
|
||||||
import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vault-timeout/vault-timeout-settings.service";
|
import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vault-timeout/vault-timeout-settings.service";
|
||||||
@ -148,10 +151,11 @@ const RELOAD_CALLBACK = new InjectionToken<() => any>("RELOAD_CALLBACK");
|
|||||||
provide: FileDownloadService,
|
provide: FileDownloadService,
|
||||||
useClass: DesktopFileDownloadService,
|
useClass: DesktopFileDownloadService,
|
||||||
},
|
},
|
||||||
{
|
safeProvider({
|
||||||
provide: AbstractThemingService,
|
provide: AbstractThemingService,
|
||||||
useClass: DesktopThemingService,
|
useClass: DesktopThemingService,
|
||||||
},
|
deps: [StateServiceAbstraction, WINDOW, DOCUMENT as SafeInjectionToken<Document>],
|
||||||
|
}),
|
||||||
{
|
{
|
||||||
provide: EncryptedMessageHandlerService,
|
provide: EncryptedMessageHandlerService,
|
||||||
deps: [
|
deps: [
|
||||||
|
@ -1,25 +1,20 @@
|
|||||||
import { DOCUMENT } from "@angular/common";
|
|
||||||
import { Inject, Injectable } from "@angular/core";
|
|
||||||
import { BehaviorSubject, filter, fromEvent, Observable } from "rxjs";
|
import { BehaviorSubject, filter, fromEvent, Observable } from "rxjs";
|
||||||
|
|
||||||
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
||||||
import { ThemeType } from "@bitwarden/common/platform/enums";
|
import { ThemeType } from "@bitwarden/common/platform/enums";
|
||||||
|
|
||||||
import { WINDOW } from "../../../services/injection-tokens";
|
|
||||||
|
|
||||||
import { Theme } from "./theme";
|
import { Theme } from "./theme";
|
||||||
import { ThemeBuilder } from "./theme-builder";
|
import { ThemeBuilder } from "./theme-builder";
|
||||||
import { AbstractThemingService } from "./theming.service.abstraction";
|
import { AbstractThemingService } from "./theming.service.abstraction";
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class ThemingService implements AbstractThemingService {
|
export class ThemingService implements AbstractThemingService {
|
||||||
private _theme = new BehaviorSubject<ThemeBuilder | null>(null);
|
private _theme = new BehaviorSubject<ThemeBuilder | null>(null);
|
||||||
theme$: Observable<Theme> = this._theme.pipe(filter((x) => x !== null));
|
theme$: Observable<Theme> = this._theme.pipe(filter((x) => x !== null));
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private stateService: StateService,
|
private stateService: StateService,
|
||||||
@Inject(WINDOW) private window: Window,
|
private window: Window,
|
||||||
@Inject(DOCUMENT) private document: Document,
|
private document: Document,
|
||||||
) {
|
) {
|
||||||
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
|
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
|
||||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
|
114
libs/angular/src/platform/utils/safe-provider.ts
Normal file
114
libs/angular/src/platform/utils/safe-provider.ts
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
import { Provider } from "@angular/core";
|
||||||
|
import { Constructor, Opaque } from "type-fest";
|
||||||
|
|
||||||
|
import { SafeInjectionToken } from "../../services/injection-tokens";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The return type of our dependency helper functions.
|
||||||
|
* Used to distinguish a type safe provider definition from a non-type safe provider definition.
|
||||||
|
*/
|
||||||
|
export type SafeProvider = Opaque<Provider>;
|
||||||
|
|
||||||
|
// TODO: type-fest also provides a type like this when we upgrade >= 3.7.0
|
||||||
|
type AbstractConstructor<T> = abstract new (...args: any) => T;
|
||||||
|
|
||||||
|
type MapParametersToDeps<T> = {
|
||||||
|
[K in keyof T]: AbstractConstructor<T[K]> | SafeInjectionToken<T[K]>;
|
||||||
|
};
|
||||||
|
|
||||||
|
type SafeInjectionTokenType<T> = T extends SafeInjectionToken<infer J> ? J : never;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a dependency provided with the useClass option.
|
||||||
|
*/
|
||||||
|
type SafeClassProvider<
|
||||||
|
A extends AbstractConstructor<any>,
|
||||||
|
I extends Constructor<InstanceType<A>>,
|
||||||
|
D extends MapParametersToDeps<ConstructorParameters<I>>,
|
||||||
|
> = {
|
||||||
|
provide: A;
|
||||||
|
useClass: I;
|
||||||
|
deps: D;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a dependency provided with the useValue option.
|
||||||
|
*/
|
||||||
|
type SafeValueProvider<A extends SafeInjectionToken<any>, V extends SafeInjectionTokenType<A>> = {
|
||||||
|
provide: A;
|
||||||
|
useValue: V;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a dependency provided with the useFactory option where a SafeInjectionToken is used as the token.
|
||||||
|
*/
|
||||||
|
type SafeFactoryProviderWithToken<
|
||||||
|
A extends SafeInjectionToken<any>,
|
||||||
|
I extends (...args: any) => InstanceType<SafeInjectionTokenType<A>>,
|
||||||
|
D extends MapParametersToDeps<Parameters<I>>,
|
||||||
|
> = {
|
||||||
|
provide: A;
|
||||||
|
useFactory: I;
|
||||||
|
deps: D;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a dependency provided with the useFactory option where an abstract class is used as the token.
|
||||||
|
*/
|
||||||
|
type SafeFactoryProviderWithClass<
|
||||||
|
A extends AbstractConstructor<any>,
|
||||||
|
I extends (...args: any) => InstanceType<A>,
|
||||||
|
D extends MapParametersToDeps<Parameters<I>>,
|
||||||
|
> = {
|
||||||
|
provide: A;
|
||||||
|
useFactory: I;
|
||||||
|
deps: D;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a dependency provided with the useExisting option.
|
||||||
|
*/
|
||||||
|
type SafeExistingProvider<
|
||||||
|
A extends Constructor<any> | AbstractConstructor<any>,
|
||||||
|
I extends Constructor<InstanceType<A>> | AbstractConstructor<InstanceType<A>>,
|
||||||
|
> = {
|
||||||
|
provide: A;
|
||||||
|
useExisting: I;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A factory function that creates a provider for the ngModule providers array.
|
||||||
|
* This guarantees type safety for your provider definition. It does nothing at runtime.
|
||||||
|
* @param provider Your provider object in the usual shape (e.g. using useClass, useValue, useFactory, etc.)
|
||||||
|
* @returns The exact same object without modification (pass-through).
|
||||||
|
*/
|
||||||
|
export const safeProvider = <
|
||||||
|
// types for useClass
|
||||||
|
AClass extends AbstractConstructor<any>,
|
||||||
|
IClass extends Constructor<InstanceType<AClass>>,
|
||||||
|
DClass extends MapParametersToDeps<ConstructorParameters<IClass>>,
|
||||||
|
// types for useValue
|
||||||
|
AValue extends SafeInjectionToken<any>,
|
||||||
|
VValue extends SafeInjectionTokenType<AValue>,
|
||||||
|
// types for useFactoryWithToken
|
||||||
|
AFactoryToken extends SafeInjectionToken<any>,
|
||||||
|
IFactoryToken extends (...args: any) => InstanceType<SafeInjectionTokenType<AFactoryToken>>,
|
||||||
|
DFactoryToken extends MapParametersToDeps<Parameters<IFactoryToken>>,
|
||||||
|
// types for useFactoryWithClass
|
||||||
|
AFactoryClass extends AbstractConstructor<any>,
|
||||||
|
IFactoryClass extends (...args: any) => InstanceType<AFactoryClass>,
|
||||||
|
DFactoryClass extends MapParametersToDeps<Parameters<IFactoryClass>>,
|
||||||
|
// types for useExisting
|
||||||
|
AExisting extends Constructor<any> | AbstractConstructor<any>,
|
||||||
|
IExisting extends
|
||||||
|
| Constructor<InstanceType<AExisting>>
|
||||||
|
| AbstractConstructor<InstanceType<AExisting>>,
|
||||||
|
>(
|
||||||
|
provider:
|
||||||
|
| SafeClassProvider<AClass, IClass, DClass>
|
||||||
|
| SafeValueProvider<AValue, VValue>
|
||||||
|
| SafeFactoryProviderWithToken<AFactoryToken, IFactoryToken, DFactoryToken>
|
||||||
|
| SafeFactoryProviderWithClass<AFactoryClass, IFactoryClass, DFactoryClass>
|
||||||
|
| SafeExistingProvider<AExisting, IExisting>
|
||||||
|
| Constructor<unknown>,
|
||||||
|
): SafeProvider => provider as SafeProvider;
|
@ -7,26 +7,39 @@ import {
|
|||||||
} from "@bitwarden/common/platform/abstractions/storage.service";
|
} from "@bitwarden/common/platform/abstractions/storage.service";
|
||||||
import { StateFactory } from "@bitwarden/common/platform/factories/state-factory";
|
import { StateFactory } from "@bitwarden/common/platform/factories/state-factory";
|
||||||
|
|
||||||
export const WINDOW = new InjectionToken<Window>("WINDOW");
|
declare const tag: unique symbol;
|
||||||
export const OBSERVABLE_MEMORY_STORAGE = new InjectionToken<
|
/**
|
||||||
|
* A (more) typesafe version of InjectionToken which will more strictly enforce the generic type parameter.
|
||||||
|
* @remarks The default angular implementation does not use the generic type to define the structure of the object,
|
||||||
|
* so the structural type system will not complain about a mismatch in the type parameter.
|
||||||
|
* This is solved by assigning T to an arbitrary private property.
|
||||||
|
*/
|
||||||
|
export class SafeInjectionToken<T> extends InjectionToken<T> {
|
||||||
|
private readonly [tag]: T;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const WINDOW = new SafeInjectionToken<Window>("WINDOW");
|
||||||
|
export const OBSERVABLE_MEMORY_STORAGE = new SafeInjectionToken<
|
||||||
AbstractMemoryStorageService & ObservableStorageService
|
AbstractMemoryStorageService & ObservableStorageService
|
||||||
>("OBSERVABLE_MEMORY_STORAGE");
|
>("OBSERVABLE_MEMORY_STORAGE");
|
||||||
export const OBSERVABLE_DISK_STORAGE = new InjectionToken<
|
export const OBSERVABLE_DISK_STORAGE = new SafeInjectionToken<
|
||||||
AbstractStorageService & ObservableStorageService
|
AbstractStorageService & ObservableStorageService
|
||||||
>("OBSERVABLE_DISK_STORAGE");
|
>("OBSERVABLE_DISK_STORAGE");
|
||||||
export const OBSERVABLE_DISK_LOCAL_STORAGE = new InjectionToken<
|
export const OBSERVABLE_DISK_LOCAL_STORAGE = new SafeInjectionToken<
|
||||||
AbstractStorageService & ObservableStorageService
|
AbstractStorageService & ObservableStorageService
|
||||||
>("OBSERVABLE_DISK_LOCAL_STORAGE");
|
>("OBSERVABLE_DISK_LOCAL_STORAGE");
|
||||||
export const MEMORY_STORAGE = new InjectionToken<AbstractMemoryStorageService>("MEMORY_STORAGE");
|
export const MEMORY_STORAGE = new SafeInjectionToken<AbstractMemoryStorageService>(
|
||||||
export const SECURE_STORAGE = new InjectionToken<AbstractStorageService>("SECURE_STORAGE");
|
"MEMORY_STORAGE",
|
||||||
export const STATE_FACTORY = new InjectionToken<StateFactory>("STATE_FACTORY");
|
);
|
||||||
export const STATE_SERVICE_USE_CACHE = new InjectionToken<boolean>("STATE_SERVICE_USE_CACHE");
|
export const SECURE_STORAGE = new SafeInjectionToken<AbstractStorageService>("SECURE_STORAGE");
|
||||||
export const LOGOUT_CALLBACK = new InjectionToken<
|
export const STATE_FACTORY = new SafeInjectionToken<StateFactory>("STATE_FACTORY");
|
||||||
|
export const STATE_SERVICE_USE_CACHE = new SafeInjectionToken<boolean>("STATE_SERVICE_USE_CACHE");
|
||||||
|
export const LOGOUT_CALLBACK = new SafeInjectionToken<
|
||||||
(expired: boolean, userId?: string) => Promise<void>
|
(expired: boolean, userId?: string) => Promise<void>
|
||||||
>("LOGOUT_CALLBACK");
|
>("LOGOUT_CALLBACK");
|
||||||
export const LOCKED_CALLBACK = new InjectionToken<(userId?: string) => Promise<void>>(
|
export const LOCKED_CALLBACK = new SafeInjectionToken<(userId?: string) => Promise<void>>(
|
||||||
"LOCKED_CALLBACK",
|
"LOCKED_CALLBACK",
|
||||||
);
|
);
|
||||||
export const LOCALES_DIRECTORY = new InjectionToken<string>("LOCALES_DIRECTORY");
|
export const LOCALES_DIRECTORY = new SafeInjectionToken<string>("LOCALES_DIRECTORY");
|
||||||
export const SYSTEM_LANGUAGE = new InjectionToken<string>("SYSTEM_LANGUAGE");
|
export const SYSTEM_LANGUAGE = new SafeInjectionToken<string>("SYSTEM_LANGUAGE");
|
||||||
export const LOG_MAC_FAILURES = new InjectionToken<string>("LOG_MAC_FAILURES");
|
export const LOG_MAC_FAILURES = new SafeInjectionToken<boolean>("LOG_MAC_FAILURES");
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
import { DOCUMENT } from "@angular/common";
|
||||||
import { LOCALE_ID, NgModule } from "@angular/core";
|
import { LOCALE_ID, NgModule } from "@angular/core";
|
||||||
|
import { UnwrapOpaque } from "type-fest";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AuthRequestServiceAbstraction,
|
AuthRequestServiceAbstraction,
|
||||||
@ -183,7 +185,10 @@ import {
|
|||||||
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service";
|
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service";
|
||||||
import { SendApiService as SendApiServiceAbstraction } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
import { SendApiService as SendApiServiceAbstraction } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
||||||
import { SendService } from "@bitwarden/common/tools/send/services/send.service";
|
import { SendService } from "@bitwarden/common/tools/send/services/send.service";
|
||||||
import { SendService as SendServiceAbstraction } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
import {
|
||||||
|
InternalSendService,
|
||||||
|
SendService as SendServiceAbstraction,
|
||||||
|
} from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
||||||
import { CipherService as CipherServiceAbstraction } from "@bitwarden/common/vault/abstractions/cipher.service";
|
import { CipherService as CipherServiceAbstraction } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||||
import { CollectionService as CollectionServiceAbstraction } from "@bitwarden/common/vault/abstractions/collection.service";
|
import { CollectionService as CollectionServiceAbstraction } from "@bitwarden/common/vault/abstractions/collection.service";
|
||||||
import { CipherFileUploadService as CipherFileUploadServiceAbstraction } from "@bitwarden/common/vault/abstractions/file-upload/cipher-file-upload.service";
|
import { CipherFileUploadService as CipherFileUploadServiceAbstraction } from "@bitwarden/common/vault/abstractions/file-upload/cipher-file-upload.service";
|
||||||
@ -228,6 +233,7 @@ import { BroadcasterService } from "../platform/services/broadcaster.service";
|
|||||||
import { FormValidationErrorsService } from "../platform/services/form-validation-errors.service";
|
import { FormValidationErrorsService } from "../platform/services/form-validation-errors.service";
|
||||||
import { ThemingService } from "../platform/services/theming/theming.service";
|
import { ThemingService } from "../platform/services/theming/theming.service";
|
||||||
import { AbstractThemingService } from "../platform/services/theming/theming.service.abstraction";
|
import { AbstractThemingService } from "../platform/services/theming/theming.service.abstraction";
|
||||||
|
import { safeProvider, SafeProvider } from "../platform/utils/safe-provider";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
LOCALES_DIRECTORY,
|
LOCALES_DIRECTORY,
|
||||||
@ -237,6 +243,7 @@ import {
|
|||||||
MEMORY_STORAGE,
|
MEMORY_STORAGE,
|
||||||
OBSERVABLE_DISK_STORAGE,
|
OBSERVABLE_DISK_STORAGE,
|
||||||
OBSERVABLE_MEMORY_STORAGE,
|
OBSERVABLE_MEMORY_STORAGE,
|
||||||
|
SafeInjectionToken,
|
||||||
SECURE_STORAGE,
|
SECURE_STORAGE,
|
||||||
STATE_FACTORY,
|
STATE_FACTORY,
|
||||||
STATE_SERVICE_USE_CACHE,
|
STATE_SERVICE_USE_CACHE,
|
||||||
@ -245,63 +252,65 @@ import {
|
|||||||
} from "./injection-tokens";
|
} from "./injection-tokens";
|
||||||
import { ModalService } from "./modal.service";
|
import { ModalService } from "./modal.service";
|
||||||
|
|
||||||
@NgModule({
|
/**
|
||||||
declarations: [],
|
* Provider definitions used in the ngModule.
|
||||||
providers: [
|
* Add your provider definition here using the safeProvider function as a wrapper. This will give you type safety.
|
||||||
AuthGuard,
|
* If you need help please ask for it, do NOT change the type of this array.
|
||||||
UnauthGuard,
|
*/
|
||||||
ModalService,
|
const typesafeProviders: Array<SafeProvider> = [
|
||||||
PasswordRepromptService,
|
safeProvider(AuthGuard),
|
||||||
|
safeProvider(UnauthGuard),
|
||||||
{ provide: WINDOW, useValue: window },
|
safeProvider(ModalService),
|
||||||
{
|
safeProvider(PasswordRepromptService),
|
||||||
provide: LOCALE_ID,
|
safeProvider({ provide: WINDOW, useValue: window }),
|
||||||
|
safeProvider({
|
||||||
|
provide: LOCALE_ID as SafeInjectionToken<string>,
|
||||||
useFactory: (i18nService: I18nServiceAbstraction) => i18nService.translationLocale,
|
useFactory: (i18nService: I18nServiceAbstraction) => i18nService.translationLocale,
|
||||||
deps: [I18nServiceAbstraction],
|
deps: [I18nServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: LOCALES_DIRECTORY,
|
provide: LOCALES_DIRECTORY,
|
||||||
useValue: "./locales",
|
useValue: "./locales",
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: SYSTEM_LANGUAGE,
|
provide: SYSTEM_LANGUAGE,
|
||||||
useFactory: (window: Window) => window.navigator.language,
|
useFactory: (window: Window) => window.navigator.language,
|
||||||
deps: [WINDOW],
|
deps: [WINDOW],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: STATE_FACTORY,
|
provide: STATE_FACTORY,
|
||||||
useValue: new StateFactory(GlobalState, Account),
|
useValue: new StateFactory(GlobalState, Account),
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: STATE_SERVICE_USE_CACHE,
|
provide: STATE_SERVICE_USE_CACHE,
|
||||||
useValue: true,
|
useValue: true,
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: LOGOUT_CALLBACK,
|
provide: LOGOUT_CALLBACK,
|
||||||
useFactory:
|
useFactory:
|
||||||
(messagingService: MessagingServiceAbstraction) => (expired: boolean, userId?: string) =>
|
(messagingService: MessagingServiceAbstraction) => (expired: boolean, userId?: string) =>
|
||||||
messagingService.send("logout", { expired: expired, userId: userId }),
|
Promise.resolve(messagingService.send("logout", { expired: expired, userId: userId })),
|
||||||
deps: [MessagingServiceAbstraction],
|
deps: [MessagingServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: LOCKED_CALLBACK,
|
provide: LOCKED_CALLBACK,
|
||||||
useValue: null,
|
useValue: null,
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: LOG_MAC_FAILURES,
|
provide: LOG_MAC_FAILURES,
|
||||||
useValue: true,
|
useValue: true,
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: AppIdServiceAbstraction,
|
provide: AppIdServiceAbstraction,
|
||||||
useClass: AppIdService,
|
useClass: AppIdService,
|
||||||
deps: [GlobalStateProvider],
|
deps: [GlobalStateProvider],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: AuditServiceAbstraction,
|
provide: AuditServiceAbstraction,
|
||||||
useClass: AuditService,
|
useClass: AuditService,
|
||||||
deps: [CryptoFunctionServiceAbstraction, ApiServiceAbstraction],
|
deps: [CryptoFunctionServiceAbstraction, ApiServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: AuthServiceAbstraction,
|
provide: AuthServiceAbstraction,
|
||||||
useClass: AuthService,
|
useClass: AuthService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -310,8 +319,8 @@ import { ModalService } from "./modal.service";
|
|||||||
ApiServiceAbstraction,
|
ApiServiceAbstraction,
|
||||||
StateServiceAbstraction,
|
StateServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: LoginStrategyServiceAbstraction,
|
provide: LoginStrategyServiceAbstraction,
|
||||||
useClass: LoginStrategyService,
|
useClass: LoginStrategyService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -334,18 +343,18 @@ import { ModalService } from "./modal.service";
|
|||||||
AuthRequestServiceAbstraction,
|
AuthRequestServiceAbstraction,
|
||||||
GlobalStateProvider,
|
GlobalStateProvider,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: FileUploadServiceAbstraction,
|
provide: FileUploadServiceAbstraction,
|
||||||
useClass: FileUploadService,
|
useClass: FileUploadService,
|
||||||
deps: [LoginServiceAbstraction],
|
deps: [LogService],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: CipherFileUploadServiceAbstraction,
|
provide: CipherFileUploadServiceAbstraction,
|
||||||
useClass: CipherFileUploadService,
|
useClass: CipherFileUploadService,
|
||||||
deps: [ApiServiceAbstraction, FileUploadServiceAbstraction],
|
deps: [ApiServiceAbstraction, FileUploadServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: CipherServiceAbstraction,
|
provide: CipherServiceAbstraction,
|
||||||
useFactory: (
|
useFactory: (
|
||||||
cryptoService: CryptoServiceAbstraction,
|
cryptoService: CryptoServiceAbstraction,
|
||||||
@ -383,9 +392,9 @@ import { ModalService } from "./modal.service";
|
|||||||
CipherFileUploadServiceAbstraction,
|
CipherFileUploadServiceAbstraction,
|
||||||
ConfigServiceAbstraction,
|
ConfigServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: FolderServiceAbstraction,
|
provide: InternalFolderService,
|
||||||
useClass: FolderService,
|
useClass: FolderService,
|
||||||
deps: [
|
deps: [
|
||||||
CryptoServiceAbstraction,
|
CryptoServiceAbstraction,
|
||||||
@ -394,17 +403,17 @@ import { ModalService } from "./modal.service";
|
|||||||
StateServiceAbstraction,
|
StateServiceAbstraction,
|
||||||
StateProvider,
|
StateProvider,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: InternalFolderService,
|
provide: FolderServiceAbstraction,
|
||||||
useExisting: FolderServiceAbstraction,
|
useExisting: InternalFolderService,
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: FolderApiServiceAbstraction,
|
provide: FolderApiServiceAbstraction,
|
||||||
useClass: FolderApiService,
|
useClass: FolderApiService,
|
||||||
deps: [FolderServiceAbstraction, ApiServiceAbstraction],
|
deps: [InternalFolderService, ApiServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: AccountApiServiceAbstraction,
|
provide: AccountApiServiceAbstraction,
|
||||||
useClass: AccountApiServiceImplementation,
|
useClass: AccountApiServiceImplementation,
|
||||||
deps: [
|
deps: [
|
||||||
@ -413,44 +422,48 @@ import { ModalService } from "./modal.service";
|
|||||||
LogService,
|
LogService,
|
||||||
InternalAccountService,
|
InternalAccountService,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: AccountServiceAbstraction,
|
provide: InternalAccountService,
|
||||||
useClass: AccountServiceImplementation,
|
useClass: AccountServiceImplementation,
|
||||||
deps: [MessagingServiceAbstraction, LogService, GlobalStateProvider],
|
deps: [MessagingServiceAbstraction, LogService, GlobalStateProvider],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: InternalAccountService,
|
provide: AccountServiceAbstraction,
|
||||||
useExisting: AccountServiceAbstraction,
|
useExisting: InternalAccountService,
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: AccountUpdateServiceAbstraction,
|
provide: AccountUpdateServiceAbstraction,
|
||||||
useClass: AvatarUpdateService,
|
useClass: AvatarUpdateService,
|
||||||
deps: [ApiServiceAbstraction, StateServiceAbstraction],
|
deps: [ApiServiceAbstraction, StateServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{ provide: LogService, useFactory: () => new ConsoleLogService(false) },
|
safeProvider({ provide: LogService, useFactory: () => new ConsoleLogService(false), deps: [] }),
|
||||||
{
|
safeProvider({
|
||||||
provide: CollectionServiceAbstraction,
|
provide: CollectionServiceAbstraction,
|
||||||
useClass: CollectionService,
|
useClass: CollectionService,
|
||||||
deps: [CryptoServiceAbstraction, I18nServiceAbstraction, StateProvider],
|
deps: [CryptoServiceAbstraction, I18nServiceAbstraction, StateProvider],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: EnvironmentServiceAbstraction,
|
provide: EnvironmentServiceAbstraction,
|
||||||
useClass: EnvironmentService,
|
useClass: EnvironmentService,
|
||||||
deps: [StateProvider, AccountServiceAbstraction],
|
deps: [StateProvider, AccountServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: TotpServiceAbstraction,
|
provide: TotpServiceAbstraction,
|
||||||
useClass: TotpService,
|
useClass: TotpService,
|
||||||
deps: [CryptoFunctionServiceAbstraction, LogService, StateServiceAbstraction],
|
deps: [CryptoFunctionServiceAbstraction, LogService],
|
||||||
},
|
}),
|
||||||
{ provide: TokenServiceAbstraction, useClass: TokenService, deps: [StateServiceAbstraction] },
|
safeProvider({
|
||||||
{
|
provide: TokenServiceAbstraction,
|
||||||
|
useClass: TokenService,
|
||||||
|
deps: [StateServiceAbstraction],
|
||||||
|
}),
|
||||||
|
safeProvider({
|
||||||
provide: KeyGenerationServiceAbstraction,
|
provide: KeyGenerationServiceAbstraction,
|
||||||
useClass: KeyGenerationService,
|
useClass: KeyGenerationService,
|
||||||
deps: [CryptoFunctionServiceAbstraction],
|
deps: [CryptoFunctionServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: CryptoServiceAbstraction,
|
provide: CryptoServiceAbstraction,
|
||||||
useClass: CryptoService,
|
useClass: CryptoService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -463,23 +476,23 @@ import { ModalService } from "./modal.service";
|
|||||||
AccountServiceAbstraction,
|
AccountServiceAbstraction,
|
||||||
StateProvider,
|
StateProvider,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: PasswordStrengthServiceAbstraction,
|
provide: PasswordStrengthServiceAbstraction,
|
||||||
useClass: PasswordStrengthService,
|
useClass: PasswordStrengthService,
|
||||||
deps: [],
|
deps: [],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: PasswordGenerationServiceAbstraction,
|
provide: PasswordGenerationServiceAbstraction,
|
||||||
useClass: PasswordGenerationService,
|
useClass: PasswordGenerationService,
|
||||||
deps: [CryptoServiceAbstraction, PolicyServiceAbstraction, StateServiceAbstraction],
|
deps: [CryptoServiceAbstraction, PolicyServiceAbstraction, StateServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: UsernameGenerationServiceAbstraction,
|
provide: UsernameGenerationServiceAbstraction,
|
||||||
useClass: UsernameGenerationService,
|
useClass: UsernameGenerationService,
|
||||||
deps: [CryptoServiceAbstraction, StateServiceAbstraction, ApiServiceAbstraction],
|
deps: [CryptoServiceAbstraction, StateServiceAbstraction, ApiServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: ApiServiceAbstraction,
|
provide: ApiServiceAbstraction,
|
||||||
useClass: ApiService,
|
useClass: ApiService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -489,9 +502,13 @@ import { ModalService } from "./modal.service";
|
|||||||
AppIdServiceAbstraction,
|
AppIdServiceAbstraction,
|
||||||
LOGOUT_CALLBACK,
|
LOGOUT_CALLBACK,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: SendServiceAbstraction,
|
provide: SendServiceAbstraction,
|
||||||
|
useExisting: InternalSendService,
|
||||||
|
}),
|
||||||
|
safeProvider({
|
||||||
|
provide: InternalSendService,
|
||||||
useClass: SendService,
|
useClass: SendService,
|
||||||
deps: [
|
deps: [
|
||||||
CryptoServiceAbstraction,
|
CryptoServiceAbstraction,
|
||||||
@ -499,42 +516,42 @@ import { ModalService } from "./modal.service";
|
|||||||
KeyGenerationServiceAbstraction,
|
KeyGenerationServiceAbstraction,
|
||||||
StateServiceAbstraction,
|
StateServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: SendApiServiceAbstraction,
|
provide: SendApiServiceAbstraction,
|
||||||
useClass: SendApiService,
|
useClass: SendApiService,
|
||||||
deps: [ApiServiceAbstraction, FileUploadServiceAbstraction, SendServiceAbstraction],
|
deps: [ApiServiceAbstraction, FileUploadServiceAbstraction, InternalSendService],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: SyncServiceAbstraction,
|
provide: SyncServiceAbstraction,
|
||||||
useClass: SyncService,
|
useClass: SyncService,
|
||||||
deps: [
|
deps: [
|
||||||
ApiServiceAbstraction,
|
ApiServiceAbstraction,
|
||||||
SettingsServiceAbstraction,
|
DomainSettingsService,
|
||||||
FolderServiceAbstraction,
|
InternalFolderService,
|
||||||
CipherServiceAbstraction,
|
CipherServiceAbstraction,
|
||||||
CryptoServiceAbstraction,
|
CryptoServiceAbstraction,
|
||||||
CollectionServiceAbstraction,
|
CollectionServiceAbstraction,
|
||||||
MessagingServiceAbstraction,
|
MessagingServiceAbstraction,
|
||||||
PolicyServiceAbstraction,
|
InternalPolicyService,
|
||||||
SendServiceAbstraction,
|
InternalSendService,
|
||||||
LogService,
|
LogService,
|
||||||
KeyConnectorServiceAbstraction,
|
KeyConnectorServiceAbstraction,
|
||||||
StateServiceAbstraction,
|
StateServiceAbstraction,
|
||||||
ProviderServiceAbstraction,
|
ProviderServiceAbstraction,
|
||||||
FolderApiServiceAbstraction,
|
FolderApiServiceAbstraction,
|
||||||
OrganizationServiceAbstraction,
|
InternalOrganizationServiceAbstraction,
|
||||||
SendApiServiceAbstraction,
|
SendApiServiceAbstraction,
|
||||||
LOGOUT_CALLBACK,
|
LOGOUT_CALLBACK,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{ provide: BroadcasterServiceAbstraction, useClass: BroadcasterService },
|
safeProvider({ provide: BroadcasterServiceAbstraction, useClass: BroadcasterService, deps: [] }),
|
||||||
{
|
safeProvider({
|
||||||
provide: SettingsServiceAbstraction,
|
provide: SettingsServiceAbstraction,
|
||||||
useClass: SettingsService,
|
useClass: SettingsService,
|
||||||
deps: [StateServiceAbstraction],
|
deps: [StateServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: VaultTimeoutSettingsServiceAbstraction,
|
provide: VaultTimeoutSettingsServiceAbstraction,
|
||||||
useClass: VaultTimeoutSettingsService,
|
useClass: VaultTimeoutSettingsService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -544,8 +561,8 @@ import { ModalService } from "./modal.service";
|
|||||||
StateServiceAbstraction,
|
StateServiceAbstraction,
|
||||||
BiometricStateService,
|
BiometricStateService,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: VaultTimeoutService,
|
provide: VaultTimeoutService,
|
||||||
useClass: VaultTimeoutService,
|
useClass: VaultTimeoutService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -563,17 +580,17 @@ import { ModalService } from "./modal.service";
|
|||||||
LOCKED_CALLBACK,
|
LOCKED_CALLBACK,
|
||||||
LOGOUT_CALLBACK,
|
LOGOUT_CALLBACK,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: VaultTimeoutServiceAbstraction,
|
provide: VaultTimeoutServiceAbstraction,
|
||||||
useExisting: VaultTimeoutService,
|
useExisting: VaultTimeoutService,
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: SsoLoginServiceAbstraction,
|
provide: SsoLoginServiceAbstraction,
|
||||||
useClass: SsoLoginService,
|
useClass: SsoLoginService,
|
||||||
deps: [StateProvider],
|
deps: [StateProvider],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: StateServiceAbstraction,
|
provide: StateServiceAbstraction,
|
||||||
useClass: StateService,
|
useClass: StateService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -587,13 +604,13 @@ import { ModalService } from "./modal.service";
|
|||||||
MigrationRunner,
|
MigrationRunner,
|
||||||
STATE_SERVICE_USE_CACHE,
|
STATE_SERVICE_USE_CACHE,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: ImportApiServiceAbstraction,
|
provide: ImportApiServiceAbstraction,
|
||||||
useClass: ImportApiService,
|
useClass: ImportApiService,
|
||||||
deps: [ApiServiceAbstraction],
|
deps: [ApiServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: ImportServiceAbstraction,
|
provide: ImportServiceAbstraction,
|
||||||
useClass: ImportService,
|
useClass: ImportService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -604,8 +621,8 @@ import { ModalService } from "./modal.service";
|
|||||||
CollectionServiceAbstraction,
|
CollectionServiceAbstraction,
|
||||||
CryptoServiceAbstraction,
|
CryptoServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: IndividualVaultExportServiceAbstraction,
|
provide: IndividualVaultExportServiceAbstraction,
|
||||||
useClass: IndividualVaultExportService,
|
useClass: IndividualVaultExportService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -615,8 +632,8 @@ import { ModalService } from "./modal.service";
|
|||||||
CryptoFunctionServiceAbstraction,
|
CryptoFunctionServiceAbstraction,
|
||||||
StateServiceAbstraction,
|
StateServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: OrganizationVaultExportServiceAbstraction,
|
provide: OrganizationVaultExportServiceAbstraction,
|
||||||
useClass: OrganizationVaultExportService,
|
useClass: OrganizationVaultExportService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -627,22 +644,20 @@ import { ModalService } from "./modal.service";
|
|||||||
StateServiceAbstraction,
|
StateServiceAbstraction,
|
||||||
CollectionServiceAbstraction,
|
CollectionServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: VaultExportServiceAbstraction,
|
provide: VaultExportServiceAbstraction,
|
||||||
useClass: VaultExportService,
|
useClass: VaultExportService,
|
||||||
deps: [IndividualVaultExportServiceAbstraction, OrganizationVaultExportServiceAbstraction],
|
deps: [IndividualVaultExportServiceAbstraction, OrganizationVaultExportServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: SearchServiceAbstraction,
|
provide: SearchServiceAbstraction,
|
||||||
useClass: SearchService,
|
useClass: SearchService,
|
||||||
deps: [LogService, I18nServiceAbstraction],
|
deps: [LogService, I18nServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: NotificationsServiceAbstraction,
|
provide: NotificationsServiceAbstraction,
|
||||||
useClass: devFlagEnabled("noopNotifications")
|
useClass: devFlagEnabled("noopNotifications") ? NoopNotificationsService : NotificationsService,
|
||||||
? NoopNotificationsService
|
|
||||||
: NotificationsService,
|
|
||||||
deps: [
|
deps: [
|
||||||
LogService,
|
LogService,
|
||||||
SyncServiceAbstraction,
|
SyncServiceAbstraction,
|
||||||
@ -654,23 +669,23 @@ import { ModalService } from "./modal.service";
|
|||||||
AuthServiceAbstraction,
|
AuthServiceAbstraction,
|
||||||
MessagingServiceAbstraction,
|
MessagingServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: CryptoFunctionServiceAbstraction,
|
provide: CryptoFunctionServiceAbstraction,
|
||||||
useClass: WebCryptoFunctionService,
|
useClass: WebCryptoFunctionService,
|
||||||
deps: [WINDOW],
|
deps: [WINDOW],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: EncryptService,
|
provide: EncryptService,
|
||||||
useFactory: encryptServiceFactory,
|
useFactory: encryptServiceFactory,
|
||||||
deps: [CryptoFunctionServiceAbstraction, LogService, LOG_MAC_FAILURES],
|
deps: [CryptoFunctionServiceAbstraction, LogService, LOG_MAC_FAILURES],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: EventUploadServiceAbstraction,
|
provide: EventUploadServiceAbstraction,
|
||||||
useClass: EventUploadService,
|
useClass: EventUploadService,
|
||||||
deps: [ApiServiceAbstraction, StateServiceAbstraction, LogService],
|
deps: [ApiServiceAbstraction, StateServiceAbstraction, LogService],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: EventCollectionServiceAbstraction,
|
provide: EventCollectionServiceAbstraction,
|
||||||
useClass: EventCollectionService,
|
useClass: EventCollectionService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -679,22 +694,22 @@ import { ModalService } from "./modal.service";
|
|||||||
OrganizationServiceAbstraction,
|
OrganizationServiceAbstraction,
|
||||||
EventUploadServiceAbstraction,
|
EventUploadServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: PolicyServiceAbstraction,
|
provide: InternalPolicyService,
|
||||||
useClass: PolicyService,
|
useClass: PolicyService,
|
||||||
deps: [StateProvider, OrganizationServiceAbstraction],
|
deps: [StateProvider, OrganizationServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: InternalPolicyService,
|
provide: PolicyServiceAbstraction,
|
||||||
useExisting: PolicyServiceAbstraction,
|
useExisting: InternalPolicyService,
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: PolicyApiServiceAbstraction,
|
provide: PolicyApiServiceAbstraction,
|
||||||
useClass: PolicyApiService,
|
useClass: PolicyApiService,
|
||||||
deps: [InternalPolicyService, ApiServiceAbstraction],
|
deps: [InternalPolicyService, ApiServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: KeyConnectorServiceAbstraction,
|
provide: KeyConnectorServiceAbstraction,
|
||||||
useClass: KeyConnectorService,
|
useClass: KeyConnectorService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -707,8 +722,8 @@ import { ModalService } from "./modal.service";
|
|||||||
KeyGenerationServiceAbstraction,
|
KeyGenerationServiceAbstraction,
|
||||||
LOGOUT_CALLBACK,
|
LOGOUT_CALLBACK,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: UserVerificationServiceAbstraction,
|
provide: UserVerificationServiceAbstraction,
|
||||||
useClass: UserVerificationService,
|
useClass: UserVerificationService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -721,22 +736,22 @@ import { ModalService } from "./modal.service";
|
|||||||
VaultTimeoutSettingsServiceAbstraction,
|
VaultTimeoutSettingsServiceAbstraction,
|
||||||
PlatformUtilsServiceAbstraction,
|
PlatformUtilsServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: OrganizationServiceAbstraction,
|
provide: InternalOrganizationServiceAbstraction,
|
||||||
useClass: OrganizationService,
|
useClass: OrganizationService,
|
||||||
deps: [StateServiceAbstraction, StateProvider],
|
deps: [StateServiceAbstraction, StateProvider],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: InternalOrganizationServiceAbstraction,
|
provide: OrganizationServiceAbstraction,
|
||||||
useExisting: OrganizationServiceAbstraction,
|
useExisting: InternalOrganizationServiceAbstraction,
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: OrganizationUserService,
|
provide: OrganizationUserService,
|
||||||
useClass: OrganizationUserServiceImplementation,
|
useClass: OrganizationUserServiceImplementation,
|
||||||
deps: [ApiServiceAbstraction],
|
deps: [ApiServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: PasswordResetEnrollmentServiceAbstraction,
|
provide: PasswordResetEnrollmentServiceAbstraction,
|
||||||
useClass: PasswordResetEnrollmentServiceImplementation,
|
useClass: PasswordResetEnrollmentServiceImplementation,
|
||||||
deps: [
|
deps: [
|
||||||
@ -746,31 +761,33 @@ import { ModalService } from "./modal.service";
|
|||||||
OrganizationUserService,
|
OrganizationUserService,
|
||||||
I18nServiceAbstraction,
|
I18nServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: ProviderServiceAbstraction,
|
provide: ProviderServiceAbstraction,
|
||||||
useClass: ProviderService,
|
useClass: ProviderService,
|
||||||
deps: [StateProvider],
|
deps: [StateProvider],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: TwoFactorServiceAbstraction,
|
provide: TwoFactorServiceAbstraction,
|
||||||
useClass: TwoFactorService,
|
useClass: TwoFactorService,
|
||||||
deps: [I18nServiceAbstraction, PlatformUtilsServiceAbstraction],
|
deps: [I18nServiceAbstraction, PlatformUtilsServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: AbstractThemingService,
|
provide: AbstractThemingService,
|
||||||
useClass: ThemingService,
|
useClass: ThemingService,
|
||||||
},
|
deps: [StateServiceAbstraction, WINDOW, DOCUMENT as SafeInjectionToken<Document>],
|
||||||
{
|
}),
|
||||||
|
safeProvider({
|
||||||
provide: FormValidationErrorsServiceAbstraction,
|
provide: FormValidationErrorsServiceAbstraction,
|
||||||
useClass: FormValidationErrorsService,
|
useClass: FormValidationErrorsService,
|
||||||
},
|
deps: [],
|
||||||
{
|
}),
|
||||||
|
safeProvider({
|
||||||
provide: UserVerificationApiServiceAbstraction,
|
provide: UserVerificationApiServiceAbstraction,
|
||||||
useClass: UserVerificationApiService,
|
useClass: UserVerificationApiService,
|
||||||
deps: [ApiServiceAbstraction],
|
deps: [ApiServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: OrganizationApiServiceAbstraction,
|
provide: OrganizationApiServiceAbstraction,
|
||||||
useClass: OrganizationApiService,
|
useClass: OrganizationApiService,
|
||||||
// This is a slightly odd dependency tree for a specialized api service
|
// This is a slightly odd dependency tree for a specialized api service
|
||||||
@ -778,12 +795,13 @@ import { ModalService } from "./modal.service";
|
|||||||
// rather than updating the OrganizationService directly. Instead OrganizationService
|
// rather than updating the OrganizationService directly. Instead OrganizationService
|
||||||
// subscribes to sync notifications and will update itself based on that.
|
// subscribes to sync notifications and will update itself based on that.
|
||||||
deps: [ApiServiceAbstraction, SyncServiceAbstraction],
|
deps: [ApiServiceAbstraction, SyncServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: SyncNotifierServiceAbstraction,
|
provide: SyncNotifierServiceAbstraction,
|
||||||
useClass: SyncNotifierService,
|
useClass: SyncNotifierService,
|
||||||
},
|
deps: [],
|
||||||
{
|
}),
|
||||||
|
safeProvider({
|
||||||
provide: ConfigService,
|
provide: ConfigService,
|
||||||
useClass: ConfigService,
|
useClass: ConfigService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -793,56 +811,56 @@ import { ModalService } from "./modal.service";
|
|||||||
EnvironmentServiceAbstraction,
|
EnvironmentServiceAbstraction,
|
||||||
LogService,
|
LogService,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: ConfigServiceAbstraction,
|
provide: ConfigServiceAbstraction,
|
||||||
useExisting: ConfigService,
|
useExisting: ConfigService,
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: ConfigApiServiceAbstraction,
|
provide: ConfigApiServiceAbstraction,
|
||||||
useClass: ConfigApiService,
|
useClass: ConfigApiService,
|
||||||
deps: [ApiServiceAbstraction, AuthServiceAbstraction],
|
deps: [ApiServiceAbstraction, AuthServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: AnonymousHubServiceAbstraction,
|
provide: AnonymousHubServiceAbstraction,
|
||||||
useClass: AnonymousHubService,
|
useClass: AnonymousHubService,
|
||||||
deps: [EnvironmentServiceAbstraction, LoginStrategyServiceAbstraction, LogService],
|
deps: [EnvironmentServiceAbstraction, LoginStrategyServiceAbstraction, LogService],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: ValidationServiceAbstraction,
|
provide: ValidationServiceAbstraction,
|
||||||
useClass: ValidationService,
|
useClass: ValidationService,
|
||||||
deps: [I18nServiceAbstraction, PlatformUtilsServiceAbstraction],
|
deps: [I18nServiceAbstraction, PlatformUtilsServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: LoginServiceAbstraction,
|
provide: LoginServiceAbstraction,
|
||||||
useClass: LoginService,
|
useClass: LoginService,
|
||||||
deps: [StateServiceAbstraction],
|
deps: [StateServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: OrgDomainServiceAbstraction,
|
provide: OrgDomainInternalServiceAbstraction,
|
||||||
useClass: OrgDomainService,
|
useClass: OrgDomainService,
|
||||||
deps: [PlatformUtilsServiceAbstraction, I18nServiceAbstraction],
|
deps: [PlatformUtilsServiceAbstraction, I18nServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: OrgDomainInternalServiceAbstraction,
|
provide: OrgDomainServiceAbstraction,
|
||||||
useExisting: OrgDomainServiceAbstraction,
|
useExisting: OrgDomainInternalServiceAbstraction,
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: OrgDomainApiServiceAbstraction,
|
provide: OrgDomainApiServiceAbstraction,
|
||||||
useClass: OrgDomainApiService,
|
useClass: OrgDomainApiService,
|
||||||
deps: [OrgDomainServiceAbstraction, ApiServiceAbstraction],
|
deps: [OrgDomainInternalServiceAbstraction, ApiServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: DevicesApiServiceAbstraction,
|
provide: DevicesApiServiceAbstraction,
|
||||||
useClass: DevicesApiServiceImplementation,
|
useClass: DevicesApiServiceImplementation,
|
||||||
deps: [ApiServiceAbstraction],
|
deps: [ApiServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: DevicesServiceAbstraction,
|
provide: DevicesServiceAbstraction,
|
||||||
useClass: DevicesServiceImplementation,
|
useClass: DevicesServiceImplementation,
|
||||||
deps: [DevicesApiServiceAbstraction],
|
deps: [DevicesApiServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: DeviceTrustCryptoServiceAbstraction,
|
provide: DeviceTrustCryptoServiceAbstraction,
|
||||||
useClass: DeviceTrustCryptoService,
|
useClass: DeviceTrustCryptoService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -856,8 +874,8 @@ import { ModalService } from "./modal.service";
|
|||||||
I18nServiceAbstraction,
|
I18nServiceAbstraction,
|
||||||
PlatformUtilsServiceAbstraction,
|
PlatformUtilsServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: AuthRequestServiceAbstraction,
|
provide: AuthRequestServiceAbstraction,
|
||||||
useClass: AuthRequestService,
|
useClass: AuthRequestService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -866,8 +884,8 @@ import { ModalService } from "./modal.service";
|
|||||||
ApiServiceAbstraction,
|
ApiServiceAbstraction,
|
||||||
StateServiceAbstraction,
|
StateServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: PinCryptoServiceAbstraction,
|
provide: PinCryptoServiceAbstraction,
|
||||||
useClass: PinCryptoService,
|
useClass: PinCryptoService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -876,19 +894,18 @@ import { ModalService } from "./modal.service";
|
|||||||
VaultTimeoutSettingsServiceAbstraction,
|
VaultTimeoutSettingsServiceAbstraction,
|
||||||
LogService,
|
LogService,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
|
safeProvider({
|
||||||
{
|
|
||||||
provide: WebAuthnLoginPrfCryptoServiceAbstraction,
|
provide: WebAuthnLoginPrfCryptoServiceAbstraction,
|
||||||
useClass: WebAuthnLoginPrfCryptoService,
|
useClass: WebAuthnLoginPrfCryptoService,
|
||||||
deps: [CryptoFunctionServiceAbstraction],
|
deps: [CryptoFunctionServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: WebAuthnLoginApiServiceAbstraction,
|
provide: WebAuthnLoginApiServiceAbstraction,
|
||||||
useClass: WebAuthnLoginApiService,
|
useClass: WebAuthnLoginApiService,
|
||||||
deps: [ApiServiceAbstraction, EnvironmentServiceAbstraction],
|
deps: [ApiServiceAbstraction, EnvironmentServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: WebAuthnLoginServiceAbstraction,
|
provide: WebAuthnLoginServiceAbstraction,
|
||||||
useClass: WebAuthnLoginService,
|
useClass: WebAuthnLoginService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -898,43 +915,43 @@ import { ModalService } from "./modal.service";
|
|||||||
WINDOW,
|
WINDOW,
|
||||||
LogService,
|
LogService,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: StorageServiceProvider,
|
provide: StorageServiceProvider,
|
||||||
useClass: StorageServiceProvider,
|
useClass: StorageServiceProvider,
|
||||||
deps: [OBSERVABLE_DISK_STORAGE, OBSERVABLE_MEMORY_STORAGE],
|
deps: [OBSERVABLE_DISK_STORAGE, OBSERVABLE_MEMORY_STORAGE],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: StateEventRegistrarService,
|
provide: StateEventRegistrarService,
|
||||||
useClass: StateEventRegistrarService,
|
useClass: StateEventRegistrarService,
|
||||||
deps: [GlobalStateProvider, StorageServiceProvider],
|
deps: [GlobalStateProvider, StorageServiceProvider],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: StateEventRunnerService,
|
provide: StateEventRunnerService,
|
||||||
useClass: StateEventRunnerService,
|
useClass: StateEventRunnerService,
|
||||||
deps: [GlobalStateProvider, StorageServiceProvider],
|
deps: [GlobalStateProvider, StorageServiceProvider],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: GlobalStateProvider,
|
provide: GlobalStateProvider,
|
||||||
useClass: DefaultGlobalStateProvider,
|
useClass: DefaultGlobalStateProvider,
|
||||||
deps: [StorageServiceProvider],
|
deps: [StorageServiceProvider],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: ActiveUserStateProvider,
|
provide: ActiveUserStateProvider,
|
||||||
useClass: DefaultActiveUserStateProvider,
|
useClass: DefaultActiveUserStateProvider,
|
||||||
deps: [AccountServiceAbstraction, StorageServiceProvider, StateEventRegistrarService],
|
deps: [AccountServiceAbstraction, StorageServiceProvider, StateEventRegistrarService],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: SingleUserStateProvider,
|
provide: SingleUserStateProvider,
|
||||||
useClass: DefaultSingleUserStateProvider,
|
useClass: DefaultSingleUserStateProvider,
|
||||||
deps: [StorageServiceProvider, StateEventRegistrarService],
|
deps: [StorageServiceProvider, StateEventRegistrarService],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: DerivedStateProvider,
|
provide: DerivedStateProvider,
|
||||||
useClass: DefaultDerivedStateProvider,
|
useClass: DefaultDerivedStateProvider,
|
||||||
deps: [OBSERVABLE_MEMORY_STORAGE],
|
deps: [OBSERVABLE_MEMORY_STORAGE],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: StateProvider,
|
provide: StateProvider,
|
||||||
useClass: DefaultStateProvider,
|
useClass: DefaultStateProvider,
|
||||||
deps: [
|
deps: [
|
||||||
@ -943,8 +960,8 @@ import { ModalService } from "./modal.service";
|
|||||||
GlobalStateProvider,
|
GlobalStateProvider,
|
||||||
DerivedStateProvider,
|
DerivedStateProvider,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: OrganizationBillingServiceAbstraction,
|
provide: OrganizationBillingServiceAbstraction,
|
||||||
useClass: OrganizationBillingService,
|
useClass: OrganizationBillingService,
|
||||||
deps: [
|
deps: [
|
||||||
@ -952,57 +969,54 @@ import { ModalService } from "./modal.service";
|
|||||||
EncryptService,
|
EncryptService,
|
||||||
I18nServiceAbstraction,
|
I18nServiceAbstraction,
|
||||||
OrganizationApiServiceAbstraction,
|
OrganizationApiServiceAbstraction,
|
||||||
OrganizationServiceAbstraction,
|
|
||||||
StateProvider,
|
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: AutofillSettingsServiceAbstraction,
|
provide: AutofillSettingsServiceAbstraction,
|
||||||
useClass: AutofillSettingsService,
|
useClass: AutofillSettingsService,
|
||||||
deps: [StateProvider, PolicyServiceAbstraction],
|
deps: [StateProvider, PolicyServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: BadgeSettingsServiceAbstraction,
|
provide: BadgeSettingsServiceAbstraction,
|
||||||
useClass: BadgeSettingsService,
|
useClass: BadgeSettingsService,
|
||||||
deps: [StateProvider],
|
deps: [StateProvider],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: DomainSettingsService,
|
provide: DomainSettingsService,
|
||||||
useClass: DefaultDomainSettingsService,
|
useClass: DefaultDomainSettingsService,
|
||||||
deps: [StateProvider],
|
deps: [StateProvider],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: BiometricStateService,
|
provide: BiometricStateService,
|
||||||
useClass: DefaultBiometricStateService,
|
useClass: DefaultBiometricStateService,
|
||||||
deps: [StateProvider],
|
deps: [StateProvider],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: VaultSettingsServiceAbstraction,
|
provide: VaultSettingsServiceAbstraction,
|
||||||
useClass: VaultSettingsService,
|
useClass: VaultSettingsService,
|
||||||
deps: [StateProvider],
|
deps: [StateProvider],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: MigrationRunner,
|
provide: MigrationRunner,
|
||||||
useClass: MigrationRunner,
|
useClass: MigrationRunner,
|
||||||
deps: [AbstractStorageService, LogService, MigrationBuilderService],
|
deps: [AbstractStorageService, LogService, MigrationBuilderService],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: MigrationBuilderService,
|
provide: MigrationBuilderService,
|
||||||
useClass: MigrationBuilderService,
|
useClass: MigrationBuilderService,
|
||||||
},
|
deps: [],
|
||||||
{
|
}),
|
||||||
|
safeProvider({
|
||||||
provide: BillingApiServiceAbstraction,
|
provide: BillingApiServiceAbstraction,
|
||||||
useClass: BillingApiService,
|
useClass: BillingApiService,
|
||||||
deps: [ApiServiceAbstraction],
|
deps: [ApiServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: PaymentMethodWarningsServiceAbstraction,
|
provide: PaymentMethodWarningsServiceAbstraction,
|
||||||
useClass: PaymentMethodWarningsService,
|
useClass: PaymentMethodWarningsService,
|
||||||
deps: [BillingApiServiceAbstraction, StateProvider],
|
deps: [BillingApiServiceAbstraction, StateProvider],
|
||||||
},
|
}),
|
||||||
],
|
];
|
||||||
})
|
|
||||||
export class JslibServicesModule {}
|
|
||||||
|
|
||||||
function encryptServiceFactory(
|
function encryptServiceFactory(
|
||||||
cryptoFunctionservice: CryptoFunctionServiceAbstraction,
|
cryptoFunctionservice: CryptoFunctionServiceAbstraction,
|
||||||
@ -1013,3 +1027,10 @@ function encryptServiceFactory(
|
|||||||
? new MultithreadEncryptServiceImplementation(cryptoFunctionservice, logService, logMacFailures)
|
? new MultithreadEncryptServiceImplementation(cryptoFunctionservice, logService, logMacFailures)
|
||||||
: new EncryptServiceImplementation(cryptoFunctionservice, logService, logMacFailures);
|
: new EncryptServiceImplementation(cryptoFunctionservice, logService, logMacFailures);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [],
|
||||||
|
// Do not register your dependency here! Add it to the typesafeProviders array using the helper function
|
||||||
|
providers: typesafeProviders as UnwrapOpaque<SafeProvider>[],
|
||||||
|
})
|
||||||
|
export class JslibServicesModule {}
|
||||||
|
Loading…
Reference in New Issue
Block a user