UNPKG

@twin.org/api-tenant-processor

Version:

API Tenant Processor for converting and api key to a tenant id.

100 lines (50 loc) 1.35 kB
# Class: TenantProcessor Handles incoming api keys and maps them to tenant ids. ## Implements - `IBaseRouteProcessor` ## Constructors ### Constructor > **new TenantProcessor**(`options?`): `TenantProcessor` Create a new instance of NodeTenantProcessor. #### Parameters ##### options? [`ITenantProcessorConstructorOptions`](../interfaces/ITenantProcessorConstructorOptions.md) Options for the processor. #### Returns `TenantProcessor` ## Properties ### CLASS\_NAME > `readonly` `static` **CLASS\_NAME**: `string` Runtime name for the class. ## Methods ### className() > **className**(): `string` Returns the class name of the component. #### Returns `string` The class name of the component. #### Implementation of `IBaseRouteProcessor.className` *** ### pre() > **pre**(`request`, `response`, `route`, `contextIds`, `processorState`): `Promise`\<`void`\> Pre process the REST request for the specified route. #### Parameters ##### request `IHttpServerRequest` The incoming request. ##### response `IHttpResponse` The outgoing response. ##### route The route to process. `IBaseRoute` | `undefined` ##### contextIds `IContextIds` The context IDs of the request. ##### processorState The state handed through the processors. #### Returns `Promise`\<`void`\> #### Implementation of `IBaseRouteProcessor.pre`