AbstractProtectedconstructorCreate an Adapter.
The blueprint to create the adapter.
Protected ReadonlyblueprintThe blueprint to create the adapter.
Protected ReadonlyhooksProtected ReadonlymiddlewareProtected ReadonlyresolvedProtectedbuildBuild the raw response.
The event context.
OptionaleventHandler: AdapterEventHandlerType<IncomingEventType, OutgoingResponseType>
The event handler to be run.
The raw response wrapper.
ProtectedexecuteExecute the event handler lifecycle hooks.
The hook to execute.
The event handler to be run.
ProtectedexecuteExecute adapter lifecycle hooks.
The hook's name.
Optionalcontext: AdapterContextType
The event context.
Optionalerror: any
The error to handle.
ProtectedhandleHandle error.
The error to handle.
The event context.
The raw response.
ProtectedhandleHandle the event.
The event context.
The event handler to be run.
The raw response wrapper.
ProtectedmakeCreate pipeline options for the Adapter.
The pipeline options for transforming the event.
ProtectedresolveGet the error handler for the given error.
The error to get the handler for.
The error handler.
ProtectedresolveGet the event handler for the adapter.
The event handler for the adapter.
AbstractrunRun handler.
The result of the handler execution.
Implementation flow
await this.executeHooks('onStart');
const eventHandlerResolver = this.blueprint.get('stone.adapter.eventHandlerResolver');
const eventHandler = eventHandlerResolver(this.blueprint)
await this.executeHooks('onInit', eventHandler);
const rawEvent: MockRawEvent = { name: 'Stone.js' }
const context: AdapterContext<MockRawEvent, MockRawResponse, any, IncomingEvent, IncomingEventOptions, OutgoingResponse> = {
rawEvent,
incomingEventBuilder: AdapterBuilder.create<IncomingEventOptions, IncomingEvent>({ resolver: v => IncomingEvent.create(v) }),
rawResponseBuilder: AdapterBuilder.create<RawResponseOptions, MockRawResponseWrapper>({ resolver: v => new MockRawResponseWrapper(v) })
}
return await this.sendEventThroughDestination(context, eventHandler);
ProtectedsendSend the raw event through the destination.
The event context.
The event handler to be run.
Platform-specific response.
ProtectedvalidateValidate the context and event handler.
The context to validate.
The event handler to validate.
Class representing an Adapter.
Author
Mr. Stone evensstone@gmail.com