@twin.org/api-models 0.0.2-next.9 → 0.0.3-next.10

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.
Files changed (179) hide show
  1. package/dist/es/factories/authenticationGeneratorFactory.js +9 -0
  2. package/dist/es/factories/authenticationGeneratorFactory.js.map +1 -0
  3. package/dist/es/factories/mimeTypeProcessorFactory.js +9 -0
  4. package/dist/es/factories/mimeTypeProcessorFactory.js.map +1 -0
  5. package/dist/es/factories/restRouteProcessorFactory.js +9 -0
  6. package/dist/es/factories/restRouteProcessorFactory.js.map +1 -0
  7. package/dist/es/factories/socketRouteProcessorFactory.js +9 -0
  8. package/dist/es/factories/socketRouteProcessorFactory.js.map +1 -0
  9. package/dist/es/helpers/httpErrorHelper.js +66 -0
  10. package/dist/es/helpers/httpErrorHelper.js.map +1 -0
  11. package/dist/es/helpers/httpParameterHelper.js +41 -0
  12. package/dist/es/helpers/httpParameterHelper.js.map +1 -0
  13. package/dist/es/index.js +61 -0
  14. package/dist/es/index.js.map +1 -0
  15. package/dist/es/models/api/IServerFavIconResponse.js +2 -0
  16. package/dist/es/models/api/IServerFavIconResponse.js.map +1 -0
  17. package/dist/es/models/api/IServerHealthResponse.js +2 -0
  18. package/dist/es/models/api/IServerHealthResponse.js.map +1 -0
  19. package/dist/es/models/api/IServerInfoResponse.js +2 -0
  20. package/dist/es/models/api/IServerInfoResponse.js.map +1 -0
  21. package/dist/es/models/api/IServerLivezResponse.js +2 -0
  22. package/dist/es/models/api/IServerLivezResponse.js.map +1 -0
  23. package/dist/es/models/api/IServerRootResponse.js +2 -0
  24. package/dist/es/models/api/IServerRootResponse.js.map +1 -0
  25. package/dist/es/models/api/IServerSpecResponse.js +2 -0
  26. package/dist/es/models/api/IServerSpecResponse.js.map +1 -0
  27. package/dist/es/models/client/IAuthenticationGenerator.js +2 -0
  28. package/dist/es/models/client/IAuthenticationGenerator.js.map +1 -0
  29. package/dist/es/models/config/IBaseRestClientConfig.js +2 -0
  30. package/dist/es/models/config/IBaseRestClientConfig.js.map +1 -0
  31. package/dist/es/models/config/IBaseSocketClientConfig.js +2 -0
  32. package/dist/es/models/config/IBaseSocketClientConfig.js.map +1 -0
  33. package/dist/es/models/protocol/IHttpRequest.js +2 -0
  34. package/dist/es/models/protocol/IHttpRequest.js.map +1 -0
  35. package/dist/es/models/protocol/IHttpRequestContext.js +2 -0
  36. package/dist/es/models/protocol/IHttpRequestContext.js.map +1 -0
  37. package/dist/es/models/protocol/IHttpRequestPathParams.js +4 -0
  38. package/dist/es/models/protocol/IHttpRequestPathParams.js.map +1 -0
  39. package/dist/es/models/protocol/IHttpRequestQuery.js +4 -0
  40. package/dist/es/models/protocol/IHttpRequestQuery.js.map +1 -0
  41. package/dist/es/models/protocol/IHttpResponse.js +2 -0
  42. package/dist/es/models/protocol/IHttpResponse.js.map +1 -0
  43. package/dist/es/models/protocol/IHttpServerRequest.js +2 -0
  44. package/dist/es/models/protocol/IHttpServerRequest.js.map +1 -0
  45. package/dist/es/models/protocol/ISocketRequestContext.js +2 -0
  46. package/dist/es/models/protocol/ISocketRequestContext.js.map +1 -0
  47. package/dist/es/models/protocol/ISocketServerRequest.js +2 -0
  48. package/dist/es/models/protocol/ISocketServerRequest.js.map +1 -0
  49. package/dist/es/models/requests/INoContentRequest.js +2 -0
  50. package/dist/es/models/requests/INoContentRequest.js.map +1 -0
  51. package/dist/es/models/responses/errors/IBadRequestResponse.js +2 -0
  52. package/dist/es/models/responses/errors/IBadRequestResponse.js.map +1 -0
  53. package/dist/es/models/responses/errors/IConflictResponse.js +2 -0
  54. package/dist/es/models/responses/errors/IConflictResponse.js.map +1 -0
  55. package/dist/es/models/responses/errors/IForbiddenResponse.js +2 -0
  56. package/dist/es/models/responses/errors/IForbiddenResponse.js.map +1 -0
  57. package/dist/es/models/responses/errors/IInternalServerErrorResponse.js +2 -0
  58. package/dist/es/models/responses/errors/IInternalServerErrorResponse.js.map +1 -0
  59. package/dist/es/models/responses/errors/INotFoundResponse.js +2 -0
  60. package/dist/es/models/responses/errors/INotFoundResponse.js.map +1 -0
  61. package/dist/es/models/responses/errors/IUnauthorizedResponse.js +2 -0
  62. package/dist/es/models/responses/errors/IUnauthorizedResponse.js.map +1 -0
  63. package/dist/es/models/responses/errors/IUnprocessableEntityResponse.js +2 -0
  64. package/dist/es/models/responses/errors/IUnprocessableEntityResponse.js.map +1 -0
  65. package/dist/es/models/responses/success/IAcceptedResponse.js +2 -0
  66. package/dist/es/models/responses/success/IAcceptedResponse.js.map +1 -0
  67. package/dist/es/models/responses/success/ICreatedResponse.js +2 -0
  68. package/dist/es/models/responses/success/ICreatedResponse.js.map +1 -0
  69. package/dist/es/models/responses/success/INoContentResponse.js +2 -0
  70. package/dist/es/models/responses/success/INoContentResponse.js.map +1 -0
  71. package/dist/es/models/responses/success/IOkResponse.js +2 -0
  72. package/dist/es/models/responses/success/IOkResponse.js.map +1 -0
  73. package/dist/es/models/routes/IBaseRoute.js +4 -0
  74. package/dist/es/models/routes/IBaseRoute.js.map +1 -0
  75. package/dist/es/models/routes/IBaseRouteEntryPoint.js +2 -0
  76. package/dist/es/models/routes/IBaseRouteEntryPoint.js.map +1 -0
  77. package/dist/es/models/routes/IRestRoute.js +2 -0
  78. package/dist/es/models/routes/IRestRoute.js.map +1 -0
  79. package/dist/es/models/routes/IRestRouteEntryPoint.js +2 -0
  80. package/dist/es/models/routes/IRestRouteEntryPoint.js.map +1 -0
  81. package/dist/es/models/routes/IRestRouteExample.js +4 -0
  82. package/dist/es/models/routes/IRestRouteExample.js.map +1 -0
  83. package/dist/es/models/routes/IRestRouteRequestExample.js +2 -0
  84. package/dist/es/models/routes/IRestRouteRequestExample.js.map +1 -0
  85. package/dist/es/models/routes/IRestRouteResponseAttachmentOptions.js +4 -0
  86. package/dist/es/models/routes/IRestRouteResponseAttachmentOptions.js.map +1 -0
  87. package/dist/es/models/routes/IRestRouteResponseExample.js +2 -0
  88. package/dist/es/models/routes/IRestRouteResponseExample.js.map +1 -0
  89. package/dist/es/models/routes/IRestRouteResponseOptions.js +2 -0
  90. package/dist/es/models/routes/IRestRouteResponseOptions.js.map +1 -0
  91. package/dist/es/models/routes/ISocketRoute.js +2 -0
  92. package/dist/es/models/routes/ISocketRoute.js.map +1 -0
  93. package/dist/es/models/routes/ISocketRouteEntryPoint.js +2 -0
  94. package/dist/es/models/routes/ISocketRouteEntryPoint.js.map +1 -0
  95. package/dist/es/models/routes/ITag.js +4 -0
  96. package/dist/es/models/routes/ITag.js.map +1 -0
  97. package/dist/es/models/server/IBaseRouteProcessor.js +2 -0
  98. package/dist/es/models/server/IBaseRouteProcessor.js.map +1 -0
  99. package/dist/es/models/server/IMimeTypeProcessor.js +2 -0
  100. package/dist/es/models/server/IMimeTypeProcessor.js.map +1 -0
  101. package/dist/es/models/server/IRestRouteProcessor.js +2 -0
  102. package/dist/es/models/server/IRestRouteProcessor.js.map +1 -0
  103. package/dist/es/models/server/ISocketRouteProcessor.js +2 -0
  104. package/dist/es/models/server/ISocketRouteProcessor.js.map +1 -0
  105. package/dist/es/models/server/IWebServer.js +2 -0
  106. package/dist/es/models/server/IWebServer.js.map +1 -0
  107. package/dist/es/models/server/IWebServerOptions.js +2 -0
  108. package/dist/es/models/server/IWebServerOptions.js.map +1 -0
  109. package/dist/es/models/services/IHealthComponentInfo.js +2 -0
  110. package/dist/es/models/services/IHealthComponentInfo.js.map +1 -0
  111. package/dist/es/models/services/IHealthInfo.js +2 -0
  112. package/dist/es/models/services/IHealthInfo.js.map +1 -0
  113. package/dist/es/models/services/IInformationComponent.js +2 -0
  114. package/dist/es/models/services/IInformationComponent.js.map +1 -0
  115. package/dist/es/models/services/IServerInfo.js +4 -0
  116. package/dist/es/models/services/IServerInfo.js.map +1 -0
  117. package/dist/es/models/services/healthStatus.js +21 -0
  118. package/dist/es/models/services/healthStatus.js.map +1 -0
  119. package/dist/types/factories/authenticationGeneratorFactory.d.ts +6 -0
  120. package/dist/types/factories/mimeTypeProcessorFactory.d.ts +1 -1
  121. package/dist/types/factories/restRouteProcessorFactory.d.ts +1 -1
  122. package/dist/types/factories/socketRouteProcessorFactory.d.ts +1 -1
  123. package/dist/types/helpers/httpErrorHelper.d.ts +1 -1
  124. package/dist/types/index.d.ts +58 -55
  125. package/dist/types/models/api/IServerHealthResponse.d.ts +1 -1
  126. package/dist/types/models/api/IServerInfoResponse.d.ts +1 -1
  127. package/dist/types/models/api/IServerLivezResponse.d.ts +16 -0
  128. package/dist/types/models/api/IServerRootResponse.d.ts +7 -0
  129. package/dist/types/models/client/IAuthenticationGenerator.d.ts +14 -0
  130. package/dist/types/models/protocol/IHttpRequest.d.ts +2 -2
  131. package/dist/types/models/protocol/IHttpRequestContext.d.ts +2 -3
  132. package/dist/types/models/protocol/IHttpRequestPathParams.d.ts +1 -1
  133. package/dist/types/models/protocol/IHttpRequestQuery.d.ts +1 -1
  134. package/dist/types/models/protocol/IHttpServerRequest.d.ts +1 -1
  135. package/dist/types/models/protocol/ISocketRequestContext.d.ts +1 -1
  136. package/dist/types/models/protocol/ISocketServerRequest.d.ts +1 -1
  137. package/dist/types/models/requests/INoContentRequest.d.ts +1 -1
  138. package/dist/types/models/routes/IBaseRoute.d.ts +15 -1
  139. package/dist/types/models/routes/IBaseRouteEntryPoint.d.ts +1 -1
  140. package/dist/types/models/routes/IRestRoute.d.ts +7 -7
  141. package/dist/types/models/routes/IRestRouteEntryPoint.d.ts +2 -2
  142. package/dist/types/models/routes/IRestRouteRequestExample.d.ts +1 -1
  143. package/dist/types/models/routes/IRestRouteResponseExample.d.ts +1 -1
  144. package/dist/types/models/routes/IRestRouteResponseOptions.d.ts +1 -1
  145. package/dist/types/models/routes/ISocketRoute.d.ts +4 -4
  146. package/dist/types/models/routes/ISocketRouteEntryPoint.d.ts +2 -2
  147. package/dist/types/models/server/IBaseRouteProcessor.d.ts +15 -8
  148. package/dist/types/models/server/IRestRouteProcessor.d.ts +5 -7
  149. package/dist/types/models/server/ISocketRouteProcessor.d.ts +5 -7
  150. package/dist/types/models/server/IWebServer.d.ts +5 -5
  151. package/dist/types/models/services/IHealthComponentInfo.d.ts +18 -0
  152. package/dist/types/models/services/IHealthInfo.d.ts +3 -15
  153. package/dist/types/models/services/IInformationComponent.d.ts +12 -5
  154. package/docs/changelog.md +141 -0
  155. package/docs/reference/classes/HttpParameterHelper.md +8 -8
  156. package/docs/reference/index.md +4 -1
  157. package/docs/reference/interfaces/IAuthenticationGenerator.md +35 -0
  158. package/docs/reference/interfaces/IBaseRoute.md +29 -1
  159. package/docs/reference/interfaces/IBaseRouteProcessor.md +26 -10
  160. package/docs/reference/interfaces/IHealthComponentInfo.md +27 -0
  161. package/docs/reference/interfaces/IHealthInfo.md +1 -19
  162. package/docs/reference/interfaces/IHttpRequestContext.md +0 -28
  163. package/docs/reference/interfaces/IHttpRequestPathParams.md +1 -1
  164. package/docs/reference/interfaces/IHttpRequestQuery.md +1 -1
  165. package/docs/reference/interfaces/IInformationComponent.md +30 -4
  166. package/docs/reference/interfaces/IRestRoute.md +41 -1
  167. package/docs/reference/interfaces/IRestRouteProcessor.md +32 -18
  168. package/docs/reference/interfaces/IServerLivezResponse.md +23 -0
  169. package/docs/reference/interfaces/IServerRootResponse.md +12 -0
  170. package/docs/reference/interfaces/ISocketRequestContext.md +0 -24
  171. package/docs/reference/interfaces/ISocketRoute.md +41 -1
  172. package/docs/reference/interfaces/ISocketRouteProcessor.md +34 -20
  173. package/docs/reference/variables/AuthenticationGeneratorFactory.md +5 -0
  174. package/locales/en.json +1 -9
  175. package/package.json +23 -8
  176. package/dist/cjs/index.cjs +0 -154
  177. package/dist/esm/index.mjs +0 -147
  178. package/dist/types/models/protocol/IHttpRequestIdentity.d.ts +0 -13
  179. package/docs/reference/interfaces/IHttpRequestIdentity.md +0 -23
