Factory class to define a bunch of action handlers.
Type parameter Value P extends PatchItemPatch
ts
new DataConnector<P>(client): DataConnector<P>
DataConnector <P>
ts
new DataConnector<P>(client, optPatchParser): DataConnector<P>
Parameter Type clientDataConnectorClientoptPatchParserP extends ItemPatch ? never : PatchParser<P>
DataConnector <P>
ts
actions: Record<string, object | object> = {};
ts
routes: Record<string, DataConnectorRoute> = {};
ts
defineAction<T>(
name,
request,
asynchronous?): DataConnector<P>
Factory to define an action request handler
Type parameter T extends string
Parameter Type nameTrequestActionTypeForName<P, T, false>asynchronous?false
DataConnector <P>
ts
defineAction<T>(
name,
request,
asynchronous): DataConnector<P>
Type parameter T extends string
Parameter Type nameTrequestActionTypeForName<P, T, true>asynchronoustrue
DataConnector <P>
ts
defineAsynchronousAction<T>(name, request): DataConnector<P>
Factory to define an asynchronous action request handler
Type parameter T extends string
Parameter Type nameTrequestActionTypeForName<P, T, true>
DataConnector <P>
ts
defineRoute(name, request): DataConnector<P>
Factory to define a route handler
DataConnector <P>
ts
routeDebugServer(options): ExpressAppLike
Add a route to the given express app (or generate a new app) to serve this data connector
Parameter Type optionsRunDebugServerOptions
ExpressAppLike
ts
runAction(
url,
headers,
body): Promise<object>
Call a defined action handler and gather its serialized response
Parameter Type urlstringheadersRecord<string, undefined | string | string[]>bodyunknown
Promise<object>
ts
runDebugServer(options): void
Serve this data connector as a simple express app for debugging purposes
Parameter Type optionsRunDebugServerOptions
void