@wix/sdk-types
Advanced tools
Comparing version
@@ -86,6 +86,7 @@ type HostModule<T, H extends Host> = { | ||
type ServicePluginContract = Record<string, (payload: { | ||
type ServicePluginMethodInput = { | ||
request: any; | ||
metadata: any; | ||
}) => unknown | Promise<unknown>>; | ||
}; | ||
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>; | ||
type ServicePluginMethodMetadata = { | ||
@@ -95,3 +96,3 @@ name: string; | ||
transformations: { | ||
fromREST: (...args: unknown[]) => unknown; | ||
fromREST: (...args: unknown[]) => ServicePluginMethodInput; | ||
toREST: (...args: unknown[]) => unknown; | ||
@@ -102,15 +103,9 @@ }; | ||
__type: 'service-plugin-definition'; | ||
componentType: string; | ||
methods: ServicePluginMethodMetadata[]; | ||
__contract: Contract; | ||
}; | ||
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>; | ||
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = { | ||
provide(implementation: T['__contract']): void; | ||
processRequest(request: Request): Promise<Response>; | ||
process(request: { | ||
url: string; | ||
body: string; | ||
}): Promise<unknown>; | ||
}; | ||
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>; | ||
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void; | ||
export { type APIMetadata, type AuthenticationStrategy, type BaseEventMetadata, type BoundAuthenticationStrategy, type BuildEventDefinition, type BuildRESTFunction, type BuildServicePluginDefinition, EventDefinition, type EventHandler, type EventIdentity, type Host, type HostModule, type HostModuleAPI, type HttpClient, type HttpResponse, type RESTFunctionDescriptor, type RequestOptions, type RequestOptionsFactory, type ServicePluginContract, ServicePluginDefinition, type ServicePluginMethodMetadata }; | ||
export { type APIMetadata, type AuthenticationStrategy, type BaseEventMetadata, type BoundAuthenticationStrategy, type BuildEventDefinition, type BuildRESTFunction, type BuildServicePluginDefinition, EventDefinition, type EventHandler, type EventIdentity, type Host, type HostModule, type HostModuleAPI, type HttpClient, type HttpResponse, type RESTFunctionDescriptor, type RequestOptions, type RequestOptionsFactory, type ServicePluginContract, ServicePluginDefinition, type ServicePluginMethodInput, type ServicePluginMethodMetadata }; |
@@ -39,5 +39,6 @@ "use strict"; | ||
// src/service-plugins.ts | ||
function ServicePluginDefinition(methods) { | ||
function ServicePluginDefinition(componentType, methods) { | ||
return { | ||
__type: "service-plugin-definition", | ||
componentType, | ||
methods | ||
@@ -44,0 +45,0 @@ }; |
{ | ||
"name": "@wix/sdk-types", | ||
"version": "1.7.0", | ||
"version": "1.7.1", | ||
"license": "UNLICENSED", | ||
@@ -60,3 +60,3 @@ "author": { | ||
}, | ||
"falconPackageHash": "9b7f2792da45401c94a36006c1ff758bcf66103fbd3a40b1d48d3bff" | ||
"falconPackageHash": "1625d05bd31b4f3c4d050efc021096c2680fe38d4b6c6c0da9f479f1" | ||
} |
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
12581
0.7%193
-1.03%