From aec712fae9e64f180b1534490611b941a52d15be Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 3 Nov 2023 09:51:40 +0000 Subject: [PATCH 1/2] chore(deps): update dependency @types/node to v16.18.60 Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5a0558cf6e..d0b66417a5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19178,11 +19178,11 @@ __metadata: linkType: hard "@types/node@npm:*, @types/node@npm:>=12.12.47, @types/node@npm:>=13.7.0, @types/node@npm:^20.1.1": - version: 20.8.6 - resolution: "@types/node@npm:20.8.6" + version: 20.8.10 + resolution: "@types/node@npm:20.8.10" dependencies: - undici-types: ~5.25.1 - checksum: ccfb7ac482c5a96edeb239893c5c099f5257fcc2ed9ae62fefdfbc782b79e16dbc2af9a85b379665237bf759904b44ca2be68e75d239e0297882aad42f61905c + undici-types: ~5.26.4 + checksum: 7c61190e43e8074a1b571e52ff14c880bc67a0447f2fe5ed0e1a023eb8a23d5f815658edb98890f7578afe0f090433c4a635c7c87311762544e20dd78723e515 languageName: node linkType: hard @@ -19201,9 +19201,9 @@ __metadata: linkType: hard "@types/node@npm:^16.11.26, @types/node@npm:^16.7.10, @types/node@npm:^16.9.2": - version: 16.18.59 - resolution: "@types/node@npm:16.18.59" - checksum: 70f28744d239c48db056ff6355d2eb99305db54d1f9377b3f4458e92ffb4da8962a0c67665452d5f430cea2286ced256dac8f769660007aedd3676cf03ff28ad + version: 16.18.60 + resolution: "@types/node@npm:16.18.60" + checksum: aa0c81c3f20e663584bf17a5968e54c419277af7982ef41f9d83edd1b7ab4c8af2583a3c8a9e1cf659c6307e6f787e1be20522855121371f5a46d1d54f8a70e3 languageName: node linkType: hard @@ -19215,9 +19215,11 @@ __metadata: linkType: hard "@types/node@npm:^18.17.8": - version: 18.18.5 - resolution: "@types/node@npm:18.18.5" - checksum: fc8c9b2bf226270cf9085a7dac76ce09dd7c3519ec9b687ee2b50385954ab3709c45ca82d002d1536e24286803cd194d7ab7008acebdcd6681b8b19d4277fa5c + version: 18.18.8 + resolution: "@types/node@npm:18.18.8" + dependencies: + undici-types: ~5.26.4 + checksum: d6a82bfc28bca8e4e32ffc9526798d1aea62f6993ea3a535cd3f47ac3f725a48efe3f484d68168dd154af0001c89935e4e1d77e7b1809c3824c6382bf99b86f6 languageName: node linkType: hard @@ -44335,10 +44337,10 @@ __metadata: languageName: node linkType: hard -"undici-types@npm:~5.25.1": - version: 5.25.3 - resolution: "undici-types@npm:5.25.3" - checksum: ec9d2cc36520cbd9fbe3b3b6c682a87fe5be214699e1f57d1e3d9a2cb5be422e62735f06e0067dc325fd3dd7404c697e4d479f9147dc8a804e049e29f357f2ff +"undici-types@npm:~5.26.4": + version: 5.26.5 + resolution: "undici-types@npm:5.26.5" + checksum: 3192ef6f3fd5df652f2dc1cd782b49d6ff14dc98e5dced492aa8a8c65425227da5da6aafe22523c67f035a272c599bb89cfe803c1db6311e44bed3042fc25487 languageName: node linkType: hard From ce632aaa3832079ef86268a2774a907e9cf3eefb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Mon, 6 Nov 2023 14:42:23 +0100 Subject: [PATCH 2/2] fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../FetchApi/IdentityAuthInjectorFetchMiddleware.ts | 10 +++++++--- .../FetchApi/PluginProtocolResolverFetchMiddleware.ts | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/core-app-api/src/apis/implementations/FetchApi/IdentityAuthInjectorFetchMiddleware.ts b/packages/core-app-api/src/apis/implementations/FetchApi/IdentityAuthInjectorFetchMiddleware.ts index 810d9e76c1..6f9733cba1 100644 --- a/packages/core-app-api/src/apis/implementations/FetchApi/IdentityAuthInjectorFetchMiddleware.ts +++ b/packages/core-app-api/src/apis/implementations/FetchApi/IdentityAuthInjectorFetchMiddleware.ts @@ -55,8 +55,12 @@ export class IdentityAuthInjectorFetchMiddleware implements FetchMiddleware { apply(next: typeof fetch): typeof fetch { return async (input, init) => { // Skip this middleware if the header already exists, or if the URL - // doesn't match any of the allowlist items, or if there was no token - const request = new Request(input, init); + // doesn't match any of the allowlist items, or if there was no token. + // NOTE(freben): The "as any" casts here and below are because of subtle + // undici type differences that happened in a node types bump. Those are + // immaterial to the code at hand at runtime, as the global fetch and + // Request are always taken from the same place. + const request = new Request(input as any, init); const { token } = await this.identityApi.getCredentials(); if ( request.headers.get(this.headerName) || @@ -64,7 +68,7 @@ export class IdentityAuthInjectorFetchMiddleware implements FetchMiddleware { !token || !this.allowUrl(request.url) ) { - return next(input, init); + return next(input as any, init); } request.headers.set(this.headerName, this.headerValue(token)); diff --git a/packages/core-app-api/src/apis/implementations/FetchApi/PluginProtocolResolverFetchMiddleware.ts b/packages/core-app-api/src/apis/implementations/FetchApi/PluginProtocolResolverFetchMiddleware.ts index ff20b594b4..e0afaed614 100644 --- a/packages/core-app-api/src/apis/implementations/FetchApi/PluginProtocolResolverFetchMiddleware.ts +++ b/packages/core-app-api/src/apis/implementations/FetchApi/PluginProtocolResolverFetchMiddleware.ts @@ -34,11 +34,15 @@ export class PluginProtocolResolverFetchMiddleware implements FetchMiddleware { apply(next: typeof fetch): typeof fetch { return async (input, init) => { - const request = new Request(input, init); + // NOTE(freben): The "as any" casts here and below are because of subtle + // undici type differences that happened in a node types bump. Those are + // immaterial to the code at hand at runtime, as the global fetch and + // Request are always taken from the same place. + const request = new Request(input as any, init); const prefix = 'plugin://'; if (!request.url.startsWith(prefix)) { - return next(input, init); + return next(input as any, init); } // Switch to a known protocol, since browser URL parsing misbehaves wildly @@ -57,7 +61,7 @@ export class PluginProtocolResolverFetchMiddleware implements FetchMiddleware { const target = `${join(base, pathname)}${search}${hash}`; return next( target, - typeof input === 'string' || isUrl(input) ? init : input, + typeof input === 'string' || isUrl(input) ? init : (input as any), ); }; }