@twin.org/engine-types 0.0.2-next.15 → 0.0.2-next.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1309,6 +1309,19 @@ async function initialiseEventBusComponent(engineCore, context, instanceConfig,
1309
1309
  return finalInstanceType;
1310
1310
  }
1311
1311
 
1312
+ // Copyright 2024 IOTA Stiftung.
1313
+ // SPDX-License-Identifier: Apache-2.0.
1314
+ /**
1315
+ * DLT config types.
1316
+ */
1317
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1318
+ const DltConfigType = {
1319
+ /**
1320
+ * IOTA.
1321
+ */
1322
+ Iota: "iota"
1323
+ };
1324
+
1312
1325
  // Copyright 2024 IOTA Stiftung.
1313
1326
  // SPDX-License-Identifier: Apache-2.0.
1314
1327
  /**
@@ -1326,6 +1339,37 @@ const FaucetConnectorType = {
1326
1339
  Iota: "iota"
1327
1340
  };
1328
1341
 
1342
+ // Copyright 2024 IOTA Stiftung.
1343
+ // SPDX-License-Identifier: Apache-2.0.
1344
+ /**
1345
+ * Helper methods for engine config types.
1346
+ */
1347
+ class EngineTypeHelper {
1348
+ /**
1349
+ * Runtime name for the class.
1350
+ */
1351
+ static CLASS_NAME = "EngineTypeHelper";
1352
+ /**
1353
+ * Get the config for the specified component and type.
1354
+ * @param engineConfig The engine configuration.
1355
+ * @param component The component name.
1356
+ * @param type The type name.
1357
+ * @returns The config for the specified component and type or undefined if it does not exist.
1358
+ */
1359
+ static getConfigOfType(engineConfig, component, type) {
1360
+ if (core.Is.empty(engineConfig.types[component])) {
1361
+ return undefined;
1362
+ }
1363
+ // First look for any of the specific type marked as default
1364
+ let foundConfig = engineConfig.types[component]?.find(config => config.type === type && config.isDefault);
1365
+ // If we found a default config then return that otherwise return the first matching type
1366
+ if (core.Is.empty(foundConfig)) {
1367
+ foundConfig = engineConfig.types[component]?.find(config => config.type === type);
1368
+ }
1369
+ return foundConfig;
1370
+ }
1371
+ }
1372
+
1329
1373
  // Copyright 2024 IOTA Stiftung.
1330
1374
  // SPDX-License-Identifier: Apache-2.0.
