@twin.org/api-models 0.0.3-next.5 → 0.0.3-next.51

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 (148) hide show
  1. package/README.md +1 -1
  2. package/dist/es/errors/forbiddenError.js +23 -0
  3. package/dist/es/errors/forbiddenError.js.map +1 -0
  4. package/dist/es/errors/tooManyRequestsError.js +25 -0
  5. package/dist/es/errors/tooManyRequestsError.js.map +1 -0
  6. package/dist/es/helpers/httpErrorHelper.js +34 -20
  7. package/dist/es/helpers/httpErrorHelper.js.map +1 -1
  8. package/dist/es/helpers/httpUrlHelper.js +141 -0
  9. package/dist/es/helpers/httpUrlHelper.js.map +1 -0
  10. package/dist/es/index.js +12 -4
  11. package/dist/es/index.js.map +1 -1
  12. package/dist/es/models/api/IServerHealthResponse.js.map +1 -1
  13. package/dist/es/models/api/IServerLivezResponse.js +2 -0
  14. package/dist/es/models/api/IServerLivezResponse.js.map +1 -0
  15. package/dist/es/models/api/IServerReadyzResponse.js +2 -0
  16. package/dist/es/models/api/IServerReadyzResponse.js.map +1 -0
  17. package/dist/es/models/api/IServerRootResponse.js +0 -2
  18. package/dist/es/models/api/IServerRootResponse.js.map +1 -1
  19. package/dist/es/models/config/IBaseRestClientConfig.js.map +1 -1
  20. package/dist/es/models/httpContextIdKeys.js +33 -0
  21. package/dist/es/models/httpContextIdKeys.js.map +1 -0
  22. package/dist/es/models/protocol/IHttpServerRequest.js.map +1 -1
  23. package/dist/es/models/responses/errors/IConflictResponse.js.map +1 -1
  24. package/dist/es/models/responses/errors/INotImplementedResponse.js +2 -0
  25. package/dist/es/models/responses/errors/INotImplementedResponse.js.map +1 -0
  26. package/dist/es/models/responses/errors/ITooManyRequestsResponse.js +2 -0
  27. package/dist/es/models/responses/errors/ITooManyRequestsResponse.js.map +1 -0
  28. package/dist/es/models/routes/IBaseRoute.js.map +1 -1
  29. package/dist/es/models/server/IBaseRouteProcessor.js.map +1 -1
  30. package/dist/es/models/server/IRestRouteProcessor.js.map +1 -1
  31. package/dist/es/models/server/ISocketRouteProcessor.js.map +1 -1
  32. package/dist/es/models/server/IWebServer.js.map +1 -1
  33. package/dist/es/models/server/IWebServerOptions.js.map +1 -1
  34. package/dist/es/models/services/IHealthComponent.js +2 -0
  35. package/dist/es/models/services/IHealthComponent.js.map +1 -0
  36. package/dist/es/models/services/IInformationComponent.js.map +1 -1
  37. package/dist/es/models/services/IPlatformComponent.js +2 -0
  38. package/dist/es/models/services/IPlatformComponent.js.map +1 -0
  39. package/dist/es/models/services/ITenant.js +4 -0
  40. package/dist/es/models/services/ITenant.js.map +1 -0
  41. package/dist/es/models/services/ITenantAdminComponent.js +2 -0
  42. package/dist/es/models/services/ITenantAdminComponent.js.map +1 -0
  43. package/dist/types/errors/forbiddenError.d.ts +20 -0
  44. package/dist/types/errors/tooManyRequestsError.d.ts +22 -0
  45. package/dist/types/helpers/httpErrorHelper.d.ts +6 -0
  46. package/dist/types/helpers/httpUrlHelper.d.ts +70 -0
  47. package/dist/types/index.d.ts +12 -4
  48. package/dist/types/models/api/IServerHealthResponse.d.ts +6 -3
  49. package/dist/types/models/api/IServerLivezResponse.d.ts +16 -0
  50. package/dist/types/models/api/IServerReadyzResponse.d.ts +16 -0
  51. package/dist/types/models/api/IServerRootResponse.d.ts +7 -0
  52. package/dist/types/models/config/IBaseRestClientConfig.d.ts +16 -0
  53. package/dist/types/models/httpContextIdKeys.d.ts +33 -0
  54. package/dist/types/models/protocol/IHttpServerRequest.d.ts +4 -4
  55. package/dist/types/models/responses/errors/IConflictResponse.d.ts +1 -6
  56. package/dist/types/models/responses/errors/INotImplementedResponse.d.ts +15 -0
  57. package/dist/types/models/responses/errors/ITooManyRequestsResponse.d.ts +15 -0
  58. package/dist/types/models/routes/IBaseRoute.d.ts +9 -1
  59. package/dist/types/models/server/IBaseRouteProcessor.d.ts +10 -4
  60. package/dist/types/models/server/IRestRouteProcessor.d.ts +5 -2
  61. package/dist/types/models/server/IWebServer.d.ts +10 -4
  62. package/dist/types/models/server/IWebServerOptions.d.ts +5 -0
  63. package/dist/types/models/services/IHealthComponent.d.ts +14 -0
  64. package/dist/types/models/services/IInformationComponent.d.ts +10 -17
  65. package/dist/types/models/services/IPlatformComponent.d.ts +24 -0
  66. package/dist/types/models/services/ITenant.d.ts +37 -0
  67. package/dist/types/models/services/ITenantAdminComponent.d.ts +70 -0
  68. package/docs/changelog.md +415 -74
  69. package/docs/examples.md +200 -1
  70. package/docs/reference/classes/ForbiddenError.md +55 -0
  71. package/docs/reference/classes/HttpErrorHelper.md +14 -2
  72. package/docs/reference/classes/HttpParameterHelper.md +4 -4
  73. package/docs/reference/classes/HttpUrlHelper.md +259 -0
  74. package/docs/reference/classes/TooManyRequestsError.md +67 -0
  75. package/docs/reference/index.md +13 -5
  76. package/docs/reference/interfaces/IAcceptedResponse.md +2 -2
  77. package/docs/reference/interfaces/IBadRequestResponse.md +2 -2
  78. package/docs/reference/interfaces/IBaseRestClientConfig.md +57 -9
  79. package/docs/reference/interfaces/IBaseRoute.md +25 -9
  80. package/docs/reference/interfaces/IBaseRouteEntryPoint.md +4 -4
  81. package/docs/reference/interfaces/IBaseRouteProcessor.md +21 -13
  82. package/docs/reference/interfaces/IBaseSocketClientConfig.md +7 -7
  83. package/docs/reference/interfaces/IConflictResponse.md +3 -11
  84. package/docs/reference/interfaces/ICreatedResponse.md +2 -2
  85. package/docs/reference/interfaces/IForbiddenResponse.md +2 -2
  86. package/docs/reference/interfaces/IHealthComponent.md +21 -0
  87. package/docs/reference/interfaces/IHttpRequest.md +8 -8
  88. package/docs/reference/interfaces/IHttpRequestContext.md +4 -4
  89. package/docs/reference/interfaces/IHttpRequestPathParams.md +1 -1
  90. package/docs/reference/interfaces/IHttpRequestQuery.md +1 -1
  91. package/docs/reference/interfaces/IHttpResponse.md +6 -6
  92. package/docs/reference/interfaces/IHttpServerRequest.md +14 -14
  93. package/docs/reference/interfaces/IInformationComponent.md +14 -56
  94. package/docs/reference/interfaces/IInternalServerErrorResponse.md +2 -2
  95. package/docs/reference/interfaces/IMimeTypeProcessor.md +2 -2
  96. package/docs/reference/interfaces/INoContentRequest.md +8 -8
  97. package/docs/reference/interfaces/INoContentResponse.md +1 -1
  98. package/docs/reference/interfaces/INotFoundResponse.md +3 -3
  99. package/docs/reference/interfaces/INotImplementedResponse.md +19 -0
  100. package/docs/reference/interfaces/IOkResponse.md +1 -1
  101. package/docs/reference/interfaces/IPlatformComponent.md +65 -0
  102. package/docs/reference/interfaces/IRestRoute.md +47 -23
  103. package/docs/reference/interfaces/IRestRouteExample.md +3 -3
  104. package/docs/reference/interfaces/IRestRouteProcessor.md +31 -19
  105. package/docs/reference/interfaces/IRestRouteRequestExample.md +4 -4
  106. package/docs/reference/interfaces/IRestRouteResponseAttachmentOptions.md +6 -6
  107. package/docs/reference/interfaces/IRestRouteResponseExample.md +4 -4
  108. package/docs/reference/interfaces/IRestRouteResponseOptions.md +2 -2
  109. package/docs/reference/interfaces/IServerFavIconResponse.md +7 -7
  110. package/docs/reference/interfaces/IServerHealthResponse.md +11 -3
  111. package/docs/reference/interfaces/IServerInfo.md +2 -2
  112. package/docs/reference/interfaces/IServerInfoResponse.md +1 -1
  113. package/docs/reference/interfaces/IServerLivezResponse.md +23 -0
  114. package/docs/reference/interfaces/IServerReadyzResponse.md +23 -0
  115. package/docs/reference/interfaces/IServerRootResponse.md +13 -1
  116. package/docs/reference/interfaces/IServerSpecResponse.md +4 -4
  117. package/docs/reference/interfaces/ISocketRequestContext.md +5 -5
  118. package/docs/reference/interfaces/ISocketRoute.md +38 -14
  119. package/docs/reference/interfaces/ISocketRouteProcessor.md +30 -22
  120. package/docs/reference/interfaces/ISocketServerRequest.md +17 -17
  121. package/docs/reference/interfaces/ITag.md +2 -2
  122. package/docs/reference/interfaces/ITenant.md +67 -0
  123. package/docs/reference/interfaces/ITenantAdminComponent.md +227 -0
  124. package/docs/reference/interfaces/ITooManyRequestsResponse.md +19 -0
  125. package/docs/reference/interfaces/IUnauthorizedResponse.md +2 -2
  126. package/docs/reference/interfaces/IUnprocessableEntityResponse.md +2 -2
  127. package/docs/reference/interfaces/IWebServer.md +37 -7
  128. package/docs/reference/interfaces/IWebServerOptions.md +21 -12
  129. package/docs/reference/type-aliases/HttpContextIdKeys.md +5 -0
  130. package/docs/reference/variables/HttpContextIdKeys.md +43 -0
  131. package/package.json +5 -4
  132. package/dist/es/factories/authenticationGeneratorFactory.js +0 -9
  133. package/dist/es/factories/authenticationGeneratorFactory.js.map +0 -1
  134. package/dist/es/models/client/IAuthenticationGenerator.js +0 -2
  135. package/dist/es/models/client/IAuthenticationGenerator.js.map +0 -1
  136. package/dist/es/models/services/IHealthInfo.js +0 -2
  137. package/dist/es/models/services/IHealthInfo.js.map +0 -1
  138. package/dist/es/models/services/healthStatus.js +0 -21
  139. package/dist/es/models/services/healthStatus.js.map +0 -1
  140. package/dist/types/factories/authenticationGeneratorFactory.d.ts +0 -6
  141. package/dist/types/models/client/IAuthenticationGenerator.d.ts +0 -14
  142. package/dist/types/models/services/IHealthInfo.d.ts +0 -27
  143. package/dist/types/models/services/healthStatus.d.ts +0 -21
  144. package/docs/reference/interfaces/IAuthenticationGenerator.md +0 -35
  145. package/docs/reference/interfaces/IHealthInfo.md +0 -37
  146. package/docs/reference/type-aliases/HealthStatus.md +0 -5
  147. package/docs/reference/variables/AuthenticationGeneratorFactory.md +0 -5
  148. package/docs/reference/variables/HealthStatus.md +0 -25
