@gtsc/api-models
Advanced tools
Comparing version 0.0.5-next.3 to 0.0.5-next.4
@@ -8,2 +8,3 @@ export * from "./helpers/responseHelper"; | ||
export * from "./models/protocol/IHttpRequest"; | ||
export * from "./models/protocol/IHttpRequestIdentity"; | ||
export * from "./models/protocol/IHttpRequestContext"; | ||
@@ -10,0 +11,0 @@ export * from "./models/protocol/IHttpRequestPathParams"; |
@@ -1,2 +0,2 @@ | ||
import type { IServiceRequestContext } from "@gtsc/services"; | ||
import type { IHttpRequestIdentity } from "./IHttpRequestIdentity"; | ||
import type { IHttpServerRequest } from "./IHttpServerRequest"; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export interface IHttpRequestContext extends IServiceRequestContext { | ||
export interface IHttpRequestContext extends IHttpRequestIdentity { | ||
/** | ||
@@ -9,0 +9,0 @@ * The raw HTTP request. |
@@ -1,3 +0,3 @@ | ||
import type { IServiceRequestContext } from "@gtsc/services"; | ||
import type { IBaseRoute } from "./IBaseRoute"; | ||
import type { IHttpRequestContext } from "../protocol/IHttpRequestContext"; | ||
/** | ||
@@ -14,3 +14,3 @@ * Interface which defines a socket route. | ||
*/ | ||
requestContext: IServiceRequestContext, | ||
httpRequestContext: IHttpRequestContext, | ||
/** | ||
@@ -17,0 +17,0 @@ * The id of the socket the request is arriving on. |
@@ -1,2 +0,3 @@ | ||
import type { IService, IServiceRequestContext } from "@gtsc/services"; | ||
import type { IService } from "@gtsc/services"; | ||
import type { IHttpRequestIdentity } from "../protocol/IHttpRequestIdentity"; | ||
import type { IHttpResponse } from "../protocol/IHttpResponse"; | ||
@@ -14,7 +15,7 @@ import type { IHttpServerRequest } from "../protocol/IHttpServerRequest"; | ||
* @param route The route being requested, if a matching one was found. | ||
* @param requestContext The context for the request. | ||
* @param requestIdentity The identity context for the request. | ||
* @param processorState The state handed through the processors. | ||
* @returns Promise that resolves when the request is processed. | ||
*/ | ||
pre?(request: IHttpServerRequest, response: IHttpResponse, route: IRestRoute | undefined, requestContext: IServiceRequestContext, processorState: { | ||
pre?(request: IHttpServerRequest, response: IHttpResponse, route: IRestRoute | undefined, requestIdentity: IHttpRequestIdentity, processorState: { | ||
[id: string]: unknown; | ||
@@ -27,7 +28,7 @@ }): Promise<void>; | ||
* @param route The route being requested, if a matching one was found. | ||
* @param requestContext The context for the request. | ||
* @param requestIdentity The identity context for the request. | ||
* @param processorState The state handed through the processors. | ||
* @returns Promise that resolves when the request is processed. | ||
*/ | ||
process?(request: IHttpServerRequest, response: IHttpResponse, route: IRestRoute | undefined, requestContext: IServiceRequestContext, processorState: { | ||
process?(request: IHttpServerRequest, response: IHttpResponse, route: IRestRoute | undefined, requestIdentity: IHttpRequestIdentity, processorState: { | ||
[id: string]: unknown; | ||
@@ -40,9 +41,9 @@ }): Promise<void>; | ||
* @param route The route being requested, if a matching one was found. | ||
* @param requestContext The context for the request. | ||
* @param requestIdentity The identity context for the request. | ||
* @param processorState The state handed through the processors. | ||
* @returns Promise that resolves when the request is processed. | ||
*/ | ||
post?(request: IHttpServerRequest, response: IHttpResponse, route: IRestRoute | undefined, requestContext: IServiceRequestContext, processorState: { | ||
post?(request: IHttpServerRequest, response: IHttpResponse, route: IRestRoute | undefined, requestIdentity: IHttpRequestIdentity, processorState: { | ||
[id: string]: unknown; | ||
}): Promise<void>; | ||
} |
@@ -16,2 +16,3 @@ # @gtsc/api-models | ||
- [IHttpRequestContext](interfaces/IHttpRequestContext.md) | ||
- [IHttpRequestIdentity](interfaces/IHttpRequestIdentity.md) | ||
- [IHttpRequestPathParams](interfaces/IHttpRequestPathParams.md) | ||
@@ -18,0 +19,0 @@ - [IHttpRequestQuery](interfaces/IHttpRequestQuery.md) |
@@ -7,46 +7,46 @@ # Interface: IHttpRequestContext | ||
- `IServiceRequestContext` | ||
- [`IHttpRequestIdentity`](IHttpRequestIdentity.md) | ||
## Properties | ||
### systemIdentity? | ||
### serverRequest | ||
> `optional` **systemIdentity**: `string` | ||
> **serverRequest**: [`IHttpServerRequest`](IHttpServerRequest.md)\<`any`\> | ||
The identity of the system the request is being performed on. | ||
The raw HTTP request. | ||
#### Inherited from | ||
`IServiceRequestContext.systemIdentity` | ||
*** | ||
### userIdentity? | ||
### processorState | ||
> `optional` **userIdentity**: `string` | ||
> **processorState**: `object` | ||
The identity of the requestor if there is an authenticated user. | ||
The state handed through the processors. | ||
#### Inherited from | ||
#### Index signature | ||
`IServiceRequestContext.userIdentity` | ||
\[`id`: `string`\]: `unknown` | ||
*** | ||
### serverRequest | ||
### systemIdentity? | ||
> **serverRequest**: [`IHttpServerRequest`](IHttpServerRequest.md)\<`any`\> | ||
> `optional` **systemIdentity**: `string` | ||
The raw HTTP request. | ||
The identity of the system the request is being performed on. | ||
#### Inherited from | ||
[`IHttpRequestIdentity`](IHttpRequestIdentity.md).[`systemIdentity`](IHttpRequestIdentity.md#systemidentity) | ||
*** | ||
### processorState | ||
### userIdentity? | ||
> **processorState**: `object` | ||
> `optional` **userIdentity**: `string` | ||
The state handed through the processors. | ||
The identity of the requestor if there is an authenticated user. | ||
#### Index signature | ||
#### Inherited from | ||
\[`id`: `string`\]: `unknown` | ||
[`IHttpRequestIdentity`](IHttpRequestIdentity.md).[`userIdentity`](IHttpRequestIdentity.md#useridentity) |
@@ -105,3 +105,3 @@ # Interface: IHttpRestRouteProcessor | ||
> `optional` **pre**(`request`, `response`, `route`, `requestContext`, `processorState`): `Promise`\<`void`\> | ||
> `optional` **pre**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\> | ||
@@ -124,5 +124,5 @@ Pre process the REST request for the specified route. | ||
• **requestContext**: `IServiceRequestContext` | ||
• **requestIdentity**: [`IHttpRequestIdentity`](IHttpRequestIdentity.md) | ||
The context for the request. | ||
The identity context for the request. | ||
@@ -143,3 +143,3 @@ • **processorState** | ||
> `optional` **process**(`request`, `response`, `route`, `requestContext`, `processorState`): `Promise`\<`void`\> | ||
> `optional` **process**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\> | ||
@@ -162,5 +162,5 @@ Process the REST request for the specified route. | ||
• **requestContext**: `IServiceRequestContext` | ||
• **requestIdentity**: [`IHttpRequestIdentity`](IHttpRequestIdentity.md) | ||
The context for the request. | ||
The identity context for the request. | ||
@@ -181,3 +181,3 @@ • **processorState** | ||
> `optional` **post**(`request`, `response`, `route`, `requestContext`, `processorState`): `Promise`\<`void`\> | ||
> `optional` **post**(`request`, `response`, `route`, `requestIdentity`, `processorState`): `Promise`\<`void`\> | ||
@@ -200,5 +200,5 @@ Post process the REST request for the specified route. | ||
• **requestContext**: `IServiceRequestContext` | ||
• **requestIdentity**: [`IHttpRequestIdentity`](IHttpRequestIdentity.md) | ||
The context for the request. | ||
The identity context for the request. | ||
@@ -205,0 +205,0 @@ • **processorState** |
@@ -49,3 +49,3 @@ # Interface: ISocketRoute | ||
> **handler**: (`requestContext`, `socketId`, `request`, `emitter`) => `Promise`\<`void`\> | ||
> **handler**: (`httpRequestContext`, `socketId`, `request`, `emitter`) => `Promise`\<`void`\> | ||
@@ -56,3 +56,3 @@ The handler module. | ||
• **requestContext**: `IServiceRequestContext` | ||
• **httpRequestContext**: [`IHttpRequestContext`](IHttpRequestContext.md) | ||
@@ -59,0 +59,0 @@ The request context. |
{ | ||
"name": "@gtsc/api-models", | ||
"version": "0.0.5-next.3", | ||
"version": "0.0.5-next.4", | ||
"description": "Contains models and classes for use with APIs", | ||
@@ -5,0 +5,0 @@ "repository": { |
64323
88
901