1331
1375
  /**
@@ -1345,8 +1389,7 @@ async function initialiseFaucetConnector(engineCore, context, instanceConfig, ov
1345
1389
  let connector;
1346
1390
  let instanceType;
1347
1391
  if (type === FaucetConnectorType.Iota) {
1348
- const defaultConfigType = engineCore.getRegisteredInstanceType("dltConfig");
1349
- const dltConfig = context.config.types.dltConfig?.find(dlt => dlt.type === defaultConfigType);
1392
+ const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
1350
1393
  connector = new walletConnectorIota.IotaFaucetConnector({
1351
1394
  ...instanceConfig.options,
1352
1395
  config: {
@@ -1495,8 +1538,7 @@ async function initialiseIdentityConnector(engineCore, context, instanceConfig,
1495
1538
  let connector;
1496
1539
  let instanceType;
1497
1540
  if (type === IdentityConnectorType.Iota) {
1498
- const defaultConfigType = engineCore.getRegisteredInstanceType("dltConfig");
1499
- const dltConfig = context.config.types.dltConfig?.find(dlt => dlt.type === defaultConfigType);
1541
+ const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
1500
1542
  connector = new identityConnectorIota.IotaIdentityConnector({
1501
1543
  vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
1502
1544
  ...instanceConfig.options,
@@ -1730,8 +1772,7 @@ async function initialiseIdentityResolverConnector(engineCore, context, instance
1730
1772
  let connector;
1731
1773
  let instanceType;
1732
1774
  if (type === IdentityResolverConnectorType.Iota) {
1733
- const defaultConfigType = engineCore.getRegisteredInstanceType("dltConfig");
1734
- const dltConfig = context.config.types.dltConfig?.find(dlt => dlt.type === defaultConfigType);
1775
+ const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
1735
1776
  connector = new identityConnectorIota.IotaIdentityResolverConnector({
1736
1777
  ...instanceConfig.options,
1737
1778
  config: {
@@ -2289,10 +2330,16 @@ async function initialiseNftConnector(engineCore, context, instanceConfig, overr
2289
2330
  instanceType = nftConnectorEntityStorage.EntityStorageNftConnector.NAMESPACE;
2290
2331
  }
2291
2332
  else if (type === NftConnectorType.Iota) {
2333
+ const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
2292
2334
  connector = new nftConnectorIota.IotaNftConnector({
2293
2335
  vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
2294
2336
  walletConnectorType: engineCore.getRegisteredInstanceType("walletConnector"),
2295
- ...instanceConfig.options
2337
+ loggingComponentType: engineCore.getRegisteredInstanceTypeOptional("loggingComponent"),
2338
+ ...instanceConfig.options,
2339
+ config: {
2340
+ ...dltConfig?.options?.config,
2341
+ ...instanceConfig.options.config
2342
+ }
2296
2343
  });
2297
2344
  instanceType = nftConnectorIota.IotaNftConnector.NAMESPACE;
2298
2345
  }
@@ -3368,10 +3415,10 @@ async function initialiseVerifiableStorageConnector(engineCore, context, instanc
3368
3415
  let connector;
3369
3416
  let instanceType;
3370
3417
  if (type === VerifiableStorageConnectorType.Iota) {
3371
- const defaultConfigType = engineCore.getRegisteredInstanceType("dltConfig");
3372
- const dltConfig = context.config.types.dltConfig?.find(dlt => dlt.type === defaultConfigType);
3418
+ const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
3373
3419
  connector = new verifiableStorageConnectorIota.IotaVerifiableStorageConnector({
3374
3420
  vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
3421
+ loggingComponentType: engineCore.getRegisteredInstanceTypeOptional("loggingComponent"),
3375
3422
  ...instanceConfig.options,
3376
3423
  config: {
3377
3424
  ...dltConfig?.options?.config,
@@ -3477,8 +3524,7 @@ async function initialiseWalletConnector(engineCore, context, instanceConfig, ov
3477
3524
  let connector;
3478
3525
  let instanceType;
3479
3526
  if (type === WalletConnectorType.Iota) {
3480
- const defaultConfigType = engineCore.getRegisteredInstanceType("dltConfig");
3481
- const dltConfig = context.config.types.dltConfig?.find(dlt => dlt.type === defaultConfigType);
3527
+ const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
3482
3528
  connector = new walletConnectorIota.IotaWalletConnector({
3483
3529
  vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
3484
3530
  faucetConnectorType: engineCore.getRegisteredInstanceType("faucetConnector"),
@@ -3537,19 +3583,6 @@ async function initialiseWalletStorage(engineCore, context, instanceConfig, over
3537
3583
  return undefined;
3538
3584
  }
3539
3585
 
3540
- // Copyright 2024 IOTA Stiftung.
3541
- // SPDX-License-Identifier: Apache-2.0.
3542
- /**
3543
- * DLT config types.
3544
- */
3545
- // eslint-disable-next-line @typescript-eslint/naming-convention
3546
- const DltConfigType = {
3547
- /**
3548
- * IOTA.
3549
- */
3550
- Iota: "iota"
3551
- };
3552
-
3553
3586
  exports.AttestationComponentType = AttestationComponentType;
3554
3587
  exports.AttestationConnectorType = AttestationConnectorType;
3555
3588
  exports.AuditableItemGraphComponentType = AuditableItemGraphComponentType;
@@ -3564,6 +3597,7 @@ exports.DataProcessingComponentType = DataProcessingComponentType;
3564
3597
  exports.DataSpaceConnectorComponentType = DataSpaceConnectorComponentType;
3565
3598
  exports.DltConfigType = DltConfigType;
