diff --git a/.eslintrc.json b/.eslintrc.json index 1a3849aee3..72b65d361d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -206,11 +206,29 @@ } }, { - "files": ["libs/tools/generator/extensions/src/**/*.ts"], + "files": ["libs/tools/generator/extensions/history/src/**/*.ts"], "rules": { "no-restricted-imports": [ "error", - { "patterns": ["@bitwarden/generator-extensions/*", "src/**/*"] } + { "patterns": ["@bitwarden/generator-history/*", "src/**/*"] } + ] + } + }, + { + "files": ["libs/tools/generator/extensions/legacy/src/**/*.ts"], + "rules": { + "no-restricted-imports": [ + "error", + { "patterns": ["@bitwarden/generator-legacy/*", "src/**/*"] } + ] + } + }, + { + "files": ["libs/tools/generator/extensions/navigation/src/**/*.ts"], + "rules": { + "no-restricted-imports": [ + "error", + { "patterns": ["@bitwarden/generator-navigation/*", "src/**/*"] } ] } }, diff --git a/apps/browser/tsconfig.json b/apps/browser/tsconfig.json index 39f9c8211c..beb4a73212 100644 --- a/apps/browser/tsconfig.json +++ b/apps/browser/tsconfig.json @@ -21,7 +21,9 @@ "@bitwarden/components": ["../../libs/components/src"], "@bitwarden/generator-components": ["../../libs/tools/generator/components/src"], "@bitwarden/generator-core": ["../../libs/tools/generator/core/src"], - "@bitwarden/generator-extensions": ["../../libs/tools/generator/extensions/src"], + "@bitwarden/generator-history": ["../../libs/tools/generator/extensions/history/src"], + "@bitwarden/generator-legacy": ["../../libs/tools/generator/extensions/legacy/src"], + "@bitwarden/generator-navigation": ["../../libs/tools/generator/extensions/navigation/src"], "@bitwarden/vault-export-core": [ "../../libs/tools/export/vault-export/vault-export-core/src" ], diff --git a/apps/desktop/tsconfig.json b/apps/desktop/tsconfig.json index ad8112db48..5ffdb3c207 100644 --- a/apps/desktop/tsconfig.json +++ b/apps/desktop/tsconfig.json @@ -19,7 +19,9 @@ "@bitwarden/components": ["../../libs/components/src"], "@bitwarden/generator-components": ["../../libs/tools/generator/components/src"], "@bitwarden/generator-core": ["../../libs/tools/generator/core/src"], - "@bitwarden/generator-extensions": ["../../libs/tools/generator/extensions/src"], + "@bitwarden/generator-history": ["../../libs/tools/generator/extensions/history/src"], + "@bitwarden/generator-legacy": ["../../libs/tools/generator/extensions/legacy/src"], + "@bitwarden/generator-navigation": ["../../libs/tools/generator/extensions/navigation/src"], "@bitwarden/vault-export-core": [ "../../libs/tools/export/vault-export/vault-export-core/src" ], diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json index cd3e969e2d..f44b67d926 100644 --- a/apps/web/tsconfig.json +++ b/apps/web/tsconfig.json @@ -14,7 +14,9 @@ "@bitwarden/components": ["../../libs/components/src"], "@bitwarden/generator-components": ["../../libs/tools/generator/components/src"], "@bitwarden/generator-core": ["../../libs/tools/generator/core/src"], - "@bitwarden/generator-extensions": ["../../libs/tools/generator/extensions/src"], + "@bitwarden/generator-history": ["../../libs/tools/generator/extensions/history/src"], + "@bitwarden/generator-legacy": ["../../libs/tools/generator/extensions/legacy/src"], + "@bitwarden/generator-navigation": ["../../libs/tools/generator/extensions/navigation/src"], "@bitwarden/vault-export-core": [ "../../libs/tools/export/vault-export/vault-export-core/src" ], diff --git a/bitwarden_license/bit-common/tsconfig.json b/bitwarden_license/bit-common/tsconfig.json index 1c81cd9a1e..4b57d593b1 100644 --- a/bitwarden_license/bit-common/tsconfig.json +++ b/bitwarden_license/bit-common/tsconfig.json @@ -13,7 +13,9 @@ "@bitwarden/components": ["../../libs/components/src"], "@bitwarden/generator-components": ["../../libs/tools/generator/components/src"], "@bitwarden/generator-core": ["../../libs/tools/generator/core/src"], - "@bitwarden/generator-extensions": ["../../libs/tools/generator/extensions/src"], + "@bitwarden/generator-history": ["../../libs/tools/generator/extensions/history/src"], + "@bitwarden/generator-legacy": ["../../libs/tools/generator/extensions/legacy/src"], + "@bitwarden/generator-navigation": ["../../libs/tools/generator/extensions/navigation/src"], "@bitwarden/vault-export-core": [ "../../libs/tools/export/vault-export/vault-export-core/src" ], diff --git a/bitwarden_license/bit-web/tsconfig.json b/bitwarden_license/bit-web/tsconfig.json index 26f8e65539..8bc6ea46e4 100644 --- a/bitwarden_license/bit-web/tsconfig.json +++ b/bitwarden_license/bit-web/tsconfig.json @@ -14,7 +14,9 @@ "@bitwarden/components": ["../../libs/components/src"], "@bitwarden/generator-components": ["../../libs/tools/generator/components/src"], "@bitwarden/generator-core": ["../../libs/tools/generator/core/src"], - "@bitwarden/generator-extensions": ["../../libs/tools/generator/extensions/src"], + "@bitwarden/generator-history": ["../../libs/tools/generator/extensions/history/src"], + "@bitwarden/generator-legacy": ["../../libs/tools/generator/extensions/legacy/src"], + "@bitwarden/generator-navigation": ["../../libs/tools/generator/extensions/navigation/src"], "@bitwarden/vault-export-core": [ "../../libs/tools/export/vault-export/vault-export-core/src" ], diff --git a/jest.config.js b/jest.config.js index f4e97262a3..57f9b3c322 100644 --- a/jest.config.js +++ b/jest.config.js @@ -32,6 +32,9 @@ module.exports = { "/libs/components/jest.config.js", "/libs/tools/export/vault-export/vault-export-core/jest.config.js", "/libs/tools/generator/core/jest.config.js", + "/libs/tools/generator/extensions/history/jest.config.js", + "/libs/tools/generator/extensions/legacy/jest.config.js", + "/libs/tools/generator/extensions/navigation/jest.config.js", "/libs/importer/jest.config.js", "/libs/platform/jest.config.js", "/libs/node/jest.config.js", diff --git a/libs/shared/tsconfig.libs.json b/libs/shared/tsconfig.libs.json index 5b24a772c1..7801a8909f 100644 --- a/libs/shared/tsconfig.libs.json +++ b/libs/shared/tsconfig.libs.json @@ -12,7 +12,9 @@ "@bitwarden/components": ["../components/src"], "@bitwarden/generator-components": ["../tools/generator/components/src"], "@bitwarden/generator-core": ["../tools/generator/core/src"], - "@bitwarden/generator-extensions": ["../tools/generator/extensions/src"], + "@bitwarden/generator-history": ["../tools/generator/extensions/history/src"], + "@bitwarden/generator-legacy": ["../tools/generator/extensions/legacy/src"], + "@bitwarden/generator-navigation": ["../tools/generator/extensions/navigation/src"], "@bitwarden/vault-export-core": ["../tools/export/vault-export/vault-export-core/src"], "@bitwarden/vault-export-ui": ["../tools/export/vault-export/vault-export-ui/src"], "@bitwarden/importer/core": ["../importer/src"], diff --git a/libs/tools/generator/components/package.json b/libs/tools/generator/components/package.json index d37eefac2c..e900b317a9 100644 --- a/libs/tools/generator/components/package.json +++ b/libs/tools/generator/components/package.json @@ -1,7 +1,7 @@ { "name": "@bitwarden/generator-components", "version": "0.0.0", - "description": "Angular components for the Bitwarden generators", + "description": "Angular components for the Bitwarden credential generators", "keywords": [ "bitwarden" ], diff --git a/libs/tools/generator/core/package.json b/libs/tools/generator/core/package.json index 5484cf0968..020adab189 100644 --- a/libs/tools/generator/core/package.json +++ b/libs/tools/generator/core/package.json @@ -1,7 +1,7 @@ { "name": "@bitwarden/generator-core", "version": "0.0.0", - "description": "TODO", + "description": "Common Bitwarden credential generation logic", "keywords": [ "bitwarden" ], diff --git a/libs/tools/generator/core/src/abstractions/index.ts b/libs/tools/generator/core/src/abstractions/index.ts index ea9cc39f04..5eee745372 100644 --- a/libs/tools/generator/core/src/abstractions/index.ts +++ b/libs/tools/generator/core/src/abstractions/index.ts @@ -1,5 +1,3 @@ -export { GeneratorHistoryService } from "../../../extensions/src/history/generator-history.abstraction"; -export { GeneratorNavigationService } from "../../../extensions/src/navigation/generator-navigation.service.abstraction"; export { GeneratorService } from "./generator.service.abstraction"; export { GeneratorStrategy } from "./generator-strategy.abstraction"; export { PolicyEvaluator } from "./policy-evaluator.abstraction"; diff --git a/libs/tools/generator/extensions/jest.config.js b/libs/tools/generator/extensions/history/jest.config.js similarity index 60% rename from libs/tools/generator/extensions/jest.config.js rename to libs/tools/generator/extensions/history/jest.config.js index 71ccbc80b6..d257f3871c 100644 --- a/libs/tools/generator/extensions/jest.config.js +++ b/libs/tools/generator/extensions/history/jest.config.js @@ -1,13 +1,13 @@ const { pathsToModuleNameMapper } = require("ts-jest"); -const { compilerOptions } = require("../../../shared/tsconfig.libs"); +const { compilerOptions } = require("../../../../shared/tsconfig.libs"); /** @type {import('jest').Config} */ module.exports = { testMatch: ["**/+(*.)+(spec).+(ts)"], preset: "ts-jest", - testEnvironment: "../../../shared/test.environment.ts", + testEnvironment: "../../../../shared/test.environment.ts", moduleNameMapper: pathsToModuleNameMapper(compilerOptions?.paths || {}, { - prefix: "/../../", + prefix: "/../../../", }), }; diff --git a/libs/tools/generator/extensions/package.json b/libs/tools/generator/extensions/history/package.json similarity index 82% rename from libs/tools/generator/extensions/package.json rename to libs/tools/generator/extensions/history/package.json index 5a48f2e600..8ce2d920df 100644 --- a/libs/tools/generator/extensions/package.json +++ b/libs/tools/generator/extensions/history/package.json @@ -1,7 +1,7 @@ { - "name": "@bitwarden/generator-extensions", + "name": "@bitwarden/generator-history", "version": "0.0.0", - "description": "TODO", + "description": "Bitwarden credential generator history service", "keywords": [ "bitwarden" ], diff --git a/libs/tools/generator/extensions/src/history/generated-credential.spec.ts b/libs/tools/generator/extensions/history/src/generated-credential.spec.ts similarity index 96% rename from libs/tools/generator/extensions/src/history/generated-credential.spec.ts rename to libs/tools/generator/extensions/history/src/generated-credential.spec.ts index 170030bad1..846f2ee96b 100644 --- a/libs/tools/generator/extensions/src/history/generated-credential.spec.ts +++ b/libs/tools/generator/extensions/history/src/generated-credential.spec.ts @@ -1,4 +1,4 @@ -import { GeneratorCategory, GeneratedCredential } from "./"; +import { GeneratorCategory, GeneratedCredential } from "."; describe("GeneratedCredential", () => { describe("constructor", () => { diff --git a/libs/tools/generator/extensions/src/history/generated-credential.ts b/libs/tools/generator/extensions/history/src/generated-credential.ts similarity index 100% rename from libs/tools/generator/extensions/src/history/generated-credential.ts rename to libs/tools/generator/extensions/history/src/generated-credential.ts diff --git a/libs/tools/generator/extensions/src/history/generated-password-history.ts b/libs/tools/generator/extensions/history/src/generated-password-history.ts similarity index 100% rename from libs/tools/generator/extensions/src/history/generated-password-history.ts rename to libs/tools/generator/extensions/history/src/generated-password-history.ts diff --git a/libs/tools/generator/extensions/src/history/generator-history.abstraction.ts b/libs/tools/generator/extensions/history/src/generator-history.abstraction.ts similarity index 100% rename from libs/tools/generator/extensions/src/history/generator-history.abstraction.ts rename to libs/tools/generator/extensions/history/src/generator-history.abstraction.ts diff --git a/libs/tools/generator/extensions/src/history/index.ts b/libs/tools/generator/extensions/history/src/index.ts similarity index 100% rename from libs/tools/generator/extensions/src/history/index.ts rename to libs/tools/generator/extensions/history/src/index.ts diff --git a/libs/tools/generator/extensions/src/history/key-definition.spec.ts b/libs/tools/generator/extensions/history/src/key-definition.spec.ts similarity index 100% rename from libs/tools/generator/extensions/src/history/key-definition.spec.ts rename to libs/tools/generator/extensions/history/src/key-definition.spec.ts diff --git a/libs/tools/generator/extensions/src/history/key-definitions.ts b/libs/tools/generator/extensions/history/src/key-definitions.ts similarity index 100% rename from libs/tools/generator/extensions/src/history/key-definitions.ts rename to libs/tools/generator/extensions/history/src/key-definitions.ts diff --git a/libs/tools/generator/extensions/src/history/legacy-password-history-decryptor.ts b/libs/tools/generator/extensions/history/src/legacy-password-history-decryptor.ts similarity index 100% rename from libs/tools/generator/extensions/src/history/legacy-password-history-decryptor.ts rename to libs/tools/generator/extensions/history/src/legacy-password-history-decryptor.ts diff --git a/libs/tools/generator/extensions/src/history/local-generator-history.service.spec.ts b/libs/tools/generator/extensions/history/src/local-generator-history.service.spec.ts similarity index 100% rename from libs/tools/generator/extensions/src/history/local-generator-history.service.spec.ts rename to libs/tools/generator/extensions/history/src/local-generator-history.service.spec.ts diff --git a/libs/tools/generator/extensions/src/history/local-generator-history.service.ts b/libs/tools/generator/extensions/history/src/local-generator-history.service.ts similarity index 100% rename from libs/tools/generator/extensions/src/history/local-generator-history.service.ts rename to libs/tools/generator/extensions/history/src/local-generator-history.service.ts diff --git a/libs/tools/generator/extensions/src/history/options.ts b/libs/tools/generator/extensions/history/src/options.ts similarity index 100% rename from libs/tools/generator/extensions/src/history/options.ts rename to libs/tools/generator/extensions/history/src/options.ts diff --git a/libs/tools/generator/extensions/tsconfig.json b/libs/tools/generator/extensions/history/tsconfig.json similarity index 56% rename from libs/tools/generator/extensions/tsconfig.json rename to libs/tools/generator/extensions/history/tsconfig.json index c52bfd7b0d..5cb9026037 100644 --- a/libs/tools/generator/extensions/tsconfig.json +++ b/libs/tools/generator/extensions/history/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../shared/tsconfig.libs", + "extends": "../../../../shared/tsconfig.libs", "include": ["src"], "exclude": ["node_modules", "dist"] } diff --git a/libs/tools/generator/extensions/tsconfig.spec.json b/libs/tools/generator/extensions/history/tsconfig.spec.json similarity index 100% rename from libs/tools/generator/extensions/tsconfig.spec.json rename to libs/tools/generator/extensions/history/tsconfig.spec.json diff --git a/libs/tools/generator/extensions/legacy/jest.config.js b/libs/tools/generator/extensions/legacy/jest.config.js new file mode 100644 index 0000000000..d257f3871c --- /dev/null +++ b/libs/tools/generator/extensions/legacy/jest.config.js @@ -0,0 +1,13 @@ +const { pathsToModuleNameMapper } = require("ts-jest"); + +const { compilerOptions } = require("../../../../shared/tsconfig.libs"); + +/** @type {import('jest').Config} */ +module.exports = { + testMatch: ["**/+(*.)+(spec).+(ts)"], + preset: "ts-jest", + testEnvironment: "../../../../shared/test.environment.ts", + moduleNameMapper: pathsToModuleNameMapper(compilerOptions?.paths || {}, { + prefix: "/../../../", + }), +}; diff --git a/libs/tools/generator/extensions/legacy/package.json b/libs/tools/generator/extensions/legacy/package.json new file mode 100644 index 0000000000..c97e817ce2 --- /dev/null +++ b/libs/tools/generator/extensions/legacy/package.json @@ -0,0 +1,26 @@ +{ + "name": "@bitwarden/generator-legacy", + "version": "0.0.0", + "description": "Deprecated Bitwarden credential generation services", + "keywords": [ + "bitwarden" + ], + "author": "Bitwarden Inc.", + "homepage": "https://bitwarden.com", + "repository": { + "type": "git", + "url": "https://github.com/bitwarden/clients" + }, + "license": "GPL-3.0", + "scripts": { + "clean": "rimraf dist", + "build": "npm run clean && tsc", + "build:watch": "npm run clean && tsc -watch" + }, + "dependencies": { + "@bitwarden/common": "file:../../../common", + "@bitwarden/generator-core": "file:../core", + "@bitwarden/generator-history": "file:../extensions/history", + "@bitwarden/generator-navigation": "file:../extensions/navigation" + } +} diff --git a/libs/tools/generator/extensions/src/legacy-password/create-generation-service.ts b/libs/tools/generator/extensions/legacy/src/create-legacy-password-generation-service.ts similarity index 92% rename from libs/tools/generator/extensions/src/legacy-password/create-generation-service.ts rename to libs/tools/generator/extensions/legacy/src/create-legacy-password-generation-service.ts index 578a8a40bb..192b566441 100644 --- a/libs/tools/generator/extensions/src/legacy-password/create-generation-service.ts +++ b/libs/tools/generator/extensions/legacy/src/create-legacy-password-generation-service.ts @@ -4,9 +4,8 @@ import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.se import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service"; import { StateProvider } from "@bitwarden/common/platform/state"; import { engine, services, strategies } from "@bitwarden/generator-core"; - -import { LocalGeneratorHistoryService } from "../history"; -import { DefaultGeneratorNavigationService } from "../navigation"; +import { LocalGeneratorHistoryService } from "@bitwarden/generator-history"; +import { DefaultGeneratorNavigationService } from "@bitwarden/generator-navigation"; import { LegacyPasswordGenerationService } from "./legacy-password-generation.service"; import { PasswordGenerationServiceAbstraction } from "./password-generation.service.abstraction"; diff --git a/libs/tools/generator/extensions/src/legacy-username/create-generation-service.ts b/libs/tools/generator/extensions/legacy/src/create-legacy-username-generation-service.ts similarity index 97% rename from libs/tools/generator/extensions/src/legacy-username/create-generation-service.ts rename to libs/tools/generator/extensions/legacy/src/create-legacy-username-generation-service.ts index a73699c073..956bc39263 100644 --- a/libs/tools/generator/extensions/src/legacy-username/create-generation-service.ts +++ b/libs/tools/generator/extensions/legacy/src/create-legacy-username-generation-service.ts @@ -6,8 +6,7 @@ import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt. import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { StateProvider } from "@bitwarden/common/platform/state"; import { engine, services, strategies } from "@bitwarden/generator-core"; - -import { DefaultGeneratorNavigationService } from "../navigation"; +import { DefaultGeneratorNavigationService } from "@bitwarden/generator-navigation"; import { LegacyUsernameGenerationService } from "./legacy-username-generation.service"; import { UsernameGenerationServiceAbstraction } from "./username-generation.service.abstraction"; diff --git a/libs/tools/generator/extensions/legacy/src/index.ts b/libs/tools/generator/extensions/legacy/src/index.ts new file mode 100644 index 0000000000..db6c65f594 --- /dev/null +++ b/libs/tools/generator/extensions/legacy/src/index.ts @@ -0,0 +1,6 @@ +export * from "./password-generation.service.abstraction"; +export * from "./create-legacy-password-generation-service"; +export * from "./password-generator-options"; +export * from "./username-generation.service.abstraction"; +export * from "./create-legacy-username-generation-service"; +export * from "./username-generation-options"; diff --git a/libs/tools/generator/extensions/src/legacy-password/legacy-password-generation.service.spec.ts b/libs/tools/generator/extensions/legacy/src/legacy-password-generation.service.spec.ts similarity index 98% rename from libs/tools/generator/extensions/src/legacy-password/legacy-password-generation.service.spec.ts rename to libs/tools/generator/extensions/legacy/src/legacy-password-generation.service.spec.ts index ff70e8b295..b536666da5 100644 --- a/libs/tools/generator/extensions/src/legacy-password/legacy-password-generation.service.spec.ts +++ b/libs/tools/generator/extensions/legacy/src/legacy-password-generation.service.spec.ts @@ -14,16 +14,20 @@ import { PasswordGeneratorPolicy, policies, } from "@bitwarden/generator-core"; - -import { mockAccountServiceWith } from "../../../../../common/spec"; -import { GeneratedCredential, GeneratorHistoryService, GeneratedPasswordHistory } from "../history"; +import { + GeneratedCredential, + GeneratorHistoryService, + GeneratedPasswordHistory, +} from "@bitwarden/generator-history"; import { GeneratorNavigationService, DefaultGeneratorNavigation, GeneratorNavigation, GeneratorNavigationEvaluator, GeneratorNavigationPolicy, -} from "../navigation"; +} from "@bitwarden/generator-navigation"; + +import { mockAccountServiceWith } from "../../../../../common/spec"; import { LegacyPasswordGenerationService } from "./legacy-password-generation.service"; import { PasswordGeneratorOptions } from "./password-generator-options"; diff --git a/libs/tools/generator/extensions/src/legacy-password/legacy-password-generation.service.ts b/libs/tools/generator/extensions/legacy/src/legacy-password-generation.service.ts similarity index 98% rename from libs/tools/generator/extensions/src/legacy-password/legacy-password-generation.service.ts rename to libs/tools/generator/extensions/legacy/src/legacy-password-generation.service.ts index e0261584f5..e9bc3bbf2b 100644 --- a/libs/tools/generator/extensions/src/legacy-password/legacy-password-generation.service.ts +++ b/libs/tools/generator/extensions/legacy/src/legacy-password-generation.service.ts @@ -22,13 +22,16 @@ import { PasswordGeneratorPolicy, PolicyEvaluator, } from "@bitwarden/generator-core"; - -import { GeneratedCredential, GeneratorHistoryService, GeneratedPasswordHistory } from "../history"; +import { + GeneratedCredential, + GeneratorHistoryService, + GeneratedPasswordHistory, +} from "@bitwarden/generator-history"; import { GeneratorNavigationService, GeneratorNavigation, GeneratorNavigationPolicy, -} from "../navigation"; +} from "@bitwarden/generator-navigation"; import { PasswordGenerationServiceAbstraction } from "./password-generation.service.abstraction"; import { PasswordGeneratorOptions } from "./password-generator-options"; diff --git a/libs/tools/generator/extensions/src/legacy-username/legacy-username-generation.service.spec.ts b/libs/tools/generator/extensions/legacy/src/legacy-username-generation.service.spec.ts similarity index 99% rename from libs/tools/generator/extensions/src/legacy-username/legacy-username-generation.service.spec.ts rename to libs/tools/generator/extensions/legacy/src/legacy-username-generation.service.spec.ts index 6b66c1d880..1391381bd0 100644 --- a/libs/tools/generator/extensions/src/legacy-username/legacy-username-generation.service.spec.ts +++ b/libs/tools/generator/extensions/legacy/src/legacy-username-generation.service.spec.ts @@ -24,15 +24,15 @@ import { SubaddressGenerationOptions, policies, } from "@bitwarden/generator-core"; - -import { mockAccountServiceWith } from "../../../../../common/spec"; import { GeneratorNavigationPolicy, GeneratorNavigationEvaluator, DefaultGeneratorNavigation, GeneratorNavigation, GeneratorNavigationService, -} from "../navigation"; +} from "@bitwarden/generator-navigation"; + +import { mockAccountServiceWith } from "../../../../../common/spec"; import { LegacyUsernameGenerationService } from "./legacy-username-generation.service"; import { UsernameGeneratorOptions } from "./username-generation-options"; diff --git a/libs/tools/generator/extensions/src/legacy-username/legacy-username-generation.service.ts b/libs/tools/generator/extensions/legacy/src/legacy-username-generation.service.ts similarity index 99% rename from libs/tools/generator/extensions/src/legacy-username/legacy-username-generation.service.ts rename to libs/tools/generator/extensions/legacy/src/legacy-username-generation.service.ts index 5184366328..fa1dbf9495 100644 --- a/libs/tools/generator/extensions/src/legacy-username/legacy-username-generation.service.ts +++ b/libs/tools/generator/extensions/legacy/src/legacy-username-generation.service.ts @@ -14,8 +14,7 @@ import { Forwarders, SubaddressGenerationOptions, } from "@bitwarden/generator-core"; - -import { GeneratorNavigationService, GeneratorNavigation } from "../navigation"; +import { GeneratorNavigationService, GeneratorNavigation } from "@bitwarden/generator-navigation"; import { UsernameGeneratorOptions } from "./username-generation-options"; import { UsernameGenerationServiceAbstraction } from "./username-generation.service.abstraction"; diff --git a/libs/tools/generator/extensions/src/legacy-password/password-generation.service.abstraction.ts b/libs/tools/generator/extensions/legacy/src/password-generation.service.abstraction.ts similarity index 94% rename from libs/tools/generator/extensions/src/legacy-password/password-generation.service.abstraction.ts rename to libs/tools/generator/extensions/legacy/src/password-generation.service.abstraction.ts index 3bc1582824..7823fdd4d4 100644 --- a/libs/tools/generator/extensions/src/legacy-password/password-generation.service.abstraction.ts +++ b/libs/tools/generator/extensions/legacy/src/password-generation.service.abstraction.ts @@ -1,8 +1,7 @@ import { Observable } from "rxjs"; import { PasswordGeneratorPolicyOptions } from "@bitwarden/common/admin-console/models/domain/password-generator-policy-options"; - -import { GeneratedPasswordHistory } from "../history"; +import { GeneratedPasswordHistory } from "@bitwarden/generator-history"; import { PasswordGeneratorOptions } from "./password-generator-options"; diff --git a/libs/tools/generator/extensions/src/legacy-password/password-generator-options.ts b/libs/tools/generator/extensions/legacy/src/password-generator-options.ts similarity index 84% rename from libs/tools/generator/extensions/src/legacy-password/password-generator-options.ts rename to libs/tools/generator/extensions/legacy/src/password-generator-options.ts index 762a1ce3ae..6a10a40ff1 100644 --- a/libs/tools/generator/extensions/src/legacy-password/password-generator-options.ts +++ b/libs/tools/generator/extensions/legacy/src/password-generator-options.ts @@ -1,6 +1,5 @@ import { PassphraseGenerationOptions, PasswordGenerationOptions } from "@bitwarden/generator-core"; - -import { GeneratorNavigation } from "../navigation"; +import { GeneratorNavigation } from "@bitwarden/generator-navigation"; /** Request format for credential generation. * This type includes all properties suitable for reactive data binding. diff --git a/libs/tools/generator/extensions/src/legacy-username/username-generation-options.ts b/libs/tools/generator/extensions/legacy/src/username-generation-options.ts similarity index 100% rename from libs/tools/generator/extensions/src/legacy-username/username-generation-options.ts rename to libs/tools/generator/extensions/legacy/src/username-generation-options.ts diff --git a/libs/tools/generator/extensions/src/legacy-username/username-generation.service.abstraction.ts b/libs/tools/generator/extensions/legacy/src/username-generation.service.abstraction.ts similarity index 100% rename from libs/tools/generator/extensions/src/legacy-username/username-generation.service.abstraction.ts rename to libs/tools/generator/extensions/legacy/src/username-generation.service.abstraction.ts diff --git a/libs/tools/generator/extensions/legacy/tsconfig.json b/libs/tools/generator/extensions/legacy/tsconfig.json new file mode 100644 index 0000000000..5cb9026037 --- /dev/null +++ b/libs/tools/generator/extensions/legacy/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "../../../../shared/tsconfig.libs", + "include": ["src"], + "exclude": ["node_modules", "dist"] +} diff --git a/libs/tools/generator/extensions/legacy/tsconfig.spec.json b/libs/tools/generator/extensions/legacy/tsconfig.spec.json new file mode 100644 index 0000000000..fc8520e737 --- /dev/null +++ b/libs/tools/generator/extensions/legacy/tsconfig.spec.json @@ -0,0 +1,3 @@ +{ + "extends": "./tsconfig.json" +} diff --git a/libs/tools/generator/extensions/navigation/jest.config.js b/libs/tools/generator/extensions/navigation/jest.config.js new file mode 100644 index 0000000000..d257f3871c --- /dev/null +++ b/libs/tools/generator/extensions/navigation/jest.config.js @@ -0,0 +1,13 @@ +const { pathsToModuleNameMapper } = require("ts-jest"); + +const { compilerOptions } = require("../../../../shared/tsconfig.libs"); + +/** @type {import('jest').Config} */ +module.exports = { + testMatch: ["**/+(*.)+(spec).+(ts)"], + preset: "ts-jest", + testEnvironment: "../../../../shared/test.environment.ts", + moduleNameMapper: pathsToModuleNameMapper(compilerOptions?.paths || {}, { + prefix: "/../../../", + }), +}; diff --git a/libs/tools/generator/extensions/navigation/package.json b/libs/tools/generator/extensions/navigation/package.json new file mode 100644 index 0000000000..ba66ce3a79 --- /dev/null +++ b/libs/tools/generator/extensions/navigation/package.json @@ -0,0 +1,24 @@ +{ + "name": "@bitwarden/generator-navigation", + "version": "0.0.0", + "description": "Bitwarden credential generator selection settings service", + "keywords": [ + "bitwarden" + ], + "author": "Bitwarden Inc.", + "homepage": "https://bitwarden.com", + "repository": { + "type": "git", + "url": "https://github.com/bitwarden/clients" + }, + "license": "GPL-3.0", + "scripts": { + "clean": "rimraf dist", + "build": "npm run clean && tsc", + "build:watch": "npm run clean && tsc -watch" + }, + "dependencies": { + "@bitwarden/common": "file:../../../common", + "@bitwarden/generator-core": "file:../core" + } +} diff --git a/libs/tools/generator/extensions/src/navigation/default-generator-navigation.service.spec.ts b/libs/tools/generator/extensions/navigation/src/default-generator-navigation.service.spec.ts similarity index 99% rename from libs/tools/generator/extensions/src/navigation/default-generator-navigation.service.spec.ts rename to libs/tools/generator/extensions/navigation/src/default-generator-navigation.service.spec.ts index f531783810..d1aa5a98a8 100644 --- a/libs/tools/generator/extensions/src/navigation/default-generator-navigation.service.spec.ts +++ b/libs/tools/generator/extensions/navigation/src/default-generator-navigation.service.spec.ts @@ -16,7 +16,7 @@ import { GeneratorNavigationEvaluator, DefaultGeneratorNavigationService, DefaultGeneratorNavigation, -} from "./"; +} from "."; const SomeUser = "some user" as UserId; diff --git a/libs/tools/generator/extensions/src/navigation/default-generator-navigation.service.ts b/libs/tools/generator/extensions/navigation/src/default-generator-navigation.service.ts similarity index 100% rename from libs/tools/generator/extensions/src/navigation/default-generator-navigation.service.ts rename to libs/tools/generator/extensions/navigation/src/default-generator-navigation.service.ts diff --git a/libs/tools/generator/extensions/src/navigation/default-generator-navigation.ts b/libs/tools/generator/extensions/navigation/src/default-generator-navigation.ts similarity index 100% rename from libs/tools/generator/extensions/src/navigation/default-generator-navigation.ts rename to libs/tools/generator/extensions/navigation/src/default-generator-navigation.ts diff --git a/libs/tools/generator/extensions/src/navigation/generator-navigation-evaluator.spec.ts b/libs/tools/generator/extensions/navigation/src/generator-navigation-evaluator.spec.ts similarity index 100% rename from libs/tools/generator/extensions/src/navigation/generator-navigation-evaluator.spec.ts rename to libs/tools/generator/extensions/navigation/src/generator-navigation-evaluator.spec.ts diff --git a/libs/tools/generator/extensions/src/navigation/generator-navigation-evaluator.ts b/libs/tools/generator/extensions/navigation/src/generator-navigation-evaluator.ts similarity index 100% rename from libs/tools/generator/extensions/src/navigation/generator-navigation-evaluator.ts rename to libs/tools/generator/extensions/navigation/src/generator-navigation-evaluator.ts diff --git a/libs/tools/generator/extensions/src/navigation/generator-navigation-policy.spec.ts b/libs/tools/generator/extensions/navigation/src/generator-navigation-policy.spec.ts similarity index 100% rename from libs/tools/generator/extensions/src/navigation/generator-navigation-policy.spec.ts rename to libs/tools/generator/extensions/navigation/src/generator-navigation-policy.spec.ts diff --git a/libs/tools/generator/extensions/src/navigation/generator-navigation-policy.ts b/libs/tools/generator/extensions/navigation/src/generator-navigation-policy.ts similarity index 100% rename from libs/tools/generator/extensions/src/navigation/generator-navigation-policy.ts rename to libs/tools/generator/extensions/navigation/src/generator-navigation-policy.ts diff --git a/libs/tools/generator/extensions/src/navigation/generator-navigation.service.abstraction.ts b/libs/tools/generator/extensions/navigation/src/generator-navigation.service.abstraction.ts similarity index 100% rename from libs/tools/generator/extensions/src/navigation/generator-navigation.service.abstraction.ts rename to libs/tools/generator/extensions/navigation/src/generator-navigation.service.abstraction.ts diff --git a/libs/tools/generator/extensions/src/navigation/generator-navigation.ts b/libs/tools/generator/extensions/navigation/src/generator-navigation.ts similarity index 100% rename from libs/tools/generator/extensions/src/navigation/generator-navigation.ts rename to libs/tools/generator/extensions/navigation/src/generator-navigation.ts diff --git a/libs/tools/generator/extensions/src/navigation/index.ts b/libs/tools/generator/extensions/navigation/src/index.ts similarity index 100% rename from libs/tools/generator/extensions/src/navigation/index.ts rename to libs/tools/generator/extensions/navigation/src/index.ts diff --git a/libs/tools/generator/extensions/src/navigation/key-definition.spec.ts b/libs/tools/generator/extensions/navigation/src/key-definition.spec.ts similarity index 100% rename from libs/tools/generator/extensions/src/navigation/key-definition.spec.ts rename to libs/tools/generator/extensions/navigation/src/key-definition.spec.ts diff --git a/libs/tools/generator/extensions/src/navigation/key-definitions.ts b/libs/tools/generator/extensions/navigation/src/key-definitions.ts similarity index 100% rename from libs/tools/generator/extensions/src/navigation/key-definitions.ts rename to libs/tools/generator/extensions/navigation/src/key-definitions.ts diff --git a/libs/tools/generator/extensions/navigation/tsconfig.json b/libs/tools/generator/extensions/navigation/tsconfig.json new file mode 100644 index 0000000000..5cb9026037 --- /dev/null +++ b/libs/tools/generator/extensions/navigation/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "../../../../shared/tsconfig.libs", + "include": ["src"], + "exclude": ["node_modules", "dist"] +} diff --git a/libs/tools/generator/extensions/navigation/tsconfig.spec.json b/libs/tools/generator/extensions/navigation/tsconfig.spec.json new file mode 100644 index 0000000000..fc8520e737 --- /dev/null +++ b/libs/tools/generator/extensions/navigation/tsconfig.spec.json @@ -0,0 +1,3 @@ +{ + "extends": "./tsconfig.json" +} diff --git a/libs/tools/generator/extensions/src/index.ts b/libs/tools/generator/extensions/src/index.ts deleted file mode 100644 index 53f7232644..0000000000 --- a/libs/tools/generator/extensions/src/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -export * as history from "./history"; -export * as legacyPassword from "./legacy-password"; -export * as legacyUsername from "./legacy-username"; -export * as navigation from "./navigation"; - -export { GeneratorHistoryService } from "./history"; -export { GeneratorNavigationService } from "./navigation"; -export { PasswordGenerationServiceAbstraction } from "./legacy-password"; -export { UsernameGenerationServiceAbstraction } from "./legacy-username"; diff --git a/libs/tools/generator/extensions/src/legacy-password/index.ts b/libs/tools/generator/extensions/src/legacy-password/index.ts deleted file mode 100644 index 55f5989e48..0000000000 --- a/libs/tools/generator/extensions/src/legacy-password/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./password-generation.service.abstraction"; -export * from "./create-generation-service"; -export * from "./password-generator-options"; diff --git a/libs/tools/generator/extensions/src/legacy-username/index.ts b/libs/tools/generator/extensions/src/legacy-username/index.ts deleted file mode 100644 index eac796d643..0000000000 --- a/libs/tools/generator/extensions/src/legacy-username/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./username-generation.service.abstraction"; -export * from "./create-generation-service"; -export * from "./username-generation-options"; diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index a2c932672b..23696d3594 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -23,7 +23,9 @@ "@bitwarden/components": ["./libs/components/src"], "@bitwarden/generator-components": ["./libs/tools/generator/components/src"], "@bitwarden/generator-core": ["./libs/tools/generator/core/src"], - "@bitwarden/generator-extensions": ["./libs/tools/generator/extensions/src"], + "@bitwarden/generator-history": ["./libs/tools/generator/extensions/history/src"], + "@bitwarden/generator-legacy": ["./libs/tools/generator/extensions/legacy/src"], + "@bitwarden/generator-navigation": ["./libs/tools/generator/extensions/navigation/src"], "@bitwarden/vault-export-core": [".libs/tools/export/vault-export/vault-export-core/src"], "@bitwarden/vault-export-ui": [".libs/tools/export/vault-export/vault-export-ui/src"], "@bitwarden/importer/core": ["./libs/importer/src"], diff --git a/tsconfig.json b/tsconfig.json index 8085b9f832..89282287da 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,7 +24,9 @@ "@bitwarden/components": ["./libs/components/src"], "@bitwarden/generator-components": ["./libs/tools/generator/components/src"], "@bitwarden/generator-core": ["./libs/tools/generator/core/src"], - "@bitwarden/generator-extensions": ["./libs/tools/generator/extensions/src"], + "@bitwarden/generator-history": ["./libs/tools/generator/extensions/history/src"], + "@bitwarden/generator-legacy": ["./libs/tools/generator/extensions/legacy/src"], + "@bitwarden/generator-navigation": ["./libs/tools/generator/extensions/navigation/src"], "@bitwarden/vault-export-core": ["./libs/tools/export/vault-export/vault-export-core/src"], "@bitwarden/vault-export-ui": ["./libs/tools/export/vault-export/vault-export-ui/src"], "@bitwarden/importer/core": ["./libs/importer/src"],