@@ -1,7 +1,7 @@
1
- import type { IBaseRoute } from "./IBaseRoute";
2
- import type { IHttpRequest } from "../protocol/IHttpRequest";
3
- import type { IHttpResponse } from "../protocol/IHttpResponse";
4
- import type { ISocketRequestContext } from "../protocol/ISocketRequestContext";
1
+ import type { IBaseRoute } from "./IBaseRoute.js";
2
+ import type { IHttpRequest } from "../protocol/IHttpRequest.js";
3
+ import type { IHttpResponse } from "../protocol/IHttpResponse.js";
4
+ import type { ISocketRequestContext } from "../protocol/ISocketRequestContext.js";
5
5
  /**
6
6
  * Interface which defines a socket route.
7
7
  */
@@ -1,5 +1,5 @@
1
- import type { IBaseRouteEntryPoint } from "./IBaseRouteEntryPoint";
2
- import type { ISocketRoute } from "./ISocketRoute";
1
+ import type { IBaseRouteEntryPoint } from "./IBaseRouteEntryPoint.js";
2
+ import type { ISocketRoute } from "./ISocketRoute.js";
3
3
  /**
4
4
  * Route entry points are used for exposing the socket routes from a package.
5
5
  */
@@ -1,23 +1,30 @@
1
+ import type { IContextIds } from "@twin.org/context";
1
2
  import type { IComponent } from "@twin.org/core";
