@twin.org/engine-server-types 0.0.3-next.14 → 0.0.3-next.16
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/components/hosting.js +27 -0
- package/dist/es/components/hosting.js.map +1 -0
- package/dist/es/index.js +3 -0
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/IEngineServerConfig.js.map +1 -1
- package/dist/es/models/config/hostingComponentConfig.js +2 -0
- package/dist/es/models/config/hostingComponentConfig.js.map +1 -0
- package/dist/es/models/types/hostingComponentType.js +13 -0
- package/dist/es/models/types/hostingComponentType.js.map +1 -0
- package/dist/types/components/hosting.d.ts +16 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/models/IEngineServerConfig.d.ts +11 -6
- package/dist/types/models/config/hostingComponentConfig.d.ts +9 -0
- package/dist/types/models/types/hostingComponentType.d.ts +13 -0
- package/docs/changelog.md +30 -0
- package/docs/reference/functions/initialiseHostingComponent.md +31 -0
- package/docs/reference/index.md +4 -0
- package/docs/reference/interfaces/IEngineServerConfig.md +12 -6
- package/docs/reference/type-aliases/HostingComponentConfig.md +17 -0
- package/docs/reference/type-aliases/HostingComponentType.md +5 -0
- package/docs/reference/variables/HostingComponentType.md +13 -0
- package/package.json +3 -3
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { HostingService } from "@twin.org/api-service";
|
|
2
|
+
import { ComponentFactory } from "@twin.org/core";
|
|
3
|
+
import { HostingComponentType } from "../models/types/hostingComponentType.js";
|
|
4
|
+
/**
|
|
5
|
+
* Initialise the hosting component.
|
|
6
|
+
* @param engineCore The engine core.
|
|
7
|
+
* @param context The context for the engine.
|
|
8
|
+
* @param instanceConfig The instance config.
|
|
9
|
+
* @returns The instance created and the factory for it.
|
|
10
|
+
*/
|
|
11
|
+
export async function initialiseHostingComponent(engineCore, context, instanceConfig) {
|
|
12
|
+
let component;
|
|
13
|
+
let instanceType;
|
|
14
|
+
if (instanceConfig.type === HostingComponentType.Service) {
|
|
15
|
+
component = new HostingService({
|
|
16
|
+
tenantAdminComponentType: engineCore.getRegisteredInstanceTypeOptional("tenantAdminComponent"),
|
|
17
|
+
config: instanceConfig.options.config
|
|
18
|
+
});
|
|
19
|
+
instanceType = "hosting-service";
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
component,
|
|
23
|
+
instanceType,
|
|
24
|
+
factory: ComponentFactory
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=hosting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosting.js","sourceRoot":"","sources":["../../../src/components/hosting.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAKnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAE/E;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC/C,UAA4C,EAC5C,OAAgD,EAChD,cAAsC;IAEtC,IAAI,SAAwC,CAAC;IAC7C,IAAI,YAAgC,CAAC;IAErC,IAAI,cAAc,CAAC,IAAI,KAAK,oBAAoB,CAAC,OAAO,EAAE,CAAC;QAC1D,SAAS,GAAG,IAAI,cAAc,CAAC;YAC9B,wBAAwB,EACvB,UAAU,CAAC,iCAAiC,CAAC,sBAAsB,CAAC;YACrE,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC,MAAM;SACrC,CAAC,CAAC;QACH,YAAY,oBAAkC,CAAC;IAChD,CAAC;IAED,OAAO;QACN,SAAS;QACT,YAAY;QACZ,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IHostingComponent } from \"@twin.org/api-models\";\nimport { HostingService } from \"@twin.org/api-service\";\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type { IEngineCore, IEngineCoreContext } from \"@twin.org/engine-models\";\nimport { nameofKebabCase } from \"@twin.org/nameof\";\nimport type { HostingComponentConfig } from \"../models/config/hostingComponentConfig.js\";\nimport type { IEngineServerConfig } from \"../models/IEngineServerConfig.js\";\nimport { HostingComponentType } from \"../models/types/hostingComponentType.js\";\n\n/**\n * Initialise the hosting component.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport async function initialiseHostingComponent(\n\tengineCore: IEngineCore<IEngineServerConfig>,\n\tcontext: IEngineCoreContext<IEngineServerConfig>,\n\tinstanceConfig: HostingComponentConfig\n): Promise<{ instanceType?: string; factory?: typeof ComponentFactory; component?: IComponent }> {\n\tlet component: IHostingComponent | undefined;\n\tlet instanceType: string | undefined;\n\n\tif (instanceConfig.type === HostingComponentType.Service) {\n\t\tcomponent = new HostingService({\n\t\t\ttenantAdminComponentType:\n\t\t\t\tengineCore.getRegisteredInstanceTypeOptional(\"tenantAdminComponent\"),\n\t\t\tconfig: instanceConfig.options.config\n\t\t});\n\t\tinstanceType = nameofKebabCase(HostingService);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tinstanceType,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
|
package/dist/es/index.js
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
3
|
export * from "./components/authentication.js";
|
|
4
4
|
export * from "./components/authenticationAdmin.js";
|
|
5
|
+
export * from "./components/hosting.js";
|
|
5
6
|
export * from "./components/information.js";
|
|
6
7
|
export * from "./components/mimeTypeProcessor.js";
|
|
7
8
|
export * from "./components/restRouteProcessor.js";
|
|
8
9
|
export * from "./components/socketRouteProcessor.js";
|
|
9
10
|
export * from "./models/config/authenticationAdminComponentConfig.js";
|
|
10
11
|
export * from "./models/config/authenticationComponentConfig.js";
|
|
12
|
+
export * from "./models/config/hostingComponentConfig.js";
|
|
11
13
|
export * from "./models/config/informationComponentConfig.js";
|
|
12
14
|
export * from "./models/config/mimeTypeProcessorConfig.js";
|
|
13
15
|
export * from "./models/config/restRouteProcessorConfig.js";
|
|
@@ -15,6 +17,7 @@ export * from "./models/config/socketRouteProcessorConfig.js";
|
|
|
15
17
|
export * from "./models/IEngineServerConfig.js";
|
|
16
18
|
export * from "./models/types/authenticationAdminComponentType.js";
|
|
17
19
|
export * from "./models/types/authenticationComponentType.js";
|
|
20
|
+
export * from "./models/types/hostingComponentType.js";
|
|
18
21
|
export * from "./models/types/informationComponentType.js";
|
|
19
22
|
export * from "./models/types/mimeTypeProcessorType.js";
|
|
20
23
|
export * from "./models/types/restRouteProcessorType.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,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uDAAuD,CAAC;AACtE,cAAc,kDAAkD,CAAC;AACjE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,iCAAiC,CAAC;AAChD,cAAc,oDAAoD,CAAC;AACnE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./components/authentication.js\";\nexport * from \"./components/authenticationAdmin.js\";\nexport * from \"./components/information.js\";\nexport * from \"./components/mimeTypeProcessor.js\";\nexport * from \"./components/restRouteProcessor.js\";\nexport * from \"./components/socketRouteProcessor.js\";\nexport * from \"./models/config/authenticationAdminComponentConfig.js\";\nexport * from \"./models/config/authenticationComponentConfig.js\";\nexport * from \"./models/config/informationComponentConfig.js\";\nexport * from \"./models/config/mimeTypeProcessorConfig.js\";\nexport * from \"./models/config/restRouteProcessorConfig.js\";\nexport * from \"./models/config/socketRouteProcessorConfig.js\";\nexport * from \"./models/IEngineServerConfig.js\";\nexport * from \"./models/types/authenticationAdminComponentType.js\";\nexport * from \"./models/types/authenticationComponentType.js\";\nexport * from \"./models/types/informationComponentType.js\";\nexport * from \"./models/types/mimeTypeProcessorType.js\";\nexport * from \"./models/types/restRouteProcessorType.js\";\nexport * from \"./models/types/socketRouteProcessorType.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uDAAuD,CAAC;AACtE,cAAc,kDAAkD,CAAC;AACjE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,iCAAiC,CAAC;AAChD,cAAc,oDAAoD,CAAC;AACnE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,wCAAwC,CAAC;AACvD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./components/authentication.js\";\nexport * from \"./components/authenticationAdmin.js\";\nexport * from \"./components/hosting.js\";\nexport * from \"./components/information.js\";\nexport * from \"./components/mimeTypeProcessor.js\";\nexport * from \"./components/restRouteProcessor.js\";\nexport * from \"./components/socketRouteProcessor.js\";\nexport * from \"./models/config/authenticationAdminComponentConfig.js\";\nexport * from \"./models/config/authenticationComponentConfig.js\";\nexport * from \"./models/config/hostingComponentConfig.js\";\nexport * from \"./models/config/informationComponentConfig.js\";\nexport * from \"./models/config/mimeTypeProcessorConfig.js\";\nexport * from \"./models/config/restRouteProcessorConfig.js\";\nexport * from \"./models/config/socketRouteProcessorConfig.js\";\nexport * from \"./models/IEngineServerConfig.js\";\nexport * from \"./models/types/authenticationAdminComponentType.js\";\nexport * from \"./models/types/authenticationComponentType.js\";\nexport * from \"./models/types/hostingComponentType.js\";\nexport * from \"./models/types/informationComponentType.js\";\nexport * from \"./models/types/mimeTypeProcessorType.js\";\nexport * from \"./models/types/restRouteProcessorType.js\";\nexport * from \"./models/types/socketRouteProcessorType.js\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IEngineServerConfig.js","sourceRoot":"","sources":["../../../src/models/IEngineServerConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IWebServerOptions } from \"@twin.org/api-models\";\nimport type { IEngineCoreTypeConfig } from \"@twin.org/engine-models\";\nimport type { IEngineConfig } from \"@twin.org/engine-types\";\nimport type { AuthenticationAdminComponentConfig } from \"./config/authenticationAdminComponentConfig.js\";\nimport type { AuthenticationComponentConfig } from \"./config/authenticationComponentConfig.js\";\nimport type { InformationComponentConfig } from \"./config/informationComponentConfig.js\";\nimport type { MimeTypeProcessorConfig } from \"./config/mimeTypeProcessorConfig.js\";\nimport type { RestRouteProcessorConfig } from \"./config/restRouteProcessorConfig.js\";\nimport type { SocketRouteProcessorConfig } from \"./config/socketRouteProcessorConfig.js\";\n\n/**\n * Extended engine server config with known types.\n */\nexport interface IEngineServerConfig extends IEngineConfig {\n\t/**\n\t * Configuration for the web server.\n\t */\n\tweb?: IWebServerOptions;\n\n\t/**\n\t * The types to initialise in the engine.\n\t */\n\ttypes: IEngineConfig[\"types\"] & {\n\t\t[type: string]: IEngineCoreTypeConfig[] | undefined;\n\n\t\t/**\n\t\t * Information component options which can be overridden by individual components by specifying types other than default
|
|
1
|
+
{"version":3,"file":"IEngineServerConfig.js","sourceRoot":"","sources":["../../../src/models/IEngineServerConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IWebServerOptions } from \"@twin.org/api-models\";\nimport type { IEngineCoreTypeConfig } from \"@twin.org/engine-models\";\nimport type { IEngineConfig } from \"@twin.org/engine-types\";\nimport type { AuthenticationAdminComponentConfig } from \"./config/authenticationAdminComponentConfig.js\";\nimport type { AuthenticationComponentConfig } from \"./config/authenticationComponentConfig.js\";\nimport type { HostingComponentConfig } from \"./config/hostingComponentConfig.js\";\nimport type { InformationComponentConfig } from \"./config/informationComponentConfig.js\";\nimport type { MimeTypeProcessorConfig } from \"./config/mimeTypeProcessorConfig.js\";\nimport type { RestRouteProcessorConfig } from \"./config/restRouteProcessorConfig.js\";\nimport type { SocketRouteProcessorConfig } from \"./config/socketRouteProcessorConfig.js\";\n\n/**\n * Extended engine server config with known types.\n */\nexport interface IEngineServerConfig extends IEngineConfig {\n\t/**\n\t * Configuration for the web server.\n\t */\n\tweb?: IWebServerOptions;\n\n\t/**\n\t * The types to initialise in the engine.\n\t */\n\ttypes: IEngineConfig[\"types\"] & {\n\t\t[type: string]: IEngineCoreTypeConfig[] | undefined;\n\n\t\t/**\n\t\t * Information component options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\tinformationComponent?: IEngineCoreTypeConfig<InformationComponentConfig>[];\n\n\t\t/**\n\t\t * Hosting component options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\thostingComponent?: IEngineCoreTypeConfig<HostingComponentConfig>[];\n\n\t\t/**\n\t\t * REST route processors options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\trestRouteProcessor?: IEngineCoreTypeConfig<RestRouteProcessorConfig>[];\n\n\t\t/**\n\t\t * Socket route processors options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\tsocketRouteProcessor?: IEngineCoreTypeConfig<SocketRouteProcessorConfig>[];\n\n\t\t/**\n\t\t * Mime type processors options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\tmimeTypeProcessor?: IEngineCoreTypeConfig<MimeTypeProcessorConfig>[];\n\n\t\t/**\n\t\t * Authentication component options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\tauthenticationComponent?: IEngineCoreTypeConfig<AuthenticationComponentConfig>[];\n\n\t\t/**\n\t\t * Authentication admin component options which can be overridden by individual components by specifying types other than default.\n\t\t */\n\t\tauthenticationAdminComponent?: IEngineCoreTypeConfig<AuthenticationAdminComponentConfig>[];\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hostingComponentConfig.js","sourceRoot":"","sources":["../../../../src/models/config/hostingComponentConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IHostingServiceConstructorOptions } from \"@twin.org/api-service\";\nimport type { HostingComponentType } from \"../types/hostingComponentType.js\";\n\n/**\n * Hosting component config types.\n */\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type HostingComponentConfig = {\n\ttype: typeof HostingComponentType.Service;\n\toptions: IHostingServiceConstructorOptions;\n};\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
/**
|
|
4
|
+
* Hosting component types.
|
|
5
|
+
*/
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
+
export const HostingComponentType = {
|
|
8
|
+
/**
|
|
9
|
+
* Service.
|
|
10
|
+
*/
|
|
11
|
+
Service: "service"
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=hostingComponentType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hostingComponentType.js","sourceRoot":"","sources":["../../../../src/models/types/hostingComponentType.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,oBAAoB,GAAG;IACnC;;OAEG;IACH,OAAO,EAAE,SAAS;CACT,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Hosting component types.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const HostingComponentType = {\n\t/**\n\t * Service.\n\t */\n\tService: \"service\"\n} as const;\n\n/**\n * Hosting component types.\n */\nexport type HostingComponentType = (typeof HostingComponentType)[keyof typeof HostingComponentType];\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ComponentFactory, type IComponent } from "@twin.org/core";
|
|
2
|
+
import type { IEngineCore, IEngineCoreContext } from "@twin.org/engine-models";
|
|
3
|
+
import type { HostingComponentConfig } from "../models/config/hostingComponentConfig.js";
|
|
4
|
+
import type { IEngineServerConfig } from "../models/IEngineServerConfig.js";
|
|
5
|
+
/**
|
|
6
|
+
* Initialise the hosting component.
|
|
7
|
+
* @param engineCore The engine core.
|
|
8
|
+
* @param context The context for the engine.
|
|
9
|
+
* @param instanceConfig The instance config.
|
|
10
|
+
* @returns The instance created and the factory for it.
|
|
11
|
+
*/
|
|
12
|
+
export declare function initialiseHostingComponent(engineCore: IEngineCore<IEngineServerConfig>, context: IEngineCoreContext<IEngineServerConfig>, instanceConfig: HostingComponentConfig): Promise<{
|
|
13
|
+
instanceType?: string;
|
|
14
|
+
factory?: typeof ComponentFactory;
|
|
15
|
+
component?: IComponent;
|
|
16
|
+
}>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export * from "./components/authentication.js";
|
|
2
2
|
export * from "./components/authenticationAdmin.js";
|
|
3
|
+
export * from "./components/hosting.js";
|
|
3
4
|
export * from "./components/information.js";
|
|
4
5
|
export * from "./components/mimeTypeProcessor.js";
|
|
5
6
|
export * from "./components/restRouteProcessor.js";
|
|
6
7
|
export * from "./components/socketRouteProcessor.js";
|
|
7
8
|
export * from "./models/config/authenticationAdminComponentConfig.js";
|
|
8
9
|
export * from "./models/config/authenticationComponentConfig.js";
|
|
10
|
+
export * from "./models/config/hostingComponentConfig.js";
|
|
9
11
|
export * from "./models/config/informationComponentConfig.js";
|
|
10
12
|
export * from "./models/config/mimeTypeProcessorConfig.js";
|
|
11
13
|
export * from "./models/config/restRouteProcessorConfig.js";
|
|
@@ -13,6 +15,7 @@ export * from "./models/config/socketRouteProcessorConfig.js";
|
|
|
13
15
|
export * from "./models/IEngineServerConfig.js";
|
|
14
16
|
export * from "./models/types/authenticationAdminComponentType.js";
|
|
15
17
|
export * from "./models/types/authenticationComponentType.js";
|
|
18
|
+
export * from "./models/types/hostingComponentType.js";
|
|
16
19
|
export * from "./models/types/informationComponentType.js";
|
|
17
20
|
export * from "./models/types/mimeTypeProcessorType.js";
|
|
18
21
|
export * from "./models/types/restRouteProcessorType.js";
|
|
@@ -3,6 +3,7 @@ import type { IEngineCoreTypeConfig } from "@twin.org/engine-models";
|
|
|
3
3
|
import type { IEngineConfig } from "@twin.org/engine-types";
|
|
4
4
|
import type { AuthenticationAdminComponentConfig } from "./config/authenticationAdminComponentConfig.js";
|
|
5
5
|
import type { AuthenticationComponentConfig } from "./config/authenticationComponentConfig.js";
|
|
6
|
+
import type { HostingComponentConfig } from "./config/hostingComponentConfig.js";
|
|
6
7
|
import type { InformationComponentConfig } from "./config/informationComponentConfig.js";
|
|
7
8
|
import type { MimeTypeProcessorConfig } from "./config/mimeTypeProcessorConfig.js";
|
|
8
9
|
import type { RestRouteProcessorConfig } from "./config/restRouteProcessorConfig.js";
|
|
@@ -21,27 +22,31 @@ export interface IEngineServerConfig extends IEngineConfig {
|
|
|
21
22
|
types: IEngineConfig["types"] & {
|
|
22
23
|
[type: string]: IEngineCoreTypeConfig[] | undefined;
|
|
23
24
|
/**
|
|
24
|
-
* Information component options which can be overridden by individual components by specifying types other than default
|
|
25
|
+
* Information component options which can be overridden by individual components by specifying types other than default.
|
|
25
26
|
*/
|
|
26
27
|
informationComponent?: IEngineCoreTypeConfig<InformationComponentConfig>[];
|
|
27
28
|
/**
|
|
28
|
-
*
|
|
29
|
+
* Hosting component options which can be overridden by individual components by specifying types other than default.
|
|
30
|
+
*/
|
|
31
|
+
hostingComponent?: IEngineCoreTypeConfig<HostingComponentConfig>[];
|
|
32
|
+
/**
|
|
33
|
+
* REST route processors options which can be overridden by individual components by specifying types other than default.
|
|
29
34
|
*/
|
|
30
35
|
restRouteProcessor?: IEngineCoreTypeConfig<RestRouteProcessorConfig>[];
|
|
31
36
|
/**
|
|
32
|
-
* Socket route processors options which can be overridden by individual components by specifying types other than default
|
|
37
|
+
* Socket route processors options which can be overridden by individual components by specifying types other than default.
|
|
33
38
|
*/
|
|
34
39
|
socketRouteProcessor?: IEngineCoreTypeConfig<SocketRouteProcessorConfig>[];
|
|
35
40
|
/**
|
|
36
|
-
* Mime type processors options which can be overridden by individual components by specifying types other than default
|
|
41
|
+
* Mime type processors options which can be overridden by individual components by specifying types other than default.
|
|
37
42
|
*/
|
|
38
43
|
mimeTypeProcessor?: IEngineCoreTypeConfig<MimeTypeProcessorConfig>[];
|
|
39
44
|
/**
|
|
40
|
-
* Authentication component options which can be overridden by individual components by specifying types other than default
|
|
45
|
+
* Authentication component options which can be overridden by individual components by specifying types other than default.
|
|
41
46
|
*/
|
|
42
47
|
authenticationComponent?: IEngineCoreTypeConfig<AuthenticationComponentConfig>[];
|
|
43
48
|
/**
|
|
44
|
-
* Authentication admin component options which can be overridden by individual components by specifying types other than default
|
|
49
|
+
* Authentication admin component options which can be overridden by individual components by specifying types other than default.
|
|
45
50
|
*/
|
|
46
51
|
authenticationAdminComponent?: IEngineCoreTypeConfig<AuthenticationAdminComponentConfig>[];
|
|
47
52
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IHostingServiceConstructorOptions } from "@twin.org/api-service";
|
|
2
|
+
import type { HostingComponentType } from "../types/hostingComponentType.js";
|
|
3
|
+
/**
|
|
4
|
+
* Hosting component config types.
|
|
5
|
+
*/
|
|
6
|
+
export type HostingComponentConfig = {
|
|
7
|
+
type: typeof HostingComponentType.Service;
|
|
8
|
+
options: IHostingServiceConstructorOptions;
|
|
9
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hosting component types.
|
|
3
|
+
*/
|
|
4
|
+
export declare const HostingComponentType: {
|
|
5
|
+
/**
|
|
6
|
+
* Service.
|
|
7
|
+
*/
|
|
8
|
+
readonly Service: "service";
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Hosting component types.
|
|
12
|
+
*/
|
|
13
|
+
export type HostingComponentType = (typeof HostingComponentType)[keyof typeof HostingComponentType];
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @twin.org/engine-server-types - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.16](https://github.com/twinfoundation/engine/compare/engine-server-types-v0.0.3-next.15...engine-server-types-v0.0.3-next.16) (2026-01-28)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* remove dap and darp ([d568c4f](https://github.com/twinfoundation/engine/commit/d568c4fc58a3159378e1d65f93228ae84f34a31d))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/engine-models bumped from 0.0.3-next.15 to 0.0.3-next.16
|
|
16
|
+
* @twin.org/engine-types bumped from 0.0.3-next.15 to 0.0.3-next.16
|
|
17
|
+
|
|
18
|
+
## [0.0.3-next.15](https://github.com/twinfoundation/engine/compare/engine-server-types-v0.0.3-next.14...engine-server-types-v0.0.3-next.15) (2026-01-26)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* add hosting component ([#70](https://github.com/twinfoundation/engine/issues/70)) ([2ab0dec](https://github.com/twinfoundation/engine/commit/2ab0dec8fdb979395c639b73f394a40a0dd7e55a))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Dependencies
|
|
27
|
+
|
|
28
|
+
* The following workspace dependencies were updated
|
|
29
|
+
* dependencies
|
|
30
|
+
* @twin.org/engine-models bumped from 0.0.3-next.14 to 0.0.3-next.15
|
|
31
|
+
* @twin.org/engine-types bumped from 0.0.3-next.14 to 0.0.3-next.15
|
|
32
|
+
|
|
3
33
|
## [0.0.3-next.14](https://github.com/twinfoundation/engine/compare/engine-server-types-v0.0.3-next.13...engine-server-types-v0.0.3-next.14) (2026-01-19)
|
|
4
34
|
|
|
5
35
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: initialiseHostingComponent()
|
|
2
|
+
|
|
3
|
+
> **initialiseHostingComponent**(`engineCore`, `context`, `instanceConfig`): `Promise`\<\{ `instanceType?`: `string`; `factory?`: `Factory`\<`IComponent`\>; `component?`: `IComponent`; \}\>
|
|
4
|
+
|
|
5
|
+
Initialise the hosting component.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### engineCore
|
|
10
|
+
|
|
11
|
+
`IEngineCore`\<[`IEngineServerConfig`](../interfaces/IEngineServerConfig.md)\>
|
|
12
|
+
|
|
13
|
+
The engine core.
|
|
14
|
+
|
|
15
|
+
### context
|
|
16
|
+
|
|
17
|
+
`IEngineCoreContext`\<[`IEngineServerConfig`](../interfaces/IEngineServerConfig.md)\>
|
|
18
|
+
|
|
19
|
+
The context for the engine.
|
|
20
|
+
|
|
21
|
+
### instanceConfig
|
|
22
|
+
|
|
23
|
+
[`HostingComponentConfig`](../type-aliases/HostingComponentConfig.md)
|
|
24
|
+
|
|
25
|
+
The instance config.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<\{ `instanceType?`: `string`; `factory?`: `Factory`\<`IComponent`\>; `component?`: `IComponent`; \}\>
|
|
30
|
+
|
|
31
|
+
The instance created and the factory for it.
|
package/docs/reference/index.md
CHANGED
|
@@ -8,12 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
- [AuthenticationAdminComponentConfig](type-aliases/AuthenticationAdminComponentConfig.md)
|
|
10
10
|
- [AuthenticationComponentConfig](type-aliases/AuthenticationComponentConfig.md)
|
|
11
|
+
- [HostingComponentConfig](type-aliases/HostingComponentConfig.md)
|
|
11
12
|
- [InformationComponentConfig](type-aliases/InformationComponentConfig.md)
|
|
12
13
|
- [MimeTypeProcessorConfig](type-aliases/MimeTypeProcessorConfig.md)
|
|
13
14
|
- [RestRouteProcessorConfig](type-aliases/RestRouteProcessorConfig.md)
|
|
14
15
|
- [SocketRouteProcessorConfig](type-aliases/SocketRouteProcessorConfig.md)
|
|
15
16
|
- [AuthenticationAdminComponentType](type-aliases/AuthenticationAdminComponentType.md)
|
|
16
17
|
- [AuthenticationComponentType](type-aliases/AuthenticationComponentType.md)
|
|
18
|
+
- [HostingComponentType](type-aliases/HostingComponentType.md)
|
|
17
19
|
- [InformationComponentType](type-aliases/InformationComponentType.md)
|
|
18
20
|
- [MimeTypeProcessorType](type-aliases/MimeTypeProcessorType.md)
|
|
19
21
|
- [RestRouteProcessorType](type-aliases/RestRouteProcessorType.md)
|
|
@@ -23,6 +25,7 @@
|
|
|
23
25
|
|
|
24
26
|
- [AuthenticationAdminComponentType](variables/AuthenticationAdminComponentType.md)
|
|
25
27
|
- [AuthenticationComponentType](variables/AuthenticationComponentType.md)
|
|
28
|
+
- [HostingComponentType](variables/HostingComponentType.md)
|
|
26
29
|
- [InformationComponentType](variables/InformationComponentType.md)
|
|
27
30
|
- [MimeTypeProcessorType](variables/MimeTypeProcessorType.md)
|
|
28
31
|
- [RestRouteProcessorType](variables/RestRouteProcessorType.md)
|
|
@@ -32,6 +35,7 @@
|
|
|
32
35
|
|
|
33
36
|
- [initialiseAuthenticationComponent](functions/initialiseAuthenticationComponent.md)
|
|
34
37
|
- [initialiseAuthenticationAdminComponent](functions/initialiseAuthenticationAdminComponent.md)
|
|
38
|
+
- [initialiseHostingComponent](functions/initialiseHostingComponent.md)
|
|
35
39
|
- [initialiseInformationComponent](functions/initialiseInformationComponent.md)
|
|
36
40
|
- [initialiseMimeTypeProcessorComponent](functions/initialiseMimeTypeProcessorComponent.md)
|
|
37
41
|
- [initialiseRestRouteProcessorComponent](functions/initialiseRestRouteProcessorComponent.md)
|
|
@@ -28,37 +28,43 @@ The types to initialise in the engine.
|
|
|
28
28
|
|
|
29
29
|
> `optional` **informationComponent**: `IEngineCoreTypeConfig`\<[`InformationComponentConfig`](../type-aliases/InformationComponentConfig.md)\>[]
|
|
30
30
|
|
|
31
|
-
Information component options which can be overridden by individual components by specifying types other than default
|
|
31
|
+
Information component options which can be overridden by individual components by specifying types other than default.
|
|
32
|
+
|
|
33
|
+
##### hostingComponent?
|
|
34
|
+
|
|
35
|
+
> `optional` **hostingComponent**: `IEngineCoreTypeConfig`\<[`HostingComponentConfig`](../type-aliases/HostingComponentConfig.md)\>[]
|
|
36
|
+
|
|
37
|
+
Hosting component options which can be overridden by individual components by specifying types other than default.
|
|
32
38
|
|
|
33
39
|
##### restRouteProcessor?
|
|
34
40
|
|
|
35
41
|
> `optional` **restRouteProcessor**: `IEngineCoreTypeConfig`\<[`RestRouteProcessorConfig`](../type-aliases/RestRouteProcessorConfig.md)\>[]
|
|
36
42
|
|
|
37
|
-
REST route processors options which can be overridden by individual components by specifying types other than default
|
|
43
|
+
REST route processors options which can be overridden by individual components by specifying types other than default.
|
|
38
44
|
|
|
39
45
|
##### socketRouteProcessor?
|
|
40
46
|
|
|
41
47
|
> `optional` **socketRouteProcessor**: `IEngineCoreTypeConfig`\<[`SocketRouteProcessorConfig`](../type-aliases/SocketRouteProcessorConfig.md)\>[]
|
|
42
48
|
|
|
43
|
-
Socket route processors options which can be overridden by individual components by specifying types other than default
|
|
49
|
+
Socket route processors options which can be overridden by individual components by specifying types other than default.
|
|
44
50
|
|
|
45
51
|
##### mimeTypeProcessor?
|
|
46
52
|
|
|
47
53
|
> `optional` **mimeTypeProcessor**: `IEngineCoreTypeConfig`\<[`MimeTypeProcessorConfig`](../type-aliases/MimeTypeProcessorConfig.md)\>[]
|
|
48
54
|
|
|
49
|
-
Mime type processors options which can be overridden by individual components by specifying types other than default
|
|
55
|
+
Mime type processors options which can be overridden by individual components by specifying types other than default.
|
|
50
56
|
|
|
51
57
|
##### authenticationComponent?
|
|
52
58
|
|
|
53
59
|
> `optional` **authenticationComponent**: `IEngineCoreTypeConfig`\<[`AuthenticationComponentConfig`](../type-aliases/AuthenticationComponentConfig.md)\>[]
|
|
54
60
|
|
|
55
|
-
Authentication component options which can be overridden by individual components by specifying types other than default
|
|
61
|
+
Authentication component options which can be overridden by individual components by specifying types other than default.
|
|
56
62
|
|
|
57
63
|
##### authenticationAdminComponent?
|
|
58
64
|
|
|
59
65
|
> `optional` **authenticationAdminComponent**: `IEngineCoreTypeConfig`\<[`AuthenticationAdminComponentConfig`](../type-aliases/AuthenticationAdminComponentConfig.md)\>[]
|
|
60
66
|
|
|
61
|
-
Authentication admin component options which can be overridden by individual components by specifying types other than default
|
|
67
|
+
Authentication admin component options which can be overridden by individual components by specifying types other than default.
|
|
62
68
|
|
|
63
69
|
#### Overrides
|
|
64
70
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Type Alias: HostingComponentConfig
|
|
2
|
+
|
|
3
|
+
> **HostingComponentConfig** = `object`
|
|
4
|
+
|
|
5
|
+
Hosting component config types.
|
|
6
|
+
|
|
7
|
+
## Properties
|
|
8
|
+
|
|
9
|
+
### type
|
|
10
|
+
|
|
11
|
+
> **type**: *typeof* [`Service`](../variables/HostingComponentType.md#service)
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### options
|
|
16
|
+
|
|
17
|
+
> **options**: `IHostingServiceConstructorOptions`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/engine-server-types",
|
|
3
|
-
"version": "0.0.3-next.
|
|
3
|
+
"version": "0.0.3-next.16",
|
|
4
4
|
"description": "Server types to use in an engine server.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@twin.org/api-tenant-processor": "next",
|
|
26
26
|
"@twin.org/context": "next",
|
|
27
27
|
"@twin.org/core": "next",
|
|
28
|
-
"@twin.org/engine-models": "0.0.3-next.
|
|
29
|
-
"@twin.org/engine-types": "0.0.3-next.
|
|
28
|
+
"@twin.org/engine-models": "0.0.3-next.16",
|
|
29
|
+
"@twin.org/engine-types": "0.0.3-next.16",
|
|
30
30
|
"@twin.org/entity": "next",
|
|
31
31
|
"@twin.org/nameof": "next"
|
|
32
32
|
},
|