From c5449e6432f60f46f29dec4e5153ec3df5cfd358 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Tue, 16 Jun 2026 09:55:07 +0200 Subject: [PATCH] [PM-39048] Feat: scaffold @bitwarden/pam library (#21259) Add a new libs/pam feature library for Privileged Access Management, generated via the basic-lib Nx generator. - Register the "pam" team in the basic-lib generator (schema enum, interactive prompt, and the @bitwarden/team-pam-dev CODEOWNERS handle) - Generate libs/pam with standard structure and a placeholder spec - Wire up tsconfig.base.json path, CODEOWNERS, and root jest.config.js --- .github/CODEOWNERS | 4 ++++ jest.config.js | 1 + libs/pam/README.md | 5 +++++ libs/pam/eslint.config.mjs | 3 +++ libs/pam/jest.config.js | 10 ++++++++++ libs/pam/package.json | 11 +++++++++++ libs/pam/project.json | 34 ++++++++++++++++++++++++++++++++++ libs/pam/src/index.ts | 0 libs/pam/src/pam.spec.ts | 7 +++++++ libs/pam/tsconfig.eslint.json | 6 ++++++ libs/pam/tsconfig.json | 13 +++++++++++++ libs/pam/tsconfig.lib.json | 10 ++++++++++ libs/pam/tsconfig.spec.json | 10 ++++++++++ package-lock.json | 9 +++++++++ tsconfig.base.json | 3 ++- 15 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 libs/pam/README.md create mode 100644 libs/pam/eslint.config.mjs create mode 100644 libs/pam/jest.config.js create mode 100644 libs/pam/package.json create mode 100644 libs/pam/project.json create mode 100644 libs/pam/src/index.ts create mode 100644 libs/pam/src/pam.spec.ts create mode 100644 libs/pam/tsconfig.eslint.json create mode 100644 libs/pam/tsconfig.json create mode 100644 libs/pam/tsconfig.lib.json create mode 100644 libs/pam/tsconfig.spec.json diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 49ebe2959df..179dacf5a72 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -235,6 +235,10 @@ apps/desktop/src/services/native-messaging.service.ts @bitwarden/team-key-manage apps/browser/src/background/nativeMessaging.background.ts @bitwarden/team-key-management-dev apps/desktop/src/services/biometric-message-handler.service.ts @bitwarden/team-key-management-dev +## PAM +apps/web/src/app/pam @bitwarden/team-pam-dev +libs/pam @bitwarden/team-pam-dev + ## Locales ## apps/browser/src/_locales/en/messages.json apps/browser/store/locales/en diff --git a/jest.config.js b/jest.config.js index fcc5b6eaf6a..5b2696127fa 100644 --- a/jest.config.js +++ b/jest.config.js @@ -66,6 +66,7 @@ module.exports = { "/libs/user-crypto-management/jest.config.js", "/libs/scheduling/jest.config.js", "/libs/organization-invite-link/jest.config.js", + "/libs/pam/jest.config.js", ], // Workaround for a memory leak that crashes tests in CI: diff --git a/libs/pam/README.md b/libs/pam/README.md new file mode 100644 index 00000000000..e60598cd066 --- /dev/null +++ b/libs/pam/README.md @@ -0,0 +1,5 @@ +# pam + +Owned by: pam + +Privileged Access Management (PAM) feature library diff --git a/libs/pam/eslint.config.mjs b/libs/pam/eslint.config.mjs new file mode 100644 index 00000000000..9c37d10e3ff --- /dev/null +++ b/libs/pam/eslint.config.mjs @@ -0,0 +1,3 @@ +import baseConfig from "../../eslint.config.mjs"; + +export default [...baseConfig]; diff --git a/libs/pam/jest.config.js b/libs/pam/jest.config.js new file mode 100644 index 00000000000..933dc487442 --- /dev/null +++ b/libs/pam/jest.config.js @@ -0,0 +1,10 @@ +module.exports = { + displayName: "pam", + preset: "../../jest.preset.js", + testEnvironment: "node", + transform: { + "^.+\\.[tj]s$": ["ts-jest", { tsconfig: "/tsconfig.spec.json" }], + }, + moduleFileExtensions: ["ts", "js", "html"], + coverageDirectory: "../../coverage/libs/pam", +}; diff --git a/libs/pam/package.json b/libs/pam/package.json new file mode 100644 index 00000000000..110041f4764 --- /dev/null +++ b/libs/pam/package.json @@ -0,0 +1,11 @@ +{ + "name": "@bitwarden/pam", + "version": "0.0.1", + "description": "Privileged Access Management (PAM) feature library", + "private": true, + "type": "commonjs", + "main": "index.js", + "types": "index.d.ts", + "license": "GPL-3.0", + "author": "pam" +} diff --git a/libs/pam/project.json b/libs/pam/project.json new file mode 100644 index 00000000000..82fc88d3d1e --- /dev/null +++ b/libs/pam/project.json @@ -0,0 +1,34 @@ +{ + "name": "pam", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/pam/src", + "projectType": "library", + "tags": [], + "targets": { + "build": { + "executor": "@nx/js:tsc", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/libs/pam", + "main": "libs/pam/src/index.ts", + "tsConfig": "libs/pam/tsconfig.lib.json", + "assets": ["libs/pam/*.md"], + "rootDir": "libs/pam/src" + } + }, + "lint": { + "executor": "@nx/eslint:lint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["libs/pam/**/*.ts"] + } + }, + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "libs/pam/jest.config.js" + } + } + } +} diff --git a/libs/pam/src/index.ts b/libs/pam/src/index.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libs/pam/src/pam.spec.ts b/libs/pam/src/pam.spec.ts new file mode 100644 index 00000000000..60e31f2d2c6 --- /dev/null +++ b/libs/pam/src/pam.spec.ts @@ -0,0 +1,7 @@ +describe("pam", () => { + // Placeholder test until the library exports something. Replace with real + // coverage as the PAM library grows. + it("should work", () => { + expect(true).toBe(true); + }); +}); diff --git a/libs/pam/tsconfig.eslint.json b/libs/pam/tsconfig.eslint.json new file mode 100644 index 00000000000..3daf120441a --- /dev/null +++ b/libs/pam/tsconfig.eslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": ["src/**/*.ts", "src/**/*.js"], + "exclude": ["**/build", "**/dist"] +} diff --git a/libs/pam/tsconfig.json b/libs/pam/tsconfig.json new file mode 100644 index 00000000000..62ebbd94647 --- /dev/null +++ b/libs/pam/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/libs/pam/tsconfig.lib.json b/libs/pam/tsconfig.lib.json new file mode 100644 index 00000000000..9cbf6736007 --- /dev/null +++ b/libs/pam/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "include": ["src/**/*.ts"], + "exclude": ["jest.config.js", "src/**/*.spec.ts"] +} diff --git a/libs/pam/tsconfig.spec.json b/libs/pam/tsconfig.spec.json new file mode 100644 index 00000000000..1275f148a18 --- /dev/null +++ b/libs/pam/tsconfig.spec.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "moduleResolution": "node10", + "types": ["jest", "node"] + }, + "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] +} diff --git a/package-lock.json b/package-lock.json index 2e8fc7bea97..27c802f9013 100644 --- a/package-lock.json +++ b/package-lock.json @@ -363,6 +363,11 @@ "version": "0.0.1", "license": "GPL-3.0" }, + "libs/pam": { + "name": "@bitwarden/pam", + "version": "0.0.1", + "license": "GPL-3.0" + }, "libs/platform": { "name": "@bitwarden/platform", "version": "0.0.0", @@ -4174,6 +4179,10 @@ "resolved": "libs/organization-invite-link", "link": true }, + "node_modules/@bitwarden/pam": { + "resolved": "libs/pam", + "link": true + }, "node_modules/@bitwarden/platform": { "resolved": "libs/platform", "link": true diff --git a/tsconfig.base.json b/tsconfig.base.json index e64bb9e1ecc..104af917c47 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -72,7 +72,8 @@ "@bitwarden/vault": ["./libs/vault/src"], "@bitwarden/vault-export-core": ["./libs/tools/export-vault-core/src"], "@bitwarden/vault-export-ui": ["./libs/tools/export-vault-ui/src"], - "@bitwarden/web-vault/*": ["./apps/web/src/*"] + "@bitwarden/web-vault/*": ["./apps/web/src/*"], + "@bitwarden/pam": ["./libs/pam/src/index.ts"] }, "plugins": [ {