Преглед на файлове

chore: Add some changes that got lost in recent merge

Michael Bromley преди 9 месеца
родител
ревизия
8278fc5349

+ 13 - 1
packages/core/src/config/asset-storage-strategy/asset-storage-strategy.ts

@@ -1,8 +1,20 @@
-import { Request } from 'express';
 import { Stream } from 'stream';
 
 import { InjectableStrategy } from '../../common/types/injectable-strategy';
 
+// This is a workaround for a type mismatch between express v5 (Vendure core)
+// and express v4 (several transitive dependencies). Can be replaced with the
+// actual Request type once the ecosystem has more significantly shifted to v5.
+type Request = {
+    headers: Record<string, string>;
+    url: string;
+    method: string;
+    body: any;
+    query: any;
+    params: any;
+    ip: string;
+} & any;
+
 /**
  * @description
  * The AssetPersistenceStrategy determines how Asset files are physically stored

+ 3 - 1
packages/core/src/i18n/i18n.service.ts

@@ -75,7 +75,9 @@ export class I18nService implements OnModuleInit {
      * @internal
      */
     handle(): Handler {
-        return i18nextMiddleware.handle(i18next);
+        // Explicit cast due to type mismatch between express v5 (Vendure core)
+        // and express v4 (several transitive dependencies)
+        return i18nextMiddleware.handle(i18next) as unknown as Handler;
     }
 
     /**

+ 17 - 19
packages/core/src/plugin/plugin-utils.ts

@@ -1,7 +1,7 @@
 import { RequestHandler } from 'express';
 import { createProxyMiddleware } from 'http-proxy-middleware';
 
-import { Logger, RuntimeVendureConfig, VendureConfig } from '../config';
+import { Logger } from '../config';
 
 /**
  * @description
@@ -43,24 +43,22 @@ export function createProxyHandler(options: ProxyOptions): RequestHandler {
         pathRewrite: {
             [`^${route}`]: '/' + (options.basePath || ''),
         },
-        logProvider(provider) {
-            return {
-                log(message: string) {
-                    Logger.debug(message, options.label);
-                },
-                debug(message: string) {
-                    Logger.debug(message, options.label);
-                },
-                info(message: string) {
-                    Logger.debug(message, options.label);
-                },
-                warn(message: string) {
-                    Logger.warn(message, options.label);
-                },
-                error(message: string) {
-                    Logger.error(message, options.label);
-                },
-            };
+        logger: {
+            log(message: string) {
+                Logger.debug(message, options.label);
+            },
+            debug(message: string) {
+                Logger.debug(message, options.label);
+            },
+            info(message: string) {
+                Logger.debug(message, options.label);
+            },
+            warn(message: string) {
+                Logger.warn(message, options.label);
+            },
+            error(message: string) {
+                Logger.error(message, options.label);
+            },
         },
     });
     return middleware;