From 83548a6753a974c57cb373b529a4da3ea5c3b5c0 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 17 Sep 2021 14:57:31 +0200 Subject: [PATCH] Remove deprecated index.ts (#490) * Remove deprecated index.ts * Update tests --- .../src/components/attachments.component.ts | 2 +- .../src/components/two-factor.component.ts | 2 +- .../src/directives/api-action.directive.ts | 2 +- common/src/abstractions/index.ts | 24 ------------------- common/src/enums/index.ts | 8 ------- .../cipherImportContext.ts | 2 +- .../onepasswordCsvImporter.ts | 2 +- .../onepasswordMacCsvImporter.ts | 4 +++- .../onepasswordWinCsvImporter.ts | 5 +++- .../src/importers/safeInCloudXmlImporter.ts | 5 ++-- common/src/importers/zohoVaultCsvImporter.ts | 2 +- common/src/index.ts | 10 -------- common/src/models/data/index.ts | 10 -------- common/src/models/domain/index.ts | 16 ------------- .../src/models/domain/sortedCiphersCache.ts | 2 +- common/src/models/request/index.ts | 8 ------- common/src/models/response/index.ts | 15 ------------ common/src/models/view/index.ts | 9 ------- common/src/services/api.service.ts | 2 +- common/src/services/index.ts | 20 ---------------- .../importers/lastpassCsvImporter.spec.ts | 3 ++- .../importers/nordpassCsvImporter.spec.ts | 6 +++-- .../onepasswordMacCsvImporter.spec.ts | 2 +- .../onepasswordWinCsvImporter.spec.ts | 3 ++- .../webCryptoFunction.service.spec.ts | 2 +- 25 files changed, 28 insertions(+), 138 deletions(-) delete mode 100644 common/src/abstractions/index.ts delete mode 100644 common/src/enums/index.ts delete mode 100644 common/src/index.ts delete mode 100644 common/src/models/data/index.ts delete mode 100644 common/src/models/domain/index.ts delete mode 100644 common/src/models/request/index.ts delete mode 100644 common/src/models/response/index.ts delete mode 100644 common/src/models/view/index.ts delete mode 100644 common/src/services/index.ts diff --git a/angular/src/components/attachments.component.ts b/angular/src/components/attachments.component.ts index 3c981b3909..a4f6b65c56 100644 --- a/angular/src/components/attachments.component.ts +++ b/angular/src/components/attachments.component.ts @@ -14,7 +14,7 @@ import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.se import { UserService } from 'jslib-common/abstractions/user.service'; import { Cipher } from 'jslib-common/models/domain/cipher'; -import { ErrorResponse } from 'jslib-common/models/response'; +import { ErrorResponse } from 'jslib-common/models/response/errorResponse'; import { AttachmentView } from 'jslib-common/models/view/attachmentView'; import { CipherView } from 'jslib-common/models/view/cipherView'; diff --git a/angular/src/components/two-factor.component.ts b/angular/src/components/two-factor.component.ts index cd41dd3114..cf25ff519e 100644 --- a/angular/src/components/two-factor.component.ts +++ b/angular/src/components/two-factor.component.ts @@ -11,7 +11,7 @@ import { TwoFactorProviderType } from 'jslib-common/enums/twoFactorProviderType' import { TwoFactorEmailRequest } from 'jslib-common/models/request/twoFactorEmailRequest'; -import { AuthResult } from 'jslib-common/models/domain'; +import { AuthResult } from 'jslib-common/models/domain/authResult'; import { ApiService } from 'jslib-common/abstractions/api.service'; import { AuthService } from 'jslib-common/abstractions/auth.service'; diff --git a/angular/src/directives/api-action.directive.ts b/angular/src/directives/api-action.directive.ts index 0ee0ed2a74..049d4b302f 100644 --- a/angular/src/directives/api-action.directive.ts +++ b/angular/src/directives/api-action.directive.ts @@ -6,7 +6,7 @@ import { } from '@angular/core'; import { LogService } from 'jslib-common/abstractions/log.service'; -import { ErrorResponse } from 'jslib-common/models/response'; +import { ErrorResponse } from 'jslib-common/models/response/errorResponse'; import { ValidationService } from '../services/validation.service'; diff --git a/common/src/abstractions/index.ts b/common/src/abstractions/index.ts deleted file mode 100644 index 6d8e7427ed..0000000000 --- a/common/src/abstractions/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Using index.ts is deprecated, please do not extend -export { ApiService } from './api.service'; -export { AppIdService } from './appId.service'; -export { AuditService } from './audit.service'; -export { AuthService } from './auth.service'; -export { CipherService } from './cipher.service'; -export { CollectionService } from './collection.service'; -export { CryptoService } from './crypto.service'; -export { EnvironmentService } from './environment.service'; -export { FolderService } from './folder.service'; -export { I18nService } from './i18n.service'; -export { LogService } from './log.service'; -export { MessagingService } from './messaging.service'; -export { PasswordGenerationService } from './passwordGeneration.service'; -export { PlatformUtilsService } from './platformUtils.service'; -export { SearchService } from './search.service'; -export { SettingsService } from './settings.service'; -export { StorageService } from './storage.service'; -export { StateService } from './state.service'; -export { SyncService } from './sync.service'; -export { TokenService } from './token.service'; -export { TotpService } from './totp.service'; -export { UserService } from './user.service'; -export { VaultTimeoutService } from './vaultTimeout.service'; diff --git a/common/src/enums/index.ts b/common/src/enums/index.ts deleted file mode 100644 index 740efbf9a9..0000000000 --- a/common/src/enums/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export { CipherType } from './cipherType'; -export { DeviceType } from './deviceType'; -export { EncryptionType } from './encryptionType'; -export { FieldType } from './fieldType'; -export { LogLevelType } from './logLevelType'; -export { SecureNoteType } from './secureNoteType'; -export { TwoFactorProviderType } from './twoFactorProviderType'; -export { UriMatchType } from './uriMatchType'; diff --git a/common/src/importers/onepasswordImporters/cipherImportContext.ts b/common/src/importers/onepasswordImporters/cipherImportContext.ts index e3a6ff8d6c..66d822313a 100644 --- a/common/src/importers/onepasswordImporters/cipherImportContext.ts +++ b/common/src/importers/onepasswordImporters/cipherImportContext.ts @@ -1,4 +1,4 @@ -import { CipherView } from '../../models/view'; +import { CipherView } from '../../models/view/cipherView'; export class CipherImportContext { lowerProperty: string; diff --git a/common/src/importers/onepasswordImporters/onepasswordCsvImporter.ts b/common/src/importers/onepasswordImporters/onepasswordCsvImporter.ts index b16bebe074..8bf5f15310 100644 --- a/common/src/importers/onepasswordImporters/onepasswordCsvImporter.ts +++ b/common/src/importers/onepasswordImporters/onepasswordCsvImporter.ts @@ -4,7 +4,7 @@ import { Importer } from '../importer'; import { CipherType } from '../../enums/cipherType'; import { FieldType } from '../../enums/fieldType'; -import { CipherView } from '../../models/view'; +import { CipherView } from '../../models/view/cipherView'; import { CipherImportContext } from './cipherImportContext'; export const IgnoredProperties = ['ainfo', 'autosubmit', 'notesplain', 'ps', 'scope', 'tags', 'title', 'uuid', 'notes']; diff --git a/common/src/importers/onepasswordImporters/onepasswordMacCsvImporter.ts b/common/src/importers/onepasswordImporters/onepasswordMacCsvImporter.ts index 443647c82d..35c602aa41 100644 --- a/common/src/importers/onepasswordImporters/onepasswordMacCsvImporter.ts +++ b/common/src/importers/onepasswordImporters/onepasswordMacCsvImporter.ts @@ -2,7 +2,9 @@ import { Importer } from '../importer'; import { IgnoredProperties, OnePasswordCsvImporter } from './onepasswordCsvImporter'; import { CipherType } from '../../enums/cipherType'; -import { CardView, CipherView, IdentityView } from '../../models/view'; +import { CardView } from '../../models/view/cardView'; +import { CipherView } from '../../models/view/cipherView'; +import { IdentityView } from '../../models/view/identityView'; export class OnePasswordMacCsvImporter extends OnePasswordCsvImporter implements Importer { setCipherType(value: any, cipher: CipherView) { diff --git a/common/src/importers/onepasswordImporters/onepasswordWinCsvImporter.ts b/common/src/importers/onepasswordImporters/onepasswordWinCsvImporter.ts index 9b4fae89c6..ef0c1055d1 100644 --- a/common/src/importers/onepasswordImporters/onepasswordWinCsvImporter.ts +++ b/common/src/importers/onepasswordImporters/onepasswordWinCsvImporter.ts @@ -3,7 +3,10 @@ import { CipherImportContext } from './cipherImportContext'; import { OnePasswordCsvImporter } from './onepasswordCsvImporter'; import { CipherType } from '../../enums/cipherType'; -import { CardView, CipherView, IdentityView, LoginView } from '../../models/view'; +import { CardView } from '../../models/view/cardView'; +import { CipherView } from '../../models/view/cipherView'; +import { IdentityView } from '../../models/view/identityView'; +import { LoginView } from '../../models/view/loginView'; export class OnePasswordWinCsvImporter extends OnePasswordCsvImporter implements Importer { constructor() { diff --git a/common/src/importers/safeInCloudXmlImporter.ts b/common/src/importers/safeInCloudXmlImporter.ts index 6e766cc03d..93339a6654 100644 --- a/common/src/importers/safeInCloudXmlImporter.ts +++ b/common/src/importers/safeInCloudXmlImporter.ts @@ -9,8 +9,9 @@ import { SecureNoteView } from '../models/view/secureNoteView'; import { CipherType } from '../enums/cipherType'; import { SecureNoteType } from '../enums/secureNoteType'; -import { FieldType } from '../enums'; -import { CipherView, FieldView } from '../models/view'; +import { FieldType } from '../enums/fieldType'; +import { CipherView } from '../models/view/cipherView'; +import { FieldView } from '../models/view/fieldView'; export class SafeInCloudXmlImporter extends BaseImporter implements Importer { parse(data: string): Promise { diff --git a/common/src/importers/zohoVaultCsvImporter.ts b/common/src/importers/zohoVaultCsvImporter.ts index 4ff99f2804..536dc8ccca 100644 --- a/common/src/importers/zohoVaultCsvImporter.ts +++ b/common/src/importers/zohoVaultCsvImporter.ts @@ -2,7 +2,7 @@ import { BaseImporter } from './baseImporter'; import { Importer } from './importer'; import { ImportResult } from '../models/domain/importResult'; -import { CipherView } from '../models/view'; +import { CipherView } from '../models/view/cipherView'; export class ZohoVaultCsvImporter extends BaseImporter implements Importer { parse(data: string): Promise { diff --git a/common/src/index.ts b/common/src/index.ts deleted file mode 100644 index d7c0a21d1d..0000000000 --- a/common/src/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -import * as Abstractions from './abstractions'; -import * as Enums from './enums'; -import * as Data from './models/data'; -import * as Domain from './models/domain'; -import * as Request from './models/request'; -import * as Response from './models/response'; -import * as View from './models/view'; -import * as Services from './services'; - -export { Abstractions, Enums, Data, Domain, Request, Response, Services, View }; diff --git a/common/src/models/data/index.ts b/common/src/models/data/index.ts deleted file mode 100644 index 97732b6d76..0000000000 --- a/common/src/models/data/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -export { AttachmentData } from './attachmentData'; -export { CardData } from './cardData'; -export { CipherData } from './cipherData'; -export { CollectionData } from './collectionData'; -export { FieldData } from './fieldData'; -export { FolderData } from './folderData'; -export { IdentityData } from './identityData'; -export { LoginData } from './loginData'; -export { LoginUriData } from './loginUriData'; -export { SecureNoteData } from './secureNoteData'; diff --git a/common/src/models/domain/index.ts b/common/src/models/domain/index.ts deleted file mode 100644 index e611bc8f85..0000000000 --- a/common/src/models/domain/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -export { Attachment } from './attachment'; -export { AuthResult } from './authResult'; -export { Card } from './card'; -export { Cipher } from './cipher'; -export { EncString } from './encString'; -export { Collection } from './collection'; -export { EncryptedObject } from './encryptedObject'; -export { EnvironmentUrls } from './environmentUrls'; -export { Field } from './field'; -export { Folder } from './folder'; -export { Identity } from './identity'; -export { Login } from './login'; -export { LoginUri } from './loginUri'; -export { GeneratedPasswordHistory } from './generatedPasswordHistory'; -export { SecureNote } from './secureNote'; -export { SymmetricCryptoKey } from './symmetricCryptoKey'; diff --git a/common/src/models/domain/sortedCiphersCache.ts b/common/src/models/domain/sortedCiphersCache.ts index 60da2d93be..64f4b049d5 100644 --- a/common/src/models/domain/sortedCiphersCache.ts +++ b/common/src/models/domain/sortedCiphersCache.ts @@ -1,4 +1,4 @@ -import { CipherView } from '../view'; +import { CipherView } from '../view/cipherView'; const CacheTTL = 3000; diff --git a/common/src/models/request/index.ts b/common/src/models/request/index.ts deleted file mode 100644 index 51acd28f4c..0000000000 --- a/common/src/models/request/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export { CipherRequest } from './cipherRequest'; -export { DeviceRequest } from './deviceRequest'; -export { DeviceTokenRequest } from './deviceTokenRequest'; -export { FolderRequest } from './folderRequest'; -export { PasswordHintRequest } from './passwordHintRequest'; -export { RegisterRequest } from './registerRequest'; -export { TokenRequest } from './tokenRequest'; -export { TwoFactorEmailRequest } from './twoFactorEmailRequest'; diff --git a/common/src/models/response/index.ts b/common/src/models/response/index.ts deleted file mode 100644 index 98829b10ea..0000000000 --- a/common/src/models/response/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -export { AttachmentResponse } from './attachmentResponse'; -export { CipherResponse } from './cipherResponse'; -export { CollectionResponse } from './collectionResponse'; -export { DeviceResponse } from './deviceResponse'; -export { DomainsResponse } from './domainsResponse'; -export { ErrorResponse } from './errorResponse'; -export { FolderResponse } from './folderResponse'; -export { GlobalDomainResponse } from './globalDomainResponse'; -export { IdentityTokenResponse } from './identityTokenResponse'; -export { IdentityTwoFactorResponse } from './identityTwoFactorResponse'; -export { KeysResponse } from './keysResponse'; -export { ListResponse } from './listResponse'; -export { ProfileOrganizationResponse } from './profileOrganizationResponse'; -export { ProfileResponse } from './profileResponse'; -export { SyncResponse } from './syncResponse'; diff --git a/common/src/models/view/index.ts b/common/src/models/view/index.ts deleted file mode 100644 index 1bc3f9d6cb..0000000000 --- a/common/src/models/view/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -export { AttachmentView } from './attachmentView'; -export { CardView } from './cardView'; -export { CipherView } from './cipherView'; -export { FieldView } from './fieldView'; -export { IdentityView } from './identityView'; -export { LoginUriView } from './loginUriView'; -export { LoginView } from './loginView'; -export { SecureNoteView } from './secureNoteView'; -export { View } from './view'; diff --git a/common/src/services/api.service.ts b/common/src/services/api.service.ts index 06af9904ff..3b0846e713 100644 --- a/common/src/services/api.service.ts +++ b/common/src/services/api.service.ts @@ -2,6 +2,7 @@ import { DeviceType } from '../enums/deviceType'; import { PolicyType } from '../enums/policyType'; import { ApiService as ApiServiceAbstraction } from '../abstractions/api.service'; +import { EnvironmentService } from '../abstractions/environment.service'; import { PlatformUtilsService } from '../abstractions/platformUtils.service'; import { TokenService } from '../abstractions/token.service'; @@ -161,7 +162,6 @@ import { ChallengeResponse } from '../models/response/twoFactorWebAuthnResponse' import { TwoFactorYubiKeyResponse } from '../models/response/twoFactorYubiKeyResponse'; import { UserKeyResponse } from '../models/response/userKeyResponse'; -import { EnvironmentService } from '../abstractions'; import { IdentityCaptchaResponse } from '../models/response/identityCaptchaResponse'; import { SendAccessView } from '../models/view/sendAccessView'; diff --git a/common/src/services/index.ts b/common/src/services/index.ts deleted file mode 100644 index dc710996fc..0000000000 --- a/common/src/services/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -export { ApiService } from './api.service'; -export { AppIdService } from './appId.service'; -export { AuditService } from './audit.service'; -export { AuthService } from './auth.service'; -export { CipherService } from './cipher.service'; -export { CollectionService } from './collection.service'; -export { ConstantsService } from './constants.service'; -export { ContainerService } from './container.service'; -export { CryptoService } from './crypto.service'; -export { EnvironmentService } from './environment.service'; -export { FolderService } from './folder.service'; -export { I18nService } from './i18n.service'; -export { PasswordGenerationService } from './passwordGeneration.service'; -export { SettingsService } from './settings.service'; -export { StateService } from './state.service'; -export { SyncService } from './sync.service'; -export { TokenService } from './token.service'; -export { TotpService } from './totp.service'; -export { UserService } from './user.service'; -export { VaultTimeoutService } from './vaultTimeout.service'; diff --git a/spec/common/importers/lastpassCsvImporter.spec.ts b/spec/common/importers/lastpassCsvImporter.spec.ts index 904d70e6c7..f42ea6767c 100644 --- a/spec/common/importers/lastpassCsvImporter.spec.ts +++ b/spec/common/importers/lastpassCsvImporter.spec.ts @@ -4,7 +4,8 @@ import { ImportResult } from 'jslib-common/models/domain/importResult'; import { CipherView } from 'jslib-common/models/view/cipherView'; import { FieldView } from 'jslib-common/models/view/fieldView'; -import { CipherType, FieldType } from 'jslib-common/enums'; +import { CipherType } from 'jslib-common/enums/cipherType'; +import { FieldType } from 'jslib-common/enums/fieldType'; function baseExcept(result: ImportResult) { expect(result).not.toBeNull(); diff --git a/spec/common/importers/nordpassCsvImporter.spec.ts b/spec/common/importers/nordpassCsvImporter.spec.ts index a46f9c773d..4e8cfcbfab 100644 --- a/spec/common/importers/nordpassCsvImporter.spec.ts +++ b/spec/common/importers/nordpassCsvImporter.spec.ts @@ -1,7 +1,9 @@ import { NordPassCsvImporter as Importer } from 'jslib-common/importers/nordpassCsvImporter'; -import { CipherType, SecureNoteType } from 'jslib-common/enums'; -import { CipherView, IdentityView } from 'jslib-common/models/view'; +import { CipherType } from 'jslib-common/enums/cipherType'; +import { SecureNoteType } from 'jslib-common/enums/secureNoteType'; +import { CipherView } from 'jslib-common/models/view/cipherView'; +import { IdentityView } from 'jslib-common/models/view/identityView'; import { data as creditCardData } from './testData/nordpassCsv/nordpass.card.csv'; import { data as identityData } from './testData/nordpassCsv/nordpass.identity.csv'; diff --git a/spec/common/importers/onepasswordMacCsvImporter.spec.ts b/spec/common/importers/onepasswordMacCsvImporter.spec.ts index 679c4bcbeb..47326db6a2 100644 --- a/spec/common/importers/onepasswordMacCsvImporter.spec.ts +++ b/spec/common/importers/onepasswordMacCsvImporter.spec.ts @@ -1,6 +1,6 @@ import { OnePasswordMacCsvImporter as Importer } from 'jslib-common/importers/onepasswordImporters/onepasswordMacCsvImporter'; -import { CipherType } from 'jslib-common/enums'; +import { CipherType } from 'jslib-common/enums/cipherType'; import { CipherView } from 'jslib-common/models/view/cipherView'; import { data as creditCardData } from './testData/onePasswordCsv/creditCard.mac.csv'; diff --git a/spec/common/importers/onepasswordWinCsvImporter.spec.ts b/spec/common/importers/onepasswordWinCsvImporter.spec.ts index 628f25235d..3b11d15a42 100644 --- a/spec/common/importers/onepasswordWinCsvImporter.spec.ts +++ b/spec/common/importers/onepasswordWinCsvImporter.spec.ts @@ -1,6 +1,7 @@ import { OnePasswordWinCsvImporter as Importer } from 'jslib-common/importers/onepasswordImporters/onepasswordWinCsvImporter'; -import { CipherType, FieldType } from 'jslib-common/enums'; +import { CipherType } from 'jslib-common/enums/cipherType'; +import { FieldType } from 'jslib-common/enums/fieldType'; import { CipherView } from 'jslib-common/models/view/cipherView'; import { FieldView } from 'jslib-common/models/view/fieldView'; diff --git a/spec/web/services/webCryptoFunction.service.spec.ts b/spec/web/services/webCryptoFunction.service.spec.ts index 3c2638696d..28d1082ebd 100644 --- a/spec/web/services/webCryptoFunction.service.spec.ts +++ b/spec/web/services/webCryptoFunction.service.spec.ts @@ -5,7 +5,7 @@ import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.se import { WebCryptoFunctionService } from 'jslib-common/services/webCryptoFunction.service'; import { Utils } from 'jslib-common/misc/utils'; -import { SymmetricCryptoKey } from 'jslib-common/models/domain'; +import { SymmetricCryptoKey } from 'jslib-common/models/domain/symmetricCryptoKey'; const RsaPublicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl0Vawl/toXzkEvB82FEtqHP' + '4xlU2ab/v0crqIfXfIoWF/XXdHGIdrZeilnRXPPJT1B9dTsasttEZNnua/0Rek/cjNDHtzT52irfoZYS7X6HNIfOi54Q+egP' +