@twin.org/api-models 0.0.3-next.45 → 0.0.3-next.47
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/index.js +0 -1
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/httpContextIdKeys.js +9 -1
- package/dist/es/models/httpContextIdKeys.js.map +1 -1
- package/dist/es/models/protocol/IHttpRequestContext.js.map +1 -1
- package/dist/es/models/server/IBaseRouteProcessor.js.map +1 -1
- package/dist/es/models/server/IRestRouteProcessor.js.map +1 -1
- package/dist/es/models/server/IWebServerOptions.js.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/models/httpContextIdKeys.d.ts +8 -0
- package/dist/types/models/protocol/IHttpRequestContext.d.ts +0 -4
- package/dist/types/models/server/IBaseRouteProcessor.d.ts +0 -4
- package/dist/types/models/server/IRestRouteProcessor.d.ts +0 -2
- package/dist/types/models/server/IWebServerOptions.d.ts +5 -0
- package/docs/changelog.md +14 -0
- package/docs/reference/index.md +0 -1
- package/docs/reference/interfaces/IBaseRouteProcessor.md +0 -12
- package/docs/reference/interfaces/IHttpRequestContext.md +0 -8
- package/docs/reference/interfaces/IRestRouteProcessor.md +0 -18
- package/docs/reference/interfaces/ISocketRequestContext.md +0 -12
- package/docs/reference/interfaces/ISocketRouteProcessor.md +0 -12
- package/docs/reference/interfaces/IWebServerOptions.md +9 -0
- package/docs/reference/variables/HttpContextIdKeys.md +12 -0
- package/package.json +1 -1
- package/dist/es/models/services/IHostingComponent.js +0 -2
- package/dist/es/models/services/IHostingComponent.js.map +0 -1
- package/dist/types/models/services/IHostingComponent.d.ts +0 -30
- package/docs/reference/interfaces/IHostingComponent.md +0 -95
package/dist/es/index.js
CHANGED
|
@@ -59,7 +59,6 @@ export * from "./models/server/ISocketRouteProcessor.js";
|
|
|
59
59
|
export * from "./models/server/IWebServer.js";
|
|
60
60
|
export * from "./models/server/IWebServerOptions.js";
|
|
61
61
|
export * from "./models/services/IHealthComponent.js";
|
|
62
|
-
export * from "./models/services/IHostingComponent.js";
|
|
63
62
|
export * from "./models/services/IInformationComponent.js";
|
|
64
63
|
export * from "./models/services/IPlatformComponent.js";
|
|
65
64
|
export * from "./models/services/IServerInfo.js";
|
package/dist/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wCAAwC,CAAC;AACvD,cAAc,uCAAuC,CAAC;AACtD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,0CAA0C,CAAC;AACzD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wCAAwC,CAAC;AACvD,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wCAAwC,CAAC;AACvD,cAAc,kDAAkD,CAAC;AACjE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,iDAAiD,CAAC;AAChE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,gDAAgD,CAAC;AAC/D,cAAc,sDAAsD,CAAC;AACrE,cAAc,uDAAuD,CAAC;AACtE,cAAc,oDAA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AAC7C,cAAc,4CAA4C,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./errors/forbiddenError.js\";\nexport * from \"./errors/tooManyRequestsError.js\";\nexport * from \"./factories/mimeTypeProcessorFactory.js\";\nexport * from \"./factories/restRouteProcessorFactory.js\";\nexport * from \"./factories/socketRouteProcessorFactory.js\";\nexport * from \"./helpers/httpErrorHelper.js\";\nexport * from \"./helpers/httpParameterHelper.js\";\nexport * from \"./helpers/httpUrlHelper.js\";\nexport * from \"./models/api/IServerFavIconResponse.js\";\nexport * from \"./models/api/IServerHealthResponse.js\";\nexport * from \"./models/api/IServerInfoResponse.js\";\nexport * from \"./models/api/IServerLivezResponse.js\";\nexport * from \"./models/api/IServerReadyzResponse.js\";\nexport * from \"./models/api/IServerRootResponse.js\";\nexport * from \"./models/api/IServerSpecResponse.js\";\nexport * from \"./models/config/IBaseRestClientConfig.js\";\nexport * from \"./models/config/IBaseSocketClientConfig.js\";\nexport * from \"./models/httpContextIdKeys.js\";\nexport * from \"./models/protocol/IHttpRequest.js\";\nexport * from \"./models/protocol/IHttpRequestContext.js\";\nexport * from \"./models/protocol/IHttpRequestPathParams.js\";\nexport * from \"./models/protocol/IHttpRequestQuery.js\";\nexport * from \"./models/protocol/IHttpResponse.js\";\nexport * from \"./models/protocol/IHttpServerRequest.js\";\nexport * from \"./models/protocol/ISocketRequestContext.js\";\nexport * from \"./models/protocol/ISocketServerRequest.js\";\nexport * from \"./models/requests/INoContentRequest.js\";\nexport * from \"./models/responses/errors/IBadRequestResponse.js\";\nexport * from \"./models/responses/errors/IConflictResponse.js\";\nexport * from \"./models/responses/errors/IForbiddenResponse.js\";\nexport * from \"./models/responses/errors/IInternalServerErrorResponse.js\";\nexport * from \"./models/responses/errors/INotFoundResponse.js\";\nexport * from \"./models/responses/errors/INotImplementedResponse.js\";\nexport * from \"./models/responses/errors/ITooManyRequestsResponse.js\";\nexport * from \"./models/responses/errors/IUnauthorizedResponse.js\";\nexport * from \"./models/responses/errors/IUnprocessableEntityResponse.js\";\nexport * from \"./models/responses/success/IAcceptedResponse.js\";\nexport * from \"./models/responses/success/ICreatedResponse.js\";\nexport * from \"./models/responses/success/INoContentResponse.js\";\nexport * from \"./models/responses/success/IOkResponse.js\";\nexport * from \"./models/routes/IBaseRoute.js\";\nexport * from \"./models/routes/IBaseRouteEntryPoint.js\";\nexport * from \"./models/routes/IRestRoute.js\";\nexport * from \"./models/routes/IRestRouteEntryPoint.js\";\nexport * from \"./models/routes/IRestRouteExample.js\";\nexport * from \"./models/routes/IRestRouteRequestExample.js\";\nexport * from \"./models/routes/IRestRouteResponseAttachmentOptions.js\";\nexport * from \"./models/routes/IRestRouteResponseExample.js\";\nexport * from \"./models/routes/IRestRouteResponseOptions.js\";\nexport * from \"./models/routes/ISocketRoute.js\";\nexport * from \"./models/routes/ISocketRouteEntryPoint.js\";\nexport * from \"./models/routes/ITag.js\";\nexport * from \"./models/server/IBaseRouteProcessor.js\";\nexport * from \"./models/server/IMimeTypeProcessor.js\";\nexport * from \"./models/server/IRestRouteProcessor.js\";\nexport * from \"./models/server/ISocketRouteProcessor.js\";\nexport * from \"./models/server/IWebServer.js\";\nexport * from \"./models/server/IWebServerOptions.js\";\nexport * from \"./models/services/IHealthComponent.js\";\nexport * from \"./models/services/IInformationComponent.js\";\nexport * from \"./models/services/IPlatformComponent.js\";\nexport * from \"./models/services/IServerInfo.js\";\nexport * from \"./models/services/ITenant.js\";\nexport * from \"./models/services/ITenantAdminComponent.js\";\n"]}
|
|
@@ -16,6 +16,14 @@ export const HttpContextIdKeys = {
|
|
|
16
16
|
/**
|
|
17
17
|
* Correlation ID of the request.
|
|
18
18
|
*/
|
|
19
|
-
CorrelationId: "correlationId"
|
|
19
|
+
CorrelationId: "correlationId",
|
|
20
|
+
/**
|
|
21
|
+
* Public Origin of the request.
|
|
22
|
+
*/
|
|
23
|
+
PublicOrigin: "publicOrigin",
|
|
24
|
+
/**
|
|
25
|
+
* Local Origin of the request.
|
|
26
|
+
*/
|
|
27
|
+
LocalOrigin: "localOrigin"
|
|
20
28
|
};
|
|
21
29
|
//# sourceMappingURL=httpContextIdKeys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpContextIdKeys.js","sourceRoot":"","sources":["../../../src/models/httpContextIdKeys.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC;;OAEG;IACH,SAAS,EAAE,WAAW;IAEtB;;OAEG;IACH,SAAS,EAAE,WAAW;IAEtB;;OAEG;IACH,aAAa,EAAE,eAAe;
|
|
1
|
+
{"version":3,"file":"httpContextIdKeys.js","sourceRoot":"","sources":["../../../src/models/httpContextIdKeys.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC;;OAEG;IACH,SAAS,EAAE,WAAW;IAEtB;;OAEG;IACH,SAAS,EAAE,WAAW;IAEtB;;OAEG;IACH,aAAa,EAAE,eAAe;IAE9B;;OAEG;IACH,YAAY,EAAE,cAAc;IAE5B;;OAEG;IACH,WAAW,EAAE,aAAa;CACjB,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * HTTP definition of some context keys.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const HttpContextIdKeys = {\n\t/**\n\t * IP address of the client.\n\t */\n\tIpAddress: \"ipAddress\",\n\n\t/**\n\t * User agent of the client.\n\t */\n\tUserAgent: \"userAgent\",\n\n\t/**\n\t * Correlation ID of the request.\n\t */\n\tCorrelationId: \"correlationId\",\n\n\t/**\n\t * Public Origin of the request.\n\t */\n\tPublicOrigin: \"publicOrigin\",\n\n\t/**\n\t * Local Origin of the request.\n\t */\n\tLocalOrigin: \"localOrigin\"\n} as const;\n\n/**\n * HTTP definition of some context keys.\n */\nexport type HttpContextIdKeys = (typeof HttpContextIdKeys)[keyof typeof HttpContextIdKeys];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IHttpRequestContext.js","sourceRoot":"","sources":["../../../../src/models/protocol/IHttpRequestContext.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IHttpServerRequest } from \"./IHttpServerRequest.js\";\n\n/**\n * Context data from the HTTP request.\n */\nexport interface IHttpRequestContext {\n\t/**\n\t * The raw HTTP request.\n\t */\n\tserverRequest: IHttpServerRequest;\n\n\t/**\n\t * The state handed through the processors.\n\t */\n\tprocessorState: { [id: string]: unknown };\n\n\t/**\n\t * Logging component type for the request.\n\t */\n\tloggingComponentType?: string;\n
|
|
1
|
+
{"version":3,"file":"IHttpRequestContext.js","sourceRoot":"","sources":["../../../../src/models/protocol/IHttpRequestContext.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IHttpServerRequest } from \"./IHttpServerRequest.js\";\n\n/**\n * Context data from the HTTP request.\n */\nexport interface IHttpRequestContext {\n\t/**\n\t * The raw HTTP request.\n\t */\n\tserverRequest: IHttpServerRequest;\n\n\t/**\n\t * The state handed through the processors.\n\t */\n\tprocessorState: { [id: string]: unknown };\n\n\t/**\n\t * Logging component type for the request.\n\t */\n\tloggingComponentType?: string;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IBaseRouteProcessor.js","sourceRoot":"","sources":["../../../../src/models/server/IBaseRouteProcessor.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IContextIds } from \"@twin.org/context\";\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IHttpResponse } from \"../protocol/IHttpResponse.js\";\nimport type { IHttpServerRequest } from \"../protocol/IHttpServerRequest.js\";\nimport type { IBaseRoute } from \"../routes/IBaseRoute.js\";\n\n/**\n * The definition for a base processor for handling REST routes.\n */\nexport interface IBaseRouteProcessor<T = IBaseRoute, R = IHttpServerRequest> extends IComponent {\n\t/**\n\t * Features supported by this processor.\n\t * If a route has any of these features listed, this processor will be run for that route.\n\t * If this is not implemented, the processor will run for all routes.\n\t * @returns The features supported by this processor.\n\t */\n\tfeatures?(): string[];\n\n\t/**\n\t * Pre process the REST request for the specified route.\n\t * @param request The request to handle.\n\t * @param response The response data to send if any.\n\t * @param route The route being requested, if a matching one was found.\n\t * @param contextIds The context IDs of the request.\n\t * @param processorState The state handed through the processors.\n\t * @param componentTypes The component types for the request.\n\t * @param componentTypes.loggingComponentType The logging component type.\n\t * @
|
|
1
|
+
{"version":3,"file":"IBaseRouteProcessor.js","sourceRoot":"","sources":["../../../../src/models/server/IBaseRouteProcessor.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IContextIds } from \"@twin.org/context\";\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IHttpResponse } from \"../protocol/IHttpResponse.js\";\nimport type { IHttpServerRequest } from \"../protocol/IHttpServerRequest.js\";\nimport type { IBaseRoute } from \"../routes/IBaseRoute.js\";\n\n/**\n * The definition for a base processor for handling REST routes.\n */\nexport interface IBaseRouteProcessor<T = IBaseRoute, R = IHttpServerRequest> extends IComponent {\n\t/**\n\t * Features supported by this processor.\n\t * If a route has any of these features listed, this processor will be run for that route.\n\t * If this is not implemented, the processor will run for all routes.\n\t * @returns The features supported by this processor.\n\t */\n\tfeatures?(): string[];\n\n\t/**\n\t * Pre process the REST request for the specified route.\n\t * @param request The request to handle.\n\t * @param response The response data to send if any.\n\t * @param route The route being requested, if a matching one was found.\n\t * @param contextIds The context IDs of the request.\n\t * @param processorState The state handed through the processors.\n\t * @param componentTypes The component types for the request.\n\t * @param componentTypes.loggingComponentType The logging component type.\n\t * @returns Promise that resolves when the request is processed.\n\t */\n\tpre?(\n\t\trequest: R,\n\t\tresponse: IHttpResponse,\n\t\troute: T | undefined,\n\t\tcontextIds: IContextIds,\n\t\tprocessorState: { [id: string]: unknown },\n\t\tcomponentTypes?: {\n\t\t\tloggingComponentType?: string;\n\t\t}\n\t): Promise<void>;\n\n\t/**\n\t * Post process the REST request for the specified route.\n\t * @param request The request to handle.\n\t * @param response The response data to send if any.\n\t * @param route The route being requested, if a matching one was found.\n\t * @param contextIds The context IDs of the request.\n\t * @param processorState The state handed through the processors.\n\t * @param componentTypes The component types for the request.\n\t * @param componentTypes.loggingComponentType The logging component type.\n\t * @returns Promise that resolves when the request is processed.\n\t */\n\tpost?(\n\t\trequest: R,\n\t\tresponse: IHttpResponse,\n\t\troute: T | undefined,\n\t\tcontextIds: IContextIds,\n\t\tprocessorState: { [id: string]: unknown },\n\t\tcomponentTypes?: {\n\t\t\tloggingComponentType?: string;\n\t\t}\n\t): Promise<void>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IRestRouteProcessor.js","sourceRoot":"","sources":["../../../../src/models/server/IRestRouteProcessor.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IBaseRouteProcessor } from \"./IBaseRouteProcessor.js\";\nimport type { IHttpResponse } from \"../protocol/IHttpResponse.js\";\nimport type { IHttpServerRequest } from \"../protocol/IHttpServerRequest.js\";\nimport type { IRestRoute } from \"../routes/IRestRoute.js\";\n\n/**\n * The definition for a processor for handling REST routes.\n */\nexport interface IRestRouteProcessor extends IBaseRouteProcessor<IRestRoute> {\n\t/**\n\t * Process the REST request for the specified route.\n\t * @param request The request to handle.\n\t * @param response The response data to send if any.\n\t * @param route The route being requested, if a matching one was found.\n\t * @param processorState The state handed through the processors.\n\t * @param componentTypes The component types for the request.\n\t * @param componentTypes.loggingComponentType The logging component type.\n\t * @
|
|
1
|
+
{"version":3,"file":"IRestRouteProcessor.js","sourceRoot":"","sources":["../../../../src/models/server/IRestRouteProcessor.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IBaseRouteProcessor } from \"./IBaseRouteProcessor.js\";\nimport type { IHttpResponse } from \"../protocol/IHttpResponse.js\";\nimport type { IHttpServerRequest } from \"../protocol/IHttpServerRequest.js\";\nimport type { IRestRoute } from \"../routes/IRestRoute.js\";\n\n/**\n * The definition for a processor for handling REST routes.\n */\nexport interface IRestRouteProcessor extends IBaseRouteProcessor<IRestRoute> {\n\t/**\n\t * Process the REST request for the specified route.\n\t * @param request The request to handle.\n\t * @param response The response data to send if any.\n\t * @param route The route being requested, if a matching one was found.\n\t * @param processorState The state handed through the processors.\n\t * @param componentTypes The component types for the request.\n\t * @param componentTypes.loggingComponentType The logging component type.\n\t * @returns Promise that resolves when the request is processed.\n\t */\n\tprocess?(\n\t\trequest: IHttpServerRequest,\n\t\tresponse: IHttpResponse,\n\t\troute: IRestRoute | undefined,\n\t\tprocessorState: { [id: string]: unknown },\n\t\tcomponentTypes?: {\n\t\t\tloggingComponentType?: string;\n\t\t}\n\t): Promise<void>;\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"]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -57,7 +57,6 @@ export * from "./models/server/ISocketRouteProcessor.js";
|
|
|
57
57
|
export * from "./models/server/IWebServer.js";
|
|
58
58
|
export * from "./models/server/IWebServerOptions.js";
|
|
59
59
|
export * from "./models/services/IHealthComponent.js";
|
|
60
|
-
export * from "./models/services/IHostingComponent.js";
|
|
61
60
|
export * from "./models/services/IInformationComponent.js";
|
|
62
61
|
export * from "./models/services/IPlatformComponent.js";
|
|
63
62
|
export * from "./models/services/IServerInfo.js";
|
|
@@ -14,6 +14,14 @@ export declare const HttpContextIdKeys: {
|
|
|
14
14
|
* Correlation ID of the request.
|
|
15
15
|
*/
|
|
16
16
|
readonly CorrelationId: "correlationId";
|
|
17
|
+
/**
|
|
18
|
+
* Public Origin of the request.
|
|
19
|
+
*/
|
|
20
|
+
readonly PublicOrigin: "publicOrigin";
|
|
21
|
+
/**
|
|
22
|
+
* Local Origin of the request.
|
|
23
|
+
*/
|
|
24
|
+
readonly LocalOrigin: "localOrigin";
|
|
17
25
|
};
|
|
18
26
|
/**
|
|
19
27
|
* HTTP definition of some context keys.
|
|
@@ -23,14 +23,12 @@ export interface IBaseRouteProcessor<T = IBaseRoute, R = IHttpServerRequest> ext
|
|
|
23
23
|
* @param processorState The state handed through the processors.
|
|
24
24
|
* @param componentTypes The component types for the request.
|
|
25
25
|
* @param componentTypes.loggingComponentType The logging component type.
|
|
26
|
-
* @param componentTypes.hostingComponentType The hosting component type.
|
|
27
26
|
* @returns Promise that resolves when the request is processed.
|
|
28
27
|
*/
|
|
29
28
|
pre?(request: R, response: IHttpResponse, route: T | undefined, contextIds: IContextIds, processorState: {
|
|
30
29
|
[id: string]: unknown;
|
|
31
30
|
}, componentTypes?: {
|
|
32
31
|
loggingComponentType?: string;
|
|
33
|
-
hostingComponentType?: string;
|
|
34
32
|
}): Promise<void>;
|
|
35
33
|
/**
|
|
36
34
|
* Post process the REST request for the specified route.
|
|
@@ -41,13 +39,11 @@ export interface IBaseRouteProcessor<T = IBaseRoute, R = IHttpServerRequest> ext
|
|
|
41
39
|
* @param processorState The state handed through the processors.
|
|
42
40
|
* @param componentTypes The component types for the request.
|
|
43
41
|
* @param componentTypes.loggingComponentType The logging component type.
|
|
44
|
-
* @param componentTypes.hostingComponentType The hosting component type.
|
|
45
42
|
* @returns Promise that resolves when the request is processed.
|
|
46
43
|
*/
|
|
47
44
|
post?(request: R, response: IHttpResponse, route: T | undefined, contextIds: IContextIds, processorState: {
|
|
48
45
|
[id: string]: unknown;
|
|
49
46
|
}, componentTypes?: {
|
|
50
47
|
loggingComponentType?: string;
|
|
51
|
-
hostingComponentType?: string;
|
|
52
48
|
}): Promise<void>;
|
|
53
49
|
}
|
|
@@ -14,13 +14,11 @@ export interface IRestRouteProcessor extends IBaseRouteProcessor<IRestRoute> {
|
|
|
14
14
|
* @param processorState The state handed through the processors.
|
|
15
15
|
* @param componentTypes The component types for the request.
|
|
16
16
|
* @param componentTypes.loggingComponentType The logging component type.
|
|
17
|
-
* @param componentTypes.hostingComponentType The hosting component type.
|
|
18
17
|
* @returns Promise that resolves when the request is processed.
|
|
19
18
|
*/
|
|
20
19
|
process?(request: IHttpServerRequest, response: IHttpResponse, route: IRestRoute | undefined, processorState: {
|
|
21
20
|
[id: string]: unknown;
|
|
22
21
|
}, componentTypes?: {
|
|
23
22
|
loggingComponentType?: string;
|
|
24
|
-
hostingComponentType?: string;
|
|
25
23
|
}): Promise<void>;
|
|
26
24
|
}
|
|
@@ -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
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.47](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.46...api-models-v0.0.3-next.47) (2026-06-18)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* remove hosting component ([#170](https://github.com/iotaledger/twin-api/issues/170)) ([e78c1e8](https://github.com/iotaledger/twin-api/commit/e78c1e87d2747bf58da02b6b77680708ff681122))
|
|
9
|
+
|
|
10
|
+
## [0.0.3-next.46](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.45...api-models-v0.0.3-next.46) (2026-06-17)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Miscellaneous Chores
|
|
14
|
+
|
|
15
|
+
* **api-models:** Synchronize repo versions
|
|
16
|
+
|
|
3
17
|
## [0.0.3-next.45](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.44...api-models-v0.0.3-next.45) (2026-06-15)
|
|
4
18
|
|
|
5
19
|
|
package/docs/reference/index.md
CHANGED
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
- [IWebServer](interfaces/IWebServer.md)
|
|
59
59
|
- [IWebServerOptions](interfaces/IWebServerOptions.md)
|
|
60
60
|
- [IHealthComponent](interfaces/IHealthComponent.md)
|
|
61
|
-
- [IHostingComponent](interfaces/IHostingComponent.md)
|
|
62
61
|
- [IInformationComponent](interfaces/IInformationComponent.md)
|
|
63
62
|
- [IPlatformComponent](interfaces/IPlatformComponent.md)
|
|
64
63
|
- [IServerInfo](interfaces/IServerInfo.md)
|
|
@@ -85,12 +85,6 @@ The component types for the request.
|
|
|
85
85
|
|
|
86
86
|
The logging component type.
|
|
87
87
|
|
|
88
|
-
###### hostingComponentType?
|
|
89
|
-
|
|
90
|
-
`string`
|
|
91
|
-
|
|
92
|
-
The hosting component type.
|
|
93
|
-
|
|
94
88
|
#### Returns
|
|
95
89
|
|
|
96
90
|
`Promise`\<`void`\>
|
|
@@ -145,12 +139,6 @@ The component types for the request.
|
|
|
145
139
|
|
|
146
140
|
The logging component type.
|
|
147
141
|
|
|
148
|
-
###### hostingComponentType?
|
|
149
|
-
|
|
150
|
-
`string`
|
|
151
|
-
|
|
152
|
-
The hosting component type.
|
|
153
|
-
|
|
154
142
|
#### Returns
|
|
155
143
|
|
|
156
144
|
`Promise`\<`void`\>
|
|
@@ -33,11 +33,3 @@ The state handed through the processors.
|
|
|
33
33
|
> `optional` **loggingComponentType?**: `string`
|
|
34
34
|
|
|
35
35
|
Logging component type for the request.
|
|
36
|
-
|
|
37
|
-
***
|
|
38
|
-
|
|
39
|
-
### hostingComponentType? {#hostingcomponenttype}
|
|
40
|
-
|
|
41
|
-
> `optional` **hostingComponentType?**: `string`
|
|
42
|
-
|
|
43
|
-
Hosting component type for the request.
|
|
@@ -74,12 +74,6 @@ The component types for the request.
|
|
|
74
74
|
|
|
75
75
|
The logging component type.
|
|
76
76
|
|
|
77
|
-
###### hostingComponentType?
|
|
78
|
-
|
|
79
|
-
`string`
|
|
80
|
-
|
|
81
|
-
The hosting component type.
|
|
82
|
-
|
|
83
77
|
#### Returns
|
|
84
78
|
|
|
85
79
|
`Promise`\<`void`\>
|
|
@@ -138,12 +132,6 @@ The component types for the request.
|
|
|
138
132
|
|
|
139
133
|
The logging component type.
|
|
140
134
|
|
|
141
|
-
###### hostingComponentType?
|
|
142
|
-
|
|
143
|
-
`string`
|
|
144
|
-
|
|
145
|
-
The hosting component type.
|
|
146
|
-
|
|
147
135
|
#### Returns
|
|
148
136
|
|
|
149
137
|
`Promise`\<`void`\>
|
|
@@ -196,12 +184,6 @@ The component types for the request.
|
|
|
196
184
|
|
|
197
185
|
The logging component type.
|
|
198
186
|
|
|
199
|
-
###### hostingComponentType?
|
|
200
|
-
|
|
201
|
-
`string`
|
|
202
|
-
|
|
203
|
-
The hosting component type.
|
|
204
|
-
|
|
205
187
|
#### Returns
|
|
206
188
|
|
|
207
189
|
`Promise`\<`void`\>
|
|
@@ -48,18 +48,6 @@ Logging component type for the request.
|
|
|
48
48
|
|
|
49
49
|
***
|
|
50
50
|
|
|
51
|
-
### hostingComponentType? {#hostingcomponenttype}
|
|
52
|
-
|
|
53
|
-
> `optional` **hostingComponentType?**: `string`
|
|
54
|
-
|
|
55
|
-
Hosting component type for the request.
|
|
56
|
-
|
|
57
|
-
#### Inherited from
|
|
58
|
-
|
|
59
|
-
[`IHttpRequestContext`](IHttpRequestContext.md).[`hostingComponentType`](IHttpRequestContext.md#hostingcomponenttype)
|
|
60
|
-
|
|
61
|
-
***
|
|
62
|
-
|
|
63
51
|
### socketId {#socketid}
|
|
64
52
|
|
|
65
53
|
> **socketId**: `string`
|
|
@@ -74,12 +74,6 @@ The component types for the request.
|
|
|
74
74
|
|
|
75
75
|
The logging component type.
|
|
76
76
|
|
|
77
|
-
###### hostingComponentType?
|
|
78
|
-
|
|
79
|
-
`string`
|
|
80
|
-
|
|
81
|
-
The hosting component type.
|
|
82
|
-
|
|
83
77
|
#### Returns
|
|
84
78
|
|
|
85
79
|
`Promise`\<`void`\>
|
|
@@ -138,12 +132,6 @@ The component types for the request.
|
|
|
138
132
|
|
|
139
133
|
The logging component type.
|
|
140
134
|
|
|
141
|
-
###### hostingComponentType?
|
|
142
|
-
|
|
143
|
-
`string`
|
|
144
|
-
|
|
145
|
-
The hosting component type.
|
|
146
|
-
|
|
147
135
|
#### Returns
|
|
148
136
|
|
|
149
137
|
`Promise`\<`void`\>
|
|
@@ -73,3 +73,12 @@ The allowed CORS domains.
|
|
|
73
73
|
```ts
|
|
74
74
|
["*"]
|
|
75
75
|
```
|
|
76
|
+
|
|
77
|
+
***
|
|
78
|
+
|
|
79
|
+
### publicOrigin? {#publicorigin}
|
|
80
|
+
|
|
81
|
+
> `optional` **publicOrigin?**: `string`
|
|
82
|
+
|
|
83
|
+
The public origin of the server, used for constructing the request URL.
|
|
84
|
+
If not provided, it will be determined from the incoming request.
|
|
@@ -23,3 +23,15 @@ User agent of the client.
|
|
|
23
23
|
> `readonly` **CorrelationId**: `"correlationId"` = `"correlationId"`
|
|
24
24
|
|
|
25
25
|
Correlation ID of the request.
|
|
26
|
+
|
|
27
|
+
### PublicOrigin {#publicorigin}
|
|
28
|
+
|
|
29
|
+
> `readonly` **PublicOrigin**: `"publicOrigin"` = `"publicOrigin"`
|
|
30
|
+
|
|
31
|
+
Public Origin of the request.
|
|
32
|
+
|
|
33
|
+
### LocalOrigin {#localorigin}
|
|
34
|
+
|
|
35
|
+
> `readonly` **LocalOrigin**: `"localOrigin"` = `"localOrigin"`
|
|
36
|
+
|
|
37
|
+
Local Origin of the request.
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IHostingComponent.js","sourceRoot":"","sources":["../../../../src/models/services/IHostingComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\n\n/**\n * The information about the hosting of the API.\n */\nexport interface IHostingComponent extends IComponent {\n\t/**\n\t * Get the public origin for the hosting.\n\t * @param serverRequestUrl The url of the current server request if there is one.\n\t * @returns The public origin.\n\t */\n\tgetPublicOrigin(serverRequestUrl?: string): Promise<string>;\n\n\t/**\n\t * Get the public origin for the tenant if one exists.\n\t * @param tenantId The tenant identifier.\n\t * @returns The public origin for the tenant.\n\t */\n\tgetTenantOrigin(tenantId: string): Promise<string | undefined>;\n\n\t/**\n\t * Build a public url based on the public origin and the url provided.\n\t * @param url The url to build upon the public origin.\n\t * @returns The full url based on the public origin.\n\t */\n\tbuildPublicUrl(url: string): Promise<string>;\n\n\t/**\n\t * Check if the origin of the given url matches the node public origin or any tenant's public origin.\n\t * @param url The url whose origin to check.\n\t * @returns \"node\" for the node public origin, the tenant id for a tenant public origin, or undefined.\n\t */\n\tmatchesLocalOrigin(url: string): Promise<string | undefined>;\n}\n"]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { IComponent } from "@twin.org/core";
|
|
2
|
-
/**
|
|
3
|
-
* The information about the hosting of the API.
|
|
4
|
-
*/
|
|
5
|
-
export interface IHostingComponent extends IComponent {
|
|
6
|
-
/**
|
|
7
|
-
* Get the public origin for the hosting.
|
|
8
|
-
* @param serverRequestUrl The url of the current server request if there is one.
|
|
9
|
-
* @returns The public origin.
|
|
10
|
-
*/
|
|
11
|
-
getPublicOrigin(serverRequestUrl?: string): Promise<string>;
|
|
12
|
-
/**
|
|
13
|
-
* Get the public origin for the tenant if one exists.
|
|
14
|
-
* @param tenantId The tenant identifier.
|
|
15
|
-
* @returns The public origin for the tenant.
|
|
16
|
-
*/
|
|
17
|
-
getTenantOrigin(tenantId: string): Promise<string | undefined>;
|
|
18
|
-
/**
|
|
19
|
-
* Build a public url based on the public origin and the url provided.
|
|
20
|
-
* @param url The url to build upon the public origin.
|
|
21
|
-
* @returns The full url based on the public origin.
|
|
22
|
-
*/
|
|
23
|
-
buildPublicUrl(url: string): Promise<string>;
|
|
24
|
-
/**
|
|
25
|
-
* Check if the origin of the given url matches the node public origin or any tenant's public origin.
|
|
26
|
-
* @param url The url whose origin to check.
|
|
27
|
-
* @returns "node" for the node public origin, the tenant id for a tenant public origin, or undefined.
|
|
28
|
-
*/
|
|
29
|
-
matchesLocalOrigin(url: string): Promise<string | undefined>;
|
|
30
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# Interface: IHostingComponent
|
|
2
|
-
|
|
3
|
-
The information about the hosting of the API.
|
|
4
|
-
|
|
5
|
-
## Extends
|
|
6
|
-
|
|
7
|
-
- `IComponent`
|
|
8
|
-
|
|
9
|
-
## Methods
|
|
10
|
-
|
|
11
|
-
### getPublicOrigin() {#getpublicorigin}
|
|
12
|
-
|
|
13
|
-
> **getPublicOrigin**(`serverRequestUrl?`): `Promise`\<`string`\>
|
|
14
|
-
|
|
15
|
-
Get the public origin for the hosting.
|
|
16
|
-
|
|
17
|
-
#### Parameters
|
|
18
|
-
|
|
19
|
-
##### serverRequestUrl?
|
|
20
|
-
|
|
21
|
-
`string`
|
|
22
|
-
|
|
23
|
-
The url of the current server request if there is one.
|
|
24
|
-
|
|
25
|
-
#### Returns
|
|
26
|
-
|
|
27
|
-
`Promise`\<`string`\>
|
|
28
|
-
|
|
29
|
-
The public origin.
|
|
30
|
-
|
|
31
|
-
***
|
|
32
|
-
|
|
33
|
-
### getTenantOrigin() {#gettenantorigin}
|
|
34
|
-
|
|
35
|
-
> **getTenantOrigin**(`tenantId`): `Promise`\<`string` \| `undefined`\>
|
|
36
|
-
|
|
37
|
-
Get the public origin for the tenant if one exists.
|
|
38
|
-
|
|
39
|
-
#### Parameters
|
|
40
|
-
|
|
41
|
-
##### tenantId
|
|
42
|
-
|
|
43
|
-
`string`
|
|
44
|
-
|
|
45
|
-
The tenant identifier.
|
|
46
|
-
|
|
47
|
-
#### Returns
|
|
48
|
-
|
|
49
|
-
`Promise`\<`string` \| `undefined`\>
|
|
50
|
-
|
|
51
|
-
The public origin for the tenant.
|
|
52
|
-
|
|
53
|
-
***
|
|
54
|
-
|
|
55
|
-
### buildPublicUrl() {#buildpublicurl}
|
|
56
|
-
|
|
57
|
-
> **buildPublicUrl**(`url`): `Promise`\<`string`\>
|
|
58
|
-
|
|
59
|
-
Build a public url based on the public origin and the url provided.
|
|
60
|
-
|
|
61
|
-
#### Parameters
|
|
62
|
-
|
|
63
|
-
##### url
|
|
64
|
-
|
|
65
|
-
`string`
|
|
66
|
-
|
|
67
|
-
The url to build upon the public origin.
|
|
68
|
-
|
|
69
|
-
#### Returns
|
|
70
|
-
|
|
71
|
-
`Promise`\<`string`\>
|
|
72
|
-
|
|
73
|
-
The full url based on the public origin.
|
|
74
|
-
|
|
75
|
-
***
|
|
76
|
-
|
|
77
|
-
### matchesLocalOrigin() {#matcheslocalorigin}
|
|
78
|
-
|
|
79
|
-
> **matchesLocalOrigin**(`url`): `Promise`\<`string` \| `undefined`\>
|
|
80
|
-
|
|
81
|
-
Check if the origin of the given url matches the node public origin or any tenant's public origin.
|
|
82
|
-
|
|
83
|
-
#### Parameters
|
|
84
|
-
|
|
85
|
-
##### url
|
|
86
|
-
|
|
87
|
-
`string`
|
|
88
|
-
|
|
89
|
-
The url whose origin to check.
|
|
90
|
-
|
|
91
|
-
#### Returns
|
|
92
|
-
|
|
93
|
-
`Promise`\<`string` \| `undefined`\>
|
|
94
|
-
|
|
95
|
-
"node" for the node public origin, the tenant id for a tenant public origin, or undefined.
|