1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

Update sdk-internal to 374 (fix breaking changes) (#17325)

* feat: update sdk-internal

* fix: symbol.dispose breaking change

* fix: TextEncoder/Decoder breaking change

* fix: move polyfills to a global setup script

* typo
This commit is contained in:
Andreas Coroiu
2025-11-11 15:01:03 +01:00
committed by GitHub
parent 97ce47b832
commit a66227638e
7 changed files with 27 additions and 11 deletions

View File

@@ -5,7 +5,8 @@ export interface IpcMessage {
message: SerializedOutgoingMessage;
}
export interface SerializedOutgoingMessage extends Omit<OutgoingMessage, "free" | "payload"> {
export interface SerializedOutgoingMessage
extends Omit<OutgoingMessage, typeof Symbol.dispose | "free" | "payload"> {
payload: number[];
}

View File

@@ -249,6 +249,7 @@ function createMockClient(): MockProxy<BitwardenClient> {
state: jest.fn().mockReturnValue(mock()),
load_flags: jest.fn().mockReturnValue(mock()),
free: mock(),
[Symbol.dispose]: jest.fn(),
});
return client;
}

View File

@@ -9,6 +9,8 @@ module.exports = {
// Also anecdotally improves performance when run locally
maxWorkers: 3,
setupFiles: ["<rootDir>/../../libs/shared/polyfill-node-globals.ts"],
transform: {
"^.+\\.tsx?$": [
"ts-jest",

View File

@@ -0,0 +1,11 @@
import { TextEncoder, TextDecoder } from "util";
// SDK/WASM code relies on TextEncoder/TextDecoder being available globally
// We can't use `test.environment.ts` because that breaks other tests that rely on
// the default jest jsdom environment
if (!(globalThis as any).TextEncoder) {
(globalThis as any).TextEncoder = TextEncoder;
}
if (!(globalThis as any).TextDecoder) {
(globalThis as any).TextDecoder = TextDecoder as unknown as typeof globalThis.TextDecoder;
}

View File

@@ -7,6 +7,7 @@ module.exports = {
testMatch: ["**/+(*.)+(spec).+(ts)"],
preset: "ts-jest",
testEnvironment: "jsdom",
setupFiles: ["<rootDir>/../../../../../libs/shared/polyfill-node-globals.ts"],
moduleNameMapper: pathsToModuleNameMapper(
{ "@bitwarden/common/spec": ["libs/common/spec"], ...(compilerOptions?.paths ?? {}) },
{

16
package-lock.json generated
View File

@@ -23,8 +23,8 @@
"@angular/platform-browser": "19.2.14",
"@angular/platform-browser-dynamic": "19.2.14",
"@angular/router": "19.2.14",
"@bitwarden/commercial-sdk-internal": "0.2.0-main.369",
"@bitwarden/sdk-internal": "0.2.0-main.369",
"@bitwarden/commercial-sdk-internal": "0.2.0-main.374",
"@bitwarden/sdk-internal": "0.2.0-main.374",
"@electron/fuses": "1.8.0",
"@emotion/css": "11.13.5",
"@koa/multer": "4.0.0",
@@ -4607,9 +4607,9 @@
"link": true
},
"node_modules/@bitwarden/commercial-sdk-internal": {
"version": "0.2.0-main.369",
"resolved": "https://registry.npmjs.org/@bitwarden/commercial-sdk-internal/-/commercial-sdk-internal-0.2.0-main.369.tgz",
"integrity": "sha512-O+EaPQJQah9j3yWzgw+dwFk5iOxPXdKf1FDeykbt+cxygSYbWTR60RXenG1LysknOdy8fiTfHEaPD+LP1LxrdA==",
"version": "0.2.0-main.374",
"resolved": "https://registry.npmjs.org/@bitwarden/commercial-sdk-internal/-/commercial-sdk-internal-0.2.0-main.374.tgz",
"integrity": "sha512-OYNjEv9Z9Y1vCDWtlp7m49+Fu0WxCyJt+DDupF8T73JqWIl2SdY3ugLtLnCUnqause5VY7OAfa4eOxwn2ONKZg==",
"license": "BITWARDEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT",
"dependencies": {
"type-fest": "^4.41.0"
@@ -4712,9 +4712,9 @@
"link": true
},
"node_modules/@bitwarden/sdk-internal": {
"version": "0.2.0-main.369",
"resolved": "https://registry.npmjs.org/@bitwarden/sdk-internal/-/sdk-internal-0.2.0-main.369.tgz",
"integrity": "sha512-gyp4Wd1YbkANA0/RNxHfVk+DuiJqxItzk/YUyQ2HsLeP07xOljftmA0XspLQz59ovs7e1jHMCpH1r/XcyKiQSw==",
"version": "0.2.0-main.374",
"resolved": "https://registry.npmjs.org/@bitwarden/sdk-internal/-/sdk-internal-0.2.0-main.374.tgz",
"integrity": "sha512-P9td//6M22Eg8YcVOVtcvkD9wfdbnwNe7lZ1HGn74o3CTgDtNq0mE5x00rDeNZq0ctBaUDaqw6XS0jC/tehcag==",
"license": "GPL-3.0",
"dependencies": {
"type-fest": "^4.41.0"

View File

@@ -160,8 +160,8 @@
"@angular/platform-browser": "19.2.14",
"@angular/platform-browser-dynamic": "19.2.14",
"@angular/router": "19.2.14",
"@bitwarden/sdk-internal": "0.2.0-main.369",
"@bitwarden/commercial-sdk-internal": "0.2.0-main.369",
"@bitwarden/sdk-internal": "0.2.0-main.374",
"@bitwarden/commercial-sdk-internal": "0.2.0-main.374",
"@electron/fuses": "1.8.0",
"@emotion/css": "11.13.5",
"@koa/multer": "4.0.0",