@twin.org/engine-types 0.9.1-next.3 → 0.9.1-next.5
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/dataspaceControlPlane.js +21 -12
- package/dist/es/components/dataspaceControlPlane.js.map +1 -1
- package/dist/es/components/dataspaceDataPlane.js +2 -7
- package/dist/es/components/dataspaceDataPlane.js.map +1 -1
- package/dist/types/components/dataspaceControlPlane.d.ts +11 -0
- package/docs/changelog.md +30 -0
- package/docs/reference/functions/initialiseDataspaceSharedEntityStorages.md +38 -0
- package/docs/reference/index.md +1 -0
- package/package.json +3 -3
|
@@ -19,17 +19,7 @@ export function initialiseDataspaceControlPlaneComponent(engineCore, context, in
|
|
|
19
19
|
let instanceTypeName;
|
|
20
20
|
if (instanceConfig.type === DataspaceControlPlaneComponentType.Service) {
|
|
21
21
|
createComponent = (createConfig) => {
|
|
22
|
-
|
|
23
|
-
// Initialize entity storage for TransferProcessEntity.
|
|
24
|
-
// This storage is shared with Data Plane service. Both planes must
|
|
25
|
-
// register the same connector name with the same partition keys,
|
|
26
|
-
// otherwise initialiseEntityStorageConnector silently drops the
|
|
27
|
-
// second registration and the two layers disagree on where records
|
|
28
|
-
// live.
|
|
29
|
-
const partitionContextIds = ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node, ContextIdKeys.Tenant]);
|
|
30
|
-
initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.transferProcessEntityStorageType, "TransferProcess", partitionContextIds);
|
|
31
|
-
// Tenant-supplied partial datasets are stored [Node]-only
|
|
32
|
-
initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.dataspaceAppDatasetEntityStorageType, "DataspaceAppDataset", partitionContextIds);
|
|
22
|
+
initialiseDataspaceSharedEntityStorages(engineCore, context, instanceConfig.options?.transferProcessEntityStorageType, instanceConfig.options?.dataspaceAppDatasetEntityStorageType);
|
|
33
23
|
return new DataspaceControlPlaneService(EngineTypeHelper.mergeConfig({
|
|
34
24
|
loggingComponentType: engineCore.getRegisteredInstanceTypeOptional("loggingComponent"),
|
|
35
25
|
trustComponentType: engineCore.getRegisteredInstanceTypeOptional("trustComponent"),
|
|
@@ -40,7 +30,7 @@ export function initialiseDataspaceControlPlaneComponent(engineCore, context, in
|
|
|
40
30
|
identityComponentType: engineCore.getRegisteredInstanceTypeOptional("identityComponent"),
|
|
41
31
|
identityAuthenticationComponentType: engineCore.getRegisteredInstanceTypeOptional("identityAuthenticationComponent"),
|
|
42
32
|
taskSchedulerComponentType: engineCore.getRegisteredInstanceTypeOptional("taskSchedulerComponent"),
|
|
43
|
-
dataPlaneComponentType: engineCore.
|
|
33
|
+
dataPlaneComponentType: engineCore.getRegisteredInstanceType("dataspaceDataPlaneComponent"),
|
|
44
34
|
platformComponentType: engineCore.getRegisteredInstanceType("platformComponent"),
|
|
45
35
|
telemetryComponentType: engineCore.getRegisteredInstanceTypeOptional("telemetryComponent")
|
|
46
36
|
}, createConfig.options));
|
|
@@ -57,4 +47,23 @@ export function initialiseDataspaceControlPlaneComponent(engineCore, context, in
|
|
|
57
47
|
factory: ComponentFactory
|
|
58
48
|
};
|
|
59
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Initialise the shared entity storages used by both control and data plane services.
|
|
52
|
+
* Both planes must register the same connector name with the same partition keys,
|
|
53
|
+
* otherwise initialiseEntityStorageConnector silently drops the second registration
|
|
54
|
+
* and the two layers disagree on where records live.
|
|
55
|
+
* @param engineCore The engine core.
|
|
56
|
+
* @param context The context for the engine.
|
|
57
|
+
* @param transferProcessEntityStorageType The entity storage type for transfer processes.
|
|
58
|
+
* @param dataspaceAppDatasetEntityStorageType The entity storage type for dataspace app datasets.
|
|
59
|
+
*/
|
|
60
|
+
export function initialiseDataspaceSharedEntityStorages(engineCore, context, transferProcessEntityStorageType, dataspaceAppDatasetEntityStorageType) {
|
|
61
|
+
initSchemaDataspaceControlPlane();
|
|
62
|
+
const partitionContextIds = ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [
|
|
63
|
+
ContextIdKeys.Node,
|
|
64
|
+
ContextIdKeys.Tenant
|
|
65
|
+
]);
|
|
66
|
+
initialiseEntityStorageConnector(engineCore, context, transferProcessEntityStorageType, "TransferProcess", partitionContextIds);
|
|
67
|
+
initialiseEntityStorageConnector(engineCore, context, dataspaceAppDatasetEntityStorageType, "DataspaceAppDataset", partitionContextIds);
|
|
68
|
+
}
|
|
60
69
|
//# sourceMappingURL=dataspaceControlPlane.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataspaceControlPlane.js","sourceRoot":"","sources":["../../../src/components/dataspaceControlPlane.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,+BAA+B,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,EACN,4BAA4B,EAC5B,UAAU,IAAI,+BAA+B,EAC7C,MAAM,2CAA2C,CAAC;AAQnD,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAGtE,OAAO,EAAE,kCAAkC,EAAE,MAAM,uDAAuD,CAAC;AAC3G,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,UAAU,wCAAwC,CACvD,UAAsC,EACtC,OAA0C,EAC1C,cAAoD;IAEpD,IAAI,eAAe,CAAC;IACpB,IAAI,gBAAgB,CAAC;IAErB,IAAI,cAAc,CAAC,IAAI,KAAK,kCAAkC,CAAC,OAAO,EAAE,CAAC;QACxE,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE;YACzD
|
|
1
|
+
{"version":3,"file":"dataspaceControlPlane.js","sourceRoot":"","sources":["../../../src/components/dataspaceControlPlane.ts"],"names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BAEpC,mBAAmB,CACnB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ContextIdHelper, ContextIdKeys } from \"@twin.org/context\";\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport { DataspaceControlPlaneRestClient } from \"@twin.org/dataspace-control-plane-rest-client\";\nimport {\n\tDataspaceControlPlaneService,\n\tinitSchema as initSchemaDataspaceControlPlane\n} from \"@twin.org/dataspace-control-plane-service\";\nimport type { DataspaceAppDataset, TransferProcess } from \"@twin.org/dataspace-models\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport { initialiseEntityStorageConnector } from \"./entityStorage.js\";\nimport type { DataspaceControlPlaneComponentConfig } from \"../models/config/dataspaceControlPlaneComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { DataspaceControlPlaneComponentType } from \"../models/types/dataspaceControlPlaneComponentType.js\";\nimport { EngineTypeHelper } from \"../utils/engineTypeHelper.js\";\n\n/**\n * Initialise the dataspace control plane 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 initialiseDataspaceControlPlaneComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: DataspaceControlPlaneComponentConfig\n): EngineTypeInitialiserReturn<DataspaceControlPlaneComponentConfig, typeof ComponentFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === DataspaceControlPlaneComponentType.Service) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitialiseDataspaceSharedEntityStorages(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tinstanceConfig.options?.transferProcessEntityStorageType,\n\t\t\t\tinstanceConfig.options?.dataspaceAppDatasetEntityStorageType\n\t\t\t);\n\n\t\t\treturn new DataspaceControlPlaneService(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\tloggingComponentType: engineCore.getRegisteredInstanceTypeOptional(\"loggingComponent\"),\n\t\t\t\t\t\ttrustComponentType: engineCore.getRegisteredInstanceTypeOptional(\"trustComponent\"),\n\t\t\t\t\t\tpolicyAdministrationPointComponentType: engineCore.getRegisteredInstanceType(\n\t\t\t\t\t\t\t\"rightsManagementPapComponent\"\n\t\t\t\t\t\t),\n\t\t\t\t\t\tpolicyNegotiationPointComponentType: engineCore.getRegisteredInstanceType(\n\t\t\t\t\t\t\t\"rightsManagementPnpComponent\"\n\t\t\t\t\t\t),\n\t\t\t\t\t\tpolicyNegotiationAdminPointComponentType: engineCore.getRegisteredInstanceType(\n\t\t\t\t\t\t\t\"rightsManagementPnapComponent\"\n\t\t\t\t\t\t),\n\t\t\t\t\t\tfederatedCatalogueComponentType: engineCore.getRegisteredInstanceType(\n\t\t\t\t\t\t\t\"federatedCatalogueComponent\"\n\t\t\t\t\t\t),\n\t\t\t\t\t\tidentityComponentType:\n\t\t\t\t\t\t\tengineCore.getRegisteredInstanceTypeOptional(\"identityComponent\"),\n\t\t\t\t\t\tidentityAuthenticationComponentType: engineCore.getRegisteredInstanceTypeOptional(\n\t\t\t\t\t\t\t\"identityAuthenticationComponent\"\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttaskSchedulerComponentType:\n\t\t\t\t\t\t\tengineCore.getRegisteredInstanceTypeOptional(\"taskSchedulerComponent\"),\n\t\t\t\t\t\tdataPlaneComponentType: engineCore.getRegisteredInstanceType(\n\t\t\t\t\t\t\t\"dataspaceDataPlaneComponent\"\n\t\t\t\t\t\t),\n\t\t\t\t\t\tplatformComponentType: engineCore.getRegisteredInstanceType(\"platformComponent\"),\n\t\t\t\t\t\ttelemetryComponentType:\n\t\t\t\t\t\t\tengineCore.getRegisteredInstanceTypeOptional(\"telemetryComponent\")\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\tinstanceTypeName = nameofKebabCase(DataspaceControlPlaneService);\n\t} else if (instanceConfig.type === DataspaceControlPlaneComponentType.RestClient) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew DataspaceControlPlaneRestClient(createConfig.options);\n\t\tinstanceTypeName = nameofKebabCase(DataspaceControlPlaneRestClient);\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: ComponentFactory\n\t};\n}\n\n/**\n * Initialise the shared entity storages used by both control and data plane services.\n * Both planes must register the same connector name with the same partition keys,\n * otherwise initialiseEntityStorageConnector silently drops the second registration\n * and the two layers disagree on where records live.\n * @param engineCore The engine core.\n * @param context The context for the engine.\n * @param transferProcessEntityStorageType The entity storage type for transfer processes.\n * @param dataspaceAppDatasetEntityStorageType The entity storage type for dataspace app datasets.\n */\nexport function initialiseDataspaceSharedEntityStorages(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\ttransferProcessEntityStorageType: string | undefined,\n\tdataspaceAppDatasetEntityStorageType: string | undefined\n): void {\n\tinitSchemaDataspaceControlPlane();\n\n\tconst partitionContextIds = ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [\n\t\tContextIdKeys.Node,\n\t\tContextIdKeys.Tenant\n\t]);\n\n\tinitialiseEntityStorageConnector(\n\t\tengineCore,\n\t\tcontext,\n\t\ttransferProcessEntityStorageType,\n\t\tnameof<TransferProcess>(),\n\t\tpartitionContextIds\n\t);\n\n\tinitialiseEntityStorageConnector(\n\t\tengineCore,\n\t\tcontext,\n\t\tdataspaceAppDatasetEntityStorageType,\n\t\tnameof<DataspaceAppDataset>(),\n\t\tpartitionContextIds\n\t);\n}"]}
|
|
@@ -5,6 +5,7 @@ import { ComponentFactory } from "@twin.org/core";
|
|
|
5
5
|
import { DataspaceDataPlaneRestClient } from "@twin.org/dataspace-data-plane-rest-client";
|
|
6
6
|
import { DataspaceDataPlaneService, initSchema as initSchemaDataspaceDataPlane } from "@twin.org/dataspace-data-plane-service";
|
|
7
7
|
import { DataspaceDataPlaneSocketClient } from "@twin.org/dataspace-data-plane-socket-client";
|
|
8
|
+
import { initialiseDataspaceSharedEntityStorages } from "./dataspaceControlPlane.js";
|
|
8
9
|
import { initialiseEntityStorageConnector } from "./entityStorage.js";
|
|
9
10
|
import { DataspaceDataPlaneComponentType } from "../models/types/dataspaceDataPlaneComponentType.js";
|
|
10
11
|
import { EngineTypeHelper } from "../utils/engineTypeHelper.js";
|
|
@@ -21,16 +22,10 @@ export function initialiseDataspaceDataPlaneComponent(engineCore, context, insta
|
|
|
21
22
|
if (instanceConfig.type === DataspaceDataPlaneComponentType.Service) {
|
|
22
23
|
createComponent = (createConfig) => {
|
|
23
24
|
initSchemaDataspaceDataPlane();
|
|
25
|
+
initialiseDataspaceSharedEntityStorages(engineCore, context, instanceConfig.options?.transferProcessEntityStorageType, instanceConfig.options?.dataspaceAppDatasetEntityStorageType);
|
|
24
26
|
const partitionContextIds = ContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [ContextIdKeys.Node, ContextIdKeys.Tenant]);
|
|
25
|
-
// Initialize entity storage for ActivityLogDetails and ActivityTask
|
|
26
27
|
initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.activityLogEntityStorageType, "ActivityLogDetails", partitionContextIds);
|
|
27
28
|
initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.activityTaskEntityStorageType, "ActivityTask", partitionContextIds);
|
|
28
|
-
// TransferProcessEntity storage is shared with Control Plane.
|
|
29
|
-
initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.transferProcessEntityStorageType, "TransferProcess", partitionContextIds);
|
|
30
|
-
// DataspaceAppDataset storage is also shared with the Control Plane —
|
|
31
|
-
// register here too in case the DP component initialises before
|
|
32
|
-
// the CP one in the engine startup order. Read-only on this side.
|
|
33
|
-
initialiseEntityStorageConnector(engineCore, context, instanceConfig.options?.dataspaceAppDatasetEntityStorageType, "DataspaceAppDataset", partitionContextIds);
|
|
34
29
|
// PushSubscription storage backs the push-mode transfer lifecycle on the data plane.
|
|
35
30
|
// Pull-only deployments still register the storage so the optional push path is usable
|
|
36
31
|
// without engine-config changes if/when a consumer requests it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataspaceDataPlane.js","sourceRoot":"","sources":["../../../src/components/dataspaceDataPlane.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAGN,yBAAyB,EAEzB,UAAU,IAAI,4BAA4B,EAC1C,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,8BAA8B,EAAE,MAAM,8CAA8C,CAAC;
|
|
1
|
+
{"version":3,"file":"dataspaceDataPlane.js","sourceRoot":"","sources":["../../../src/components/dataspaceDataPlane.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAGN,yBAAyB,EAEzB,UAAU,IAAI,4BAA4B,EAC1C,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,8BAA8B,EAAE,MAAM,8CAA8C,CAAC;AAO9F,OAAO,E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C;gBACtF,2BAA2B,EAC1B,UAAU,CAAC,iCAAiC,CAAC,yBAAyB,CAAC;gBACxE,0BAA0B,EACzB,UAAU,CAAC,iCAAiC,CAAC,wBAAwB,CAAC;gBACvE,kBAAkB,EAAE,UAAU,CAAC,iCAAiC,CAAC,gBAAgB,CAAC;gBAClF,gBAAgB,EAAE,UAAU,CAAC,iCAAiC,CAC7D,8BAA8B,CAC9B;gBACD,qBAAqB,EAAE,UAAU,CAAC,yBAAyB,CAAC,mBAAmB,CAAC;gBAChF,sBAAsB,EACrB,UAAU,CAAC,iCAAiC,CAAC,oBAAoB,CAAC;aACnE,EACD,YAAY,CAAC,OAAO,CACpB,CACD,CAAC;QACH,CAAC,CAAC;QACF,gBAAgB,iCAA6C,CAAC;IAC/D,CAAC;SAAM,IAAI,cAAc,CAAC,IAAI,KAAK,+BAA+B,CAAC,UAAU,EAAE,CAAC;QAC/E,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE,CACzD,IAAI,4BAA4B,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACxD,gBAAgB,qCAAgD,CAAC;IAClE,CAAC;SAAM,IAAI,cAAc,CAAC,IAAI,KAAK,+BAA+B,CAAC,YAAY,EAAE,CAAC;QACjF,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE,CACzD,IAAI,8BAA8B,CACjC,gBAAgB,CAAC,WAAW,CAC3B;YACC,oBAAoB,EAAE,UAAU,CAAC,iCAAiC,CAAC,kBAAkB,CAAC;SACtF,EACD,YAAY,CAAC,OAAO,CACpB,CACD,CAAC;QACH,gBAAgB,uCAAkD,CAAC;IACpE,CAAC;IAED,OAAO;QACN,eAAe,EAAE,eAAsE;QACvF,gBAAgB;QAChB,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ContextIdHelper, ContextIdKeys } from \"@twin.org/context\";\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport { DataspaceDataPlaneRestClient } from \"@twin.org/dataspace-data-plane-rest-client\";\nimport {\n\ttype ActivityLogDetails,\n\ttype ActivityTask,\n\tDataspaceDataPlaneService,\n\ttype PushSubscription,\n\tinitSchema as initSchemaDataspaceDataPlane\n} from \"@twin.org/dataspace-data-plane-service\";\nimport { DataspaceDataPlaneSocketClient } from \"@twin.org/dataspace-data-plane-socket-client\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport { initialiseDataspaceSharedEntityStorages } from \"./dataspaceControlPlane.js\";\nimport { initialiseEntityStorageConnector } from \"./entityStorage.js\";\nimport type { DataspaceDataPlaneComponentConfig } from \"../models/config/dataspaceDataPlaneComponentConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { DataspaceDataPlaneComponentType } from \"../models/types/dataspaceDataPlaneComponentType.js\";\nimport { EngineTypeHelper } from \"../utils/engineTypeHelper.js\";\n\n/**\n * Initialise the dataspace data plane 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 initialiseDataspaceDataPlaneComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: DataspaceDataPlaneComponentConfig\n): EngineTypeInitialiserReturn<DataspaceDataPlaneComponentConfig, typeof ComponentFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === DataspaceDataPlaneComponentType.Service) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchemaDataspaceDataPlane();\n\n\t\t\tinitialiseDataspaceSharedEntityStorages(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tinstanceConfig.options?.transferProcessEntityStorageType,\n\t\t\t\tinstanceConfig.options?.dataspaceAppDatasetEntityStorageType\n\t\t\t);\n\n\t\t\tconst partitionContextIds = ContextIdHelper.pickKeysFromAvailable(\n\t\t\t\tengineCore.getContextIdKeys(),\n\t\t\t\t[ContextIdKeys.Node, ContextIdKeys.Tenant]\n\t\t\t);\n\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tinstanceConfig.options?.activityLogEntityStorageType,\n\t\t\t\tnameof<ActivityLogDetails>(),\n\t\t\t\tpartitionContextIds\n\t\t\t);\n\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tinstanceConfig.options?.activityTaskEntityStorageType,\n\t\t\t\tnameof<ActivityTask>(),\n\t\t\t\tpartitionContextIds\n\t\t\t);\n\n\t\t\t// PushSubscription storage backs the push-mode transfer lifecycle on the data plane.\n\t\t\t// Pull-only deployments still register the storage so the optional push path is usable\n\t\t\t// without engine-config changes if/when a consumer requests it.\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tinstanceConfig.options?.pushSubscriptionEntityStorageType,\n\t\t\t\tnameof<PushSubscription>(),\n\t\t\t\tpartitionContextIds\n\t\t\t);\n\n\t\t\treturn new DataspaceDataPlaneService(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\tloggingComponentType: engineCore.getRegisteredInstanceTypeOptional(\"loggingComponent\"),\n\t\t\t\t\t\tbackgroundTaskComponentType:\n\t\t\t\t\t\t\tengineCore.getRegisteredInstanceTypeOptional(\"backgroundTaskComponent\"),\n\t\t\t\t\t\ttaskSchedulerComponentType:\n\t\t\t\t\t\t\tengineCore.getRegisteredInstanceTypeOptional(\"taskSchedulerComponent\"),\n\t\t\t\t\t\ttrustComponentType: engineCore.getRegisteredInstanceTypeOptional(\"trustComponent\"),\n\t\t\t\t\t\tpepComponentType: engineCore.getRegisteredInstanceTypeOptional(\n\t\t\t\t\t\t\t\"rightsManagementPepComponent\"\n\t\t\t\t\t\t),\n\t\t\t\t\t\tplatformComponentType: engineCore.getRegisteredInstanceType(\"platformComponent\"),\n\t\t\t\t\t\ttelemetryComponentType:\n\t\t\t\t\t\t\tengineCore.getRegisteredInstanceTypeOptional(\"telemetryComponent\")\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\tinstanceTypeName = nameofKebabCase(DataspaceDataPlaneService);\n\t} else if (instanceConfig.type === DataspaceDataPlaneComponentType.RestClient) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew DataspaceDataPlaneRestClient(createConfig.options);\n\t\tinstanceTypeName = nameofKebabCase(DataspaceDataPlaneRestClient);\n\t} else if (instanceConfig.type === DataspaceDataPlaneComponentType.SocketClient) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew DataspaceDataPlaneSocketClient(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\tloggingComponentType: engineCore.getRegisteredInstanceTypeOptional(\"loggingComponent\")\n\t\t\t\t\t},\n\t\t\t\t\tcreateConfig.options\n\t\t\t\t)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(DataspaceDataPlaneSocketClient);\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: ComponentFactory\n\t};\n}\n"]}
|
|
@@ -10,3 +10,14 @@ import type { IEngineConfig } from "../models/IEngineConfig.js";
|
|
|
10
10
|
* @returns The instance created and the factory for it.
|
|
11
11
|
*/
|
|
12
12
|
export declare function initialiseDataspaceControlPlaneComponent(engineCore: IEngineCore<IEngineConfig>, context: IEngineCoreContext<IEngineConfig>, instanceConfig: DataspaceControlPlaneComponentConfig): EngineTypeInitialiserReturn<DataspaceControlPlaneComponentConfig, typeof ComponentFactory>;
|
|
13
|
+
/**
|
|
14
|
+
* Initialise the shared entity storages used by both control and data plane services.
|
|
15
|
+
* Both planes must register the same connector name with the same partition keys,
|
|
16
|
+
* otherwise initialiseEntityStorageConnector silently drops the second registration
|
|
17
|
+
* and the two layers disagree on where records live.
|
|
18
|
+
* @param engineCore The engine core.
|
|
19
|
+
* @param context The context for the engine.
|
|
20
|
+
* @param transferProcessEntityStorageType The entity storage type for transfer processes.
|
|
21
|
+
* @param dataspaceAppDatasetEntityStorageType The entity storage type for dataspace app datasets.
|
|
22
|
+
*/
|
|
23
|
+
export declare function initialiseDataspaceSharedEntityStorages(engineCore: IEngineCore<IEngineConfig>, context: IEngineCoreContext<IEngineConfig>, transferProcessEntityStorageType: string | undefined, dataspaceAppDatasetEntityStorageType: string | undefined): void;
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.9.1-next.5](https://github.com/iotaledger/twin-engine/compare/engine-types-v0.9.1-next.4...engine-types-v0.9.1-next.5) (2026-07-02)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* dataspace ordering ([#180](https://github.com/iotaledger/twin-engine/issues/180)) ([e319596](https://github.com/iotaledger/twin-engine/commit/e31959689e7037618b530740bc023a9c499e5924))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/engine-core bumped from 0.9.1-next.4 to 0.9.1-next.5
|
|
16
|
+
* @twin.org/engine-models bumped from 0.9.1-next.4 to 0.9.1-next.5
|
|
17
|
+
|
|
18
|
+
## [0.9.1-next.4](https://github.com/iotaledger/twin-engine/compare/engine-types-v0.9.1-next.3...engine-types-v0.9.1-next.4) (2026-06-30)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Miscellaneous Chores
|
|
22
|
+
|
|
23
|
+
* **engine-types:** Synchronize repo versions
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Dependencies
|
|
27
|
+
|
|
28
|
+
* The following workspace dependencies were updated
|
|
29
|
+
* dependencies
|
|
30
|
+
* @twin.org/engine-core bumped from 0.9.1-next.3 to 0.9.1-next.4
|
|
31
|
+
* @twin.org/engine-models bumped from 0.9.1-next.3 to 0.9.1-next.4
|
|
32
|
+
|
|
3
33
|
## [0.9.1-next.3](https://github.com/iotaledger/twin-engine/compare/engine-types-v0.9.1-next.2...engine-types-v0.9.1-next.3) (2026-06-29)
|
|
4
34
|
|
|
5
35
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Function: initialiseDataspaceSharedEntityStorages()
|
|
2
|
+
|
|
3
|
+
> **initialiseDataspaceSharedEntityStorages**(`engineCore`, `context`, `transferProcessEntityStorageType`, `dataspaceAppDatasetEntityStorageType`): `void`
|
|
4
|
+
|
|
5
|
+
Initialise the shared entity storages used by both control and data plane services.
|
|
6
|
+
Both planes must register the same connector name with the same partition keys,
|
|
7
|
+
otherwise initialiseEntityStorageConnector silently drops the second registration
|
|
8
|
+
and the two layers disagree on where records live.
|
|
9
|
+
|
|
10
|
+
## Parameters
|
|
11
|
+
|
|
12
|
+
### engineCore
|
|
13
|
+
|
|
14
|
+
`IEngineCore`\<[`IEngineConfig`](../interfaces/IEngineConfig.md)\>
|
|
15
|
+
|
|
16
|
+
The engine core.
|
|
17
|
+
|
|
18
|
+
### context
|
|
19
|
+
|
|
20
|
+
`IEngineCoreContext`\<[`IEngineConfig`](../interfaces/IEngineConfig.md)\>
|
|
21
|
+
|
|
22
|
+
The context for the engine.
|
|
23
|
+
|
|
24
|
+
### transferProcessEntityStorageType
|
|
25
|
+
|
|
26
|
+
`string` \| `undefined`
|
|
27
|
+
|
|
28
|
+
The entity storage type for transfer processes.
|
|
29
|
+
|
|
30
|
+
### dataspaceAppDatasetEntityStorageType
|
|
31
|
+
|
|
32
|
+
`string` \| `undefined`
|
|
33
|
+
|
|
34
|
+
The entity storage type for dataspace app datasets.
|
|
35
|
+
|
|
36
|
+
## Returns
|
|
37
|
+
|
|
38
|
+
`void`
|
package/docs/reference/index.md
CHANGED
|
@@ -243,6 +243,7 @@
|
|
|
243
243
|
- [initialiseDataExtractorConnector](functions/initialiseDataExtractorConnector.md)
|
|
244
244
|
- [initialiseDataProcessingComponent](functions/initialiseDataProcessingComponent.md)
|
|
245
245
|
- [initialiseDataspaceControlPlaneComponent](functions/initialiseDataspaceControlPlaneComponent.md)
|
|
246
|
+
- [initialiseDataspaceSharedEntityStorages](functions/initialiseDataspaceSharedEntityStorages.md)
|
|
246
247
|
- [initialiseDataspaceDataPlaneComponent](functions/initialiseDataspaceDataPlaneComponent.md)
|
|
247
248
|
- [initialiseDocumentManagementComponent](functions/initialiseDocumentManagementComponent.md)
|
|
248
249
|
- [initialiseEntityStorageConnector](functions/initialiseEntityStorageConnector.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/engine-types",
|
|
3
|
-
"version": "0.9.1-next.
|
|
3
|
+
"version": "0.9.1-next.5",
|
|
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.9.1-next.
|
|
66
|
-
"@twin.org/engine-models": "0.9.1-next.
|
|
65
|
+
"@twin.org/engine-core": "0.9.1-next.5",
|
|
66
|
+
"@twin.org/engine-models": "0.9.1-next.5",
|
|
67
67
|
"@twin.org/entity": "next",
|
|
68
68
|
"@twin.org/entity-storage-connector-cosmosdb": "next",
|
|
69
69
|
"@twin.org/entity-storage-connector-dynamodb": "next",
|