@twin.org/node-core 0.9.4-next.1 â 0.9.4-next.3
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/builders/engineEnvBuilder.js +2 -1
- package/dist/es/builders/engineEnvBuilder.js.map +1 -1
- package/dist/es/models/deprecatedEnvironmentVariableKeys.js +16 -0
- package/dist/es/models/deprecatedEnvironmentVariableKeys.js.map +1 -0
- package/dist/es/node.js +29 -2
- package/dist/es/node.js.map +1 -1
- package/dist/types/models/deprecatedEnvironmentVariableKeys.d.ts +7 -0
- package/docs/changelog.md +14 -0
- package/locales/en.json +3 -1
- package/package.json +1 -1
|
@@ -1647,7 +1647,8 @@ export function isTrustRequired(envVars) {
|
|
|
1647
1647
|
export function isBackgroundTasksRequired(envVars) {
|
|
1648
1648
|
return (envBoolean(envVars, "dataspaceEnabled", false) ||
|
|
1649
1649
|
isImmutableProofRequired(envVars) ||
|
|
1650
|
-
envBoolean(envVars, "healthEnabled", false)
|
|
1650
|
+
envBoolean(envVars, "healthEnabled", false) ||
|
|
1651
|
+
commaSeparatedListToArray(envVars.telemetryConnector).includes(TelemetryConnectorType.EntityStorage));
|
|
1651
1652
|
}
|
|
1652
1653
|
/**
|
|
1653
1654
|
* Checks if the immutable proof subsystem is required.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engineEnvBuilder.js","sourceRoot":"","sources":["../../../src/builders/engineEnvBuilder.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACN,wBAAwB,EACxB,wBAAwB,EACxB,+BAA+B,EAC/B,gCAAgC,EAEhC,oBAAoB,EACpB,uBAAuB,EACvB,2BAA2B,EAC3B,wBA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AED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAoC;IACxE,OAAO,0BAA0B,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAoC;IACtE,OAAO,yBAAyB,CAAyB,OAAO,CAAC,kBAAkB,CAAC,CAAC,IAAI,CACxF,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,sBAAsB,CAAC,aAAa,IAAI,CAAC,KAAK,sBAAsB,CAAC,aAAa,CAC7F,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAoC;IACpE,OAAO,yBAAyB,CAAuB,OAAO,CAAC,gBAAgB,CAAC,CAAC,IAAI,CACpF,CAAC,CAAC,EAAE,CACH,CAAC,KAAK,oBAAoB,CAAC,aAAa;QACxC,CAAC,KAAK,oBAAoB,CAAC,aAAa;QACxC,CAAC,KAAK,oBAAoB,CAAC,OAAO,CACnC,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAoC;IACpE,OAAO,yBAAyB,CAA6B,OAAO,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAChG,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,0BAA0B,CAAC,IAAI,IAAI,CAAC,KAAK,0BAA0B,CAAC,IAAI,CACnF,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport path from \"node:path\";\nimport { Is, Mutex } from \"@twin.org/core\";\nimport type { IIotaConfig } from \"@twin.org/dlt-iota\";\nimport { EngineCloneMode } from \"@twin.org/engine-models\";\nimport {\n\tAttestationComponentType,\n\tAttestationConnectorType,\n\tAuditableItemGraphComponentType,\n\tAuditableItemStreamComponentType,\n\ttype AutomationActionConfig,\n\tAutomationActionType,\n\tAutomationComponentType,\n\tBackgroundTaskComponentType,\n\tBlobStorageComponentType,\n\tBlobStorageConnectorType,\n\tContextIdHandlerComponentType,\n\tDataConverterConnectorType,\n\tDataExtractorConnectorType,\n\tDataProcessingComponentType,\n\tDataspaceControlPlaneComponentType,\n\tDataspaceDataPlaneComponentType,\n\ttype DltConfig,\n\tDltConfigType,\n\tDocumentManagementComponentType,\n\tEmailProtocolConnectorType,\n\tEngineTypeHelper,\n\tEntityStorageConnectorType,\n\tEventBusComponentType,\n\tEventBusConnectorType,\n\tFaucetConnectorType,\n\tFederatedCatalogueComponentType,\n\tFederatedCatalogueFilterComponentType,\n\tHealthComponentType,\n\tIdentityComponentType,\n\tIdentityConnectorType,\n\tIdentityProfileComponentType,\n\tIdentityProfileConnectorType,\n\tIdentityResolverComponentType,\n\tIdentityResolverConnectorType,\n\ttype IEngineConfig,\n\tImmutableProofComponentType,\n\tLoggingComponentType,\n\tLoggingConnectorType,\n\tMailboxComponentType,\n\tMailStorageComponentType,\n\tMessagingAdminComponentType,\n\tMessagingComponentType,\n\tMessagingEmailConnectorType,\n\tMessagingPushNotificationConnectorType,\n\tMessagingSmsConnectorType,\n\tMetricsCollectorComponentType,\n\tMetricsProducerComponentType,\n\tNftComponentType,\n\tNftConnectorType,\n\tNotarizationComponentType,\n\tNotarizationConnectorType,\n\tPlatformComponentType,\n\tRightsManagementPapComponentType,\n\tRightsManagementPdpComponentType,\n\tRightsManagementPepComponentType,\n\tRightsManagementPipComponentType,\n\tRightsManagementPmpComponentType,\n\tRightsManagementPnapComponentType,\n\tRightsManagementPnpComponentType,\n\tRightsManagementPolicyArbiterComponentType,\n\tRightsManagementPolicyEnforcementProcessorComponentType,\n\tRightsManagementPolicyExecutionActionComponentType,\n\tRightsManagementPolicyInformationSourceComponentType,\n\tRightsManagementPolicyNegotiatorComponentType,\n\tRightsManagementPolicyObligationEnforcerComponentType,\n\tRightsManagementPolicyRequesterComponentType,\n\tRightsManagementPxpComponentType,\n\tSchemaVersionMigrationComponentType,\n\tTaskSchedulerComponentType,\n\tTelemetryComponentType,\n\tTelemetryConnectorType,\n\tTenantAdminComponentType,\n\tTracingComponentType,\n\tTracingConnectorType,\n\tTrustComponentType,\n\tTrustGeneratorComponentType,\n\tTrustVerifierComponentType,\n\tVaultConnectorType,\n\tWalletConnectorType\n} from \"@twin.org/engine-types\";\nimport {\n\ttype IOpenTelemetryLoggingConnectorConfig,\n\ttype IOpenTelemetryOtlpExporterConfig,\n\tOpenTelemetryExporterTypes\n} from \"@twin.org/logging-connector-opentelemetry\";\nimport {\n\ttype IOpenTelemetryTelemetryConnectorConfig,\n\tOpenTelemetryReaderTypes\n} from \"@twin.org/telemetry-connector-opentelemetry\";\nimport {\n\ttype IOpenTelemetryTracingConnectorConfig,\n\tOpenTelemetryProcessorTypes\n} from \"@twin.org/tracing-connector-opentelemetry\";\nimport { CONTEXT_ID_HANDLER_FEATURE_DID, CONTEXT_ID_HANDLER_FEATURE_TENANT } from \"../defaults.js\";\nimport { isAuthEntityStorageRequired } from \"./engineServerEnvBuilder.js\";\nimport {\n\tcommaSeparatedListToArray,\n\tenvArray,\n\tenvBoolean,\n\tenvChoice,\n\tenvCount,\n\tenvDateTime,\n\tenvInteger,\n\tenvListToArray,\n\tenvMinToMs,\n\tenvMinutes,\n\tenvMs,\n\tenvSecToMs,\n\tenvSeconds\n} from \"./helper/envHelpers.js\";\nimport type { IEngineEnvironmentVariables } from \"../models/IEngineEnvironmentVariables.js\";\n\n/**\n * Build the engine core configuration from environment variables.\n * @param envVars The environment variables.\n * @returns The config for the core.\n */\nexport async function buildEngineConfiguration(\n\tenvVars: IEngineEnvironmentVariables\n): Promise<IEngineConfig> {\n\tif (Is.stringValue(envVars.storageFileRoot)) {\n\t\tenvVars.stateFilename ??= \"engine-state.json\";\n\t\tenvVars.storageFileRoot = path.resolve(envVars.storageFileRoot);\n\t\tenvVars.stateFilename = path.join(envVars.storageFileRoot, envVars.stateFilename);\n\t}\n\n\tconst coreConfig: IEngineConfig = {\n\t\tdebug: envBoolean(envVars, \"debug\", false),\n\t\tsilent: envBoolean(envVars, \"silent\", false),\n\t\tsilentComponents: {\n\t\t\tlogging: commaSeparatedListToArray(envVars.loggingSilentComponents),\n\t\t\ttelemetry: commaSeparatedListToArray(envVars.telemetrySilentComponents),\n\t\t\ttracing: commaSeparatedListToArray(envVars.tracingSilentComponents)\n\t\t},\n\t\ttypes: {}\n\t};\n\n\tconst mutexTimeoutMs = envMs(envVars, \"mutexTimeoutDefault\");\n\tif (Is.notEmpty(mutexTimeoutMs)) {\n\t\tMutex.setDefaultTimeoutMs(mutexTimeoutMs);\n\t}\n\n\tawait configureSchemaMigration(coreConfig, envVars);\n\tawait configurePlatform(coreConfig, envVars);\n\tawait configureTenant(coreConfig, envVars);\n\tawait configureContextIdHandlers(coreConfig, envVars);\n\n\tawait configureEntityStorage(coreConfig, envVars);\n\tawait configureBlobStorage(coreConfig, envVars);\n\tawait configureVault(coreConfig, envVars);\n\tawait configureDlt(coreConfig, envVars);\n\n\tawait configureLogging(coreConfig, envVars);\n\tawait configureBackgroundTask(coreConfig, envVars);\n\tawait configureTaskScheduler(coreConfig, envVars);\n\tawait configureEventBus(coreConfig, envVars);\n\tawait configureTelemetry(coreConfig, envVars);\n\tawait configureMetricsCollector(coreConfig, envVars);\n\tawait configureTracing(coreConfig, envVars);\n\tawait configureMessaging(coreConfig, envVars);\n\tawait configureMailbox(coreConfig, envVars);\n\tawait configureAutomation(coreConfig, envVars);\n\tawait configureHealth(coreConfig, envVars);\n\n\tawait configureFaucet(coreConfig, envVars);\n\tawait configureWallet(coreConfig, envVars);\n\tawait configureNft(coreConfig, envVars);\n\tawait configureNotarization(coreConfig, envVars);\n\tawait configureImmutableProof(coreConfig, envVars);\n\tawait configureIdentity(coreConfig, envVars);\n\tawait configureIdentityResolver(coreConfig, envVars);\n\tawait configureIdentityProfile(coreConfig, envVars);\n\tawait configureAttestation(coreConfig, envVars);\n\tawait configureDataProcessing(coreConfig, envVars);\n\n\tawait configureAuditableItemGraph(coreConfig, envVars);\n\tawait configureAuditableItemStream(coreConfig, envVars);\n\tawait configureDocumentManagement(coreConfig, envVars);\n\tawait configureTrust(coreConfig, envVars);\n\tawait configureRightsManagement(coreConfig, envVars);\n\n\tawait configureFederatedCatalogue(coreConfig, envVars);\n\tawait configureDataspace(coreConfig, envVars);\n\n\treturn coreConfig;\n}\n\n/**\n * Configures the entity storage.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the entity storage configuration has been applied.\n */\nasync function configureEntityStorage(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types ??= {};\n\tcoreConfig.types.entityStorageConnector ??= [];\n\n\tconst entityStorageConnectorTypes = envListToArray<\n\t\tIEngineEnvironmentVariables,\n\t\tEntityStorageConnectorType\n\t>(envVars, \"entityStorageConnectorType\", Object.values(EntityStorageConnectorType));\n\n\tfor (const entityStorageConnectorType of entityStorageConnectorTypes) {\n\t\tif (entityStorageConnectorType === EntityStorageConnectorType.Memory) {\n\t\t\tcoreConfig.types.entityStorageConnector.push({\n\t\t\t\ttype: EntityStorageConnectorType.Memory,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"entityStorageMutexTimeout\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (entityStorageConnectorType === EntityStorageConnectorType.File) {\n\t\t\tcoreConfig.types.entityStorageConnector.push({\n\t\t\t\ttype: EntityStorageConnectorType.File,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tdirectory: envVars.storageFileRoot ?? \"\",\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"entityStorageMutexTimeout\")\n\t\t\t\t\t},\n\t\t\t\t\tfolderPrefix: envVars.entityStorageTablePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (entityStorageConnectorType === EntityStorageConnectorType.AwsDynamoDb) {\n\t\t\tcoreConfig.types.entityStorageConnector.push({\n\t\t\t\ttype: EntityStorageConnectorType.AwsDynamoDb,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tregion: envVars.awsDynamodbRegion ?? \"\",\n\t\t\t\t\t\tauthMode: envVars.awsDynamodbAuthMode as \"credentials\" | \"pod\",\n\t\t\t\t\t\taccessKeyId: envVars.awsDynamodbAccessKeyId,\n\t\t\t\t\t\tsecretAccessKey: envVars.awsDynamodbSecretAccessKey,\n\t\t\t\t\t\tendpoint: envVars.awsDynamodbEndpoint,\n\t\t\t\t\t\tconnectionTimeoutMs: envMs(envVars, \"awsDynamodbConnectionTimeout\"),\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"entityStorageMutexTimeout\")\n\t\t\t\t\t},\n\t\t\t\t\ttablePrefix: envVars.entityStorageTablePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (entityStorageConnectorType === EntityStorageConnectorType.AzureCosmosDb) {\n\t\t\tcoreConfig.types.entityStorageConnector.push({\n\t\t\t\ttype: EntityStorageConnectorType.AzureCosmosDb,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tendpoint: envVars.azureCosmosdbEndpoint ?? \"\",\n\t\t\t\t\t\tkey: envVars.azureCosmosdbKey ?? \"\",\n\t\t\t\t\t\tdatabaseId: envVars.azureCosmosdbDatabaseId ?? \"\",\n\t\t\t\t\t\tcontainerId: envVars.azureCosmosdbContainerId ?? \"\",\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"entityStorageMutexTimeout\")\n\t\t\t\t\t},\n\t\t\t\t\ttablePrefix: envVars.entityStorageTablePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (entityStorageConnectorType === EntityStorageConnectorType.GcpFirestoreDb) {\n\t\t\tcoreConfig.types.entityStorageConnector.push({\n\t\t\t\ttype: EntityStorageConnectorType.GcpFirestoreDb,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tprojectId: envVars.gcpFirestoreProjectId ?? \"\",\n\t\t\t\t\t\tcredentials: envVars.gcpFirestoreCredentials ?? \"\",\n\t\t\t\t\t\tdatabaseId: envVars.gcpFirestoreDatabaseId ?? \"\",\n\t\t\t\t\t\tcollectionName: envVars.gcpFirestoreCollectionName ?? \"\",\n\t\t\t\t\t\tendpoint: envVars.gcpFirestoreEndpoint ?? \"\",\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"entityStorageMutexTimeout\")\n\t\t\t\t\t},\n\t\t\t\t\ttablePrefix: envVars.entityStorageTablePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (entityStorageConnectorType === EntityStorageConnectorType.ScyllaDb) {\n\t\t\tcoreConfig.types.entityStorageConnector.push({\n\t\t\t\ttype: EntityStorageConnectorType.ScyllaDb,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\thosts: commaSeparatedListToArray(envVars.scylladbHosts),\n\t\t\t\t\t\tlocalDataCenter: envVars.scylladbLocalDataCenter ?? \"\",\n\t\t\t\t\t\tkeyspace: envVars.scylladbKeyspace ?? \"\",\n\t\t\t\t\t\tport: envInteger(envVars, \"scylladbPort\"),\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"entityStorageMutexTimeout\"),\n\t\t\t\t\t\tpool: {\n\t\t\t\t\t\t\tcoreConnectionsPerHost: envCount(envVars, \"scylladbPoolCoreConnectionsPerHost\"),\n\t\t\t\t\t\t\tmaxRequestsPerConnection: envCount(envVars, \"scylladbPoolMaxRequestsPerConnection\")\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\ttablePrefix: envVars.entityStorageTablePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (entityStorageConnectorType === EntityStorageConnectorType.MySqlDb) {\n\t\t\tcoreConfig.types.entityStorageConnector.push({\n\t\t\t\ttype: EntityStorageConnectorType.MySqlDb,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\thost: envVars.mySqlHost ?? \"\",\n\t\t\t\t\t\tport: envInteger(envVars, \"mySqlPort\"),\n\t\t\t\t\t\tuser: envVars.mySqlUser ?? \"\",\n\t\t\t\t\t\tpassword: envVars.mySqlPassword ?? \"\",\n\t\t\t\t\t\tdatabase: envVars.mySqlDatabase ?? \"\",\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"entityStorageMutexTimeout\"),\n\t\t\t\t\t\tpool: {\n\t\t\t\t\t\t\tconnectionLimit: envCount(envVars, \"mySqlPoolConnectionLimit\"),\n\t\t\t\t\t\t\tmaxIdle: envCount(envVars, \"mySqlPoolMaxIdle\"),\n\t\t\t\t\t\t\tidleTimeout: envMs(envVars, \"mySqlPoolIdleTimeout\"),\n\t\t\t\t\t\t\tenableKeepAlive: envBoolean(envVars, \"mySqlPoolEnableKeepAlive\"),\n\t\t\t\t\t\t\twaitForConnections: envBoolean(envVars, \"mySqlPoolWaitForConnections\"),\n\t\t\t\t\t\t\tqueueLimit: envCount(envVars, \"mySqlPoolQueueLimit\")\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\ttablePrefix: envVars.entityStorageTablePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (entityStorageConnectorType === EntityStorageConnectorType.MongoDb) {\n\t\t\tcoreConfig.types.entityStorageConnector.push({\n\t\t\t\ttype: EntityStorageConnectorType.MongoDb,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\thost: envVars.mongoDbHost ?? \"\",\n\t\t\t\t\t\tport: envInteger(envVars, \"mongoDbPort\"),\n\t\t\t\t\t\tuser: envVars.mongoDbUser ?? \"\",\n\t\t\t\t\t\tpassword: envVars.mongoDbPassword ?? \"\",\n\t\t\t\t\t\tdatabase: envVars.mongoDbDatabase ?? \"\",\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"entityStorageMutexTimeout\"),\n\t\t\t\t\t\tpool: {\n\t\t\t\t\t\t\tmaxPoolSize: envCount(envVars, \"mongoDbPoolMaxPoolSize\"),\n\t\t\t\t\t\t\tminPoolSize: envCount(envVars, \"mongoDbPoolMinPoolSize\"),\n\t\t\t\t\t\t\tmaxIdleTimeMs: envMs(envVars, \"mongoDbPoolMaxIdleTime\"),\n\t\t\t\t\t\t\twaitQueueTimeoutMs: envMs(envVars, \"mongoDbPoolWaitQueueTimeout\")\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\ttablePrefix: envVars.entityStorageTablePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (entityStorageConnectorType === EntityStorageConnectorType.PostgreSql) {\n\t\t\tcoreConfig.types.entityStorageConnector.push({\n\t\t\t\ttype: EntityStorageConnectorType.PostgreSql,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\thost: envVars.postgreSqlHost ?? \"\",\n\t\t\t\t\t\tport: envInteger(envVars, \"postgreSqlPort\"),\n\t\t\t\t\t\tuser: envVars.postgreSqlUser ?? \"\",\n\t\t\t\t\t\tpassword: envVars.postgreSqlPassword ?? \"\",\n\t\t\t\t\t\tdatabase: envVars.postgreSqlDatabase ?? \"\",\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"entityStorageMutexTimeout\"),\n\t\t\t\t\t\tpool: {\n\t\t\t\t\t\t\tmax: envCount(envVars, \"postgreSqlPoolMax\"),\n\t\t\t\t\t\t\tidleTimeout: envSeconds(envVars, \"postgreSqlPoolIdleTimeout\"),\n\t\t\t\t\t\t\tconnectTimeout: envSeconds(envVars, \"postgreSqlPoolConnectTimeout\"),\n\t\t\t\t\t\t\tmaxLifetime: envSeconds(envVars, \"postgreSqlPoolMaxLifetime\")\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\ttablePrefix: envVars.entityStorageTablePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tconst defaultEntityStorageConnectorType =\n\t\tenvVars.entityStorageConnectorDefault ?? entityStorageConnectorTypes[0];\n\n\tif (Is.arrayValue(entityStorageConnectorTypes)) {\n\t\tfor (const config of coreConfig.types.entityStorageConnector) {\n\t\t\tif (config.type === defaultEntityStorageConnectorType) {\n\t\t\t\tconfig.isDefault = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Configures the blob storage.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the blob storage configuration has been applied.\n */\nasync function configureBlobStorage(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.blobStorageConnector ??= [];\n\n\tconst blobStorageConnectorTypes = envListToArray<\n\t\tIEngineEnvironmentVariables,\n\t\tBlobStorageConnectorType\n\t>(envVars, \"blobStorageConnectorType\", Object.values(BlobStorageConnectorType));\n\n\tfor (const blobStorageConnectorType of blobStorageConnectorTypes) {\n\t\tif (blobStorageConnectorType === BlobStorageConnectorType.Memory) {\n\t\t\tcoreConfig.types.blobStorageConnector.push({\n\t\t\t\ttype: BlobStorageConnectorType.Memory\n\t\t\t});\n\t\t} else if (blobStorageConnectorType === BlobStorageConnectorType.File) {\n\t\t\tcoreConfig.types.blobStorageConnector.push({\n\t\t\t\ttype: BlobStorageConnectorType.File,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tdirectory: Is.stringValue(envVars.storageFileRoot)\n\t\t\t\t\t\t\t? path.join(envVars.storageFileRoot, \"blob-storage\")\n\t\t\t\t\t\t\t: \"\"\n\t\t\t\t\t},\n\t\t\t\t\tstoragePrefix: envVars.blobStoragePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (blobStorageConnectorType === BlobStorageConnectorType.Ipfs) {\n\t\t\tcoreConfig.types.blobStorageConnector.push({\n\t\t\t\ttype: BlobStorageConnectorType.Ipfs,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tapiUrl: envVars.ipfsApiUrl ?? \"\",\n\t\t\t\t\t\tbearerToken: envVars.ipfsBearerToken\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (blobStorageConnectorType === BlobStorageConnectorType.AwsS3) {\n\t\t\tcoreConfig.types.blobStorageConnector.push({\n\t\t\t\ttype: BlobStorageConnectorType.AwsS3,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tregion: envVars.awsS3Region ?? \"\",\n\t\t\t\t\t\tbucketName: envVars.awsS3BucketName ?? \"\",\n\t\t\t\t\t\tauthMode: envVars.awsS3AuthMode as \"credentials\" | \"pod\",\n\t\t\t\t\t\taccessKeyId: envVars.awsS3AccessKeyId,\n\t\t\t\t\t\tsecretAccessKey: envVars.awsS3SecretAccessKey,\n\t\t\t\t\t\tendpoint: envVars.awsS3Endpoint\n\t\t\t\t\t},\n\t\t\t\t\tstoragePrefix: envVars.blobStoragePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (blobStorageConnectorType === BlobStorageConnectorType.AzureStorage) {\n\t\t\tcoreConfig.types.blobStorageConnector.push({\n\t\t\t\ttype: BlobStorageConnectorType.AzureStorage,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\taccountName: envVars.azureStorageAccountName ?? \"\",\n\t\t\t\t\t\taccountKey: envVars.azureStorageAccountKey ?? \"\",\n\t\t\t\t\t\tcontainerName: envVars.azureStorageContainerName ?? \"\",\n\t\t\t\t\t\tendpoint: envVars.azureStorageEndpoint ?? \"\"\n\t\t\t\t\t},\n\t\t\t\t\tstoragePrefix: envVars.blobStoragePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (blobStorageConnectorType === BlobStorageConnectorType.GcpStorage) {\n\t\t\tcoreConfig.types.blobStorageConnector.push({\n\t\t\t\ttype: BlobStorageConnectorType.GcpStorage,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tprojectId: envVars.gcpStorageProjectId ?? \"\",\n\t\t\t\t\t\tcredentials: envVars.gcpStorageCredentials ?? \"\",\n\t\t\t\t\t\tbucketName: envVars.gcpStorageBucketName ?? \"\",\n\t\t\t\t\t\tapiEndpoint: envVars.gcpFirestoreEndpoint\n\t\t\t\t\t},\n\t\t\t\t\tstoragePrefix: envVars.blobStoragePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tif (Is.arrayValue(blobStorageConnectorTypes)) {\n\t\tconst defaultStorageConnectorType =\n\t\t\tenvVars.blobStorageConnectorDefault ?? blobStorageConnectorTypes[0];\n\t\tfor (const config of coreConfig.types.blobStorageConnector) {\n\t\t\tif (config.type === defaultStorageConnectorType) {\n\t\t\t\tconfig.isDefault = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (coreConfig.types.blobStorageConnector.length > 0) {\n\t\tcoreConfig.types.blobStorageComponent ??= [];\n\t\tcoreConfig.types.blobStorageComponent.push({\n\t\t\ttype: BlobStorageComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tvaultKeyId:\n\t\t\t\t\t\t(envVars.blobStorageEnableEncryption ?? false)\n\t\t\t\t\t\t\t? envVars.blobStorageEncryptionKeyId\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the logging.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the logging configuration has been applied.\n */\nasync function configureLogging(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.loggingConnector ??= [];\n\n\tconst loggingConnectorTypes = envListToArray<IEngineEnvironmentVariables, LoggingConnectorType>(\n\t\tenvVars,\n\t\t\"loggingConnector\",\n\t\tObject.values(LoggingConnectorType)\n\t);\n\tlet additionalConnectorCount = 0;\n\n\tfor (const loggingConnector of loggingConnectorTypes) {\n\t\tif (loggingConnector === LoggingConnectorType.Console) {\n\t\t\tcoreConfig.types.loggingConnector.push({\n\t\t\t\ttype: LoggingConnectorType.Console,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\ttranslateMessages: true,\n\t\t\t\t\t\thideGroups: true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t} else if (loggingConnector === LoggingConnectorType.EntityStorage) {\n\t\t\tcoreConfig.types.loggingConnector.push({\n\t\t\t\ttype: LoggingConnectorType.EntityStorage,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tbatchSize: envCount(envVars, \"loggingBatchSize\"),\n\t\t\t\t\t\tbatchIntervalMs: envSecToMs(envVars, \"loggingBatchFlushInterval\"),\n\t\t\t\t\t\tretainForMs: envMinToMs(envVars, \"loggingRetainFor\"),\n\t\t\t\t\t\tmaxEntries: envCount(envVars, \"loggingMaxEntries\"),\n\t\t\t\t\t\tretentionIntervalMs: envMinToMs(envVars, \"loggingRetentionInterval\"),\n\t\t\t\t\t\tretentionBatchSize: envCount(envVars, \"loggingRetentionBatchSize\"),\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"loggingMutexTimeout\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t} else if (loggingConnector === LoggingConnectorType.OpenTelemetry) {\n\t\t\tconst otelLoggingConfig: IOpenTelemetryLoggingConnectorConfig = {\n\t\t\t\tloggerName: envVars.openTelemetryLoggingLoggerName,\n\t\t\t\tloggerVersion: envVars.openTelemetryLoggingLoggerVersion\n\t\t\t};\n\t\t\tif (Is.stringValue(envVars.openTelemetryLoggingPrometheusEndpoint)) {\n\t\t\t\totelLoggingConfig.exporters = {\n\t\t\t\t\totlp: {\n\t\t\t\t\t\ttype: OpenTelemetryExporterTypes.Otlp,\n\t\t\t\t\t\tendpoint: envVars.openTelemetryLoggingPrometheusEndpoint,\n\t\t\t\t\t\tprocessor:\n\t\t\t\t\t\t\t(envVars.openTelemetryLoggingProcessor as IOpenTelemetryOtlpExporterConfig[\"processor\"]) ??\n\t\t\t\t\t\t\t\"batch\"\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\t\t\tcoreConfig.types.loggingConnector.push({\n\t\t\t\ttype: LoggingConnectorType.OpenTelemetry,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: otelLoggingConfig\n\t\t\t\t}\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t} else if (loggingConnector === LoggingConnectorType.File) {\n\t\t\tcoreConfig.types.loggingConnector.push({\n\t\t\t\ttype: LoggingConnectorType.File,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tdirectory: envVars.loggingFileDirectory ?? envVars.storageFileRoot ?? \"\",\n\t\t\t\t\t\tfilename: envVars.loggingFileFilename,\n\t\t\t\t\t\tmaxFileSizeBytes: envCount(envVars, \"loggingFileMaxFileSizeBytes\"),\n\t\t\t\t\t\tmaxRetainedFiles: envCount(envVars, \"loggingFileMaxRetainedFiles\"),\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"loggingMutexTimeout\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t}\n\t}\n\n\t// If more than one logging connector, then we need to add a multi connector\n\t// and set it as the default one\n\tif (additionalConnectorCount > 1) {\n\t\tcoreConfig.types.loggingConnector.push({\n\t\t\ttype: LoggingConnectorType.Multi,\n\t\t\toptions: {\n\t\t\t\tloggingConnectorTypes\n\t\t\t},\n\t\t\tisDefault: true\n\t\t});\n\t} else if (additionalConnectorCount > 0) {\n\t\t// If only one connector, then we set it as the default one\n\t\tcoreConfig.types.loggingConnector[coreConfig.types.loggingConnector.length - 1].isDefault =\n\t\t\ttrue;\n\t}\n\n\tif (additionalConnectorCount > 0) {\n\t\tcoreConfig.types.loggingComponent ??= [];\n\t\t// We set the isDefault flag so that other components will get this service by default\n\t\t// and not the generic one from the engine core\n\t\tcoreConfig.types.loggingComponent.push({ type: LoggingComponentType.Service, isDefault: true });\n\t}\n}\n\n/**\n * Configures the vault.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the vault configuration has been applied.\n */\nasync function configureVault(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.vaultConnector ??= [];\n\n\tconst vaultConnectorType = envChoice<IEngineEnvironmentVariables, VaultConnectorType>(\n\t\tenvVars,\n\t\t\"vaultConnector\",\n\t\tObject.values(VaultConnectorType)\n\t);\n\n\tif (vaultConnectorType === VaultConnectorType.EntityStorage) {\n\t\tcoreConfig.types.vaultConnector.push({\n\t\t\ttype: VaultConnectorType.EntityStorage,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tprefix: envVars.vaultPrefix\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} else if (vaultConnectorType === VaultConnectorType.Hashicorp) {\n\t\tcoreConfig.types.vaultConnector.push({\n\t\t\ttype: VaultConnectorType.Hashicorp,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tendpoint: envVars.hashicorpVaultEndpoint ?? \"\",\n\t\t\t\t\ttoken: envVars.hashicorpVaultToken ?? \"\",\n\t\t\t\t\tprefix: envVars.vaultPrefix\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the background task.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the background task configuration has been applied.\n */\nasync function configureBackgroundTask(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.backgroundTaskComponent ??= [];\n\n\tif (isBackgroundTasksRequired(envVars)) {\n\t\tcoreConfig.types.backgroundTaskComponent.push({\n\t\t\ttype: BackgroundTaskComponentType.Service\n\t\t});\n\t}\n}\n\n/**\n * Configures the event bus.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the event bus configuration has been applied.\n */\nasync function configureEventBus(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.eventBusConnector ??= [];\n\n\tconst eventBusConnectorType = envChoice<IEngineEnvironmentVariables, EventBusConnectorType>(\n\t\tenvVars,\n\t\t\"eventBusConnector\",\n\t\tObject.values(EventBusConnectorType)\n\t);\n\n\tif (eventBusConnectorType === EventBusConnectorType.Local) {\n\t\tcoreConfig.types.eventBusConnector.push({\n\t\t\ttype: EventBusConnectorType.Local\n\t\t});\n\t}\n\n\tif (coreConfig.types.eventBusConnector.length > 0) {\n\t\tcoreConfig.types.eventBusComponent ??= [];\n\t\tcoreConfig.types.eventBusComponent.push({ type: EventBusComponentType.Service });\n\t}\n}\n\n/**\n * Configures the telemetry.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the telemetry configuration has been applied.\n */\nasync function configureTelemetry(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.telemetryConnector ??= [];\n\n\tconst telemetryConnectorTypes = envListToArray<\n\t\tIEngineEnvironmentVariables,\n\t\tTelemetryConnectorType\n\t>(envVars, \"telemetryConnector\", Object.values(TelemetryConnectorType));\n\tlet additionalConnectorCount = 0;\n\n\tfor (const telemetryConnectorType of telemetryConnectorTypes) {\n\t\tif (telemetryConnectorType === TelemetryConnectorType.Silent) {\n\t\t\tcoreConfig.types.telemetryConnector.push({\n\t\t\t\ttype: TelemetryConnectorType.Silent\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t} else if (telemetryConnectorType === TelemetryConnectorType.EntityStorage) {\n\t\t\tcoreConfig.types.telemetryConnector.push({\n\t\t\t\ttype: TelemetryConnectorType.EntityStorage,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tbatchSize: envCount(envVars, \"telemetryBatchSize\"),\n\t\t\t\t\t\tbatchIntervalMs: envSecToMs(envVars, \"telemetryBatchFlushInterval\"),\n\t\t\t\t\t\tmaxCacheSize: envCount(envVars, \"telemetryMaxCacheSize\"),\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"telemetryMutexTimeout\"),\n\t\t\t\t\t\tmetricDefinitionCacheCapacity: envCount(\n\t\t\t\t\t\t\tenvVars,\n\t\t\t\t\t\t\t\"telemetryMetricDefinitionCacheCapacity\"\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmetricDefinitionCacheTtiMs: envMs(envVars, \"telemetryMetricDefinitionCacheTtiMs\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t} else if (telemetryConnectorType === TelemetryConnectorType.OpenTelemetry) {\n\t\t\tlet readers: IOpenTelemetryTelemetryConnectorConfig[\"readers\"];\n\t\t\tif (envVars.openTelemetryReader === OpenTelemetryReaderTypes.Prometheus) {\n\t\t\t\treaders = {\n\t\t\t\t\tprometheus: {\n\t\t\t\t\t\ttype: OpenTelemetryReaderTypes.Prometheus,\n\t\t\t\t\t\tport: envCount(envVars, \"openTelemetryPrometheusPort\")\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\t\t\tcoreConfig.types.telemetryConnector.push({\n\t\t\t\ttype: TelemetryConnectorType.OpenTelemetry,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tmeterName: envVars.openTelemetryMeterName,\n\t\t\t\t\t\tmeterVersion: envVars.openTelemetryMeterVersion,\n\t\t\t\t\t\treaders\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t}\n\t}\n\n\t// If more than one telemetry connector, then we need to add a multi connector\n\t// and set it as the default one\n\tif (additionalConnectorCount > 1) {\n\t\tcoreConfig.types.telemetryConnector.push({\n\t\t\ttype: TelemetryConnectorType.Multi,\n\t\t\toptions: {\n\t\t\t\ttelemetryConnectorTypes\n\t\t\t},\n\t\t\tisDefault: true\n\t\t});\n\t} else if (additionalConnectorCount > 0) {\n\t\t// If only one connector, then we set it as the default one\n\t\tcoreConfig.types.telemetryConnector[coreConfig.types.telemetryConnector.length - 1].isDefault =\n\t\t\ttrue;\n\t}\n\n\tif (additionalConnectorCount > 0) {\n\t\tcoreConfig.types.telemetryComponent ??= [];\n\t\tcoreConfig.types.telemetryComponent.push({ type: TelemetryComponentType.Service });\n\t}\n}\n\n/**\n * Configures the metrics producers and orchestrator service.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the metrics collector configuration has been applied.\n */\nasync function configureMetricsCollector(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (isTelemetryEnabled(envVars)) {\n\t\tcoreConfig.types.metricsCollectorComponent ??= [];\n\t\tcoreConfig.types.metricsCollectorComponent.push({\n\t\t\ttype: MetricsCollectorComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tintervalMs: envSecToMs(envVars, \"telemetryMetricsCollectorInterval\")\n\t\t\t\t}\n\t\t\t},\n\t\t\tcloneMode: EngineCloneMode.Never\n\t\t});\n\n\t\tcoreConfig.types.metricsProducerComponent ??= [];\n\n\t\tconst metricsProducers = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tMetricsProducerComponentType\n\t\t>(envVars, \"telemetryMetricsProducers\", Object.values(MetricsProducerComponentType), [\n\t\t\tMetricsProducerComponentType.System,\n\t\t\tMetricsProducerComponentType.Process\n\t\t]);\n\n\t\tfor (const producerType of metricsProducers) {\n\t\t\tcoreConfig.types.metricsProducerComponent.push({\n\t\t\t\ttype: producerType,\n\t\t\t\toptions: { maxHistory: envCount(envVars, \"telemetryMetricsProducerMaxHistory\") },\n\t\t\t\tcloneMode: EngineCloneMode.Never\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * Configures the tracing.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the tracing configuration has been applied.\n */\nasync function configureTracing(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.tracingConnector ??= [];\n\n\tconst tracingConnectorTypes = envListToArray<IEngineEnvironmentVariables, TracingConnectorType>(\n\t\tenvVars,\n\t\t\"tracingConnector\",\n\t\tObject.values(TracingConnectorType)\n\t);\n\tlet additionalConnectorCount = 0;\n\n\tfor (const tracingConnectorType of tracingConnectorTypes) {\n\t\tif (tracingConnectorType === TracingConnectorType.Silent) {\n\t\t\tcoreConfig.types.tracingConnector.push({\n\t\t\t\ttype: TracingConnectorType.Silent\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t} else if (tracingConnectorType === TracingConnectorType.EntityStorage) {\n\t\t\tcoreConfig.types.tracingConnector.push({\n\t\t\t\ttype: TracingConnectorType.EntityStorage,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"tracingMutexTimeout\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t} else if (tracingConnectorType === TracingConnectorType.Console) {\n\t\t\tcoreConfig.types.tracingConnector.push({\n\t\t\t\ttype: TracingConnectorType.Console\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t} else if (tracingConnectorType === TracingConnectorType.OpenTelemetry) {\n\t\t\tconst otelTracingConfig: IOpenTelemetryTracingConnectorConfig = {\n\t\t\t\ttracerName: envVars.openTelemetryTracingTracerName,\n\t\t\t\ttracerVersion: envVars.openTelemetryTracingTracerVersion\n\t\t\t};\n\t\t\tif (Is.stringValue(envVars.openTelemetryTracingEndpoint)) {\n\t\t\t\totelTracingConfig.exporters = {\n\t\t\t\t\totlp: {\n\t\t\t\t\t\tendpoint: envVars.openTelemetryTracingEndpoint,\n\t\t\t\t\t\tprocessor:\n\t\t\t\t\t\t\t(envVars.openTelemetryTracingProcessor as OpenTelemetryProcessorTypes) ??\n\t\t\t\t\t\t\tOpenTelemetryProcessorTypes.Batch\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\t\t\tcoreConfig.types.tracingConnector.push({\n\t\t\t\ttype: TracingConnectorType.OpenTelemetry,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: otelTracingConfig\n\t\t\t\t}\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t}\n\t}\n\n\t// If more than one tracing connector, then we need to add a multi connector\n\t// and set it as the default one\n\tif (additionalConnectorCount > 1) {\n\t\tcoreConfig.types.tracingConnector.push({\n\t\t\ttype: TracingConnectorType.Multi,\n\t\t\toptions: {\n\t\t\t\ttracingConnectorTypes\n\t\t\t},\n\t\t\tisDefault: true\n\t\t});\n\t} else if (additionalConnectorCount > 0) {\n\t\t// If only one connector, then we set it as the default one\n\t\tcoreConfig.types.tracingConnector[coreConfig.types.tracingConnector.length - 1].isDefault =\n\t\t\ttrue;\n\t}\n\n\tif (additionalConnectorCount > 0) {\n\t\tcoreConfig.types.tracingComponent ??= [];\n\t\tcoreConfig.types.tracingComponent.push({ type: TracingComponentType.Service });\n\t}\n}\n\n/**\n * Configures the automation.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the automation configuration has been applied.\n */\nasync function configureAutomation(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.automationComponent ??= [];\n\n\tif (isAutomationRequired(envVars)) {\n\t\tcoreConfig.types.automationComponent.push({\n\t\t\ttype: AutomationComponentType.Service\n\t\t});\n\n\t\tconst automationActionTypes = envListToArray<IEngineEnvironmentVariables, AutomationActionType>(\n\t\t\tenvVars,\n\t\t\t\"automationActionTypes\",\n\t\t\tObject.values(AutomationActionType)\n\t\t);\n\n\t\tcoreConfig.types.automationAction ??= [];\n\n\t\tfor (const actionType of automationActionTypes) {\n\t\t\tcoreConfig.types.automationAction.push({\n\t\t\t\ttype: actionType,\n\t\t\t\tisMultiInstance: true\n\t\t\t} as unknown as AutomationActionConfig);\n\t\t}\n\t}\n}\n\n/**\n * Configures the health.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the health configuration has been applied.\n */\nasync function configureHealth(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.healthComponent ??= [];\n\n\tif (envBoolean(envVars, \"healthEnabled\", false)) {\n\t\tcoreConfig.types.healthComponent.push({\n\t\t\ttype: HealthComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\thealthCheckInterval: envSecToMs(envVars, \"healthInterval\"),\n\t\t\t\t\thealthCheckApplicationInterval: envSecToMs(envVars, \"healthApplicationInterval\"),\n\t\t\t\t\tinitialInterval: envSecToMs(envVars, \"healthStartupInterval\")\n\t\t\t\t}\n\t\t\t},\n\t\t\tcloneMode: EngineCloneMode.Never\n\t\t});\n\t}\n}\n\n/**\n * Configures the schema migration.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the schema migration configuration has been applied.\n */\nasync function configureSchemaMigration(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tconst isSchemaMigrationEnabled = envBoolean(envVars, \"schemaMigrationEnabled\", true);\n\n\tcoreConfig.types.schemaVersionMigrationComponent ??= [];\n\tcoreConfig.types.schemaVersionMigrationComponent.push({\n\t\ttype: SchemaVersionMigrationComponentType.Service,\n\t\toptions: { config: { enabled: isSchemaMigrationEnabled } },\n\t\tcloneMode: EngineCloneMode.Never\n\t});\n}\n\n/**\n * Configures the platform.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the platform configuration has been applied.\n */\nasync function configurePlatform(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tconst isTenantEnabled = envBoolean(envVars, \"tenantEnabled\", false);\n\n\tcoreConfig.types.platformComponent ??= [];\n\tcoreConfig.types.platformComponent.push({\n\t\ttype: PlatformComponentType.Service,\n\t\toptions: {\n\t\t\tconfig: {\n\t\t\t\tisMultiTenant: isTenantEnabled\n\t\t\t}\n\t\t},\n\t\tcloneMode: EngineCloneMode.Always\n\t});\n}\n\n/**\n * Configures the tenant.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the tenant configuration has been applied.\n */\nasync function configureTenant(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tconst isTenantEnabled = envBoolean(envVars, \"tenantEnabled\", false);\n\n\tif (isTenantEnabled) {\n\t\tcoreConfig.types.tenantAdminComponent ??= [];\n\t\tcoreConfig.types.tenantAdminComponent.push({\n\t\t\ttype: TenantAdminComponentType.Service\n\t\t});\n\t}\n}\n\n/**\n * Configures the context ID handlers.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the context ID handler configuration has been applied.\n */\nasync function configureContextIdHandlers(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.contextIdHandlerComponent ??= [];\n\tcoreConfig.types.contextIdHandlerComponent.push({\n\t\ttype: ContextIdHandlerComponentType.Did,\n\t\tfeatures: [CONTEXT_ID_HANDLER_FEATURE_DID],\n\t\tcloneMode: EngineCloneMode.Always\n\t});\n\tif (envBoolean(envVars, \"tenantEnabled\", false)) {\n\t\tcoreConfig.types.contextIdHandlerComponent.push({\n\t\t\ttype: ContextIdHandlerComponentType.Tenant,\n\t\t\tfeatures: [CONTEXT_ID_HANDLER_FEATURE_TENANT],\n\t\t\tcloneMode: EngineCloneMode.Always\n\t\t});\n\t}\n}\n\n/**\n * Configures the messaging.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the messaging configuration has been applied.\n */\nasync function configureMessaging(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.messagingEmailConnector ??= [];\n\tcoreConfig.types.messagingSmsConnector ??= [];\n\tcoreConfig.types.messagingPushNotificationConnector ??= [];\n\n\tconst messagingEmailConnectorType = envChoice<\n\t\tIEngineEnvironmentVariables,\n\t\tMessagingEmailConnectorType\n\t>(envVars, \"messagingEmailConnector\", Object.values(MessagingEmailConnectorType));\n\n\tif (messagingEmailConnectorType === MessagingEmailConnectorType.EntityStorage) {\n\t\tcoreConfig.types.messagingEmailConnector.push({\n\t\t\ttype: MessagingEmailConnectorType.EntityStorage\n\t\t});\n\t} else if (messagingEmailConnectorType === MessagingEmailConnectorType.Aws) {\n\t\tcoreConfig.types.messagingEmailConnector.push({\n\t\t\ttype: MessagingEmailConnectorType.Aws,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tregion: envVars.awsSesRegion ?? \"\",\n\t\t\t\t\tauthMode: envVars.awsSesAuthMode as \"credentials\" | \"pod\",\n\t\t\t\t\taccessKeyId: envVars.awsSesAccessKeyId,\n\t\t\t\t\tsecretAccessKey: envVars.awsSesSecretAccessKey,\n\t\t\t\t\tendpoint: envVars.awsSesEndpoint\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} else if (messagingEmailConnectorType === MessagingEmailConnectorType.Smtp) {\n\t\tcoreConfig.types.messagingEmailConnector.push({\n\t\t\ttype: MessagingEmailConnectorType.Smtp,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\thost: envVars.smtpHost ?? \"\",\n\t\t\t\t\tport: envInteger(envVars, \"smtpPort\"),\n\t\t\t\t\tsecure: envBoolean(envVars, \"smtpSecure\"),\n\t\t\t\t\tusername: envVars.smtpUsername,\n\t\t\t\t\tpassword: envVars.smtpPassword\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tconst messagingSmsConnectorType = envChoice<\n\t\tIEngineEnvironmentVariables,\n\t\tMessagingSmsConnectorType\n\t>(envVars, \"messagingSmsConnector\", Object.values(MessagingSmsConnectorType));\n\n\tif (messagingSmsConnectorType === MessagingSmsConnectorType.EntityStorage) {\n\t\tcoreConfig.types.messagingSmsConnector.push({\n\t\t\ttype: MessagingSmsConnectorType.EntityStorage\n\t\t});\n\t} else if (messagingSmsConnectorType === MessagingSmsConnectorType.Aws) {\n\t\tcoreConfig.types.messagingSmsConnector.push({\n\t\t\ttype: MessagingSmsConnectorType.Aws,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tregion: envVars.awsSesRegion ?? \"\",\n\t\t\t\t\tauthMode: envVars.awsSesAuthMode as \"credentials\" | \"pod\",\n\t\t\t\t\taccessKeyId: envVars.awsSesAccessKeyId,\n\t\t\t\t\tsecretAccessKey: envVars.awsSesSecretAccessKey,\n\t\t\t\t\tendpoint: envVars.awsSesEndpoint\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tconst messagingPushConnectorType = envChoice<\n\t\tIEngineEnvironmentVariables,\n\t\tMessagingPushNotificationConnectorType\n\t>(\n\t\tenvVars,\n\t\t\"messagingPushNotificationConnector\",\n\t\tObject.values(MessagingPushNotificationConnectorType)\n\t);\n\n\tif (messagingPushConnectorType === MessagingPushNotificationConnectorType.EntityStorage) {\n\t\tcoreConfig.types.messagingPushNotificationConnector.push({\n\t\t\ttype: MessagingPushNotificationConnectorType.EntityStorage\n\t\t});\n\t} else if (messagingPushConnectorType === MessagingPushNotificationConnectorType.Aws) {\n\t\tcoreConfig.types.messagingPushNotificationConnector.push({\n\t\t\ttype: MessagingPushNotificationConnectorType.Aws,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tregion: envVars.awsSesRegion ?? \"\",\n\t\t\t\t\tauthMode: envVars.awsSesAuthMode as \"credentials\" | \"pod\",\n\t\t\t\t\taccessKeyId: envVars.awsSesAccessKeyId,\n\t\t\t\t\tsecretAccessKey: envVars.awsSesSecretAccessKey,\n\t\t\t\t\tendpoint: envVars.awsSesEndpoint,\n\t\t\t\t\tapplicationsSettings: envArray(envVars, \"awsMessagingPushNotificationApplications\", [])\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\t// If any messaging connectors are configured, then we should configure the messaging admin and\n\t// service components as well since they are required for the messaging connectors to work.\n\tif (\n\t\tcoreConfig.types.messagingEmailConnector.length > 0 ||\n\t\tcoreConfig.types.messagingSmsConnector.length > 0 ||\n\t\tcoreConfig.types.messagingPushNotificationConnector.length > 0\n\t) {\n\t\tcoreConfig.types.messagingAdminComponent ??= [];\n\t\tcoreConfig.types.messagingAdminComponent.push({\n\t\t\ttype: MessagingAdminComponentType.Service\n\t\t});\n\n\t\tcoreConfig.types.messagingComponent ??= [];\n\t\tcoreConfig.types.messagingComponent.push({ type: MessagingComponentType.Service });\n\t}\n}\n\n/**\n * Configures mailbox components, mail storage components, and email protocol connectors.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the mailbox configuration has been applied.\n */\nasync function configureMailbox(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.emailProtocolConnector ??= [];\n\n\tconst emailProtocolConnectorTypes = envListToArray<\n\t\tIEngineEnvironmentVariables,\n\t\tEmailProtocolConnectorType\n\t>(envVars, \"emailProtocolConnector\", Object.values(EmailProtocolConnectorType));\n\tfor (const emailProtocolConnectorType of emailProtocolConnectorTypes) {\n\t\tcoreConfig.types.emailProtocolConnector.push({\n\t\t\ttype: emailProtocolConnectorType,\n\t\t\toptions: {\n\t\t\t\tconfig: {} as never\n\t\t\t},\n\t\t\tcloneMode: EngineCloneMode.Never,\n\t\t\tisMultiInstance: true\n\t\t});\n\t}\n\n\t// If email protocol connectors are configured, then we should configure the mailbox and mail store\n\t// components as well, since they are required for the email protocol connectors to work.\n\tif (coreConfig.types.emailProtocolConnector.length > 0) {\n\t\tcoreConfig.types.mailStorageComponent ??= [];\n\t\tcoreConfig.types.mailStorageComponent.push({\n\t\t\ttype: MailStorageComponentType.Service,\n\t\t\tcloneMode: EngineCloneMode.Never\n\t\t});\n\n\t\tcoreConfig.types.mailboxComponent ??= [];\n\t\tcoreConfig.types.mailboxComponent.push({\n\t\t\ttype: MailboxComponentType.Service,\n\t\t\tcloneMode: EngineCloneMode.Never\n\t\t});\n\t}\n}\n\n/**\n * Configures the faucet.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the faucet configuration has been applied.\n */\nasync function configureFaucet(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.faucetConnector ??= [];\n\n\tconst faucetConnectorType = envChoice<IEngineEnvironmentVariables, FaucetConnectorType>(\n\t\tenvVars,\n\t\t\"faucetConnector\",\n\t\tObject.values(FaucetConnectorType)\n\t);\n\n\tif (faucetConnectorType === FaucetConnectorType.EntityStorage) {\n\t\tcoreConfig.types.faucetConnector.push({\n\t\t\ttype: FaucetConnectorType.EntityStorage\n\t\t});\n\t} else if (\n\t\tfaucetConnectorType === FaucetConnectorType.Iota &&\n\t\tIs.stringValue(envVars.iotaFaucetEndpoint)\n\t) {\n\t\tconst dltConfig = EngineTypeHelper.getConfigOfType<DltConfig>(\n\t\t\tcoreConfig,\n\t\t\t\"dltConfig\",\n\t\t\tDltConfigType.Iota\n\t\t);\n\t\tcoreConfig.types.faucetConnector.push({\n\t\t\ttype: FaucetConnectorType.Iota,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tendpoint: envVars.iotaFaucetEndpoint,\n\t\t\t\t\tclientOptions: dltConfig?.options?.config?.clientOptions ?? { url: \"\" },\n\t\t\t\t\tnetwork: dltConfig?.options?.config?.network ?? \"\"\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the wallet.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the wallet configuration has been applied.\n */\nasync function configureWallet(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.walletConnector ??= [];\n\n\tconst walletConnectorType = envChoice<IEngineEnvironmentVariables, WalletConnectorType>(\n\t\tenvVars,\n\t\t\"walletConnector\",\n\t\tObject.values(WalletConnectorType)\n\t);\n\n\tif (walletConnectorType === WalletConnectorType.EntityStorage) {\n\t\tcoreConfig.types.walletConnector.push({\n\t\t\ttype: WalletConnectorType.EntityStorage\n\t\t});\n\t} else if (walletConnectorType === WalletConnectorType.Iota) {\n\t\tconst dltConfig = EngineTypeHelper.getConfigOfType<DltConfig>(\n\t\t\tcoreConfig,\n\t\t\t\"dltConfig\",\n\t\t\tDltConfigType.Iota\n\t\t);\n\t\tcoreConfig.types.walletConnector.push({\n\t\t\ttype: WalletConnectorType.Iota,\n\t\t\toptions: {\n\t\t\t\tconfig: dltConfig?.options?.config ?? ({} as IIotaConfig)\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the NFT.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the NFT configuration has been applied.\n */\nasync function configureNft(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.nftConnector ??= [];\n\n\tconst nftConnectorType = envChoice<IEngineEnvironmentVariables, NftConnectorType>(\n\t\tenvVars,\n\t\t\"nftConnector\",\n\t\tObject.values(NftConnectorType)\n\t);\n\n\tif (nftConnectorType === NftConnectorType.EntityStorage) {\n\t\tcoreConfig.types.nftConnector.push({\n\t\t\ttype: NftConnectorType.EntityStorage\n\t\t});\n\t} else if (nftConnectorType === NftConnectorType.Iota) {\n\t\tconst dltConfig = EngineTypeHelper.getConfigOfType<DltConfig>(\n\t\t\tcoreConfig,\n\t\t\t\"dltConfig\",\n\t\t\tDltConfigType.Iota\n\t\t);\n\t\tconst config = {\n\t\t\t...(dltConfig?.options?.config as IIotaConfig),\n\t\t\tdeploymentPkgId: Is.stringValue(envVars.nftPackageId) ? envVars.nftPackageId : undefined\n\t\t};\n\t\tcoreConfig.types.nftConnector.push({\n\t\t\ttype: NftConnectorType.Iota,\n\t\t\toptions: {\n\t\t\t\tconfig\n\t\t\t}\n\t\t});\n\t}\n\n\tif (coreConfig.types.nftConnector.length > 0) {\n\t\tcoreConfig.types.nftComponent ??= [];\n\t\tcoreConfig.types.nftComponent.push({ type: NftComponentType.Service });\n\t}\n}\n\n/**\n * Configures the notarization.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the notarization configuration has been applied.\n */\nasync function configureNotarization(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.notarizationConnector ??= [];\n\n\tconst notarizationConnectorType = envChoice<\n\t\tIEngineEnvironmentVariables,\n\t\tNotarizationConnectorType\n\t>(envVars, \"notarizationConnector\", Object.values(NotarizationConnectorType));\n\n\tif (notarizationConnectorType === NotarizationConnectorType.EntityStorage) {\n\t\tcoreConfig.types.notarizationConnector.push({\n\t\t\ttype: NotarizationConnectorType.EntityStorage\n\t\t});\n\t} else if (notarizationConnectorType === NotarizationConnectorType.Iota) {\n\t\tconst dltConfig = EngineTypeHelper.getConfigOfType<DltConfig>(\n\t\t\tcoreConfig,\n\t\t\t\"dltConfig\",\n\t\t\tDltConfigType.Iota\n\t\t);\n\t\tcoreConfig.types.notarizationConnector.push({\n\t\t\ttype: NotarizationConnectorType.Iota,\n\t\t\toptions: {\n\t\t\t\tconfig: dltConfig?.options?.config ?? ({} as IIotaConfig)\n\t\t\t}\n\t\t});\n\t}\n\n\tif (coreConfig.types.notarizationConnector.length > 0) {\n\t\tcoreConfig.types.notarizationComponent ??= [];\n\t\tcoreConfig.types.notarizationComponent.push({ type: NotarizationComponentType.Service });\n\t}\n}\n\n/**\n * Configures the immutable proof.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the immutable proof configuration has been applied.\n */\nasync function configureImmutableProof(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (isImmutableProofRequired(envVars)) {\n\t\tcoreConfig.types.immutableProofComponent ??= [];\n\t\tcoreConfig.types.immutableProofComponent.push({\n\t\t\ttype: ImmutableProofComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tverificationMethodId: envVars.immutableProofVerificationMethodId,\n\t\t\t\t\ttaskRetryCount: envCount(envVars, \"immutableProofTaskRetryCount\"),\n\t\t\t\t\ttaskRetryInterval: envSecToMs(envVars, \"immutableProofTaskRetryInterval\"),\n\t\t\t\t\ttaskFailureRetainFor: envMinToMs(envVars, \"immutableProofTaskFailureRetainFor\"),\n\t\t\t\t\tsweepIntervalMinutes: envMinutes(envVars, \"immutableProofSweepInterval\"),\n\t\t\t\t\tsweepStaleThresholdMs: envMinToMs(envVars, \"immutableProofSweepStaleThreshold\"),\n\t\t\t\t\tsweepMaxAttempts: envCount(envVars, \"immutableProofSweepMaxAttempts\"),\n\t\t\t\t\tsweepBatchLimit: envCount(envVars, \"immutableProofSweepBatchLimit\"),\n\t\t\t\t\tsweepBackoffMs: envMinToMs(envVars, \"immutableProofSweepBackoff\"),\n\t\t\t\t\tsweepAssumeRetryableBefore: envDateTime(\n\t\t\t\t\t\tenvVars,\n\t\t\t\t\t\t\"immutableProofSweepAssumeRetryableBefore\"\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the identity.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the identity configuration has been applied.\n */\nasync function configureIdentity(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.identityConnector ??= [];\n\n\tconst identityConnectorType = envChoice<IEngineEnvironmentVariables, IdentityConnectorType>(\n\t\tenvVars,\n\t\t\"identityConnector\",\n\t\tObject.values(IdentityConnectorType)\n\t);\n\n\tif (identityConnectorType === IdentityConnectorType.EntityStorage) {\n\t\tcoreConfig.types.identityConnector.push({\n\t\t\ttype: IdentityConnectorType.EntityStorage\n\t\t});\n\t} else if (identityConnectorType === IdentityConnectorType.Iota) {\n\t\tconst dltConfig = EngineTypeHelper.getConfigOfType<DltConfig>(\n\t\t\tcoreConfig,\n\t\t\t\"dltConfig\",\n\t\t\tDltConfigType.Iota\n\t\t);\n\t\tcoreConfig.types.identityConnector.push({\n\t\t\ttype: IdentityConnectorType.Iota,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\t...(dltConfig?.options?.config ?? ({} as IIotaConfig)),\n\t\t\t\t\tidentityPkgId: Is.stringValue(envVars.iotaIdentityPackageId)\n\t\t\t\t\t\t? envVars.iotaIdentityPackageId\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\twalletAddressIndex: envCount(envVars, \"identityWalletAddressIndex\") ?? 0,\n\t\t\t\t\tdidResolutionCacheTtlMs: envMs(envVars, \"identityDidResolutionCacheTtl\"),\n\t\t\t\t\tdidResolutionCacheCapacity: envCount(envVars, \"identityDidResolutionCacheCapacity\"),\n\t\t\t\t\tdidResolutionCacheMutexTimeoutMs: envMs(\n\t\t\t\t\t\tenvVars,\n\t\t\t\t\t\t\"identityDidResolutionCacheMutexTimeout\"\n\t\t\t\t\t),\n\t\t\t\t\tdidResolutionRetries: envCount(envVars, \"identityDidResolutionRetries\"),\n\t\t\t\t\tdidResolutionRetryDelayMs: envMs(envVars, \"identityDidResolutionRetryDelay\")\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tif (coreConfig.types.identityConnector.length > 0) {\n\t\tcoreConfig.types.identityComponent ??= [];\n\t\tcoreConfig.types.identityComponent.push({ type: IdentityComponentType.Service });\n\t}\n}\n\n/**\n * Configures the identity resolver.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the identity resolver configuration has been applied.\n */\nasync function configureIdentityResolver(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.identityResolverConnector ??= [];\n\n\tconst identityResolverConnectorType = envChoice<\n\t\tIEngineEnvironmentVariables,\n\t\tIdentityResolverConnectorType\n\t>(envVars, \"identityResolverConnector\", Object.values(IdentityResolverConnectorType));\n\n\tif (identityResolverConnectorType === IdentityResolverConnectorType.EntityStorage) {\n\t\tcoreConfig.types.identityResolverConnector.push({\n\t\t\ttype: IdentityResolverConnectorType.EntityStorage\n\t\t});\n\t} else if (identityResolverConnectorType === IdentityResolverConnectorType.Iota) {\n\t\tconst dltConfig = EngineTypeHelper.getConfigOfType<DltConfig>(\n\t\t\tcoreConfig,\n\t\t\t\"dltConfig\",\n\t\t\tDltConfigType.Iota\n\t\t);\n\t\tcoreConfig.types.identityResolverConnector.push({\n\t\t\ttype: IdentityResolverConnectorType.Iota,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\t...(dltConfig?.options?.config as IIotaConfig),\n\t\t\t\t\tidentityPkgId: Is.stringValue(envVars.iotaIdentityPackageId)\n\t\t\t\t\t\t? envVars.iotaIdentityPackageId\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} else if (identityResolverConnectorType === IdentityResolverConnectorType.Universal) {\n\t\tcoreConfig.types.identityResolverConnector.push({\n\t\t\ttype: IdentityResolverConnectorType.Universal,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tendpoint: envVars.universalResolverEndpoint ?? \"\"\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tif (coreConfig.types.identityResolverConnector.length > 0) {\n\t\tcoreConfig.types.identityResolverComponent ??= [];\n\t\tcoreConfig.types.identityResolverComponent.push({\n\t\t\ttype: IdentityResolverComponentType.Service\n\t\t});\n\t}\n}\n\n/**\n * Configures the identity profile.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the identity profile configuration has been applied.\n */\nasync function configureIdentityProfile(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.identityProfileConnector ??= [];\n\n\tconst identityProfileConnectorType = envChoice<\n\t\tIEngineEnvironmentVariables,\n\t\tIdentityProfileConnectorType\n\t>(envVars, \"identityProfileConnector\", Object.values(IdentityProfileConnectorType));\n\n\tif (identityProfileConnectorType === IdentityProfileConnectorType.EntityStorage) {\n\t\tcoreConfig.types.identityProfileConnector.push({\n\t\t\ttype: IdentityProfileConnectorType.EntityStorage\n\t\t});\n\t}\n\n\tif (coreConfig.types.identityProfileConnector.length > 0) {\n\t\tcoreConfig.types.identityProfileComponent ??= [];\n\t\tcoreConfig.types.identityProfileComponent.push({ type: IdentityProfileComponentType.Service });\n\t}\n}\n\n/**\n * Configures the attestation.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the attestation configuration has been applied.\n */\nasync function configureAttestation(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.attestationConnector ??= [];\n\n\tconst attestationConnectorType = envChoice<IEngineEnvironmentVariables, AttestationConnectorType>(\n\t\tenvVars,\n\t\t\"attestationConnector\",\n\t\tObject.values(AttestationConnectorType)\n\t);\n\n\tif (attestationConnectorType === AttestationConnectorType.Nft) {\n\t\tcoreConfig.types.attestationConnector.push({\n\t\t\ttype: AttestationConnectorType.Nft\n\t\t});\n\t}\n\n\tif (coreConfig.types.attestationConnector.length > 0) {\n\t\tcoreConfig.types.attestationComponent ??= [];\n\t\tcoreConfig.types.attestationComponent.push({\n\t\t\ttype: AttestationComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tverificationMethodId: envVars.attestationVerificationMethodId\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the auditable item graph.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the auditable item graph configuration has been applied.\n */\nasync function configureAuditableItemGraph(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (envBoolean(envVars, \"auditableItemGraphEnabled\", false)) {\n\t\tcoreConfig.types.auditableItemGraphComponent ??= [];\n\t\tcoreConfig.types.auditableItemGraphComponent.push({\n\t\t\ttype: AuditableItemGraphComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"auditableItemGraphMutexTimeout\")\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the auditable item stream.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the auditable item stream configuration has been applied.\n */\nasync function configureAuditableItemStream(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (envBoolean(envVars, \"auditableItemStreamEnabled\", false)) {\n\t\tcoreConfig.types.auditableItemStreamComponent ??= [];\n\t\tcoreConfig.types.auditableItemStreamComponent.push({\n\t\t\ttype: AuditableItemStreamComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"auditableItemStreamMutexTimeout\")\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the data processing.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the data processing configuration has been applied.\n */\nasync function configureDataProcessing(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.dataConverterConnector ??= [];\n\n\tconst converterConnectors = envListToArray<\n\t\tIEngineEnvironmentVariables,\n\t\tDataConverterConnectorType\n\t>(envVars, \"dataConverterConnectors\", Object.values(DataConverterConnectorType));\n\tfor (const converterConnector of converterConnectors) {\n\t\tcoreConfig.types.dataConverterConnector.push({\n\t\t\ttype: converterConnector\n\t\t});\n\t}\n\n\tcoreConfig.types.dataExtractorConnector ??= [];\n\tconst extractorConnectors = envListToArray<\n\t\tIEngineEnvironmentVariables,\n\t\tDataExtractorConnectorType\n\t>(envVars, \"dataExtractorConnectors\", Object.values(DataExtractorConnectorType));\n\tfor (const extractorConnector of extractorConnectors) {\n\t\tcoreConfig.types.dataExtractorConnector.push({\n\t\t\ttype: extractorConnector\n\t\t});\n\t}\n\n\tif (\n\t\tcoreConfig.types.dataConverterConnector.length > 0 ||\n\t\tcoreConfig.types.dataExtractorConnector.length > 0\n\t) {\n\t\tcoreConfig.types.dataProcessingComponent ??= [];\n\t\tcoreConfig.types.dataProcessingComponent.push({ type: DataProcessingComponentType.Service });\n\t}\n}\n\n/**\n * Configures the document management.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the document management configuration has been applied.\n */\nasync function configureDocumentManagement(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (envBoolean(envVars, \"documentManagementEnabled\", false)) {\n\t\tcoreConfig.types.documentManagementComponent ??= [];\n\t\tcoreConfig.types.documentManagementComponent.push({\n\t\t\ttype: DocumentManagementComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"documentManagementMutexTimeout\")\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the trust components.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the trust configuration has been applied.\n */\nasync function configureTrust(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (isTrustRequired(envVars)) {\n\t\tcoreConfig.types.trustComponent ??= [];\n\t\tcoreConfig.types.trustComponent.push({\n\t\t\ttype: TrustComponentType.Service\n\t\t});\n\n\t\tcoreConfig.types.trustGeneratorComponent ??= [];\n\t\tconst trustGeneratorTypes = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tTrustGeneratorComponentType\n\t\t>(envVars, \"trustGenerators\", Object.values(TrustGeneratorComponentType));\n\n\t\tfor (const trustGeneratorType of trustGeneratorTypes) {\n\t\t\tcoreConfig.types.trustGeneratorComponent.push({\n\t\t\t\ttype: trustGeneratorType,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tverificationMethodId: envVars.trustVerificationMethodId ?? \"\",\n\t\t\t\t\t\ttokenTtlInSeconds: envCount(envVars, \"trustJwtTtl\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tcoreConfig.types.trustVerifierComponent ??= [];\n\t\tconst trustVerifierTypes = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tTrustVerifierComponentType\n\t\t>(envVars, \"trustVerifiers\", Object.values(TrustVerifierComponentType));\n\t\tfor (const trustVerifierType of trustVerifierTypes) {\n\t\t\tif (trustVerifierType === TrustVerifierComponentType.IdentityAllowDeny) {\n\t\t\t\tcoreConfig.types.trustVerifierComponent.push({\n\t\t\t\t\ttype: TrustVerifierComponentType.IdentityAllowDeny,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\tallowIdentities: commaSeparatedListToArray<string>(envVars.trustIdentitiesAllow),\n\t\t\t\t\t\t\tdenyIdentities: commaSeparatedListToArray<string>(envVars.trustIdentitiesDeny)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (trustVerifierType === TrustVerifierComponentType.JwtVerifiableCredential) {\n\t\t\t\tcoreConfig.types.trustVerifierComponent.push({\n\t\t\t\t\ttype: TrustVerifierComponentType.JwtVerifiableCredential\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Configures the rights management.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the rights management configuration has been applied.\n */\nasync function configureRightsManagement(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (isRightsManagementRequired(envVars)) {\n\t\tcoreConfig.types.rightsManagementPapComponent ??= [];\n\t\tcoreConfig.types.rightsManagementPapComponent.push({\n\t\t\ttype: RightsManagementPapComponentType.Service\n\t\t});\n\n\t\tcoreConfig.types.rightsManagementPmpComponent ??= [];\n\t\tcoreConfig.types.rightsManagementPmpComponent.push({\n\t\t\ttype: RightsManagementPmpComponentType.Service\n\t\t});\n\n\t\tcoreConfig.types.rightsManagementPipComponent ??= [];\n\t\tcoreConfig.types.rightsManagementPipComponent.push({\n\t\t\ttype: RightsManagementPipComponentType.Service\n\t\t});\n\n\t\tcoreConfig.types.rightsManagementPxpComponent ??= [];\n\t\tcoreConfig.types.rightsManagementPxpComponent.push({\n\t\t\ttype: RightsManagementPxpComponentType.Service\n\t\t});\n\n\t\tcoreConfig.types.rightsManagementPdpComponent ??= [];\n\t\tcoreConfig.types.rightsManagementPdpComponent.push({\n\t\t\ttype: RightsManagementPdpComponentType.Service\n\t\t});\n\n\t\tcoreConfig.types.rightsManagementPepComponent ??= [];\n\t\tcoreConfig.types.rightsManagementPepComponent.push({\n\t\t\ttype: RightsManagementPepComponentType.Service\n\t\t});\n\n\t\tcoreConfig.types.rightsManagementPnpComponent ??= [];\n\n\t\t// Single source of truth for the rights-management mount path.\n\t\tconst rightsManagementPath = envVars.rightsManagementCallbackPath ?? \"rights-management\";\n\n\t\t// We add a multi instance REST client for the remote negotiations\n\t\t// use a dummy endpoint for now as the actual endpoint will be provided in the config\n\t\t// of the policy negotiator when it is used for remote negotiations\n\t\t// We must add it before the service as the service needs to be able to request\n\t\t// the REST client type from the engine core to be able to support remote negotiations\n\t\tcoreConfig.types.rightsManagementPnpComponent.push({\n\t\t\ttype: RightsManagementPnpComponentType.RestClient,\n\t\t\toptions: {\n\t\t\t\t// The endpoint is required in config, but as this is multi-instance\n\t\t\t\t// the actual endpoint will be provided in the config when it is constructed\n\t\t\t\tendpoint: \"http://localhost\",\n\t\t\t\tpathPrefix: rightsManagementPath\n\t\t\t},\n\t\t\tisMultiInstance: true,\n\t\t\tfeatures: [\"remote\"]\n\t\t});\n\t\tcoreConfig.types.rightsManagementPnpComponent.push({\n\t\t\ttype: RightsManagementPnpComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tcallbackPath: rightsManagementPath,\n\t\t\t\t\tincludeErrorDetails: coreConfig.debug ?? false,\n\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"rightsManagementMutexTimeout\")\n\t\t\t\t}\n\t\t\t},\n\t\t\tisDefault: true\n\t\t});\n\n\t\tcoreConfig.types.rightsManagementPnapComponent ??= [];\n\t\tcoreConfig.types.rightsManagementPnapComponent.push({\n\t\t\ttype: RightsManagementPnapComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"rightsManagementMutexTimeout\")\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tcoreConfig.types.rightsManagementPolicyArbiterComponent ??= [];\n\t\tconst policyArbiterTypes = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tRightsManagementPolicyArbiterComponentType\n\t\t>(\n\t\t\tenvVars,\n\t\t\t\"rightsManagementPolicyArbiters\",\n\t\t\tObject.values(RightsManagementPolicyArbiterComponentType)\n\t\t);\n\t\tfor (const policyArbiterType of policyArbiterTypes) {\n\t\t\tcoreConfig.types.rightsManagementPolicyArbiterComponent.push({\n\t\t\t\ttype: policyArbiterType\n\t\t\t});\n\t\t}\n\n\t\tcoreConfig.types.rightsManagementPolicyObligationEnforcerComponent ??= [];\n\t\tconst policyObligationEnforcerTypes = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tRightsManagementPolicyObligationEnforcerComponentType\n\t\t>(\n\t\t\tenvVars,\n\t\t\t\"rightsManagementPolicyObligationEnforcers\",\n\t\t\tObject.values(RightsManagementPolicyObligationEnforcerComponentType)\n\t\t);\n\t\tfor (const policyObligationEnforcerType of policyObligationEnforcerTypes) {\n\t\t\tcoreConfig.types.rightsManagementPolicyObligationEnforcerComponent.push({\n\t\t\t\ttype: policyObligationEnforcerType\n\t\t\t});\n\t\t}\n\n\t\tcoreConfig.types.rightsManagementPolicyEnforcementProcessorComponent ??= [];\n\t\tconst policyEnforcementProcessTypes = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tRightsManagementPolicyEnforcementProcessorComponentType\n\t\t>(\n\t\t\tenvVars,\n\t\t\t\"rightsManagementPolicyEnforcementProcessors\",\n\t\t\tObject.values(RightsManagementPolicyEnforcementProcessorComponentType)\n\t\t);\n\t\tfor (const policyEnforcementProcessorType of policyEnforcementProcessTypes) {\n\t\t\tcoreConfig.types.rightsManagementPolicyEnforcementProcessorComponent.push({\n\t\t\t\ttype: policyEnforcementProcessorType\n\t\t\t});\n\t\t}\n\n\t\tcoreConfig.types.rightsManagementPolicyExecutionActionComponent ??= [];\n\t\tconst policyExecutionActionTypes = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tRightsManagementPolicyExecutionActionComponentType\n\t\t>(\n\t\t\tenvVars,\n\t\t\t\"rightsManagementPolicyExecutionActions\",\n\t\t\tObject.values(RightsManagementPolicyExecutionActionComponentType)\n\t\t);\n\t\tfor (const policyExecutionActionType of policyExecutionActionTypes) {\n\t\t\tcoreConfig.types.rightsManagementPolicyExecutionActionComponent.push({\n\t\t\t\ttype: policyExecutionActionType\n\t\t\t});\n\t\t}\n\n\t\tcoreConfig.types.rightsManagementPolicyInformationSourceComponent ??= [];\n\t\tconst policyInformationSourceTypes = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tRightsManagementPolicyInformationSourceComponentType\n\t\t>(\n\t\t\tenvVars,\n\t\t\t\"rightsManagementPolicyInformationSources\",\n\t\t\tObject.values(RightsManagementPolicyInformationSourceComponentType)\n\t\t);\n\t\tfor (const policyInformationSourceType of policyInformationSourceTypes) {\n\t\t\tcoreConfig.types.rightsManagementPolicyInformationSourceComponent.push({\n\t\t\t\ttype: policyInformationSourceType\n\t\t\t});\n\t\t}\n\n\t\tcoreConfig.types.rightsManagementPolicyRequesterComponent ??= [];\n\t\tconst policyRequesterTypes = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tRightsManagementPolicyRequesterComponentType\n\t\t>(\n\t\t\tenvVars,\n\t\t\t\"rightsManagementPolicyRequesters\",\n\t\t\tObject.values(RightsManagementPolicyRequesterComponentType)\n\t\t);\n\t\tfor (const policyRequesterType of policyRequesterTypes) {\n\t\t\tcoreConfig.types.rightsManagementPolicyRequesterComponent.push({\n\t\t\t\ttype: policyRequesterType\n\t\t\t});\n\t\t}\n\n\t\tcoreConfig.types.rightsManagementPolicyNegotiatorComponent ??= [];\n\t\tconst policyNegotiatorTypes = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tRightsManagementPolicyNegotiatorComponentType\n\t\t>(\n\t\t\tenvVars,\n\t\t\t\"rightsManagementPolicyNegotiators\",\n\t\t\tObject.values(RightsManagementPolicyNegotiatorComponentType)\n\t\t);\n\t\tfor (const policyNegotiatorType of policyNegotiatorTypes) {\n\t\t\tcoreConfig.types.rightsManagementPolicyNegotiatorComponent.push({\n\t\t\t\ttype: policyNegotiatorType\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * Configures the task scheduler.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the task scheduler configuration has been applied.\n */\nasync function configureTaskScheduler(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (isTaskSchedulerRequired(envVars)) {\n\t\tcoreConfig.types.taskSchedulerComponent ??= [];\n\t\tcoreConfig.types.taskSchedulerComponent.push({\n\t\t\ttype: TaskSchedulerComponentType.Service\n\t\t});\n\t}\n}\n\n/**\n * Configures the federated catalogue.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the federated catalogue configuration has been applied.\n */\nasync function configureFederatedCatalogue(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (isFederatedCatalogueRequired(envVars)) {\n\t\tcoreConfig.types.federatedCatalogueComponent ??= [];\n\n\t\tif (Is.stringValue(envVars.federatedCatalogueRemoteEndpoint)) {\n\t\t\tcoreConfig.types.federatedCatalogueComponent.push({\n\t\t\t\ttype: FederatedCatalogueComponentType.RestClient,\n\t\t\t\toptions: {\n\t\t\t\t\tendpoint: envVars.federatedCatalogueRemoteEndpoint,\n\t\t\t\t\tpathPrefix: envVars.federatedCatalogueRestClientPathPrefix ?? \"catalog\"\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tcoreConfig.types.federatedCatalogueComponent.push({\n\t\t\t\ttype: FederatedCatalogueComponentType.Service,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"federatedCatalogueMutexTimeout\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tcoreConfig.types.federatedCatalogueFilterComponent ??= [];\n\t\t\tconst filters = envListToArray<\n\t\t\t\tIEngineEnvironmentVariables,\n\t\t\t\tFederatedCatalogueFilterComponentType\n\t\t\t>(envVars, \"federatedCatalogueFilters\", Object.values(FederatedCatalogueFilterComponentType));\n\n\t\t\tfor (const filter of filters) {\n\t\t\t\tcoreConfig.types.federatedCatalogueFilterComponent.push({\n\t\t\t\t\ttype: filter,\n\t\t\t\t\toptions: {}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Configures the dataspace control plane and data plane.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the dataspace configuration has been applied.\n */\nasync function configureDataspace(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (envBoolean(envVars, \"dataspaceEnabled\", false)) {\n\t\tcoreConfig.types.dataspaceControlPlaneComponent ??= [];\n\t\t// We add a multi instance REST client for remote/consumer-initiated transfers.\n\t\tcoreConfig.types.dataspaceControlPlaneComponent.push({\n\t\t\ttype: DataspaceControlPlaneComponentType.RestClient,\n\t\t\toptions: {\n\t\t\t\tendpoint: \"http://localhost\"\n\t\t\t},\n\t\t\tisMultiInstance: true,\n\t\t\tfeatures: [\"remote\"]\n\t\t});\n\t\tcoreConfig.types.dataspaceControlPlaneComponent.push({\n\t\t\ttype: DataspaceControlPlaneComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\t// Must match the control-plane REST mount, as it is combined with the public origin\n\t\t\t\t\t// to build the consumer's advertised callback address;\n\t\t\t\t\tcallbackPath: envVars.dataspaceCallbackPath ?? \"dataspace-control-plane\",\n\t\t\t\t\t// Base mount path of the data plane only; the transfer handlers append the\n\t\t\t\t\t// sub-paths themselves (`/entities` for PULL, `/inbox` for PUSH).\n\t\t\t\t\tdataPlanePath: envVars.dataspaceDataPlanePath,\n\t\t\t\t\tautoStartTransfers: envBoolean(envVars, \"dataspaceAutoStartTransfers\", false),\n\t\t\t\t\tstalledNegotiationTimeoutMs: envSecToMs(envVars, \"dataspaceStalledNegotiationTimeout\"),\n\t\t\t\t\tstalledTransferTimeoutMs: envSecToMs(envVars, \"dataspaceStalledTransferTimeout\"),\n\t\t\t\t\tproviderTransferIdleTimeoutMs: envSecToMs(\n\t\t\t\t\t\tenvVars,\n\t\t\t\t\t\t\"dataspaceProviderTransferIdleTimeout\"\n\t\t\t\t\t),\n\t\t\t\t\tproviderTransferPolicySweepIntervalMs: envSecToMs(\n\t\t\t\t\t\tenvVars,\n\t\t\t\t\t\t\"dataspaceProviderTransferPolicySweepInterval\"\n\t\t\t\t\t),\n\t\t\t\t\tagreementUnusedThresholdMs: envMs(envVars, \"dataspaceAgreementUnusedThreshold\"),\n\t\t\t\t\tagreementSweepIntervalMs: envMs(envVars, \"dataspaceAgreementSweepInterval\")\n\t\t\t\t}\n\t\t\t},\n\t\t\tisDefault: true\n\t\t});\n\n\t\tcoreConfig.types.dataspaceDataPlaneComponent ??= [];\n\t\tcoreConfig.types.dataspaceDataPlaneComponent.push({\n\t\t\ttype: DataspaceDataPlaneComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tretainActivityLogsForMs: envSecToMs(envVars, \"dataspaceRetainActivityLogsFor\"),\n\t\t\t\t\tactivityLogsCleanUpIntervalMs: envSecToMs(\n\t\t\t\t\t\tenvVars,\n\t\t\t\t\t\t\"dataspaceActivityLogsCleanupInterval\"\n\t\t\t\t\t),\n\t\t\t\t\tretryCount: envCount(envVars, \"dataspaceRetryCount\"),\n\t\t\t\t\tpushRetryCount: envCount(envVars, \"dataspacePushRetryCount\"),\n\t\t\t\t\tpushRetryBaseDelayMs: envMs(envVars, \"dataspacePushRetryBaseDelay\"),\n\t\t\t\t\tpushTimeoutMs: envMs(envVars, \"dataspacePushTimeout\"),\n\t\t\t\t\tpushSubscriptionCleanupIntervalMs: envMs(\n\t\t\t\t\t\tenvVars,\n\t\t\t\t\t\t\"dataspacePushSubscriptionCleanupInterval\"\n\t\t\t\t\t),\n\t\t\t\t\tagreementCacheTtlMs: envMs(envVars, \"dataspaceAgreementCacheTtl\"),\n\t\t\t\t\tagreementCacheMutexTimeoutMs: envMs(envVars, \"dataspaceAgreementCacheMutexTimeout\")\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the DLT.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the DLT configuration has been applied.\n */\nasync function configureDlt(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\t// Create centralized DLT configuration for IOTA if essential IOTA variables are set\n\tif (Is.stringValue(envVars.iotaNodeEndpoint) && Is.stringValue(envVars.iotaNetwork)) {\n\t\tcoreConfig.types.dltConfig ??= [];\n\n\t\tconst gasStationConfig =\n\t\t\tIs.stringValue(envVars.iotaGasStationEndpoint) &&\n\t\t\tIs.stringValue(envVars.iotaGasStationAuthToken)\n\t\t\t\t? {\n\t\t\t\t\t\tgasStationUrl: envVars.iotaGasStationEndpoint,\n\t\t\t\t\t\tgasStationAuthToken: envVars.iotaGasStationAuthToken\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\n\t\tcoreConfig.types.dltConfig.push({\n\t\t\ttype: DltConfigType.Iota,\n\t\t\tisDefault: true,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tclientOptions: {\n\t\t\t\t\t\turl: envVars.iotaNodeEndpoint ?? \"\"\n\t\t\t\t\t},\n\t\t\t\t\tnetwork: envVars.iotaNetwork ?? \"\",\n\t\t\t\t\tcoinType: envCount(envVars, \"iotaCoinType\"),\n\t\t\t\t\tgasStation: gasStationConfig,\n\t\t\t\t\tgasBudget: envCount(envVars, \"iotaGasBudget\"),\n\t\t\t\t\tgasReservationDuration: envSeconds(envVars, \"iotaGasReservationDuration\")\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Checks if the trust subsystem is required.\n * Returns true when any component that depends on the trust subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if rights-management, or dataspace is enabled.\n */\nexport function isTrustRequired(envVars: IEngineEnvironmentVariables): boolean {\n\treturn (\n\t\tisRightsManagementRequired(envVars) ||\n\t\tenvBoolean(envVars, \"dataspaceEnabled\", false) ||\n\t\tisFederatedCatalogueRequired(envVars)\n\t);\n}\n\n/**\n * Checks if the background tasks subsystem is required.\n * Returns true when any component that depends on the background tasks subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if dataspace or verifiable storage is enabled.\n */\nexport function isBackgroundTasksRequired(envVars: IEngineEnvironmentVariables): boolean {\n\treturn (\n\t\tenvBoolean(envVars, \"dataspaceEnabled\", false) ||\n\t\tisImmutableProofRequired(envVars) ||\n\t\tenvBoolean(envVars, \"healthEnabled\", false)\n\t);\n}\n\n/**\n * Checks if the immutable proof subsystem is required.\n * Returns true when any component that depends on the immutable proof subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if verifiable storage is enabled.\n */\nexport function isImmutableProofRequired(envVars: IEngineEnvironmentVariables): boolean {\n\treturn (\n\t\tenvBoolean(envVars, \"auditableItemGraphEnabled\", false) ||\n\t\tenvBoolean(envVars, \"auditableItemStreamEnabled\", false) ||\n\t\tenvBoolean(envVars, \"documentManagementEnabled\", false)\n\t);\n}\n\n/**\n * Checks if the federated catalogue subsystem is required.\n * Returns true when the catalogue is explicitly enabled, a remote endpoint is configured, filters are set, or dataspace is enabled.\n * @param envVars The environment variables.\n * @returns True if the federated catalogue is required.\n */\nexport function isFederatedCatalogueRequired(envVars: IEngineEnvironmentVariables): boolean {\n\treturn (\n\t\tenvBoolean(envVars, \"federatedCatalogueEnabled\", false) ||\n\t\tIs.stringValue(envVars.federatedCatalogueRemoteEndpoint) ||\n\t\tIs.stringValue(envVars.federatedCatalogueFilters) ||\n\t\tenvBoolean(envVars, \"dataspaceEnabled\", false)\n\t);\n}\n\n/**\n * Checks if the rights management subsystem is required.\n * Returns true when any component that depends on the rights management subsystem is enabled.\n * Note: rights management has no standalone enable flag - it is gated entirely on\n * `dataspaceEnabled`. Setting `TWIN_RIGHTS_MANAGEMENT_*` env var in isolation does not\n * enable the subsystem; `TWIN_DATASPACE_ENABLED` must also be true.\n * @param envVars The environment variables.\n * @returns True if rights management is enabled.\n */\nexport function isRightsManagementRequired(envVars: IEngineEnvironmentVariables): boolean {\n\treturn envBoolean(envVars, \"dataspaceEnabled\", false);\n}\n\n/**\n * Checks if the task scheduler subsystem is required.\n * Returns true when any component that depends on the task scheduler subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if task scheduler is enabled.\n */\nexport function isTaskSchedulerRequired(envVars: IEngineEnvironmentVariables): boolean {\n\treturn (\n\t\tenvBoolean(envVars, \"taskSchedulerEnabled\", false) ||\n\t\tenvBoolean(envVars, \"dataspaceEnabled\", false) ||\n\t\tisRightsManagementRequired(envVars) ||\n\t\tisAuthEntityStorageRequired(envVars) ||\n\t\tisImmutableProofRequired(envVars) ||\n\t\tisMailboxEnabled(envVars)\n\t);\n}\n\n/**\n * Checks if the automation subsystem is required.\n * Returns true when any component that depends on the automation subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if automation is enabled.\n */\nexport function isAutomationRequired(envVars: IEngineEnvironmentVariables): boolean {\n\treturn isRightsManagementRequired(envVars);\n}\n\n/**\n * Checks if the telemetry subsystem is enabled.\n * Returns true when any component that depends on the telemetry subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if telemetry is enabled.\n */\nexport function isTelemetryEnabled(envVars: IEngineEnvironmentVariables): boolean {\n\treturn commaSeparatedListToArray<TelemetryConnectorType>(envVars.telemetryConnector).some(\n\t\tt => t === TelemetryConnectorType.EntityStorage || t === TelemetryConnectorType.OpenTelemetry\n\t);\n}\n\n/**\n * Checks if the tracing subsystem is enabled.\n * Returns true when any component that depends on the tracing subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if tracing is enabled.\n */\nexport function isTracingEnabled(envVars: IEngineEnvironmentVariables): boolean {\n\treturn commaSeparatedListToArray<TracingConnectorType>(envVars.tracingConnector).some(\n\t\tt =>\n\t\t\tt === TracingConnectorType.EntityStorage ||\n\t\t\tt === TracingConnectorType.OpenTelemetry ||\n\t\t\tt === TracingConnectorType.Console\n\t);\n}\n\n/**\n * Checks if the mailbox subsystem is enabled.\n * Returns true when any component that depends on the mailbox subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if mailbox is enabled.\n */\nexport function isMailboxEnabled(envVars: IEngineEnvironmentVariables): boolean {\n\treturn commaSeparatedListToArray<EmailProtocolConnectorType>(envVars.emailProtocolConnector).some(\n\t\tt => t === EmailProtocolConnectorType.Imap || t === EmailProtocolConnectorType.Pop3\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"engineEnvBuilder.js","sourceRoot":"","sources":["../../../src/builders/engineEnvBuilder.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACN,wBAAwB,EACxB,wBAAwB,EACxB,+BAA+B,EAC/B,gCAAgC,EAEhC,oBAAoB,EACpB,uBAAuB,EACvB,2BAA2B,EAC3B,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,EAC7B,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC3B,kCAAkC,EAClC,+BAA+B,EAE/B,aAAa,EACb,+BAA+B,EAC/B,0BAA0B,EAC1B,gBAAgB,EAChB,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,+BAA+B,EAC/B,qCAAqC,EACrC,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,4BAA4B,EAC5B,4BAA4B,EAC5B,6BAA6B,EAC7B,6BAA6B,EAE7B,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,EAC3B,sBAAsB,EACtB,2BAA2B,EAC3B,sCAAsC,EACtC,yBAAyB,EACzB,6BAA6B,EAC7B,4BAA4B,EAC5B,gBAAgB,EAChB,gBAAgB,EAChB,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,EACrB,gCAAgC,EAChC,gCAAgC,EAChC,gCAAgC,EAChC,gCAAgC,EAChC,gCAAgC,EAChC,iCAAiC,EACjC,gCAAgC,EAChC,0CAA0C,EAC1C,uDAAuD,EACvD,kDAAkD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AU,gBAAgB,CAAC,OAAoC;IACpE,OAAO,yBAAyB,CAA6B,OAAO,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAChG,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,0BAA0B,CAAC,IAAI,IAAI,CAAC,KAAK,0BAA0B,CAAC,IAAI,CACnF,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport path from \"node:path\";\nimport { Is, Mutex } from \"@twin.org/core\";\nimport type { IIotaConfig } from \"@twin.org/dlt-iota\";\nimport { EngineCloneMode } from \"@twin.org/engine-models\";\nimport {\n\tAttestationComponentType,\n\tAttestationConnectorType,\n\tAuditableItemGraphComponentType,\n\tAuditableItemStreamComponentType,\n\ttype AutomationActionConfig,\n\tAutomationActionType,\n\tAutomationComponentType,\n\tBackgroundTaskComponentType,\n\tBlobStorageComponentType,\n\tBlobStorageConnectorType,\n\tContextIdHandlerComponentType,\n\tDataConverterConnectorType,\n\tDataExtractorConnectorType,\n\tDataProcessingComponentType,\n\tDataspaceControlPlaneComponentType,\n\tDataspaceDataPlaneComponentType,\n\ttype DltConfig,\n\tDltConfigType,\n\tDocumentManagementComponentType,\n\tEmailProtocolConnectorType,\n\tEngineTypeHelper,\n\tEntityStorageConnectorType,\n\tEventBusComponentType,\n\tEventBusConnectorType,\n\tFaucetConnectorType,\n\tFederatedCatalogueComponentType,\n\tFederatedCatalogueFilterComponentType,\n\tHealthComponentType,\n\tIdentityComponentType,\n\tIdentityConnectorType,\n\tIdentityProfileComponentType,\n\tIdentityProfileConnectorType,\n\tIdentityResolverComponentType,\n\tIdentityResolverConnectorType,\n\ttype IEngineConfig,\n\tImmutableProofComponentType,\n\tLoggingComponentType,\n\tLoggingConnectorType,\n\tMailboxComponentType,\n\tMailStorageComponentType,\n\tMessagingAdminComponentType,\n\tMessagingComponentType,\n\tMessagingEmailConnectorType,\n\tMessagingPushNotificationConnectorType,\n\tMessagingSmsConnectorType,\n\tMetricsCollectorComponentType,\n\tMetricsProducerComponentType,\n\tNftComponentType,\n\tNftConnectorType,\n\tNotarizationComponentType,\n\tNotarizationConnectorType,\n\tPlatformComponentType,\n\tRightsManagementPapComponentType,\n\tRightsManagementPdpComponentType,\n\tRightsManagementPepComponentType,\n\tRightsManagementPipComponentType,\n\tRightsManagementPmpComponentType,\n\tRightsManagementPnapComponentType,\n\tRightsManagementPnpComponentType,\n\tRightsManagementPolicyArbiterComponentType,\n\tRightsManagementPolicyEnforcementProcessorComponentType,\n\tRightsManagementPolicyExecutionActionComponentType,\n\tRightsManagementPolicyInformationSourceComponentType,\n\tRightsManagementPolicyNegotiatorComponentType,\n\tRightsManagementPolicyObligationEnforcerComponentType,\n\tRightsManagementPolicyRequesterComponentType,\n\tRightsManagementPxpComponentType,\n\tSchemaVersionMigrationComponentType,\n\tTaskSchedulerComponentType,\n\tTelemetryComponentType,\n\tTelemetryConnectorType,\n\tTenantAdminComponentType,\n\tTracingComponentType,\n\tTracingConnectorType,\n\tTrustComponentType,\n\tTrustGeneratorComponentType,\n\tTrustVerifierComponentType,\n\tVaultConnectorType,\n\tWalletConnectorType\n} from \"@twin.org/engine-types\";\nimport {\n\ttype IOpenTelemetryLoggingConnectorConfig,\n\ttype IOpenTelemetryOtlpExporterConfig,\n\tOpenTelemetryExporterTypes\n} from \"@twin.org/logging-connector-opentelemetry\";\nimport {\n\ttype IOpenTelemetryTelemetryConnectorConfig,\n\tOpenTelemetryReaderTypes\n} from \"@twin.org/telemetry-connector-opentelemetry\";\nimport {\n\ttype IOpenTelemetryTracingConnectorConfig,\n\tOpenTelemetryProcessorTypes\n} from \"@twin.org/tracing-connector-opentelemetry\";\nimport { CONTEXT_ID_HANDLER_FEATURE_DID, CONTEXT_ID_HANDLER_FEATURE_TENANT } from \"../defaults.js\";\nimport { isAuthEntityStorageRequired } from \"./engineServerEnvBuilder.js\";\nimport {\n\tcommaSeparatedListToArray,\n\tenvArray,\n\tenvBoolean,\n\tenvChoice,\n\tenvCount,\n\tenvDateTime,\n\tenvInteger,\n\tenvListToArray,\n\tenvMinToMs,\n\tenvMinutes,\n\tenvMs,\n\tenvSecToMs,\n\tenvSeconds\n} from \"./helper/envHelpers.js\";\nimport type { IEngineEnvironmentVariables } from \"../models/IEngineEnvironmentVariables.js\";\n\n/**\n * Build the engine core configuration from environment variables.\n * @param envVars The environment variables.\n * @returns The config for the core.\n */\nexport async function buildEngineConfiguration(\n\tenvVars: IEngineEnvironmentVariables\n): Promise<IEngineConfig> {\n\tif (Is.stringValue(envVars.storageFileRoot)) {\n\t\tenvVars.stateFilename ??= \"engine-state.json\";\n\t\tenvVars.storageFileRoot = path.resolve(envVars.storageFileRoot);\n\t\tenvVars.stateFilename = path.join(envVars.storageFileRoot, envVars.stateFilename);\n\t}\n\n\tconst coreConfig: IEngineConfig = {\n\t\tdebug: envBoolean(envVars, \"debug\", false),\n\t\tsilent: envBoolean(envVars, \"silent\", false),\n\t\tsilentComponents: {\n\t\t\tlogging: commaSeparatedListToArray(envVars.loggingSilentComponents),\n\t\t\ttelemetry: commaSeparatedListToArray(envVars.telemetrySilentComponents),\n\t\t\ttracing: commaSeparatedListToArray(envVars.tracingSilentComponents)\n\t\t},\n\t\ttypes: {}\n\t};\n\n\tconst mutexTimeoutMs = envMs(envVars, \"mutexTimeoutDefault\");\n\tif (Is.notEmpty(mutexTimeoutMs)) {\n\t\tMutex.setDefaultTimeoutMs(mutexTimeoutMs);\n\t}\n\n\tawait configureSchemaMigration(coreConfig, envVars);\n\tawait configurePlatform(coreConfig, envVars);\n\tawait configureTenant(coreConfig, envVars);\n\tawait configureContextIdHandlers(coreConfig, envVars);\n\n\tawait configureEntityStorage(coreConfig, envVars);\n\tawait configureBlobStorage(coreConfig, envVars);\n\tawait configureVault(coreConfig, envVars);\n\tawait configureDlt(coreConfig, envVars);\n\n\tawait configureLogging(coreConfig, envVars);\n\tawait configureBackgroundTask(coreConfig, envVars);\n\tawait configureTaskScheduler(coreConfig, envVars);\n\tawait configureEventBus(coreConfig, envVars);\n\tawait configureTelemetry(coreConfig, envVars);\n\tawait configureMetricsCollector(coreConfig, envVars);\n\tawait configureTracing(coreConfig, envVars);\n\tawait configureMessaging(coreConfig, envVars);\n\tawait configureMailbox(coreConfig, envVars);\n\tawait configureAutomation(coreConfig, envVars);\n\tawait configureHealth(coreConfig, envVars);\n\n\tawait configureFaucet(coreConfig, envVars);\n\tawait configureWallet(coreConfig, envVars);\n\tawait configureNft(coreConfig, envVars);\n\tawait configureNotarization(coreConfig, envVars);\n\tawait configureImmutableProof(coreConfig, envVars);\n\tawait configureIdentity(coreConfig, envVars);\n\tawait configureIdentityResolver(coreConfig, envVars);\n\tawait configureIdentityProfile(coreConfig, envVars);\n\tawait configureAttestation(coreConfig, envVars);\n\tawait configureDataProcessing(coreConfig, envVars);\n\n\tawait configureAuditableItemGraph(coreConfig, envVars);\n\tawait configureAuditableItemStream(coreConfig, envVars);\n\tawait configureDocumentManagement(coreConfig, envVars);\n\tawait configureTrust(coreConfig, envVars);\n\tawait configureRightsManagement(coreConfig, envVars);\n\n\tawait configureFederatedCatalogue(coreConfig, envVars);\n\tawait configureDataspace(coreConfig, envVars);\n\n\treturn coreConfig;\n}\n\n/**\n * Configures the entity storage.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the entity storage configuration has been applied.\n */\nasync function configureEntityStorage(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types ??= {};\n\tcoreConfig.types.entityStorageConnector ??= [];\n\n\tconst entityStorageConnectorTypes = envListToArray<\n\t\tIEngineEnvironmentVariables,\n\t\tEntityStorageConnectorType\n\t>(envVars, \"entityStorageConnectorType\", Object.values(EntityStorageConnectorType));\n\n\tfor (const entityStorageConnectorType of entityStorageConnectorTypes) {\n\t\tif (entityStorageConnectorType === EntityStorageConnectorType.Memory) {\n\t\t\tcoreConfig.types.entityStorageConnector.push({\n\t\t\t\ttype: EntityStorageConnectorType.Memory,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"entityStorageMutexTimeout\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (entityStorageConnectorType === EntityStorageConnectorType.File) {\n\t\t\tcoreConfig.types.entityStorageConnector.push({\n\t\t\t\ttype: EntityStorageConnectorType.File,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tdirectory: envVars.storageFileRoot ?? \"\",\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"entityStorageMutexTimeout\")\n\t\t\t\t\t},\n\t\t\t\t\tfolderPrefix: envVars.entityStorageTablePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (entityStorageConnectorType === EntityStorageConnectorType.AwsDynamoDb) {\n\t\t\tcoreConfig.types.entityStorageConnector.push({\n\t\t\t\ttype: EntityStorageConnectorType.AwsDynamoDb,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tregion: envVars.awsDynamodbRegion ?? \"\",\n\t\t\t\t\t\tauthMode: envVars.awsDynamodbAuthMode as \"credentials\" | \"pod\",\n\t\t\t\t\t\taccessKeyId: envVars.awsDynamodbAccessKeyId,\n\t\t\t\t\t\tsecretAccessKey: envVars.awsDynamodbSecretAccessKey,\n\t\t\t\t\t\tendpoint: envVars.awsDynamodbEndpoint,\n\t\t\t\t\t\tconnectionTimeoutMs: envMs(envVars, \"awsDynamodbConnectionTimeout\"),\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"entityStorageMutexTimeout\")\n\t\t\t\t\t},\n\t\t\t\t\ttablePrefix: envVars.entityStorageTablePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (entityStorageConnectorType === EntityStorageConnectorType.AzureCosmosDb) {\n\t\t\tcoreConfig.types.entityStorageConnector.push({\n\t\t\t\ttype: EntityStorageConnectorType.AzureCosmosDb,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tendpoint: envVars.azureCosmosdbEndpoint ?? \"\",\n\t\t\t\t\t\tkey: envVars.azureCosmosdbKey ?? \"\",\n\t\t\t\t\t\tdatabaseId: envVars.azureCosmosdbDatabaseId ?? \"\",\n\t\t\t\t\t\tcontainerId: envVars.azureCosmosdbContainerId ?? \"\",\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"entityStorageMutexTimeout\")\n\t\t\t\t\t},\n\t\t\t\t\ttablePrefix: envVars.entityStorageTablePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (entityStorageConnectorType === EntityStorageConnectorType.GcpFirestoreDb) {\n\t\t\tcoreConfig.types.entityStorageConnector.push({\n\t\t\t\ttype: EntityStorageConnectorType.GcpFirestoreDb,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tprojectId: envVars.gcpFirestoreProjectId ?? \"\",\n\t\t\t\t\t\tcredentials: envVars.gcpFirestoreCredentials ?? \"\",\n\t\t\t\t\t\tdatabaseId: envVars.gcpFirestoreDatabaseId ?? \"\",\n\t\t\t\t\t\tcollectionName: envVars.gcpFirestoreCollectionName ?? \"\",\n\t\t\t\t\t\tendpoint: envVars.gcpFirestoreEndpoint ?? \"\",\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"entityStorageMutexTimeout\")\n\t\t\t\t\t},\n\t\t\t\t\ttablePrefix: envVars.entityStorageTablePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (entityStorageConnectorType === EntityStorageConnectorType.ScyllaDb) {\n\t\t\tcoreConfig.types.entityStorageConnector.push({\n\t\t\t\ttype: EntityStorageConnectorType.ScyllaDb,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\thosts: commaSeparatedListToArray(envVars.scylladbHosts),\n\t\t\t\t\t\tlocalDataCenter: envVars.scylladbLocalDataCenter ?? \"\",\n\t\t\t\t\t\tkeyspace: envVars.scylladbKeyspace ?? \"\",\n\t\t\t\t\t\tport: envInteger(envVars, \"scylladbPort\"),\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"entityStorageMutexTimeout\"),\n\t\t\t\t\t\tpool: {\n\t\t\t\t\t\t\tcoreConnectionsPerHost: envCount(envVars, \"scylladbPoolCoreConnectionsPerHost\"),\n\t\t\t\t\t\t\tmaxRequestsPerConnection: envCount(envVars, \"scylladbPoolMaxRequestsPerConnection\")\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\ttablePrefix: envVars.entityStorageTablePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (entityStorageConnectorType === EntityStorageConnectorType.MySqlDb) {\n\t\t\tcoreConfig.types.entityStorageConnector.push({\n\t\t\t\ttype: EntityStorageConnectorType.MySqlDb,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\thost: envVars.mySqlHost ?? \"\",\n\t\t\t\t\t\tport: envInteger(envVars, \"mySqlPort\"),\n\t\t\t\t\t\tuser: envVars.mySqlUser ?? \"\",\n\t\t\t\t\t\tpassword: envVars.mySqlPassword ?? \"\",\n\t\t\t\t\t\tdatabase: envVars.mySqlDatabase ?? \"\",\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"entityStorageMutexTimeout\"),\n\t\t\t\t\t\tpool: {\n\t\t\t\t\t\t\tconnectionLimit: envCount(envVars, \"mySqlPoolConnectionLimit\"),\n\t\t\t\t\t\t\tmaxIdle: envCount(envVars, \"mySqlPoolMaxIdle\"),\n\t\t\t\t\t\t\tidleTimeout: envMs(envVars, \"mySqlPoolIdleTimeout\"),\n\t\t\t\t\t\t\tenableKeepAlive: envBoolean(envVars, \"mySqlPoolEnableKeepAlive\"),\n\t\t\t\t\t\t\twaitForConnections: envBoolean(envVars, \"mySqlPoolWaitForConnections\"),\n\t\t\t\t\t\t\tqueueLimit: envCount(envVars, \"mySqlPoolQueueLimit\")\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\ttablePrefix: envVars.entityStorageTablePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (entityStorageConnectorType === EntityStorageConnectorType.MongoDb) {\n\t\t\tcoreConfig.types.entityStorageConnector.push({\n\t\t\t\ttype: EntityStorageConnectorType.MongoDb,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\thost: envVars.mongoDbHost ?? \"\",\n\t\t\t\t\t\tport: envInteger(envVars, \"mongoDbPort\"),\n\t\t\t\t\t\tuser: envVars.mongoDbUser ?? \"\",\n\t\t\t\t\t\tpassword: envVars.mongoDbPassword ?? \"\",\n\t\t\t\t\t\tdatabase: envVars.mongoDbDatabase ?? \"\",\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"entityStorageMutexTimeout\"),\n\t\t\t\t\t\tpool: {\n\t\t\t\t\t\t\tmaxPoolSize: envCount(envVars, \"mongoDbPoolMaxPoolSize\"),\n\t\t\t\t\t\t\tminPoolSize: envCount(envVars, \"mongoDbPoolMinPoolSize\"),\n\t\t\t\t\t\t\tmaxIdleTimeMs: envMs(envVars, \"mongoDbPoolMaxIdleTime\"),\n\t\t\t\t\t\t\twaitQueueTimeoutMs: envMs(envVars, \"mongoDbPoolWaitQueueTimeout\")\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\ttablePrefix: envVars.entityStorageTablePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (entityStorageConnectorType === EntityStorageConnectorType.PostgreSql) {\n\t\t\tcoreConfig.types.entityStorageConnector.push({\n\t\t\t\ttype: EntityStorageConnectorType.PostgreSql,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\thost: envVars.postgreSqlHost ?? \"\",\n\t\t\t\t\t\tport: envInteger(envVars, \"postgreSqlPort\"),\n\t\t\t\t\t\tuser: envVars.postgreSqlUser ?? \"\",\n\t\t\t\t\t\tpassword: envVars.postgreSqlPassword ?? \"\",\n\t\t\t\t\t\tdatabase: envVars.postgreSqlDatabase ?? \"\",\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"entityStorageMutexTimeout\"),\n\t\t\t\t\t\tpool: {\n\t\t\t\t\t\t\tmax: envCount(envVars, \"postgreSqlPoolMax\"),\n\t\t\t\t\t\t\tidleTimeout: envSeconds(envVars, \"postgreSqlPoolIdleTimeout\"),\n\t\t\t\t\t\t\tconnectTimeout: envSeconds(envVars, \"postgreSqlPoolConnectTimeout\"),\n\t\t\t\t\t\t\tmaxLifetime: envSeconds(envVars, \"postgreSqlPoolMaxLifetime\")\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\ttablePrefix: envVars.entityStorageTablePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tconst defaultEntityStorageConnectorType =\n\t\tenvVars.entityStorageConnectorDefault ?? entityStorageConnectorTypes[0];\n\n\tif (Is.arrayValue(entityStorageConnectorTypes)) {\n\t\tfor (const config of coreConfig.types.entityStorageConnector) {\n\t\t\tif (config.type === defaultEntityStorageConnectorType) {\n\t\t\t\tconfig.isDefault = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Configures the blob storage.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the blob storage configuration has been applied.\n */\nasync function configureBlobStorage(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.blobStorageConnector ??= [];\n\n\tconst blobStorageConnectorTypes = envListToArray<\n\t\tIEngineEnvironmentVariables,\n\t\tBlobStorageConnectorType\n\t>(envVars, \"blobStorageConnectorType\", Object.values(BlobStorageConnectorType));\n\n\tfor (const blobStorageConnectorType of blobStorageConnectorTypes) {\n\t\tif (blobStorageConnectorType === BlobStorageConnectorType.Memory) {\n\t\t\tcoreConfig.types.blobStorageConnector.push({\n\t\t\t\ttype: BlobStorageConnectorType.Memory\n\t\t\t});\n\t\t} else if (blobStorageConnectorType === BlobStorageConnectorType.File) {\n\t\t\tcoreConfig.types.blobStorageConnector.push({\n\t\t\t\ttype: BlobStorageConnectorType.File,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tdirectory: Is.stringValue(envVars.storageFileRoot)\n\t\t\t\t\t\t\t? path.join(envVars.storageFileRoot, \"blob-storage\")\n\t\t\t\t\t\t\t: \"\"\n\t\t\t\t\t},\n\t\t\t\t\tstoragePrefix: envVars.blobStoragePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (blobStorageConnectorType === BlobStorageConnectorType.Ipfs) {\n\t\t\tcoreConfig.types.blobStorageConnector.push({\n\t\t\t\ttype: BlobStorageConnectorType.Ipfs,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tapiUrl: envVars.ipfsApiUrl ?? \"\",\n\t\t\t\t\t\tbearerToken: envVars.ipfsBearerToken\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (blobStorageConnectorType === BlobStorageConnectorType.AwsS3) {\n\t\t\tcoreConfig.types.blobStorageConnector.push({\n\t\t\t\ttype: BlobStorageConnectorType.AwsS3,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tregion: envVars.awsS3Region ?? \"\",\n\t\t\t\t\t\tbucketName: envVars.awsS3BucketName ?? \"\",\n\t\t\t\t\t\tauthMode: envVars.awsS3AuthMode as \"credentials\" | \"pod\",\n\t\t\t\t\t\taccessKeyId: envVars.awsS3AccessKeyId,\n\t\t\t\t\t\tsecretAccessKey: envVars.awsS3SecretAccessKey,\n\t\t\t\t\t\tendpoint: envVars.awsS3Endpoint\n\t\t\t\t\t},\n\t\t\t\t\tstoragePrefix: envVars.blobStoragePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (blobStorageConnectorType === BlobStorageConnectorType.AzureStorage) {\n\t\t\tcoreConfig.types.blobStorageConnector.push({\n\t\t\t\ttype: BlobStorageConnectorType.AzureStorage,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\taccountName: envVars.azureStorageAccountName ?? \"\",\n\t\t\t\t\t\taccountKey: envVars.azureStorageAccountKey ?? \"\",\n\t\t\t\t\t\tcontainerName: envVars.azureStorageContainerName ?? \"\",\n\t\t\t\t\t\tendpoint: envVars.azureStorageEndpoint ?? \"\"\n\t\t\t\t\t},\n\t\t\t\t\tstoragePrefix: envVars.blobStoragePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (blobStorageConnectorType === BlobStorageConnectorType.GcpStorage) {\n\t\t\tcoreConfig.types.blobStorageConnector.push({\n\t\t\t\ttype: BlobStorageConnectorType.GcpStorage,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tprojectId: envVars.gcpStorageProjectId ?? \"\",\n\t\t\t\t\t\tcredentials: envVars.gcpStorageCredentials ?? \"\",\n\t\t\t\t\t\tbucketName: envVars.gcpStorageBucketName ?? \"\",\n\t\t\t\t\t\tapiEndpoint: envVars.gcpFirestoreEndpoint\n\t\t\t\t\t},\n\t\t\t\t\tstoragePrefix: envVars.blobStoragePrefix\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tif (Is.arrayValue(blobStorageConnectorTypes)) {\n\t\tconst defaultStorageConnectorType =\n\t\t\tenvVars.blobStorageConnectorDefault ?? blobStorageConnectorTypes[0];\n\t\tfor (const config of coreConfig.types.blobStorageConnector) {\n\t\t\tif (config.type === defaultStorageConnectorType) {\n\t\t\t\tconfig.isDefault = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (coreConfig.types.blobStorageConnector.length > 0) {\n\t\tcoreConfig.types.blobStorageComponent ??= [];\n\t\tcoreConfig.types.blobStorageComponent.push({\n\t\t\ttype: BlobStorageComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tvaultKeyId:\n\t\t\t\t\t\t(envVars.blobStorageEnableEncryption ?? false)\n\t\t\t\t\t\t\t? envVars.blobStorageEncryptionKeyId\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the logging.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the logging configuration has been applied.\n */\nasync function configureLogging(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.loggingConnector ??= [];\n\n\tconst loggingConnectorTypes = envListToArray<IEngineEnvironmentVariables, LoggingConnectorType>(\n\t\tenvVars,\n\t\t\"loggingConnector\",\n\t\tObject.values(LoggingConnectorType)\n\t);\n\tlet additionalConnectorCount = 0;\n\n\tfor (const loggingConnector of loggingConnectorTypes) {\n\t\tif (loggingConnector === LoggingConnectorType.Console) {\n\t\t\tcoreConfig.types.loggingConnector.push({\n\t\t\t\ttype: LoggingConnectorType.Console,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\ttranslateMessages: true,\n\t\t\t\t\t\thideGroups: true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t} else if (loggingConnector === LoggingConnectorType.EntityStorage) {\n\t\t\tcoreConfig.types.loggingConnector.push({\n\t\t\t\ttype: LoggingConnectorType.EntityStorage,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tbatchSize: envCount(envVars, \"loggingBatchSize\"),\n\t\t\t\t\t\tbatchIntervalMs: envSecToMs(envVars, \"loggingBatchFlushInterval\"),\n\t\t\t\t\t\tretainForMs: envMinToMs(envVars, \"loggingRetainFor\"),\n\t\t\t\t\t\tmaxEntries: envCount(envVars, \"loggingMaxEntries\"),\n\t\t\t\t\t\tretentionIntervalMs: envMinToMs(envVars, \"loggingRetentionInterval\"),\n\t\t\t\t\t\tretentionBatchSize: envCount(envVars, \"loggingRetentionBatchSize\"),\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"loggingMutexTimeout\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t} else if (loggingConnector === LoggingConnectorType.OpenTelemetry) {\n\t\t\tconst otelLoggingConfig: IOpenTelemetryLoggingConnectorConfig = {\n\t\t\t\tloggerName: envVars.openTelemetryLoggingLoggerName,\n\t\t\t\tloggerVersion: envVars.openTelemetryLoggingLoggerVersion\n\t\t\t};\n\t\t\tif (Is.stringValue(envVars.openTelemetryLoggingPrometheusEndpoint)) {\n\t\t\t\totelLoggingConfig.exporters = {\n\t\t\t\t\totlp: {\n\t\t\t\t\t\ttype: OpenTelemetryExporterTypes.Otlp,\n\t\t\t\t\t\tendpoint: envVars.openTelemetryLoggingPrometheusEndpoint,\n\t\t\t\t\t\tprocessor:\n\t\t\t\t\t\t\t(envVars.openTelemetryLoggingProcessor as IOpenTelemetryOtlpExporterConfig[\"processor\"]) ??\n\t\t\t\t\t\t\t\"batch\"\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\t\t\tcoreConfig.types.loggingConnector.push({\n\t\t\t\ttype: LoggingConnectorType.OpenTelemetry,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: otelLoggingConfig\n\t\t\t\t}\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t} else if (loggingConnector === LoggingConnectorType.File) {\n\t\t\tcoreConfig.types.loggingConnector.push({\n\t\t\t\ttype: LoggingConnectorType.File,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tdirectory: envVars.loggingFileDirectory ?? envVars.storageFileRoot ?? \"\",\n\t\t\t\t\t\tfilename: envVars.loggingFileFilename,\n\t\t\t\t\t\tmaxFileSizeBytes: envCount(envVars, \"loggingFileMaxFileSizeBytes\"),\n\t\t\t\t\t\tmaxRetainedFiles: envCount(envVars, \"loggingFileMaxRetainedFiles\"),\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"loggingMutexTimeout\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t}\n\t}\n\n\t// If more than one logging connector, then we need to add a multi connector\n\t// and set it as the default one\n\tif (additionalConnectorCount > 1) {\n\t\tcoreConfig.types.loggingConnector.push({\n\t\t\ttype: LoggingConnectorType.Multi,\n\t\t\toptions: {\n\t\t\t\tloggingConnectorTypes\n\t\t\t},\n\t\t\tisDefault: true\n\t\t});\n\t} else if (additionalConnectorCount > 0) {\n\t\t// If only one connector, then we set it as the default one\n\t\tcoreConfig.types.loggingConnector[coreConfig.types.loggingConnector.length - 1].isDefault =\n\t\t\ttrue;\n\t}\n\n\tif (additionalConnectorCount > 0) {\n\t\tcoreConfig.types.loggingComponent ??= [];\n\t\t// We set the isDefault flag so that other components will get this service by default\n\t\t// and not the generic one from the engine core\n\t\tcoreConfig.types.loggingComponent.push({ type: LoggingComponentType.Service, isDefault: true });\n\t}\n}\n\n/**\n * Configures the vault.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the vault configuration has been applied.\n */\nasync function configureVault(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.vaultConnector ??= [];\n\n\tconst vaultConnectorType = envChoice<IEngineEnvironmentVariables, VaultConnectorType>(\n\t\tenvVars,\n\t\t\"vaultConnector\",\n\t\tObject.values(VaultConnectorType)\n\t);\n\n\tif (vaultConnectorType === VaultConnectorType.EntityStorage) {\n\t\tcoreConfig.types.vaultConnector.push({\n\t\t\ttype: VaultConnectorType.EntityStorage,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tprefix: envVars.vaultPrefix\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} else if (vaultConnectorType === VaultConnectorType.Hashicorp) {\n\t\tcoreConfig.types.vaultConnector.push({\n\t\t\ttype: VaultConnectorType.Hashicorp,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tendpoint: envVars.hashicorpVaultEndpoint ?? \"\",\n\t\t\t\t\ttoken: envVars.hashicorpVaultToken ?? \"\",\n\t\t\t\t\tprefix: envVars.vaultPrefix\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the background task.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the background task configuration has been applied.\n */\nasync function configureBackgroundTask(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.backgroundTaskComponent ??= [];\n\n\tif (isBackgroundTasksRequired(envVars)) {\n\t\tcoreConfig.types.backgroundTaskComponent.push({\n\t\t\ttype: BackgroundTaskComponentType.Service\n\t\t});\n\t}\n}\n\n/**\n * Configures the event bus.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the event bus configuration has been applied.\n */\nasync function configureEventBus(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.eventBusConnector ??= [];\n\n\tconst eventBusConnectorType = envChoice<IEngineEnvironmentVariables, EventBusConnectorType>(\n\t\tenvVars,\n\t\t\"eventBusConnector\",\n\t\tObject.values(EventBusConnectorType)\n\t);\n\n\tif (eventBusConnectorType === EventBusConnectorType.Local) {\n\t\tcoreConfig.types.eventBusConnector.push({\n\t\t\ttype: EventBusConnectorType.Local\n\t\t});\n\t}\n\n\tif (coreConfig.types.eventBusConnector.length > 0) {\n\t\tcoreConfig.types.eventBusComponent ??= [];\n\t\tcoreConfig.types.eventBusComponent.push({ type: EventBusComponentType.Service });\n\t}\n}\n\n/**\n * Configures the telemetry.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the telemetry configuration has been applied.\n */\nasync function configureTelemetry(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.telemetryConnector ??= [];\n\n\tconst telemetryConnectorTypes = envListToArray<\n\t\tIEngineEnvironmentVariables,\n\t\tTelemetryConnectorType\n\t>(envVars, \"telemetryConnector\", Object.values(TelemetryConnectorType));\n\tlet additionalConnectorCount = 0;\n\n\tfor (const telemetryConnectorType of telemetryConnectorTypes) {\n\t\tif (telemetryConnectorType === TelemetryConnectorType.Silent) {\n\t\t\tcoreConfig.types.telemetryConnector.push({\n\t\t\t\ttype: TelemetryConnectorType.Silent\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t} else if (telemetryConnectorType === TelemetryConnectorType.EntityStorage) {\n\t\t\tcoreConfig.types.telemetryConnector.push({\n\t\t\t\ttype: TelemetryConnectorType.EntityStorage,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tbatchSize: envCount(envVars, \"telemetryBatchSize\"),\n\t\t\t\t\t\tbatchIntervalMs: envSecToMs(envVars, \"telemetryBatchFlushInterval\"),\n\t\t\t\t\t\tmaxCacheSize: envCount(envVars, \"telemetryMaxCacheSize\"),\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"telemetryMutexTimeout\"),\n\t\t\t\t\t\tmetricDefinitionCacheCapacity: envCount(\n\t\t\t\t\t\t\tenvVars,\n\t\t\t\t\t\t\t\"telemetryMetricDefinitionCacheCapacity\"\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmetricDefinitionCacheTtiMs: envMs(envVars, \"telemetryMetricDefinitionCacheTtiMs\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t} else if (telemetryConnectorType === TelemetryConnectorType.OpenTelemetry) {\n\t\t\tlet readers: IOpenTelemetryTelemetryConnectorConfig[\"readers\"];\n\t\t\tif (envVars.openTelemetryReader === OpenTelemetryReaderTypes.Prometheus) {\n\t\t\t\treaders = {\n\t\t\t\t\tprometheus: {\n\t\t\t\t\t\ttype: OpenTelemetryReaderTypes.Prometheus,\n\t\t\t\t\t\tport: envCount(envVars, \"openTelemetryPrometheusPort\")\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\t\t\tcoreConfig.types.telemetryConnector.push({\n\t\t\t\ttype: TelemetryConnectorType.OpenTelemetry,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tmeterName: envVars.openTelemetryMeterName,\n\t\t\t\t\t\tmeterVersion: envVars.openTelemetryMeterVersion,\n\t\t\t\t\t\treaders\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t}\n\t}\n\n\t// If more than one telemetry connector, then we need to add a multi connector\n\t// and set it as the default one\n\tif (additionalConnectorCount > 1) {\n\t\tcoreConfig.types.telemetryConnector.push({\n\t\t\ttype: TelemetryConnectorType.Multi,\n\t\t\toptions: {\n\t\t\t\ttelemetryConnectorTypes\n\t\t\t},\n\t\t\tisDefault: true\n\t\t});\n\t} else if (additionalConnectorCount > 0) {\n\t\t// If only one connector, then we set it as the default one\n\t\tcoreConfig.types.telemetryConnector[coreConfig.types.telemetryConnector.length - 1].isDefault =\n\t\t\ttrue;\n\t}\n\n\tif (additionalConnectorCount > 0) {\n\t\tcoreConfig.types.telemetryComponent ??= [];\n\t\tcoreConfig.types.telemetryComponent.push({ type: TelemetryComponentType.Service });\n\t}\n}\n\n/**\n * Configures the metrics producers and orchestrator service.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the metrics collector configuration has been applied.\n */\nasync function configureMetricsCollector(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (isTelemetryEnabled(envVars)) {\n\t\tcoreConfig.types.metricsCollectorComponent ??= [];\n\t\tcoreConfig.types.metricsCollectorComponent.push({\n\t\t\ttype: MetricsCollectorComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tintervalMs: envSecToMs(envVars, \"telemetryMetricsCollectorInterval\")\n\t\t\t\t}\n\t\t\t},\n\t\t\tcloneMode: EngineCloneMode.Never\n\t\t});\n\n\t\tcoreConfig.types.metricsProducerComponent ??= [];\n\n\t\tconst metricsProducers = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tMetricsProducerComponentType\n\t\t>(envVars, \"telemetryMetricsProducers\", Object.values(MetricsProducerComponentType), [\n\t\t\tMetricsProducerComponentType.System,\n\t\t\tMetricsProducerComponentType.Process\n\t\t]);\n\n\t\tfor (const producerType of metricsProducers) {\n\t\t\tcoreConfig.types.metricsProducerComponent.push({\n\t\t\t\ttype: producerType,\n\t\t\t\toptions: { maxHistory: envCount(envVars, \"telemetryMetricsProducerMaxHistory\") },\n\t\t\t\tcloneMode: EngineCloneMode.Never\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * Configures the tracing.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the tracing configuration has been applied.\n */\nasync function configureTracing(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.tracingConnector ??= [];\n\n\tconst tracingConnectorTypes = envListToArray<IEngineEnvironmentVariables, TracingConnectorType>(\n\t\tenvVars,\n\t\t\"tracingConnector\",\n\t\tObject.values(TracingConnectorType)\n\t);\n\tlet additionalConnectorCount = 0;\n\n\tfor (const tracingConnectorType of tracingConnectorTypes) {\n\t\tif (tracingConnectorType === TracingConnectorType.Silent) {\n\t\t\tcoreConfig.types.tracingConnector.push({\n\t\t\t\ttype: TracingConnectorType.Silent\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t} else if (tracingConnectorType === TracingConnectorType.EntityStorage) {\n\t\t\tcoreConfig.types.tracingConnector.push({\n\t\t\t\ttype: TracingConnectorType.EntityStorage,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"tracingMutexTimeout\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t} else if (tracingConnectorType === TracingConnectorType.Console) {\n\t\t\tcoreConfig.types.tracingConnector.push({\n\t\t\t\ttype: TracingConnectorType.Console\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t} else if (tracingConnectorType === TracingConnectorType.OpenTelemetry) {\n\t\t\tconst otelTracingConfig: IOpenTelemetryTracingConnectorConfig = {\n\t\t\t\ttracerName: envVars.openTelemetryTracingTracerName,\n\t\t\t\ttracerVersion: envVars.openTelemetryTracingTracerVersion\n\t\t\t};\n\t\t\tif (Is.stringValue(envVars.openTelemetryTracingEndpoint)) {\n\t\t\t\totelTracingConfig.exporters = {\n\t\t\t\t\totlp: {\n\t\t\t\t\t\tendpoint: envVars.openTelemetryTracingEndpoint,\n\t\t\t\t\t\tprocessor:\n\t\t\t\t\t\t\t(envVars.openTelemetryTracingProcessor as OpenTelemetryProcessorTypes) ??\n\t\t\t\t\t\t\tOpenTelemetryProcessorTypes.Batch\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\t\t\tcoreConfig.types.tracingConnector.push({\n\t\t\t\ttype: TracingConnectorType.OpenTelemetry,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: otelTracingConfig\n\t\t\t\t}\n\t\t\t});\n\t\t\tadditionalConnectorCount++;\n\t\t}\n\t}\n\n\t// If more than one tracing connector, then we need to add a multi connector\n\t// and set it as the default one\n\tif (additionalConnectorCount > 1) {\n\t\tcoreConfig.types.tracingConnector.push({\n\t\t\ttype: TracingConnectorType.Multi,\n\t\t\toptions: {\n\t\t\t\ttracingConnectorTypes\n\t\t\t},\n\t\t\tisDefault: true\n\t\t});\n\t} else if (additionalConnectorCount > 0) {\n\t\t// If only one connector, then we set it as the default one\n\t\tcoreConfig.types.tracingConnector[coreConfig.types.tracingConnector.length - 1].isDefault =\n\t\t\ttrue;\n\t}\n\n\tif (additionalConnectorCount > 0) {\n\t\tcoreConfig.types.tracingComponent ??= [];\n\t\tcoreConfig.types.tracingComponent.push({ type: TracingComponentType.Service });\n\t}\n}\n\n/**\n * Configures the automation.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the automation configuration has been applied.\n */\nasync function configureAutomation(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.automationComponent ??= [];\n\n\tif (isAutomationRequired(envVars)) {\n\t\tcoreConfig.types.automationComponent.push({\n\t\t\ttype: AutomationComponentType.Service\n\t\t});\n\n\t\tconst automationActionTypes = envListToArray<IEngineEnvironmentVariables, AutomationActionType>(\n\t\t\tenvVars,\n\t\t\t\"automationActionTypes\",\n\t\t\tObject.values(AutomationActionType)\n\t\t);\n\n\t\tcoreConfig.types.automationAction ??= [];\n\n\t\tfor (const actionType of automationActionTypes) {\n\t\t\tcoreConfig.types.automationAction.push({\n\t\t\t\ttype: actionType,\n\t\t\t\tisMultiInstance: true\n\t\t\t} as unknown as AutomationActionConfig);\n\t\t}\n\t}\n}\n\n/**\n * Configures the health.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the health configuration has been applied.\n */\nasync function configureHealth(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.healthComponent ??= [];\n\n\tif (envBoolean(envVars, \"healthEnabled\", false)) {\n\t\tcoreConfig.types.healthComponent.push({\n\t\t\ttype: HealthComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\thealthCheckInterval: envSecToMs(envVars, \"healthInterval\"),\n\t\t\t\t\thealthCheckApplicationInterval: envSecToMs(envVars, \"healthApplicationInterval\"),\n\t\t\t\t\tinitialInterval: envSecToMs(envVars, \"healthStartupInterval\")\n\t\t\t\t}\n\t\t\t},\n\t\t\tcloneMode: EngineCloneMode.Never\n\t\t});\n\t}\n}\n\n/**\n * Configures the schema migration.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the schema migration configuration has been applied.\n */\nasync function configureSchemaMigration(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tconst isSchemaMigrationEnabled = envBoolean(envVars, \"schemaMigrationEnabled\", true);\n\n\tcoreConfig.types.schemaVersionMigrationComponent ??= [];\n\tcoreConfig.types.schemaVersionMigrationComponent.push({\n\t\ttype: SchemaVersionMigrationComponentType.Service,\n\t\toptions: { config: { enabled: isSchemaMigrationEnabled } },\n\t\tcloneMode: EngineCloneMode.Never\n\t});\n}\n\n/**\n * Configures the platform.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the platform configuration has been applied.\n */\nasync function configurePlatform(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tconst isTenantEnabled = envBoolean(envVars, \"tenantEnabled\", false);\n\n\tcoreConfig.types.platformComponent ??= [];\n\tcoreConfig.types.platformComponent.push({\n\t\ttype: PlatformComponentType.Service,\n\t\toptions: {\n\t\t\tconfig: {\n\t\t\t\tisMultiTenant: isTenantEnabled\n\t\t\t}\n\t\t},\n\t\tcloneMode: EngineCloneMode.Always\n\t});\n}\n\n/**\n * Configures the tenant.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the tenant configuration has been applied.\n */\nasync function configureTenant(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tconst isTenantEnabled = envBoolean(envVars, \"tenantEnabled\", false);\n\n\tif (isTenantEnabled) {\n\t\tcoreConfig.types.tenantAdminComponent ??= [];\n\t\tcoreConfig.types.tenantAdminComponent.push({\n\t\t\ttype: TenantAdminComponentType.Service\n\t\t});\n\t}\n}\n\n/**\n * Configures the context ID handlers.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the context ID handler configuration has been applied.\n */\nasync function configureContextIdHandlers(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.contextIdHandlerComponent ??= [];\n\tcoreConfig.types.contextIdHandlerComponent.push({\n\t\ttype: ContextIdHandlerComponentType.Did,\n\t\tfeatures: [CONTEXT_ID_HANDLER_FEATURE_DID],\n\t\tcloneMode: EngineCloneMode.Always\n\t});\n\tif (envBoolean(envVars, \"tenantEnabled\", false)) {\n\t\tcoreConfig.types.contextIdHandlerComponent.push({\n\t\t\ttype: ContextIdHandlerComponentType.Tenant,\n\t\t\tfeatures: [CONTEXT_ID_HANDLER_FEATURE_TENANT],\n\t\t\tcloneMode: EngineCloneMode.Always\n\t\t});\n\t}\n}\n\n/**\n * Configures the messaging.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the messaging configuration has been applied.\n */\nasync function configureMessaging(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.messagingEmailConnector ??= [];\n\tcoreConfig.types.messagingSmsConnector ??= [];\n\tcoreConfig.types.messagingPushNotificationConnector ??= [];\n\n\tconst messagingEmailConnectorType = envChoice<\n\t\tIEngineEnvironmentVariables,\n\t\tMessagingEmailConnectorType\n\t>(envVars, \"messagingEmailConnector\", Object.values(MessagingEmailConnectorType));\n\n\tif (messagingEmailConnectorType === MessagingEmailConnectorType.EntityStorage) {\n\t\tcoreConfig.types.messagingEmailConnector.push({\n\t\t\ttype: MessagingEmailConnectorType.EntityStorage\n\t\t});\n\t} else if (messagingEmailConnectorType === MessagingEmailConnectorType.Aws) {\n\t\tcoreConfig.types.messagingEmailConnector.push({\n\t\t\ttype: MessagingEmailConnectorType.Aws,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tregion: envVars.awsSesRegion ?? \"\",\n\t\t\t\t\tauthMode: envVars.awsSesAuthMode as \"credentials\" | \"pod\",\n\t\t\t\t\taccessKeyId: envVars.awsSesAccessKeyId,\n\t\t\t\t\tsecretAccessKey: envVars.awsSesSecretAccessKey,\n\t\t\t\t\tendpoint: envVars.awsSesEndpoint\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} else if (messagingEmailConnectorType === MessagingEmailConnectorType.Smtp) {\n\t\tcoreConfig.types.messagingEmailConnector.push({\n\t\t\ttype: MessagingEmailConnectorType.Smtp,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\thost: envVars.smtpHost ?? \"\",\n\t\t\t\t\tport: envInteger(envVars, \"smtpPort\"),\n\t\t\t\t\tsecure: envBoolean(envVars, \"smtpSecure\"),\n\t\t\t\t\tusername: envVars.smtpUsername,\n\t\t\t\t\tpassword: envVars.smtpPassword\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tconst messagingSmsConnectorType = envChoice<\n\t\tIEngineEnvironmentVariables,\n\t\tMessagingSmsConnectorType\n\t>(envVars, \"messagingSmsConnector\", Object.values(MessagingSmsConnectorType));\n\n\tif (messagingSmsConnectorType === MessagingSmsConnectorType.EntityStorage) {\n\t\tcoreConfig.types.messagingSmsConnector.push({\n\t\t\ttype: MessagingSmsConnectorType.EntityStorage\n\t\t});\n\t} else if (messagingSmsConnectorType === MessagingSmsConnectorType.Aws) {\n\t\tcoreConfig.types.messagingSmsConnector.push({\n\t\t\ttype: MessagingSmsConnectorType.Aws,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tregion: envVars.awsSesRegion ?? \"\",\n\t\t\t\t\tauthMode: envVars.awsSesAuthMode as \"credentials\" | \"pod\",\n\t\t\t\t\taccessKeyId: envVars.awsSesAccessKeyId,\n\t\t\t\t\tsecretAccessKey: envVars.awsSesSecretAccessKey,\n\t\t\t\t\tendpoint: envVars.awsSesEndpoint\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tconst messagingPushConnectorType = envChoice<\n\t\tIEngineEnvironmentVariables,\n\t\tMessagingPushNotificationConnectorType\n\t>(\n\t\tenvVars,\n\t\t\"messagingPushNotificationConnector\",\n\t\tObject.values(MessagingPushNotificationConnectorType)\n\t);\n\n\tif (messagingPushConnectorType === MessagingPushNotificationConnectorType.EntityStorage) {\n\t\tcoreConfig.types.messagingPushNotificationConnector.push({\n\t\t\ttype: MessagingPushNotificationConnectorType.EntityStorage\n\t\t});\n\t} else if (messagingPushConnectorType === MessagingPushNotificationConnectorType.Aws) {\n\t\tcoreConfig.types.messagingPushNotificationConnector.push({\n\t\t\ttype: MessagingPushNotificationConnectorType.Aws,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tregion: envVars.awsSesRegion ?? \"\",\n\t\t\t\t\tauthMode: envVars.awsSesAuthMode as \"credentials\" | \"pod\",\n\t\t\t\t\taccessKeyId: envVars.awsSesAccessKeyId,\n\t\t\t\t\tsecretAccessKey: envVars.awsSesSecretAccessKey,\n\t\t\t\t\tendpoint: envVars.awsSesEndpoint,\n\t\t\t\t\tapplicationsSettings: envArray(envVars, \"awsMessagingPushNotificationApplications\", [])\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\t// If any messaging connectors are configured, then we should configure the messaging admin and\n\t// service components as well since they are required for the messaging connectors to work.\n\tif (\n\t\tcoreConfig.types.messagingEmailConnector.length > 0 ||\n\t\tcoreConfig.types.messagingSmsConnector.length > 0 ||\n\t\tcoreConfig.types.messagingPushNotificationConnector.length > 0\n\t) {\n\t\tcoreConfig.types.messagingAdminComponent ??= [];\n\t\tcoreConfig.types.messagingAdminComponent.push({\n\t\t\ttype: MessagingAdminComponentType.Service\n\t\t});\n\n\t\tcoreConfig.types.messagingComponent ??= [];\n\t\tcoreConfig.types.messagingComponent.push({ type: MessagingComponentType.Service });\n\t}\n}\n\n/**\n * Configures mailbox components, mail storage components, and email protocol connectors.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the mailbox configuration has been applied.\n */\nasync function configureMailbox(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.emailProtocolConnector ??= [];\n\n\tconst emailProtocolConnectorTypes = envListToArray<\n\t\tIEngineEnvironmentVariables,\n\t\tEmailProtocolConnectorType\n\t>(envVars, \"emailProtocolConnector\", Object.values(EmailProtocolConnectorType));\n\tfor (const emailProtocolConnectorType of emailProtocolConnectorTypes) {\n\t\tcoreConfig.types.emailProtocolConnector.push({\n\t\t\ttype: emailProtocolConnectorType,\n\t\t\toptions: {\n\t\t\t\tconfig: {} as never\n\t\t\t},\n\t\t\tcloneMode: EngineCloneMode.Never,\n\t\t\tisMultiInstance: true\n\t\t});\n\t}\n\n\t// If email protocol connectors are configured, then we should configure the mailbox and mail store\n\t// components as well, since they are required for the email protocol connectors to work.\n\tif (coreConfig.types.emailProtocolConnector.length > 0) {\n\t\tcoreConfig.types.mailStorageComponent ??= [];\n\t\tcoreConfig.types.mailStorageComponent.push({\n\t\t\ttype: MailStorageComponentType.Service,\n\t\t\tcloneMode: EngineCloneMode.Never\n\t\t});\n\n\t\tcoreConfig.types.mailboxComponent ??= [];\n\t\tcoreConfig.types.mailboxComponent.push({\n\t\t\ttype: MailboxComponentType.Service,\n\t\t\tcloneMode: EngineCloneMode.Never\n\t\t});\n\t}\n}\n\n/**\n * Configures the faucet.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the faucet configuration has been applied.\n */\nasync function configureFaucet(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.faucetConnector ??= [];\n\n\tconst faucetConnectorType = envChoice<IEngineEnvironmentVariables, FaucetConnectorType>(\n\t\tenvVars,\n\t\t\"faucetConnector\",\n\t\tObject.values(FaucetConnectorType)\n\t);\n\n\tif (faucetConnectorType === FaucetConnectorType.EntityStorage) {\n\t\tcoreConfig.types.faucetConnector.push({\n\t\t\ttype: FaucetConnectorType.EntityStorage\n\t\t});\n\t} else if (\n\t\tfaucetConnectorType === FaucetConnectorType.Iota &&\n\t\tIs.stringValue(envVars.iotaFaucetEndpoint)\n\t) {\n\t\tconst dltConfig = EngineTypeHelper.getConfigOfType<DltConfig>(\n\t\t\tcoreConfig,\n\t\t\t\"dltConfig\",\n\t\t\tDltConfigType.Iota\n\t\t);\n\t\tcoreConfig.types.faucetConnector.push({\n\t\t\ttype: FaucetConnectorType.Iota,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tendpoint: envVars.iotaFaucetEndpoint,\n\t\t\t\t\tclientOptions: dltConfig?.options?.config?.clientOptions ?? { url: \"\" },\n\t\t\t\t\tnetwork: dltConfig?.options?.config?.network ?? \"\"\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the wallet.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the wallet configuration has been applied.\n */\nasync function configureWallet(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.walletConnector ??= [];\n\n\tconst walletConnectorType = envChoice<IEngineEnvironmentVariables, WalletConnectorType>(\n\t\tenvVars,\n\t\t\"walletConnector\",\n\t\tObject.values(WalletConnectorType)\n\t);\n\n\tif (walletConnectorType === WalletConnectorType.EntityStorage) {\n\t\tcoreConfig.types.walletConnector.push({\n\t\t\ttype: WalletConnectorType.EntityStorage\n\t\t});\n\t} else if (walletConnectorType === WalletConnectorType.Iota) {\n\t\tconst dltConfig = EngineTypeHelper.getConfigOfType<DltConfig>(\n\t\t\tcoreConfig,\n\t\t\t\"dltConfig\",\n\t\t\tDltConfigType.Iota\n\t\t);\n\t\tcoreConfig.types.walletConnector.push({\n\t\t\ttype: WalletConnectorType.Iota,\n\t\t\toptions: {\n\t\t\t\tconfig: dltConfig?.options?.config ?? ({} as IIotaConfig)\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the NFT.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the NFT configuration has been applied.\n */\nasync function configureNft(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.nftConnector ??= [];\n\n\tconst nftConnectorType = envChoice<IEngineEnvironmentVariables, NftConnectorType>(\n\t\tenvVars,\n\t\t\"nftConnector\",\n\t\tObject.values(NftConnectorType)\n\t);\n\n\tif (nftConnectorType === NftConnectorType.EntityStorage) {\n\t\tcoreConfig.types.nftConnector.push({\n\t\t\ttype: NftConnectorType.EntityStorage\n\t\t});\n\t} else if (nftConnectorType === NftConnectorType.Iota) {\n\t\tconst dltConfig = EngineTypeHelper.getConfigOfType<DltConfig>(\n\t\t\tcoreConfig,\n\t\t\t\"dltConfig\",\n\t\t\tDltConfigType.Iota\n\t\t);\n\t\tconst config = {\n\t\t\t...(dltConfig?.options?.config as IIotaConfig),\n\t\t\tdeploymentPkgId: Is.stringValue(envVars.nftPackageId) ? envVars.nftPackageId : undefined\n\t\t};\n\t\tcoreConfig.types.nftConnector.push({\n\t\t\ttype: NftConnectorType.Iota,\n\t\t\toptions: {\n\t\t\t\tconfig\n\t\t\t}\n\t\t});\n\t}\n\n\tif (coreConfig.types.nftConnector.length > 0) {\n\t\tcoreConfig.types.nftComponent ??= [];\n\t\tcoreConfig.types.nftComponent.push({ type: NftComponentType.Service });\n\t}\n}\n\n/**\n * Configures the notarization.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the notarization configuration has been applied.\n */\nasync function configureNotarization(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.notarizationConnector ??= [];\n\n\tconst notarizationConnectorType = envChoice<\n\t\tIEngineEnvironmentVariables,\n\t\tNotarizationConnectorType\n\t>(envVars, \"notarizationConnector\", Object.values(NotarizationConnectorType));\n\n\tif (notarizationConnectorType === NotarizationConnectorType.EntityStorage) {\n\t\tcoreConfig.types.notarizationConnector.push({\n\t\t\ttype: NotarizationConnectorType.EntityStorage\n\t\t});\n\t} else if (notarizationConnectorType === NotarizationConnectorType.Iota) {\n\t\tconst dltConfig = EngineTypeHelper.getConfigOfType<DltConfig>(\n\t\t\tcoreConfig,\n\t\t\t\"dltConfig\",\n\t\t\tDltConfigType.Iota\n\t\t);\n\t\tcoreConfig.types.notarizationConnector.push({\n\t\t\ttype: NotarizationConnectorType.Iota,\n\t\t\toptions: {\n\t\t\t\tconfig: dltConfig?.options?.config ?? ({} as IIotaConfig)\n\t\t\t}\n\t\t});\n\t}\n\n\tif (coreConfig.types.notarizationConnector.length > 0) {\n\t\tcoreConfig.types.notarizationComponent ??= [];\n\t\tcoreConfig.types.notarizationComponent.push({ type: NotarizationComponentType.Service });\n\t}\n}\n\n/**\n * Configures the immutable proof.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the immutable proof configuration has been applied.\n */\nasync function configureImmutableProof(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (isImmutableProofRequired(envVars)) {\n\t\tcoreConfig.types.immutableProofComponent ??= [];\n\t\tcoreConfig.types.immutableProofComponent.push({\n\t\t\ttype: ImmutableProofComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tverificationMethodId: envVars.immutableProofVerificationMethodId,\n\t\t\t\t\ttaskRetryCount: envCount(envVars, \"immutableProofTaskRetryCount\"),\n\t\t\t\t\ttaskRetryInterval: envSecToMs(envVars, \"immutableProofTaskRetryInterval\"),\n\t\t\t\t\ttaskFailureRetainFor: envMinToMs(envVars, \"immutableProofTaskFailureRetainFor\"),\n\t\t\t\t\tsweepIntervalMinutes: envMinutes(envVars, \"immutableProofSweepInterval\"),\n\t\t\t\t\tsweepStaleThresholdMs: envMinToMs(envVars, \"immutableProofSweepStaleThreshold\"),\n\t\t\t\t\tsweepMaxAttempts: envCount(envVars, \"immutableProofSweepMaxAttempts\"),\n\t\t\t\t\tsweepBatchLimit: envCount(envVars, \"immutableProofSweepBatchLimit\"),\n\t\t\t\t\tsweepBackoffMs: envMinToMs(envVars, \"immutableProofSweepBackoff\"),\n\t\t\t\t\tsweepAssumeRetryableBefore: envDateTime(\n\t\t\t\t\t\tenvVars,\n\t\t\t\t\t\t\"immutableProofSweepAssumeRetryableBefore\"\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the identity.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the identity configuration has been applied.\n */\nasync function configureIdentity(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.identityConnector ??= [];\n\n\tconst identityConnectorType = envChoice<IEngineEnvironmentVariables, IdentityConnectorType>(\n\t\tenvVars,\n\t\t\"identityConnector\",\n\t\tObject.values(IdentityConnectorType)\n\t);\n\n\tif (identityConnectorType === IdentityConnectorType.EntityStorage) {\n\t\tcoreConfig.types.identityConnector.push({\n\t\t\ttype: IdentityConnectorType.EntityStorage\n\t\t});\n\t} else if (identityConnectorType === IdentityConnectorType.Iota) {\n\t\tconst dltConfig = EngineTypeHelper.getConfigOfType<DltConfig>(\n\t\t\tcoreConfig,\n\t\t\t\"dltConfig\",\n\t\t\tDltConfigType.Iota\n\t\t);\n\t\tcoreConfig.types.identityConnector.push({\n\t\t\ttype: IdentityConnectorType.Iota,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\t...(dltConfig?.options?.config ?? ({} as IIotaConfig)),\n\t\t\t\t\tidentityPkgId: Is.stringValue(envVars.iotaIdentityPackageId)\n\t\t\t\t\t\t? envVars.iotaIdentityPackageId\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\twalletAddressIndex: envCount(envVars, \"identityWalletAddressIndex\") ?? 0,\n\t\t\t\t\tdidResolutionCacheTtlMs: envMs(envVars, \"identityDidResolutionCacheTtl\"),\n\t\t\t\t\tdidResolutionCacheCapacity: envCount(envVars, \"identityDidResolutionCacheCapacity\"),\n\t\t\t\t\tdidResolutionCacheMutexTimeoutMs: envMs(\n\t\t\t\t\t\tenvVars,\n\t\t\t\t\t\t\"identityDidResolutionCacheMutexTimeout\"\n\t\t\t\t\t),\n\t\t\t\t\tdidResolutionRetries: envCount(envVars, \"identityDidResolutionRetries\"),\n\t\t\t\t\tdidResolutionRetryDelayMs: envMs(envVars, \"identityDidResolutionRetryDelay\")\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tif (coreConfig.types.identityConnector.length > 0) {\n\t\tcoreConfig.types.identityComponent ??= [];\n\t\tcoreConfig.types.identityComponent.push({ type: IdentityComponentType.Service });\n\t}\n}\n\n/**\n * Configures the identity resolver.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the identity resolver configuration has been applied.\n */\nasync function configureIdentityResolver(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.identityResolverConnector ??= [];\n\n\tconst identityResolverConnectorType = envChoice<\n\t\tIEngineEnvironmentVariables,\n\t\tIdentityResolverConnectorType\n\t>(envVars, \"identityResolverConnector\", Object.values(IdentityResolverConnectorType));\n\n\tif (identityResolverConnectorType === IdentityResolverConnectorType.EntityStorage) {\n\t\tcoreConfig.types.identityResolverConnector.push({\n\t\t\ttype: IdentityResolverConnectorType.EntityStorage\n\t\t});\n\t} else if (identityResolverConnectorType === IdentityResolverConnectorType.Iota) {\n\t\tconst dltConfig = EngineTypeHelper.getConfigOfType<DltConfig>(\n\t\t\tcoreConfig,\n\t\t\t\"dltConfig\",\n\t\t\tDltConfigType.Iota\n\t\t);\n\t\tcoreConfig.types.identityResolverConnector.push({\n\t\t\ttype: IdentityResolverConnectorType.Iota,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\t...(dltConfig?.options?.config as IIotaConfig),\n\t\t\t\t\tidentityPkgId: Is.stringValue(envVars.iotaIdentityPackageId)\n\t\t\t\t\t\t? envVars.iotaIdentityPackageId\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t} else if (identityResolverConnectorType === IdentityResolverConnectorType.Universal) {\n\t\tcoreConfig.types.identityResolverConnector.push({\n\t\t\ttype: IdentityResolverConnectorType.Universal,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tendpoint: envVars.universalResolverEndpoint ?? \"\"\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tif (coreConfig.types.identityResolverConnector.length > 0) {\n\t\tcoreConfig.types.identityResolverComponent ??= [];\n\t\tcoreConfig.types.identityResolverComponent.push({\n\t\t\ttype: IdentityResolverComponentType.Service\n\t\t});\n\t}\n}\n\n/**\n * Configures the identity profile.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the identity profile configuration has been applied.\n */\nasync function configureIdentityProfile(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.identityProfileConnector ??= [];\n\n\tconst identityProfileConnectorType = envChoice<\n\t\tIEngineEnvironmentVariables,\n\t\tIdentityProfileConnectorType\n\t>(envVars, \"identityProfileConnector\", Object.values(IdentityProfileConnectorType));\n\n\tif (identityProfileConnectorType === IdentityProfileConnectorType.EntityStorage) {\n\t\tcoreConfig.types.identityProfileConnector.push({\n\t\t\ttype: IdentityProfileConnectorType.EntityStorage\n\t\t});\n\t}\n\n\tif (coreConfig.types.identityProfileConnector.length > 0) {\n\t\tcoreConfig.types.identityProfileComponent ??= [];\n\t\tcoreConfig.types.identityProfileComponent.push({ type: IdentityProfileComponentType.Service });\n\t}\n}\n\n/**\n * Configures the attestation.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the attestation configuration has been applied.\n */\nasync function configureAttestation(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.attestationConnector ??= [];\n\n\tconst attestationConnectorType = envChoice<IEngineEnvironmentVariables, AttestationConnectorType>(\n\t\tenvVars,\n\t\t\"attestationConnector\",\n\t\tObject.values(AttestationConnectorType)\n\t);\n\n\tif (attestationConnectorType === AttestationConnectorType.Nft) {\n\t\tcoreConfig.types.attestationConnector.push({\n\t\t\ttype: AttestationConnectorType.Nft\n\t\t});\n\t}\n\n\tif (coreConfig.types.attestationConnector.length > 0) {\n\t\tcoreConfig.types.attestationComponent ??= [];\n\t\tcoreConfig.types.attestationComponent.push({\n\t\t\ttype: AttestationComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tverificationMethodId: envVars.attestationVerificationMethodId\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the auditable item graph.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the auditable item graph configuration has been applied.\n */\nasync function configureAuditableItemGraph(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (envBoolean(envVars, \"auditableItemGraphEnabled\", false)) {\n\t\tcoreConfig.types.auditableItemGraphComponent ??= [];\n\t\tcoreConfig.types.auditableItemGraphComponent.push({\n\t\t\ttype: AuditableItemGraphComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"auditableItemGraphMutexTimeout\")\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the auditable item stream.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the auditable item stream configuration has been applied.\n */\nasync function configureAuditableItemStream(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (envBoolean(envVars, \"auditableItemStreamEnabled\", false)) {\n\t\tcoreConfig.types.auditableItemStreamComponent ??= [];\n\t\tcoreConfig.types.auditableItemStreamComponent.push({\n\t\t\ttype: AuditableItemStreamComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"auditableItemStreamMutexTimeout\")\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the data processing.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the data processing configuration has been applied.\n */\nasync function configureDataProcessing(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tcoreConfig.types.dataConverterConnector ??= [];\n\n\tconst converterConnectors = envListToArray<\n\t\tIEngineEnvironmentVariables,\n\t\tDataConverterConnectorType\n\t>(envVars, \"dataConverterConnectors\", Object.values(DataConverterConnectorType));\n\tfor (const converterConnector of converterConnectors) {\n\t\tcoreConfig.types.dataConverterConnector.push({\n\t\t\ttype: converterConnector\n\t\t});\n\t}\n\n\tcoreConfig.types.dataExtractorConnector ??= [];\n\tconst extractorConnectors = envListToArray<\n\t\tIEngineEnvironmentVariables,\n\t\tDataExtractorConnectorType\n\t>(envVars, \"dataExtractorConnectors\", Object.values(DataExtractorConnectorType));\n\tfor (const extractorConnector of extractorConnectors) {\n\t\tcoreConfig.types.dataExtractorConnector.push({\n\t\t\ttype: extractorConnector\n\t\t});\n\t}\n\n\tif (\n\t\tcoreConfig.types.dataConverterConnector.length > 0 ||\n\t\tcoreConfig.types.dataExtractorConnector.length > 0\n\t) {\n\t\tcoreConfig.types.dataProcessingComponent ??= [];\n\t\tcoreConfig.types.dataProcessingComponent.push({ type: DataProcessingComponentType.Service });\n\t}\n}\n\n/**\n * Configures the document management.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the document management configuration has been applied.\n */\nasync function configureDocumentManagement(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (envBoolean(envVars, \"documentManagementEnabled\", false)) {\n\t\tcoreConfig.types.documentManagementComponent ??= [];\n\t\tcoreConfig.types.documentManagementComponent.push({\n\t\t\ttype: DocumentManagementComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"documentManagementMutexTimeout\")\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the trust components.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the trust configuration has been applied.\n */\nasync function configureTrust(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (isTrustRequired(envVars)) {\n\t\tcoreConfig.types.trustComponent ??= [];\n\t\tcoreConfig.types.trustComponent.push({\n\t\t\ttype: TrustComponentType.Service\n\t\t});\n\n\t\tcoreConfig.types.trustGeneratorComponent ??= [];\n\t\tconst trustGeneratorTypes = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tTrustGeneratorComponentType\n\t\t>(envVars, \"trustGenerators\", Object.values(TrustGeneratorComponentType));\n\n\t\tfor (const trustGeneratorType of trustGeneratorTypes) {\n\t\t\tcoreConfig.types.trustGeneratorComponent.push({\n\t\t\t\ttype: trustGeneratorType,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tverificationMethodId: envVars.trustVerificationMethodId ?? \"\",\n\t\t\t\t\t\ttokenTtlInSeconds: envCount(envVars, \"trustJwtTtl\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tcoreConfig.types.trustVerifierComponent ??= [];\n\t\tconst trustVerifierTypes = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tTrustVerifierComponentType\n\t\t>(envVars, \"trustVerifiers\", Object.values(TrustVerifierComponentType));\n\t\tfor (const trustVerifierType of trustVerifierTypes) {\n\t\t\tif (trustVerifierType === TrustVerifierComponentType.IdentityAllowDeny) {\n\t\t\t\tcoreConfig.types.trustVerifierComponent.push({\n\t\t\t\t\ttype: TrustVerifierComponentType.IdentityAllowDeny,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\tallowIdentities: commaSeparatedListToArray<string>(envVars.trustIdentitiesAllow),\n\t\t\t\t\t\t\tdenyIdentities: commaSeparatedListToArray<string>(envVars.trustIdentitiesDeny)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (trustVerifierType === TrustVerifierComponentType.JwtVerifiableCredential) {\n\t\t\t\tcoreConfig.types.trustVerifierComponent.push({\n\t\t\t\t\ttype: TrustVerifierComponentType.JwtVerifiableCredential\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Configures the rights management.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the rights management configuration has been applied.\n */\nasync function configureRightsManagement(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (isRightsManagementRequired(envVars)) {\n\t\tcoreConfig.types.rightsManagementPapComponent ??= [];\n\t\tcoreConfig.types.rightsManagementPapComponent.push({\n\t\t\ttype: RightsManagementPapComponentType.Service\n\t\t});\n\n\t\tcoreConfig.types.rightsManagementPmpComponent ??= [];\n\t\tcoreConfig.types.rightsManagementPmpComponent.push({\n\t\t\ttype: RightsManagementPmpComponentType.Service\n\t\t});\n\n\t\tcoreConfig.types.rightsManagementPipComponent ??= [];\n\t\tcoreConfig.types.rightsManagementPipComponent.push({\n\t\t\ttype: RightsManagementPipComponentType.Service\n\t\t});\n\n\t\tcoreConfig.types.rightsManagementPxpComponent ??= [];\n\t\tcoreConfig.types.rightsManagementPxpComponent.push({\n\t\t\ttype: RightsManagementPxpComponentType.Service\n\t\t});\n\n\t\tcoreConfig.types.rightsManagementPdpComponent ??= [];\n\t\tcoreConfig.types.rightsManagementPdpComponent.push({\n\t\t\ttype: RightsManagementPdpComponentType.Service\n\t\t});\n\n\t\tcoreConfig.types.rightsManagementPepComponent ??= [];\n\t\tcoreConfig.types.rightsManagementPepComponent.push({\n\t\t\ttype: RightsManagementPepComponentType.Service\n\t\t});\n\n\t\tcoreConfig.types.rightsManagementPnpComponent ??= [];\n\n\t\t// Single source of truth for the rights-management mount path.\n\t\tconst rightsManagementPath = envVars.rightsManagementCallbackPath ?? \"rights-management\";\n\n\t\t// We add a multi instance REST client for the remote negotiations\n\t\t// use a dummy endpoint for now as the actual endpoint will be provided in the config\n\t\t// of the policy negotiator when it is used for remote negotiations\n\t\t// We must add it before the service as the service needs to be able to request\n\t\t// the REST client type from the engine core to be able to support remote negotiations\n\t\tcoreConfig.types.rightsManagementPnpComponent.push({\n\t\t\ttype: RightsManagementPnpComponentType.RestClient,\n\t\t\toptions: {\n\t\t\t\t// The endpoint is required in config, but as this is multi-instance\n\t\t\t\t// the actual endpoint will be provided in the config when it is constructed\n\t\t\t\tendpoint: \"http://localhost\",\n\t\t\t\tpathPrefix: rightsManagementPath\n\t\t\t},\n\t\t\tisMultiInstance: true,\n\t\t\tfeatures: [\"remote\"]\n\t\t});\n\t\tcoreConfig.types.rightsManagementPnpComponent.push({\n\t\t\ttype: RightsManagementPnpComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tcallbackPath: rightsManagementPath,\n\t\t\t\t\tincludeErrorDetails: coreConfig.debug ?? false,\n\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"rightsManagementMutexTimeout\")\n\t\t\t\t}\n\t\t\t},\n\t\t\tisDefault: true\n\t\t});\n\n\t\tcoreConfig.types.rightsManagementPnapComponent ??= [];\n\t\tcoreConfig.types.rightsManagementPnapComponent.push({\n\t\t\ttype: RightsManagementPnapComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"rightsManagementMutexTimeout\")\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tcoreConfig.types.rightsManagementPolicyArbiterComponent ??= [];\n\t\tconst policyArbiterTypes = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tRightsManagementPolicyArbiterComponentType\n\t\t>(\n\t\t\tenvVars,\n\t\t\t\"rightsManagementPolicyArbiters\",\n\t\t\tObject.values(RightsManagementPolicyArbiterComponentType)\n\t\t);\n\t\tfor (const policyArbiterType of policyArbiterTypes) {\n\t\t\tcoreConfig.types.rightsManagementPolicyArbiterComponent.push({\n\t\t\t\ttype: policyArbiterType\n\t\t\t});\n\t\t}\n\n\t\tcoreConfig.types.rightsManagementPolicyObligationEnforcerComponent ??= [];\n\t\tconst policyObligationEnforcerTypes = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tRightsManagementPolicyObligationEnforcerComponentType\n\t\t>(\n\t\t\tenvVars,\n\t\t\t\"rightsManagementPolicyObligationEnforcers\",\n\t\t\tObject.values(RightsManagementPolicyObligationEnforcerComponentType)\n\t\t);\n\t\tfor (const policyObligationEnforcerType of policyObligationEnforcerTypes) {\n\t\t\tcoreConfig.types.rightsManagementPolicyObligationEnforcerComponent.push({\n\t\t\t\ttype: policyObligationEnforcerType\n\t\t\t});\n\t\t}\n\n\t\tcoreConfig.types.rightsManagementPolicyEnforcementProcessorComponent ??= [];\n\t\tconst policyEnforcementProcessTypes = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tRightsManagementPolicyEnforcementProcessorComponentType\n\t\t>(\n\t\t\tenvVars,\n\t\t\t\"rightsManagementPolicyEnforcementProcessors\",\n\t\t\tObject.values(RightsManagementPolicyEnforcementProcessorComponentType)\n\t\t);\n\t\tfor (const policyEnforcementProcessorType of policyEnforcementProcessTypes) {\n\t\t\tcoreConfig.types.rightsManagementPolicyEnforcementProcessorComponent.push({\n\t\t\t\ttype: policyEnforcementProcessorType\n\t\t\t});\n\t\t}\n\n\t\tcoreConfig.types.rightsManagementPolicyExecutionActionComponent ??= [];\n\t\tconst policyExecutionActionTypes = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tRightsManagementPolicyExecutionActionComponentType\n\t\t>(\n\t\t\tenvVars,\n\t\t\t\"rightsManagementPolicyExecutionActions\",\n\t\t\tObject.values(RightsManagementPolicyExecutionActionComponentType)\n\t\t);\n\t\tfor (const policyExecutionActionType of policyExecutionActionTypes) {\n\t\t\tcoreConfig.types.rightsManagementPolicyExecutionActionComponent.push({\n\t\t\t\ttype: policyExecutionActionType\n\t\t\t});\n\t\t}\n\n\t\tcoreConfig.types.rightsManagementPolicyInformationSourceComponent ??= [];\n\t\tconst policyInformationSourceTypes = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tRightsManagementPolicyInformationSourceComponentType\n\t\t>(\n\t\t\tenvVars,\n\t\t\t\"rightsManagementPolicyInformationSources\",\n\t\t\tObject.values(RightsManagementPolicyInformationSourceComponentType)\n\t\t);\n\t\tfor (const policyInformationSourceType of policyInformationSourceTypes) {\n\t\t\tcoreConfig.types.rightsManagementPolicyInformationSourceComponent.push({\n\t\t\t\ttype: policyInformationSourceType\n\t\t\t});\n\t\t}\n\n\t\tcoreConfig.types.rightsManagementPolicyRequesterComponent ??= [];\n\t\tconst policyRequesterTypes = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tRightsManagementPolicyRequesterComponentType\n\t\t>(\n\t\t\tenvVars,\n\t\t\t\"rightsManagementPolicyRequesters\",\n\t\t\tObject.values(RightsManagementPolicyRequesterComponentType)\n\t\t);\n\t\tfor (const policyRequesterType of policyRequesterTypes) {\n\t\t\tcoreConfig.types.rightsManagementPolicyRequesterComponent.push({\n\t\t\t\ttype: policyRequesterType\n\t\t\t});\n\t\t}\n\n\t\tcoreConfig.types.rightsManagementPolicyNegotiatorComponent ??= [];\n\t\tconst policyNegotiatorTypes = envListToArray<\n\t\t\tIEngineEnvironmentVariables,\n\t\t\tRightsManagementPolicyNegotiatorComponentType\n\t\t>(\n\t\t\tenvVars,\n\t\t\t\"rightsManagementPolicyNegotiators\",\n\t\t\tObject.values(RightsManagementPolicyNegotiatorComponentType)\n\t\t);\n\t\tfor (const policyNegotiatorType of policyNegotiatorTypes) {\n\t\t\tcoreConfig.types.rightsManagementPolicyNegotiatorComponent.push({\n\t\t\t\ttype: policyNegotiatorType\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * Configures the task scheduler.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the task scheduler configuration has been applied.\n */\nasync function configureTaskScheduler(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (isTaskSchedulerRequired(envVars)) {\n\t\tcoreConfig.types.taskSchedulerComponent ??= [];\n\t\tcoreConfig.types.taskSchedulerComponent.push({\n\t\t\ttype: TaskSchedulerComponentType.Service\n\t\t});\n\t}\n}\n\n/**\n * Configures the federated catalogue.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the federated catalogue configuration has been applied.\n */\nasync function configureFederatedCatalogue(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (isFederatedCatalogueRequired(envVars)) {\n\t\tcoreConfig.types.federatedCatalogueComponent ??= [];\n\n\t\tif (Is.stringValue(envVars.federatedCatalogueRemoteEndpoint)) {\n\t\t\tcoreConfig.types.federatedCatalogueComponent.push({\n\t\t\t\ttype: FederatedCatalogueComponentType.RestClient,\n\t\t\t\toptions: {\n\t\t\t\t\tendpoint: envVars.federatedCatalogueRemoteEndpoint,\n\t\t\t\t\tpathPrefix: envVars.federatedCatalogueRestClientPathPrefix ?? \"catalog\"\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tcoreConfig.types.federatedCatalogueComponent.push({\n\t\t\t\ttype: FederatedCatalogueComponentType.Service,\n\t\t\t\toptions: {\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tmutexTimeoutMs: envMs(envVars, \"federatedCatalogueMutexTimeout\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tcoreConfig.types.federatedCatalogueFilterComponent ??= [];\n\t\t\tconst filters = envListToArray<\n\t\t\t\tIEngineEnvironmentVariables,\n\t\t\t\tFederatedCatalogueFilterComponentType\n\t\t\t>(envVars, \"federatedCatalogueFilters\", Object.values(FederatedCatalogueFilterComponentType));\n\n\t\t\tfor (const filter of filters) {\n\t\t\t\tcoreConfig.types.federatedCatalogueFilterComponent.push({\n\t\t\t\t\ttype: filter,\n\t\t\t\t\toptions: {}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Configures the dataspace control plane and data plane.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the dataspace configuration has been applied.\n */\nasync function configureDataspace(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\tif (envBoolean(envVars, \"dataspaceEnabled\", false)) {\n\t\tcoreConfig.types.dataspaceControlPlaneComponent ??= [];\n\t\t// We add a multi instance REST client for remote/consumer-initiated transfers.\n\t\tcoreConfig.types.dataspaceControlPlaneComponent.push({\n\t\t\ttype: DataspaceControlPlaneComponentType.RestClient,\n\t\t\toptions: {\n\t\t\t\tendpoint: \"http://localhost\"\n\t\t\t},\n\t\t\tisMultiInstance: true,\n\t\t\tfeatures: [\"remote\"]\n\t\t});\n\t\tcoreConfig.types.dataspaceControlPlaneComponent.push({\n\t\t\ttype: DataspaceControlPlaneComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\t// Must match the control-plane REST mount, as it is combined with the public origin\n\t\t\t\t\t// to build the consumer's advertised callback address;\n\t\t\t\t\tcallbackPath: envVars.dataspaceCallbackPath ?? \"dataspace-control-plane\",\n\t\t\t\t\t// Base mount path of the data plane only; the transfer handlers append the\n\t\t\t\t\t// sub-paths themselves (`/entities` for PULL, `/inbox` for PUSH).\n\t\t\t\t\tdataPlanePath: envVars.dataspaceDataPlanePath,\n\t\t\t\t\tautoStartTransfers: envBoolean(envVars, \"dataspaceAutoStartTransfers\", false),\n\t\t\t\t\tstalledNegotiationTimeoutMs: envSecToMs(envVars, \"dataspaceStalledNegotiationTimeout\"),\n\t\t\t\t\tstalledTransferTimeoutMs: envSecToMs(envVars, \"dataspaceStalledTransferTimeout\"),\n\t\t\t\t\tproviderTransferIdleTimeoutMs: envSecToMs(\n\t\t\t\t\t\tenvVars,\n\t\t\t\t\t\t\"dataspaceProviderTransferIdleTimeout\"\n\t\t\t\t\t),\n\t\t\t\t\tproviderTransferPolicySweepIntervalMs: envSecToMs(\n\t\t\t\t\t\tenvVars,\n\t\t\t\t\t\t\"dataspaceProviderTransferPolicySweepInterval\"\n\t\t\t\t\t),\n\t\t\t\t\tagreementUnusedThresholdMs: envMs(envVars, \"dataspaceAgreementUnusedThreshold\"),\n\t\t\t\t\tagreementSweepIntervalMs: envMs(envVars, \"dataspaceAgreementSweepInterval\")\n\t\t\t\t}\n\t\t\t},\n\t\t\tisDefault: true\n\t\t});\n\n\t\tcoreConfig.types.dataspaceDataPlaneComponent ??= [];\n\t\tcoreConfig.types.dataspaceDataPlaneComponent.push({\n\t\t\ttype: DataspaceDataPlaneComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tretainActivityLogsForMs: envSecToMs(envVars, \"dataspaceRetainActivityLogsFor\"),\n\t\t\t\t\tactivityLogsCleanUpIntervalMs: envSecToMs(\n\t\t\t\t\t\tenvVars,\n\t\t\t\t\t\t\"dataspaceActivityLogsCleanupInterval\"\n\t\t\t\t\t),\n\t\t\t\t\tretryCount: envCount(envVars, \"dataspaceRetryCount\"),\n\t\t\t\t\tpushRetryCount: envCount(envVars, \"dataspacePushRetryCount\"),\n\t\t\t\t\tpushRetryBaseDelayMs: envMs(envVars, \"dataspacePushRetryBaseDelay\"),\n\t\t\t\t\tpushTimeoutMs: envMs(envVars, \"dataspacePushTimeout\"),\n\t\t\t\t\tpushSubscriptionCleanupIntervalMs: envMs(\n\t\t\t\t\t\tenvVars,\n\t\t\t\t\t\t\"dataspacePushSubscriptionCleanupInterval\"\n\t\t\t\t\t),\n\t\t\t\t\tagreementCacheTtlMs: envMs(envVars, \"dataspaceAgreementCacheTtl\"),\n\t\t\t\t\tagreementCacheMutexTimeoutMs: envMs(envVars, \"dataspaceAgreementCacheMutexTimeout\")\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Configures the DLT.\n * @param coreConfig The core config.\n * @param envVars The environment variables.\n * @returns A promise that resolves when the DLT configuration has been applied.\n */\nasync function configureDlt(\n\tcoreConfig: IEngineConfig,\n\tenvVars: IEngineEnvironmentVariables\n): Promise<void> {\n\t// Create centralized DLT configuration for IOTA if essential IOTA variables are set\n\tif (Is.stringValue(envVars.iotaNodeEndpoint) && Is.stringValue(envVars.iotaNetwork)) {\n\t\tcoreConfig.types.dltConfig ??= [];\n\n\t\tconst gasStationConfig =\n\t\t\tIs.stringValue(envVars.iotaGasStationEndpoint) &&\n\t\t\tIs.stringValue(envVars.iotaGasStationAuthToken)\n\t\t\t\t? {\n\t\t\t\t\t\tgasStationUrl: envVars.iotaGasStationEndpoint,\n\t\t\t\t\t\tgasStationAuthToken: envVars.iotaGasStationAuthToken\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\n\t\tcoreConfig.types.dltConfig.push({\n\t\t\ttype: DltConfigType.Iota,\n\t\t\tisDefault: true,\n\t\t\toptions: {\n\t\t\t\tconfig: {\n\t\t\t\t\tclientOptions: {\n\t\t\t\t\t\turl: envVars.iotaNodeEndpoint ?? \"\"\n\t\t\t\t\t},\n\t\t\t\t\tnetwork: envVars.iotaNetwork ?? \"\",\n\t\t\t\t\tcoinType: envCount(envVars, \"iotaCoinType\"),\n\t\t\t\t\tgasStation: gasStationConfig,\n\t\t\t\t\tgasBudget: envCount(envVars, \"iotaGasBudget\"),\n\t\t\t\t\tgasReservationDuration: envSeconds(envVars, \"iotaGasReservationDuration\")\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Checks if the trust subsystem is required.\n * Returns true when any component that depends on the trust subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if rights-management, or dataspace is enabled.\n */\nexport function isTrustRequired(envVars: IEngineEnvironmentVariables): boolean {\n\treturn (\n\t\tisRightsManagementRequired(envVars) ||\n\t\tenvBoolean(envVars, \"dataspaceEnabled\", false) ||\n\t\tisFederatedCatalogueRequired(envVars)\n\t);\n}\n\n/**\n * Checks if the background tasks subsystem is required.\n * Returns true when any component that depends on the background tasks subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if dataspace or verifiable storage is enabled.\n */\nexport function isBackgroundTasksRequired(envVars: IEngineEnvironmentVariables): boolean {\n\treturn (\n\t\tenvBoolean(envVars, \"dataspaceEnabled\", false) ||\n\t\tisImmutableProofRequired(envVars) ||\n\t\tenvBoolean(envVars, \"healthEnabled\", false) ||\n\t\tcommaSeparatedListToArray<TelemetryConnectorType>(envVars.telemetryConnector).includes(\n\t\t\tTelemetryConnectorType.EntityStorage\n\t\t)\n\t);\n}\n\n/**\n * Checks if the immutable proof subsystem is required.\n * Returns true when any component that depends on the immutable proof subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if verifiable storage is enabled.\n */\nexport function isImmutableProofRequired(envVars: IEngineEnvironmentVariables): boolean {\n\treturn (\n\t\tenvBoolean(envVars, \"auditableItemGraphEnabled\", false) ||\n\t\tenvBoolean(envVars, \"auditableItemStreamEnabled\", false) ||\n\t\tenvBoolean(envVars, \"documentManagementEnabled\", false)\n\t);\n}\n\n/**\n * Checks if the federated catalogue subsystem is required.\n * Returns true when the catalogue is explicitly enabled, a remote endpoint is configured, filters are set, or dataspace is enabled.\n * @param envVars The environment variables.\n * @returns True if the federated catalogue is required.\n */\nexport function isFederatedCatalogueRequired(envVars: IEngineEnvironmentVariables): boolean {\n\treturn (\n\t\tenvBoolean(envVars, \"federatedCatalogueEnabled\", false) ||\n\t\tIs.stringValue(envVars.federatedCatalogueRemoteEndpoint) ||\n\t\tIs.stringValue(envVars.federatedCatalogueFilters) ||\n\t\tenvBoolean(envVars, \"dataspaceEnabled\", false)\n\t);\n}\n\n/**\n * Checks if the rights management subsystem is required.\n * Returns true when any component that depends on the rights management subsystem is enabled.\n * Note: rights management has no standalone enable flag - it is gated entirely on\n * `dataspaceEnabled`. Setting `TWIN_RIGHTS_MANAGEMENT_*` env var in isolation does not\n * enable the subsystem; `TWIN_DATASPACE_ENABLED` must also be true.\n * @param envVars The environment variables.\n * @returns True if rights management is enabled.\n */\nexport function isRightsManagementRequired(envVars: IEngineEnvironmentVariables): boolean {\n\treturn envBoolean(envVars, \"dataspaceEnabled\", false);\n}\n\n/**\n * Checks if the task scheduler subsystem is required.\n * Returns true when any component that depends on the task scheduler subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if task scheduler is enabled.\n */\nexport function isTaskSchedulerRequired(envVars: IEngineEnvironmentVariables): boolean {\n\treturn (\n\t\tenvBoolean(envVars, \"taskSchedulerEnabled\", false) ||\n\t\tenvBoolean(envVars, \"dataspaceEnabled\", false) ||\n\t\tisRightsManagementRequired(envVars) ||\n\t\tisAuthEntityStorageRequired(envVars) ||\n\t\tisImmutableProofRequired(envVars) ||\n\t\tisMailboxEnabled(envVars)\n\t);\n}\n\n/**\n * Checks if the automation subsystem is required.\n * Returns true when any component that depends on the automation subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if automation is enabled.\n */\nexport function isAutomationRequired(envVars: IEngineEnvironmentVariables): boolean {\n\treturn isRightsManagementRequired(envVars);\n}\n\n/**\n * Checks if the telemetry subsystem is enabled.\n * Returns true when any component that depends on the telemetry subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if telemetry is enabled.\n */\nexport function isTelemetryEnabled(envVars: IEngineEnvironmentVariables): boolean {\n\treturn commaSeparatedListToArray<TelemetryConnectorType>(envVars.telemetryConnector).some(\n\t\tt => t === TelemetryConnectorType.EntityStorage || t === TelemetryConnectorType.OpenTelemetry\n\t);\n}\n\n/**\n * Checks if the tracing subsystem is enabled.\n * Returns true when any component that depends on the tracing subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if tracing is enabled.\n */\nexport function isTracingEnabled(envVars: IEngineEnvironmentVariables): boolean {\n\treturn commaSeparatedListToArray<TracingConnectorType>(envVars.tracingConnector).some(\n\t\tt =>\n\t\t\tt === TracingConnectorType.EntityStorage ||\n\t\t\tt === TracingConnectorType.OpenTelemetry ||\n\t\t\tt === TracingConnectorType.Console\n\t);\n}\n\n/**\n * Checks if the mailbox subsystem is enabled.\n * Returns true when any component that depends on the mailbox subsystem is enabled.\n * @param envVars The environment variables.\n * @returns True if mailbox is enabled.\n */\nexport function isMailboxEnabled(envVars: IEngineEnvironmentVariables): boolean {\n\treturn commaSeparatedListToArray<EmailProtocolConnectorType>(envVars.emailProtocolConnector).some(\n\t\tt => t === EmailProtocolConnectorType.Imap || t === EmailProtocolConnectorType.Pop3\n\t);\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 2026 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
/**
|
|
4
|
+
* The camelCase property names which are no longer used, mapped to the keys which replace them.
|
|
5
|
+
* They are still recognised so an existing configuration does not fail validation, but each one
|
|
6
|
+
* reports a deprecation warning and has no effect on the engine configuration.
|
|
7
|
+
* An empty array is a key which has been withdrawn with nothing to replace it.
|
|
8
|
+
*/
|
|
9
|
+
export const DEPRECATED_ENVIRONMENT_VARIABLE_KEYS = new Map([
|
|
10
|
+
[
|
|
11
|
+
"messagingEnabled",
|
|
12
|
+
["messagingEmailConnector", "messagingSmsConnector", "messagingPushNotificationConnector"]
|
|
13
|
+
],
|
|
14
|
+
["dataProcessingEnabled", ["dataConverterConnectors", "dataExtractorConnectors"]]
|
|
15
|
+
]);
|
|
16
|
+
//# sourceMappingURL=deprecatedEnvironmentVariableKeys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecatedEnvironmentVariableKeys.js","sourceRoot":"","sources":["../../../src/models/deprecatedEnvironmentVariableKeys.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAA2C,IAAI,GAAG,CAClG;IACC;QACC,kBAAkB;QAClB,CAAC,yBAAyB,EAAE,uBAAuB,EAAE,oCAAoC,CAAC;KAC1F;IACD,CAAC,uBAAuB,EAAE,CAAC,yBAAyB,EAAE,yBAAyB,CAAC,CAAC;CACjF,CACD,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The camelCase property names which are no longer used, mapped to the keys which replace them.\n * They are still recognised so an existing configuration does not fail validation, but each one\n * reports a deprecation warning and has no effect on the engine configuration.\n * An empty array is a key which has been withdrawn with nothing to replace it.\n */\nexport const DEPRECATED_ENVIRONMENT_VARIABLE_KEYS: ReadonlyMap<string, readonly string[]> = new Map(\n\t[\n\t\t[\n\t\t\t\"messagingEnabled\",\n\t\t\t[\"messagingEmailConnector\", \"messagingSmsConnector\", \"messagingPushNotificationConnector\"]\n\t\t],\n\t\t[\"dataProcessingEnabled\", [\"dataConverterConnectors\", \"dataExtractorConnectors\"]]\n\t]\n);\n"]}
|
package/dist/es/node.js
CHANGED
|
@@ -12,6 +12,7 @@ import { commaSeparatedListToArray } from "./builders/helper/envHelpers.js";
|
|
|
12
12
|
import { constructCliCommand, parseCommandLineArgs, registerCommands } from "./cli.js";
|
|
13
13
|
import { getEnvDefaults } from "./defaults.js";
|
|
14
14
|
import { BOOTSTRAP_DEV_ENVIRONMENT_VARIABLE_KEYS } from "./models/bootstrapDevEnvironmentVariableKeys.js";
|
|
15
|
+
import { DEPRECATED_ENVIRONMENT_VARIABLE_KEYS } from "./models/deprecatedEnvironmentVariableKeys.js";
|
|
15
16
|
import { ENGINE_ENVIRONMENT_VARIABLE_KEYS } from "./models/engineEnvironmentVariableKeys.js";
|
|
16
17
|
import { ENGINE_SERVER_ENVIRONMENT_VARIABLE_KEYS } from "./models/engineServerEnvironmentVariableKeys.js";
|
|
17
18
|
import { ModuleProtocol } from "./models/moduleProtocol.js";
|
|
@@ -32,7 +33,7 @@ export async function run(nodeOptions, args) {
|
|
|
32
33
|
nodeOptions ??= {};
|
|
33
34
|
const serverInfo = {
|
|
34
35
|
name: nodeOptions?.serverName ?? "TWIN Node",
|
|
35
|
-
version: nodeOptions?.serverVersion ?? "0.9.4-next.
|
|
36
|
+
version: nodeOptions?.serverVersion ?? "0.9.4-next.3" // x-release-please-version
|
|
36
37
|
};
|
|
37
38
|
CLIDisplay.header(serverInfo.name, serverInfo.version, "đŠī¸ ");
|
|
38
39
|
if (!Is.stringValue(nodeOptions?.executionDirectory)) {
|
|
@@ -150,6 +151,30 @@ function matchesPatternSet(camelKey, patternSet) {
|
|
|
150
151
|
}
|
|
151
152
|
return false;
|
|
152
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Report any environment variables which are still recognised but no longer used.
|
|
156
|
+
* @param envVars The already-converted camelCase env variables.
|
|
157
|
+
* @param prefix The prefix used for the environment variables (e.g. "TWIN_").
|
|
158
|
+
*/
|
|
159
|
+
function warnDeprecatedEnvVarKeys(envVars, prefix) {
|
|
160
|
+
for (const camelKey of Object.keys(envVars)) {
|
|
161
|
+
const replacements = DEPRECATED_ENVIRONMENT_VARIABLE_KEYS.get(camelKey);
|
|
162
|
+
if (!Is.undefined(replacements)) {
|
|
163
|
+
const key = EnvHelper.jsonKeyToEnvVarKey(camelKey, prefix);
|
|
164
|
+
if (Is.arrayValue(replacements)) {
|
|
165
|
+
CLIDisplay.warning(I18n.formatMessage("warn.node.deprecatedEnvVar", {
|
|
166
|
+
key,
|
|
167
|
+
replacements: replacements
|
|
168
|
+
.map(replacement => EnvHelper.jsonKeyToEnvVarKey(replacement, prefix))
|
|
169
|
+
.join(", ")
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
CLIDisplay.warning(I18n.formatMessage("warn.node.deprecatedEnvVarNoReplacement", { key }));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
153
178
|
/**
|
|
154
179
|
* Validate that every key in envVars maps to a recognised property.
|
|
155
180
|
* All unknown keys are collected, then reported together as a single error or warning.
|
|
@@ -169,7 +194,8 @@ function validateEnvVarKeys(envVars, prefix, allowSets) {
|
|
|
169
194
|
const customSet = new Set(commaSeparatedListToArray(envVars.envAllowList).map(k => EnvHelper.envVarKeyToJsonKey(k.trim(), prefix)));
|
|
170
195
|
const unknown = Object.keys(envVars)
|
|
171
196
|
.filter(camelKey => !allowSets.some(set => matchesPatternSet(camelKey, set)) &&
|
|
172
|
-
!matchesPatternSet(camelKey, customSet)
|
|
197
|
+
!matchesPatternSet(camelKey, customSet) &&
|
|
198
|
+
!DEPRECATED_ENVIRONMENT_VARIABLE_KEYS.has(camelKey))
|
|
173
199
|
.map(camelKey => EnvHelper.jsonKeyToEnvVarKey(camelKey, prefix));
|
|
174
200
|
if (unknown.length > 0) {
|
|
175
201
|
if (mode === "error") {
|
|
@@ -215,6 +241,7 @@ export async function buildConfiguration(processEnv, options, serverInfo) {
|
|
|
215
241
|
}
|
|
216
242
|
}
|
|
217
243
|
const envVars = EnvHelper.envToJson(processEnv, options.envPrefix ?? "");
|
|
244
|
+
warnDeprecatedEnvVarKeys(envVars, options.envPrefix ?? "");
|
|
218
245
|
validateEnvVarKeys(envVars, options.envPrefix ?? "", [
|
|
219
246
|
ENGINE_ENVIRONMENT_VARIABLE_KEYS,
|
|
220
247
|
ENGINE_SERVER_ENVIRONMENT_VARIABLE_KEYS,
|
package/dist/es/node.js.map
CHANGED
|
@@ -1 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CAAC;oBACvD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,UAAU,CAAC,CAAC;oBAC5C,IAAI,MAAM,EAAE,CAAC;wBACZ,YAAY,GAAG,UAAU,CAAC;oBAC3B,CAAC;gBACF,CAAC;gBAAC,MAAM,CAAC;oBACR,4CAA4C;gBAC7C,CAAC;gBACD,MAAM;YACP,CAAC;QACF,CAAC;QAED,0CAA0C;QAC1C,IAAI,YAAY,EAAE,CAAC;YAClB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC,CAAC;YACjE,WAAW,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC;YACjC,OAAO;gBACN,MAAM;gBACN,UAAU,EAAE,KAAK;aACjB,CAAC;QACH,CAAC;QAED,OAAO;YACN,MAAM,EAAE,SAAS;YACjB,UAAU,EAAE,IAAI;SAChB,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport path from \"node:path\";\nimport type { IServerInfo } from \"@twin.org/api-models\";\nimport { CLIDisplay, CLIUtils } from \"@twin.org/cli-core\";\nimport { Coerce, EnvHelper, GeneralError, Guards, I18n, Is } from \"@twin.org/core\";\nimport type { Engine } from \"@twin.org/engine\";\nimport type { EngineServer } from \"@twin.org/engine-server\";\nimport type { IEngineServerConfig } from \"@twin.org/engine-server-types\";\nimport { ModuleHelper } from \"@twin.org/modules\";\nimport * as dotenv from \"dotenv\";\nimport { buildEngineConfiguration } from \"./builders/engineEnvBuilder.js\";\nimport { buildEngineServerConfiguration } from \"./builders/engineServerEnvBuilder.js\";\nimport { extensionsConfiguration } from \"./builders/extensionsBuilder.js\";\nimport { commaSeparatedListToArray } from \"./builders/helper/envHelpers.js\";\nimport { constructCliCommand, parseCommandLineArgs, registerCommands } from \"./cli.js\";\nimport { getEnvDefaults } from \"./defaults.js\";\nimport { BOOTSTRAP_DEV_ENVIRONMENT_VARIABLE_KEYS } from \"./models/bootstrapDevEnvironmentVariableKeys.js\";\nimport { ENGINE_ENVIRONMENT_VARIABLE_KEYS } from \"./models/engineEnvironmentVariableKeys.js\";\nimport { ENGINE_SERVER_ENVIRONMENT_VARIABLE_KEYS } from \"./models/engineServerEnvironmentVariableKeys.js\";\nimport type { IEnvironmentVariables } from \"./models/IEnvironmentVariables.js\";\nimport type { INodeEngineConfig } from \"./models/INodeEngineConfig.js\";\nimport type { INodeEngineState } from \"./models/INodeEngineState.js\";\nimport type { INodeOptions } from \"./models/INodeOptions.js\";\nimport { ModuleProtocol } from \"./models/moduleProtocol.js\";\nimport { NODE_ENVIRONMENT_VARIABLE_KEYS } from \"./models/nodeEnvironmentVariableKeys.js\";\nimport { start } from \"./start.js\";\nimport {\n\tcreateModuleImportUrl,\n\tfileExists,\n\tgetExecutionDirectory,\n\tgetExtensionsCacheDir,\n\tgetScriptDirectory,\n\thandleHttpsProtocol,\n\thandleNpmProtocol,\n\tinitialiseLocales,\n\tloadJsonFile,\n\tloadTextFile,\n\tparseModuleProtocol,\n\tresolvePackageEntryPoint\n} from \"./utils.js\";\n\nconst moduleCache: { [id: string]: unknown } = {};\n\n/**\n * Run the node.\n * @param nodeOptions Optional configuration options for running the server.\n * @param args Optional command line arguments.\n * @returns A promise that resolves when the server is started containing a shutdown method.\n */\nexport async function run(\n\tnodeOptions?: INodeOptions,\n\targs?: string[]\n): Promise<\n\t| {\n\t\t\tengine: Engine<IEngineServerConfig, INodeEngineState>;\n\t\t\tserver: EngineServer;\n\t\t\tshutdown: () => Promise<void>;\n\t }\n\t| undefined\n> {\n\tlet showErrorDetails = true;\n\tlet debugEnabled = true;\n\ttry {\n\t\tnodeOptions ??= {};\n\n\t\tconst serverInfo: IServerInfo = {\n\t\t\tname: nodeOptions?.serverName ?? \"TWIN Node\",\n\t\t\tversion: nodeOptions?.serverVersion ?? \"0.9.4-next.1\" // x-release-please-version\n\t\t};\n\n\t\tCLIDisplay.header(serverInfo.name, serverInfo.version, \"đŠī¸ \");\n\n\t\tif (!Is.stringValue(nodeOptions?.executionDirectory)) {\n\t\t\tnodeOptions.executionDirectory = getExecutionDirectory();\n\t\t}\n\t\tCLIDisplay.value(\"Execution Directory\", nodeOptions.executionDirectory);\n\n\t\tif (!Is.stringValue(nodeOptions?.scriptDirectory)) {\n\t\t\tnodeOptions.scriptDirectory = getScriptDirectory(args);\n\t\t}\n\t\tCLIDisplay.value(\"Script Directory\", nodeOptions.scriptDirectory);\n\n\t\tnodeOptions.localesDirectory =\n\t\t\tnodeOptions?.localesDirectory ??\n\t\t\tpath.resolve(path.join(nodeOptions.scriptDirectory, \"dist\", \"locales\"));\n\n\t\tCLIDisplay.value(\"Locales Directory\", nodeOptions.localesDirectory);\n\t\tawait initialiseLocales(nodeOptions.localesDirectory);\n\n\t\tnodeOptions.envPrefix ??= \"TWIN_\";\n\n\t\toverrideModuleImport(nodeOptions.executionDirectory ?? \"\");\n\n\t\tconst commandLineArgs = parseCommandLineArgs(args);\n\n\t\tconst hasEnvPrefix = commandLineArgs.options?.find(option => option.key === \"env-prefix\");\n\t\tif (hasEnvPrefix) {\n\t\t\tnodeOptions.envPrefix = Coerce.string(hasEnvPrefix.value) ?? nodeOptions.envPrefix;\n\t\t}\n\n\t\tCLIDisplay.value(\"Environment Variable Prefix\", nodeOptions.envPrefix);\n\n\t\t// This is the only location in the code base that should access process.env directly\n\t\t// So we can safely disable the linting rule here.\n\t\tlet finalEnvVars =\n\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\tprocess.env as {\n\t\t\t\t[id: string]: string;\n\t\t\t};\n\n\t\tif (Is.objectValue(nodeOptions?.envVars)) {\n\t\t\tfinalEnvVars = {\n\t\t\t\t...finalEnvVars,\n\t\t\t\t...nodeOptions.envVars\n\t\t\t};\n\t\t}\n\n\t\tfinalEnvVars = {\n\t\t\t...getEnvDefaults(nodeOptions.envPrefix),\n\t\t\t...finalEnvVars\n\t\t};\n\n\t\tlet cliCommand;\n\t\tif (Is.arrayValue(commandLineArgs.options)) {\n\t\t\tregisterCommands();\n\t\t\tcliCommand = constructCliCommand(finalEnvVars, commandLineArgs);\n\t\t}\n\n\t\tif (Is.object(cliCommand)) {\n\t\t\tfinalEnvVars[`${nodeOptions.envPrefix}SILENT`] ??= \"true\";\n\t\t} else {\n\t\t\tif (Is.empty(nodeOptions?.openApiSpecFile)) {\n\t\t\t\tconst specFile = path.resolve(\n\t\t\t\t\tpath.join(nodeOptions.scriptDirectory ?? \"\", \"docs\", \"open-api\", \"spec.json\")\n\t\t\t\t);\n\t\t\t\tif (await fileExists(specFile)) {\n\t\t\t\t\tnodeOptions ??= {};\n\t\t\t\t\tnodeOptions.openApiSpecFile = specFile;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (Is.stringValue(nodeOptions.openApiSpecFile)) {\n\t\t\t\tCLIDisplay.value(\"OpenAPI Spec File\", nodeOptions.openApiSpecFile);\n\t\t\t}\n\n\t\t\tif (Is.empty(nodeOptions?.favIconFile)) {\n\t\t\t\tconst favIconFile = path.resolve(\n\t\t\t\t\tpath.join(nodeOptions.scriptDirectory ?? \"\", \"static\", \"favicon.png\")\n\t\t\t\t);\n\t\t\t\tif (await fileExists(favIconFile)) {\n\t\t\t\t\tnodeOptions ??= {};\n\t\t\t\t\tnodeOptions.favIconFile = favIconFile;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (Is.stringValue(nodeOptions.favIconFile)) {\n\t\t\t\tCLIDisplay.value(\"Favicon File\", nodeOptions.favIconFile);\n\t\t\t}\n\t\t}\n\n\t\tconst { nodeEngineConfig, nodeEnvVars, availableContextIdKeys } = await buildConfiguration(\n\t\t\tfinalEnvVars,\n\t\t\tnodeOptions,\n\t\t\tserverInfo\n\t\t);\n\n\t\tdebugEnabled = Coerce.boolean(nodeEnvVars.debug) ?? debugEnabled;\n\n\t\tCLIDisplay.break();\n\n\t\tconst startResult = await start(\n\t\t\tnodeOptions,\n\t\t\tnodeEngineConfig,\n\t\t\tnodeEnvVars,\n\t\t\tcliCommand,\n\t\t\tavailableContextIdKeys\n\t\t);\n\n\t\tif (Is.notEmpty(startResult)) {\n\t\t\tshowErrorDetails = false;\n\n\t\t\tlet isShuttingDown = false;\n\t\t\tfor (const signal of [\"SIGHUP\", \"SIGINT\", \"SIGTERM\"]) {\n\t\t\t\tprocess.on(signal, async () => {\n\t\t\t\t\tif (!isShuttingDown) {\n\t\t\t\t\t\tisShuttingDown = true;\n\t\t\t\t\t\tCLIDisplay.value(\"Terminate Signal\", signal);\n\t\t\t\t\t\tawait startResult.shutdown();\n\t\t\t\t\t\tprocess.exit(0);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn startResult;\n\t} catch (err) {\n\t\tif (nodeOptions?.disableProcessExitOnFailure ?? false) {\n\t\t\tthrow err;\n\t\t}\n\n\t\tif (showErrorDetails) {\n\t\t\tCLIDisplay.error(err, true, { includeAdditional: true, includeStack: debugEnabled });\n\t\t}\n\n\t\t// eslint-disable-next-line unicorn/no-process-exit\n\t\tprocess.exit(1);\n\t}\n}\n\n/**\n * Test whether a camelCase key matches an entry in a pattern set.\n * Entries ending with \"*\" are treated as prefix patterns; all others require an exact match.\n * @param camelKey The camelCase key to test.\n * @param patternSet The set of exact keys and/or wildcard patterns (e.g. \"restPath*\").\n * @returns True if the key matches any entry.\n */\nfunction matchesPatternSet(\n\tcamelKey: string,\n\tpatternSet: ReadonlySet<string> | Set<string>\n): boolean {\n\tif (patternSet.has(camelKey)) {\n\t\treturn true;\n\t}\n\tfor (const pattern of patternSet) {\n\t\tif (pattern.endsWith(\"*\") && camelKey.startsWith(pattern.slice(0, -1))) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n/**\n * Validate that every key in envVars maps to a recognised property.\n * All unknown keys are collected, then reported together as a single error or warning.\n * Raw env var names listed in the allow list (e.g. TWIN_MY_EXTENSION_SECRET, TWIN_REST_PATH_*) are always accepted.\n * Wildcard patterns ending with * are supported in both allow sets and the allow list.\n * @param envVars The already-converted camelCase env variables.\n * @param prefix The prefix used for the environment variables (e.g. \"TWIN_\").\n * @param allowSets An array of sets of allowed keys and/or wildcard patterns.\n * @throws GeneralError If any unknown env var properties are found and strict mode is \"error\", or if the strict mode value is invalid.\n */\nfunction validateEnvVarKeys(\n\tenvVars: { [id: string]: string | unknown },\n\tprefix: string,\n\tallowSets: ReadonlySet<string>[]\n): void {\n\tconst mode = Is.stringValue(envVars.strictEnv) ? envVars.strictEnv : \"error\";\n\tGuards.arrayOneOf(\"node\", `${prefix}STRICT_ENV`, mode, [\"error\", \"warn\", \"ignore\"]);\n\n\tif (mode === \"ignore\") {\n\t\treturn;\n\t}\n\n\tconst customSet = new Set(\n\t\tcommaSeparatedListToArray<string>(envVars.envAllowList as string).map(k =>\n\t\t\tEnvHelper.envVarKeyToJsonKey(k.trim(), prefix)\n\t\t)\n\t);\n\n\tconst unknown = Object.keys(envVars)\n\t\t.filter(\n\t\t\tcamelKey =>\n\t\t\t\t!allowSets.some(set => matchesPatternSet(camelKey, set)) &&\n\t\t\t\t!matchesPatternSet(camelKey, customSet)\n\t\t)\n\t\t.map(camelKey => EnvHelper.jsonKeyToEnvVarKey(camelKey, prefix));\n\n\tif (unknown.length > 0) {\n\t\tif (mode === \"error\") {\n\t\t\tthrow new GeneralError(\"node\", \"unknownEnvVars\", { keys: unknown.join(\", \"), prefix });\n\t\t}\n\t\tCLIDisplay.warning(\n\t\t\tI18n.formatMessage(\"warn.node.unknownEnvVars\", { keys: unknown.join(\", \"), prefix })\n\t\t);\n\t}\n}\n\n/**\n * Build the configuration for the TWIN Node.\n * @param processEnv The environment variables from the process.\n * @param options The options for running the server.\n * @param serverInfo The server information.\n * @returns A promise that resolves to the engine server configuration, environment prefix, environment variables,\n * and options.\n */\nexport async function buildConfiguration(\n\tprocessEnv: {\n\t\t[id: string]: string;\n\t},\n\toptions: INodeOptions,\n\tserverInfo: IServerInfo\n): Promise<{\n\tnodeEnvVars: IEnvironmentVariables & { [id: string]: string | unknown };\n\tnodeEngineConfig: INodeEngineConfig;\n\tavailableContextIdKeys: { key: string; requiredHandlerFeatures: string[] }[];\n}> {\n\tconst availableContextIdKeys: { key: string; requiredHandlerFeatures: string[] }[] = [];\n\n\tlet defaultEnvOnly = false;\n\tif (Is.empty(options?.envFilenames)) {\n\t\tconst envFile = path.resolve(path.join(options.executionDirectory ?? \"\", \".env\"));\n\t\tCLIDisplay.value(\"Default Environment File\", envFile);\n\t\toptions ??= {};\n\t\toptions.envFilenames = [envFile];\n\t\tdefaultEnvOnly = true;\n\t}\n\n\tif (Is.arrayValue(options?.envFilenames)) {\n\t\tconst output = dotenv.config({\n\t\t\tpath: options?.envFilenames,\n\t\t\tquiet: true\n\t\t});\n\n\t\t// We don't want to throw an error if the default environment file is not found.\n\t\t// Only if we have custom environment files.\n\t\tif (!defaultEnvOnly && output.error) {\n\t\t\tthrow output.error;\n\t\t}\n\n\t\tif (Is.objectValue(output.parsed)) {\n\t\t\tfor (const [key, value] of Object.entries(output.parsed)) {\n\t\t\t\t// Only set environment variables that are not already set in\n\t\t\t\t// the process environment or provided via options.envVars\n\t\t\t\tprocessEnv[key] ??= value;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst envVars = EnvHelper.envToJson<{ [id: string]: string | unknown }>(\n\t\tprocessEnv,\n\t\toptions.envPrefix ?? \"\"\n\t);\n\n\tvalidateEnvVarKeys(envVars, options.envPrefix ?? \"\", [\n\t\tENGINE_ENVIRONMENT_VARIABLE_KEYS,\n\t\tENGINE_SERVER_ENVIRONMENT_VARIABLE_KEYS,\n\t\tNODE_ENVIRONMENT_VARIABLE_KEYS,\n\t\tBOOTSTRAP_DEV_ENVIRONMENT_VARIABLE_KEYS\n\t]);\n\n\t// Expand any environment variables that use the @file: syntax\n\tconst keys = Object.keys(envVars);\n\tfor (const key of keys) {\n\t\tif (\n\t\t\tIs.stringValue(envVars[key]) &&\n\t\t\t(envVars[key].startsWith(\"@text:\") || envVars[key].startsWith(\"@json:\"))\n\t\t) {\n\t\t\tconst filePath = envVars[key].slice(6).trim();\n\t\t\tconst embeddedFile = path.resolve(path.join(options.executionDirectory ?? \"\", filePath));\n\n\t\t\tif (envVars[key].startsWith(\"@text:\")) {\n\t\t\t\tCLIDisplay.value(`Expanding Environment Variable: ${key} from text file`, embeddedFile);\n\t\t\t\tenvVars[key] = await loadTextFile(embeddedFile);\n\t\t\t} else if (envVars[key].startsWith(\"@json:\")) {\n\t\t\t\tCLIDisplay.value(`Expanding Environment Variable: ${key} from JSON file`, embeddedFile);\n\t\t\t\tenvVars[key] = await loadJsonFile(embeddedFile);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Extend the environment variables with any additional custom configuration.\n\tif (Is.function(options?.extendEnvVars)) {\n\t\tCLIDisplay.task(\"Extending Environment Variables\");\n\t\tawait options.extendEnvVars(envVars);\n\t}\n\n\t// Build the engine configuration from the environment variables.\n\tconst coreConfig = await buildEngineConfiguration(envVars);\n\tconst engineServerConfig = await buildEngineServerConfiguration(\n\t\tenvVars,\n\t\tavailableContextIdKeys,\n\t\tcoreConfig,\n\t\tserverInfo,\n\t\toptions?.openApiSpecFile,\n\t\toptions?.favIconFile\n\t);\n\n\t// Merge any custom configuration provided in the options.\n\tif (Is.arrayValue(options?.configFilenames)) {\n\t\tfor (const configFile of options.configFilenames) {\n\t\t\tCLIDisplay.value(\"Loading Configuration File\", configFile);\n\t\t\tconst configFilePath = path.resolve(path.join(options.executionDirectory ?? \"\", configFile));\n\t\t\tconst config = await loadJsonFile(configFilePath);\n\t\t\tObject.assign(engineServerConfig, config);\n\t\t}\n\t}\n\n\tif (Is.objectValue(options?.config)) {\n\t\tCLIDisplay.task(\"Merging Custom Configuration\");\n\t\tObject.assign(engineServerConfig, options.config);\n\t}\n\n\t// Merge any custom configuration provided in the options.\n\tif (Is.function(options?.extendConfig)) {\n\t\tCLIDisplay.task(\"Extending Configuration\");\n\t\tawait options.extendConfig(envVars, engineServerConfig);\n\t}\n\n\tconst nodeEngineConfig = await extensionsConfiguration(envVars, engineServerConfig);\n\n\treturn { nodeEngineConfig, nodeEnvVars: envVars, availableContextIdKeys };\n}\n\n/**\n * Override module imports to support protocol-based loading (npm:, https:) and local files.\n * @param executionDirectory The execution directory for resolving local module paths.\n * @param envVars The environment variables containing extension configuration (optional, uses defaults if not provided).\n */\nexport function overrideModuleImport(\n\texecutionDirectory: string,\n\tenvVars?: IEnvironmentVariables\n): void {\n\tconst maxSizeMb = Coerce.number(envVars?.extensionsMaxSizeMb) ?? 10;\n\tconst cacheDirectory = envVars?.extensionsCacheDirectory;\n\n\tModuleHelper.overrideImport(async moduleName => {\n\t\tif (moduleCache[moduleName]) {\n\t\t\treturn {\n\t\t\t\tmodule: moduleCache[moduleName],\n\t\t\t\tuseDefault: false\n\t\t\t};\n\t\t}\n\n\t\tconst parsed = parseModuleProtocol(moduleName);\n\t\tlet resolvedPath: string | undefined;\n\n\t\tswitch (parsed.protocol) {\n\t\t\tcase ModuleProtocol.Npm: {\n\t\t\t\tconst result = await handleNpmProtocol(\n\t\t\t\t\tparsed.identifier,\n\t\t\t\t\texecutionDirectory,\n\t\t\t\t\tcacheDirectory\n\t\t\t\t);\n\t\t\t\tresolvedPath = result.resolvedPath;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase ModuleProtocol.Https: {\n\t\t\t\tconst result = await handleHttpsProtocol(\n\t\t\t\t\tparsed.identifier,\n\t\t\t\t\texecutionDirectory,\n\t\t\t\t\tmaxSizeMb,\n\t\t\t\t\tcacheDirectory,\n\t\t\t\t\tenvVars?.extensionsCacheTtlHours,\n\t\t\t\t\tenvVars?.extensionsForceRefresh\n\t\t\t\t);\n\t\t\t\tresolvedPath = result.resolvedPath;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase ModuleProtocol.Http: {\n\t\t\t\tthrow new GeneralError(\"node\", \"insecureProtocol\", { protocol: ModuleProtocol.Http });\n\t\t\t}\n\n\t\t\tcase ModuleProtocol.Local: {\n\t\t\t\tlet localFilename = path.resolve(moduleName);\n\n\t\t\t\tlet exists = await fileExists(localFilename);\n\t\t\t\tif (!exists) {\n\t\t\t\t\tlocalFilename = path.resolve(executionDirectory, moduleName);\n\t\t\t\t\texists = await fileExists(localFilename);\n\t\t\t\t}\n\n\t\t\t\tif (exists) {\n\t\t\t\t\tresolvedPath = localFilename;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase ModuleProtocol.Default: {\n\t\t\t\ttry {\n\t\t\t\t\tconst packagePath = await CLIUtils.findPackageRoot(moduleName, executionDirectory);\n\t\t\t\t\tif (Is.stringValue(packagePath)) {\n\t\t\t\t\t\tconst mainFile = await resolvePackageEntryPoint(packagePath, moduleName);\n\t\t\t\t\t\tconst modulePath = path.resolve(packagePath, mainFile);\n\t\t\t\t\t\tconst exists = await fileExists(modulePath);\n\t\t\t\t\t\tif (exists) {\n\t\t\t\t\t\t\tresolvedPath = modulePath;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// Continue to fallback resolution\n\t\t\t\t}\n\n\t\t\t\t// Fallback: resolve from npm protocol cache directory (installed via handleNpmProtocol)\n\t\t\t\ttry {\n\t\t\t\t\tconst cacheNpmRoot = path.resolve(\n\t\t\t\t\t\tgetExtensionsCacheDir(executionDirectory, ModuleProtocol.Npm, cacheDirectory),\n\t\t\t\t\t\t\"node_modules\"\n\t\t\t\t\t);\n\n\t\t\t\t\tconst packagePath = path.resolve(cacheNpmRoot, moduleName);\n\t\t\t\t\tconst mainFile = await resolvePackageEntryPoint(packagePath, moduleName);\n\t\t\t\t\tconst modulePath = path.resolve(packagePath, mainFile);\n\t\t\t\t\tconst exists = await fileExists(modulePath);\n\t\t\t\t\tif (exists) {\n\t\t\t\t\t\tresolvedPath = modulePath;\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// No cached resolution either; fall through\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Common module loading and caching logic\n\t\tif (resolvedPath) {\n\t\t\tconst module = await import(createModuleImportUrl(resolvedPath));\n\t\t\tmoduleCache[moduleName] = module;\n\t\t\treturn {\n\t\t\t\tmodule,\n\t\t\t\tuseDefault: false\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tmodule: undefined,\n\t\t\tuseDefault: true\n\t\t};\n\t});\n}\n"]}
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/node.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAInF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,uCAAuC,EAAE,MAAM,iDAAiD,CAAC;AAC1G,OAAO,EAAE,oCAAoC,EAAE,MAAM,+CAA+C,CAAC;AACrG,OAAO,EAAE,gCAAgC,EAAE,MAAM,2CAA2C,CAAC;AAC7F,OAAO,EAAE,uCAAuC,EAAE,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AC,CAAC;oBACzE,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;oBACvD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,UAAU,CAAC,CAAC;oBAC5C,IAAI,MAAM,EAAE,CAAC;wBACZ,YAAY,GAAG,UAAU,CAAC;oBAC3B,CAAC;gBACF,CAAC;gBAAC,MAAM,CAAC;oBACR,4CAA4C;gBAC7C,CAAC;gBACD,MAAM;YACP,CAAC;QACF,CAAC;QAED,0CAA0C;QAC1C,IAAI,YAAY,EAAE,CAAC;YAClB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC,CAAC;YACjE,WAAW,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC;YACjC,OAAO;gBACN,MAAM;gBACN,UAAU,EAAE,KAAK;aACjB,CAAC;QACH,CAAC;QAED,OAAO;YACN,MAAM,EAAE,SAAS;YACjB,UAAU,EAAE,IAAI;SAChB,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport path from \"node:path\";\nimport type { IServerInfo } from \"@twin.org/api-models\";\nimport { CLIDisplay, CLIUtils } from \"@twin.org/cli-core\";\nimport { Coerce, EnvHelper, GeneralError, Guards, I18n, Is } from \"@twin.org/core\";\nimport type { Engine } from \"@twin.org/engine\";\nimport type { EngineServer } from \"@twin.org/engine-server\";\nimport type { IEngineServerConfig } from \"@twin.org/engine-server-types\";\nimport { ModuleHelper } from \"@twin.org/modules\";\nimport * as dotenv from \"dotenv\";\nimport { buildEngineConfiguration } from \"./builders/engineEnvBuilder.js\";\nimport { buildEngineServerConfiguration } from \"./builders/engineServerEnvBuilder.js\";\nimport { extensionsConfiguration } from \"./builders/extensionsBuilder.js\";\nimport { commaSeparatedListToArray } from \"./builders/helper/envHelpers.js\";\nimport { constructCliCommand, parseCommandLineArgs, registerCommands } from \"./cli.js\";\nimport { getEnvDefaults } from \"./defaults.js\";\nimport { BOOTSTRAP_DEV_ENVIRONMENT_VARIABLE_KEYS } from \"./models/bootstrapDevEnvironmentVariableKeys.js\";\nimport { DEPRECATED_ENVIRONMENT_VARIABLE_KEYS } from \"./models/deprecatedEnvironmentVariableKeys.js\";\nimport { ENGINE_ENVIRONMENT_VARIABLE_KEYS } from \"./models/engineEnvironmentVariableKeys.js\";\nimport { ENGINE_SERVER_ENVIRONMENT_VARIABLE_KEYS } from \"./models/engineServerEnvironmentVariableKeys.js\";\nimport type { IEnvironmentVariables } from \"./models/IEnvironmentVariables.js\";\nimport type { INodeEngineConfig } from \"./models/INodeEngineConfig.js\";\nimport type { INodeEngineState } from \"./models/INodeEngineState.js\";\nimport type { INodeOptions } from \"./models/INodeOptions.js\";\nimport { ModuleProtocol } from \"./models/moduleProtocol.js\";\nimport { NODE_ENVIRONMENT_VARIABLE_KEYS } from \"./models/nodeEnvironmentVariableKeys.js\";\nimport { start } from \"./start.js\";\nimport {\n\tcreateModuleImportUrl,\n\tfileExists,\n\tgetExecutionDirectory,\n\tgetExtensionsCacheDir,\n\tgetScriptDirectory,\n\thandleHttpsProtocol,\n\thandleNpmProtocol,\n\tinitialiseLocales,\n\tloadJsonFile,\n\tloadTextFile,\n\tparseModuleProtocol,\n\tresolvePackageEntryPoint\n} from \"./utils.js\";\n\nconst moduleCache: { [id: string]: unknown } = {};\n\n/**\n * Run the node.\n * @param nodeOptions Optional configuration options for running the server.\n * @param args Optional command line arguments.\n * @returns A promise that resolves when the server is started containing a shutdown method.\n */\nexport async function run(\n\tnodeOptions?: INodeOptions,\n\targs?: string[]\n): Promise<\n\t| {\n\t\t\tengine: Engine<IEngineServerConfig, INodeEngineState>;\n\t\t\tserver: EngineServer;\n\t\t\tshutdown: () => Promise<void>;\n\t }\n\t| undefined\n> {\n\tlet showErrorDetails = true;\n\tlet debugEnabled = true;\n\ttry {\n\t\tnodeOptions ??= {};\n\n\t\tconst serverInfo: IServerInfo = {\n\t\t\tname: nodeOptions?.serverName ?? \"TWIN Node\",\n\t\t\tversion: nodeOptions?.serverVersion ?? \"0.9.4-next.3\" // x-release-please-version\n\t\t};\n\n\t\tCLIDisplay.header(serverInfo.name, serverInfo.version, \"đŠī¸ \");\n\n\t\tif (!Is.stringValue(nodeOptions?.executionDirectory)) {\n\t\t\tnodeOptions.executionDirectory = getExecutionDirectory();\n\t\t}\n\t\tCLIDisplay.value(\"Execution Directory\", nodeOptions.executionDirectory);\n\n\t\tif (!Is.stringValue(nodeOptions?.scriptDirectory)) {\n\t\t\tnodeOptions.scriptDirectory = getScriptDirectory(args);\n\t\t}\n\t\tCLIDisplay.value(\"Script Directory\", nodeOptions.scriptDirectory);\n\n\t\tnodeOptions.localesDirectory =\n\t\t\tnodeOptions?.localesDirectory ??\n\t\t\tpath.resolve(path.join(nodeOptions.scriptDirectory, \"dist\", \"locales\"));\n\n\t\tCLIDisplay.value(\"Locales Directory\", nodeOptions.localesDirectory);\n\t\tawait initialiseLocales(nodeOptions.localesDirectory);\n\n\t\tnodeOptions.envPrefix ??= \"TWIN_\";\n\n\t\toverrideModuleImport(nodeOptions.executionDirectory ?? \"\");\n\n\t\tconst commandLineArgs = parseCommandLineArgs(args);\n\n\t\tconst hasEnvPrefix = commandLineArgs.options?.find(option => option.key === \"env-prefix\");\n\t\tif (hasEnvPrefix) {\n\t\t\tnodeOptions.envPrefix = Coerce.string(hasEnvPrefix.value) ?? nodeOptions.envPrefix;\n\t\t}\n\n\t\tCLIDisplay.value(\"Environment Variable Prefix\", nodeOptions.envPrefix);\n\n\t\t// This is the only location in the code base that should access process.env directly\n\t\t// So we can safely disable the linting rule here.\n\t\tlet finalEnvVars =\n\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\tprocess.env as {\n\t\t\t\t[id: string]: string;\n\t\t\t};\n\n\t\tif (Is.objectValue(nodeOptions?.envVars)) {\n\t\t\tfinalEnvVars = {\n\t\t\t\t...finalEnvVars,\n\t\t\t\t...nodeOptions.envVars\n\t\t\t};\n\t\t}\n\n\t\tfinalEnvVars = {\n\t\t\t...getEnvDefaults(nodeOptions.envPrefix),\n\t\t\t...finalEnvVars\n\t\t};\n\n\t\tlet cliCommand;\n\t\tif (Is.arrayValue(commandLineArgs.options)) {\n\t\t\tregisterCommands();\n\t\t\tcliCommand = constructCliCommand(finalEnvVars, commandLineArgs);\n\t\t}\n\n\t\tif (Is.object(cliCommand)) {\n\t\t\tfinalEnvVars[`${nodeOptions.envPrefix}SILENT`] ??= \"true\";\n\t\t} else {\n\t\t\tif (Is.empty(nodeOptions?.openApiSpecFile)) {\n\t\t\t\tconst specFile = path.resolve(\n\t\t\t\t\tpath.join(nodeOptions.scriptDirectory ?? \"\", \"docs\", \"open-api\", \"spec.json\")\n\t\t\t\t);\n\t\t\t\tif (await fileExists(specFile)) {\n\t\t\t\t\tnodeOptions ??= {};\n\t\t\t\t\tnodeOptions.openApiSpecFile = specFile;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (Is.stringValue(nodeOptions.openApiSpecFile)) {\n\t\t\t\tCLIDisplay.value(\"OpenAPI Spec File\", nodeOptions.openApiSpecFile);\n\t\t\t}\n\n\t\t\tif (Is.empty(nodeOptions?.favIconFile)) {\n\t\t\t\tconst favIconFile = path.resolve(\n\t\t\t\t\tpath.join(nodeOptions.scriptDirectory ?? \"\", \"static\", \"favicon.png\")\n\t\t\t\t);\n\t\t\t\tif (await fileExists(favIconFile)) {\n\t\t\t\t\tnodeOptions ??= {};\n\t\t\t\t\tnodeOptions.favIconFile = favIconFile;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (Is.stringValue(nodeOptions.favIconFile)) {\n\t\t\t\tCLIDisplay.value(\"Favicon File\", nodeOptions.favIconFile);\n\t\t\t}\n\t\t}\n\n\t\tconst { nodeEngineConfig, nodeEnvVars, availableContextIdKeys } = await buildConfiguration(\n\t\t\tfinalEnvVars,\n\t\t\tnodeOptions,\n\t\t\tserverInfo\n\t\t);\n\n\t\tdebugEnabled = Coerce.boolean(nodeEnvVars.debug) ?? debugEnabled;\n\n\t\tCLIDisplay.break();\n\n\t\tconst startResult = await start(\n\t\t\tnodeOptions,\n\t\t\tnodeEngineConfig,\n\t\t\tnodeEnvVars,\n\t\t\tcliCommand,\n\t\t\tavailableContextIdKeys\n\t\t);\n\n\t\tif (Is.notEmpty(startResult)) {\n\t\t\tshowErrorDetails = false;\n\n\t\t\tlet isShuttingDown = false;\n\t\t\tfor (const signal of [\"SIGHUP\", \"SIGINT\", \"SIGTERM\"]) {\n\t\t\t\tprocess.on(signal, async () => {\n\t\t\t\t\tif (!isShuttingDown) {\n\t\t\t\t\t\tisShuttingDown = true;\n\t\t\t\t\t\tCLIDisplay.value(\"Terminate Signal\", signal);\n\t\t\t\t\t\tawait startResult.shutdown();\n\t\t\t\t\t\tprocess.exit(0);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn startResult;\n\t} catch (err) {\n\t\tif (nodeOptions?.disableProcessExitOnFailure ?? false) {\n\t\t\tthrow err;\n\t\t}\n\n\t\tif (showErrorDetails) {\n\t\t\tCLIDisplay.error(err, true, { includeAdditional: true, includeStack: debugEnabled });\n\t\t}\n\n\t\t// eslint-disable-next-line unicorn/no-process-exit\n\t\tprocess.exit(1);\n\t}\n}\n\n/**\n * Test whether a camelCase key matches an entry in a pattern set.\n * Entries ending with \"*\" are treated as prefix patterns; all others require an exact match.\n * @param camelKey The camelCase key to test.\n * @param patternSet The set of exact keys and/or wildcard patterns (e.g. \"restPath*\").\n * @returns True if the key matches any entry.\n */\nfunction matchesPatternSet(\n\tcamelKey: string,\n\tpatternSet: ReadonlySet<string> | Set<string>\n): boolean {\n\tif (patternSet.has(camelKey)) {\n\t\treturn true;\n\t}\n\tfor (const pattern of patternSet) {\n\t\tif (pattern.endsWith(\"*\") && camelKey.startsWith(pattern.slice(0, -1))) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n/**\n * Report any environment variables which are still recognised but no longer used.\n * @param envVars The already-converted camelCase env variables.\n * @param prefix The prefix used for the environment variables (e.g. \"TWIN_\").\n */\nfunction warnDeprecatedEnvVarKeys(\n\tenvVars: { [id: string]: string | unknown },\n\tprefix: string\n): void {\n\tfor (const camelKey of Object.keys(envVars)) {\n\t\tconst replacements = DEPRECATED_ENVIRONMENT_VARIABLE_KEYS.get(camelKey);\n\t\tif (!Is.undefined(replacements)) {\n\t\t\tconst key = EnvHelper.jsonKeyToEnvVarKey(camelKey, prefix);\n\n\t\t\tif (Is.arrayValue(replacements)) {\n\t\t\t\tCLIDisplay.warning(\n\t\t\t\t\tI18n.formatMessage(\"warn.node.deprecatedEnvVar\", {\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\treplacements: replacements\n\t\t\t\t\t\t\t.map(replacement => EnvHelper.jsonKeyToEnvVarKey(replacement, prefix))\n\t\t\t\t\t\t\t.join(\", \")\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tCLIDisplay.warning(I18n.formatMessage(\"warn.node.deprecatedEnvVarNoReplacement\", { key }));\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Validate that every key in envVars maps to a recognised property.\n * All unknown keys are collected, then reported together as a single error or warning.\n * Raw env var names listed in the allow list (e.g. TWIN_MY_EXTENSION_SECRET, TWIN_REST_PATH_*) are always accepted.\n * Wildcard patterns ending with * are supported in both allow sets and the allow list.\n * @param envVars The already-converted camelCase env variables.\n * @param prefix The prefix used for the environment variables (e.g. \"TWIN_\").\n * @param allowSets An array of sets of allowed keys and/or wildcard patterns.\n * @throws GeneralError If any unknown env var properties are found and strict mode is \"error\", or if the strict mode value is invalid.\n */\nfunction validateEnvVarKeys(\n\tenvVars: { [id: string]: string | unknown },\n\tprefix: string,\n\tallowSets: ReadonlySet<string>[]\n): void {\n\tconst mode = Is.stringValue(envVars.strictEnv) ? envVars.strictEnv : \"error\";\n\tGuards.arrayOneOf(\"node\", `${prefix}STRICT_ENV`, mode, [\"error\", \"warn\", \"ignore\"]);\n\n\tif (mode === \"ignore\") {\n\t\treturn;\n\t}\n\n\tconst customSet = new Set(\n\t\tcommaSeparatedListToArray<string>(envVars.envAllowList as string).map(k =>\n\t\t\tEnvHelper.envVarKeyToJsonKey(k.trim(), prefix)\n\t\t)\n\t);\n\n\tconst unknown = Object.keys(envVars)\n\t\t.filter(\n\t\t\tcamelKey =>\n\t\t\t\t!allowSets.some(set => matchesPatternSet(camelKey, set)) &&\n\t\t\t\t!matchesPatternSet(camelKey, customSet) &&\n\t\t\t\t!DEPRECATED_ENVIRONMENT_VARIABLE_KEYS.has(camelKey)\n\t\t)\n\t\t.map(camelKey => EnvHelper.jsonKeyToEnvVarKey(camelKey, prefix));\n\n\tif (unknown.length > 0) {\n\t\tif (mode === \"error\") {\n\t\t\tthrow new GeneralError(\"node\", \"unknownEnvVars\", { keys: unknown.join(\", \"), prefix });\n\t\t}\n\t\tCLIDisplay.warning(\n\t\t\tI18n.formatMessage(\"warn.node.unknownEnvVars\", { keys: unknown.join(\", \"), prefix })\n\t\t);\n\t}\n}\n\n/**\n * Build the configuration for the TWIN Node.\n * @param processEnv The environment variables from the process.\n * @param options The options for running the server.\n * @param serverInfo The server information.\n * @returns A promise that resolves to the engine server configuration, environment prefix, environment variables,\n * and options.\n */\nexport async function buildConfiguration(\n\tprocessEnv: {\n\t\t[id: string]: string;\n\t},\n\toptions: INodeOptions,\n\tserverInfo: IServerInfo\n): Promise<{\n\tnodeEnvVars: IEnvironmentVariables & { [id: string]: string | unknown };\n\tnodeEngineConfig: INodeEngineConfig;\n\tavailableContextIdKeys: { key: string; requiredHandlerFeatures: string[] }[];\n}> {\n\tconst availableContextIdKeys: { key: string; requiredHandlerFeatures: string[] }[] = [];\n\n\tlet defaultEnvOnly = false;\n\tif (Is.empty(options?.envFilenames)) {\n\t\tconst envFile = path.resolve(path.join(options.executionDirectory ?? \"\", \".env\"));\n\t\tCLIDisplay.value(\"Default Environment File\", envFile);\n\t\toptions ??= {};\n\t\toptions.envFilenames = [envFile];\n\t\tdefaultEnvOnly = true;\n\t}\n\n\tif (Is.arrayValue(options?.envFilenames)) {\n\t\tconst output = dotenv.config({\n\t\t\tpath: options?.envFilenames,\n\t\t\tquiet: true\n\t\t});\n\n\t\t// We don't want to throw an error if the default environment file is not found.\n\t\t// Only if we have custom environment files.\n\t\tif (!defaultEnvOnly && output.error) {\n\t\t\tthrow output.error;\n\t\t}\n\n\t\tif (Is.objectValue(output.parsed)) {\n\t\t\tfor (const [key, value] of Object.entries(output.parsed)) {\n\t\t\t\t// Only set environment variables that are not already set in\n\t\t\t\t// the process environment or provided via options.envVars\n\t\t\t\tprocessEnv[key] ??= value;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst envVars = EnvHelper.envToJson<{ [id: string]: string | unknown }>(\n\t\tprocessEnv,\n\t\toptions.envPrefix ?? \"\"\n\t);\n\n\twarnDeprecatedEnvVarKeys(envVars, options.envPrefix ?? \"\");\n\n\tvalidateEnvVarKeys(envVars, options.envPrefix ?? \"\", [\n\t\tENGINE_ENVIRONMENT_VARIABLE_KEYS,\n\t\tENGINE_SERVER_ENVIRONMENT_VARIABLE_KEYS,\n\t\tNODE_ENVIRONMENT_VARIABLE_KEYS,\n\t\tBOOTSTRAP_DEV_ENVIRONMENT_VARIABLE_KEYS\n\t]);\n\n\t// Expand any environment variables that use the @file: syntax\n\tconst keys = Object.keys(envVars);\n\tfor (const key of keys) {\n\t\tif (\n\t\t\tIs.stringValue(envVars[key]) &&\n\t\t\t(envVars[key].startsWith(\"@text:\") || envVars[key].startsWith(\"@json:\"))\n\t\t) {\n\t\t\tconst filePath = envVars[key].slice(6).trim();\n\t\t\tconst embeddedFile = path.resolve(path.join(options.executionDirectory ?? \"\", filePath));\n\n\t\t\tif (envVars[key].startsWith(\"@text:\")) {\n\t\t\t\tCLIDisplay.value(`Expanding Environment Variable: ${key} from text file`, embeddedFile);\n\t\t\t\tenvVars[key] = await loadTextFile(embeddedFile);\n\t\t\t} else if (envVars[key].startsWith(\"@json:\")) {\n\t\t\t\tCLIDisplay.value(`Expanding Environment Variable: ${key} from JSON file`, embeddedFile);\n\t\t\t\tenvVars[key] = await loadJsonFile(embeddedFile);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Extend the environment variables with any additional custom configuration.\n\tif (Is.function(options?.extendEnvVars)) {\n\t\tCLIDisplay.task(\"Extending Environment Variables\");\n\t\tawait options.extendEnvVars(envVars);\n\t}\n\n\t// Build the engine configuration from the environment variables.\n\tconst coreConfig = await buildEngineConfiguration(envVars);\n\tconst engineServerConfig = await buildEngineServerConfiguration(\n\t\tenvVars,\n\t\tavailableContextIdKeys,\n\t\tcoreConfig,\n\t\tserverInfo,\n\t\toptions?.openApiSpecFile,\n\t\toptions?.favIconFile\n\t);\n\n\t// Merge any custom configuration provided in the options.\n\tif (Is.arrayValue(options?.configFilenames)) {\n\t\tfor (const configFile of options.configFilenames) {\n\t\t\tCLIDisplay.value(\"Loading Configuration File\", configFile);\n\t\t\tconst configFilePath = path.resolve(path.join(options.executionDirectory ?? \"\", configFile));\n\t\t\tconst config = await loadJsonFile(configFilePath);\n\t\t\tObject.assign(engineServerConfig, config);\n\t\t}\n\t}\n\n\tif (Is.objectValue(options?.config)) {\n\t\tCLIDisplay.task(\"Merging Custom Configuration\");\n\t\tObject.assign(engineServerConfig, options.config);\n\t}\n\n\t// Merge any custom configuration provided in the options.\n\tif (Is.function(options?.extendConfig)) {\n\t\tCLIDisplay.task(\"Extending Configuration\");\n\t\tawait options.extendConfig(envVars, engineServerConfig);\n\t}\n\n\tconst nodeEngineConfig = await extensionsConfiguration(envVars, engineServerConfig);\n\n\treturn { nodeEngineConfig, nodeEnvVars: envVars, availableContextIdKeys };\n}\n\n/**\n * Override module imports to support protocol-based loading (npm:, https:) and local files.\n * @param executionDirectory The execution directory for resolving local module paths.\n * @param envVars The environment variables containing extension configuration (optional, uses defaults if not provided).\n */\nexport function overrideModuleImport(\n\texecutionDirectory: string,\n\tenvVars?: IEnvironmentVariables\n): void {\n\tconst maxSizeMb = Coerce.number(envVars?.extensionsMaxSizeMb) ?? 10;\n\tconst cacheDirectory = envVars?.extensionsCacheDirectory;\n\n\tModuleHelper.overrideImport(async moduleName => {\n\t\tif (moduleCache[moduleName]) {\n\t\t\treturn {\n\t\t\t\tmodule: moduleCache[moduleName],\n\t\t\t\tuseDefault: false\n\t\t\t};\n\t\t}\n\n\t\tconst parsed = parseModuleProtocol(moduleName);\n\t\tlet resolvedPath: string | undefined;\n\n\t\tswitch (parsed.protocol) {\n\t\t\tcase ModuleProtocol.Npm: {\n\t\t\t\tconst result = await handleNpmProtocol(\n\t\t\t\t\tparsed.identifier,\n\t\t\t\t\texecutionDirectory,\n\t\t\t\t\tcacheDirectory\n\t\t\t\t);\n\t\t\t\tresolvedPath = result.resolvedPath;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase ModuleProtocol.Https: {\n\t\t\t\tconst result = await handleHttpsProtocol(\n\t\t\t\t\tparsed.identifier,\n\t\t\t\t\texecutionDirectory,\n\t\t\t\t\tmaxSizeMb,\n\t\t\t\t\tcacheDirectory,\n\t\t\t\t\tenvVars?.extensionsCacheTtlHours,\n\t\t\t\t\tenvVars?.extensionsForceRefresh\n\t\t\t\t);\n\t\t\t\tresolvedPath = result.resolvedPath;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase ModuleProtocol.Http: {\n\t\t\t\tthrow new GeneralError(\"node\", \"insecureProtocol\", { protocol: ModuleProtocol.Http });\n\t\t\t}\n\n\t\t\tcase ModuleProtocol.Local: {\n\t\t\t\tlet localFilename = path.resolve(moduleName);\n\n\t\t\t\tlet exists = await fileExists(localFilename);\n\t\t\t\tif (!exists) {\n\t\t\t\t\tlocalFilename = path.resolve(executionDirectory, moduleName);\n\t\t\t\t\texists = await fileExists(localFilename);\n\t\t\t\t}\n\n\t\t\t\tif (exists) {\n\t\t\t\t\tresolvedPath = localFilename;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase ModuleProtocol.Default: {\n\t\t\t\ttry {\n\t\t\t\t\tconst packagePath = await CLIUtils.findPackageRoot(moduleName, executionDirectory);\n\t\t\t\t\tif (Is.stringValue(packagePath)) {\n\t\t\t\t\t\tconst mainFile = await resolvePackageEntryPoint(packagePath, moduleName);\n\t\t\t\t\t\tconst modulePath = path.resolve(packagePath, mainFile);\n\t\t\t\t\t\tconst exists = await fileExists(modulePath);\n\t\t\t\t\t\tif (exists) {\n\t\t\t\t\t\t\tresolvedPath = modulePath;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// Continue to fallback resolution\n\t\t\t\t}\n\n\t\t\t\t// Fallback: resolve from npm protocol cache directory (installed via handleNpmProtocol)\n\t\t\t\ttry {\n\t\t\t\t\tconst cacheNpmRoot = path.resolve(\n\t\t\t\t\t\tgetExtensionsCacheDir(executionDirectory, ModuleProtocol.Npm, cacheDirectory),\n\t\t\t\t\t\t\"node_modules\"\n\t\t\t\t\t);\n\n\t\t\t\t\tconst packagePath = path.resolve(cacheNpmRoot, moduleName);\n\t\t\t\t\tconst mainFile = await resolvePackageEntryPoint(packagePath, moduleName);\n\t\t\t\t\tconst modulePath = path.resolve(packagePath, mainFile);\n\t\t\t\t\tconst exists = await fileExists(modulePath);\n\t\t\t\t\tif (exists) {\n\t\t\t\t\t\tresolvedPath = modulePath;\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// No cached resolution either; fall through\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Common module loading and caching logic\n\t\tif (resolvedPath) {\n\t\t\tconst module = await import(createModuleImportUrl(resolvedPath));\n\t\t\tmoduleCache[moduleName] = module;\n\t\t\treturn {\n\t\t\t\tmodule,\n\t\t\t\tuseDefault: false\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tmodule: undefined,\n\t\t\tuseDefault: true\n\t\t};\n\t});\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The camelCase property names which are no longer used, mapped to the keys which replace them.
|
|
3
|
+
* They are still recognised so an existing configuration does not fail validation, but each one
|
|
4
|
+
* reports a deprecation warning and has no effect on the engine configuration.
|
|
5
|
+
* An empty array is a key which has been withdrawn with nothing to replace it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEPRECATED_ENVIRONMENT_VARIABLE_KEYS: ReadonlyMap<string, readonly string[]>;
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.9.4-next.3](https://github.com/iotaledger/twin-node/compare/node-core-v0.9.4-next.2...node-core-v0.9.4-next.3) (2026-09-09)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* update components ([a2643b9](https://github.com/iotaledger/twin-node/commit/a2643b9ce7e338e4853237a6daba7fa58d9fc5c8))
|
|
9
|
+
|
|
10
|
+
## [0.9.4-next.2](https://github.com/iotaledger/twin-node/compare/node-core-v0.9.4-next.1...node-core-v0.9.4-next.2) (2026-09-08)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* telemetry and deprecated variables ([198f43f](https://github.com/iotaledger/twin-node/commit/198f43fd2d94e2f6721924365b73c0af3020e31d))
|
|
16
|
+
|
|
3
17
|
## [0.9.4-next.1](https://github.com/iotaledger/twin-node/compare/node-core-v0.9.4-next.0...node-core-v0.9.4-next.1) (2026-09-07)
|
|
4
18
|
|
|
5
19
|
|
package/locales/en.json
CHANGED
|
@@ -98,7 +98,9 @@
|
|
|
98
98
|
},
|
|
99
99
|
"warn": {
|
|
100
100
|
"node": {
|
|
101
|
-
"unknownEnvVars": "Unknown environment variable properties [{keys}], they will be ignored. Check for typos in variable names, for custom variables use the {prefix}ENV_ALLOW_LIST."
|
|
101
|
+
"unknownEnvVars": "Unknown environment variable properties [{keys}], they will be ignored. Check for typos in variable names, for custom variables use the {prefix}ENV_ALLOW_LIST.",
|
|
102
|
+
"deprecatedEnvVar": "The environment variable \"{key}\" is deprecated and no longer has any effect, please use {replacements} instead. This variable will be removed in a future release.",
|
|
103
|
+
"deprecatedEnvVarNoReplacement": "The environment variable \"{key}\" is deprecated and no longer has any effect. This variable will be removed in a future release."
|
|
102
104
|
}
|
|
103
105
|
},
|
|
104
106
|
"node": {
|