@twin.org/engine-types 0.0.3-next.48 → 0.0.3-next.49
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/schemaVersionMigration.js +17 -11
- package/dist/es/components/schemaVersionMigration.js.map +1 -1
- package/dist/es/models/config/schemaVersionMigrationComponentConfig.js.map +1 -1
- package/dist/types/models/config/schemaVersionMigrationComponentConfig.d.ts +2 -0
- package/docs/changelog.md +15 -0
- package/docs/reference/type-aliases/SchemaVersionMigrationComponentConfig.md +6 -0
- package/package.json +3 -3
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// Copyright 2026 IOTA Stiftung.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
3
|
import { ComponentFactory } from "@twin.org/core";
|
|
4
|
-
import {
|
|
4
|
+
import { SchemaVersionService, initSchema } from "@twin.org/entity-storage-service";
|
|
5
5
|
import { initialiseEntityStorageConnector } from "./entityStorage.js";
|
|
6
|
+
import { SchemaVersionMigrationComponentType } from "../models/types/schemaVersionMigrationComponentType.js";
|
|
7
|
+
import { EngineTypeHelper } from "../utils/engineTypeHelper.js";
|
|
6
8
|
/**
|
|
7
9
|
* Initialise the schema version migration component.
|
|
8
10
|
* @param engineCore The engine core.
|
|
@@ -11,18 +13,22 @@ import { initialiseEntityStorageConnector } from "./entityStorage.js";
|
|
|
11
13
|
* @returns The instance created and the factory for it.
|
|
12
14
|
*/
|
|
13
15
|
export function initialiseSchemaVersionMigrationComponent(engineCore, context, instanceConfig) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
let createComponent;
|
|
17
|
+
let instanceTypeName;
|
|
18
|
+
if (instanceConfig.type === SchemaVersionMigrationComponentType.Service) {
|
|
19
|
+
createComponent = (createConfig) => {
|
|
20
|
+
initSchema();
|
|
21
|
+
// No partition keys ([] not [Node]) schema versions track
|
|
22
|
+
// entity type structure globally — there is no per-context versioning and no scenario
|
|
23
|
+
// where migrations should read from a different connector than the rest of entity storage.
|
|
24
|
+
initialiseEntityStorageConnector(engineCore, context, createConfig.options?.schemaVersionStorageType, "SchemaVersion", []);
|
|
25
|
+
return new SchemaVersionService(EngineTypeHelper.mergeConfig(createConfig.options));
|
|
26
|
+
};
|
|
27
|
+
instanceTypeName = "schema-version-service";
|
|
28
|
+
}
|
|
23
29
|
return {
|
|
24
30
|
createComponent,
|
|
25
|
-
instanceTypeName
|
|
31
|
+
instanceTypeName,
|
|
26
32
|
factory: ComponentFactory
|
|
27
33
|
};
|
|
28
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaVersionMigration.js","sourceRoot":"","sources":["../../../src/components/schemaVersionMigration.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"schemaVersionMigration.js","sourceRoot":"","sources":["../../../src/components/schemaVersionMigration.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAMlD,OAAO,EAEN,oBAAoB,EACpB,UAAU,EACV,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAGtE,OAAO,EAAE,mCAAmC,EAAE,MAAM,wDAAwD,CAAC;AAC7G,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,UAAU,yCAAyC,CACxD,UAAsC,EACtC,OAA0C,EAC1C,cAAqD;IAErD,IAAI,eAAe,CAAC;IACpB,IAAI,gBAAgB,CAAC;IAErB,IAAI,cAAc,CAAC,IAAI,KAAK,mCAAmC,CAAC,OAAO,EAAE,CAAC;QACzE,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE;YACzD,UAAU,EAAE,CAAC;YAEb,0DAA0D;YAC1D,sFAAsF;YACtF,2FAA2F;YAC3F,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,YAAY,CAAC,OAAO,EAAE,wBAAwB,mBAE9C,EAAE,CACF,CAAC;YACF,OAAO,IAAI,oBAAoB,CAC9B,gBAAgB,CAAC,WAAW,CAAqC,YAAY,CAAC,OAAO,CAAC,CACtF,CAAC;QACH,CAAC,CAAC;QACF,gBAAgB,2BAAwC,CAAC;IAC1D,CAAC;IAED,OAAO;QACN,eAAe;QACf,gBAAgB;QAChB,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory } from \"@twin.org/core\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport {\n\ttype SchemaVersion,\n\tSchemaVersionService,\n\tinitSchema\n} from \"@twin.org/entity-storage-service\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport { initialiseEntityStorageConnector } from \"./entityStorage.js\";\nimport type { SchemaVersionMigrationComponentConfig } from \"../models/config/schemaVersionMigrationComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { SchemaVersionMigrationComponentType } from \"../models/types/schemaVersionMigrationComponentType.js\";\nimport { EngineTypeHelper } from \"../utils/engineTypeHelper.js\";\n\n/**\n * Initialise the schema version migration 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 function initialiseSchemaVersionMigrationComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: SchemaVersionMigrationComponentConfig\n): EngineTypeInitialiserReturn<typeof instanceConfig, typeof ComponentFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === SchemaVersionMigrationComponentType.Service) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchema();\n\n\t\t\t// No partition keys ([] not [Node]) schema versions track\n\t\t\t// entity type structure globally — there is no per-context versioning and no scenario\n\t\t\t// where migrations should read from a different connector than the rest of entity storage.\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.schemaVersionStorageType,\n\t\t\t\tnameof<SchemaVersion>(),\n\t\t\t\t[]\n\t\t\t);\n\t\t\treturn new SchemaVersionService(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\t};\n\t\tinstanceTypeName = nameofKebabCase(SchemaVersionService);\n\t}\n\n\treturn {\n\t\tcreateComponent,\n\t\tinstanceTypeName,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaVersionMigrationComponentConfig.js","sourceRoot":"","sources":["../../../../src/models/config/schemaVersionMigrationComponentConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { SchemaVersionMigrationComponentType } from \"../types/schemaVersionMigrationComponentType.js\";\n\n/**\n * Schema version migration component config types.\n */\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type SchemaVersionMigrationComponentConfig = {\n\ttype: typeof SchemaVersionMigrationComponentType.Service;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"schemaVersionMigrationComponentConfig.js","sourceRoot":"","sources":["../../../../src/models/config/schemaVersionMigrationComponentConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { ISchemaVersionServiceConstructorOptions } from \"@twin.org/entity-storage-service\";\nimport type { SchemaVersionMigrationComponentType } from \"../types/schemaVersionMigrationComponentType.js\";\n\n/**\n * Schema version migration component config types.\n */\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type SchemaVersionMigrationComponentConfig = {\n\ttype: typeof SchemaVersionMigrationComponentType.Service;\n\toptions?: ISchemaVersionServiceConstructorOptions;\n};\n"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { ISchemaVersionServiceConstructorOptions } from "@twin.org/entity-storage-service";
|
|
1
2
|
import type { SchemaVersionMigrationComponentType } from "../types/schemaVersionMigrationComponentType.js";
|
|
2
3
|
/**
|
|
3
4
|
* Schema version migration component config types.
|
|
4
5
|
*/
|
|
5
6
|
export type SchemaVersionMigrationComponentConfig = {
|
|
6
7
|
type: typeof SchemaVersionMigrationComponentType.Service;
|
|
8
|
+
options?: ISchemaVersionServiceConstructorOptions;
|
|
7
9
|
};
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.49](https://github.com/iotaledger/twin-engine/compare/engine-types-v0.0.3-next.48...engine-types-v0.0.3-next.49) (2026-06-09)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* schema migration ([#147](https://github.com/iotaledger/twin-engine/issues/147)) ([2026f19](https://github.com/iotaledger/twin-engine/commit/2026f195e7a8d930d20cd43c7ff8ac4d003e454d))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/engine-core bumped from 0.0.3-next.48 to 0.0.3-next.49
|
|
16
|
+
* @twin.org/engine-models bumped from 0.0.3-next.48 to 0.0.3-next.49
|
|
17
|
+
|
|
3
18
|
## [0.0.3-next.48](https://github.com/iotaledger/twin-engine/compare/engine-types-v0.0.3-next.47...engine-types-v0.0.3-next.48) (2026-06-08)
|
|
4
19
|
|
|
5
20
|
|
|
@@ -9,3 +9,9 @@ Schema version migration component config types.
|
|
|
9
9
|
### type {#type}
|
|
10
10
|
|
|
11
11
|
> **type**: *typeof* [`Service`](../variables/SchemaVersionMigrationComponentType.md#service)
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### options? {#options}
|
|
16
|
+
|
|
17
|
+
> `optional` **options?**: `ISchemaVersionServiceConstructorOptions`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/engine-types",
|
|
3
|
-
"version": "0.0.3-next.
|
|
3
|
+
"version": "0.0.3-next.49",
|
|
4
4
|
"description": "Component and connector type definitions with configuration helpers for engine composition.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"@twin.org/document-management-models": "next",
|
|
63
63
|
"@twin.org/document-management-rest-client": "next",
|
|
64
64
|
"@twin.org/document-management-service": "next",
|
|
65
|
-
"@twin.org/engine-core": "0.0.3-next.
|
|
66
|
-
"@twin.org/engine-models": "0.0.3-next.
|
|
65
|
+
"@twin.org/engine-core": "0.0.3-next.49",
|
|
66
|
+
"@twin.org/engine-models": "0.0.3-next.49",
|
|
67
67
|
"@twin.org/entity": "next",
|
|
68
68
|
"@twin.org/entity-storage-connector-cosmosdb": "next",
|
|
69
69
|
"@twin.org/entity-storage-connector-dynamodb": "next",
|