@@ -1 +1 @@
1
- {"version":3,"file":"IWebServer.js","sourceRoot":"","sources":["../../../../src/models/server/IWebServer.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IRestRouteProcessor } from \"./IRestRouteProcessor.js\";\nimport type { ISocketRouteProcessor } from \"./ISocketRouteProcessor.js\";\nimport type { IWebServerOptions } from \"./IWebServerOptions.js\";\nimport type { IRestRoute } from \"../routes/IRestRoute.js\";\nimport type { ISocketRoute } from \"../routes/ISocketRoute.js\";\n\n/**\n * Interface describing a web server.\n */\nexport interface IWebServer<T> {\n\t/**\n\t * Get the web server instance.\n\t * @returns The web server instance.\n\t */\n\tgetInstance(): T;\n\n\t/**\n\t * Build the server.\n\t * @param restRouteProcessors The processors for incoming requests over REST.\n\t * @param restRoutes The REST routes.\n\t * @param socketRouteProcessors The processors for incoming requests over Sockets.\n\t * @param socketRoutes The socket routes.\n\t * @param options Options for building the server.\n\t * @returns Nothing.\n\t */\n\tbuild(\n\t\trestRouteProcessors?: IRestRouteProcessor[],\n\t\trestRoutes?: IRestRoute[],\n\t\tsocketRouteProcessors?: ISocketRouteProcessor[],\n\t\tsocketRoutes?: ISocketRoute[],\n\t\toptions?: IWebServerOptions\n\t): Promise<void>;\n\n\t/**\n\t * Start the server.\n\t * @returns Nothing.\n\t */\n\tstart(): Promise<void>;\n\n\t/**\n\t * Stop the server.\n\t * @returns Nothing.\n\t */\n\tstop(): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"IWebServer.js","sourceRoot":"","sources":["../../../../src/models/server/IWebServer.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent, IHealth } from \"@twin.org/core\";\nimport type { IRestRouteProcessor } from \"./IRestRouteProcessor.js\";\nimport type { ISocketRouteProcessor } from \"./ISocketRouteProcessor.js\";\nimport type { IWebServerOptions } from \"./IWebServerOptions.js\";\nimport type { IRestRoute } from \"../routes/IRestRoute.js\";\nimport type { ISocketRoute } from \"../routes/ISocketRoute.js\";\n\n/**\n * Interface describing a web server.\n */\nexport interface IWebServer<T> extends IComponent {\n\t/**\n\t * Get the web server instance.\n\t * @returns The web server instance.\n\t */\n\tgetInstance(): T;\n\n\t/**\n\t * Build the server.\n\t * @param restRouteProcessors The processors for incoming requests over REST.\n\t * @param restRoutes The REST routes.\n\t * @param socketRouteProcessors The processors for incoming requests over Sockets.\n\t * @param socketRoutes The socket routes.\n\t * @param options Options for building the server.\n\t * @returns A promise that resolves when the server is fully built and ready to start.\n\t */\n\tbuild(\n\t\trestRouteProcessors?: IRestRouteProcessor[],\n\t\trestRoutes?: IRestRoute[],\n\t\tsocketRouteProcessors?: ISocketRouteProcessor[],\n\t\tsocketRoutes?: ISocketRoute[],\n\t\toptions?: IWebServerOptions\n\t): Promise<void>;\n\n\t/**\n\t * Start the server.\n\t * @returns A promise that resolves when the server is listening for connections.\n\t */\n\tstart(): Promise<void>;\n\n\t/**\n\t * Stop the server.\n\t * @returns A promise that resolves when the server has shut down all connections.\n\t */\n\tstop(): Promise<void>;\n\n\t/**\n\t * Returns the health status of the component.\n\t * @returns The health status of the component, can return multiple entries for elements within the component.\n\t */\n\thealth(): Promise<IHealth[]>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IWebServerOptions.js","sourceRoot":"","sources":["../../../../src/models/server/IWebServerOptions.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HttpMethod } from \"@twin.org/web\";\n\n/**\n * Options for the web server.\n */\nexport interface IWebServerOptions {\n\t/**\n\t * The port to bind the web server to.\n\t * @default 3000\n\t */\n\tport?: number;\n\n\t/**\n\t * The address to bind the web server to.\n\t * @default localhost\n\t */\n\thost?: string;\n\n\t/**\n\t * The methods that the server accepts.\n\t * @default [\"GET\", \"PUT\", \"POST\", \"DELETE\", \"OPTIONS\"]\n\t */\n\tmethods?: HttpMethod[];\n\n\t/**\n\t * Any additional allowed headers.\n\t */\n\tallowedHeaders?: string[];\n\n\t/**\n\t * And additional exposed headers.\n\t */\n\texposedHeaders?: string[];\n\n\t/**\n\t * The allowed CORS domains.\n\t * @default [\"*\"]\n\t */\n\tcorsOrigins?: string | string[];\n}\n"]}
1
+ {"version":3,"file":"IWebServerOptions.js","sourceRoot":"","sources":["../../../../src/models/server/IWebServerOptions.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HttpMethod } from \"@twin.org/web\";\n\n/**\n * Options for the web server.\n */\nexport interface IWebServerOptions {\n\t/**\n\t * The port to bind the web server to.\n\t * @default 3000\n\t */\n\tport?: number;\n\n\t/**\n\t * The address to bind the web server to.\n\t * @default localhost\n\t */\n\thost?: string;\n\n\t/**\n\t * The methods that the server accepts.\n\t * @default [\"GET\", \"PUT\", \"POST\", \"DELETE\", \"OPTIONS\"]\n\t */\n\tmethods?: HttpMethod[];\n\n\t/**\n\t * Any additional allowed headers.\n\t */\n\tallowedHeaders?: string[];\n\n\t/**\n\t * And additional exposed headers.\n\t */\n\texposedHeaders?: string[];\n\n\t/**\n\t * The allowed CORS domains.\n\t * @default [\"*\"]\n\t */\n\tcorsOrigins?: string | string[];\n\n\t/**\n\t * The public origin of the server, used for constructing the request URL.\n\t * If not provided, it will be determined from the incoming request.\n\t */\n\tpublicOrigin?: string;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IHealthComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IHealthComponent.js","sourceRoot":"","sources":["../../../../src/models/services/IHealthComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HealthStatus, IComponent, IHealth } from \"@twin.org/core\";\n\n/**\n * The health component for the server.\n */\nexport interface IHealthComponent extends IComponent {\n\t/**\n\t * Get the server health.\n\t * @returns The service health.\n\t */\n\thealthStatus(): Promise<{ status: HealthStatus; components: IHealth[] }>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IInformationComponent.js","sourceRoot":"","sources":["../../../../src/models/services/IInformationComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { HealthStatus } from \"./healthStatus.js\";\nimport type { IHealthInfo } from \"./IHealthInfo.js\";\nimport type { IServerInfo } from \"./IServerInfo.js\";\n\n/**\n * The information component for the server.\n */\nexport interface IInformationComponent extends IComponent {\n\t/**\n\t * Get the root information.\n\t * @returns The root information.\n\t */\n\troot(): Promise<string>;\n\n\t/**\n\t * Get the server information.\n\t * @returns The service information.\n\t */\n\tinfo(): Promise<IServerInfo>;\n\n\t/**\n\t * Get the favicon.\n\t * @returns The favicon.\n\t */\n\tfavicon(): Promise<Uint8Array | undefined>;\n\n\t/**\n\t * Get the OpenAPI spec.\n\t * @returns The OpenAPI spec.\n\t */\n\tspec(): Promise<unknown>;\n\n\t/**\n\t * Get the server health.\n\t * @returns The service health.\n\t */\n\thealth(): Promise<IHealthInfo>;\n\n\t/**\n\t * Set the status of a component.\n\t * @param name The component name.\n\t * @param status The status of the component.\n\t * @param details The details for the status.\n\t * @returns Nothing.\n\t */\n\tsetComponentHealth(name: string, status: HealthStatus, details?: string): Promise<void>;\n\n\t/**\n\t * Remove the status of a component.\n\t * @param name The component name.\n\t * @returns Nothing.\n\t */\n\tremoveComponentHealth(name: string): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"IInformationComponent.js","sourceRoot":"","sources":["../../../../src/models/services/IInformationComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IServerInfo } from \"./IServerInfo.js\";\n\n/**\n * The information component for the server.\n */\nexport interface IInformationComponent extends IComponent {\n\t/**\n\t * Get the root information.\n\t * @returns The root information.\n\t */\n\troot(): Promise<string>;\n\n\t/**\n\t * Get the server information.\n\t * @returns The service information.\n\t */\n\tinfo(): Promise<IServerInfo>;\n\n\t/**\n\t * Get the favicon.\n\t * @returns The favicon.\n\t */\n\tfavicon(): Promise<Uint8Array | undefined>;\n\n\t/**\n\t * Get the OpenAPI spec.\n\t * @returns The OpenAPI spec.\n\t */\n\tspec(): Promise<unknown>;\n\n\t/**\n\t * Is the server live.\n\t * @returns The livez status of the server.\n\t */\n\tlivez(): Promise<{ status: \"alive\" | \"dead\" }>;\n\n\t/**\n\t * Is the server ready.\n\t * @returns The readyz status of the server.\n\t */\n\treadyz(): Promise<{ status: \"ready\" | \"not ready\" }>;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IPlatformComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPlatformComponent.js","sourceRoot":"","sources":["../../../../src/models/services/IPlatformComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IContextIds } from \"@twin.org/context\";\nimport type { IComponent } from \"@twin.org/core\";\n\n/**\n * Interface for the platform component.\n */\nexport interface IPlatformComponent extends IComponent {\n\t/**\n\t * Indicates whether the component is running in a multi-tenant environment.\n\t * @returns True if the component is running in a multi-tenant environment, false otherwise.\n\t */\n\tisMultiTenant(): boolean;\n\n\t/**\n\t * Execute a method, if single tenant will run once, if multi-tenant will run for each tenant.\n\t * @param method The method to run for each tenant.\n\t * @returns A promise that resolves when the method has been executed for all applicable tenants.\n\t */\n\texecute(method: () => Promise<void>): Promise<void>;\n\n\t/**\n\t * Get the local origin context IDs for the given URL.\n\t * @param url The URL to check.\n\t * @returns A promise that resolves to the context IDs if the URL is a local origin, undefined otherwise.\n\t */\n\tgetLocalOriginContext(url: string): Promise<IContextIds | undefined>;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2025 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=ITenant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITenant.js","sourceRoot":"","sources":["../../../../src/models/services/ITenant.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Model defining the tenant.\n */\nexport interface ITenant {\n\t/**\n\t * The unique identifier for the tenant.\n\t */\n\tid: string;\n\n\t/**\n\t * The api key for the tenant.\n\t */\n\tapiKey: string;\n\n\t/**\n\t * The label of the tenant.\n\t */\n\tlabel: string;\n\n\t/**\n\t * The date the tenant was created.\n\t */\n\tdateCreated: string;\n\n\t/**\n\t * The date the tenant was modified.\n\t */\n\tdateModified: string;\n\n\t/**\n\t * The public origin available to the public for accessing the API.\n\t */\n\tpublicOrigin?: string;\n\n\t/**\n\t * The organization id for the tenant.\n\t */\n\torganizationId: string;\n\n\t/**\n\t * Optional list of organization aliases that can are used for legacy lookups.\n\t */\n\torganizationIdLegacy?: string[];\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ITenantAdminComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITenantAdminComponent.js","sourceRoot":"","sources":["../../../../src/models/services/ITenantAdminComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { EntityCondition } from \"@twin.org/entity\";\nimport type { ITenant } from \"./ITenant.js\";\n\n/**\n * Configuration for the tenant admin component\n */\nexport interface ITenantAdminComponent extends IComponent {\n\t/**\n\t * Create a tenant.\n\t * @param tenant The tenant to store.\n\t * @returns The tenant id.\n\t */\n\tcreate(\n\t\ttenant: Omit<ITenant, \"id\" | \"dateCreated\" | \"dateModified\"> & { id?: string }\n\t): Promise<string>;\n\n\t/**\n\t * Update a tenant.\n\t * @param tenant The tenant to update.\n\t * @returns A promise that resolves when the tenant has been updated.\n\t */\n\tupdate(tenant: Partial<Omit<ITenant, \"dateCreated\" | \"dateModified\">>): Promise<void>;\n\n\t/**\n\t * Get a tenant by its id.\n\t * @param tenantId The id of the tenant.\n\t * @returns The tenant.\n\t * @throws Error if the tenant is not found.\n\t */\n\tget(tenantId: string): Promise<ITenant>;\n\n\t/**\n\t * Get a tenant by its api key.\n\t * @param apiKey The api key of the tenant.\n\t * @returns The tenant.\n\t * @throws Error if the tenant is not found.\n\t */\n\tgetByApiKey(apiKey: string): Promise<ITenant>;\n\n\t/**\n\t * Get a tenant by its public origin.\n\t * @param publicOrigin The origin of the tenant.\n\t * @returns The tenant.\n\t * @throws Error if the tenant is not found.\n\t */\n\tgetByPublicOrigin(publicOrigin: string): Promise<ITenant>;\n\n\t/**\n\t * Remove a tenant by its id.\n\t * @param tenantId The id of the tenant.\n\t * @returns A promise that resolves when the tenant has been removed.\n\t * @throws Error if the tenant is not found.\n\t */\n\tremove(tenantId: string): Promise<void>;\n\n\t/**\n\t * Get a tenant by its organization id, optionally searching legacy ids.\n\t * @param organizationId The organization id of the tenant.\n\t * @param includeLegacy Whether to also search the legacy organization id array.\n\t * @returns The tenant.\n\t * @throws Error if the tenant is not found.\n\t */\n\tgetTenantByOrganizationId(organizationId: string, includeLegacy?: boolean): Promise<ITenant>;\n\n\t/**\n\t * Query tenants with pagination.\n\t * @param conditions The conditions to filter the tenants.\n\t * @param properties The properties to include in the returned tenants.\n\t * @param cursor The cursor to start from.\n\t * @param limit The maximum number of tenants to return.\n\t * @returns The tenants and the next cursor if more tenants are available.\n\t */\n\tquery(\n\t\tconditions?: EntityCondition<ITenant>,\n\t\tproperties?: (keyof ITenant)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{ tenants: ITenant[]; cursor?: string }>;\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import { BaseError } from "@twin.org/core";
2
+ /**
3
+ * Class to handle errors which are triggered by forbidden actions.
4
+ */
5
+ export declare class ForbiddenError extends BaseError {
6
+ /**
7
+ * Runtime name for the class.
8
+ */
9
+ static readonly CLASS_NAME: string;
10
+ /**
11
+ * Create a new instance of ForbiddenError.
12
+ * @param source The source of the error.
13
+ * @param message The message as a code.
14
+ * @param properties Any additional information for the error.
15
+ * @param cause The cause of the error if we have wrapped another error.
16
+ */
17
+ constructor(source: string, message: string, properties?: {
18
+ [id: string]: unknown;
19
+ }, cause?: unknown);
20
+ }
@@ -0,0 +1,22 @@
1
+ import { BaseError } from "@twin.org/core";
2
+ /**
3
+ * Class to handle errors which are triggered by too many requests.
4
+ */
5
+ export declare class TooManyRequestsError extends BaseError {
6
+ /**
7
+ * Runtime name for the class.
8
+ */
9
+ static readonly CLASS_NAME: string;
10
+ /**
11
+ * Create a new instance of TooManyRequestsError.
12
+ * @param source The source of the error.
13
+ * @param message The message as a code.
14
+ * @param requestCount The current request count.
15
+ * @param nextRequestTime The time when the next request can be made, as date ISO string.
16
+ * @param properties Any additional information for the error.
17
+ * @param cause The cause of the error if we have wrapped another error.
18
+ */
19
+ constructor(source: string, message: string, requestCount: number, nextRequestTime: string, properties?: {
20
+ [id: string]: unknown;
21
+ }, cause?: unknown);
22
+ }
@@ -5,6 +5,12 @@ import type { IHttpResponse } from "../models/protocol/IHttpResponse.js";
5
5
  * Class to help with processing http errors.
6
6
  */
7
7
  export declare class HttpErrorHelper {
8
+ /**
9
+ * Mapping of error types to status codes.
10
+ */
11
+ static readonly ERROR_TYPE_MAP: {
12
+ [id: string]: HttpStatusCode;
13
+ };
8
14
  /**
9
15
  * Process the errors from the routes.
10
16
  * @param err The error to process.
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Class to help with handling http URLs.
3
+ */
4
+ export declare class HttpUrlHelper {
5
+ /**
6
+ * Extract the origin from the url which includes protocol,host,port.
7
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/URL/origin
8
+ * @param url The url to extract the origin from.
9
+ * @returns The extracted origin.
10
+ */
11
+ static extractOrigin(url: string): string | undefined;
12
+ /**
13
+ * Extract the path from the url.
14
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/URL/pathname
15
+ * @param url The url to extract the path from.
16
+ * @returns The extracted path.
17
+ */
18
+ static extractPath(url: string): string | undefined;
19
+ /**
20
+ * Extract the search from the url.
21
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/URL/search
22
+ * @param url The url to extract the search from.
23
+ * @returns The extracted search.
24
+ */
25
+ static extractSearch(url: string): string | undefined;
26
+ /**
27
+ * Extract the path and search from the url.
28
+ * @param url The url to extract the path and search from.
29
+ * @returns The extracted path and search.
30
+ */
31
+ static extractPathAndSearch(url: string): string | undefined;
32
+ /**
33
+ * Combine the urls parts.
34
+ * @param origin The origin to combine.
35
+ * @param pathAndSearch The path and search to combine.
36
+ * @returns The combined parts.
37
+ */
38
+ static combineParts(origin: string, pathAndSearch: string): string | undefined;
39
+ /**
40
+ * Encode a single URL path segment per RFC 3986 §3.3.
41
+ * Unlike encodeURIComponent, sub-delimiters ($ & + , ; =) and the colon and
42
+ * at-sign characters that are valid unencoded in path segments are preserved.
43
+ * @see https://datatracker.ietf.org/doc/html/rfc3986#section-3.3
44
+ * @param segment The raw path segment value to encode.
45
+ * @returns The percent-encoded path segment.
46
+ */
47
+ static encodeUriPathSegment(segment: string): string;
48
+ /**
49
+ * Replace the origin in the url.
50
+ * @param url The url to replace the origin in.
51
+ * @param newOrigin The new origin to use.
52
+ * @returns The url with the replaced origin.
53
+ */
54
+ static replaceOrigin(url: string, newOrigin?: string): string;
55
+ /**
56
+ * Add a query string parameter to the url.
57
+ * @param url The url to add the query string parameter to.
58
+ * @param key The key of the query string parameter.
59
+ * @param value The value of the query string parameter.
60
+ * @returns The url with the added query string parameter.
61
+ */
62
+ static addQueryStringParam(url: string, key: string, value: string): string;
63
+ /**
64
+ * Get a query string parameter from the url.
65
+ * @param url The url to get the query string parameter from.
66
+ * @param key The key of the query string parameter.
67
+ * @returns The value of the query string parameter.
68
+ */
69
+ static getQueryStringParam(url: string, key: string): string | undefined;
70
+ }
@@ -1,17 +1,21 @@
1
- export * from "./factories/authenticationGeneratorFactory.js";
1
+ export * from "./errors/forbiddenError.js";
2
+ export * from "./errors/tooManyRequestsError.js";
2
3
  export * from "./factories/mimeTypeProcessorFactory.js";
3
4
  export * from "./factories/restRouteProcessorFactory.js";
4
5
  export * from "./factories/socketRouteProcessorFactory.js";
5
6
  export * from "./helpers/httpErrorHelper.js";
6
7
  export * from "./helpers/httpParameterHelper.js";
8
+ export * from "./helpers/httpUrlHelper.js";
7
9
  export * from "./models/api/IServerFavIconResponse.js";
8
10
  export * from "./models/api/IServerHealthResponse.js";
9
11
  export * from "./models/api/IServerInfoResponse.js";
12
+ export * from "./models/api/IServerLivezResponse.js";
13
+ export * from "./models/api/IServerReadyzResponse.js";
10
14
  export * from "./models/api/IServerRootResponse.js";
11
15
  export * from "./models/api/IServerSpecResponse.js";
12
- export * from "./models/client/IAuthenticationGenerator.js";
13
16
  export * from "./models/config/IBaseRestClientConfig.js";
14
17
  export * from "./models/config/IBaseSocketClientConfig.js";
18
+ export * from "./models/httpContextIdKeys.js";
15
19
  export * from "./models/protocol/IHttpRequest.js";
16
20
  export * from "./models/protocol/IHttpRequestContext.js";
17
21
  export * from "./models/protocol/IHttpRequestPathParams.js";
@@ -26,6 +30,8 @@ export * from "./models/responses/errors/IConflictResponse.js";
26
30
  export * from "./models/responses/errors/IForbiddenResponse.js";
27
31
  export * from "./models/responses/errors/IInternalServerErrorResponse.js";
28
32
  export * from "./models/responses/errors/INotFoundResponse.js";
33
+ export * from "./models/responses/errors/INotImplementedResponse.js";
34
+ export * from "./models/responses/errors/ITooManyRequestsResponse.js";
29
35
  export * from "./models/responses/errors/IUnauthorizedResponse.js";
30
36
  export * from "./models/responses/errors/IUnprocessableEntityResponse.js";
31
37
  export * from "./models/responses/success/IAcceptedResponse.js";
@@ -50,7 +56,9 @@ export * from "./models/server/IRestRouteProcessor.js";
50
56
  export * from "./models/server/ISocketRouteProcessor.js";
51
57
  export * from "./models/server/IWebServer.js";
52
58
  export * from "./models/server/IWebServerOptions.js";
53
- export * from "./models/services/healthStatus.js";
54
- export * from "./models/services/IHealthInfo.js";
59
+ export * from "./models/services/IHealthComponent.js";
55
60
  export * from "./models/services/IInformationComponent.js";
61
+ export * from "./models/services/IPlatformComponent.js";
56
62
  export * from "./models/services/IServerInfo.js";
63
+ export * from "./models/services/ITenant.js";
64
+ export * from "./models/services/ITenantAdminComponent.js";
@@ -1,10 +1,13 @@
1
- import type { IHealthInfo } from "../services/IHealthInfo.js";
1
+ import type { HealthStatus, IHealth } from "@twin.org/core";
2
2
  /**
3
3
  * The health of the server.
4
4
  */
5
5
  export interface IServerHealthResponse {
6
6
  /**
7
- * The information for the server.
7
+ * The health for the server.
8
8
  */
9
- body: IHealthInfo;
9
+ body: {
10
+ status: HealthStatus;
11
+ components: IHealth[];
12
+ };
10
13
  }
@@ -0,0 +1,16 @@
1
+ import type { HeaderTypes, MimeTypes } from "@twin.org/web";
2
+ /**
3
+ * The livez of the server.
4
+ */
5
+ export interface IServerLivezResponse {
6
+ /**
7
+ * The headers for the response.
8
+ */
9
+ headers: {
10
+ [HeaderTypes.ContentType]: typeof MimeTypes.PlainText;
11
+ };
12
+ /**
13
+ * The livez information for the server.
14
+ */
15
+ body: "alive" | "dead";
16
+ }
@@ -0,0 +1,16 @@
1
+ import type { HeaderTypes, MimeTypes } from "@twin.org/web";
2
+ /**
3
+ * The readyz of the server.
4
+ */
5
+ export interface IServerReadyzResponse {
6
+ /**
7
+ * The headers for the response.
8
+ */
9
+ headers: {
10
+ [HeaderTypes.ContentType]: typeof MimeTypes.PlainText;
11
+ };
12
+ /**
13
+ * The readyz information for the server.
14
+ */
15
+ body: "ready" | "not ready";
16
+ }
@@ -1,7 +1,14 @@
1
+ import type { HeaderTypes, MimeTypes } from "@twin.org/web";
1
2
  /**
2
3
  * The root text for the server.
3
4
  */
4
5
  export interface IServerRootResponse {
6
+ /**
7
+ * The headers for the response.
8
+ */
9
+ headers: {
10
+ [HeaderTypes.ContentType]: typeof MimeTypes.PlainText;
11
+ };
5
12
  /**
6
13
  * The root text for the server.
7
14
  */
@@ -1,3 +1,4 @@
1
+ import type { IError } from "@twin.org/core";
1
2
  import type { IHttpHeaders } from "@twin.org/web";
2
3
  /**
3
4
  * Definition for the configuration of a rest client.
@@ -23,4 +24,19 @@ export interface IBaseRestClientConfig {
23
24
  * Include credentials in the request, defaults to true.
24
25
  */
25
26
  includeCredentials?: boolean;
27
+ /**
28
+ * Hook to provide headers asynchronously.
29
+ * @returns A promise that resolves to the headers.
30
+ */
31
+ customHeaders?: () => Promise<IHttpHeaders>;
32
+ /**
33
+ * Hook to provide an authorization header value asynchronously.
34
+ * @returns A promise that resolves to the authorization header value.
35
+ */
36
+ customAuthHeader?: () => Promise<string>;
37
+ /**
38
+ * Hook to handle authorization failures asynchronously.
39
+ * @returns A promise that resolves when the auth failure handling is complete.
40
+ */
41
+ onAuthFailure?: (err: IError) => Promise<void>;
26
42
  }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * HTTP definition of some context keys.
3
+ */
4
+ export declare const HttpContextIdKeys: {
5
+ /**
6
+ * IP address of the client.
7
+ */
8
+ readonly IpAddress: "ipAddress";
9
+ /**
10
+ * User agent of the client.
11
+ */
12
+ readonly UserAgent: "userAgent";
13
+ /**
14
+ * Correlation ID of the request.
15
+ */
16
+ readonly CorrelationId: "correlationId";
17
+ /**
18
+ * Is this a remote request, will be a random UUID if request arrived through a REST endpoint, otherwise undefined.
19
+ */
20
+ readonly RemoteRequest: "remoteRequest";
21
+ /**
22
+ * Public Origin of the request.
23
+ */
24
+ readonly PublicOrigin: "publicOrigin";
25
+ /**
26
+ * Local Origin of the request.
27
+ */
28
+ readonly LocalOrigin: "localOrigin";
29
+ };
30
+ /**
31
+ * HTTP definition of some context keys.
32
+ */
33
+ export type HttpContextIdKeys = (typeof HttpContextIdKeys)[keyof typeof HttpContextIdKeys];
@@ -5,11 +5,11 @@ import type { IHttpRequest } from "./IHttpRequest.js";
5
5
  */
6
6
  export interface IHttpServerRequest<T = any> extends IHttpRequest<T> {
7
7
  /**
8
- * The request method.
8
+ * The request url.
9
9
  */
10
- method?: HttpMethod;
10
+ url: string;
11
11
  /**
12
- * The request url.
12
+ * The request method.
13
13
  */
14
- url?: string;
14
+ method?: HttpMethod;
15
15
  }
@@ -11,10 +11,5 @@ export interface IConflictResponse {
11
11
  /**
12
12
  * The body which contains the error.
13
13
  */
14
- body: IError & {
15
- /**
16
- * The conflicting items.
17
- */
18
- conflicts: string[];
19
- };
14
+ body: IError;
20
15
  }
@@ -0,0 +1,15 @@
1
+ import type { IError } from "@twin.org/core";
2
+ import type { HttpStatusCode } from "@twin.org/web";
3
+ /**
4
+ * The operation that you tried to perform is not implemented, see the content for more details.
5
+ */
6
+ export interface INotImplementedResponse {
7
+ /**
8
+ * Response status code.
9
+ */
10
+ statusCode: typeof HttpStatusCode.notImplemented;
11
+ /**
12
+ * The body which contains the error.
13
+ */
14
+ body: IError;
15
+ }
@@ -0,0 +1,15 @@
1
+ import type { IError } from "@twin.org/core";
2
+ import type { HttpStatusCode } from "@twin.org/web";
3
+ /**
4
+ * The request resulted in too many requests, see the content for more details.
5
+ */
6
+ export interface ITooManyRequestsResponse {
7
+ /**
8
+ * Response status code.
9
+ */
10
+ statusCode: typeof HttpStatusCode.tooManyRequests;
11
+ /**
12
+ * The body which contains the error.
13
+ */
14
+ body: IError;
15
+ }
@@ -11,9 +11,17 @@ export interface IBaseRoute {
11
11
  */
12
12
  path: string;
13
13
  /**
14
- * Skips the authentication for this route.
14
+ * Skips the authentication requirement for this route.
15
15
  */
16
16
  skipAuth?: boolean;
17
+ /**
18
+ * Skips the tenant requirement for this route.
19
+ */
20
+ skipTenant?: boolean;
21
+ /**
22
+ * The user must have one of the specified scopes to access the route.
23
+ */
24
+ requiredScope?: string[];
17
25
  /**
18
26
  * The features supported by additional processors to run for this route.
19
27
  */
@@ -21,12 +21,15 @@ export interface IBaseRouteProcessor<T = IBaseRoute, R = IHttpServerRequest> ext
21
21
  * @param route The route being requested, if a matching one was found.
22
22
  * @param contextIds The context IDs of the request.
23
23
  * @param processorState The state handed through the processors.
24
- * @param loggingComponentType The logging component type for the request.
24
+ * @param componentTypes The component types for the request.
25
+ * @param componentTypes.loggingComponentType The logging component type.
25
26
  * @returns Promise that resolves when the request is processed.
26
27
  */
27
28
  pre?(request: R, response: IHttpResponse, route: T | undefined, contextIds: IContextIds, processorState: {
28
29
  [id: string]: unknown;
29
- }, loggingComponentType?: string): Promise<void>;
30
+ }, componentTypes?: {
31
+ loggingComponentType?: string;
32
+ }): Promise<void>;
30
33
  /**
31
34
  * Post process the REST request for the specified route.
32
35
  * @param request The request to handle.
@@ -34,10 +37,13 @@ export interface IBaseRouteProcessor<T = IBaseRoute, R = IHttpServerRequest> ext
34
37
  * @param route The route being requested, if a matching one was found.
35
38
  * @param contextIds The context IDs of the request.
36
39
  * @param processorState The state handed through the processors.
37
- * @param loggingComponentType The logging component type for the request.
40
+ * @param componentTypes The component types for the request.
41
+ * @param componentTypes.loggingComponentType The logging component type.
38
42
  * @returns Promise that resolves when the request is processed.
39
43
  */
40
44
  post?(request: R, response: IHttpResponse, route: T | undefined, contextIds: IContextIds, processorState: {
41
45
  [id: string]: unknown;
42
- }, loggingComponentType?: string): Promise<void>;
46
+ }, componentTypes?: {
47
+ loggingComponentType?: string;
48
+ }): Promise<void>;
43
49
  }
@@ -12,10 +12,13 @@ export interface IRestRouteProcessor extends IBaseRouteProcessor<IRestRoute> {
12
12
  * @param response The response data to send if any.
13
13
  * @param route The route being requested, if a matching one was found.
14
14
  * @param processorState The state handed through the processors.
15
- * @param loggingComponentType The logging component type for the request.
15
+ * @param componentTypes The component types for the request.
16
+ * @param componentTypes.loggingComponentType The logging component type.
16
17
  * @returns Promise that resolves when the request is processed.
17
18
  */
18
19
  process?(request: IHttpServerRequest, response: IHttpResponse, route: IRestRoute | undefined, processorState: {
19
20
  [id: string]: unknown;
20
- }, loggingComponentType?: string): Promise<void>;
21
+ }, componentTypes?: {
22
+ loggingComponentType?: string;
23
+ }): Promise<void>;
21
24
  }
@@ -1,3 +1,4 @@
1
+ import type { IComponent, IHealth } from "@twin.org/core";
1
2
  import type { IRestRouteProcessor } from "./IRestRouteProcessor.js";
2
3
  import type { ISocketRouteProcessor } from "./ISocketRouteProcessor.js";
3
4
  import type { IWebServerOptions } from "./IWebServerOptions.js";
@@ -6,7 +7,7 @@ import type { ISocketRoute } from "../routes/ISocketRoute.js";
6
7
  /**
7
8
  * Interface describing a web server.
8
9
  */
9
- export interface IWebServer<T> {
10
+ export interface IWebServer<T> extends IComponent {
10
11
  /**
11
12
  * Get the web server instance.
12
13
  * @returns The web server instance.
@@ -19,17 +20,22 @@ export interface IWebServer<T> {
19
20
  * @param socketRouteProcessors The processors for incoming requests over Sockets.
20
21
  * @param socketRoutes The socket routes.
21
22
  * @param options Options for building the server.
22
- * @returns Nothing.
23
+ * @returns A promise that resolves when the server is fully built and ready to start.
23
24
  */
24
25
  build(restRouteProcessors?: IRestRouteProcessor[], restRoutes?: IRestRoute[], socketRouteProcessors?: ISocketRouteProcessor[], socketRoutes?: ISocketRoute[], options?: IWebServerOptions): Promise<void>;
25
26
  /**
26
27
  * Start the server.
27
- * @returns Nothing.
28
+ * @returns A promise that resolves when the server is listening for connections.
28
29
  */
29
30
  start(): Promise<void>;
30
31
  /**
31
32
  * Stop the server.
32
- * @returns Nothing.
33
+ * @returns A promise that resolves when the server has shut down all connections.
33
34
  */
34
35
  stop(): Promise<void>;
36
+ /**
37
+ * Returns the health status of the component.
38
+ * @returns The health status of the component, can return multiple entries for elements within the component.
39
+ */
40
+ health(): Promise<IHealth[]>;
35
41
  }
@@ -31,4 +31,9 @@ export interface IWebServerOptions {
31
31
  * @default ["*"]
32
32
  */
33
33
  corsOrigins?: string | string[];
34
+ /**
35
+ * The public origin of the server, used for constructing the request URL.
36
+ * If not provided, it will be determined from the incoming request.
37
+ */
38
+ publicOrigin?: string;
34
39
  }
@@ -0,0 +1,14 @@
1
+ import type { HealthStatus, IComponent, IHealth } from "@twin.org/core";
2
+ /**
3
+ * The health component for the server.
4
+ */
5
+ export interface IHealthComponent extends IComponent {
6
+ /**
7
+ * Get the server health.
8
+ * @returns The service health.
9
+ */
10
+ healthStatus(): Promise<{
11
+ status: HealthStatus;
12
+ components: IHealth[];
13
+ }>;
14
+ }
@@ -1,6 +1,4 @@
1
1
  import type { IComponent } from "@twin.org/core";
2
- import type { HealthStatus } from "./healthStatus.js";
3
- import type { IHealthInfo } from "./IHealthInfo.js";
4
2
  import type { IServerInfo } from "./IServerInfo.js";
5
3
  /**
6
4
  * The information component for the server.
@@ -27,22 +25,17 @@ export interface IInformationComponent extends IComponent {
27
25
  */
28
26
  spec(): Promise<unknown>;
29
27
  /**
30
- * Get the server health.
31
- * @returns The service health.
28
+ * Is the server live.
29
+ * @returns The livez status of the server.
32
30
  */
33
- health(): Promise<IHealthInfo>;
31
+ livez(): Promise<{
32
+ status: "alive" | "dead";
33
+ }>;
34
34
  /**
35
- * Set the status of a component.
36
- * @param name The component name.
37
- * @param status The status of the component.
38
- * @param details The details for the status.
39
- * @returns Nothing.
35
+ * Is the server ready.
36
+ * @returns The readyz status of the server.
40
37
  */
41
- setComponentHealth(name: string, status: HealthStatus, details?: string): Promise<void>;
42
- /**
43
- * Remove the status of a component.
44
- * @param name The component name.
45
- * @returns Nothing.
46
- */
47
- removeComponentHealth(name: string): Promise<void>;
38
+ readyz(): Promise<{
39
+ status: "ready" | "not ready";
40
+ }>;
48
41
  }