@twin.org/engine-models 0.0.2-next.9 → 0.0.3-next.2

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 (55) hide show
  1. package/dist/es/factories/engineCoreFactory.js +9 -0
  2. package/dist/es/factories/engineCoreFactory.js.map +1 -0
  3. package/dist/es/factories/engineServerFactory.js +9 -0
  4. package/dist/es/factories/engineServerFactory.js.map +1 -0
  5. package/dist/es/index.js +16 -0
  6. package/dist/es/index.js.map +1 -0
  7. package/dist/es/models/IEngineCore.js +2 -0
  8. package/dist/es/models/IEngineCore.js.map +1 -0
  9. package/dist/es/models/IEngineCoreClone.js +2 -0
  10. package/dist/es/models/IEngineCoreClone.js.map +1 -0
  11. package/dist/es/models/IEngineCoreContext.js +2 -0
  12. package/dist/es/models/IEngineCoreContext.js.map +1 -0
  13. package/dist/es/models/IEngineServer.js +4 -0
  14. package/dist/es/models/IEngineServer.js.map +1 -0
  15. package/dist/es/models/IEngineState.js +4 -0
  16. package/dist/es/models/IEngineState.js.map +1 -0
  17. package/dist/es/models/IEngineStateStorage.js +2 -0
  18. package/dist/es/models/IEngineStateStorage.js.map +1 -0
  19. package/dist/es/models/config/IEngineCoreConfig.js +2 -0
  20. package/dist/es/models/config/IEngineCoreConfig.js.map +1 -0
  21. package/dist/es/models/config/IEngineCoreTypeBaseConfig.js +4 -0
  22. package/dist/es/models/config/IEngineCoreTypeBaseConfig.js.map +1 -0
  23. package/dist/es/models/config/IEngineCoreTypeConfig.js +2 -0
  24. package/dist/es/models/config/IEngineCoreTypeConfig.js.map +1 -0
  25. package/dist/es/models/config/IEngineModuleConfig.js +4 -0
  26. package/dist/es/models/config/IEngineModuleConfig.js.map +1 -0
  27. package/dist/es/models/engineTypeInitialiser.js +2 -0
  28. package/dist/es/models/engineTypeInitialiser.js.map +1 -0
  29. package/dist/types/factories/engineCoreFactory.d.ts +2 -2
  30. package/dist/types/factories/engineServerFactory.d.ts +1 -1
  31. package/dist/types/index.d.ts +13 -12
  32. package/dist/types/models/IEngineCore.d.ts +33 -6
  33. package/dist/types/models/IEngineCoreClone.d.ts +4 -6
  34. package/dist/types/models/IEngineCoreContext.d.ts +4 -2
  35. package/dist/types/models/IEngineServer.d.ts +2 -5
  36. package/dist/types/models/IEngineState.d.ts +0 -4
  37. package/dist/types/models/IEngineStateStorage.d.ts +2 -2
  38. package/dist/types/models/config/IEngineCoreConfig.d.ts +1 -1
  39. package/dist/types/models/config/IEngineCoreTypeConfig.d.ts +27 -5
  40. package/dist/types/models/config/IEngineModuleConfig.d.ts +30 -0
  41. package/dist/types/models/engineTypeInitialiser.d.ts +22 -4
  42. package/docs/changelog.md +153 -0
  43. package/docs/reference/index.md +2 -0
  44. package/docs/reference/interfaces/EngineTypeInitialiserReturn.md +27 -0
  45. package/docs/reference/interfaces/IEngineCore.md +97 -7
  46. package/docs/reference/interfaces/IEngineCoreClone.md +3 -7
  47. package/docs/reference/interfaces/IEngineCoreContext.md +4 -0
  48. package/docs/reference/interfaces/IEngineModuleConfig.md +59 -0
  49. package/docs/reference/interfaces/IEngineServer.md +2 -14
  50. package/docs/reference/interfaces/IEngineState.md +0 -8
  51. package/docs/reference/type-aliases/EngineTypeInitialiser.md +2 -6
  52. package/docs/reference/type-aliases/IEngineCoreTypeConfig.md +32 -2
  53. package/package.json +22 -8
  54. package/dist/cjs/index.cjs +0 -22
  55. package/dist/esm/index.mjs +0 -19