3566
3599
  exports.DocumentManagementComponentType = DocumentManagementComponentType;
3600
+ exports.EngineTypeHelper = EngineTypeHelper;
3567
3601
  exports.EntityStorageComponentType = EntityStorageComponentType;
3568
3602
  exports.EntityStorageConnectorType = EntityStorageConnectorType;
3569
3603
  exports.EventBusComponentType = EventBusComponentType;
@@ -1307,6 +1307,19 @@ async function initialiseEventBusComponent(engineCore, context, instanceConfig,
1307
1307
  return finalInstanceType;
1308
1308
  }
1309
1309
 
1310
+ // Copyright 2024 IOTA Stiftung.
1311
+ // SPDX-License-Identifier: Apache-2.0.
1312
+ /**
1313
+ * DLT config types.
1314
+ */
1315
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1316
+ const DltConfigType = {
1317
+ /**
1318
+ * IOTA.
1319
+ */
1320
+ Iota: "iota"
1321
+ };
1322
+
1310
1323
  // Copyright 2024 IOTA Stiftung.
1311
1324
  // SPDX-License-Identifier: Apache-2.0.
1312
1325
  /**
@@ -1324,6 +1337,37 @@ const FaucetConnectorType = {
1324
1337
  Iota: "iota"
1325
1338
  };
1326
1339
 
1340
+ // Copyright 2024 IOTA Stiftung.
1341
+ // SPDX-License-Identifier: Apache-2.0.
1342
+ /**
1343
+ * Helper methods for engine config types.
1344
+ */
1345
+ class EngineTypeHelper {
1346
+ /**
1347
+ * Runtime name for the class.
1348
+ */
1349
+ static CLASS_NAME = "EngineTypeHelper";
1350
+ /**
1351
+ * Get the config for the specified component and type.
1352
+ * @param engineConfig The engine configuration.
1353
+ * @param component The component name.
1354
+ * @param type The type name.
1355
+ * @returns The config for the specified component and type or undefined if it does not exist.
1356
+ */
1357
+ static getConfigOfType(engineConfig, component, type) {
1358
+ if (Is.empty(engineConfig.types[component])) {
1359
+ return undefined;
1360
+ }
1361
+ // First look for any of the specific type marked as default
1362
+ let foundConfig = engineConfig.types[component]?.find(config => config.type === type && config.isDefault);
1363
+ // If we found a default config then return that otherwise return the first matching type
1364
+ if (Is.empty(foundConfig)) {
1365
+ foundConfig = engineConfig.types[component]?.find(config => config.type === type);
1366
+ }
1367
+ return foundConfig;
1368
+ }
1369
+ }
1370
+
1327
1371
  // Copyright 2024 IOTA Stiftung.
1328
1372
  // SPDX-License-Identifier: Apache-2.0.
