@twin.org/engine-types 0.9.1-next.5 → 0.9.1-next.6
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.map +1 -1
- package/dist/es/components/logging.js +5 -0
- package/dist/es/components/logging.js.map +1 -1
- package/dist/es/models/config/loggingConnectorConfig.js.map +1 -1
- package/dist/es/models/types/loggingConnectorType.js +5 -1
- package/dist/es/models/types/loggingConnectorType.js.map +1 -1
- package/dist/types/models/config/loggingConnectorConfig.d.ts +4 -0
- package/dist/types/models/types/loggingConnectorType.d.ts +4 -0
- package/docs/changelog.md +15 -0
- package/docs/reference/type-aliases/LoggingConnectorConfig.md +1 -1
- package/docs/reference/variables/LoggingConnectorType.md +6 -0
- package/package.json +4 -3
|
@@ -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,KAA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ACzD,IAAI,+BAA+B,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC3D,gBAAgB,wCAAmD,CAAC;IACrE,CAAC;IAED,OAAO;QACN,eAAe,EAAE,eAAsE;QACvF,gBAAgB;QAChB,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,uCAAuC,CACtD,UAAsC,EACtC,OAA0C,EAC1C,gCAAoD,EACpD,oCAAwD;IAExD,+BAA+B,EAAE,CAAC;IAElC,MAAM,mBAAmB,GAAG,eAAe,CAAC,qBAAqB,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE;QAChG,aAAa,CAAC,IAAI;QAClB,aAAa,CAAC,MAAM;KACpB,CAAC,CAAC;IAEH,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,gCAAgC,qBAEhC,mBAAmB,CACnB,CAAC;IAEF,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,oCAAoC,yBAEpC,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}"]}
|
|
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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;SAAM,IAAI,cAAc,CAAC,IAAI,KAAK,kCAAkC,CAAC,UAAU,EAAE,CAAC;QAClF,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE,CACzD,IAAI,+BAA+B,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC3D,gBAAgB,wCAAmD,CAAC;IACrE,CAAC;IAED,OAAO;QACN,eAAe,EAAE,eAAsE;QACvF,gBAAgB;QAChB,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,uCAAuC,CACtD,UAAsC,EACtC,OAA0C,EAC1C,gCAAoD,EACpD,oCAAwD;IAExD,+BAA+B,EAAE,CAAC;IAElC,MAAM,mBAAmB,GAAG,eAAe,CAAC,qBAAqB,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE;QAChG,aAAa,CAAC,IAAI;QAClB,aAAa,CAAC,MAAM;KACpB,CAAC,CAAC;IAEH,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,gCAAgC,qBAEhC,mBAAmB,CACnB,CAAC;IAEF,gCAAgC,CAC/B,UAAU,EACV,OAAO,EACP,oCAAoC,yBAEpC,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}\n"]}
|
|
@@ -4,6 +4,7 @@ import { ContextIdHelper, ContextIdKeys } from "@twin.org/context";
|
|
|
4
4
|
import { ComponentFactory } from "@twin.org/core";
|
|
5
5
|
import { ConsoleLoggingConnector } from "@twin.org/logging-connector-console";
|
|
6
6
|
import { EntityStorageLoggingConnector, initSchema as initSchemaLogging } from "@twin.org/logging-connector-entity-storage";
|
|
7
|
+
import { FileLoggingConnector } from "@twin.org/logging-connector-file";
|
|
7
8
|
import { OpenTelemetryLoggingConnector } from "@twin.org/logging-connector-opentelemetry";
|
|
8
9
|
import { LoggingConnectorFactory, MultiLoggingConnector } from "@twin.org/logging-models";
|
|
9
10
|
import { LoggingRestClient } from "@twin.org/logging-rest-client";
|
|
@@ -47,6 +48,10 @@ export function initialiseLoggingConnector(engineCore, context, instanceConfig)
|
|
|
47
48
|
createComponent = (createConfig) => new OpenTelemetryLoggingConnector(EngineTypeHelper.mergeConfig(createConfig.options));
|
|
48
49
|
instanceTypeName = OpenTelemetryLoggingConnector.NAMESPACE;
|
|
49
50
|
}
|
|
51
|
+
else if (instanceConfig.type === LoggingConnectorType.File) {
|
|
52
|
+
createComponent = (createConfig) => new FileLoggingConnector(EngineTypeHelper.mergeConfig(createConfig.options));
|
|
53
|
+
instanceTypeName = FileLoggingConnector.NAMESPACE;
|
|
54
|
+
}
|
|
50
55
|
return {
|
|
51
56
|
createComponent: createComponent,
|
|
52
57
|
instanceTypeName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../../src/components/logging.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;AAMnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EACN,6BAA6B,EAC7B,UAAU,IAAI,iBAAiB,EAE/B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,6BAA6B,EAAE,MAAM,2CAA2C,CAAC;AAC1F,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAItE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE;;;;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Helper, ContextIdKeys } from \"@twin.org/context\";\nimport { ComponentFactory, type IComponent } from \"@twin.org/core\";\nimport type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport { ConsoleLoggingConnector } from \"@twin.org/logging-connector-console\";\nimport {\n\tEntityStorageLoggingConnector,\n\tinitSchema as initSchemaLogging,\n\ttype LogEntry\n} from \"@twin.org/logging-connector-entity-storage\";\nimport { OpenTelemetryLoggingConnector } from \"@twin.org/logging-connector-opentelemetry\";\nimport { LoggingConnectorFactory, MultiLoggingConnector } from \"@twin.org/logging-models\";\nimport { LoggingRestClient } from \"@twin.org/logging-rest-client\";\nimport { LoggingService } from \"@twin.org/logging-service\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport { initialiseEntityStorageConnector } from \"./entityStorage.js\";\nimport type { LoggingComponentConfig } from \"../models/config/loggingComponentConfig.js\";\nimport type { LoggingConnectorConfig } from \"../models/config/loggingConnectorConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { LoggingComponentType } from \"../models/types/loggingComponentType.js\";\nimport { LoggingConnectorType } from \"../models/types/loggingConnectorType.js\";\nimport { EngineTypeHelper } from \"../utils/engineTypeHelper.js\";\n\n/**\n * Initialise the logging connector.\n * @param engineCore The engine core.\n * @param context The engine core context.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport function initialiseLoggingConnector(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: LoggingConnectorConfig\n): EngineTypeInitialiserReturn<typeof instanceConfig, typeof LoggingConnectorFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === LoggingConnectorType.Console) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew ConsoleLoggingConnector(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = ConsoleLoggingConnector.NAMESPACE;\n\t} else if (instanceConfig.type === LoggingConnectorType.EntityStorage) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchemaLogging();\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.logEntryStorageConnectorType,\n\t\t\t\tnameof<LogEntry>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [\n\t\t\t\t\tContextIdKeys.Node,\n\t\t\t\t\tContextIdKeys.Tenant\n\t\t\t\t])\n\t\t\t);\n\t\t\treturn new EntityStorageLoggingConnector(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\tplatformComponentType: engineCore.getRegisteredInstanceType(\"platformComponent\")\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 = EntityStorageLoggingConnector.NAMESPACE;\n\t} else if (instanceConfig.type === LoggingConnectorType.Multi) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew MultiLoggingConnector(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = MultiLoggingConnector.NAMESPACE;\n\t} else if (instanceConfig.type === LoggingConnectorType.Otel) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew OpenTelemetryLoggingConnector(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = OpenTelemetryLoggingConnector.NAMESPACE;\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: LoggingConnectorFactory\n\t};\n}\n\n/**\n * Initialise the logging 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 initialiseLoggingComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: LoggingComponentConfig\n): EngineTypeInitialiserReturn<typeof instanceConfig, typeof ComponentFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === LoggingComponentType.Service) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew LoggingService(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\tloggingConnectorType: engineCore.getRegisteredInstanceType(\"loggingConnector\")\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(LoggingService);\n\t} else if (instanceConfig.type === LoggingComponentType.RestClient) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew LoggingRestClient(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(LoggingRestClient);\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"]}
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../../src/components/logging.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;AAMnE,OAAO,EAAE,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;KAChC,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CACzC,UAAsC,EACtC,OAA0C,EAC1C,cAAsC;IAEtC,IAAI,eAAe,CAAC;IACpB,IAAI,gBAAgB,CAAC;IAErB,IAAI,cAAc,CAAC,IAAI,KAAK,oBAAoB,CAAC,OAAO,EAAE,CAAC;QAC1D,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE,CACzD,IAAI,cAAc,CACjB,gBAAgB,CAAC,WAAW,CAC3B;YACC,oBAAoB,EAAE,UAAU,CAAC,yBAAyB,CAAC,kBAAkB,CAAC;SAC9E,EACD,YAAY,CAAC,OAAO,CACpB,CACD,CAAC;QACH,gBAAgB,oBAAkC,CAAC;IACpD,CAAC;SAAM,IAAI,cAAc,CAAC,IAAI,KAAK,oBAAoB,CAAC,UAAU,EAAE,CAAC;QACpE,eAAe,GAAG,CAAC,YAAmC,EAAE,EAAE,CACzD,IAAI,iBAAiB,CACpB,gBAAgB,CAAC,WAAW,CAAqC,YAAY,CAAC,OAAO,CAAC,CACtF,CAAC;QACH,gBAAgB,wBAAqC,CAAC;IACvD,CAAC;IAED,OAAO;QACN,eAAe,EAAE,eAAsE;QACvF,gBAAgB;QAChB,OAAO,EAAE,gBAAgB;KACzB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 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 type {\n\tEngineTypeInitialiserReturn,\n\tIEngineCore,\n\tIEngineCoreContext\n} from \"@twin.org/engine-models\";\nimport { ConsoleLoggingConnector } from \"@twin.org/logging-connector-console\";\nimport {\n\tEntityStorageLoggingConnector,\n\tinitSchema as initSchemaLogging,\n\ttype LogEntry\n} from \"@twin.org/logging-connector-entity-storage\";\nimport { FileLoggingConnector } from \"@twin.org/logging-connector-file\";\nimport { OpenTelemetryLoggingConnector } from \"@twin.org/logging-connector-opentelemetry\";\nimport { LoggingConnectorFactory, MultiLoggingConnector } from \"@twin.org/logging-models\";\nimport { LoggingRestClient } from \"@twin.org/logging-rest-client\";\nimport { LoggingService } from \"@twin.org/logging-service\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport { initialiseEntityStorageConnector } from \"./entityStorage.js\";\nimport type { LoggingComponentConfig } from \"../models/config/loggingComponentConfig.js\";\nimport type { LoggingConnectorConfig } from \"../models/config/loggingConnectorConfig.js\";\nimport type { IEngineConfig } from \"../models/IEngineConfig.js\";\nimport { LoggingComponentType } from \"../models/types/loggingComponentType.js\";\nimport { LoggingConnectorType } from \"../models/types/loggingConnectorType.js\";\nimport { EngineTypeHelper } from \"../utils/engineTypeHelper.js\";\n\n/**\n * Initialise the logging connector.\n * @param engineCore The engine core.\n * @param context The engine core context.\n * @param instanceConfig The instance config.\n * @returns The instance created and the factory for it.\n */\nexport function initialiseLoggingConnector(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: LoggingConnectorConfig\n): EngineTypeInitialiserReturn<typeof instanceConfig, typeof LoggingConnectorFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === LoggingConnectorType.Console) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew ConsoleLoggingConnector(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = ConsoleLoggingConnector.NAMESPACE;\n\t} else if (instanceConfig.type === LoggingConnectorType.EntityStorage) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) => {\n\t\t\tinitSchemaLogging();\n\t\t\tinitialiseEntityStorageConnector(\n\t\t\t\tengineCore,\n\t\t\t\tcontext,\n\t\t\t\tcreateConfig.options?.logEntryStorageConnectorType,\n\t\t\t\tnameof<LogEntry>(),\n\t\t\t\tContextIdHelper.pickKeysFromAvailable(engineCore.getContextIdKeys(), [\n\t\t\t\t\tContextIdKeys.Node,\n\t\t\t\t\tContextIdKeys.Tenant\n\t\t\t\t])\n\t\t\t);\n\t\t\treturn new EntityStorageLoggingConnector(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\tplatformComponentType: engineCore.getRegisteredInstanceType(\"platformComponent\")\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 = EntityStorageLoggingConnector.NAMESPACE;\n\t} else if (instanceConfig.type === LoggingConnectorType.Multi) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew MultiLoggingConnector(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = MultiLoggingConnector.NAMESPACE;\n\t} else if (instanceConfig.type === LoggingConnectorType.Otel) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew OpenTelemetryLoggingConnector(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = OpenTelemetryLoggingConnector.NAMESPACE;\n\t} else if (instanceConfig.type === LoggingConnectorType.File) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew FileLoggingConnector(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = FileLoggingConnector.NAMESPACE;\n\t}\n\n\treturn {\n\t\tcreateComponent: createComponent as (createConfig: typeof instanceConfig) => IComponent,\n\t\tinstanceTypeName,\n\t\tfactory: LoggingConnectorFactory\n\t};\n}\n\n/**\n * Initialise the logging 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 initialiseLoggingComponent(\n\tengineCore: IEngineCore<IEngineConfig>,\n\tcontext: IEngineCoreContext<IEngineConfig>,\n\tinstanceConfig: LoggingComponentConfig\n): EngineTypeInitialiserReturn<typeof instanceConfig, typeof ComponentFactory> {\n\tlet createComponent;\n\tlet instanceTypeName;\n\n\tif (instanceConfig.type === LoggingComponentType.Service) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew LoggingService(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(\n\t\t\t\t\t{\n\t\t\t\t\t\tloggingConnectorType: engineCore.getRegisteredInstanceType(\"loggingConnector\")\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(LoggingService);\n\t} else if (instanceConfig.type === LoggingComponentType.RestClient) {\n\t\tcreateComponent = (createConfig: typeof instanceConfig) =>\n\t\t\tnew LoggingRestClient(\n\t\t\t\tEngineTypeHelper.mergeConfig<(typeof instanceConfig)[\"options\"]>(createConfig.options)\n\t\t\t);\n\t\tinstanceTypeName = nameofKebabCase(LoggingRestClient);\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loggingConnectorConfig.js","sourceRoot":"","sources":["../../../../src/models/config/loggingConnectorConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IConsoleLoggingConnectorConstructorOptions } from \"@twin.org/logging-connector-console\";\nimport type { IEntityStorageLoggingConnectorConstructorOptions } from \"@twin.org/logging-connector-entity-storage\";\nimport type { IOpenTelemetryLoggingConnectorConstructorOptions } from \"@twin.org/logging-connector-opentelemetry\";\nimport type { IMultiLoggingConnectorConstructorOptions } from \"@twin.org/logging-models\";\nimport type { LoggingConnectorType } from \"../types/loggingConnectorType.js\";\n\n/**\n * Logging config connector types.\n */\nexport type LoggingConnectorConfig =\n\t| {\n\t\t\ttype: typeof LoggingConnectorType.EntityStorage;\n\t\t\toptions?: IEntityStorageLoggingConnectorConstructorOptions;\n\t }\n\t| {\n\t\t\ttype: typeof LoggingConnectorType.Console;\n\t\t\toptions?: IConsoleLoggingConnectorConstructorOptions;\n\t }\n\t| {\n\t\t\ttype: typeof LoggingConnectorType.Multi;\n\t\t\toptions: IMultiLoggingConnectorConstructorOptions;\n\t }\n\t| {\n\t\t\ttype: typeof LoggingConnectorType.Otel;\n\t\t\toptions?: IOpenTelemetryLoggingConnectorConstructorOptions;\n\t };\n"]}
|
|
1
|
+
{"version":3,"file":"loggingConnectorConfig.js","sourceRoot":"","sources":["../../../../src/models/config/loggingConnectorConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IConsoleLoggingConnectorConstructorOptions } from \"@twin.org/logging-connector-console\";\nimport type { IEntityStorageLoggingConnectorConstructorOptions } from \"@twin.org/logging-connector-entity-storage\";\nimport type { IFileLoggingConnectorConstructorOptions } from \"@twin.org/logging-connector-file\";\nimport type { IOpenTelemetryLoggingConnectorConstructorOptions } from \"@twin.org/logging-connector-opentelemetry\";\nimport type { IMultiLoggingConnectorConstructorOptions } from \"@twin.org/logging-models\";\nimport type { LoggingConnectorType } from \"../types/loggingConnectorType.js\";\n\n/**\n * Logging config connector types.\n */\nexport type LoggingConnectorConfig =\n\t| {\n\t\t\ttype: typeof LoggingConnectorType.EntityStorage;\n\t\t\toptions?: IEntityStorageLoggingConnectorConstructorOptions;\n\t }\n\t| {\n\t\t\ttype: typeof LoggingConnectorType.Console;\n\t\t\toptions?: IConsoleLoggingConnectorConstructorOptions;\n\t }\n\t| {\n\t\t\ttype: typeof LoggingConnectorType.Multi;\n\t\t\toptions: IMultiLoggingConnectorConstructorOptions;\n\t }\n\t| {\n\t\t\ttype: typeof LoggingConnectorType.Otel;\n\t\t\toptions?: IOpenTelemetryLoggingConnectorConstructorOptions;\n\t }\n\t| {\n\t\t\ttype: typeof LoggingConnectorType.File;\n\t\t\toptions: IFileLoggingConnectorConstructorOptions;\n\t };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loggingConnectorType.js","sourceRoot":"","sources":["../../../../src/models/types/loggingConnectorType.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,oBAAoB,GAAG;IACnC;;OAEG;IACH,aAAa,EAAE,gBAAgB;IAE/B;;OAEG;IACH,OAAO,EAAE,SAAS;IAElB;;OAEG;IACH,KAAK,EAAE,OAAO;IAEd;;OAEG;IACH,IAAI,EAAE,MAAM;CACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Logging connector types.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const LoggingConnectorType = {\n\t/**\n\t * Entity storage.\n\t */\n\tEntityStorage: \"entity-storage\",\n\n\t/**\n\t * Console.\n\t */\n\tConsole: \"console\",\n\n\t/**\n\t * Multi combines other loggers.\n\t */\n\tMulti: \"multi\",\n\n\t/**\n\t * OpenTelemetry.\n\t */\n\tOtel: \"otel\"\n} as const;\n\n/**\n * Logging connector types.\n */\nexport type LoggingConnectorType = (typeof LoggingConnectorType)[keyof typeof LoggingConnectorType];\n"]}
|
|
1
|
+
{"version":3,"file":"loggingConnectorType.js","sourceRoot":"","sources":["../../../../src/models/types/loggingConnectorType.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,oBAAoB,GAAG;IACnC;;OAEG;IACH,aAAa,EAAE,gBAAgB;IAE/B;;OAEG;IACH,OAAO,EAAE,SAAS;IAElB;;OAEG;IACH,KAAK,EAAE,OAAO;IAEd;;OAEG;IACH,IAAI,EAAE,MAAM;IAEZ;;OAEG;IACH,IAAI,EAAE,MAAM;CACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Logging connector types.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const LoggingConnectorType = {\n\t/**\n\t * Entity storage.\n\t */\n\tEntityStorage: \"entity-storage\",\n\n\t/**\n\t * Console.\n\t */\n\tConsole: \"console\",\n\n\t/**\n\t * Multi combines other loggers.\n\t */\n\tMulti: \"multi\",\n\n\t/**\n\t * OpenTelemetry.\n\t */\n\tOtel: \"otel\",\n\n\t/**\n\t * File.\n\t */\n\tFile: \"file\"\n} as const;\n\n/**\n * Logging connector types.\n */\nexport type LoggingConnectorType = (typeof LoggingConnectorType)[keyof typeof LoggingConnectorType];\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IConsoleLoggingConnectorConstructorOptions } from "@twin.org/logging-connector-console";
|
|
2
2
|
import type { IEntityStorageLoggingConnectorConstructorOptions } from "@twin.org/logging-connector-entity-storage";
|
|
3
|
+
import type { IFileLoggingConnectorConstructorOptions } from "@twin.org/logging-connector-file";
|
|
3
4
|
import type { IOpenTelemetryLoggingConnectorConstructorOptions } from "@twin.org/logging-connector-opentelemetry";
|
|
4
5
|
import type { IMultiLoggingConnectorConstructorOptions } from "@twin.org/logging-models";
|
|
5
6
|
import type { LoggingConnectorType } from "../types/loggingConnectorType.js";
|
|
@@ -18,4 +19,7 @@ export type LoggingConnectorConfig = {
|
|
|
18
19
|
} | {
|
|
19
20
|
type: typeof LoggingConnectorType.Otel;
|
|
20
21
|
options?: IOpenTelemetryLoggingConnectorConstructorOptions;
|
|
22
|
+
} | {
|
|
23
|
+
type: typeof LoggingConnectorType.File;
|
|
24
|
+
options: IFileLoggingConnectorConstructorOptions;
|
|
21
25
|
};
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.9.1-next.6](https://github.com/iotaledger/twin-engine/compare/engine-types-v0.9.1-next.5...engine-types-v0.9.1-next.6) (2026-07-20)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add file logging connector ([#184](https://github.com/iotaledger/twin-engine/issues/184)) ([918eb82](https://github.com/iotaledger/twin-engine/commit/918eb82ea5ef11cb311e03945dae163a8fb81096))
|
|
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.5 to 0.9.1-next.6
|
|
16
|
+
* @twin.org/engine-models bumped from 0.9.1-next.5 to 0.9.1-next.6
|
|
17
|
+
|
|
3
18
|
## [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
19
|
|
|
5
20
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Type Alias: LoggingConnectorConfig
|
|
2
2
|
|
|
3
|
-
> **LoggingConnectorConfig** = \{ `type`: *typeof* [`EntityStorage`](../variables/LoggingConnectorType.md#entitystorage); `options?`: `IEntityStorageLoggingConnectorConstructorOptions`; \} \| \{ `type`: *typeof* [`Console`](../variables/LoggingConnectorType.md#console); `options?`: `IConsoleLoggingConnectorConstructorOptions`; \} \| \{ `type`: *typeof* [`Multi`](../variables/LoggingConnectorType.md#multi); `options`: `IMultiLoggingConnectorConstructorOptions`; \} \| \{ `type`: *typeof* [`Otel`](../variables/LoggingConnectorType.md#otel); `options?`: `IOpenTelemetryLoggingConnectorConstructorOptions`; \}
|
|
3
|
+
> **LoggingConnectorConfig** = \{ `type`: *typeof* [`EntityStorage`](../variables/LoggingConnectorType.md#entitystorage); `options?`: `IEntityStorageLoggingConnectorConstructorOptions`; \} \| \{ `type`: *typeof* [`Console`](../variables/LoggingConnectorType.md#console); `options?`: `IConsoleLoggingConnectorConstructorOptions`; \} \| \{ `type`: *typeof* [`Multi`](../variables/LoggingConnectorType.md#multi); `options`: `IMultiLoggingConnectorConstructorOptions`; \} \| \{ `type`: *typeof* [`Otel`](../variables/LoggingConnectorType.md#otel); `options?`: `IOpenTelemetryLoggingConnectorConstructorOptions`; \} \| \{ `type`: *typeof* [`File`](../variables/LoggingConnectorType.md#file); `options`: `IFileLoggingConnectorConstructorOptions`; \}
|
|
4
4
|
|
|
5
5
|
Logging config connector types.
|
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.6",
|
|
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.6",
|
|
66
|
+
"@twin.org/engine-models": "0.9.1-next.6",
|
|
67
67
|
"@twin.org/entity": "next",
|
|
68
68
|
"@twin.org/entity-storage-connector-cosmosdb": "next",
|
|
69
69
|
"@twin.org/entity-storage-connector-dynamodb": "next",
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
"@twin.org/immutable-proof-service": "next",
|
|
97
97
|
"@twin.org/logging-connector-console": "next",
|
|
98
98
|
"@twin.org/logging-connector-entity-storage": "next",
|
|
99
|
+
"@twin.org/logging-connector-file": "next",
|
|
99
100
|
"@twin.org/logging-connector-opentelemetry": "next",
|
|
100
101
|
"@twin.org/logging-models": "next",
|
|
101
102
|
"@twin.org/logging-rest-client": "next",
|