@vue-storefront/middleware
Advanced tools
Comparing version 3.6.0-rc.0 to 3.6.0-rc.2
@@ -225,3 +225,3 @@ 'use strict'; | ||
integrations, | ||
getIntegration: (integrationKey) => { | ||
getApiClient: (integrationKey) => { | ||
if (!integrations[integrationKey]) { | ||
@@ -289,11 +289,11 @@ const keys = Object.keys(integrations); | ||
const app = express__default["default"](); | ||
app.use(express__default["default"].json()); | ||
app.use(cookieParser__default["default"]()); | ||
app.use(cors__default["default"]({ | ||
credentials: true, | ||
origin: "http://localhost:3000", | ||
})); | ||
app.disable("x-powered-by"); | ||
async function createServer(config) { | ||
const app = express__default["default"](); | ||
app.use(express__default["default"].json()); | ||
app.use(cookieParser__default["default"]()); | ||
app.use(cors__default["default"]({ | ||
credentials: true, | ||
origin: "http://localhost:3000", | ||
})); | ||
app.disable("x-powered-by"); | ||
consola__default["default"].info("Middleware starting...."); | ||
@@ -300,0 +300,0 @@ const options = { |
@@ -213,3 +213,3 @@ import consola from 'consola'; | ||
integrations, | ||
getIntegration: (integrationKey) => { | ||
getApiClient: (integrationKey) => { | ||
if (!integrations[integrationKey]) { | ||
@@ -277,11 +277,11 @@ const keys = Object.keys(integrations); | ||
const app = express(); | ||
app.use(express.json()); | ||
app.use(cookieParser()); | ||
app.use(cors({ | ||
credentials: true, | ||
origin: "http://localhost:3000", | ||
})); | ||
app.disable("x-powered-by"); | ||
async function createServer(config) { | ||
const app = express(); | ||
app.use(express.json()); | ||
app.use(cookieParser()); | ||
app.use(cors({ | ||
credentials: true, | ||
origin: "http://localhost:3000", | ||
})); | ||
app.disable("x-powered-by"); | ||
consola.info("Middleware starting...."); | ||
@@ -288,0 +288,0 @@ const options = { |
@@ -75,3 +75,3 @@ import type { Express, Request, Response } from "express"; | ||
integrations: IntegrationsLoaded; | ||
getIntegration: (integrationName: string) => any; | ||
getApiClient: (integrationName: string) => any; | ||
} | ||
@@ -78,0 +78,0 @@ export type ExtendQuery = <T extends ContextQuery<string>, Key extends keyof T>(customQuery: CustomQuery<Key> | null, defaults: T) => ContextQuery<Key>; |
@@ -27,2 +27,6 @@ import { TObject } from "./base"; | ||
} | ||
/** | ||
* @deprecated | ||
* Use `ApiClient` instead. | ||
*/ | ||
export interface ApiInstance<CONFIG, API, CLIENT> { | ||
@@ -33,2 +37,7 @@ api: API; | ||
} | ||
export interface ApiClient<API = any, CONFIG = any, CLIENT = any> { | ||
api: API; | ||
client: CLIENT; | ||
settings: CONFIG; | ||
} | ||
export interface ApiClientConfig<CLIENT = any> { | ||
@@ -40,3 +49,3 @@ client?: CLIENT; | ||
export type CreateApiClientFn<CONFIG extends ApiClientConfig, API extends ApiMethods> = { | ||
<T extends ApiClientConfig, C>(givenConfig: CONFIG, customApi?: ApiMethods): ApiInstance<T, API & ApiMethods, C>; | ||
<T extends ApiClientConfig, C>(givenConfig: CONFIG, customApi?: ApiMethods): ApiClient<API & ApiMethods, T, C>; | ||
_predefinedExtensions?: ApiClientExtension<API>[]; | ||
@@ -60,3 +69,3 @@ }; | ||
} | ||
export type CreateApiProxyFn = <CONFIG, API, CLIENT>(givenConfig: any, customApi?: any) => ApiInstance<CONFIG, API, CLIENT>; | ||
export type CreateApiProxyFn = <CONFIG, API, CLIENT>(givenConfig: any, customApi?: any) => ApiClient<API, CONFIG, CLIENT>; | ||
//# sourceMappingURL=server.d.ts.map |
{ | ||
"name": "@vue-storefront/middleware", | ||
"version": "3.6.0-rc.0", | ||
"version": "3.6.0-rc.2", | ||
"main": "lib/index.cjs.js", | ||
@@ -16,3 +16,3 @@ "module": "lib/index.es.js", | ||
"test:unit": "jest -c jest.config.ts --coverage", | ||
"test:integration": "echo No integration tests", | ||
"test:integration": "jest ./integration -c ./jest.config.ts --runInBand", | ||
"lint": "eslint . --ext .ts,.js", | ||
@@ -35,5 +35,6 @@ "prepublishOnly": "yarn build", | ||
"@types/express": "^4.17.13", | ||
"supertest": "^6.3.3" | ||
"supertest": "^6.3.3", | ||
"@types/supertest": "^2.0.13" | ||
}, | ||
"packageManager": "yarn@1.22.10" | ||
} |
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
69673
1146
6