@@ -0,0 +1,9 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ import { Factory } from "@twin.org/core";
4
+ /**
5
+ * Factory for creating engine cores.
6
+ */
7
+ // eslint-disable-next-line @typescript-eslint/naming-convention
8
+ export const EngineCoreFactory = Factory.createFactory("engine-core");
9
+ //# sourceMappingURL=engineCoreFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engineCoreFactory.js","sourceRoot":"","sources":["../../../src/factories/engineCoreFactory.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAc,aAAa,CAAC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Factory } from \"@twin.org/core\";\nimport type { IEngineCore } from \"../models/IEngineCore.js\";\n\n/**\n * Factory for creating engine cores.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const EngineCoreFactory = Factory.createFactory<IEngineCore>(\"engine-core\");\n"]}
@@ -0,0 +1,9 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ import { Factory } from "@twin.org/core";
4
+ /**
5
+ * Factory for creating engine servers.
6
+ */
7
+ // eslint-disable-next-line @typescript-eslint/naming-convention
8
+ export const EngineServerFactory = Factory.createFactory("engine-server");
9
+ //# sourceMappingURL=engineServerFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engineServerFactory.js","sourceRoot":"","sources":["../../../src/factories/engineServerFactory.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC,aAAa,CAAgB,eAAe,CAAC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Factory } from \"@twin.org/core\";\nimport type { IEngineServer } from \"../models/IEngineServer.js\";\n\n/**\n * Factory for creating engine servers.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const EngineServerFactory = Factory.createFactory<IEngineServer>(\"engine-server\");\n"]}
@@ -0,0 +1,16 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export * from "./factories/engineCoreFactory.js";
4
+ export * from "./factories/engineServerFactory.js";
5
+ export * from "./models/config/IEngineCoreConfig.js";
6
+ export * from "./models/config/IEngineCoreTypeBaseConfig.js";
7
+ export * from "./models/config/IEngineCoreTypeConfig.js";
8
+ export * from "./models/config/IEngineModuleConfig.js";
9
+ export * from "./models/engineTypeInitialiser.js";
10
+ export * from "./models/IEngineCore.js";
11
+ export * from "./models/IEngineCoreClone.js";
12
+ export * from "./models/IEngineCoreContext.js";
13
+ export * from "./models/IEngineServer.js";
14
+ export * from "./models/IEngineState.js";
15
+ export * from "./models/IEngineStateStorage.js";
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC;AACrD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0CAA0C,CAAC;AACzD,cAAc,wCAAwC,CAAC;AACvD,cAAc,mCAAmC,CAAC;AAClD,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./factories/engineCoreFactory.js\";\nexport * from \"./factories/engineServerFactory.js\";\nexport * from \"./models/config/IEngineCoreConfig.js\";\nexport * from \"./models/config/IEngineCoreTypeBaseConfig.js\";\nexport * from \"./models/config/IEngineCoreTypeConfig.js\";\nexport * from \"./models/config/IEngineModuleConfig.js\";\nexport * from \"./models/engineTypeInitialiser.js\";\nexport * from \"./models/IEngineCore.js\";\nexport * from \"./models/IEngineCoreClone.js\";\nexport * from \"./models/IEngineCoreContext.js\";\nexport * from \"./models/IEngineServer.js\";\nexport * from \"./models/IEngineState.js\";\nexport * from \"./models/IEngineStateStorage.js\";\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IEngineCore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IEngineCore.js","sourceRoot":"","sources":["../../../src/models/IEngineCore.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IContextIds } from \"@twin.org/context\";\nimport type { IError } from \"@twin.org/core\";\nimport type { IEngineCoreConfig } from \"./config/IEngineCoreConfig.js\";\nimport type { IEngineCoreTypeConfig } from \"./config/IEngineCoreTypeConfig.js\";\nimport type { IEngineCoreClone } from \"./IEngineCoreClone.js\";\nimport type { IEngineState } from \"./IEngineState.js\";\n\n/**\n * Interface describing the engine core methods.\n */\nexport interface IEngineCore<\n\tC extends IEngineCoreConfig = IEngineCoreConfig,\n\tS extends IEngineState = IEngineState\n> {\n\t/**\n\t * Add a type initialiser.\n\t * @param type The type to add the initialiser for.\n\t * @param module The name of the module which contains the initialiser method.\n\t * @param method The name of the method to call.\n\t */\n\taddTypeInitialiser(type: string, module: string, method: string): void;\n\n\t/**\n\t * Get the type config for a specific type.\n\t * @param type The type to get the config for.\n\t * @returns The type config or undefined if not found.\n\t */\n\tgetTypeConfig(type: string): IEngineCoreTypeConfig[] | undefined;\n\n\t/**\n\t * Add a context ID key to the engine.\n\t * @param key The context ID key.\n\t */\n\taddContextIdKey(key: string): void;\n\n\t/**\n\t * Get the context ID keys for the engine.\n\t * @returns The context IDs keys.\n\t */\n\tgetContextIdKeys(): string[];\n\n\t/**\n\t * Add a context ID to the engine.\n\t * @param key The context ID key.\n\t * @param value The context ID value.\n\t */\n\taddContextId(key: string, value: string): void;\n\n\t/**\n\t * Get the context IDs for the engine.\n\t * @returns The context IDs or undefined if none are set.\n\t */\n\tgetContextIds(): IContextIds | undefined;\n\n\t/**\n\t * Start the engine core.\n\t * @returns True if the start was successful.\n\t */\n\tstart(): Promise<boolean>;\n\n\t/**\n\t * Stop the engine core.\n\t * @returns Nothing.\n\t */\n\tstop(): Promise<void>;\n\n\t/**\n\t * Is the engine started.\n\t * @returns True if the engine is started.\n\t */\n\tisStarted(): boolean;\n\n\t/**\n\t * Is this the primary engine instance.\n\t * @returns True if the engine is the primary instance.\n\t */\n\tisPrimary(): boolean;\n\n\t/**\n\t * Is this engine instance a clone.\n\t * @returns True if the engine instance is a clone.\n\t */\n\tisClone(): boolean;\n\n\t/**\n\t * Log info.\n\t * @param message The message to log.\n\t */\n\tlogInfo(message: string): void;\n\n\t/**\n\t * Log error.\n\t * @param error The error to log.\n\t */\n\tlogError(error: IError): void;\n\n\t/**\n\t * Get the config for the engine.\n\t * @returns The config for the engine.\n\t */\n\tgetConfig(): C;\n\n\t/**\n\t * Get the state of the engine.\n\t * @returns The state of the engine.\n\t */\n\tgetState(): S;\n\n\t/**\n\t * Get all the registered instances.\n\t * @returns The registered instances.\n\t */\n\tgetRegisteredInstances(): {\n\t\t[name: string]: {\n\t\t\ttype: string;\n\t\t\tfeatures?: string[];\n\t\t}[];\n\t};\n\n\t/**\n\t * Get the registered instance type for the component/connector.\n\t * @param componentConnectorType The type of the component/connector.\n\t * @param features The requested features of the component, if not specified the default entry will be retrieved.\n\t * @returns The instance type matching the criteria if one is registered.\n\t * @throws If a matching instance was not found.\n\t */\n\tgetRegisteredInstanceType(componentConnectorType: string, features?: string[]): string;\n\n\t/**\n\t * Get the registered instance type for the component/connector.\n\t * @param componentConnectorType The type of the component/connector.\n\t * @param features The requested features of the component, if not specified the default entry will be retrieved.\n\t * @returns The instance type matching the criteria if one is registered.\n\t */\n\tgetRegisteredInstanceTypeOptional(\n\t\tcomponentConnectorType: string,\n\t\tfeatures?: string[]\n\t): string | undefined;\n\n\t/**\n\t * Get the data required to create a clone of the engine.\n\t * @returns The clone data.\n\t */\n\tgetCloneData(): IEngineCoreClone<C, S>;\n\n\t/**\n\t * Populate the engine from the clone data.\n\t * @param cloneData The clone data to populate from.\n\t * @param silent Should the clone be silent.\n\t */\n\tpopulateClone(cloneData: IEngineCoreClone<C, S>, silent?: boolean): void;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IEngineCoreClone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IEngineCoreClone.js","sourceRoot":"","sources":["../../../src/models/IEngineCoreClone.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IEntitySchema } from \"@twin.org/entity\";\nimport type { IEngineCoreConfig } from \"./config/IEngineCoreConfig.js\";\nimport type { IEngineState } from \"./IEngineState.js\";\n\n/**\n * Interface describing the data required to clone an engine.\n */\nexport interface IEngineCoreClone<\n\tC extends IEngineCoreConfig = IEngineCoreConfig,\n\tS extends IEngineState = IEngineState\n> {\n\t/**\n\t * The config for the engine.\n\t */\n\tconfig: C;\n\n\t/**\n\t * The state of the engine.\n\t */\n\tstate: S;\n\n\t/**\n\t * The type initialisers for the engine.\n\t */\n\ttypeInitialisers: {\n\t\ttype: string;\n\t\tmodule: string;\n\t\tmethod: string;\n\t}[];\n\n\t/**\n\t * The entity schemas for the engine.\n\t */\n\tentitySchemas: { [schema: string]: IEntitySchema };\n\n\t/**\n\t * The context ID keys.\n\t */\n\tcontextIdKeys: string[];\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IEngineCoreContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IEngineCoreContext.js","sourceRoot":"","sources":["../../../src/models/IEngineCoreContext.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IEngineCoreConfig } from \"./config/IEngineCoreConfig.js\";\nimport type { IEngineState } from \"./IEngineState.js\";\n\n/**\n * The context for the engine core.\n */\nexport interface IEngineCoreContext<\n\tC extends IEngineCoreConfig = IEngineCoreConfig,\n\tS extends IEngineState = IEngineState\n> {\n\t/**\n\t * The engine core config.\n\t */\n\tconfig: C;\n\n\t/**\n\t * The engine core state.\n\t */\n\tstate: S;\n\n\t/**\n\t * The state dirty flag, which flags that the state needs saving.\n\t */\n\tstateDirty: boolean;\n\n\t/**\n\t * The registered instances to use when components don't have custom types.\n\t * The default entry will be the first in the list.\n\t */\n\tregisteredInstances: {\n\t\t[name: string]: { type: string; isDefault?: boolean; features?: string[] }[];\n\t};\n\n\t/**\n\t * The components.\n\t */\n\tcomponentInstances: { instanceType: string; component: IComponent; started: boolean }[];\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IEngineServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IEngineServer.js","sourceRoot":"","sources":["../../../src/models/IEngineServer.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Interface describing the engine server methods.\n */\nexport interface IEngineServer {\n\t/**\n\t * Add a REST route generator.\n\t * @param type The type to add the generator for.\n\t * @param module The module containing the generator.\n\t * @param method The method to call on the module.\n\t */\n\taddRestRouteGenerator(type: string, module: string, method: string): void;\n\n\t/**\n\t * Add a socket route generator.\n\t * @param type The type to add the generator for.\n\t * @param module The module containing the generator.\n\t * @param method The method to call on the module.\n\t */\n\taddSocketRouteGenerator(type: string, module: string, method: string): void;\n\n\t/**\n\t * Start the engine server.\n\t * @returns True if the start was successful.\n\t */\n\tstart(): Promise<boolean>;\n\n\t/**\n\t * Stop the engine server.\n\t * @returns Nothing.\n\t */\n\tstop(): Promise<void>;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IEngineState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IEngineState.js","sourceRoot":"","sources":["../../../src/models/IEngineState.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The state of the engine.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IEngineState {}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IEngineStateStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IEngineStateStorage.js","sourceRoot":"","sources":["../../../src/models/IEngineStateStorage.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IEngineCore } from \"./IEngineCore.js\";\nimport type { IEngineState } from \"./IEngineState.js\";\n\n/**\n * Definition of state storage for engine.\n */\nexport interface IEngineStateStorage<S extends IEngineState = IEngineState> {\n\t/**\n\t * Method for loading the state.\n\t * @param engineCore The engine core to load the state for.\n\t * @returns The state of the engine or undefined if it doesn't exist.\n\t */\n\tload(engineCore: IEngineCore): Promise<S | undefined>;\n\n\t/**\n\t * Method for saving the state.\n\t * @param engineCore The engine core to save the state for.\n\t * @param state The state of the engine to save.\n\t * @returns Nothing.\n\t */\n\tsave(engineCore: IEngineCore, state: S): Promise<void>;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IEngineCoreConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IEngineCoreConfig.js","sourceRoot":"","sources":["../../../../src/models/config/IEngineCoreConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IEngineCoreTypeConfig } from \"./IEngineCoreTypeConfig.js\";\n\n/**\n * Configuration for the engine core.\n */\nexport interface IEngineCoreConfig {\n\t/**\n\t * Start the engine in debug mode.\n\t * @default false\n\t */\n\tdebug?: boolean;\n\n\t/**\n\t * Disable output to the console.\n\t * @default false\n\t */\n\tsilent?: boolean;\n\n\t/**\n\t * The types to initialise in the engine.\n\t */\n\ttypes: {\n\t\t[type: string]: IEngineCoreTypeConfig[] | undefined;\n\t};\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IEngineCoreTypeBaseConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IEngineCoreTypeBaseConfig.js","sourceRoot":"","sources":["../../../../src/models/config/IEngineCoreTypeBaseConfig.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Configuration for the engine core type base.\n */\nexport interface IEngineCoreTypeBaseConfig<T = unknown> {\n\t/**\n\t * The type of the instance.\n\t */\n\ttype: string;\n\n\t/**\n\t * The options for the instance.\n\t */\n\toptions?: T;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IEngineCoreTypeConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IEngineCoreTypeConfig.js","sourceRoot":"","sources":["../../../../src/models/config/IEngineCoreTypeConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IEngineCoreTypeBaseConfig } from \"./IEngineCoreTypeBaseConfig.js\";\n\n/**\n * Configuration for the engine core type.\n */\nexport type IEngineCoreTypeConfig<T extends IEngineCoreTypeBaseConfig = IEngineCoreTypeBaseConfig> =\n\tT & {\n\t\t/**\n\t\t * The instance type to override with.\n\t\t */\n\t\toverrideInstanceType?: string;\n\n\t\t/**\n\t\t * Whether this is the default instance.\n\t\t */\n\t\tisDefault?: boolean;\n\n\t\t/**\n\t\t * The features supported by this instance.\n\t\t */\n\t\tfeatures?: string[];\n\n\t\t/**\n\t\t * The path for the REST API.\n\t\t */\n\t\trestPath?: string;\n\n\t\t/**\n\t\t * The options for the REST API route generation.\n\t\t */\n\t\trestOptions?: unknown;\n\n\t\t/**\n\t\t * The path for the socket API.\n\t\t */\n\t\tsocketPath?: string;\n\n\t\t/**\n\t\t * The options for the socket API route generation.\n\t\t */\n\t\tsocketOptions?: unknown;\n\t};\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IEngineModuleConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IEngineModuleConfig.js","sourceRoot":"","sources":["../../../../src/models/config/IEngineModuleConfig.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Configuration for an engine module.\n */\nexport interface IEngineModuleConfig {\n\t/**\n\t * The unique identifier for the module.\n\t */\n\tid: string;\n\n\t/**\n\t * The module that implements the additional component.\n\t */\n\tmoduleName: string;\n\n\t/**\n\t * The class name of the additional component.\n\t */\n\tclassName: string;\n\n\t/**\n\t * Additional dependencies required by the component.\n\t */\n\tdependencies?: {\n\t\tpropertyName: string;\n\t\tcomponentName: string;\n\t\tfeatures?: string[];\n\t\tisOptional?: boolean;\n\t}[];\n\n\t/**\n\t * Additional configuration for the component.\n\t */\n\tconfig?: unknown;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=engineTypeInitialiser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engineTypeInitialiser.js","sourceRoot":"","sources":["../../../src/models/engineTypeInitialiser.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { Factory, IComponent } from \"@twin.org/core\";\nimport type { IEngineCoreTypeBaseConfig } from \"./config/IEngineCoreTypeBaseConfig.js\";\nimport type { IEngineCore } from \"./IEngineCore.js\";\nimport type { IEngineCoreContext } from \"./IEngineCoreContext.js\";\n\n/**\n * Method definition for the engine type initialiser.\n */\nexport type EngineTypeInitialiser<T extends IEngineCoreTypeBaseConfig = IEngineCoreTypeBaseConfig> =\n\t(\n\t\tengineCore: IEngineCore,\n\t\tcontext: IEngineCoreContext,\n\t\tinstanceConfig: T\n\t) => Promise<EngineTypeInitialiserReturn>;\n\n/**\n * Engine type initialiser return type.\n */\nexport interface EngineTypeInitialiserReturn {\n\t/**\n\t * The instance type created.\n\t */\n\tinstanceType?: string;\n\n\t/**\n\t * The factory to store the instance in.\n\t */\n\tfactory?: Factory<unknown>;\n\n\t/**\n\t * The component created.\n\t */\n\tcomponent?: IComponent;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { Factory } from "@twin.org/core";
2
- import type { IEngineCore } from "../models/IEngineCore";
2
+ import type { IEngineCore } from "../models/IEngineCore.js";
3
3
  /**
4
4
  * Factory for creating engine cores.
5
5
  */
6
- export declare const EngineCoreFactory: Factory<IEngineCore<import("..").IEngineCoreConfig, import("..").IEngineState>>;
6
+ export declare const EngineCoreFactory: Factory<IEngineCore<import("../index.js").IEngineCoreConfig, import("../index.js").IEngineState>>;
@@ -1,5 +1,5 @@
1
1
  import { Factory } from "@twin.org/core";
2
- import type { IEngineServer } from "../models/IEngineServer";
2
+ import type { IEngineServer } from "../models/IEngineServer.js";
3
3
  /**
4
4
  * Factory for creating engine servers.
5
5
  */
@@ -1,12 +1,13 @@
1
- export * from "./factories/engineCoreFactory";
2
- export * from "./factories/engineServerFactory";
3
- export * from "./models/config/IEngineCoreConfig";
4
- export * from "./models/config/IEngineCoreTypeBaseConfig";
5
- export * from "./models/config/IEngineCoreTypeConfig";
6
- export * from "./models/engineTypeInitialiser";
7
- export * from "./models/IEngineCore";
8
- export * from "./models/IEngineCoreClone";
9
- export * from "./models/IEngineCoreContext";
10
- export * from "./models/IEngineServer";
11
- export * from "./models/IEngineState";
12
- export * from "./models/IEngineStateStorage";
1
+ export * from "./factories/engineCoreFactory.js";
2
+ export * from "./factories/engineServerFactory.js";
3
+ export * from "./models/config/IEngineCoreConfig.js";
4
+ export * from "./models/config/IEngineCoreTypeBaseConfig.js";
5
+ export * from "./models/config/IEngineCoreTypeConfig.js";
6
+ export * from "./models/config/IEngineModuleConfig.js";
7
+ export * from "./models/engineTypeInitialiser.js";
8
+ export * from "./models/IEngineCore.js";
9
+ export * from "./models/IEngineCoreClone.js";
10
+ export * from "./models/IEngineCoreContext.js";
11
+ export * from "./models/IEngineServer.js";
12
+ export * from "./models/IEngineState.js";
13
+ export * from "./models/IEngineStateStorage.js";
@@ -1,8 +1,9 @@
1
+ import type { IContextIds } from "@twin.org/context";
1
2
  import type { IError } from "@twin.org/core";
2
- import type { IEngineCoreConfig } from "./config/IEngineCoreConfig";
3
- import type { IEngineCoreTypeConfig } from "./config/IEngineCoreTypeConfig";
4
- import type { IEngineCoreClone } from "./IEngineCoreClone";
5
- import type { IEngineState } from "./IEngineState";
3
+ import type { IEngineCoreConfig } from "./config/IEngineCoreConfig.js";
4
+ import type { IEngineCoreTypeConfig } from "./config/IEngineCoreTypeConfig.js";
5
+ import type { IEngineCoreClone } from "./IEngineCoreClone.js";
6
+ import type { IEngineState } from "./IEngineState.js";
6
7
  /**
7
8
  * Interface describing the engine core methods.
8
9
  */
@@ -10,11 +11,37 @@ export interface IEngineCore<C extends IEngineCoreConfig = IEngineCoreConfig, S
10
11
  /**
11
12
  * Add a type initialiser.
12
13
  * @param type The type to add the initialiser for.
13
- * @param typeConfig The type config.
14
14
  * @param module The name of the module which contains the initialiser method.
15
15
  * @param method The name of the method to call.
16
16
  */
17
- addTypeInitialiser(type: string, typeConfig: IEngineCoreTypeConfig[] | undefined, module: string, method: string): void;
17
+ addTypeInitialiser(type: string, module: string, method: string): void;
18
+ /**
19
+ * Get the type config for a specific type.
20
+ * @param type The type to get the config for.
21
+ * @returns The type config or undefined if not found.
22
+ */
23
+ getTypeConfig(type: string): IEngineCoreTypeConfig[] | undefined;
24
+ /**
25
+ * Add a context ID key to the engine.
26
+ * @param key The context ID key.
27
+ */
28
+ addContextIdKey(key: string): void;
29
+ /**
30
+ * Get the context ID keys for the engine.
31
+ * @returns The context IDs keys.
32
+ */
33
+ getContextIdKeys(): string[];
34
+ /**
35
+ * Add a context ID to the engine.
36
+ * @param key The context ID key.
37
+ * @param value The context ID value.
38
+ */
39
+ addContextId(key: string, value: string): void;
40
+ /**
41
+ * Get the context IDs for the engine.
42
+ * @returns The context IDs or undefined if none are set.
43
+ */
44
+ getContextIds(): IContextIds | undefined;
18
45
  /**
19
46
  * Start the engine core.
20
47
  * @returns True if the start was successful.
@@ -1,7 +1,6 @@
1
1
  import type { IEntitySchema } from "@twin.org/entity";
2
- import type { IEngineCoreConfig } from "./config/IEngineCoreConfig";
3
- import type { IEngineCoreTypeConfig } from "./config/IEngineCoreTypeConfig";
4
- import type { IEngineState } from "./IEngineState";
2
+ import type { IEngineCoreConfig } from "./config/IEngineCoreConfig.js";
3
+ import type { IEngineState } from "./IEngineState.js";
5
4
  /**
6
5
  * Interface describing the data required to clone an engine.
7
6
  */
@@ -19,7 +18,6 @@ export interface IEngineCoreClone<C extends IEngineCoreConfig = IEngineCoreConfi
19
18
  */
20
19
  typeInitialisers: {
21
20
  type: string;
22
- typeConfig: IEngineCoreTypeConfig[];
23
21
  module: string;
24
22
  method: string;
25
23
  }[];
@@ -30,7 +28,7 @@ export interface IEngineCoreClone<C extends IEngineCoreConfig = IEngineCoreConfi
30
28
  [schema: string]: IEntitySchema;
31
29
  };
32
30
  /**
33
- * The logger type name.
31
+ * The context ID keys.
34
32
  */
35
- loggerTypeName: string;
33
+ contextIdKeys: string[];
36
34
  }
@@ -1,6 +1,6 @@
1
1
  import type { IComponent } from "@twin.org/core";
2
- import type { IEngineCoreConfig } from "./config/IEngineCoreConfig";
3
- import type { IEngineState } from "./IEngineState";
2
+ import type { IEngineCoreConfig } from "./config/IEngineCoreConfig.js";
3
+ import type { IEngineState } from "./IEngineState.js";
4
4
  /**
5
5
  * The context for the engine core.
6
6
  */
@@ -24,6 +24,7 @@ export interface IEngineCoreContext<C extends IEngineCoreConfig = IEngineCoreCon
24
24
  registeredInstances: {
25
25
  [name: string]: {
26
26
  type: string;
27
+ isDefault?: boolean;
27
28
  features?: string[];
28
29
  }[];
29
30
  };
@@ -33,5 +34,6 @@ export interface IEngineCoreContext<C extends IEngineCoreConfig = IEngineCoreCon
33
34
  componentInstances: {
34
35
  instanceType: string;
35
36
  component: IComponent;
37
+ started: boolean;
36
38
  }[];
37
39
  }
@@ -1,4 +1,3 @@
1
- import type { IEngineCoreTypeConfig } from "./config/IEngineCoreTypeConfig";
2
1
  /**
3
2
  * Interface describing the engine server methods.
4
3
  */
@@ -6,19 +5,17 @@ export interface IEngineServer {
6
5
  /**
7
6
  * Add a REST route generator.
8
7
  * @param type The type to add the generator for.
9
- * @param typeConfig The type config.
10
8
  * @param module The module containing the generator.
11
9
  * @param method The method to call on the module.
12
10
  */
13
- addRestRouteGenerator(type: string, typeConfig: IEngineCoreTypeConfig[] | undefined, module: string, method: string): void;
11
+ addRestRouteGenerator(type: string, module: string, method: string): void;
14
12
  /**
15
13
  * Add a socket route generator.
16
14
  * @param type The type to add the generator for.
17
- * @param typeConfig The type config.
18
15
  * @param module The module containing the generator.
19
16
  * @param method The method to call on the module.
20
17
  */
21
- addSocketRouteGenerator(type: string, typeConfig: IEngineCoreTypeConfig[] | undefined, module: string, method: string): void;
18
+ addSocketRouteGenerator(type: string, module: string, method: string): void;
22
19
  /**
23
20
  * Start the engine server.
24
21
  * @returns True if the start was successful.
@@ -2,8 +2,4 @@
2
2
  * The state of the engine.
3
3
  */
4
4
  export interface IEngineState {
5
- /**
6
- * The identity for the node.
7
- */
8
- nodeIdentity?: string;
9
5
  }
@@ -1,5 +1,5 @@
1
- import type { IEngineCore } from "./IEngineCore";
2
- import type { IEngineState } from "./IEngineState";
1
+ import type { IEngineCore } from "./IEngineCore.js";
2
+ import type { IEngineState } from "./IEngineState.js";
3
3
  /**
4
4
  * Definition of state storage for engine.
5
5
  */
@@ -1,4 +1,4 @@
1
- import type { IEngineCoreTypeConfig } from "./IEngineCoreTypeConfig";
1
+ import type { IEngineCoreTypeConfig } from "./IEngineCoreTypeConfig.js";
2
2
  /**
3
3
  * Configuration for the engine core.
4
4
  */
@@ -1,12 +1,34 @@
1
- import type { IEngineCoreTypeBaseConfig } from "./IEngineCoreTypeBaseConfig";
1
+ import type { IEngineCoreTypeBaseConfig } from "./IEngineCoreTypeBaseConfig.js";
2
2
  /**
3
3
  * Configuration for the engine core type.
4
4
  */
5
- export type IEngineCoreTypeConfig<T extends IEngineCoreTypeBaseConfig = {
6
- type: string;
7
- }> = T & {
8
- [id: string]: unknown;
5
+ export type IEngineCoreTypeConfig<T extends IEngineCoreTypeBaseConfig = IEngineCoreTypeBaseConfig> = T & {
6
+ /**
7
+ * The instance type to override with.
8
+ */
9
9
  overrideInstanceType?: string;
10
+ /**
11
+ * Whether this is the default instance.
12
+ */
10
13
  isDefault?: boolean;
14
+ /**
15
+ * The features supported by this instance.
16
+ */
11
17
  features?: string[];
18
+ /**
19
+ * The path for the REST API.
20
+ */
21
+ restPath?: string;
22
+ /**
23
+ * The options for the REST API route generation.
24
+ */
25
+ restOptions?: unknown;
26
+ /**
27
+ * The path for the socket API.
28
+ */
29
+ socketPath?: string;
30
+ /**
31
+ * The options for the socket API route generation.
32
+ */
33
+ socketOptions?: unknown;
12
34
  };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Configuration for an engine module.
3
+ */
4
+ export interface IEngineModuleConfig {
5
+ /**
6
+ * The unique identifier for the module.
7
+ */
8
+ id: string;
9
+ /**
10
+ * The module that implements the additional component.
11
+ */
12
+ moduleName: string;
13
+ /**
14
+ * The class name of the additional component.
15
+ */
16
+ className: string;
17
+ /**
18
+ * Additional dependencies required by the component.
19
+ */
20
+ dependencies?: {
21
+ propertyName: string;
22
+ componentName: string;
23
+ features?: string[];
24
+ isOptional?: boolean;
25
+ }[];
26
+ /**
27
+ * Additional configuration for the component.
28
+ */
29
+ config?: unknown;
30
+ }
@@ -1,7 +1,25 @@
1
- import type { IEngineCoreTypeBaseConfig } from "./config/IEngineCoreTypeBaseConfig";
2
- import type { IEngineCore } from "./IEngineCore";
3
- import type { IEngineCoreContext } from "./IEngineCoreContext";
1
+ import type { Factory, IComponent } from "@twin.org/core";
2
+ import type { IEngineCoreTypeBaseConfig } from "./config/IEngineCoreTypeBaseConfig.js";
3
+ import type { IEngineCore } from "./IEngineCore.js";
4
+ import type { IEngineCoreContext } from "./IEngineCoreContext.js";
4
5
  /**
5
6
  * Method definition for the engine type initialiser.
6
7
  */
7
- export type EngineTypeInitialiser<T extends IEngineCoreTypeBaseConfig = IEngineCoreTypeBaseConfig> = (engineCore: IEngineCore, context: IEngineCoreContext, instanceConfig: T, overrideInstanceType?: string) => string | undefined;
8
+ export type EngineTypeInitialiser<T extends IEngineCoreTypeBaseConfig = IEngineCoreTypeBaseConfig> = (engineCore: IEngineCore, context: IEngineCoreContext, instanceConfig: T) => Promise<EngineTypeInitialiserReturn>;
9
+ /**
10
+ * Engine type initialiser return type.
11
+ */
12
+ export interface EngineTypeInitialiserReturn {
13
+ /**
14
+ * The instance type created.
15
+ */
16
+ instanceType?: string;
17
+ /**
18
+ * The factory to store the instance in.
19
+ */
20
+ factory?: Factory<unknown>;
21
+ /**
22
+ * The component created.
23
+ */
24
+ component?: IComponent;
25
+ }
package/docs/changelog.md CHANGED
@@ -1,5 +1,158 @@
1
1
  # @twin.org/engine-models - Changelog
2
2
 
3
+ ## [0.0.3-next.2](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.1...engine-models-v0.0.3-next.2) (2025-11-13)
4
+
5
+
6
+ ### Features
7
+
8
+ * close already started components on startup error ([a55a117](https://github.com/twinfoundation/engine/commit/a55a117a508998288c8ae804e732fc6085cb22fa))
9
+
10
+ ## [0.0.3-next.1](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.3-next.0...engine-models-v0.0.3-next.1) (2025-11-13)
11
+
12
+
13
+ ### Features
14
+
15
+ * add auth admin component ([201cd06](https://github.com/twinfoundation/engine/commit/201cd061be83afccb5a6b06856ffe7cf8db7d6b3))
16
+ * add context id features ([#51](https://github.com/twinfoundation/engine/issues/51)) ([eaef180](https://github.com/twinfoundation/engine/commit/eaef1807397a907bc7655ef1545a151a710ca2f1))
17
+ * add engine type helper for config lookups ([a20a398](https://github.com/twinfoundation/engine/commit/a20a3987016c48351178ab8410bc05b0fba0f2c1))
18
+ * add engine type helper for config lookups ([7d5eeef](https://github.com/twinfoundation/engine/commit/7d5eeefd3e7b9daab1ba20e2fb6b1ebfec178aec))
19
+ * add isPrimary and isClone methods ([a7c63e9](https://github.com/twinfoundation/engine/commit/a7c63e97f54c95b104cc81e66d3fa42c6607bdc1))
20
+ * add mimeTypeProcessors and disableNodeIdentity ([bb7e81e](https://github.com/twinfoundation/engine/commit/bb7e81e2036fe042068a5645ec59b22e20d33aad))
21
+ * add REST options for route construction ([4adf0af](https://github.com/twinfoundation/engine/commit/4adf0af8a03689a4dbdf67e8527d6db0d2c5d59d))
22
+ * add rights management negotiation ([84ef46b](https://github.com/twinfoundation/engine/commit/84ef46bff110611a19512793425c8c873ee2a590))
23
+ * add synchronised storage support ([5142e34](https://github.com/twinfoundation/engine/commit/5142e3488f09195cf9f48a9c6c6d1014231a4c2c))
24
+ * add validate-locales ([b92ea09](https://github.com/twinfoundation/engine/commit/b92ea09dbcfe35225271a51f24d231f59e2d363e))
25
+ * eslint migration to flat config ([6b978da](https://github.com/twinfoundation/engine/commit/6b978daf777a615d7758b63c3df57d5a376f6dfb))
26
+ * maintain isDefault flag for registered instances ([2ac5bee](https://github.com/twinfoundation/engine/commit/2ac5bee094bef42b396cc82b0d18bb6aebe27352))
27
+ * remove bootstrapped components, component should manage their own state ([5c7e9e4](https://github.com/twinfoundation/engine/commit/5c7e9e419ef26933e49c9c5a21a20a8961244e7f))
28
+ * remove unused component states ([d56d648](https://github.com/twinfoundation/engine/commit/d56d6486119ea8b8501a33f9e3a3101a08b826ed))
29
+ * simplify config building ([732c871](https://github.com/twinfoundation/engine/commit/732c871c5aca236759168f4bc15aeffd98a330a8))
30
+ * standardised engine logging naming ([0dbf857](https://github.com/twinfoundation/engine/commit/0dbf857587641f86ddf010143519d0e8333489ff))
31
+ * update dependencies ([97c9f64](https://github.com/twinfoundation/engine/commit/97c9f64b6ef096963bcc5de338a2a9e99bdc1a11))
32
+ * update framework core ([acc0f8d](https://github.com/twinfoundation/engine/commit/acc0f8d455a4b8ec47f1da643139fa0f07775fa6))
33
+ * upgrade framework components ([efd52e8](https://github.com/twinfoundation/engine/commit/efd52e80564fff29c3897bfa09b6305b3a322812))
34
+ * use shared store mechanism ([#2](https://github.com/twinfoundation/engine/issues/2)) ([9eed8d7](https://github.com/twinfoundation/engine/commit/9eed8d7766388479b42f03e2542fe761f2156408))
35
+
36
+ ## [0.0.2-next.26](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.25...engine-models-v0.0.2-next.26) (2025-10-09)
37
+
38
+
39
+ ### Miscellaneous Chores
40
+
41
+ * **engine-models:** Synchronize repo versions
42
+
43
+ ## [0.0.2-next.25](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.24...engine-models-v0.0.2-next.25) (2025-10-09)
44
+
45
+
46
+ ### Features
47
+
48
+ * add validate-locales ([b92ea09](https://github.com/twinfoundation/engine/commit/b92ea09dbcfe35225271a51f24d231f59e2d363e))
49
+
50
+ ## [0.0.2-next.24](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.23...engine-models-v0.0.2-next.24) (2025-10-08)
51
+
52
+
53
+ ### Features
54
+
55
+ * maintain isDefault flag for registered instances ([2ac5bee](https://github.com/twinfoundation/engine/commit/2ac5bee094bef42b396cc82b0d18bb6aebe27352))
56
+
57
+ ## [0.0.2-next.23](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.22...engine-models-v0.0.2-next.23) (2025-10-07)
58
+
59
+
60
+ ### Miscellaneous Chores
61
+
62
+ * **engine-models:** Synchronize repo versions
63
+
64
+ ## [0.0.2-next.22](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.21...engine-models-v0.0.2-next.22) (2025-10-07)
65
+
66
+
67
+ ### Miscellaneous Chores
68
+
69
+ * **engine-models:** Synchronize repo versions
70
+
71
+ ## [0.0.2-next.21](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.20...engine-models-v0.0.2-next.21) (2025-10-07)
72
+
73
+
74
+ ### Miscellaneous Chores
75
+
76
+ * **engine-models:** Synchronize repo versions
77
+
78
+ ## [0.0.2-next.20](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.19...engine-models-v0.0.2-next.20) (2025-10-06)
79
+
80
+
81
+ ### Features
82
+
83
+ * standardised engine logging naming ([0dbf857](https://github.com/twinfoundation/engine/commit/0dbf857587641f86ddf010143519d0e8333489ff))
84
+
85
+ ## [0.0.2-next.19](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.18...engine-models-v0.0.2-next.19) (2025-10-02)
86
+
87
+
88
+ ### Features
89
+
90
+ * simplify config building ([732c871](https://github.com/twinfoundation/engine/commit/732c871c5aca236759168f4bc15aeffd98a330a8))
91
+
92
+ ## [0.0.2-next.18](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.17...engine-models-v0.0.2-next.18) (2025-09-29)
93
+
94
+
95
+ ### Features
96
+
97
+ * upgrade framework components ([efd52e8](https://github.com/twinfoundation/engine/commit/efd52e80564fff29c3897bfa09b6305b3a322812))
98
+
99
+ ## [0.0.2-next.17](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.16...engine-models-v0.0.2-next.17) (2025-09-26)
100
+
101
+
102
+ ### Features
103
+
104
+ * add engine type helper for config lookups ([a20a398](https://github.com/twinfoundation/engine/commit/a20a3987016c48351178ab8410bc05b0fba0f2c1))
105
+ * add REST options for route construction ([4adf0af](https://github.com/twinfoundation/engine/commit/4adf0af8a03689a4dbdf67e8527d6db0d2c5d59d))
106
+
107
+ ## [0.0.2-next.16](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.15...engine-models-v0.0.2-next.16) (2025-09-25)
108
+
109
+
110
+ ### Features
111
+
112
+ * add engine type helper for config lookups ([7d5eeef](https://github.com/twinfoundation/engine/commit/7d5eeefd3e7b9daab1ba20e2fb6b1ebfec178aec))
113
+
114
+ ## [0.0.2-next.15](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.14...engine-models-v0.0.2-next.15) (2025-09-24)
115
+
116
+
117
+ ### Miscellaneous Chores
118
+
119
+ * **engine-models:** Synchronize repo versions
120
+
121
+ ## [0.0.2-next.14](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.13...engine-models-v0.0.2-next.14) (2025-09-19)
122
+
123
+
124
+ ### Miscellaneous Chores
125
+
126
+ * **engine-models:** Synchronize repo versions
127
+
128
+ ## [0.0.2-next.13](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.12...engine-models-v0.0.2-next.13) (2025-09-08)
129
+
130
+
131
+ ### Miscellaneous Chores
132
+
133
+ * **engine-models:** Synchronize repo versions
134
+
135
+ ## [0.0.2-next.12](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.11...engine-models-v0.0.2-next.12) (2025-09-05)
136
+
137
+
138
+ ### Features
139
+
140
+ * add rights management negotiation ([84ef46b](https://github.com/twinfoundation/engine/commit/84ef46bff110611a19512793425c8c873ee2a590))
141
+
142
+ ## [0.0.2-next.11](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.10...engine-models-v0.0.2-next.11) (2025-08-29)
143
+
144
+
145
+ ### Features
146
+
147
+ * eslint migration to flat config ([6b978da](https://github.com/twinfoundation/engine/commit/6b978daf777a615d7758b63c3df57d5a376f6dfb))
148
+
149
+ ## [0.0.2-next.10](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.9...engine-models-v0.0.2-next.10) (2025-08-26)
150
+
151
+
152
+ ### Miscellaneous Chores
153
+
154
+ * **engine-models:** Synchronize repo versions
155
+
3
156
  ## [0.0.2-next.9](https://github.com/twinfoundation/engine/compare/engine-models-v0.0.2-next.8...engine-models-v0.0.2-next.9) (2025-08-25)
4
157
 
5
158
 
@@ -10,6 +10,8 @@
10
10
  - [IEngineStateStorage](interfaces/IEngineStateStorage.md)
11
11
  - [IEngineCoreConfig](interfaces/IEngineCoreConfig.md)
12
12
  - [IEngineCoreTypeBaseConfig](interfaces/IEngineCoreTypeBaseConfig.md)
13
+ - [IEngineModuleConfig](interfaces/IEngineModuleConfig.md)
14
+ - [EngineTypeInitialiserReturn](interfaces/EngineTypeInitialiserReturn.md)
13
15
 
14
16
  ## Type Aliases
15
17
 
@@ -0,0 +1,27 @@
1
+ # Interface: EngineTypeInitialiserReturn
2
+
3
+ Engine type initialiser return type.
4
+
5
+ ## Properties
6
+
7
+ ### instanceType?
8
+
9
+ > `optional` **instanceType**: `string`
10
+
11
+ The instance type created.
12
+
13
+ ***
14
+
15
+ ### factory?
16
+
17
+ > `optional` **factory**: `Factory`\<`unknown`\>
18
+
19
+ The factory to store the instance in.
20
+
21
+ ***
22
+
23
+ ### component?
24
+
25
+ > `optional` **component**: `IComponent`
26
+
27
+ The component created.
@@ -16,7 +16,7 @@ Interface describing the engine core methods.
16
16
 
17
17
  ### addTypeInitialiser()
18
18
 
19
- > **addTypeInitialiser**(`type`, `typeConfig`, `module`, `method`): `void`
19
+ > **addTypeInitialiser**(`type`, `module`, `method`): `void`
20
20
 
21
21
  Add a type initialiser.
22
22
 
@@ -28,12 +28,6 @@ Add a type initialiser.
28
28
 
29
29
  The type to add the initialiser for.
30
30
 
31
- ##### typeConfig
32
-
33
- The type config.
34
-
35
- `undefined` | [`IEngineCoreTypeConfig`](../type-aliases/IEngineCoreTypeConfig.md)[]
36
-
37
31
  ##### module
38
32
 
39
33
  `string`
@@ -52,6 +46,102 @@ The name of the method to call.
52
46
 
53
47
  ***
54
48
 
49
+ ### getTypeConfig()
50
+
51
+ > **getTypeConfig**(`type`): `undefined` \| [`IEngineCoreTypeConfig`](../type-aliases/IEngineCoreTypeConfig.md)[]
52
+
53
+ Get the type config for a specific type.
54
+
55
+ #### Parameters
56
+
57
+ ##### type
58
+
59
+ `string`
60
+
61
+ The type to get the config for.
62
+
63
+ #### Returns
64
+
65
+ `undefined` \| [`IEngineCoreTypeConfig`](../type-aliases/IEngineCoreTypeConfig.md)[]
66
+
67
+ The type config or undefined if not found.
68
+
69
+ ***
70
+
71
+ ### addContextIdKey()
72
+
73
+ > **addContextIdKey**(`key`): `void`
74
+
75
+ Add a context ID key to the engine.
76
+
77
+ #### Parameters
78
+
79
+ ##### key
80
+
81
+ `string`
82
+
83
+ The context ID key.
84
+
85
+ #### Returns
86
+
87
+ `void`
88
+
89
+ ***
90
+
91
+ ### getContextIdKeys()
92
+
93
+ > **getContextIdKeys**(): `string`[]
94
+
95
+ Get the context ID keys for the engine.
96
+
97
+ #### Returns
98
+
99
+ `string`[]
100
+
101
+ The context IDs keys.
102
+
103
+ ***
104
+
105
+ ### addContextId()
106
+
107
+ > **addContextId**(`key`, `value`): `void`
108
+
109
+ Add a context ID to the engine.
110
+
111
+ #### Parameters
112
+
113
+ ##### key
114
+
115
+ `string`
116
+
117
+ The context ID key.
118
+
119
+ ##### value
120
+
121
+ `string`
122
+
123
+ The context ID value.
124
+
125
+ #### Returns
126
+
127
+ `void`
128
+
129
+ ***
130
+
131
+ ### getContextIds()
132
+
133
+ > **getContextIds**(): `undefined` \| `IContextIds`
134
+
135
+ Get the context IDs for the engine.
136
+
137
+ #### Returns
138
+
139
+ `undefined` \| `IContextIds`
140
+
141
+ The context IDs or undefined if none are set.
142
+
143
+ ***
144
+
55
145
  ### start()
56
146
 
57
147
  > **start**(): `Promise`\<`boolean`\>
@@ -40,10 +40,6 @@ The type initialisers for the engine.
40
40
 
41
41
  > **type**: `string`
42
42
 
43
- #### typeConfig
44
-
45
- > **typeConfig**: [`IEngineCoreTypeConfig`](../type-aliases/IEngineCoreTypeConfig.md)[]
46
-
47
43
  #### module
48
44
 
49
45
  > **module**: `string`
@@ -66,8 +62,8 @@ The entity schemas for the engine.
66
62
 
67
63
  ***
68
64
 
69
- ### loggerTypeName
65
+ ### contextIdKeys
70
66
 
71
- > **loggerTypeName**: `string`
67
+ > **contextIdKeys**: `string`[]
72
68
 
73
- The logger type name.
69
+ The context ID keys.
@@ -64,3 +64,7 @@ The components.
64
64
  #### component
65
65
 
66
66
  > **component**: `IComponent`
67
+
68
+ #### started
69
+
70
+ > **started**: `boolean`
@@ -0,0 +1,59 @@
1
+ # Interface: IEngineModuleConfig
2
+
3
+ Configuration for an engine module.
4
+
5
+ ## Properties
6
+
7
+ ### id
8
+
9
+ > **id**: `string`
10
+
11
+ The unique identifier for the module.
12
+
13
+ ***
14
+
15
+ ### moduleName
16
+
17
+ > **moduleName**: `string`
18
+
19
+ The module that implements the additional component.
20
+
21
+ ***
22
+
23
+ ### className
24
+
25
+ > **className**: `string`
26
+
27
+ The class name of the additional component.
28
+
29
+ ***
30
+
31
+ ### dependencies?
32
+
33
+ > `optional` **dependencies**: `object`[]
34
+
35
+ Additional dependencies required by the component.
36
+
37
+ #### propertyName
38
+
39
+ > **propertyName**: `string`
40
+
41
+ #### componentName
42
+
43
+ > **componentName**: `string`
44
+
45
+ #### features?
46
+
47
+ > `optional` **features**: `string`[]
48
+
49
+ #### isOptional?
50
+
51
+ > `optional` **isOptional**: `boolean`
52
+
53
+ ***
54
+
55
+ ### config?
56
+
57
+ > `optional` **config**: `unknown`
58
+
59
+ Additional configuration for the component.
@@ -6,7 +6,7 @@ Interface describing the engine server methods.
6
6
 
7
7
  ### addRestRouteGenerator()
8
8
 
9
- > **addRestRouteGenerator**(`type`, `typeConfig`, `module`, `method`): `void`
9
+ > **addRestRouteGenerator**(`type`, `module`, `method`): `void`
10
10
 
11
11
  Add a REST route generator.
12
12
 
@@ -18,12 +18,6 @@ Add a REST route generator.
18
18
 
19
19
  The type to add the generator for.
20
20
 
21
- ##### typeConfig
22
-
23
- The type config.
24
-
25
- `undefined` | [`IEngineCoreTypeConfig`](../type-aliases/IEngineCoreTypeConfig.md)[]
26
-
27
21
  ##### module
28
22
 
29
23
  `string`
@@ -44,7 +38,7 @@ The method to call on the module.
44
38
 
45
39
  ### addSocketRouteGenerator()
46
40
 
47
- > **addSocketRouteGenerator**(`type`, `typeConfig`, `module`, `method`): `void`
41
+ > **addSocketRouteGenerator**(`type`, `module`, `method`): `void`
48
42
 
49
43
  Add a socket route generator.
50
44
 
@@ -56,12 +50,6 @@ Add a socket route generator.
56
50
 
57
51
  The type to add the generator for.
58
52
 
59
- ##### typeConfig
60
-
61
- The type config.
62
-
63
- `undefined` | [`IEngineCoreTypeConfig`](../type-aliases/IEngineCoreTypeConfig.md)[]
64
-
65
53
  ##### module
66
54
 
67
55
  `string`
@@ -1,11 +1,3 @@
1
1
  # Interface: IEngineState
2
2
 
3
3
  The state of the engine.
4
-
5
- ## Properties
6
-
7
- ### nodeIdentity?
8
-
9
- > `optional` **nodeIdentity**: `string`
10
-
11
- The identity for the node.
@@ -1,6 +1,6 @@
1
1
  # Type Alias: EngineTypeInitialiser()\<T\>
2
2
 
3
- > **EngineTypeInitialiser**\<`T`\> = (`engineCore`, `context`, `instanceConfig`, `overrideInstanceType?`) => `string` \| `undefined`
3
+ > **EngineTypeInitialiser**\<`T`\> = (`engineCore`, `context`, `instanceConfig`) => `Promise`\<[`EngineTypeInitialiserReturn`](../interfaces/EngineTypeInitialiserReturn.md)\>
4
4
 
5
5
  Method definition for the engine type initialiser.
6
6
 
@@ -24,10 +24,6 @@ Method definition for the engine type initialiser.
24
24
 
25
25
  `T`
26
26
 
27
- ### overrideInstanceType?
28
-
29
- `string`
30
-
31
27
  ## Returns
32
28
 
33
- `string` \| `undefined`
29
+ `Promise`\<[`EngineTypeInitialiserReturn`](../interfaces/EngineTypeInitialiserReturn.md)\>
@@ -4,22 +4,52 @@
4
4
 
5
5
  Configuration for the engine core type.
6
6
 
7
- ## Type declaration
7
+ ## Type Declaration
8
8
 
9
9
  ### overrideInstanceType?
10
10
 
11
11
  > `optional` **overrideInstanceType**: `string`
12
12
 
13
+ The instance type to override with.
14
+
13
15
  ### isDefault?
14
16
 
15
17
  > `optional` **isDefault**: `boolean`
16
18
 
19
+ Whether this is the default instance.
20
+
17
21
  ### features?
18
22
 
19
23
  > `optional` **features**: `string`[]
20
24
 
25
+ The features supported by this instance.
26
+
27
+ ### restPath?
28
+
29
+ > `optional` **restPath**: `string`
30
+
31
+ The path for the REST API.
32
+
33
+ ### restOptions?
34
+
35
+ > `optional` **restOptions**: `unknown`
36
+
37
+ The options for the REST API route generation.
38
+
39
+ ### socketPath?
40
+
41
+ > `optional` **socketPath**: `string`
42
+
43
+ The path for the socket API.
44
+
45
+ ### socketOptions?
46
+
47
+ > `optional` **socketOptions**: `unknown`
48
+
49
+ The options for the socket API route generation.
50
+
21
51
  ## Type Parameters
22
52
 
23
53
  ### T
24
54
 
25
- `T` *extends* [`IEngineCoreTypeBaseConfig`](../interfaces/IEngineCoreTypeBaseConfig.md) = \{ `type`: `string`; \}
55
+ `T` *extends* [`IEngineCoreTypeBaseConfig`](../interfaces/IEngineCoreTypeBaseConfig.md) = [`IEngineCoreTypeBaseConfig`](../interfaces/IEngineCoreTypeBaseConfig.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/engine-models",
3
- "version": "0.0.2-next.9",
3
+ "version": "0.0.3-next.2",
4
4
  "description": "Models which define the structure of the engine.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,25 +14,39 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
+ "@twin.org/context": "next",
17
18
  "@twin.org/core": "next",
18
19
  "@twin.org/entity": "next"
19
20
  },
20
- "main": "./dist/cjs/index.cjs",
21
- "module": "./dist/esm/index.mjs",
21
+ "main": "./dist/es/index.js",
22
22
  "types": "./dist/types/index.d.ts",
23
23
  "exports": {
24
24
  ".": {
25
25
  "types": "./dist/types/index.d.ts",
26
- "require": "./dist/cjs/index.cjs",
27
- "import": "./dist/esm/index.mjs"
26
+ "import": "./dist/es/index.js",
27
+ "default": "./dist/es/index.js"
28
28
  },
29
29
  "./locales/*.json": "./locales/*.json"
30
30
  },
31
31
  "files": [
32
- "dist/cjs",
33
- "dist/esm",
32
+ "dist/es",
34
33
  "dist/types",
35
34
  "locales",
36
35
  "docs"
37
- ]
36
+ ],
37
+ "keywords": [
38
+ "twin",
39
+ "trade",
40
+ "iota",
41
+ "framework",
42
+ "blockchain",
43
+ "engine",
44
+ "models",
45
+ "types",
46
+ "schemas"
47
+ ],
48
+ "bugs": {
49
+ "url": "git+https://github.com/twinfoundation/engine/issues"
50
+ },
51
+ "homepage": "https://twindev.org"
38
52
  }
@@ -1,22 +0,0 @@
1
- 'use strict';
2
-
3
- var core = require('@twin.org/core');
4
-
5
- // Copyright 2024 IOTA Stiftung.
6
- // SPDX-License-Identifier: Apache-2.0.
7
- /**
8
- * Factory for creating engine cores.
9
- */
10
- // eslint-disable-next-line @typescript-eslint/naming-convention
11
- const EngineCoreFactory = core.Factory.createFactory("engine-core");
12
-
13
- // Copyright 2024 IOTA Stiftung.
14
- // SPDX-License-Identifier: Apache-2.0.
15
- /**
16
- * Factory for creating engine servers.
17
- */
18
- // eslint-disable-next-line @typescript-eslint/naming-convention
19
- const EngineServerFactory = core.Factory.createFactory("engine-server");
20
-
21
- exports.EngineCoreFactory = EngineCoreFactory;
22
- exports.EngineServerFactory = EngineServerFactory;
@@ -1,19 +0,0 @@
1
- import { Factory } from '@twin.org/core';
2
-
3
- // Copyright 2024 IOTA Stiftung.
4
- // SPDX-License-Identifier: Apache-2.0.
5
- /**
6
- * Factory for creating engine cores.
7
- */
8
- // eslint-disable-next-line @typescript-eslint/naming-convention
9
- const EngineCoreFactory = Factory.createFactory("engine-core");
10
-
11
- // Copyright 2024 IOTA Stiftung.
12
- // SPDX-License-Identifier: Apache-2.0.
13
- /**
14
- * Factory for creating engine servers.
15
- */
16
- // eslint-disable-next-line @typescript-eslint/naming-convention
17
- const EngineServerFactory = Factory.createFactory("engine-server");
18
-
19
- export { EngineCoreFactory, EngineServerFactory };