2
- import type { IHttpRequestIdentity } from "../protocol/IHttpRequestIdentity";
3
- import type { IHttpResponse } from "../protocol/IHttpResponse";
4
- import type { IHttpServerRequest } from "../protocol/IHttpServerRequest";
5
- import type { IBaseRoute } from "../routes/IBaseRoute";
3
+ import type { IHttpResponse } from "../protocol/IHttpResponse.js";
4
+ import type { IHttpServerRequest } from "../protocol/IHttpServerRequest.js";
5
+ import type { IBaseRoute } from "../routes/IBaseRoute.js";
6
6
  /**
7
7
  * The definition for a base processor for handling REST routes.
8
8
  */
9
9
  export interface IBaseRouteProcessor<T = IBaseRoute, R = IHttpServerRequest> extends IComponent {
10
+ /**
11
+ * Features supported by this processor.
12
+ * If a route has any of these features listed, this processor will be run for that route.
13
+ * If this is not implemented, the processor will run for all routes.
14
+ * @returns The features supported by this processor.
15
+ */
16
+ features?(): string[];
10
17
  /**
11
18
  * Pre process the REST request for the specified route.
12
19
  * @param request The request to handle.
13
20
  * @param response The response data to send if any.
14
21
  * @param route The route being requested, if a matching one was found.
15
- * @param requestIdentity The identity context for the request.
22
+ * @param contextIds The context IDs of the request.
16
23
  * @param processorState The state handed through the processors.
17
24
  * @param loggingComponentType The logging component type for the request.
18
25
  * @returns Promise that resolves when the request is processed.
19
26
  */
20
- pre?(request: R, response: IHttpResponse, route: T | undefined, requestIdentity: IHttpRequestIdentity, processorState: {
27
+ pre?(request: R, response: IHttpResponse, route: T | undefined, contextIds: IContextIds, processorState: {
21
28
  [id: string]: unknown;
22
29
  }, loggingComponentType?: string): Promise<void>;
23
30
  /**
@@ -25,12 +32,12 @@ export interface IBaseRouteProcessor<T = IBaseRoute, R = IHttpServerRequest> ext
25
32
  * @param request The request to handle.
26
33
  * @param response The response data to send if any.
27
34
  * @param route The route being requested, if a matching one was found.
28
- * @param requestIdentity The identity context for the request.
35
+ * @param contextIds The context IDs of the request.
29
36
  * @param processorState The state handed through the processors.
30
37
  * @param loggingComponentType The logging component type for the request.
31
38
  * @returns Promise that resolves when the request is processed.
32
39
  */
33
- post?(request: R, response: IHttpResponse, route: T | undefined, requestIdentity: IHttpRequestIdentity, processorState: {
40
+ post?(request: R, response: IHttpResponse, route: T | undefined, contextIds: IContextIds, processorState: {
34
41
  [id: string]: unknown;
35
42
  }, loggingComponentType?: string): Promise<void>;
36
43
  }
@@ -1,8 +1,7 @@
1
- import type { IBaseRouteProcessor } from "./IBaseRouteProcessor";
2
- import type { IHttpRequestIdentity } from "../protocol/IHttpRequestIdentity";
3
- import type { IHttpResponse } from "../protocol/IHttpResponse";
4
- import type { IHttpServerRequest } from "../protocol/IHttpServerRequest";
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, requestIdentity: IHttpRequestIdentity, processorState: {
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 { IHttpRequestIdentity } from "../protocol/IHttpRequestIdentity";
3
- import type { IHttpResponse } from "../protocol/IHttpResponse";
4
- import type { ISocketServerRequest } from "../protocol/ISocketServerRequest";
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, requestIdentity: IHttpRequestIdentity, processorState: {
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
  */
@@ -0,0 +1,18 @@
1
+ import type { HealthStatus } from "./healthStatus.js";
2
+ /**
3
+ * The health component information.
4
+ */
5
+ export interface IHealthComponentInfo {
6
+ /**
7
+ * The name of the component.
8
+ */
9
+ name: string;
10
+ /**
11
+ * The status of the component.
12
+ */
13
+ status: HealthStatus;
14
+ /**
15
+ * The details for the status.
16
+ */
17
+ details?: string;
18
+ }
@@ -1,4 +1,5 @@
1
- import type { HealthStatus } from "./healthStatus";
1
+ import type { HealthStatus } from "./healthStatus.js";
2
+ import type { IHealthComponentInfo } from "./IHealthComponentInfo.js";
2
3
  /**
3
4
  * The status of the server.
4
5
  */
@@ -10,18 +11,5 @@ export interface IHealthInfo {
10
11
  /**
11
12
  * The status of the components.
12
13
  */
13
- components?: {
14
- /**
15
- * The name of the component.
16
- */
17
- name: string;
18
- /**
19
- * The status of the component.
20
- */
21
- status: HealthStatus;
22
- /**
23
- * The details for the status.
24
- */
25
- details?: string;
26
- }[];
14
+ components?: IHealthComponentInfo[];
27
15
  }
@@ -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
  */
@@ -26,6 +26,11 @@ export interface IInformationComponent extends IComponent {
26
26
  * @returns The OpenAPI spec.
27
27
  */
28
28
  spec(): Promise<unknown>;
29
+ /**
30
+ * Is the server live.
31
+ * @returns True if the server is live.
32
+ */
33
+ livez(): Promise<boolean>;
29
34
  /**
30
35
  * Get the server health.
31
36
  * @returns The service health.
@@ -36,13 +41,15 @@ export interface IInformationComponent extends IComponent {
36
41
  * @param name The component name.
37
42
  * @param status The status of the component.
38
43
  * @param details The details for the status.
44
+ * @param tenantId The tenant id, optional if the health status is not tenant specific.
39
45
  * @returns Nothing.
40
46
  */
41
- setComponentHealth(name: string, status: HealthStatus, details?: string): Promise<void>;
47
+ setComponentHealth(name: string, status: HealthStatus, details?: string, tenantId?: string): Promise<void>;
42
48
  /**
43
49
  * Remove the status of a component.
44
50
  * @param name The component name.
51
+ * @param tenantId The tenant id, optional if the health status is not tenant specific.
45
52
  * @returns Nothing.
46
53
  */
47
- removeComponentHealth(name: string): Promise<void>;
54
+ removeComponentHealth(name: string, tenantId?: string): Promise<void>;
48
55
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,146 @@
1
1
  # @twin.org/api-models - Changelog
2
2
 
3
+ ## [0.0.3-next.10](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.9...api-models-v0.0.3-next.10) (2026-01-05)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **api-models:** Synchronize repo versions
9
+
10
+ ## [0.0.3-next.9](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.8...api-models-v0.0.3-next.9) (2026-01-05)
11
+
12
+
13
+ ### Features
14
+
15
+ * add authentication generators and process features option ([a67edf1](https://github.com/twinfoundation/api/commit/a67edf1df212bd8ab94a40cddf5338551155696f))
16
+ * add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
17
+ * add livez endpoint ([#57](https://github.com/twinfoundation/api/issues/57)) ([ef007db](https://github.com/twinfoundation/api/commit/ef007db8201736dd3053211f849ffd03baaa485e))
18
+ * add logging component type to request contexts ([210de1b](https://github.com/twinfoundation/api/commit/210de1b9e1c91079b59a2b90ddd57569668d647d))
19
+ * add root, favicon routes ([71da1c3](https://github.com/twinfoundation/api/commit/71da1c3a93c349588aff7084d1d8d6a29a277da8))
20
+ * add socket id, connect and disconnect ([20b0d0e](https://github.com/twinfoundation/api/commit/20b0d0ec279cab46141fee09de2c4a7087cdce16))
21
+ * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
22
+ * decodeURIComponent for query and path params ([ead68a2](https://github.com/twinfoundation/api/commit/ead68a257425c10dd912497f7edd473c469ca132))
23
+ * eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
24
+ * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
25
+ * update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
26
+ * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
27
+ * use new includeStackTrace flag for toJsonObject ([6452b15](https://github.com/twinfoundation/api/commit/6452b153af786eee14b21152420f8a2578b70593))
28
+ * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
29
+ * validationError mapped to http status badrequest ([adc5eb1](https://github.com/twinfoundation/api/commit/adc5eb11d987abb0ab9f7e0dc8e1fdae207e436e))
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * error handling make sure primary error takes precedence ([84b61f2](https://github.com/twinfoundation/api/commit/84b61f27fe5e4919c0c9f9a1edc8ff46dc45c1f7))
35
+
36
+ ## [0.0.3-next.8](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.7...api-models-v0.0.3-next.8) (2025-12-17)
37
+
38
+
39
+ ### Miscellaneous Chores
40
+
41
+ * **api-models:** Synchronize repo versions
42
+
43
+ ## [0.0.3-next.7](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.6...api-models-v0.0.3-next.7) (2025-11-26)
44
+
45
+
46
+ ### Bug Fixes
47
+
48
+ * error handling make sure primary error takes precedence ([84b61f2](https://github.com/twinfoundation/api/commit/84b61f27fe5e4919c0c9f9a1edc8ff46dc45c1f7))
49
+
50
+ ## [0.0.3-next.6](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.5...api-models-v0.0.3-next.6) (2025-11-20)
51
+
52
+
53
+ ### Miscellaneous Chores
54
+
55
+ * **api-models:** Synchronize repo versions
56
+
57
+ ## [0.0.3-next.5](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.4...api-models-v0.0.3-next.5) (2025-11-14)
58
+
59
+
60
+ ### Features
61
+
62
+ * decodeURIComponent for query and path params ([ead68a2](https://github.com/twinfoundation/api/commit/ead68a257425c10dd912497f7edd473c469ca132))
63
+
64
+ ## [0.0.3-next.4](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.3...api-models-v0.0.3-next.4) (2025-11-14)
65
+
66
+
67
+ ### Features
68
+
69
+ * add authentication generators and process features option ([a67edf1](https://github.com/twinfoundation/api/commit/a67edf1df212bd8ab94a40cddf5338551155696f))
70
+ * add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
71
+ * add logging component type to request contexts ([210de1b](https://github.com/twinfoundation/api/commit/210de1b9e1c91079b59a2b90ddd57569668d647d))
72
+ * add root, favicon routes ([71da1c3](https://github.com/twinfoundation/api/commit/71da1c3a93c349588aff7084d1d8d6a29a277da8))
73
+ * add socket id, connect and disconnect ([20b0d0e](https://github.com/twinfoundation/api/commit/20b0d0ec279cab46141fee09de2c4a7087cdce16))
74
+ * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
75
+ * eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
76
+ * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
77
+ * update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
78
+ * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
79
+ * use new includeStackTrace flag for toJsonObject ([6452b15](https://github.com/twinfoundation/api/commit/6452b153af786eee14b21152420f8a2578b70593))
80
+ * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
81
+ * validationError mapped to http status badrequest ([adc5eb1](https://github.com/twinfoundation/api/commit/adc5eb11d987abb0ab9f7e0dc8e1fdae207e436e))
82
+
83
+ ## [0.0.3-next.3](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.2...api-models-v0.0.3-next.3) (2025-11-14)
84
+
85
+
86
+ ### Miscellaneous Chores
87
+
88
+ * **api-models:** Synchronize repo versions
89
+
90
+ ## [0.0.3-next.2](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.1...api-models-v0.0.3-next.2) (2025-11-12)
91
+
92
+
93
+ ### Miscellaneous Chores
94
+
95
+ * **api-models:** Synchronize repo versions
96
+
97
+ ## [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)
98
+
99
+
100
+ ### Features
101
+
102
+ * add authentication generators and process features option ([a67edf1](https://github.com/twinfoundation/api/commit/a67edf1df212bd8ab94a40cddf5338551155696f))
103
+ * add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
104
+ * add logging component type to request contexts ([210de1b](https://github.com/twinfoundation/api/commit/210de1b9e1c91079b59a2b90ddd57569668d647d))
105
+ * add root, favicon routes ([71da1c3](https://github.com/twinfoundation/api/commit/71da1c3a93c349588aff7084d1d8d6a29a277da8))
106
+ * add socket id, connect and disconnect ([20b0d0e](https://github.com/twinfoundation/api/commit/20b0d0ec279cab46141fee09de2c4a7087cdce16))
107
+ * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
108
+ * eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
109
+ * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
110
+ * update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
111
+ * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
112
+ * use new includeStackTrace flag for toJsonObject ([6452b15](https://github.com/twinfoundation/api/commit/6452b153af786eee14b21152420f8a2578b70593))
113
+ * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
114
+ * validationError mapped to http status badrequest ([adc5eb1](https://github.com/twinfoundation/api/commit/adc5eb11d987abb0ab9f7e0dc8e1fdae207e436e))
115
+
116
+ ## [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)
117
+
118
+
119
+ ### Miscellaneous Chores
120
+
121
+ * **api-models:** Synchronize repo versions
122
+
123
+ ## [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)
124
+
125
+
126
+ ### Features
127
+
128
+ * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
129
+
130
+ ## [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)
131
+
132
+
133
+ ### Features
134
+
135
+ * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
136
+
137
+ ## [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)
138
+
139
+
140
+ ### Features
141
+
142
+ * add authentication generators and process features option ([a67edf1](https://github.com/twinfoundation/api/commit/a67edf1df212bd8ab94a40cddf5338551155696f))
143
+
3
144
  ## [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
145
 
5
146
 
@@ -16,7 +16,7 @@ Class to help with handling http parameters.
16
16
 
17
17
  ### arrayFromString()
18
18
 
19
- > `static` **arrayFromString**\<`T`\>(`values?`): `undefined` \| `T`[]
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
- `undefined` \| `T`[]
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?`): `undefined` \| `string`
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
- `undefined` \| `string`
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?`): `undefined` \| `T`
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
- `undefined` \| `T`
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?`): `undefined` \| `string`
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
- `undefined` \| `string`
123
+ `string` \| `undefined`
124
124
 
125
125
  The converted object.
@@ -10,13 +10,14 @@
10
10
  - [IServerFavIconResponse](interfaces/IServerFavIconResponse.md)
11
11
  - [IServerHealthResponse](interfaces/IServerHealthResponse.md)
12
12
  - [IServerInfoResponse](interfaces/IServerInfoResponse.md)
13
+ - [IServerLivezResponse](interfaces/IServerLivezResponse.md)
13
14
  - [IServerRootResponse](interfaces/IServerRootResponse.md)
14
15
  - [IServerSpecResponse](interfaces/IServerSpecResponse.md)
16
+ - [IAuthenticationGenerator](interfaces/IAuthenticationGenerator.md)
15
17
  - [IBaseRestClientConfig](interfaces/IBaseRestClientConfig.md)
16
18
  - [IBaseSocketClientConfig](interfaces/IBaseSocketClientConfig.md)
17
19
  - [IHttpRequest](interfaces/IHttpRequest.md)
18
20
  - [IHttpRequestContext](interfaces/IHttpRequestContext.md)
19
- - [IHttpRequestIdentity](interfaces/IHttpRequestIdentity.md)
20
21
  - [IHttpRequestPathParams](interfaces/IHttpRequestPathParams.md)
21
22
  - [IHttpRequestQuery](interfaces/IHttpRequestQuery.md)
22
23
  - [IHttpResponse](interfaces/IHttpResponse.md)
@@ -51,6 +52,7 @@
51
52
  - [ISocketRouteProcessor](interfaces/ISocketRouteProcessor.md)
52
53
  - [IWebServer](interfaces/IWebServer.md)
53
54
  - [IWebServerOptions](interfaces/IWebServerOptions.md)
55
+ - [IHealthComponentInfo](interfaces/IHealthComponentInfo.md)
54
56
  - [IHealthInfo](interfaces/IHealthInfo.md)
55
57
  - [IInformationComponent](interfaces/IInformationComponent.md)
56
58
  - [IServerInfo](interfaces/IServerInfo.md)
@@ -63,6 +65,7 @@
63
65
 
64
66
  ## Variables
65
67
 
68
+ - [AuthenticationGeneratorFactory](variables/AuthenticationGeneratorFactory.md)
66
69
  - [MimeTypeProcessorFactory](variables/MimeTypeProcessorFactory.md)
67
70
  - [RestRouteProcessorFactory](variables/RestRouteProcessorFactory.md)
68
71
  - [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.
@@ -29,4 +29,32 @@ The path to use for routing.
29
29
 
30
30
  > `optional` **skipAuth**: `boolean`
31
31
 
32
- Skips the authentication for this route.
32
+ Skips the authentication requirement for this route.
33
+
34
+ ***
35
+
36
+ ### skipTenant?
37
+
38
+ > `optional` **skipTenant**: `boolean`
39
+
40
+ Skips the tenant requirement for this route.
41
+
42
+ ***
43
+
44
+ ### processorFeatures?
45
+
46
+ > `optional` **processorFeatures**: `string`[]
47
+
48
+ The features supported by additional processors to run for this route.
49
+
50
+ ***
51
+
52
+ ### processorData?
53
+
54
+ > `optional` **processorData**: `object`
55
+
56
+ The data for additional processors to run for this route.
57
+
58
+ #### Index Signature
59
+
60
+ \[`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`, `requestIdentity`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
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
- `undefined` | `T`
66
+ `T` | `undefined`
51
67
 
52
- ##### requestIdentity
68
+ ##### contextIds
53
69
 
54
- [`IHttpRequestIdentity`](IHttpRequestIdentity.md)
70
+ `IContextIds`
55
71
 
56
- The identity context for the request.
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`, `requestIdentity`, `processorState`, `loggingComponentType?`): `Promise`\<`void`\>
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
- `undefined` | `T`
116
+ `T` | `undefined`
101
117
 
102
- ##### requestIdentity
118
+ ##### contextIds
103
119
 
104
- [`IHttpRequestIdentity`](IHttpRequestIdentity.md)
120
+ `IContextIds`
105
121
 
106
- The identity context for the request.
122
+ The context IDs of the request.
107
123
 
108
124
  ##### processorState
109
125
 
@@ -0,0 +1,27 @@
1
+ # Interface: IHealthComponentInfo
2
+
3
+ The health component information.
4
+
5
+ ## Properties
6
+
7
+ ### name
8
+
9
+ > **name**: `string`
10
+
11
+ The name of the component.
12
+
13
+ ***
14
+
15
+ ### status
16
+
17
+ > **status**: [`HealthStatus`](../type-aliases/HealthStatus.md)
18
+
19
+ The status of the component.
20
+
21
+ ***
22
+
23
+ ### details?
24
+
25
+ > `optional` **details**: `string`
26
+
27
+ The details for the status.