@twin.org/api-models 0.0.2-next.9 → 0.0.3-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/factories/authenticationGeneratorFactory.js +9 -0
- package/dist/es/factories/authenticationGeneratorFactory.js.map +1 -0
- package/dist/es/factories/mimeTypeProcessorFactory.js +9 -0
- package/dist/es/factories/mimeTypeProcessorFactory.js.map +1 -0
- package/dist/es/factories/restRouteProcessorFactory.js +9 -0
- package/dist/es/factories/restRouteProcessorFactory.js.map +1 -0
- package/dist/es/factories/socketRouteProcessorFactory.js +9 -0
- package/dist/es/factories/socketRouteProcessorFactory.js.map +1 -0
- package/dist/es/helpers/httpErrorHelper.js +60 -0
- package/dist/es/helpers/httpErrorHelper.js.map +1 -0
- package/dist/es/helpers/httpParameterHelper.js +41 -0
- package/dist/es/helpers/httpParameterHelper.js.map +1 -0
- package/dist/es/index.js +59 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/api/IServerFavIconResponse.js +2 -0
- package/dist/es/models/api/IServerFavIconResponse.js.map +1 -0
- package/dist/es/models/api/IServerHealthResponse.js +2 -0
- package/dist/es/models/api/IServerHealthResponse.js.map +1 -0
- package/dist/es/models/api/IServerInfoResponse.js +2 -0
- package/dist/es/models/api/IServerInfoResponse.js.map +1 -0
- package/dist/es/models/api/IServerRootResponse.js +4 -0
- package/dist/es/models/api/IServerRootResponse.js.map +1 -0
- package/dist/es/models/api/IServerSpecResponse.js +2 -0
- package/dist/es/models/api/IServerSpecResponse.js.map +1 -0
- package/dist/es/models/client/IAuthenticationGenerator.js +2 -0
- package/dist/es/models/client/IAuthenticationGenerator.js.map +1 -0
- package/dist/es/models/config/IBaseRestClientConfig.js +2 -0
- package/dist/es/models/config/IBaseRestClientConfig.js.map +1 -0
- package/dist/es/models/config/IBaseSocketClientConfig.js +2 -0
- package/dist/es/models/config/IBaseSocketClientConfig.js.map +1 -0
- package/dist/es/models/protocol/IHttpRequest.js +2 -0
- package/dist/es/models/protocol/IHttpRequest.js.map +1 -0
- package/dist/es/models/protocol/IHttpRequestContext.js +2 -0
- package/dist/es/models/protocol/IHttpRequestContext.js.map +1 -0
- package/dist/es/models/protocol/IHttpRequestPathParams.js +4 -0
- package/dist/es/models/protocol/IHttpRequestPathParams.js.map +1 -0
- package/dist/es/models/protocol/IHttpRequestQuery.js +4 -0
- package/dist/es/models/protocol/IHttpRequestQuery.js.map +1 -0
- package/dist/es/models/protocol/IHttpResponse.js +2 -0
- package/dist/es/models/protocol/IHttpResponse.js.map +1 -0
- package/dist/es/models/protocol/IHttpServerRequest.js +2 -0
- package/dist/es/models/protocol/IHttpServerRequest.js.map +1 -0
- package/dist/es/models/protocol/ISocketRequestContext.js +2 -0
- package/dist/es/models/protocol/ISocketRequestContext.js.map +1 -0
- package/dist/es/models/protocol/ISocketServerRequest.js +2 -0
- package/dist/es/models/protocol/ISocketServerRequest.js.map +1 -0
- package/dist/es/models/requests/INoContentRequest.js +2 -0
- package/dist/es/models/requests/INoContentRequest.js.map +1 -0
- package/dist/es/models/responses/errors/IBadRequestResponse.js +2 -0
- package/dist/es/models/responses/errors/IBadRequestResponse.js.map +1 -0
- package/dist/es/models/responses/errors/IConflictResponse.js +2 -0
- package/dist/es/models/responses/errors/IConflictResponse.js.map +1 -0
- package/dist/es/models/responses/errors/IForbiddenResponse.js +2 -0
- package/dist/es/models/responses/errors/IForbiddenResponse.js.map +1 -0
- package/dist/es/models/responses/errors/IInternalServerErrorResponse.js +2 -0
- package/dist/es/models/responses/errors/IInternalServerErrorResponse.js.map +1 -0
- package/dist/es/models/responses/errors/INotFoundResponse.js +2 -0
- package/dist/es/models/responses/errors/INotFoundResponse.js.map +1 -0
- package/dist/es/models/responses/errors/IUnauthorizedResponse.js +2 -0
- package/dist/es/models/responses/errors/IUnauthorizedResponse.js.map +1 -0
- package/dist/es/models/responses/errors/IUnprocessableEntityResponse.js +2 -0
- package/dist/es/models/responses/errors/IUnprocessableEntityResponse.js.map +1 -0
- package/dist/es/models/responses/success/IAcceptedResponse.js +2 -0
- package/dist/es/models/responses/success/IAcceptedResponse.js.map +1 -0
- package/dist/es/models/responses/success/ICreatedResponse.js +2 -0
- package/dist/es/models/responses/success/ICreatedResponse.js.map +1 -0
- package/dist/es/models/responses/success/INoContentResponse.js +2 -0
- package/dist/es/models/responses/success/INoContentResponse.js.map +1 -0
- package/dist/es/models/responses/success/IOkResponse.js +2 -0
- package/dist/es/models/responses/success/IOkResponse.js.map +1 -0
- package/dist/es/models/routes/IBaseRoute.js +4 -0
- package/dist/es/models/routes/IBaseRoute.js.map +1 -0
- package/dist/es/models/routes/IBaseRouteEntryPoint.js +2 -0
- package/dist/es/models/routes/IBaseRouteEntryPoint.js.map +1 -0
- package/dist/es/models/routes/IRestRoute.js +2 -0
- package/dist/es/models/routes/IRestRoute.js.map +1 -0
- package/dist/es/models/routes/IRestRouteEntryPoint.js +2 -0
- package/dist/es/models/routes/IRestRouteEntryPoint.js.map +1 -0
- package/dist/es/models/routes/IRestRouteExample.js +4 -0
- package/dist/es/models/routes/IRestRouteExample.js.map +1 -0
- package/dist/es/models/routes/IRestRouteRequestExample.js +2 -0
- package/dist/es/models/routes/IRestRouteRequestExample.js.map +1 -0
- package/dist/es/models/routes/IRestRouteResponseAttachmentOptions.js +4 -0
- package/dist/es/models/routes/IRestRouteResponseAttachmentOptions.js.map +1 -0
- package/dist/es/models/routes/IRestRouteResponseExample.js +2 -0
- package/dist/es/models/routes/IRestRouteResponseExample.js.map +1 -0
- package/dist/es/models/routes/IRestRouteResponseOptions.js +2 -0
- package/dist/es/models/routes/IRestRouteResponseOptions.js.map +1 -0
- package/dist/es/models/routes/ISocketRoute.js +2 -0
- package/dist/es/models/routes/ISocketRoute.js.map +1 -0
- package/dist/es/models/routes/ISocketRouteEntryPoint.js +2 -0
- package/dist/es/models/routes/ISocketRouteEntryPoint.js.map +1 -0
- package/dist/es/models/routes/ITag.js +4 -0
- package/dist/es/models/routes/ITag.js.map +1 -0
- package/dist/es/models/server/IBaseRouteProcessor.js +2 -0
- package/dist/es/models/server/IBaseRouteProcessor.js.map +1 -0
- package/dist/es/models/server/IMimeTypeProcessor.js +2 -0
- package/dist/es/models/server/IMimeTypeProcessor.js.map +1 -0
- package/dist/es/models/server/IRestRouteProcessor.js +2 -0
- package/dist/es/models/server/IRestRouteProcessor.js.map +1 -0
- package/dist/es/models/server/ISocketRouteProcessor.js +2 -0
- package/dist/es/models/server/ISocketRouteProcessor.js.map +1 -0
- package/dist/es/models/server/IWebServer.js +2 -0
- package/dist/es/models/server/IWebServer.js.map +1 -0
- package/dist/es/models/server/IWebServerOptions.js +2 -0
- package/dist/es/models/server/IWebServerOptions.js.map +1 -0
- package/dist/es/models/services/IHealthInfo.js +2 -0
- package/dist/es/models/services/IHealthInfo.js.map +1 -0
- package/dist/es/models/services/IInformationComponent.js +2 -0
- package/dist/es/models/services/IInformationComponent.js.map +1 -0
- package/dist/es/models/services/IServerInfo.js +4 -0
- package/dist/es/models/services/IServerInfo.js.map +1 -0
- package/dist/es/models/services/healthStatus.js +21 -0
- package/dist/es/models/services/healthStatus.js.map +1 -0
- package/dist/types/factories/authenticationGeneratorFactory.d.ts +6 -0
- package/dist/types/factories/mimeTypeProcessorFactory.d.ts +1 -1
- package/dist/types/factories/restRouteProcessorFactory.d.ts +1 -1
- package/dist/types/factories/socketRouteProcessorFactory.d.ts +1 -1
- package/dist/types/helpers/httpErrorHelper.d.ts +1 -1
- package/dist/types/index.d.ts +56 -55
- package/dist/types/models/api/IServerHealthResponse.d.ts +1 -1
- package/dist/types/models/api/IServerInfoResponse.d.ts +1 -1
- package/dist/types/models/client/IAuthenticationGenerator.d.ts +14 -0
- package/dist/types/models/protocol/IHttpRequest.d.ts +2 -2
- package/dist/types/models/protocol/IHttpRequestContext.d.ts +2 -3
- package/dist/types/models/protocol/IHttpServerRequest.d.ts +1 -1
- package/dist/types/models/protocol/ISocketRequestContext.d.ts +1 -1
- package/dist/types/models/protocol/ISocketServerRequest.d.ts +1 -1
- package/dist/types/models/requests/INoContentRequest.d.ts +1 -1
- package/dist/types/models/routes/IBaseRoute.d.ts +10 -0
- package/dist/types/models/routes/IBaseRouteEntryPoint.d.ts +1 -1
- package/dist/types/models/routes/IRestRoute.d.ts +7 -7
- package/dist/types/models/routes/IRestRouteEntryPoint.d.ts +2 -2
- package/dist/types/models/routes/IRestRouteRequestExample.d.ts +1 -1
- package/dist/types/models/routes/IRestRouteResponseExample.d.ts +1 -1
- package/dist/types/models/routes/IRestRouteResponseOptions.d.ts +1 -1
- package/dist/types/models/routes/ISocketRoute.d.ts +4 -4
- package/dist/types/models/routes/ISocketRouteEntryPoint.d.ts +2 -2
- package/dist/types/models/server/IBaseRouteProcessor.d.ts +15 -8
- package/dist/types/models/server/IRestRouteProcessor.d.ts +5 -7
- package/dist/types/models/server/ISocketRouteProcessor.d.ts +5 -7
- package/dist/types/models/server/IWebServer.d.ts +5 -5
- package/dist/types/models/services/IHealthInfo.d.ts +1 -1
- package/dist/types/models/services/IInformationComponent.d.ts +3 -3
- package/docs/changelog.md +47 -0
- package/docs/reference/classes/HttpParameterHelper.md +8 -8
- package/docs/reference/index.md +2 -1
- package/docs/reference/interfaces/IAuthenticationGenerator.md +35 -0
- package/docs/reference/interfaces/IBaseRoute.md +20 -0
- package/docs/reference/interfaces/IBaseRouteProcessor.md +26 -10
- package/docs/reference/interfaces/IHttpRequestContext.md +0 -28
- package/docs/reference/interfaces/IInformationComponent.md +2 -2
- package/docs/reference/interfaces/IRestRoute.md +28 -0
- package/docs/reference/interfaces/IRestRouteProcessor.md +32 -18
- package/docs/reference/interfaces/ISocketRequestContext.md +0 -24
- package/docs/reference/interfaces/ISocketRoute.md +28 -0
- package/docs/reference/interfaces/ISocketRouteProcessor.md +34 -20
- package/docs/reference/variables/AuthenticationGeneratorFactory.md +5 -0
- package/locales/en.json +1 -9
- package/package.json +23 -8
- package/dist/cjs/index.cjs +0 -154
- package/dist/esm/index.mjs +0 -147
- package/dist/types/models/protocol/IHttpRequestIdentity.d.ts +0 -13
- package/docs/reference/interfaces/IHttpRequestIdentity.md +0 -23
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { IBaseRouteProcessor } from "./IBaseRouteProcessor";
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type { IRestRoute } from "../routes/IRestRoute";
|
|
1
|
+
import type { IBaseRouteProcessor } from "./IBaseRouteProcessor.js";
|
|
2
|
+
import type { IHttpResponse } from "../protocol/IHttpResponse.js";
|
|
3
|
+
import type { IHttpServerRequest } from "../protocol/IHttpServerRequest.js";
|
|
4
|
+
import type { IRestRoute } from "../routes/IRestRoute.js";
|
|
6
5
|
/**
|
|
7
6
|
* The definition for a processor for handling REST routes.
|
|
8
7
|
*/
|
|
@@ -12,12 +11,11 @@ export interface IRestRouteProcessor extends IBaseRouteProcessor<IRestRoute> {
|
|
|
12
11
|
* @param request The request to handle.
|
|
13
12
|
* @param response The response data to send if any.
|
|
14
13
|
* @param route The route being requested, if a matching one was found.
|
|
15
|
-
* @param requestIdentity The identity context for the request.
|
|
16
14
|
* @param processorState The state handed through the processors.
|
|
17
15
|
* @param loggingComponentType The logging component type for the request.
|
|
18
16
|
* @returns Promise that resolves when the request is processed.
|
|
19
17
|
*/
|
|
20
|
-
process?(request: IHttpServerRequest, response: IHttpResponse, route: IRestRoute | undefined,
|
|
18
|
+
process?(request: IHttpServerRequest, response: IHttpResponse, route: IRestRoute | undefined, processorState: {
|
|
21
19
|
[id: string]: unknown;
|
|
22
20
|
}, loggingComponentType?: string): Promise<void>;
|
|
23
21
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { IBaseRouteProcessor } from "./IBaseRouteProcessor";
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type { ISocketRoute } from "../routes/ISocketRoute";
|
|
1
|
+
import type { IBaseRouteProcessor } from "./IBaseRouteProcessor.js";
|
|
2
|
+
import type { IHttpResponse } from "../protocol/IHttpResponse.js";
|
|
3
|
+
import type { ISocketServerRequest } from "../protocol/ISocketServerRequest.js";
|
|
4
|
+
import type { ISocketRoute } from "../routes/ISocketRoute.js";
|
|
6
5
|
/**
|
|
7
6
|
* The definition for a processor for handling socket routes.
|
|
8
7
|
*/
|
|
@@ -28,13 +27,12 @@ export interface ISocketRouteProcessor extends IBaseRouteProcessor<ISocketRoute,
|
|
|
28
27
|
* @param request The server request object containing the socket id and other parameters.
|
|
29
28
|
* @param response The response data to send if any.
|
|
30
29
|
* @param route The route being requested, if a matching one was found.
|
|
31
|
-
* @param requestIdentity The identity context for the request.
|
|
32
30
|
* @param processorState The state handed through the processors.
|
|
33
31
|
* @param responseEmitter The function to emit a response.
|
|
34
32
|
* @param loggingComponentType The logging component type for the request.
|
|
35
33
|
* @returns Promise that resolves when the request is processed.
|
|
36
34
|
*/
|
|
37
|
-
process?(request: ISocketServerRequest, response: IHttpResponse, route: ISocketRoute | undefined,
|
|
35
|
+
process?(request: ISocketServerRequest, response: IHttpResponse, route: ISocketRoute | undefined, processorState: {
|
|
38
36
|
[id: string]: unknown;
|
|
39
37
|
}, responseEmitter: (topic: string, response: IHttpResponse) => Promise<void>, loggingComponentType?: string): Promise<void>;
|
|
40
38
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { IRestRouteProcessor } from "./IRestRouteProcessor";
|
|
2
|
-
import type { ISocketRouteProcessor } from "./ISocketRouteProcessor";
|
|
3
|
-
import type { IWebServerOptions } from "./IWebServerOptions";
|
|
4
|
-
import type { IRestRoute } from "../routes/IRestRoute";
|
|
5
|
-
import type { ISocketRoute } from "../routes/ISocketRoute";
|
|
1
|
+
import type { IRestRouteProcessor } from "./IRestRouteProcessor.js";
|
|
2
|
+
import type { ISocketRouteProcessor } from "./ISocketRouteProcessor.js";
|
|
3
|
+
import type { IWebServerOptions } from "./IWebServerOptions.js";
|
|
4
|
+
import type { IRestRoute } from "../routes/IRestRoute.js";
|
|
5
|
+
import type { ISocketRoute } from "../routes/ISocketRoute.js";
|
|
6
6
|
/**
|
|
7
7
|
* Interface describing a web server.
|
|
8
8
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IComponent } from "@twin.org/core";
|
|
2
|
-
import type { HealthStatus } from "./healthStatus";
|
|
3
|
-
import type { IHealthInfo } from "./IHealthInfo";
|
|
4
|
-
import type { IServerInfo } from "./IServerInfo";
|
|
2
|
+
import type { HealthStatus } from "./healthStatus.js";
|
|
3
|
+
import type { IHealthInfo } from "./IHealthInfo.js";
|
|
4
|
+
import type { IServerInfo } from "./IServerInfo.js";
|
|
5
5
|
/**
|
|
6
6
|
* The information component for the server.
|
|
7
7
|
*/
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# @twin.org/api-models - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.1](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.0...api-models-v0.0.3-next.1) (2025-11-10)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add authentication generators and process features option ([a67edf1](https://github.com/twinfoundation/api/commit/a67edf1df212bd8ab94a40cddf5338551155696f))
|
|
9
|
+
* add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
|
|
10
|
+
* add logging component type to request contexts ([210de1b](https://github.com/twinfoundation/api/commit/210de1b9e1c91079b59a2b90ddd57569668d647d))
|
|
11
|
+
* add root, favicon routes ([71da1c3](https://github.com/twinfoundation/api/commit/71da1c3a93c349588aff7084d1d8d6a29a277da8))
|
|
12
|
+
* add socket id, connect and disconnect ([20b0d0e](https://github.com/twinfoundation/api/commit/20b0d0ec279cab46141fee09de2c4a7087cdce16))
|
|
13
|
+
* add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
|
|
14
|
+
* eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
|
|
15
|
+
* update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
|
|
16
|
+
* update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
|
|
17
|
+
* update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
|
|
18
|
+
* use new includeStackTrace flag for toJsonObject ([6452b15](https://github.com/twinfoundation/api/commit/6452b153af786eee14b21152420f8a2578b70593))
|
|
19
|
+
* use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
|
|
20
|
+
* validationError mapped to http status badrequest ([adc5eb1](https://github.com/twinfoundation/api/commit/adc5eb11d987abb0ab9f7e0dc8e1fdae207e436e))
|
|
21
|
+
|
|
22
|
+
## [0.0.2-next.13](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.12...api-models-v0.0.2-next.13) (2025-10-09)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Miscellaneous Chores
|
|
26
|
+
|
|
27
|
+
* **api-models:** Synchronize repo versions
|
|
28
|
+
|
|
29
|
+
## [0.0.2-next.12](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.11...api-models-v0.0.2-next.12) (2025-10-09)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
* add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
|
|
35
|
+
|
|
36
|
+
## [0.0.2-next.11](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.10...api-models-v0.0.2-next.11) (2025-09-29)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Features
|
|
40
|
+
|
|
41
|
+
* update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
|
|
42
|
+
|
|
43
|
+
## [0.0.2-next.10](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.9...api-models-v0.0.2-next.10) (2025-09-23)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
* add authentication generators and process features option ([a67edf1](https://github.com/twinfoundation/api/commit/a67edf1df212bd8ab94a40cddf5338551155696f))
|
|
49
|
+
|
|
3
50
|
## [0.0.2-next.9](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.8...api-models-v0.0.2-next.9) (2025-08-29)
|
|
4
51
|
|
|
5
52
|
|
|
@@ -16,7 +16,7 @@ Class to help with handling http parameters.
|
|
|
16
16
|
|
|
17
17
|
### arrayFromString()
|
|
18
18
|
|
|
19
|
-
> `static` **arrayFromString**\<`T`\>(`values?`): `
|
|
19
|
+
> `static` **arrayFromString**\<`T`\>(`values?`): `T`[] \| `undefined`
|
|
20
20
|
|
|
21
21
|
Convert list query to array.
|
|
22
22
|
|
|
@@ -36,7 +36,7 @@ The values query string.
|
|
|
36
36
|
|
|
37
37
|
#### Returns
|
|
38
38
|
|
|
39
|
-
`
|
|
39
|
+
`T`[] \| `undefined`
|
|
40
40
|
|
|
41
41
|
The array of values.
|
|
42
42
|
|
|
@@ -44,7 +44,7 @@ The array of values.
|
|
|
44
44
|
|
|
45
45
|
### arrayToString()
|
|
46
46
|
|
|
47
|
-
> `static` **arrayToString**\<`T`\>(`values?`): `
|
|
47
|
+
> `static` **arrayToString**\<`T`\>(`values?`): `string` \| `undefined`
|
|
48
48
|
|
|
49
49
|
Convert array of values to query string.
|
|
50
50
|
|
|
@@ -64,7 +64,7 @@ The values to combine string.
|
|
|
64
64
|
|
|
65
65
|
#### Returns
|
|
66
66
|
|
|
67
|
-
`
|
|
67
|
+
`string` \| `undefined`
|
|
68
68
|
|
|
69
69
|
The combined.
|
|
70
70
|
|
|
@@ -72,7 +72,7 @@ The combined.
|
|
|
72
72
|
|
|
73
73
|
### objectFromString()
|
|
74
74
|
|
|
75
|
-
> `static` **objectFromString**\<`T`\>(`value?`): `
|
|
75
|
+
> `static` **objectFromString**\<`T`\>(`value?`): `T` \| `undefined`
|
|
76
76
|
|
|
77
77
|
Convert object string to object.
|
|
78
78
|
|
|
@@ -92,7 +92,7 @@ The value query string.
|
|
|
92
92
|
|
|
93
93
|
#### Returns
|
|
94
94
|
|
|
95
|
-
`
|
|
95
|
+
`T` \| `undefined`
|
|
96
96
|
|
|
97
97
|
The object.
|
|
98
98
|
|
|
@@ -100,7 +100,7 @@ The object.
|
|
|
100
100
|
|
|
101
101
|
### objectToString()
|
|
102
102
|
|
|
103
|
-
> `static` **objectToString**\<`T`\>(`value?`): `
|
|
103
|
+
> `static` **objectToString**\<`T`\>(`value?`): `string` \| `undefined`
|
|
104
104
|
|
|
105
105
|
Convert object to query string.
|
|
106
106
|
|
|
@@ -120,6 +120,6 @@ The value to convert to a string.
|
|
|
120
120
|
|
|
121
121
|
#### Returns
|
|
122
122
|
|
|
123
|
-
`
|
|
123
|
+
`string` \| `undefined`
|
|
124
124
|
|
|
125
125
|
The converted object.
|
package/docs/reference/index.md
CHANGED
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
- [IServerInfoResponse](interfaces/IServerInfoResponse.md)
|
|
13
13
|
- [IServerRootResponse](interfaces/IServerRootResponse.md)
|
|
14
14
|
- [IServerSpecResponse](interfaces/IServerSpecResponse.md)
|
|
15
|
+
- [IAuthenticationGenerator](interfaces/IAuthenticationGenerator.md)
|
|
15
16
|
- [IBaseRestClientConfig](interfaces/IBaseRestClientConfig.md)
|
|
16
17
|
- [IBaseSocketClientConfig](interfaces/IBaseSocketClientConfig.md)
|
|
17
18
|
- [IHttpRequest](interfaces/IHttpRequest.md)
|
|
18
19
|
- [IHttpRequestContext](interfaces/IHttpRequestContext.md)
|
|
19
|
-
- [IHttpRequestIdentity](interfaces/IHttpRequestIdentity.md)
|
|
20
20
|
- [IHttpRequestPathParams](interfaces/IHttpRequestPathParams.md)
|
|
21
21
|
- [IHttpRequestQuery](interfaces/IHttpRequestQuery.md)
|
|
22
22
|
- [IHttpResponse](interfaces/IHttpResponse.md)
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
|
|
64
64
|
## Variables
|
|
65
65
|
|
|
66
|
+
- [AuthenticationGeneratorFactory](variables/AuthenticationGeneratorFactory.md)
|
|
66
67
|
- [MimeTypeProcessorFactory](variables/MimeTypeProcessorFactory.md)
|
|
67
68
|
- [RestRouteProcessorFactory](variables/RestRouteProcessorFactory.md)
|
|
68
69
|
- [SocketRouteProcessorFactory](variables/SocketRouteProcessorFactory.md)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Interface: IAuthenticationGenerator
|
|
2
|
+
|
|
3
|
+
Definition for the authentication generator component.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `IComponent`
|
|
8
|
+
|
|
9
|
+
## Methods
|
|
10
|
+
|
|
11
|
+
### addAuthentication()
|
|
12
|
+
|
|
13
|
+
> **addAuthentication**(`requestHeaders`, `authData?`): `Promise`\<`void`\>
|
|
14
|
+
|
|
15
|
+
Adds authentication information to the request headers.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### requestHeaders
|
|
20
|
+
|
|
21
|
+
`IHttpHeaders`
|
|
22
|
+
|
|
23
|
+
The request headers to add authentication information to.
|
|
24
|
+
|
|
25
|
+
##### authData?
|
|
26
|
+
|
|
27
|
+
`unknown`
|
|
28
|
+
|
|
29
|
+
Optional authentication data passed from the request.
|
|
30
|
+
|
|
31
|
+
#### Returns
|
|
32
|
+
|
|
33
|
+
`Promise`\<`void`\>
|
|
34
|
+
|
|
35
|
+
A promise that resolves when the authentication information has been added.
|
|
@@ -30,3 +30,23 @@ The path to use for routing.
|
|
|
30
30
|
> `optional` **skipAuth**: `boolean`
|
|
31
31
|
|
|
32
32
|
Skips the authentication for this route.
|
|
33
|
+
|
|
34
|
+
***
|
|
35
|
+
|
|
36
|
+
### processorFeatures?
|
|
37
|
+
|
|
38
|
+
> `optional` **processorFeatures**: `string`[]
|
|
39
|
+
|
|
40
|
+
The features supported by additional processors to run for this route.
|
|
41
|
+
|
|
42
|
+
***
|
|
43
|
+
|
|
44
|
+
### processorData?
|
|
45
|
+
|
|
46
|
+
> `optional` **processorData**: `object`
|
|
47
|
+
|
|
48
|
+
The data for additional processors to run for this route.
|
|
49
|
+
|
|
50
|
+
#### Index Signature
|
|
51
|
+
|
|
52
|
+
\[`key`: `string`\]: `unknown`
|
|
@@ -23,9 +23,25 @@ The definition for a base processor for handling REST routes.
|
|
|
23
23
|
|
|
24
24
|
## Methods
|
|
25
25
|
|
|
26
|
+
### features()?
|
|
27
|
+
|
|
28
|
+
> `optional` **features**(): `string`[]
|
|
29
|
+
|
|
30
|
+
Features supported by this processor.
|
|
31
|
+
If a route has any of these features listed, this processor will be run for that route.
|
|
32
|
+
If this is not implemented, the processor will run for all routes.
|
|
33
|
+
|
|
34
|
+
#### Returns
|
|
35
|
+
|
|
36
|
+
`string`[]
|
|
37
|
+
|
|
38
|
+
The features supported by this processor.
|
|
39
|
+
|
|
40
|
+
***
|
|
41
|
+
|
|
26
42
|
### pre()?
|
|
27
43
|
|
|
28
|
-
> `optional` **pre**(`request`, `response`, `route`, `
|
|
44
|
+
> `optional` **pre**(`request`, `response`, `route`, `contextIds`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
|
|
29
45
|
|
|
30
46
|
Pre process the REST request for the specified route.
|
|
31
47
|
|
|
@@ -47,13 +63,13 @@ The response data to send if any.
|
|
|
47
63
|
|
|
48
64
|
The route being requested, if a matching one was found.
|
|
49
65
|
|
|
50
|
-
`
|
|
66
|
+
`T` | `undefined`
|
|
51
67
|
|
|
52
|
-
#####
|
|
68
|
+
##### contextIds
|
|
53
69
|
|
|
54
|
-
|
|
70
|
+
`IContextIds`
|
|
55
71
|
|
|
56
|
-
The
|
|
72
|
+
The context IDs of the request.
|
|
57
73
|
|
|
58
74
|
##### processorState
|
|
59
75
|
|
|
@@ -75,7 +91,7 @@ Promise that resolves when the request is processed.
|
|
|
75
91
|
|
|
76
92
|
### post()?
|
|
77
93
|
|
|
78
|
-
> `optional` **post**(`request`, `response`, `route`, `
|
|
94
|
+
> `optional` **post**(`request`, `response`, `route`, `contextIds`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
|
|
79
95
|
|
|
80
96
|
Post process the REST request for the specified route.
|
|
81
97
|
|
|
@@ -97,13 +113,13 @@ The response data to send if any.
|
|
|
97
113
|
|
|
98
114
|
The route being requested, if a matching one was found.
|
|
99
115
|
|
|
100
|
-
`
|
|
116
|
+
`T` | `undefined`
|
|
101
117
|
|
|
102
|
-
#####
|
|
118
|
+
##### contextIds
|
|
103
119
|
|
|
104
|
-
|
|
120
|
+
`IContextIds`
|
|
105
121
|
|
|
106
|
-
The
|
|
122
|
+
The context IDs of the request.
|
|
107
123
|
|
|
108
124
|
##### processorState
|
|
109
125
|
|
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Context data from the HTTP request.
|
|
4
4
|
|
|
5
|
-
## Extends
|
|
6
|
-
|
|
7
|
-
- [`IHttpRequestIdentity`](IHttpRequestIdentity.md)
|
|
8
|
-
|
|
9
5
|
## Extended by
|
|
10
6
|
|
|
11
7
|
- [`ISocketRequestContext`](ISocketRequestContext.md)
|
|
@@ -37,27 +33,3 @@ The state handed through the processors.
|
|
|
37
33
|
> `optional` **loggingComponentType**: `string`
|
|
38
34
|
|
|
39
35
|
Logging component type for the request.
|
|
40
|
-
|
|
41
|
-
***
|
|
42
|
-
|
|
43
|
-
### nodeIdentity?
|
|
44
|
-
|
|
45
|
-
> `optional` **nodeIdentity**: `string`
|
|
46
|
-
|
|
47
|
-
The identity of the node the request is being performed on.
|
|
48
|
-
|
|
49
|
-
#### Inherited from
|
|
50
|
-
|
|
51
|
-
[`IHttpRequestIdentity`](IHttpRequestIdentity.md).[`nodeIdentity`](IHttpRequestIdentity.md#nodeidentity)
|
|
52
|
-
|
|
53
|
-
***
|
|
54
|
-
|
|
55
|
-
### userIdentity?
|
|
56
|
-
|
|
57
|
-
> `optional` **userIdentity**: `string`
|
|
58
|
-
|
|
59
|
-
The identity of the requestor if there is an authenticated user.
|
|
60
|
-
|
|
61
|
-
#### Inherited from
|
|
62
|
-
|
|
63
|
-
[`IHttpRequestIdentity`](IHttpRequestIdentity.md).[`userIdentity`](IHttpRequestIdentity.md#useridentity)
|
|
@@ -38,13 +38,13 @@ The service information.
|
|
|
38
38
|
|
|
39
39
|
### favicon()
|
|
40
40
|
|
|
41
|
-
> **favicon**(): `Promise`\<`
|
|
41
|
+
> **favicon**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `undefined`\>
|
|
42
42
|
|
|
43
43
|
Get the favicon.
|
|
44
44
|
|
|
45
45
|
#### Returns
|
|
46
46
|
|
|
47
|
-
`Promise`\<`
|
|
47
|
+
`Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `undefined`\>
|
|
48
48
|
|
|
49
49
|
The favicon.
|
|
50
50
|
|
|
@@ -54,6 +54,34 @@ Skips the authentication for this route.
|
|
|
54
54
|
|
|
55
55
|
***
|
|
56
56
|
|
|
57
|
+
### processorFeatures?
|
|
58
|
+
|
|
59
|
+
> `optional` **processorFeatures**: `string`[]
|
|
60
|
+
|
|
61
|
+
The features supported by additional processors to run for this route.
|
|
62
|
+
|
|
63
|
+
#### Inherited from
|
|
64
|
+
|
|
65
|
+
[`IBaseRoute`](IBaseRoute.md).[`processorFeatures`](IBaseRoute.md#processorfeatures)
|
|
66
|
+
|
|
67
|
+
***
|
|
68
|
+
|
|
69
|
+
### processorData?
|
|
70
|
+
|
|
71
|
+
> `optional` **processorData**: `object`
|
|
72
|
+
|
|
73
|
+
The data for additional processors to run for this route.
|
|
74
|
+
|
|
75
|
+
#### Index Signature
|
|
76
|
+
|
|
77
|
+
\[`key`: `string`\]: `unknown`
|
|
78
|
+
|
|
79
|
+
#### Inherited from
|
|
80
|
+
|
|
81
|
+
[`IBaseRoute`](IBaseRoute.md).[`processorData`](IBaseRoute.md#processordata)
|
|
82
|
+
|
|
83
|
+
***
|
|
84
|
+
|
|
57
85
|
### summary
|
|
58
86
|
|
|
59
87
|
> **summary**: `string`
|
|
@@ -8,9 +8,29 @@ The definition for a processor for handling REST routes.
|
|
|
8
8
|
|
|
9
9
|
## Methods
|
|
10
10
|
|
|
11
|
+
### features()?
|
|
12
|
+
|
|
13
|
+
> `optional` **features**(): `string`[]
|
|
14
|
+
|
|
15
|
+
Features supported by this processor.
|
|
16
|
+
If a route has any of these features listed, this processor will be run for that route.
|
|
17
|
+
If this is not implemented, the processor will run for all routes.
|
|
18
|
+
|
|
19
|
+
#### Returns
|
|
20
|
+
|
|
21
|
+
`string`[]
|
|
22
|
+
|
|
23
|
+
The features supported by this processor.
|
|
24
|
+
|
|
25
|
+
#### Inherited from
|
|
26
|
+
|
|
27
|
+
[`IBaseRouteProcessor`](IBaseRouteProcessor.md).[`features`](IBaseRouteProcessor.md#features)
|
|
28
|
+
|
|
29
|
+
***
|
|
30
|
+
|
|
11
31
|
### pre()?
|
|
12
32
|
|
|
13
|
-
> `optional` **pre**(`request`, `response`, `route`, `
|
|
33
|
+
> `optional` **pre**(`request`, `response`, `route`, `contextIds`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
|
|
14
34
|
|
|
15
35
|
Pre process the REST request for the specified route.
|
|
16
36
|
|
|
@@ -32,13 +52,13 @@ The response data to send if any.
|
|
|
32
52
|
|
|
33
53
|
The route being requested, if a matching one was found.
|
|
34
54
|
|
|
35
|
-
|
|
55
|
+
[`IRestRoute`](IRestRoute.md)\<`any`, `any`\> | `undefined`
|
|
36
56
|
|
|
37
|
-
#####
|
|
57
|
+
##### contextIds
|
|
38
58
|
|
|
39
|
-
|
|
59
|
+
`IContextIds`
|
|
40
60
|
|
|
41
|
-
The
|
|
61
|
+
The context IDs of the request.
|
|
42
62
|
|
|
43
63
|
##### processorState
|
|
44
64
|
|
|
@@ -64,7 +84,7 @@ Promise that resolves when the request is processed.
|
|
|
64
84
|
|
|
65
85
|
### post()?
|
|
66
86
|
|
|
67
|
-
> `optional` **post**(`request`, `response`, `route`, `
|
|
87
|
+
> `optional` **post**(`request`, `response`, `route`, `contextIds`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
|
|
68
88
|
|
|
69
89
|
Post process the REST request for the specified route.
|
|
70
90
|
|
|
@@ -86,13 +106,13 @@ The response data to send if any.
|
|
|
86
106
|
|
|
87
107
|
The route being requested, if a matching one was found.
|
|
88
108
|
|
|
89
|
-
|
|
109
|
+
[`IRestRoute`](IRestRoute.md)\<`any`, `any`\> | `undefined`
|
|
90
110
|
|
|
91
|
-
#####
|
|
111
|
+
##### contextIds
|
|
92
112
|
|
|
93
|
-
|
|
113
|
+
`IContextIds`
|
|
94
114
|
|
|
95
|
-
The
|
|
115
|
+
The context IDs of the request.
|
|
96
116
|
|
|
97
117
|
##### processorState
|
|
98
118
|
|
|
@@ -118,7 +138,7 @@ Promise that resolves when the request is processed.
|
|
|
118
138
|
|
|
119
139
|
### process()?
|
|
120
140
|
|
|
121
|
-
> `optional` **process**(`request`, `response`, `route`, `
|
|
141
|
+
> `optional` **process**(`request`, `response`, `route`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
|
|
122
142
|
|
|
123
143
|
Process the REST request for the specified route.
|
|
124
144
|
|
|
@@ -140,13 +160,7 @@ The response data to send if any.
|
|
|
140
160
|
|
|
141
161
|
The route being requested, if a matching one was found.
|
|
142
162
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
##### requestIdentity
|
|
146
|
-
|
|
147
|
-
[`IHttpRequestIdentity`](IHttpRequestIdentity.md)
|
|
148
|
-
|
|
149
|
-
The identity context for the request.
|
|
163
|
+
[`IRestRoute`](IRestRoute.md)\<`any`, `any`\> | `undefined`
|
|
150
164
|
|
|
151
165
|
##### processorState
|
|
152
166
|
|
|
@@ -48,30 +48,6 @@ Logging component type for the request.
|
|
|
48
48
|
|
|
49
49
|
***
|
|
50
50
|
|
|
51
|
-
### nodeIdentity?
|
|
52
|
-
|
|
53
|
-
> `optional` **nodeIdentity**: `string`
|
|
54
|
-
|
|
55
|
-
The identity of the node the request is being performed on.
|
|
56
|
-
|
|
57
|
-
#### Inherited from
|
|
58
|
-
|
|
59
|
-
[`IHttpRequestContext`](IHttpRequestContext.md).[`nodeIdentity`](IHttpRequestContext.md#nodeidentity)
|
|
60
|
-
|
|
61
|
-
***
|
|
62
|
-
|
|
63
|
-
### userIdentity?
|
|
64
|
-
|
|
65
|
-
> `optional` **userIdentity**: `string`
|
|
66
|
-
|
|
67
|
-
The identity of the requestor if there is an authenticated user.
|
|
68
|
-
|
|
69
|
-
#### Inherited from
|
|
70
|
-
|
|
71
|
-
[`IHttpRequestContext`](IHttpRequestContext.md).[`userIdentity`](IHttpRequestContext.md#useridentity)
|
|
72
|
-
|
|
73
|
-
***
|
|
74
|
-
|
|
75
51
|
### socketId
|
|
76
52
|
|
|
77
53
|
> **socketId**: `string`
|
|
@@ -54,6 +54,34 @@ Skips the authentication for this route.
|
|
|
54
54
|
|
|
55
55
|
***
|
|
56
56
|
|
|
57
|
+
### processorFeatures?
|
|
58
|
+
|
|
59
|
+
> `optional` **processorFeatures**: `string`[]
|
|
60
|
+
|
|
61
|
+
The features supported by additional processors to run for this route.
|
|
62
|
+
|
|
63
|
+
#### Inherited from
|
|
64
|
+
|
|
65
|
+
[`IBaseRoute`](IBaseRoute.md).[`processorFeatures`](IBaseRoute.md#processorfeatures)
|
|
66
|
+
|
|
67
|
+
***
|
|
68
|
+
|
|
69
|
+
### processorData?
|
|
70
|
+
|
|
71
|
+
> `optional` **processorData**: `object`
|
|
72
|
+
|
|
73
|
+
The data for additional processors to run for this route.
|
|
74
|
+
|
|
75
|
+
#### Index Signature
|
|
76
|
+
|
|
77
|
+
\[`key`: `string`\]: `unknown`
|
|
78
|
+
|
|
79
|
+
#### Inherited from
|
|
80
|
+
|
|
81
|
+
[`IBaseRoute`](IBaseRoute.md).[`processorData`](IBaseRoute.md#processordata)
|
|
82
|
+
|
|
83
|
+
***
|
|
84
|
+
|
|
57
85
|
### handler()
|
|
58
86
|
|
|
59
87
|
> **handler**: (`socketRequestContext`, `request`, `emit`) => `void`
|