@vue-storefront/middleware
Advanced tools
Comparing version 3.5.0 to 3.6.0-test.0
@@ -218,2 +218,15 @@ 'use strict'; | ||
customQueries, | ||
integrations, | ||
getApiClient: (name) => { | ||
if (!integrations[name]) { | ||
throw new Error(`You're trying to access the "${name}" integration, however it has not been configured in the middleware.config.[js,ts] file.`); | ||
} | ||
const createClient = integrations[name].apiClient.createApiClient.bind({ | ||
middleware: middlewareContext, | ||
}); | ||
return createClient({ | ||
...integrations[name].configuration, | ||
...integrations[name].initConfig, | ||
}); | ||
}, | ||
}; | ||
@@ -220,0 +233,0 @@ const createApiClient = apiClient.createApiClient.bind({ |
@@ -206,2 +206,15 @@ import consola from 'consola'; | ||
customQueries, | ||
integrations, | ||
getApiClient: (name) => { | ||
if (!integrations[name]) { | ||
throw new Error(`You're trying to access the "${name}" integration, however it has not been configured in the middleware.config.[js,ts] file.`); | ||
} | ||
const createClient = integrations[name].apiClient.createApiClient.bind({ | ||
middleware: middlewareContext, | ||
}); | ||
return createClient({ | ||
...integrations[name].configuration, | ||
...integrations[name].initConfig, | ||
}); | ||
}, | ||
}; | ||
@@ -208,0 +221,0 @@ const createApiClient = apiClient.createApiClient.bind({ |
@@ -53,2 +53,4 @@ import type { Express, Request, Response } from 'express'; | ||
customQueries: Record<string, CustomQueryFunction>; | ||
integrations: IntegrationsLoaded; | ||
getApiClient: <T = any>(integrationName: string) => T; | ||
} | ||
@@ -55,0 +57,0 @@ export interface ApiContext<CONFIG, CLIENT, REQUEST, RESPONSE> { |
{ | ||
"name": "@vue-storefront/middleware", | ||
"version": "3.5.0", | ||
"version": "3.6.0-test.0", | ||
"main": "lib/index.cjs.js", | ||
@@ -31,3 +31,2 @@ "module": "lib/index.es.js", | ||
"devDependencies": { | ||
"@changesets/changelog-github": "^0.4.8", | ||
"@changesets/cli": "^2.26.1", | ||
@@ -34,0 +33,0 @@ "@types/body-parser": "^1.19.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
67465
14
1085
2