1329
1373
  /**
@@ -1343,8 +1387,7 @@ async function initialiseFaucetConnector(engineCore, context, instanceConfig, ov
1343
1387
  let connector;
1344
1388
  let instanceType;
1345
1389
  if (type === FaucetConnectorType.Iota) {
1346
- const defaultConfigType = engineCore.getRegisteredInstanceType("dltConfig");
1347
- const dltConfig = context.config.types.dltConfig?.find(dlt => dlt.type === defaultConfigType);
1390
+ const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
1348
1391
  connector = new IotaFaucetConnector({
1349
1392
  ...instanceConfig.options,
1350
1393
  config: {
@@ -1493,8 +1536,7 @@ async function initialiseIdentityConnector(engineCore, context, instanceConfig,
1493
1536
  let connector;
1494
1537
  let instanceType;
1495
1538
  if (type === IdentityConnectorType.Iota) {
1496
- const defaultConfigType = engineCore.getRegisteredInstanceType("dltConfig");
1497
- const dltConfig = context.config.types.dltConfig?.find(dlt => dlt.type === defaultConfigType);
1539
+ const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
1498
1540
  connector = new IotaIdentityConnector({
1499
1541
  vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
1500
1542
  ...instanceConfig.options,
@@ -1728,8 +1770,7 @@ async function initialiseIdentityResolverConnector(engineCore, context, instance
1728
1770
  let connector;
1729
1771
  let instanceType;
1730
1772
  if (type === IdentityResolverConnectorType.Iota) {
1731
- const defaultConfigType = engineCore.getRegisteredInstanceType("dltConfig");
1732
- const dltConfig = context.config.types.dltConfig?.find(dlt => dlt.type === defaultConfigType);
1773
+ const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
1733
1774
  connector = new IotaIdentityResolverConnector({
1734
1775
  ...instanceConfig.options,
1735
1776
  config: {
@@ -2287,10 +2328,16 @@ async function initialiseNftConnector(engineCore, context, instanceConfig, overr
2287
2328
  instanceType = EntityStorageNftConnector.NAMESPACE;
2288
2329
  }
2289
2330
  else if (type === NftConnectorType.Iota) {
2331
+ const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
2290
2332
  connector = new IotaNftConnector({
2291
2333
  vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
2292
2334
  walletConnectorType: engineCore.getRegisteredInstanceType("walletConnector"),
2293
- ...instanceConfig.options
2335
+ loggingComponentType: engineCore.getRegisteredInstanceTypeOptional("loggingComponent"),
2336
+ ...instanceConfig.options,
2337
+ config: {
2338
+ ...dltConfig?.options?.config,
2339
+ ...instanceConfig.options.config
2340
+ }
2294
2341
  });
2295
2342
  instanceType = IotaNftConnector.NAMESPACE;
2296
2343
  }
@@ -3366,10 +3413,10 @@ async function initialiseVerifiableStorageConnector(engineCore, context, instanc
3366
3413
  let connector;
3367
3414
  let instanceType;
3368
3415
  if (type === VerifiableStorageConnectorType.Iota) {
3369
- const defaultConfigType = engineCore.getRegisteredInstanceType("dltConfig");
3370
- const dltConfig = context.config.types.dltConfig?.find(dlt => dlt.type === defaultConfigType);
3416
+ const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
3371
3417
  connector = new IotaVerifiableStorageConnector({
3372
3418
  vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
3419
+ loggingComponentType: engineCore.getRegisteredInstanceTypeOptional("loggingComponent"),
3373
3420
  ...instanceConfig.options,
3374
3421
  config: {
3375
3422
  ...dltConfig?.options?.config,
@@ -3475,8 +3522,7 @@ async function initialiseWalletConnector(engineCore, context, instanceConfig, ov
3475
3522
  let connector;
3476
3523
  let instanceType;
3477
3524
  if (type === WalletConnectorType.Iota) {
3478
- const defaultConfigType = engineCore.getRegisteredInstanceType("dltConfig");
3479
- const dltConfig = context.config.types.dltConfig?.find(dlt => dlt.type === defaultConfigType);
3525
+ const dltConfig = EngineTypeHelper.getConfigOfType(engineCore.getConfig(), "dltConfig", DltConfigType.Iota);
3480
3526
  connector = new IotaWalletConnector({
3481
3527
  vaultConnectorType: engineCore.getRegisteredInstanceType("vaultConnector"),
3482
3528
  faucetConnectorType: engineCore.getRegisteredInstanceType("faucetConnector"),
@@ -3535,17 +3581,4 @@ async function initialiseWalletStorage(engineCore, context, instanceConfig, over
3535
3581
  return undefined;
3536
3582
  }
3537
3583
 
3538
- // Copyright 2024 IOTA Stiftung.
3539
- // SPDX-License-Identifier: Apache-2.0.
3540
- /**
3541
- * DLT config types.
3542
- */
3543
- // eslint-disable-next-line @typescript-eslint/naming-convention
3544
- const DltConfigType = {
3545
- /**
3546
- * IOTA.
3547
- */
3548
- Iota: "iota"
3549
- };
3550
-
3551
- export { AttestationComponentType, AttestationConnectorType, AuditableItemGraphComponentType, AuditableItemStreamComponentType, AuthenticationGeneratorComponentType, BackgroundTaskConnectorType, BlobStorageComponentType, BlobStorageConnectorType, DataConverterConnectorType, DataExtractorConnectorType, DataProcessingComponentType, DataSpaceConnectorComponentType, DltConfigType, DocumentManagementComponentType, EntityStorageComponentType, EntityStorageConnectorType, EventBusComponentType, EventBusConnectorType, FaucetConnectorType, FederatedCatalogueComponentType, IdentityComponentType, IdentityConnectorType, IdentityProfileComponentType, IdentityProfileConnectorType, IdentityResolverComponentType, IdentityResolverConnectorType, ImmutableProofComponentType, LoggingComponentType, LoggingConnectorType, MessagingComponentType, MessagingEmailConnectorType, MessagingPushNotificationConnectorType, MessagingSmsConnectorType, NftComponentType, NftConnectorType, RightsManagementDapComponentType, RightsManagementDarpComponentType, RightsManagementPapComponentType, RightsManagementPdpComponentType, RightsManagementPepComponentType, RightsManagementPipComponentType, RightsManagementPmpComponentType, RightsManagementPnapComponentType, RightsManagementPnpComponentType, RightsManagementPxpComponentType, SynchronisedStorageComponentType, TaskSchedulerComponentType, TelemetryComponentType, TelemetryConnectorType, VaultConnectorType, VerifiableStorageComponentType, VerifiableStorageConnectorType, WalletConnectorType, initialiseAttestationComponent, initialiseAttestationConnector, initialiseAuditableItemGraphComponent, initialiseAuditableItemStreamComponent, initialiseAuthenticationGeneratorComponent, initialiseBackgroundTaskConnector, initialiseBlobStorageComponent, initialiseBlobStorageConnector, initialiseDataConverterConnector, initialiseDataExtractorConnector, initialiseDataProcessingComponent, initialiseDataSpaceConnectorComponent, initialiseDocumentManagementComponent, initialiseEntityStorageComponent, initialiseEntityStorageConnector, initialiseEventBusComponent, initialiseEventBusConnector, initialiseFaucetConnector, initialiseFederatedCatalogueComponent, initialiseIdentityComponent, initialiseIdentityConnector, initialiseIdentityProfileComponent, initialiseIdentityProfileConnector, initialiseIdentityResolverComponent, initialiseIdentityResolverConnector, initialiseImmutableProofComponent, initialiseLoggingComponent, initialiseLoggingConnector, initialiseMessagingComponent, initialiseMessagingEmailConnector, initialiseMessagingPushNotificationConnector, initialiseMessagingSmsConnector, initialiseNftComponent, initialiseNftConnector, initialiseRightsManagementDapComponent, initialiseRightsManagementDarpComponent, initialiseRightsManagementPapComponent, initialiseRightsManagementPdpComponent, initialiseRightsManagementPepComponent, initialiseRightsManagementPipComponent, initialiseRightsManagementPmpComponent, initialiseRightsManagementPnapComponent, initialiseRightsManagementPnpComponent, initialiseRightsManagementPxpComponent, initialiseSynchronisedStorageComponent, initialiseTaskSchedulerComponent, initialiseTelemetryComponent, initialiseTelemetryConnector, initialiseVaultConnector, initialiseVerifiableStorageComponent, initialiseVerifiableStorageConnector, initialiseWalletConnector, initialiseWalletStorage };
3584
+ export { AttestationComponentType, AttestationConnectorType, AuditableItemGraphComponentType, AuditableItemStreamComponentType, AuthenticationGeneratorComponentType, BackgroundTaskConnectorType, BlobStorageComponentType, BlobStorageConnectorType, DataConverterConnectorType, DataExtractorConnectorType, DataProcessingComponentType, DataSpaceConnectorComponentType, DltConfigType, DocumentManagementComponentType, EngineTypeHelper, EntityStorageComponentType, EntityStorageConnectorType, EventBusComponentType, EventBusConnectorType, FaucetConnectorType, FederatedCatalogueComponentType, IdentityComponentType, IdentityConnectorType, IdentityProfileComponentType, IdentityProfileConnectorType, IdentityResolverComponentType, IdentityResolverConnectorType, ImmutableProofComponentType, LoggingComponentType, LoggingConnectorType, MessagingComponentType, MessagingEmailConnectorType, MessagingPushNotificationConnectorType, MessagingSmsConnectorType, NftComponentType, NftConnectorType, RightsManagementDapComponentType, RightsManagementDarpComponentType, RightsManagementPapComponentType, RightsManagementPdpComponentType, RightsManagementPepComponentType, RightsManagementPipComponentType, RightsManagementPmpComponentType, RightsManagementPnapComponentType, RightsManagementPnpComponentType, RightsManagementPxpComponentType, SynchronisedStorageComponentType, TaskSchedulerComponentType, TelemetryComponentType, TelemetryConnectorType, VaultConnectorType, VerifiableStorageComponentType, VerifiableStorageConnectorType, WalletConnectorType, initialiseAttestationComponent, initialiseAttestationConnector, initialiseAuditableItemGraphComponent, initialiseAuditableItemStreamComponent, initialiseAuthenticationGeneratorComponent, initialiseBackgroundTaskConnector, initialiseBlobStorageComponent, initialiseBlobStorageConnector, initialiseDataConverterConnector, initialiseDataExtractorConnector, initialiseDataProcessingComponent, initialiseDataSpaceConnectorComponent, initialiseDocumentManagementComponent, initialiseEntityStorageComponent, initialiseEntityStorageConnector, initialiseEventBusComponent, initialiseEventBusConnector, initialiseFaucetConnector, initialiseFederatedCatalogueComponent, initialiseIdentityComponent, initialiseIdentityConnector, initialiseIdentityProfileComponent, initialiseIdentityProfileConnector, initialiseIdentityResolverComponent, initialiseIdentityResolverConnector, initialiseImmutableProofComponent, initialiseLoggingComponent, initialiseLoggingConnector, initialiseMessagingComponent, initialiseMessagingEmailConnector, initialiseMessagingPushNotificationConnector, initialiseMessagingSmsConnector, initialiseNftComponent, initialiseNftConnector, initialiseRightsManagementDapComponent, initialiseRightsManagementDarpComponent, initialiseRightsManagementPapComponent, initialiseRightsManagementPdpComponent, initialiseRightsManagementPepComponent, initialiseRightsManagementPipComponent, initialiseRightsManagementPmpComponent, initialiseRightsManagementPnapComponent, initialiseRightsManagementPnpComponent, initialiseRightsManagementPxpComponent, initialiseSynchronisedStorageComponent, initialiseTaskSchedulerComponent, initialiseTelemetryComponent, initialiseTelemetryConnector, initialiseVaultConnector, initialiseVerifiableStorageComponent, initialiseVerifiableStorageConnector, initialiseWalletConnector, initialiseWalletStorage };
@@ -141,3 +141,4 @@ export * from "./models/types/vaultConnectorType";
141
141
  export * from "./models/types/verifiableStorageComponentType";
