1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 09:43:23 +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,7 +10,10 @@ export class AvatarUpdateService implements AvatarUpdateServiceAbstraction {
private _avatarUpdate$ = new BehaviorSubject<string | null>(null);
avatarUpdate$: Observable<string | null> = this._avatarUpdate$.asObservable();
constructor(private apiService: ApiService, private stateService: StateService) {
constructor(
private apiService: ApiService,
private stateService: StateService,
) {
this.loadColorFromState();
}

View File

@@ -156,7 +156,7 @@ export class ApiService implements ApiServiceAbstraction {
private environmentService: EnvironmentService,
private appIdService: AppIdService,
private logoutCallback: (expired: boolean) => Promise<void>,
private customUserAgent: string = null
private customUserAgent: string = null,
) {
this.device = platformUtilsService.getDevice();
this.deviceType = this.device.toString();
@@ -185,7 +185,7 @@ export class ApiService implements ApiServiceAbstraction {
| UserApiTokenRequest
| PasswordTokenRequest
| SsoTokenRequest
| WebAuthnLoginTokenRequest
| WebAuthnLoginTokenRequest,
): Promise<IdentityTokenResponse | IdentityTwoFactorResponse | IdentityCaptchaResponse> {
const headers = new Headers({
"Content-Type": "application/x-www-form-urlencoded; charset=utf-8",
@@ -209,7 +209,7 @@ export class ApiService implements ApiServiceAbstraction {
cache: "no-store",
headers: headers,
method: "POST",
})
}),
);
let responseJson: any = null;
@@ -285,7 +285,7 @@ export class ApiService implements ApiServiceAbstraction {
const requests = await this.getAuthRequests();
const activeRequests = requests.data.filter((m) => !m.isAnswered && !m.isExpired);
const lastRequest = activeRequests.sort((a: AuthRequestResponse, b: AuthRequestResponse) =>
a.creationDate.localeCompare(b.creationDate)
a.creationDate.localeCompare(b.creationDate),
)[activeRequests.length - 1];
return lastRequest;
}
@@ -328,7 +328,7 @@ export class ApiService implements ApiServiceAbstraction {
request,
false,
true,
this.environmentService.getIdentityUrl()
this.environmentService.getIdentityUrl(),
);
return new PreloginResponse(r);
}
@@ -373,7 +373,7 @@ export class ApiService implements ApiServiceAbstraction {
request,
false,
true,
this.environmentService.getIdentityUrl()
this.environmentService.getIdentityUrl(),
);
return new RegisterResponse(r);
}
@@ -425,7 +425,7 @@ export class ApiService implements ApiServiceAbstraction {
}
postAccountVerifyPassword(
request: SecretVerificationRequest
request: SecretVerificationRequest,
): Promise<MasterPasswordPolicyResponse> {
return this.send("POST", "/accounts/verify-password", request, true, true);
}
@@ -457,7 +457,7 @@ export class ApiService implements ApiServiceAbstraction {
async postUserRotateApiKey(
id: string,
request: SecretVerificationRequest
request: SecretVerificationRequest,
): Promise<ApiKeyResponse> {
const r = await this.send("POST", "/accounts/rotate-api-key", request, true, true);
return new ApiKeyResponse(r);
@@ -506,7 +506,7 @@ export class ApiService implements ApiServiceAbstraction {
"/ciphers/organization-details?organizationId=" + organizationId,
null,
true,
true
true,
);
return new ListResponse(r, CipherResponse);
}
@@ -580,7 +580,7 @@ export class ApiService implements ApiServiceAbstraction {
postPurgeCiphers(
request: SecretVerificationRequest,
organizationId: string = null
organizationId: string = null,
): Promise<any> {
let path = "/ciphers/purge";
if (organizationId != null) {
@@ -616,14 +616,14 @@ export class ApiService implements ApiServiceAbstraction {
}
async putRestoreManyCiphers(
request: CipherBulkRestoreRequest
request: CipherBulkRestoreRequest,
): Promise<ListResponse<CipherResponse>> {
const r = await this.send("PUT", "/ciphers/restore", request, true, true);
return new ListResponse<CipherResponse>(r, CipherResponse);
}
async putRestoreManyCiphersAdmin(
request: CipherBulkRestoreRequest
request: CipherBulkRestoreRequest,
): Promise<ListResponse<CipherResponse>> {
const r = await this.send("PUT", "/ciphers/restore-admin", request, true, true);
return new ListResponse<CipherResponse>(r, CipherResponse);
@@ -634,7 +634,7 @@ export class ApiService implements ApiServiceAbstraction {
async getAttachmentData(
cipherId: string,
attachmentId: string,
emergencyAccessId?: string
emergencyAccessId?: string,
): Promise<AttachmentResponse> {
const path =
(emergencyAccessId != null ? "/emergency-access/" + emergencyAccessId + "/" : "/ciphers/") +
@@ -647,7 +647,7 @@ export class ApiService implements ApiServiceAbstraction {
async postCipherAttachment(
id: string,
request: AttachmentRequest
request: AttachmentRequest,
): Promise<AttachmentUploadDataResponse> {
const r = await this.send("POST", "/ciphers/" + id + "/attachment/v2", request, true, true);
return new AttachmentUploadDataResponse(r);
@@ -681,7 +681,7 @@ export class ApiService implements ApiServiceAbstraction {
"/ciphers/" + id + "/attachment/" + attachmentId + "/admin",
null,
true,
false
false,
);
}
@@ -689,27 +689,27 @@ export class ApiService implements ApiServiceAbstraction {
id: string,
attachmentId: string,
data: FormData,
organizationId: string
organizationId: string,
): Promise<any> {
return this.send(
"POST",
"/ciphers/" + id + "/attachment/" + attachmentId + "/share?organizationId=" + organizationId,
data,
true,
false
false,
);
}
async renewAttachmentUploadUrl(
id: string,
attachmentId: string
attachmentId: string,
): Promise<AttachmentUploadDataResponse> {
const r = await this.send(
"GET",
"/ciphers/" + id + "/attachment/" + attachmentId + "/renew",
null,
true,
true
true,
);
return new AttachmentUploadDataResponse(r);
}
@@ -722,14 +722,14 @@ export class ApiService implements ApiServiceAbstraction {
async getCollectionAccessDetails(
organizationId: string,
id: string
id: string,
): Promise<CollectionAccessDetailsResponse> {
const r = await this.send(
"GET",
"/organizations/" + organizationId + "/collections/" + id + "/details",
null,
true,
true
true,
);
return new CollectionAccessDetailsResponse(r);
}
@@ -745,48 +745,48 @@ export class ApiService implements ApiServiceAbstraction {
"/organizations/" + organizationId + "/collections",
null,
true,
true
true,
);
return new ListResponse(r, CollectionResponse);
}
async getManyCollectionsWithAccessDetails(
organizationId: string
organizationId: string,
): Promise<ListResponse<CollectionAccessDetailsResponse>> {
const r = await this.send(
"GET",
"/organizations/" + organizationId + "/collections/details",
null,
true,
true
true,
);
return new ListResponse(r, CollectionAccessDetailsResponse);
}
async getCollectionUsers(
organizationId: string,
id: string
id: string,
): Promise<SelectionReadOnlyResponse[]> {
const r = await this.send(
"GET",
"/organizations/" + organizationId + "/collections/" + id + "/users",
null,
true,
true
true,
);
return r.map((dr: any) => new SelectionReadOnlyResponse(dr));
}
async postCollection(
organizationId: string,
request: CollectionRequest
request: CollectionRequest,
): Promise<CollectionResponse> {
const r = await this.send(
"POST",
"/organizations/" + organizationId + "/collections",
request,
true,
true
true,
);
return new CollectionResponse(r);
}
@@ -794,14 +794,14 @@ export class ApiService implements ApiServiceAbstraction {
async putCollection(
organizationId: string,
id: string,
request: CollectionRequest
request: CollectionRequest,
): Promise<CollectionResponse> {
const r = await this.send(
"PUT",
"/organizations/" + organizationId + "/collections/" + id,
request,
true,
true
true,
);
return new CollectionResponse(r);
}
@@ -809,14 +809,14 @@ export class ApiService implements ApiServiceAbstraction {
async putCollectionUsers(
organizationId: string,
id: string,
request: SelectionReadOnlyRequest[]
request: SelectionReadOnlyRequest[],
): Promise<any> {
await this.send(
"PUT",
"/organizations/" + organizationId + "/collections/" + id + "/users",
request,
true,
false
false,
);
}
@@ -826,7 +826,7 @@ export class ApiService implements ApiServiceAbstraction {
"/organizations/" + organizationId + "/collections/" + id,
null,
true,
false
false,
);
}
@@ -836,21 +836,21 @@ export class ApiService implements ApiServiceAbstraction {
"/organizations/" + organizationId + "/collections",
new CollectionBulkDeleteRequest(collectionIds),
true,
false
false,
);
}
deleteCollectionUser(
organizationId: string,
id: string,
organizationUserId: string
organizationUserId: string,
): Promise<any> {
return this.send(
"DELETE",
"/organizations/" + organizationId + "/collections/" + id + "/user/" + organizationUserId,
null,
true,
false
false,
);
}
@@ -862,7 +862,7 @@ export class ApiService implements ApiServiceAbstraction {
"/organizations/" + organizationId + "/groups/" + id + "/users",
null,
true,
true
true,
);
return r;
}
@@ -873,7 +873,7 @@ export class ApiService implements ApiServiceAbstraction {
"/organizations/" + organizationId + "/groups/" + id + "/users",
request,
true,
false
false,
);
}
@@ -883,7 +883,7 @@ export class ApiService implements ApiServiceAbstraction {
"/organizations/" + organizationId + "/groups/" + id + "/user/" + organizationUserId,
null,
true,
false
false,
);
}
@@ -931,20 +931,20 @@ export class ApiService implements ApiServiceAbstraction {
}
async getTwoFactorOrganizationProviders(
organizationId: string
organizationId: string,
): Promise<ListResponse<TwoFactorProviderResponse>> {
const r = await this.send(
"GET",
"/organizations/" + organizationId + "/two-factor",
null,
true,
true
true,
);
return new ListResponse(r, TwoFactorProviderResponse);
}
async getTwoFactorAuthenticator(
request: SecretVerificationRequest
request: SecretVerificationRequest,
): Promise<TwoFactorAuthenticatorResponse> {
const r = await this.send("POST", "/two-factor/get-authenticator", request, true, true);
return new TwoFactorAuthenticatorResponse(r);
@@ -962,14 +962,14 @@ export class ApiService implements ApiServiceAbstraction {
async getTwoFactorOrganizationDuo(
organizationId: string,
request: SecretVerificationRequest
request: SecretVerificationRequest,
): Promise<TwoFactorDuoResponse> {
const r = await this.send(
"POST",
"/organizations/" + organizationId + "/two-factor/get-duo",
request,
true,
true
true,
);
return new TwoFactorDuoResponse(r);
}
@@ -980,14 +980,14 @@ export class ApiService implements ApiServiceAbstraction {
}
async getTwoFactorWebAuthn(
request: SecretVerificationRequest
request: SecretVerificationRequest,
): Promise<TwoFactorWebAuthnResponse> {
const r = await this.send("POST", "/two-factor/get-webauthn", request, true, true);
return new TwoFactorWebAuthnResponse(r);
}
async getTwoFactorWebAuthnChallenge(
request: SecretVerificationRequest
request: SecretVerificationRequest,
): Promise<ChallengeResponse> {
const r = await this.send("POST", "/two-factor/get-webauthn-challenge", request, true, true);
return new ChallengeResponse(r);
@@ -999,7 +999,7 @@ export class ApiService implements ApiServiceAbstraction {
}
async putTwoFactorAuthenticator(
request: UpdateTwoFactorAuthenticatorRequest
request: UpdateTwoFactorAuthenticatorRequest,
): Promise<TwoFactorAuthenticatorResponse> {
const r = await this.send("PUT", "/two-factor/authenticator", request, true, true);
return new TwoFactorAuthenticatorResponse(r);
@@ -1017,27 +1017,27 @@ export class ApiService implements ApiServiceAbstraction {
async putTwoFactorOrganizationDuo(
organizationId: string,
request: UpdateTwoFactorDuoRequest
request: UpdateTwoFactorDuoRequest,
): Promise<TwoFactorDuoResponse> {
const r = await this.send(
"PUT",
"/organizations/" + organizationId + "/two-factor/duo",
request,
true,
true
true,
);
return new TwoFactorDuoResponse(r);
}
async putTwoFactorYubiKey(
request: UpdateTwoFactorYubioOtpRequest
request: UpdateTwoFactorYubioOtpRequest,
): Promise<TwoFactorYubiKeyResponse> {
const r = await this.send("PUT", "/two-factor/yubikey", request, true, true);
return new TwoFactorYubiKeyResponse(r);
}
async putTwoFactorWebAuthn(
request: UpdateTwoFactorWebAuthnRequest
request: UpdateTwoFactorWebAuthnRequest,
): Promise<TwoFactorWebAuthnResponse> {
const response = request.deviceResponse.response as AuthenticatorAttestationResponse;
const data: any = Object.assign({}, request);
@@ -1058,7 +1058,7 @@ export class ApiService implements ApiServiceAbstraction {
}
async deleteTwoFactorWebAuthn(
request: UpdateTwoFactorWebAuthnDeleteRequest
request: UpdateTwoFactorWebAuthnDeleteRequest,
): Promise<TwoFactorWebAuthnResponse> {
const r = await this.send("DELETE", "/two-factor/webauthn", request, true, true);
return new TwoFactorWebAuthnResponse(r);
@@ -1071,14 +1071,14 @@ export class ApiService implements ApiServiceAbstraction {
async putTwoFactorOrganizationDisable(
organizationId: string,
request: TwoFactorProviderRequest
request: TwoFactorProviderRequest,
): Promise<TwoFactorProviderResponse> {
const r = await this.send(
"PUT",
"/organizations/" + organizationId + "/two-factor/disable",
request,
true,
true
true,
);
return new TwoFactorProviderResponse(r);
}
@@ -1101,20 +1101,20 @@ export class ApiService implements ApiServiceAbstraction {
"/two-factor/get-device-verification-settings",
null,
true,
true
true,
);
return new DeviceVerificationResponse(r);
}
async putDeviceVerificationSettings(
request: DeviceVerificationRequest
request: DeviceVerificationRequest,
): Promise<DeviceVerificationResponse> {
const r = await this.send(
"PUT",
"/two-factor/device-verification-settings",
request,
true,
true
true,
);
return new DeviceVerificationResponse(r);
}
@@ -1129,7 +1129,7 @@ export class ApiService implements ApiServiceAbstraction {
async getOrganizationConnection<TConfig extends OrganizationConnectionConfigApis>(
id: string,
type: OrganizationConnectionType,
configType: { new (response: any): TConfig }
configType: { new (response: any): TConfig },
): Promise<OrganizationConnectionResponse<TConfig>> {
const r = await this.send("GET", `/organizations/connections/${id}/${type}`, null, true, true);
return new OrganizationConnectionResponse(r, configType);
@@ -1137,7 +1137,7 @@ export class ApiService implements ApiServiceAbstraction {
async createOrganizationConnection<TConfig extends OrganizationConnectionConfigApis>(
request: OrganizationConnectionRequest,
configType: { new (response: any): TConfig }
configType: { new (response: any): TConfig },
): Promise<OrganizationConnectionResponse<TConfig>> {
const r = await this.send("POST", "/organizations/connections/", request, true, true);
return new OrganizationConnectionResponse(r, configType);
@@ -1146,14 +1146,14 @@ export class ApiService implements ApiServiceAbstraction {
async updateOrganizationConnection<TConfig extends OrganizationConnectionConfigApis>(
request: OrganizationConnectionRequest,
configType: { new (response: any): TConfig },
organizationConnectionId?: string
organizationConnectionId?: string,
): Promise<OrganizationConnectionResponse<TConfig>> {
const r = await this.send(
"PUT",
"/organizations/connections/" + organizationConnectionId,
request,
true,
true
true,
);
return new OrganizationConnectionResponse(r, configType);
}
@@ -1182,7 +1182,7 @@ export class ApiService implements ApiServiceAbstraction {
// Provider User APIs
async getProviderUsers(
providerId: string
providerId: string,
): Promise<ListResponse<ProviderUserUserDetailsResponse>> {
const r = await this.send("GET", "/providers/" + providerId + "/users", null, true, true);
return new ListResponse(r, ProviderUserUserDetailsResponse);
@@ -1203,41 +1203,41 @@ export class ApiService implements ApiServiceAbstraction {
"/providers/" + providerId + "/users/" + id + "/reinvite",
null,
true,
false
false,
);
}
async postManyProviderUserReinvite(
providerId: string,
request: ProviderUserBulkRequest
request: ProviderUserBulkRequest,
): Promise<ListResponse<ProviderUserBulkResponse>> {
const r = await this.send(
"POST",
"/providers/" + providerId + "/users/reinvite",
request,
true,
true
true,
);
return new ListResponse(r, ProviderUserBulkResponse);
}
async postProviderUserBulkConfirm(
providerId: string,
request: ProviderUserBulkConfirmRequest
request: ProviderUserBulkConfirmRequest,
): Promise<ListResponse<ProviderUserBulkResponse>> {
const r = await this.send(
"POST",
"/providers/" + providerId + "/users/confirm",
request,
true,
true
true,
);
return new ListResponse(r, ProviderUserBulkResponse);
}
async deleteManyProviderUsers(
providerId: string,
request: ProviderUserBulkRequest
request: ProviderUserBulkRequest,
): Promise<ListResponse<ProviderUserBulkResponse>> {
const r = await this.send("DELETE", "/providers/" + providerId + "/users", request, true, true);
return new ListResponse(r, ProviderUserBulkResponse);
@@ -1246,41 +1246,41 @@ export class ApiService implements ApiServiceAbstraction {
postProviderUserAccept(
providerId: string,
id: string,
request: ProviderUserAcceptRequest
request: ProviderUserAcceptRequest,
): Promise<any> {
return this.send(
"POST",
"/providers/" + providerId + "/users/" + id + "/accept",
request,
true,
false
false,
);
}
postProviderUserConfirm(
providerId: string,
id: string,
request: ProviderUserConfirmRequest
request: ProviderUserConfirmRequest,
): Promise<any> {
return this.send(
"POST",
"/providers/" + providerId + "/users/" + id + "/confirm",
request,
true,
false
false,
);
}
async postProviderUsersPublicKey(
providerId: string,
request: ProviderUserBulkRequest
request: ProviderUserBulkRequest,
): Promise<ListResponse<ProviderUserBulkPublicKeyResponse>> {
const r = await this.send(
"POST",
"/providers/" + providerId + "/users/public-keys",
request,
true,
true
true,
);
return new ListResponse(r, ProviderUserBulkPublicKeyResponse);
}
@@ -1288,7 +1288,7 @@ export class ApiService implements ApiServiceAbstraction {
putProviderUser(
providerId: string,
id: string,
request: ProviderUserUpdateRequest
request: ProviderUserUpdateRequest,
): Promise<any> {
return this.send("PUT", "/providers/" + providerId + "/users/" + id, request, true, false);
}
@@ -1300,41 +1300,41 @@ export class ApiService implements ApiServiceAbstraction {
// Provider Organization APIs
async getProviderClients(
providerId: string
providerId: string,
): Promise<ListResponse<ProviderOrganizationOrganizationDetailsResponse>> {
const r = await this.send(
"GET",
"/providers/" + providerId + "/organizations",
null,
true,
true
true,
);
return new ListResponse(r, ProviderOrganizationOrganizationDetailsResponse);
}
postProviderAddOrganization(
providerId: string,
request: ProviderAddOrganizationRequest
request: ProviderAddOrganizationRequest,
): Promise<any> {
return this.send(
"POST",
"/providers/" + providerId + "/organizations/add",
request,
true,
false
false,
);
}
async postProviderCreateOrganization(
providerId: string,
request: ProviderOrganizationCreateRequest
request: ProviderOrganizationCreateRequest,
): Promise<ProviderOrganizationResponse> {
const r = await this.send(
"POST",
"/providers/" + providerId + "/organizations",
request,
true,
true
true,
);
return new ProviderOrganizationResponse(r);
}
@@ -1345,7 +1345,7 @@ export class ApiService implements ApiServiceAbstraction {
"/providers/" + providerId + "/organizations/" + id,
null,
true,
false
false,
);
}
@@ -1357,7 +1357,7 @@ export class ApiService implements ApiServiceAbstraction {
this.addEventParameters("/events", start, end, token),
null,
true,
true
true,
);
return new ListResponse(r, EventResponse);
}
@@ -1366,14 +1366,14 @@ export class ApiService implements ApiServiceAbstraction {
id: string,
start: string,
end: string,
token: string
token: string,
): Promise<ListResponse<EventResponse>> {
const r = await this.send(
"GET",
this.addEventParameters("/ciphers/" + id + "/events", start, end, token),
null,
true,
true
true,
);
return new ListResponse(r, EventResponse);
}
@@ -1382,14 +1382,14 @@ export class ApiService implements ApiServiceAbstraction {
id: string,
start: string,
end: string,
token: string
token: string,
): Promise<ListResponse<EventResponse>> {
const r = await this.send(
"GET",
this.addEventParameters("/organizations/" + id + "/events", start, end, token),
null,
true,
true
true,
);
return new ListResponse(r, EventResponse);
}
@@ -1399,7 +1399,7 @@ export class ApiService implements ApiServiceAbstraction {
id: string,
start: string,
end: string,
token: string
token: string,
): Promise<ListResponse<EventResponse>> {
const r = await this.send(
"GET",
@@ -1407,11 +1407,11 @@ export class ApiService implements ApiServiceAbstraction {
"/organizations/" + organizationId + "/users/" + id + "/events",
start,
end,
token
token,
),
null,
true,
true
true,
);
return new ListResponse(r, EventResponse);
}
@@ -1420,14 +1420,14 @@ export class ApiService implements ApiServiceAbstraction {
id: string,
start: string,
end: string,
token: string
token: string,
): Promise<ListResponse<EventResponse>> {
const r = await this.send(
"GET",
this.addEventParameters("/providers/" + id + "/events", start, end, token),
null,
true,
true
true,
);
return new ListResponse(r, EventResponse);
}
@@ -1437,7 +1437,7 @@ export class ApiService implements ApiServiceAbstraction {
id: string,
start: string,
end: string,
token: string
token: string,
): Promise<ListResponse<EventResponse>> {
const r = await this.send(
"GET",
@@ -1445,11 +1445,11 @@ export class ApiService implements ApiServiceAbstraction {
"/providers/" + providerId + "/users/" + id + "/events",
start,
end,
token
token,
),
null,
true,
true
true,
);
return new ListResponse(r, EventResponse);
}
@@ -1471,7 +1471,7 @@ export class ApiService implements ApiServiceAbstraction {
method: "POST",
body: JSON.stringify(request),
headers: headers,
})
}),
);
if (response.status !== 200) {
return Promise.reject("Event post failed.");
@@ -1507,7 +1507,7 @@ export class ApiService implements ApiServiceAbstraction {
// Key Connector
async getMasterKeyFromKeyConnector(
keyConnectorUrl: string
keyConnectorUrl: string,
): Promise<KeyConnectorUserKeyResponse> {
const authHeader = await this.getActiveBearerToken();
@@ -1519,7 +1519,7 @@ export class ApiService implements ApiServiceAbstraction {
Accept: "application/json",
Authorization: "Bearer " + authHeader,
}),
})
}),
);
if (response.status !== 200) {
@@ -1532,7 +1532,7 @@ export class ApiService implements ApiServiceAbstraction {
async postUserKeyToKeyConnector(
keyConnectorUrl: string,
request: KeyConnectorUserKeyRequest
request: KeyConnectorUserKeyRequest,
): Promise<void> {
const authHeader = await this.getActiveBearerToken();
@@ -1546,7 +1546,7 @@ export class ApiService implements ApiServiceAbstraction {
"Content-Type": "application/json; charset=utf-8",
}),
body: JSON.stringify(request),
})
}),
);
if (response.status !== 200) {
@@ -1564,7 +1564,7 @@ export class ApiService implements ApiServiceAbstraction {
Accept: "application/json",
"Content-Type": "application/json; charset=utf-8",
}),
})
}),
);
if (response.status !== 200) {
@@ -1579,7 +1579,7 @@ export class ApiService implements ApiServiceAbstraction {
"/organizations/" + organizationId + "/export",
null,
true,
true
true,
);
return new OrganizationExportResponse(r);
}
@@ -1603,7 +1603,7 @@ export class ApiService implements ApiServiceAbstraction {
request.headers.set("Bitwarden-Client-Name", this.platformUtilsService.getClientType());
request.headers.set(
"Bitwarden-Client-Version",
await this.platformUtilsService.getApplicationVersionNumber()
await this.platformUtilsService.getApplicationVersionNumber(),
);
return this.nativeFetch(request);
}
@@ -1631,7 +1631,7 @@ export class ApiService implements ApiServiceAbstraction {
credentials: this.getCredentials(),
headers: headers,
method: "GET",
})
}),
);
if (response.status === 200) {
@@ -1645,7 +1645,7 @@ export class ApiService implements ApiServiceAbstraction {
async postCreateSponsorship(
sponsoredOrgId: string,
request: OrganizationSponsorshipCreateRequest
request: OrganizationSponsorshipCreateRequest,
): Promise<void> {
return await this.send(
"POST",
@@ -1655,19 +1655,19 @@ export class ApiService implements ApiServiceAbstraction {
"/families-for-enterprise",
request,
true,
false
false,
);
}
async getSponsorshipSyncStatus(
sponsoredOrgId: string
sponsoredOrgId: string,
): Promise<OrganizationSponsorshipSyncStatusResponse> {
const response = await this.send(
"GET",
"/organization/sponsorship/" + sponsoredOrgId + "/sync-status",
null,
true,
true
true,
);
return new OrganizationSponsorshipSyncStatusResponse(response);
}
@@ -1680,7 +1680,7 @@ export class ApiService implements ApiServiceAbstraction {
sponsoringOrganizationId,
null,
true,
false
false,
);
}
@@ -1690,7 +1690,7 @@ export class ApiService implements ApiServiceAbstraction {
"/organization/sponsorship/sponsored/" + sponsoringOrgId,
null,
true,
false
false,
);
}
@@ -1701,21 +1701,21 @@ export class ApiService implements ApiServiceAbstraction {
encodeURIComponent(sponsorshipToken),
null,
true,
true
true,
);
return r as boolean;
}
async postRedeemSponsorship(
sponsorshipToken: string,
request: OrganizationSponsorshipRedeemRequest
request: OrganizationSponsorshipRedeemRequest,
): Promise<void> {
return await this.send(
"POST",
"/organization/sponsorship/redeem?sponsorshipToken=" + encodeURIComponent(sponsorshipToken),
request,
true,
false
false,
);
}
@@ -1725,7 +1725,7 @@ export class ApiService implements ApiServiceAbstraction {
"/organization/sponsorship/" + sponsoringOrgId + "/families-for-enterprise/resend",
null,
true,
false
false,
);
}
@@ -1770,7 +1770,7 @@ export class ApiService implements ApiServiceAbstraction {
credentials: this.getCredentials(),
headers: headers,
method: "POST",
})
}),
);
if (response.status === 200) {
@@ -1779,7 +1779,7 @@ export class ApiService implements ApiServiceAbstraction {
await this.tokenService.setTokens(
tokenResponse.accessToken,
tokenResponse.refreshToken,
null
null,
);
} else {
const error = await this.handleError(response, true, true);
@@ -1797,7 +1797,7 @@ export class ApiService implements ApiServiceAbstraction {
clientId,
clientSecret,
new TokenTwoFactorRequest(),
deviceRequest
deviceRequest,
);
const response = await this.postIdentityToken(tokenRequest);
@@ -1815,7 +1815,7 @@ export class ApiService implements ApiServiceAbstraction {
authed: boolean,
hasResponse: boolean,
apiUrl?: string,
alterHeaders?: (headers: Headers) => void
alterHeaders?: (headers: Headers) => void,
): Promise<any> {
apiUrl = Utils.isNullOrWhitespace(apiUrl) ? this.environmentService.getApiUrl() : apiUrl;
@@ -1878,7 +1878,7 @@ export class ApiService implements ApiServiceAbstraction {
private async handleError(
response: Response,
tokenError: boolean,
authed: boolean
authed: boolean,
): Promise<ErrorResponse> {
let responseJson: any = null;
if (this.isJsonResponse(response)) {

View File

@@ -11,7 +11,7 @@ const PwnedPasswordsApi = "https://api.pwnedpasswords.com/range/";
export class AuditService implements AuditServiceAbstraction {
constructor(
private cryptoFunctionService: CryptoFunctionService,
private apiService: ApiService
private apiService: ApiService,
) {}
@throttle(100, () => "passwordLeaked")

View File

@@ -11,14 +11,14 @@ export class EventCollectionService implements EventCollectionServiceAbstraction
private cipherService: CipherService,
private stateService: StateService,
private organizationService: OrganizationService,
private eventUploadService: EventUploadService
private eventUploadService: EventUploadService,
) {}
async collect(
eventType: EventType,
cipherId: string = null,
uploadImmediately = false,
organizationId: string = null
organizationId: string = null,
): Promise<any> {
const authed = await this.stateService.getIsAuthenticated();
if (!authed) {

View File

@@ -9,7 +9,7 @@ export class EventUploadService implements EventUploadServiceAbstraction {
constructor(
private apiService: ApiService,
private stateService: StateService,
private logService: LogService
private logService: LogService,
) {}
init(checkOnInterval: boolean) {

View File

@@ -36,7 +36,7 @@ export class NotificationsService implements NotificationsServiceAbstraction {
private logoutCallback: (expired: boolean) => Promise<void>,
private stateService: StateService,
private authService: AuthService,
private messagingService: MessagingService
private messagingService: MessagingService,
) {
this.environmentService.urls.subscribe(() => {
if (!this.inited) {
@@ -76,7 +76,7 @@ export class NotificationsService implements NotificationsServiceAbstraction {
.build();
this.signalrConnection.on("ReceiveMessage", (data: any) =>
this.processNotification(new NotificationResponse(data))
this.processNotification(new NotificationResponse(data)),
);
// eslint-disable-next-line
this.signalrConnection.on("Heartbeat", (data: any) => {
@@ -139,7 +139,7 @@ export class NotificationsService implements NotificationsServiceAbstraction {
case NotificationType.SyncCipherUpdate:
await this.syncService.syncUpsertCipher(
notification.payload as SyncCipherNotification,
notification.type === NotificationType.SyncCipherUpdate
notification.type === NotificationType.SyncCipherUpdate,
);
break;
case NotificationType.SyncCipherDelete:
@@ -150,7 +150,7 @@ export class NotificationsService implements NotificationsServiceAbstraction {
case NotificationType.SyncFolderUpdate:
await this.syncService.syncUpsertFolder(
notification.payload as SyncFolderNotification,
notification.type === NotificationType.SyncFolderUpdate
notification.type === NotificationType.SyncFolderUpdate,
);
break;
case NotificationType.SyncFolderDelete:
@@ -179,7 +179,7 @@ export class NotificationsService implements NotificationsServiceAbstraction {
case NotificationType.SyncSendUpdate:
await this.syncService.syncUpsertSend(
notification.payload as SyncSendNotification,
notification.type === NotificationType.SyncSendUpdate
notification.type === NotificationType.SyncSendUpdate,
);
break;
case NotificationType.SyncSendDelete:

View File

@@ -40,8 +40,8 @@ describe("PolicyService", () => {
true,
true,
OrganizationUserStatusType.Accepted,
false
)
false,
),
),
]);
organizationService.getAll.calledWith(undefined).mockResolvedValue([]);
@@ -168,10 +168,10 @@ describe("PolicyService", () => {
const data: any = {};
const model = [
new Policy(
policyData("3", "test-organization-3", PolicyType.DisablePersonalVaultExport, true, data)
policyData("3", "test-organization-3", PolicyType.DisablePersonalVaultExport, true, data),
),
new Policy(
policyData("4", "test-organization-3", PolicyType.MaximumVaultTimeout, true, data)
policyData("4", "test-organization-3", PolicyType.MaximumVaultTimeout, true, data),
),
];
@@ -186,7 +186,7 @@ describe("PolicyService", () => {
};
const model = [
new Policy(
policyData("3", "test-organization-3", PolicyType.DisablePersonalVaultExport, true, data)
policyData("3", "test-organization-3", PolicyType.DisablePersonalVaultExport, true, data),
),
new Policy(policyData("4", "test-organization-3", PolicyType.MasterPassword, true, data)),
];
@@ -290,13 +290,13 @@ describe("PolicyService", () => {
new Policy(
policyData("1", "organization-1", PolicyType.DisablePersonalVaultExport, true, {
requireUpper: true,
})
}),
),
new Policy(
policyData("2", "organization-2", PolicyType.DisableSend, false, {
minComplexity: 5,
minLength: 20,
})
}),
),
]);
});
@@ -305,7 +305,7 @@ describe("PolicyService", () => {
describe("policyAppliesToActiveUser$", () => {
it("MasterPassword does not apply", async () => {
const result = await firstValueFrom(
policyService.policyAppliesToActiveUser$(PolicyType.MasterPassword)
policyService.policyAppliesToActiveUser$(PolicyType.MasterPassword),
);
expect(result).toEqual(false);
@@ -313,7 +313,7 @@ describe("PolicyService", () => {
it("MaximumVaultTimeout applies", async () => {
const result = await firstValueFrom(
policyService.policyAppliesToActiveUser$(PolicyType.MaximumVaultTimeout)
policyService.policyAppliesToActiveUser$(PolicyType.MaximumVaultTimeout),
);
expect(result).toEqual(true);
@@ -321,7 +321,7 @@ describe("PolicyService", () => {
it("PolicyFilter filters result", async () => {
const result = await firstValueFrom(
policyService.policyAppliesToActiveUser$(PolicyType.MaximumVaultTimeout, (p) => false)
policyService.policyAppliesToActiveUser$(PolicyType.MaximumVaultTimeout, (p) => false),
);
expect(result).toEqual(false);
@@ -329,7 +329,7 @@ describe("PolicyService", () => {
it("DisablePersonalVaultExport does not apply", async () => {
const result = await firstValueFrom(
policyService.policyAppliesToActiveUser$(PolicyType.DisablePersonalVaultExport)
policyService.policyAppliesToActiveUser$(PolicyType.DisablePersonalVaultExport),
);
expect(result).toEqual(false);
@@ -341,7 +341,7 @@ describe("PolicyService", () => {
const result = await policyService.policyAppliesToUser(
PolicyType.MasterPassword,
null,
"user"
"user",
);
expect(result).toEqual(false);
@@ -351,7 +351,7 @@ describe("PolicyService", () => {
const result = await policyService.policyAppliesToUser(
PolicyType.MaximumVaultTimeout,
null,
"user"
"user",
);
expect(result).toEqual(true);
@@ -361,7 +361,7 @@ describe("PolicyService", () => {
const result = await policyService.policyAppliesToUser(
PolicyType.MaximumVaultTimeout,
(p) => false,
"user"
"user",
);
expect(result).toEqual(false);
@@ -371,7 +371,7 @@ describe("PolicyService", () => {
const result = await policyService.policyAppliesToUser(
PolicyType.DisablePersonalVaultExport,
null,
"user"
"user",
);
expect(result).toEqual(false);
@@ -383,7 +383,7 @@ describe("PolicyService", () => {
organizationId: string,
type: PolicyType,
enabled: boolean,
data?: any
data?: any,
) {
const policyData = new PolicyData({} as any);
policyData.id = id;
@@ -400,7 +400,7 @@ describe("PolicyService", () => {
enabled: boolean,
usePolicies: boolean,
status: OrganizationUserStatusType,
managePolicies: boolean
managePolicies: boolean,
) {
const organizationData = new OrganizationData({} as any, {} as any);
organizationData.id = id;

View File

@@ -18,7 +18,10 @@ export class SearchService implements SearchServiceAbstraction {
private readonly defaultSearchableMinLength: number = 2;
private searchableMinLength: number = this.defaultSearchableMinLength;
constructor(private logService: LogService, private i18nService: I18nService) {
constructor(
private logService: LogService,
private i18nService: I18nService,
) {
this.i18nService.locale$.subscribe((locale) => {
if (this.immediateSearchLocales.indexOf(locale) !== -1) {
this.searchableMinLength = 1;
@@ -101,7 +104,7 @@ export class SearchService implements SearchServiceAbstraction {
async searchCiphers(
query: string,
filter: ((cipher: CipherView) => boolean) | ((cipher: CipherView) => boolean)[] = null,
ciphers: CipherView[]
ciphers: CipherView[],
): Promise<CipherView[]> {
const results: CipherView[] = [];
if (query != null) {

View File

@@ -30,7 +30,7 @@ export class SettingsService implements SettingsServiceAbstraction {
this._settings.next(data);
this._disableFavicon.next(disableFavicon);
})
}),
)
.subscribe();
}

View File

@@ -31,7 +31,7 @@ describe("VaultTimeoutSettingsService", () => {
tokenService,
policyService,
stateService,
userVerificationService
userVerificationService,
);
});
@@ -100,14 +100,14 @@ describe("VaultTimeoutSettingsService", () => {
userVerificationService.hasMasterPassword.mockResolvedValue(true);
policyService.policyAppliesToUser.mockResolvedValue(policy === null ? false : true);
policyService.getAll.mockResolvedValue(
policy === null ? [] : ([{ data: { action: policy } }] as unknown as Policy[])
policy === null ? [] : ([{ data: { action: policy } }] as unknown as Policy[]),
);
stateService.getVaultTimeoutAction.mockResolvedValue(userPreference);
const result = await firstValueFrom(service.vaultTimeoutAction$());
expect(result).toBe(expected);
}
},
);
});
@@ -128,14 +128,14 @@ describe("VaultTimeoutSettingsService", () => {
userVerificationService.hasMasterPassword.mockResolvedValue(false);
policyService.policyAppliesToUser.mockResolvedValue(policy === null ? false : true);
policyService.getAll.mockResolvedValue(
policy === null ? [] : ([{ data: { action: policy } }] as unknown as Policy[])
policy === null ? [] : ([{ data: { action: policy } }] as unknown as Policy[]),
);
stateService.getVaultTimeoutAction.mockResolvedValue(userPreference);
const result = await firstValueFrom(service.vaultTimeoutAction$());
expect(result).toBe(expected);
}
},
);
});
});

View File

@@ -22,7 +22,7 @@ export class VaultTimeoutSettingsService implements VaultTimeoutSettingsServiceA
private tokenService: TokenService,
private policyService: PolicyService,
private stateService: StateService,
private userVerificationService: UserVerificationService
private userVerificationService: UserVerificationService,
) {}
async setVaultTimeoutOptions(timeout: number, action: VaultTimeoutAction): Promise<void> {

View File

@@ -74,7 +74,7 @@ describe("VaultTimeoutService", () => {
authService,
vaultTimeoutSettingsService,
lockedCallback,
loggedOutCallback
loggedOutCallback,
);
});
@@ -91,7 +91,7 @@ describe("VaultTimeoutService", () => {
availableTimeoutActions?: VaultTimeoutAction[];
}
>,
userId?: string
userId?: string,
) => {
// Both are available by default and the specific test can change this per test
availableVaultTimeoutActionsSubject.next([VaultTimeoutAction.Lock, VaultTimeoutAction.LogOut]);
@@ -123,7 +123,7 @@ describe("VaultTimeoutService", () => {
accounts[userId]?.availableTimeoutActions ?? [
VaultTimeoutAction.Lock,
VaultTimeoutAction.LogOut,
]
],
);
});
@@ -133,7 +133,7 @@ describe("VaultTimeoutService", () => {
newPartial[key] = null; // No values actually matter on this other than the key
return Object.assign(agg, newPartial);
},
{} as Record<string, Account>
{} as Record<string, Account>,
);
accountsSubject.next(accountsSubjectValue);
};
@@ -172,7 +172,7 @@ describe("VaultTimeoutService", () => {
});
expectNoAction("1");
}
},
);
it.each([
@@ -195,7 +195,7 @@ describe("VaultTimeoutService", () => {
await vaultTimeoutService.checkVaultTimeout();
expectNoAction("1");
}
},
);
it.each([undefined, null])(
@@ -212,7 +212,7 @@ describe("VaultTimeoutService", () => {
await vaultTimeoutService.checkVaultTimeout();
expectNoAction("1");
}
},
);
it("should lock an account that isn't active and has immediate as their timeout when view is not open", async () => {
@@ -276,7 +276,7 @@ describe("VaultTimeoutService", () => {
availableTimeoutActions: [VaultTimeoutAction.LogOut],
},
},
"2" // Treat user 2 as the active user
"2", // Treat user 2 as the active user
);
await vaultTimeoutService.checkVaultTimeout();

View File

@@ -30,7 +30,7 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
private authService: AuthService,
private vaultTimeoutSettingsService: VaultTimeoutSettingsService,
private lockedCallback: (userId?: string) => Promise<void> = null,
private loggedOutCallback: (expired: boolean, userId?: string) => Promise<void> = null
private loggedOutCallback: (expired: boolean, userId?: string) => Promise<void> = null,
) {}
async init(checkOnInterval: boolean) {
@@ -71,7 +71,7 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
}
const availableActions = await firstValueFrom(
this.vaultTimeoutSettingsService.availableVaultTimeoutActions$(userId)
this.vaultTimeoutSettingsService.availableVaultTimeoutActions$(userId),
);
const supportsLock = availableActions.includes(VaultTimeoutAction.Lock);
if (!supportsLock) {
@@ -134,7 +134,7 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
private async executeTimeoutAction(userId: string): Promise<void> {
const timeoutAction = await firstValueFrom(
this.vaultTimeoutSettingsService.vaultTimeoutAction$(userId)
this.vaultTimeoutSettingsService.vaultTimeoutAction$(userId),
);
timeoutAction === VaultTimeoutAction.LogOut
? await this.logOut(userId)