142
142
  export * from "./models/types/verifiableStorageConnectorType";
143
143
  export * from "./models/types/walletConnectorType";
144
+ export * from "./utils/engineTypeHelper";
@@ -0,0 +1,19 @@
1
+ import type { IEngineCoreTypeBaseConfig, IEngineCoreTypeConfig } from "@twin.org/engine-models";
2
+ import type { IEngineConfig } from "../models/IEngineConfig";
3
+ /**
4
+ * Helper methods for engine config types.
5
+ */
6
+ export declare class EngineTypeHelper {
7
+ /**
8
+ * Runtime name for the class.
9
+ */
10
+ static readonly CLASS_NAME: string;
11
+ /**
12
+ * Get the config for the specified component and type.
13
+ * @param engineConfig The engine configuration.
14
+ * @param component The component name.
15
+ * @param type The type name.
16
+ * @returns The config for the specified component and type or undefined if it does not exist.
17
+ */
18
+ static getConfigOfType<T extends IEngineCoreTypeBaseConfig>(engineConfig: IEngineConfig, component: string, type: string): IEngineCoreTypeConfig<T> | undefined;
19
+ }
package/docs/changelog.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @twin.org/engine-types - Changelog
2
2
 
3
+ ## [0.0.2-next.16](https://github.com/twinfoundation/engine/compare/engine-types-v0.0.2-next.15...engine-types-v0.0.2-next.16) (2025-09-25)
4
+
5
+
6
+ ### Features
7
+
8
+ * add engine type helper for config lookups ([7d5eeef](https://github.com/twinfoundation/engine/commit/7d5eeefd3e7b9daab1ba20e2fb6b1ebfec178aec))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/engine-core bumped from 0.0.2-next.15 to 0.0.2-next.16
16
+ * @twin.org/engine-models bumped from 0.0.2-next.15 to 0.0.2-next.16
17
+
3
18
  ## [0.0.2-next.15](https://github.com/twinfoundation/engine/compare/engine-types-v0.0.2-next.14...engine-types-v0.0.2-next.15) (2025-09-24)
4
19
 
5
20
 
@@ -0,0 +1,61 @@
1
+ # Class: EngineTypeHelper
2
+
3
+ Helper methods for engine config types.
4
+
5
+ ## Constructors
6
+
7
+ ### Constructor
8
+
9
+ > **new EngineTypeHelper**(): `EngineTypeHelper`
10
+
11
+ #### Returns
12
+
13
+ `EngineTypeHelper`
14
+
15
+ ## Properties
16
+
17
+ ### CLASS\_NAME
18
+
19
+ > `readonly` `static` **CLASS\_NAME**: `string`
20
+
21
+ Runtime name for the class.
22
+
23
+ ## Methods
24
+
25
+ ### getConfigOfType()
26
+
27
+ > `static` **getConfigOfType**\<`T`\>(`engineConfig`, `component`, `type`): `undefined` \| `IEngineCoreTypeConfig`\<`T`\>
28
+
29
+ Get the config for the specified component and type.
30
+
31
+ #### Type Parameters
32
+
33
+ ##### T
34
+
35
+ `T` *extends* `IEngineCoreTypeBaseConfig`\<`unknown`\>
36
+
37
+ #### Parameters
38
+
39
+ ##### engineConfig
40
+
41
+ [`IEngineConfig`](../interfaces/IEngineConfig.md)
42
+
43
+ The engine configuration.
44
+
45
+ ##### component
46
+
47
+ `string`
48
+
49
+ The component name.
50
+
51
+ ##### type
52
+
53
+ `string`
54
+
55
+ The type name.
56
+
57
+ #### Returns
58
+
59
+ `undefined` \| `IEngineCoreTypeConfig`\<`T`\>
60
+
61
+ The config for the specified component and type or undefined if it does not exist.
@@ -1,5 +1,9 @@
1
1
  # @twin.org/engine-types
2
2
 
3
+ ## Classes
4
+
5
+ - [EngineTypeHelper](classes/EngineTypeHelper.md)
6
+
3
7
  ## Interfaces
4
8
 
5
9
  - [IEngineConfig](interfaces/IEngineConfig.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/engine-types",
3
- "version": "0.0.2-next.15",
3
+ "version": "0.0.2-next.16",
4
4
  "description": "Types to use in an engine.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -52,8 +52,8 @@
52
52
  "@twin.org/document-management-models": "next",
53
53
  "@twin.org/document-management-rest-client": "next",
54
54
  "@twin.org/document-management-service": "next",
55
- "@twin.org/engine-core": "0.0.2-next.15",
56
- "@twin.org/engine-models": "0.0.2-next.15",
55
+ "@twin.org/engine-core": "0.0.2-next.16",
56
+ "@twin.org/engine-models": "0.0.2-next.16",
57
57
  "@twin.org/entity": "next",
58
58
  "@twin.org/entity-storage-connector-cosmosdb": "next",
59
59
  "@twin.org/entity-storage-connector-dynamodb": "next",