@twin.org/node-core 0.9.4 → 0.9.5-next.1

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.
Files changed (48) hide show
  1. package/dist/es/builders/engineEnvBuilder.js +478 -378
  2. package/dist/es/builders/engineEnvBuilder.js.map +1 -1
  3. package/dist/es/builders/engineServerEnvBuilder.js +5 -2
  4. package/dist/es/builders/engineServerEnvBuilder.js.map +1 -1
  5. package/dist/es/builders/helper/envHelpers.js +40 -9
  6. package/dist/es/builders/helper/envHelpers.js.map +1 -1
  7. package/dist/es/cli.js +1 -1
  8. package/dist/es/cli.js.map +1 -1
  9. package/dist/es/commands/bootstrapDev.js +3 -3
  10. package/dist/es/commands/bootstrapDev.js.map +1 -1
  11. package/dist/es/commands/help.js +1 -1
  12. package/dist/es/commands/help.js.map +1 -1
  13. package/dist/es/commands/identityCreate.js +2 -2
  14. package/dist/es/commands/identityCreate.js.map +1 -1
  15. package/dist/es/commands/identityVerificationMethodCreate.js +2 -2
  16. package/dist/es/commands/identityVerificationMethodCreate.js.map +1 -1
  17. package/dist/es/commands/userCreate.js +1 -1
  18. package/dist/es/commands/userCreate.js.map +1 -1
  19. package/dist/es/commands/vaultKeyCreate.js +1 -1
  20. package/dist/es/commands/vaultKeyCreate.js.map +1 -1
  21. package/dist/es/commands/vaultKeyImport.js +1 -1
  22. package/dist/es/commands/vaultKeyImport.js.map +1 -1
  23. package/dist/es/defaults.js +17 -0
  24. package/dist/es/defaults.js.map +1 -1
  25. package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -1
  26. package/dist/es/models/IEngineServerEnvironmentVariables.js.map +1 -1
  27. package/dist/es/models/deprecatedEnvironmentVariableKeys.js +16 -0
  28. package/dist/es/models/deprecatedEnvironmentVariableKeys.js.map +1 -0
  29. package/dist/es/models/engineEnvironmentVariableKeys.js +19 -5
  30. package/dist/es/models/engineEnvironmentVariableKeys.js.map +1 -1
  31. package/dist/es/models/engineServerEnvironmentVariableKeys.js +1 -0
  32. package/dist/es/models/engineServerEnvironmentVariableKeys.js.map +1 -1
  33. package/dist/es/node.js +40 -21
  34. package/dist/es/node.js.map +1 -1
  35. package/dist/types/builders/engineEnvBuilder.d.ts +7 -0
  36. package/dist/types/builders/helper/envHelpers.d.ts +59 -2
  37. package/dist/types/defaults.d.ts +8 -0
  38. package/dist/types/models/IEngineEnvironmentVariables.d.ts +77 -18
  39. package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +4 -0
  40. package/dist/types/models/deprecatedEnvironmentVariableKeys.d.ts +7 -0
  41. package/docs/changelog.md +162 -0
  42. package/docs/reference/functions/isMailboxEnabled.md +20 -0
  43. package/docs/reference/index.md +2 -0
  44. package/docs/reference/interfaces/IEngineEnvironmentVariables.md +159 -32
  45. package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +8 -0
  46. package/docs/reference/variables/DEFAULT_HEALTH_EXCLUDE_CLONE_COMPONENTS.md +9 -0
  47. package/locales/en.json +3 -1
  48. package/package.json +34 -34
@@ -1,15 +1,16 @@
1
1
  // Copyright 2024 IOTA Stiftung.
2
2
  // SPDX-License-Identifier: Apache-2.0.
3
+ import { cpus } from "node:os";
3
4
  import path from "node:path";
4
5
  import { Is, Mutex } from "@twin.org/core";
5
6
  import { EngineCloneMode } from "@twin.org/engine-models";
6
- import { AttestationComponentType, AttestationConnectorType, AuditableItemGraphComponentType, AuditableItemStreamComponentType, AutomationComponentType, BackgroundTaskComponentType, BlobStorageComponentType, BlobStorageConnectorType, ContextIdHandlerComponentType, DataProcessingComponentType, DataspaceControlPlaneComponentType, DataspaceDataPlaneComponentType, DltConfigType, DocumentManagementComponentType, EngineTypeHelper, EntityStorageConnectorType, EventBusComponentType, EventBusConnectorType, FaucetConnectorType, FederatedCatalogueComponentType, HealthComponentType, IdentityComponentType, IdentityConnectorType, IdentityProfileComponentType, IdentityProfileConnectorType, IdentityResolverComponentType, IdentityResolverConnectorType, ImmutableProofComponentType, LoggingComponentType, LoggingConnectorType, MessagingAdminComponentType, MessagingComponentType, MessagingEmailConnectorType, MessagingPushNotificationConnectorType, MessagingSmsConnectorType, MetricsCollectorComponentType, MetricsProducerComponentType, NftComponentType, NftConnectorType, NotarizationComponentType, NotarizationConnectorType, PlatformComponentType, RightsManagementPapComponentType, RightsManagementPdpComponentType, RightsManagementPepComponentType, RightsManagementPipComponentType, RightsManagementPmpComponentType, RightsManagementPnapComponentType, RightsManagementPnpComponentType, RightsManagementPxpComponentType, SchemaVersionMigrationComponentType, TaskSchedulerComponentType, TelemetryComponentType, TelemetryConnectorType, TenantAdminComponentType, TracingComponentType, TracingConnectorType, TrustComponentType, TrustVerifierComponentType, VaultConnectorType, WalletConnectorType } from "@twin.org/engine-types";
7
+ import { AttestationComponentType, AttestationConnectorType, AuditableItemGraphComponentType, AuditableItemStreamComponentType, AutomationActionType, AutomationComponentType, BackgroundTaskComponentType, BlobStorageComponentType, BlobStorageConnectorType, ContextIdHandlerComponentType, DataConverterConnectorType, DataExtractorConnectorType, DataProcessingComponentType, DataspaceControlPlaneComponentType, DataspaceDataPlaneComponentType, DltConfigType, DocumentManagementComponentType, EmailProtocolConnectorType, EngineTypeHelper, EntityStorageConnectorType, EventBusComponentType, EventBusConnectorType, FaucetConnectorType, FederatedCatalogueComponentType, FederatedCatalogueFilterComponentType, HealthComponentType, IdentityComponentType, IdentityConnectorType, IdentityProfileComponentType, IdentityProfileConnectorType, IdentityResolverComponentType, IdentityResolverConnectorType, ImmutableProofComponentType, LoggingComponentType, LoggingConnectorType, MailboxComponentType, MailStorageComponentType, MessagingAdminComponentType, MessagingComponentType, MessagingEmailConnectorType, MessagingPushNotificationConnectorType, MessagingSmsConnectorType, MetricsCollectorComponentType, MetricsProducerComponentType, NftComponentType, NftConnectorType, NotarizationComponentType, NotarizationConnectorType, PlatformComponentType, RightsManagementPapComponentType, RightsManagementPdpComponentType, RightsManagementPepComponentType, RightsManagementPipComponentType, RightsManagementPmpComponentType, RightsManagementPnapComponentType, RightsManagementPnpComponentType, RightsManagementPolicyArbiterComponentType, RightsManagementPolicyEnforcementProcessorComponentType, RightsManagementPolicyExecutionActionComponentType, RightsManagementPolicyInformationSourceComponentType, RightsManagementPolicyNegotiatorComponentType, RightsManagementPolicyObligationEnforcerComponentType, RightsManagementPolicyRequesterComponentType, RightsManagementPxpComponentType, SchemaVersionMigrationComponentType, TaskSchedulerComponentType, TelemetryComponentType, TelemetryConnectorType, TenantAdminComponentType, TracingComponentType, TracingConnectorType, TrustComponentType, TrustGeneratorComponentType, TrustVerifierComponentType, VaultConnectorType, WalletConnectorType } from "@twin.org/engine-types";
7
8
  import { OpenTelemetryExporterTypes } from "@twin.org/logging-connector-opentelemetry";
8
9
  import { OpenTelemetryReaderTypes } from "@twin.org/telemetry-connector-opentelemetry";
9
10
  import { OpenTelemetryProcessorTypes } from "@twin.org/tracing-connector-opentelemetry";
10
- import { CONTEXT_ID_HANDLER_FEATURE_DID, CONTEXT_ID_HANDLER_FEATURE_TENANT } from "../defaults.js";
11
+ import { CONTEXT_ID_HANDLER_FEATURE_DID, CONTEXT_ID_HANDLER_FEATURE_TENANT, DEFAULT_HEALTH_EXCLUDE_CLONE_COMPONENTS } from "../defaults.js";
11
12
  import { isAuthEntityStorageRequired } from "./engineServerEnvBuilder.js";
12
- import { commaSeparatedListToArray, envArray, envBoolean, envCount, envDateTime, envInteger, envMinToMs, envMinutes, envMs, envSecToMs, envSeconds } from "./helper/envHelpers.js";
13
+ import { commaSeparatedListToArray, envArray, envBoolean, envChoice, envCount, envDateTime, envInteger, envListToArray, envMinToMs, envMinutes, envMs, envSecToMs, envSeconds } from "./helper/envHelpers.js";
13
14
  /**
14
15
  * Build the engine core configuration from environment variables.
15
16
  * @param envVars The environment variables.
@@ -32,7 +33,7 @@ export async function buildEngineConfiguration(envVars) {
32
33
  types: {}
33
34
  };
34
35
  const mutexTimeoutMs = envMs(envVars, "mutexTimeoutDefault");
35
- if (!Is.empty(mutexTimeoutMs)) {
36
+ if (Is.notEmpty(mutexTimeoutMs)) {
36
37
  Mutex.setDefaultTimeoutMs(mutexTimeoutMs);
37
38
  }
38
39
  await configureSchemaMigration(coreConfig, envVars);
@@ -51,6 +52,7 @@ export async function buildEngineConfiguration(envVars) {
51
52
  await configureMetricsCollector(coreConfig, envVars);
52
53
  await configureTracing(coreConfig, envVars);
53
54
  await configureMessaging(coreConfig, envVars);
55
+ await configureMailbox(coreConfig, envVars);
54
56
  await configureAutomation(coreConfig, envVars);
55
57
  await configureHealth(coreConfig, envVars);
56
58
  await configureFaucet(coreConfig, envVars);
@@ -81,163 +83,165 @@ export async function buildEngineConfiguration(envVars) {
81
83
  async function configureEntityStorage(coreConfig, envVars) {
82
84
  coreConfig.types ??= {};
83
85
  coreConfig.types.entityStorageConnector ??= [];
84
- const entityStorageConnectorTypes = commaSeparatedListToArray(envVars.entityStorageConnectorType);
85
- if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.Memory)) {
86
- coreConfig.types.entityStorageConnector.push({
87
- type: EntityStorageConnectorType.Memory,
88
- options: {
89
- config: {
90
- mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
91
- }
92
- }
93
- });
94
- }
95
- if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.File)) {
96
- coreConfig.types.entityStorageConnector.push({
97
- type: EntityStorageConnectorType.File,
98
- options: {
99
- config: {
100
- directory: envVars.storageFileRoot ?? "",
101
- mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
102
- },
103
- folderPrefix: envVars.entityStorageTablePrefix
104
- }
105
- });
106
- }
107
- if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.AwsDynamoDb)) {
108
- coreConfig.types.entityStorageConnector.push({
109
- type: EntityStorageConnectorType.AwsDynamoDb,
110
- options: {
111
- config: {
112
- region: envVars.awsDynamodbRegion ?? "",
113
- authMode: envVars.awsDynamodbAuthMode,
114
- accessKeyId: envVars.awsDynamodbAccessKeyId,
115
- secretAccessKey: envVars.awsDynamodbSecretAccessKey,
116
- endpoint: envVars.awsDynamodbEndpoint,
117
- connectionTimeoutMs: envMs(envVars, "awsDynamodbConnectionTimeout"),
118
- mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
119
- },
120
- tablePrefix: envVars.entityStorageTablePrefix
121
- }
122
- });
123
- }
124
- if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.AzureCosmosDb)) {
125
- coreConfig.types.entityStorageConnector.push({
126
- type: EntityStorageConnectorType.AzureCosmosDb,
127
- options: {
128
- config: {
129
- endpoint: envVars.azureCosmosdbEndpoint ?? "",
130
- key: envVars.azureCosmosdbKey ?? "",
131
- databaseId: envVars.azureCosmosdbDatabaseId ?? "",
132
- containerId: envVars.azureCosmosdbContainerId ?? "",
133
- mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
134
- },
135
- tablePrefix: envVars.entityStorageTablePrefix
136
- }
137
- });
138
- }
139
- if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.GcpFirestoreDb)) {
140
- coreConfig.types.entityStorageConnector.push({
141
- type: EntityStorageConnectorType.GcpFirestoreDb,
142
- options: {
143
- config: {
144
- projectId: envVars.gcpFirestoreProjectId ?? "",
145
- credentials: envVars.gcpFirestoreCredentials ?? "",
146
- databaseId: envVars.gcpFirestoreDatabaseId ?? "",
147
- collectionName: envVars.gcpFirestoreCollectionName ?? "",
148
- endpoint: envVars.gcpFirestoreEndpoint ?? "",
149
- mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
150
- },
151
- tablePrefix: envVars.entityStorageTablePrefix
152
- }
153
- });
154
- }
155
- if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.ScyllaDb)) {
156
- coreConfig.types.entityStorageConnector.push({
157
- type: EntityStorageConnectorType.ScyllaDb,
158
- options: {
159
- config: {
160
- hosts: commaSeparatedListToArray(envVars.scylladbHosts),
161
- localDataCenter: envVars.scylladbLocalDataCenter ?? "",
162
- keyspace: envVars.scylladbKeyspace ?? "",
163
- port: envInteger(envVars, "scylladbPort"),
164
- mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout"),
165
- pool: {
166
- coreConnectionsPerHost: envCount(envVars, "scylladbPoolCoreConnectionsPerHost"),
167
- maxRequestsPerConnection: envCount(envVars, "scylladbPoolMaxRequestsPerConnection")
168
- }
169
- },
170
- tablePrefix: envVars.entityStorageTablePrefix
171
- }
172
- });
173
- }
174
- if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.MySqlDb)) {
175
- coreConfig.types.entityStorageConnector.push({
176
- type: EntityStorageConnectorType.MySqlDb,
177
- options: {
178
- config: {
179
- host: envVars.mySqlHost ?? "",
180
- port: envInteger(envVars, "mySqlPort"),
181
- user: envVars.mySqlUser ?? "",
182
- password: envVars.mySqlPassword ?? "",
183
- database: envVars.mySqlDatabase ?? "",
184
- mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout"),
185
- pool: {
186
- connectionLimit: envCount(envVars, "mySqlPoolConnectionLimit"),
187
- maxIdle: envCount(envVars, "mySqlPoolMaxIdle"),
188
- idleTimeout: envMs(envVars, "mySqlPoolIdleTimeout"),
189
- enableKeepAlive: envBoolean(envVars, "mySqlPoolEnableKeepAlive"),
190
- waitForConnections: envBoolean(envVars, "mySqlPoolWaitForConnections"),
191
- queueLimit: envCount(envVars, "mySqlPoolQueueLimit")
192
- }
193
- },
194
- tablePrefix: envVars.entityStorageTablePrefix
195
- }
196
- });
197
- }
198
- if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.MongoDb)) {
199
- coreConfig.types.entityStorageConnector.push({
200
- type: EntityStorageConnectorType.MongoDb,
201
- options: {
202
- config: {
203
- host: envVars.mongoDbHost ?? "",
204
- port: envInteger(envVars, "mongoDbPort"),
205
- user: envVars.mongoDbUser ?? "",
206
- password: envVars.mongoDbPassword ?? "",
207
- database: envVars.mongoDbDatabase ?? "",
208
- mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout"),
209
- pool: {
210
- maxPoolSize: envCount(envVars, "mongoDbPoolMaxPoolSize"),
211
- minPoolSize: envCount(envVars, "mongoDbPoolMinPoolSize"),
212
- maxIdleTimeMs: envMs(envVars, "mongoDbPoolMaxIdleTime"),
213
- waitQueueTimeoutMs: envMs(envVars, "mongoDbPoolWaitQueueTimeout")
214
- }
215
- },
216
- tablePrefix: envVars.entityStorageTablePrefix
217
- }
218
- });
219
- }
220
- if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.PostgreSql)) {
221
- coreConfig.types.entityStorageConnector.push({
222
- type: EntityStorageConnectorType.PostgreSql,
223
- options: {
224
- config: {
225
- host: envVars.postgreSqlHost ?? "",
226
- port: envInteger(envVars, "postgreSqlPort"),
227
- user: envVars.postgreSqlUser ?? "",
228
- password: envVars.postgreSqlPassword ?? "",
229
- database: envVars.postgreSqlDatabase ?? "",
230
- mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout"),
231
- pool: {
232
- max: envCount(envVars, "postgreSqlPoolMax"),
233
- idleTimeout: envSeconds(envVars, "postgreSqlPoolIdleTimeout"),
234
- connectTimeout: envSeconds(envVars, "postgreSqlPoolConnectTimeout"),
235
- maxLifetime: envSeconds(envVars, "postgreSqlPoolMaxLifetime")
86
+ const entityStorageConnectorTypes = envListToArray(envVars, "entityStorageConnectorType", Object.values(EntityStorageConnectorType));
87
+ for (const entityStorageConnectorType of entityStorageConnectorTypes) {
88
+ if (entityStorageConnectorType === EntityStorageConnectorType.Memory) {
89
+ coreConfig.types.entityStorageConnector.push({
90
+ type: EntityStorageConnectorType.Memory,
91
+ options: {
92
+ config: {
93
+ mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
236
94
  }
237
- },
238
- tablePrefix: envVars.entityStorageTablePrefix
239
- }
240
- });
95
+ }
96
+ });
97
+ }
98
+ else if (entityStorageConnectorType === EntityStorageConnectorType.File) {
99
+ coreConfig.types.entityStorageConnector.push({
100
+ type: EntityStorageConnectorType.File,
101
+ options: {
102
+ config: {
103
+ directory: envVars.storageFileRoot ?? "",
104
+ mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
105
+ },
106
+ folderPrefix: envVars.entityStorageTablePrefix
107
+ }
108
+ });
109
+ }
110
+ else if (entityStorageConnectorType === EntityStorageConnectorType.AwsDynamoDb) {
111
+ coreConfig.types.entityStorageConnector.push({
112
+ type: EntityStorageConnectorType.AwsDynamoDb,
113
+ options: {
114
+ config: {
115
+ region: envVars.awsDynamodbRegion ?? "",
116
+ authMode: envVars.awsDynamodbAuthMode,
117
+ accessKeyId: envVars.awsDynamodbAccessKeyId,
118
+ secretAccessKey: envVars.awsDynamodbSecretAccessKey,
119
+ endpoint: envVars.awsDynamodbEndpoint,
120
+ connectionTimeoutMs: envMs(envVars, "awsDynamodbConnectionTimeout"),
121
+ mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
122
+ },
123
+ tablePrefix: envVars.entityStorageTablePrefix
124
+ }
125
+ });
126
+ }
127
+ else if (entityStorageConnectorType === EntityStorageConnectorType.AzureCosmosDb) {
128
+ coreConfig.types.entityStorageConnector.push({
129
+ type: EntityStorageConnectorType.AzureCosmosDb,
130
+ options: {
131
+ config: {
132
+ endpoint: envVars.azureCosmosdbEndpoint ?? "",
133
+ key: envVars.azureCosmosdbKey ?? "",
134
+ databaseId: envVars.azureCosmosdbDatabaseId ?? "",
135
+ containerId: envVars.azureCosmosdbContainerId ?? "",
136
+ mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
137
+ },
138
+ tablePrefix: envVars.entityStorageTablePrefix
139
+ }
140
+ });
141
+ }
142
+ else if (entityStorageConnectorType === EntityStorageConnectorType.GcpFirestoreDb) {
143
+ coreConfig.types.entityStorageConnector.push({
144
+ type: EntityStorageConnectorType.GcpFirestoreDb,
145
+ options: {
146
+ config: {
147
+ projectId: envVars.gcpFirestoreProjectId ?? "",
148
+ credentials: envVars.gcpFirestoreCredentials ?? "",
149
+ databaseId: envVars.gcpFirestoreDatabaseId ?? "",
150
+ collectionName: envVars.gcpFirestoreCollectionName ?? "",
151
+ endpoint: envVars.gcpFirestoreEndpoint ?? "",
152
+ mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout")
153
+ },
154
+ tablePrefix: envVars.entityStorageTablePrefix
155
+ }
156
+ });
157
+ }
158
+ else if (entityStorageConnectorType === EntityStorageConnectorType.ScyllaDb) {
159
+ coreConfig.types.entityStorageConnector.push({
160
+ type: EntityStorageConnectorType.ScyllaDb,
161
+ options: {
162
+ config: {
163
+ hosts: commaSeparatedListToArray(envVars.scylladbHosts),
164
+ localDataCenter: envVars.scylladbLocalDataCenter ?? "",
165
+ keyspace: envVars.scylladbKeyspace ?? "",
166
+ port: envInteger(envVars, "scylladbPort"),
167
+ mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout"),
168
+ pool: {
169
+ coreConnectionsPerHost: envCount(envVars, "scylladbPoolCoreConnectionsPerHost"),
170
+ maxRequestsPerConnection: envCount(envVars, "scylladbPoolMaxRequestsPerConnection")
171
+ }
172
+ },
173
+ tablePrefix: envVars.entityStorageTablePrefix
174
+ }
175
+ });
176
+ }
177
+ else if (entityStorageConnectorType === EntityStorageConnectorType.MySqlDb) {
178
+ coreConfig.types.entityStorageConnector.push({
179
+ type: EntityStorageConnectorType.MySqlDb,
180
+ options: {
181
+ config: {
182
+ host: envVars.mySqlHost ?? "",
183
+ port: envInteger(envVars, "mySqlPort"),
184
+ user: envVars.mySqlUser ?? "",
185
+ password: envVars.mySqlPassword ?? "",
186
+ database: envVars.mySqlDatabase ?? "",
187
+ mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout"),
188
+ pool: {
189
+ connectionLimit: envCount(envVars, "mySqlPoolConnectionLimit"),
190
+ maxIdle: envCount(envVars, "mySqlPoolMaxIdle"),
191
+ idleTimeout: envMs(envVars, "mySqlPoolIdleTimeout"),
192
+ enableKeepAlive: envBoolean(envVars, "mySqlPoolEnableKeepAlive"),
193
+ waitForConnections: envBoolean(envVars, "mySqlPoolWaitForConnections"),
194
+ queueLimit: envCount(envVars, "mySqlPoolQueueLimit")
195
+ }
196
+ },
197
+ tablePrefix: envVars.entityStorageTablePrefix
198
+ }
199
+ });
200
+ }
201
+ else if (entityStorageConnectorType === EntityStorageConnectorType.MongoDb) {
202
+ coreConfig.types.entityStorageConnector.push({
203
+ type: EntityStorageConnectorType.MongoDb,
204
+ options: {
205
+ config: {
206
+ host: envVars.mongoDbHost ?? "",
207
+ port: envInteger(envVars, "mongoDbPort"),
208
+ user: envVars.mongoDbUser ?? "",
209
+ password: envVars.mongoDbPassword ?? "",
210
+ database: envVars.mongoDbDatabase ?? "",
211
+ mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout"),
212
+ pool: {
213
+ maxPoolSize: envCount(envVars, "mongoDbPoolMaxPoolSize"),
214
+ minPoolSize: envCount(envVars, "mongoDbPoolMinPoolSize"),
215
+ maxIdleTimeMs: envMs(envVars, "mongoDbPoolMaxIdleTime"),
216
+ waitQueueTimeoutMs: envMs(envVars, "mongoDbPoolWaitQueueTimeout")
217
+ }
218
+ },
219
+ tablePrefix: envVars.entityStorageTablePrefix
220
+ }
221
+ });
222
+ }
223
+ else if (entityStorageConnectorType === EntityStorageConnectorType.PostgreSql) {
224
+ coreConfig.types.entityStorageConnector.push({
225
+ type: EntityStorageConnectorType.PostgreSql,
226
+ options: {
227
+ config: {
228
+ host: envVars.postgreSqlHost ?? "",
229
+ port: envInteger(envVars, "postgreSqlPort"),
230
+ user: envVars.postgreSqlUser ?? "",
231
+ password: envVars.postgreSqlPassword ?? "",
232
+ database: envVars.postgreSqlDatabase ?? "",
233
+ mutexTimeoutMs: envMs(envVars, "entityStorageMutexTimeout"),
234
+ pool: {
235
+ max: envCount(envVars, "postgreSqlPoolMax"),
236
+ idleTimeout: envSeconds(envVars, "postgreSqlPoolIdleTimeout"),
237
+ connectTimeout: envSeconds(envVars, "postgreSqlPoolConnectTimeout"),
238
+ maxLifetime: envSeconds(envVars, "postgreSqlPoolMaxLifetime")
239
+ }
240
+ },
241
+ tablePrefix: envVars.entityStorageTablePrefix
242
+ }
243
+ });
244
+ }
241
245
  }
242
246
  const defaultEntityStorageConnectorType = envVars.entityStorageConnectorDefault ?? entityStorageConnectorTypes[0];
243
247
  if (Is.arrayValue(entityStorageConnectorTypes)) {
@@ -257,85 +261,88 @@ async function configureEntityStorage(coreConfig, envVars) {
257
261
  */
258
262
  async function configureBlobStorage(coreConfig, envVars) {
259
263
  coreConfig.types.blobStorageConnector ??= [];
260
- const blobStorageConnectorTypes = commaSeparatedListToArray(envVars.blobStorageConnectorType);
261
- if (blobStorageConnectorTypes.includes(BlobStorageConnectorType.Memory)) {
262
- coreConfig.types.blobStorageConnector.push({
263
- type: BlobStorageConnectorType.Memory
264
- });
265
- }
266
- if (blobStorageConnectorTypes.includes(BlobStorageConnectorType.File)) {
267
- coreConfig.types.blobStorageConnector.push({
268
- type: BlobStorageConnectorType.File,
269
- options: {
270
- config: {
271
- directory: Is.stringValue(envVars.storageFileRoot)
272
- ? path.join(envVars.storageFileRoot, "blob-storage")
273
- : ""
274
- },
275
- storagePrefix: envVars.blobStoragePrefix
276
- }
277
- });
278
- }
279
- if (blobStorageConnectorTypes.includes(BlobStorageConnectorType.Ipfs)) {
280
- coreConfig.types.blobStorageConnector.push({
281
- type: BlobStorageConnectorType.Ipfs,
282
- options: {
283
- config: {
284
- apiUrl: envVars.ipfsApiUrl ?? "",
285
- bearerToken: envVars.ipfsBearerToken
264
+ const blobStorageConnectorTypes = envListToArray(envVars, "blobStorageConnectorType", Object.values(BlobStorageConnectorType));
265
+ for (const blobStorageConnectorType of blobStorageConnectorTypes) {
266
+ if (blobStorageConnectorType === BlobStorageConnectorType.Memory) {
267
+ coreConfig.types.blobStorageConnector.push({
268
+ type: BlobStorageConnectorType.Memory
269
+ });
270
+ }
271
+ else if (blobStorageConnectorType === BlobStorageConnectorType.File) {
272
+ coreConfig.types.blobStorageConnector.push({
273
+ type: BlobStorageConnectorType.File,
274
+ options: {
275
+ config: {
276
+ directory: Is.stringValue(envVars.storageFileRoot)
277
+ ? path.join(envVars.storageFileRoot, "blob-storage")
278
+ : ""
279
+ },
280
+ storagePrefix: envVars.blobStoragePrefix
286
281
  }
287
- }
288
- });
289
- }
290
- if (blobStorageConnectorTypes.includes(BlobStorageConnectorType.AwsS3)) {
291
- coreConfig.types.blobStorageConnector.push({
292
- type: BlobStorageConnectorType.AwsS3,
293
- options: {
294
- config: {
295
- region: envVars.awsS3Region ?? "",
296
- bucketName: envVars.awsS3BucketName ?? "",
297
- authMode: envVars.awsS3AuthMode,
298
- accessKeyId: envVars.awsS3AccessKeyId,
299
- secretAccessKey: envVars.awsS3SecretAccessKey,
300
- endpoint: envVars.awsS3Endpoint
301
- },
302
- storagePrefix: envVars.blobStoragePrefix
303
- }
304
- });
305
- }
306
- if (blobStorageConnectorTypes.includes(BlobStorageConnectorType.AzureStorage)) {
307
- coreConfig.types.blobStorageConnector.push({
308
- type: BlobStorageConnectorType.AzureStorage,
309
- options: {
310
- config: {
311
- accountName: envVars.azureStorageAccountName ?? "",
312
- accountKey: envVars.azureStorageAccountKey ?? "",
313
- containerName: envVars.azureStorageContainerName ?? "",
314
- endpoint: envVars.azureStorageEndpoint ?? ""
315
- },
316
- storagePrefix: envVars.blobStoragePrefix
317
- }
318
- });
319
- }
320
- if (blobStorageConnectorTypes.includes(BlobStorageConnectorType.GcpStorage)) {
321
- coreConfig.types.blobStorageConnector.push({
322
- type: BlobStorageConnectorType.GcpStorage,
323
- options: {
324
- config: {
325
- projectId: envVars.gcpStorageProjectId ?? "",
326
- credentials: envVars.gcpStorageCredentials ?? "",
327
- bucketName: envVars.gcpStorageBucketName ?? "",
328
- apiEndpoint: envVars.gcpFirestoreEndpoint
329
- },
330
- storagePrefix: envVars.blobStoragePrefix
331
- }
332
- });
282
+ });
283
+ }
284
+ else if (blobStorageConnectorType === BlobStorageConnectorType.Ipfs) {
285
+ coreConfig.types.blobStorageConnector.push({
286
+ type: BlobStorageConnectorType.Ipfs,
287
+ options: {
288
+ config: {
289
+ apiUrl: envVars.ipfsApiUrl ?? "",
290
+ bearerToken: envVars.ipfsBearerToken
291
+ }
292
+ }
293
+ });
294
+ }
295
+ else if (blobStorageConnectorType === BlobStorageConnectorType.AwsS3) {
296
+ coreConfig.types.blobStorageConnector.push({
297
+ type: BlobStorageConnectorType.AwsS3,
298
+ options: {
299
+ config: {
300
+ region: envVars.awsS3Region ?? "",
301
+ bucketName: envVars.awsS3BucketName ?? "",
302
+ authMode: envVars.awsS3AuthMode,
303
+ accessKeyId: envVars.awsS3AccessKeyId,
304
+ secretAccessKey: envVars.awsS3SecretAccessKey,
305
+ endpoint: envVars.awsS3Endpoint
306
+ },
307
+ storagePrefix: envVars.blobStoragePrefix
308
+ }
309
+ });
310
+ }
311
+ else if (blobStorageConnectorType === BlobStorageConnectorType.AzureStorage) {
312
+ coreConfig.types.blobStorageConnector.push({
313
+ type: BlobStorageConnectorType.AzureStorage,
314
+ options: {
315
+ config: {
316
+ accountName: envVars.azureStorageAccountName ?? "",
317
+ accountKey: envVars.azureStorageAccountKey ?? "",
318
+ containerName: envVars.azureStorageContainerName ?? "",
319
+ endpoint: envVars.azureStorageEndpoint ?? ""
320
+ },
321
+ storagePrefix: envVars.blobStoragePrefix
322
+ }
323
+ });
324
+ }
325
+ else if (blobStorageConnectorType === BlobStorageConnectorType.GcpStorage) {
326
+ coreConfig.types.blobStorageConnector.push({
327
+ type: BlobStorageConnectorType.GcpStorage,
328
+ options: {
329
+ config: {
330
+ projectId: envVars.gcpStorageProjectId ?? "",
331
+ credentials: envVars.gcpStorageCredentials ?? "",
332
+ bucketName: envVars.gcpStorageBucketName ?? "",
333
+ apiEndpoint: envVars.gcpFirestoreEndpoint
334
+ },
335
+ storagePrefix: envVars.blobStoragePrefix
336
+ }
337
+ });
338
+ }
333
339
  }
334
340
  if (Is.arrayValue(blobStorageConnectorTypes)) {
335
341
  const defaultStorageConnectorType = envVars.blobStorageConnectorDefault ?? blobStorageConnectorTypes[0];
336
342
  for (const config of coreConfig.types.blobStorageConnector) {
337
343
  if (config.type === defaultStorageConnectorType) {
338
344
  config.isDefault = true;
345
+ break;
339
346
  }
340
347
  }
341
348
  }
@@ -361,7 +368,7 @@ async function configureBlobStorage(coreConfig, envVars) {
361
368
  */
362
369
  async function configureLogging(coreConfig, envVars) {
363
370
  coreConfig.types.loggingConnector ??= [];
364
- const loggingConnectorTypes = commaSeparatedListToArray(envVars.loggingConnector);
371
+ const loggingConnectorTypes = envListToArray(envVars, "loggingConnector", Object.values(LoggingConnectorType));
365
372
  let additionalConnectorCount = 0;
366
373
  for (const loggingConnector of loggingConnectorTypes) {
367
374
  if (loggingConnector === LoggingConnectorType.Console) {
@@ -386,8 +393,7 @@ async function configureLogging(coreConfig, envVars) {
386
393
  retainForMs: envMinToMs(envVars, "loggingRetainFor"),
387
394
  maxEntries: envCount(envVars, "loggingMaxEntries"),
388
395
  retentionIntervalMs: envMinToMs(envVars, "loggingRetentionInterval"),
389
- retentionBatchSize: envCount(envVars, "loggingRetentionBatchSize"),
390
- mutexTimeoutMs: envMs(envVars, "loggingMutexTimeout")
396
+ retentionBatchSize: envCount(envVars, "loggingRetentionBatchSize")
391
397
  }
392
398
  }
393
399
  });
@@ -424,8 +430,7 @@ async function configureLogging(coreConfig, envVars) {
424
430
  directory: envVars.loggingFileDirectory ?? envVars.storageFileRoot ?? "",
425
431
  filename: envVars.loggingFileFilename,
426
432
  maxFileSizeBytes: envCount(envVars, "loggingFileMaxFileSizeBytes"),
427
- maxRetainedFiles: envCount(envVars, "loggingFileMaxRetainedFiles"),
428
- mutexTimeoutMs: envMs(envVars, "loggingMutexTimeout")
433
+ maxRetainedFiles: envCount(envVars, "loggingFileMaxRetainedFiles")
429
434
  }
430
435
  }
431
436
  });
@@ -463,7 +468,8 @@ async function configureLogging(coreConfig, envVars) {
463
468
  */
464
469
  async function configureVault(coreConfig, envVars) {
465
470
  coreConfig.types.vaultConnector ??= [];
466
- if (envVars.vaultConnector === VaultConnectorType.EntityStorage) {
471
+ const vaultConnectorType = envChoice(envVars, "vaultConnector", Object.values(VaultConnectorType));
472
+ if (vaultConnectorType === VaultConnectorType.EntityStorage) {
467
473
  coreConfig.types.vaultConnector.push({
468
474
  type: VaultConnectorType.EntityStorage,
469
475
  options: {
@@ -473,7 +479,7 @@ async function configureVault(coreConfig, envVars) {
473
479
  }
474
480
  });
475
481
  }
476
- else if (envVars.vaultConnector === VaultConnectorType.Hashicorp) {
482
+ else if (vaultConnectorType === VaultConnectorType.Hashicorp) {
477
483
  coreConfig.types.vaultConnector.push({
478
484
  type: VaultConnectorType.Hashicorp,
479
485
  options: {
@@ -496,7 +502,17 @@ async function configureBackgroundTask(coreConfig, envVars) {
496
502
  coreConfig.types.backgroundTaskComponent ??= [];
497
503
  if (isBackgroundTasksRequired(envVars)) {
498
504
  coreConfig.types.backgroundTaskComponent.push({
499
- type: BackgroundTaskComponentType.Service
505
+ type: BackgroundTaskComponentType.Service,
506
+ options: {
507
+ config: {
508
+ maxSystemWorkerCount: envCount(envVars, "backgroundTaskMaxSystemWorkerCount", cpus().length * 2),
509
+ taskInterval: envMs(envVars, "backgroundTaskInterval"),
510
+ retryInterval: envMs(envVars, "backgroundTaskRetryInterval"),
511
+ cleanupInterval: envMs(envVars, "backgroundTaskCleanupInterval"),
512
+ workerShutdownTimeout: envMs(envVars, "backgroundTaskWorkerShutdownTimeout"),
513
+ maxDispatchCount: envCount(envVars, "backgroundTaskMaxDispatchCount")
514
+ }
515
+ }
500
516
  });
501
517
  }
502
518
  }
@@ -508,7 +524,8 @@ async function configureBackgroundTask(coreConfig, envVars) {
508
524
  */
509
525
  async function configureEventBus(coreConfig, envVars) {
510
526
  coreConfig.types.eventBusConnector ??= [];
511
- if (envVars.eventBusConnector === EventBusConnectorType.Local) {
527
+ const eventBusConnectorType = envChoice(envVars, "eventBusConnector", Object.values(EventBusConnectorType));
528
+ if (eventBusConnectorType === EventBusConnectorType.Local) {
512
529
  coreConfig.types.eventBusConnector.push({
513
530
  type: EventBusConnectorType.Local
514
531
  });
@@ -526,16 +543,16 @@ async function configureEventBus(coreConfig, envVars) {
526
543
  */
527
544
  async function configureTelemetry(coreConfig, envVars) {
528
545
  coreConfig.types.telemetryConnector ??= [];
529
- const telemetryConnectorTypes = commaSeparatedListToArray(envVars.telemetryConnector);
546
+ const telemetryConnectorTypes = envListToArray(envVars, "telemetryConnector", Object.values(TelemetryConnectorType));
530
547
  let additionalConnectorCount = 0;
531
- for (const telemetryConnector of telemetryConnectorTypes) {
532
- if (telemetryConnector === TelemetryConnectorType.Silent) {
548
+ for (const telemetryConnectorType of telemetryConnectorTypes) {
549
+ if (telemetryConnectorType === TelemetryConnectorType.Silent) {
533
550
  coreConfig.types.telemetryConnector.push({
534
551
  type: TelemetryConnectorType.Silent
535
552
  });
536
553
  additionalConnectorCount++;
537
554
  }
538
- else if (telemetryConnector === TelemetryConnectorType.EntityStorage) {
555
+ else if (telemetryConnectorType === TelemetryConnectorType.EntityStorage) {
539
556
  coreConfig.types.telemetryConnector.push({
540
557
  type: TelemetryConnectorType.EntityStorage,
541
558
  options: {
@@ -543,7 +560,9 @@ async function configureTelemetry(coreConfig, envVars) {
543
560
  batchSize: envCount(envVars, "telemetryBatchSize"),
544
561
  batchIntervalMs: envSecToMs(envVars, "telemetryBatchFlushInterval"),
545
562
  maxCacheSize: envCount(envVars, "telemetryMaxCacheSize"),
546
- mutexTimeoutMs: envMs(envVars, "telemetryMutexTimeout"),
563
+ flushTimeoutMs: envMs(envVars, "telemetryFlushTimeout"),
564
+ taskCoalesceMs: envMs(envVars, "telemetryTaskCoalesce"),
565
+ taskStallTimeoutMs: envMs(envVars, "telemetryTaskStallTimeout"),
547
566
  metricDefinitionCacheCapacity: envCount(envVars, "telemetryMetricDefinitionCacheCapacity"),
548
567
  metricDefinitionCacheTtiMs: envMs(envVars, "telemetryMetricDefinitionCacheTtiMs")
549
568
  }
@@ -551,7 +570,7 @@ async function configureTelemetry(coreConfig, envVars) {
551
570
  });
552
571
  additionalConnectorCount++;
553
572
  }
554
- else if (telemetryConnector === TelemetryConnectorType.OpenTelemetry) {
573
+ else if (telemetryConnectorType === TelemetryConnectorType.OpenTelemetry) {
555
574
  let readers;
556
575
  if (envVars.openTelemetryReader === OpenTelemetryReaderTypes.Prometheus) {
557
576
  readers = {
@@ -614,8 +633,10 @@ async function configureMetricsCollector(coreConfig, envVars) {
614
633
  cloneMode: EngineCloneMode.Never
615
634
  });
616
635
  coreConfig.types.metricsProducerComponent ??= [];
617
- const metricsProducers = commaSeparatedListToArray(envVars.telemetryMetricsProducers ??
618
- [MetricsProducerComponentType.System, MetricsProducerComponentType.Process].join(","));
636
+ const metricsProducers = envListToArray(envVars, "telemetryMetricsProducers", Object.values(MetricsProducerComponentType), [
637
+ MetricsProducerComponentType.System,
638
+ MetricsProducerComponentType.Process
639
+ ]);
619
640
  for (const producerType of metricsProducers) {
620
641
  coreConfig.types.metricsProducerComponent.push({
621
642
  type: producerType,
@@ -633,27 +654,28 @@ async function configureMetricsCollector(coreConfig, envVars) {
633
654
  */
634
655
  async function configureTracing(coreConfig, envVars) {
635
656
  coreConfig.types.tracingConnector ??= [];
636
- const tracingConnectorTypes = commaSeparatedListToArray(envVars.tracingConnector);
657
+ const tracingConnectorTypes = envListToArray(envVars, "tracingConnector", Object.values(TracingConnectorType));
637
658
  let additionalConnectorCount = 0;
638
- for (const tracingConnector of tracingConnectorTypes) {
639
- if (tracingConnector === TracingConnectorType.Silent) {
659
+ for (const tracingConnectorType of tracingConnectorTypes) {
660
+ if (tracingConnectorType === TracingConnectorType.Silent) {
640
661
  coreConfig.types.tracingConnector.push({
641
662
  type: TracingConnectorType.Silent
642
663
  });
643
664
  additionalConnectorCount++;
644
665
  }
645
- else if (tracingConnector === TracingConnectorType.EntityStorage) {
666
+ else if (tracingConnectorType === TracingConnectorType.EntityStorage) {
646
667
  coreConfig.types.tracingConnector.push({
647
- type: TracingConnectorType.EntityStorage,
648
- options: {
649
- config: {
650
- mutexTimeoutMs: envMs(envVars, "tracingMutexTimeout")
651
- }
652
- }
668
+ type: TracingConnectorType.EntityStorage
653
669
  });
654
670
  additionalConnectorCount++;
655
671
  }
656
- else if (tracingConnector === TracingConnectorType.OpenTelemetry) {
672
+ else if (tracingConnectorType === TracingConnectorType.Console) {
673
+ coreConfig.types.tracingConnector.push({
674
+ type: TracingConnectorType.Console
675
+ });
676
+ additionalConnectorCount++;
677
+ }
678
+ else if (tracingConnectorType === TracingConnectorType.OpenTelemetry) {
657
679
  const otelTracingConfig = {
658
680
  tracerName: envVars.openTelemetryTracingTracerName,
659
681
  tracerVersion: envVars.openTelemetryTracingTracerVersion
@@ -709,15 +731,13 @@ async function configureAutomation(coreConfig, envVars) {
709
731
  coreConfig.types.automationComponent.push({
710
732
  type: AutomationComponentType.Service
711
733
  });
712
- const automationActionTypes = commaSeparatedListToArray(envVars.automationActionTypes);
713
- if (Is.arrayValue(automationActionTypes)) {
714
- coreConfig.types.automationAction ??= [];
715
- for (const actionType of automationActionTypes) {
716
- coreConfig.types.automationAction.push({
717
- type: actionType,
718
- isMultiInstance: true
719
- });
720
- }
734
+ const automationActionTypes = envListToArray(envVars, "automationActionTypes", Object.values(AutomationActionType));
735
+ coreConfig.types.automationAction ??= [];
736
+ for (const actionType of automationActionTypes) {
737
+ coreConfig.types.automationAction.push({
738
+ type: actionType,
739
+ isMultiInstance: true
740
+ });
721
741
  }
722
742
  }
723
743
  }
@@ -736,7 +756,8 @@ async function configureHealth(coreConfig, envVars) {
736
756
  config: {
737
757
  healthCheckInterval: envSecToMs(envVars, "healthInterval"),
738
758
  healthCheckApplicationInterval: envSecToMs(envVars, "healthApplicationInterval"),
739
- initialInterval: envSecToMs(envVars, "healthStartupInterval")
759
+ initialInterval: envSecToMs(envVars, "healthStartupInterval"),
760
+ excludeCloneComponents: envListToArray(envVars, "healthExcludeCloneComponents", undefined, DEFAULT_HEALTH_EXCLUDE_CLONE_COMPONENTS)
740
761
  }
741
762
  },
742
763
  cloneMode: EngineCloneMode.Never
@@ -820,69 +841,89 @@ async function configureContextIdHandlers(coreConfig, envVars) {
820
841
  * @returns A promise that resolves when the messaging configuration has been applied.
821
842
  */
822
843
  async function configureMessaging(coreConfig, envVars) {
823
- if (envBoolean(envVars, "messagingEnabled", false)) {
824
- coreConfig.types.messagingEmailConnector ??= [];
825
- coreConfig.types.messagingSmsConnector ??= [];
826
- coreConfig.types.messagingPushNotificationConnector ??= [];
827
- if (envVars.messagingEmailConnector === MessagingEmailConnectorType.EntityStorage) {
828
- coreConfig.types.messagingEmailConnector.push({
829
- type: MessagingEmailConnectorType.EntityStorage
830
- });
831
- }
832
- else if (envVars.messagingEmailConnector === MessagingEmailConnectorType.Aws) {
833
- coreConfig.types.messagingEmailConnector.push({
834
- type: MessagingEmailConnectorType.Aws,
835
- options: {
836
- config: {
837
- region: envVars.awsSesRegion ?? "",
838
- authMode: envVars.awsSesAuthMode,
839
- accessKeyId: envVars.awsSesAccessKeyId,
840
- secretAccessKey: envVars.awsSesSecretAccessKey,
841
- endpoint: envVars.awsSesEndpoint
842
- }
844
+ coreConfig.types.messagingEmailConnector ??= [];
845
+ coreConfig.types.messagingSmsConnector ??= [];
846
+ coreConfig.types.messagingPushNotificationConnector ??= [];
847
+ const messagingEmailConnectorType = envChoice(envVars, "messagingEmailConnector", Object.values(MessagingEmailConnectorType));
848
+ if (messagingEmailConnectorType === MessagingEmailConnectorType.EntityStorage) {
849
+ coreConfig.types.messagingEmailConnector.push({
850
+ type: MessagingEmailConnectorType.EntityStorage
851
+ });
852
+ }
853
+ else if (messagingEmailConnectorType === MessagingEmailConnectorType.Aws) {
854
+ coreConfig.types.messagingEmailConnector.push({
855
+ type: MessagingEmailConnectorType.Aws,
856
+ options: {
857
+ config: {
858
+ region: envVars.awsSesRegion ?? "",
859
+ authMode: envVars.awsSesAuthMode,
860
+ accessKeyId: envVars.awsSesAccessKeyId,
861
+ secretAccessKey: envVars.awsSesSecretAccessKey,
862
+ endpoint: envVars.awsSesEndpoint
843
863
  }
844
- });
845
- }
846
- if (envVars.messagingSmsConnector === MessagingSmsConnectorType.EntityStorage) {
847
- coreConfig.types.messagingSmsConnector.push({
848
- type: MessagingSmsConnectorType.EntityStorage
849
- });
850
- }
851
- else if (envVars.messagingSmsConnector === MessagingSmsConnectorType.Aws) {
852
- coreConfig.types.messagingSmsConnector.push({
853
- type: MessagingSmsConnectorType.Aws,
854
- options: {
855
- config: {
856
- region: envVars.awsSesRegion ?? "",
857
- authMode: envVars.awsSesAuthMode,
858
- accessKeyId: envVars.awsSesAccessKeyId,
859
- secretAccessKey: envVars.awsSesSecretAccessKey,
860
- endpoint: envVars.awsSesEndpoint
861
- }
864
+ }
865
+ });
866
+ }
867
+ else if (messagingEmailConnectorType === MessagingEmailConnectorType.Smtp) {
868
+ coreConfig.types.messagingEmailConnector.push({
869
+ type: MessagingEmailConnectorType.Smtp,
870
+ options: {
871
+ config: {
872
+ host: envVars.smtpHost ?? "",
873
+ port: envInteger(envVars, "smtpPort"),
874
+ secure: envBoolean(envVars, "smtpSecure"),
875
+ username: envVars.smtpUsername,
876
+ password: envVars.smtpPassword
862
877
  }
863
- });
864
- }
865
- if (envVars.messagingPushNotificationConnector ===
866
- MessagingPushNotificationConnectorType.EntityStorage) {
867
- coreConfig.types.messagingPushNotificationConnector.push({
868
- type: MessagingPushNotificationConnectorType.EntityStorage
869
- });
870
- }
871
- else if (envVars.messagingPushNotificationConnector === MessagingPushNotificationConnectorType.Aws) {
872
- coreConfig.types.messagingPushNotificationConnector.push({
873
- type: MessagingPushNotificationConnectorType.Aws,
874
- options: {
875
- config: {
876
- region: envVars.awsSesRegion ?? "",
877
- authMode: envVars.awsSesAuthMode,
878
- accessKeyId: envVars.awsSesAccessKeyId,
879
- secretAccessKey: envVars.awsSesSecretAccessKey,
880
- endpoint: envVars.awsSesEndpoint,
881
- applicationsSettings: envArray(envVars, "awsMessagingPushNotificationApplications", [])
882
- }
878
+ }
879
+ });
880
+ }
881
+ const messagingSmsConnectorType = envChoice(envVars, "messagingSmsConnector", Object.values(MessagingSmsConnectorType));
882
+ if (messagingSmsConnectorType === MessagingSmsConnectorType.EntityStorage) {
883
+ coreConfig.types.messagingSmsConnector.push({
884
+ type: MessagingSmsConnectorType.EntityStorage
885
+ });
886
+ }
887
+ else if (messagingSmsConnectorType === MessagingSmsConnectorType.Aws) {
888
+ coreConfig.types.messagingSmsConnector.push({
889
+ type: MessagingSmsConnectorType.Aws,
890
+ options: {
891
+ config: {
892
+ region: envVars.awsSesRegion ?? "",
893
+ authMode: envVars.awsSesAuthMode,
894
+ accessKeyId: envVars.awsSesAccessKeyId,
895
+ secretAccessKey: envVars.awsSesSecretAccessKey,
896
+ endpoint: envVars.awsSesEndpoint
883
897
  }
884
- });
885
- }
898
+ }
899
+ });
900
+ }
901
+ const messagingPushConnectorType = envChoice(envVars, "messagingPushNotificationConnector", Object.values(MessagingPushNotificationConnectorType));
902
+ if (messagingPushConnectorType === MessagingPushNotificationConnectorType.EntityStorage) {
903
+ coreConfig.types.messagingPushNotificationConnector.push({
904
+ type: MessagingPushNotificationConnectorType.EntityStorage
905
+ });
906
+ }
907
+ else if (messagingPushConnectorType === MessagingPushNotificationConnectorType.Aws) {
908
+ coreConfig.types.messagingPushNotificationConnector.push({
909
+ type: MessagingPushNotificationConnectorType.Aws,
910
+ options: {
911
+ config: {
912
+ region: envVars.awsSesRegion ?? "",
913
+ authMode: envVars.awsSesAuthMode,
914
+ accessKeyId: envVars.awsSesAccessKeyId,
915
+ secretAccessKey: envVars.awsSesSecretAccessKey,
916
+ endpoint: envVars.awsSesEndpoint,
917
+ applicationsSettings: envArray(envVars, "awsMessagingPushNotificationApplications", [])
918
+ }
919
+ }
920
+ });
921
+ }
922
+ // If any messaging connectors are configured, then we should configure the messaging admin and
923
+ // service components as well since they are required for the messaging connectors to work.
924
+ if (coreConfig.types.messagingEmailConnector.length > 0 ||
925
+ coreConfig.types.messagingSmsConnector.length > 0 ||
926
+ coreConfig.types.messagingPushNotificationConnector.length > 0) {
886
927
  coreConfig.types.messagingAdminComponent ??= [];
887
928
  coreConfig.types.messagingAdminComponent.push({
888
929
  type: MessagingAdminComponentType.Service
@@ -891,6 +932,40 @@ async function configureMessaging(coreConfig, envVars) {
891
932
  coreConfig.types.messagingComponent.push({ type: MessagingComponentType.Service });
892
933
  }
893
934
  }
935
+ /**
936
+ * Configures mailbox components, mail storage components, and email protocol connectors.
937
+ * @param coreConfig The core config.
938
+ * @param envVars The environment variables.
939
+ * @returns A promise that resolves when the mailbox configuration has been applied.
940
+ */
941
+ async function configureMailbox(coreConfig, envVars) {
942
+ coreConfig.types.emailProtocolConnector ??= [];
943
+ const emailProtocolConnectorTypes = envListToArray(envVars, "emailProtocolConnector", Object.values(EmailProtocolConnectorType));
944
+ for (const emailProtocolConnectorType of emailProtocolConnectorTypes) {
945
+ coreConfig.types.emailProtocolConnector.push({
946
+ type: emailProtocolConnectorType,
947
+ options: {
948
+ config: {}
949
+ },
950
+ cloneMode: EngineCloneMode.Never,
951
+ isMultiInstance: true
952
+ });
953
+ }
954
+ // If email protocol connectors are configured, then we should configure the mailbox and mail store
955
+ // components as well, since they are required for the email protocol connectors to work.
956
+ if (coreConfig.types.emailProtocolConnector.length > 0) {
957
+ coreConfig.types.mailStorageComponent ??= [];
958
+ coreConfig.types.mailStorageComponent.push({
959
+ type: MailStorageComponentType.Service,
960
+ cloneMode: EngineCloneMode.Never
961
+ });
962
+ coreConfig.types.mailboxComponent ??= [];
963
+ coreConfig.types.mailboxComponent.push({
964
+ type: MailboxComponentType.Service,
965
+ cloneMode: EngineCloneMode.Never
966
+ });
967
+ }
968
+ }
894
969
  /**
895
970
  * Configures the faucet.
896
971
  * @param coreConfig The core config.
@@ -899,12 +974,13 @@ async function configureMessaging(coreConfig, envVars) {
899
974
  */
900
975
  async function configureFaucet(coreConfig, envVars) {
901
976
  coreConfig.types.faucetConnector ??= [];
902
- if (envVars.faucetConnector === FaucetConnectorType.EntityStorage) {
977
+ const faucetConnectorType = envChoice(envVars, "faucetConnector", Object.values(FaucetConnectorType));
978
+ if (faucetConnectorType === FaucetConnectorType.EntityStorage) {
903
979
  coreConfig.types.faucetConnector.push({
904
980
  type: FaucetConnectorType.EntityStorage
905
981
  });
906
982
  }
907
- else if (envVars.faucetConnector === FaucetConnectorType.Iota &&
983
+ else if (faucetConnectorType === FaucetConnectorType.Iota &&
908
984
  Is.stringValue(envVars.iotaFaucetEndpoint)) {
909
985
  const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
910
986
  coreConfig.types.faucetConnector.push({
@@ -927,12 +1003,13 @@ async function configureFaucet(coreConfig, envVars) {
927
1003
  */
928
1004
  async function configureWallet(coreConfig, envVars) {
929
1005
  coreConfig.types.walletConnector ??= [];
930
- if (envVars.walletConnector === WalletConnectorType.EntityStorage) {
1006
+ const walletConnectorType = envChoice(envVars, "walletConnector", Object.values(WalletConnectorType));
1007
+ if (walletConnectorType === WalletConnectorType.EntityStorage) {
931
1008
  coreConfig.types.walletConnector.push({
932
1009
  type: WalletConnectorType.EntityStorage
933
1010
  });
934
1011
  }
935
- else if (envVars.walletConnector === WalletConnectorType.Iota) {
1012
+ else if (walletConnectorType === WalletConnectorType.Iota) {
936
1013
  const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
937
1014
  coreConfig.types.walletConnector.push({
938
1015
  type: WalletConnectorType.Iota,
@@ -950,12 +1027,13 @@ async function configureWallet(coreConfig, envVars) {
950
1027
  */
951
1028
  async function configureNft(coreConfig, envVars) {
952
1029
  coreConfig.types.nftConnector ??= [];
953
- if (envVars.nftConnector === NftConnectorType.EntityStorage) {
1030
+ const nftConnectorType = envChoice(envVars, "nftConnector", Object.values(NftConnectorType));
1031
+ if (nftConnectorType === NftConnectorType.EntityStorage) {
954
1032
  coreConfig.types.nftConnector.push({
955
1033
  type: NftConnectorType.EntityStorage
956
1034
  });
957
1035
  }
958
- else if (envVars.nftConnector === NftConnectorType.Iota) {
1036
+ else if (nftConnectorType === NftConnectorType.Iota) {
959
1037
  const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
960
1038
  const config = {
961
1039
  ...dltConfig?.options?.config,
@@ -981,12 +1059,13 @@ async function configureNft(coreConfig, envVars) {
981
1059
  */
982
1060
  async function configureNotarization(coreConfig, envVars) {
983
1061
  coreConfig.types.notarizationConnector ??= [];
984
- if (envVars.notarizationConnector === NotarizationConnectorType.EntityStorage) {
1062
+ const notarizationConnectorType = envChoice(envVars, "notarizationConnector", Object.values(NotarizationConnectorType));
1063
+ if (notarizationConnectorType === NotarizationConnectorType.EntityStorage) {
985
1064
  coreConfig.types.notarizationConnector.push({
986
1065
  type: NotarizationConnectorType.EntityStorage
987
1066
  });
988
1067
  }
989
- else if (envVars.notarizationConnector === NotarizationConnectorType.Iota) {
1068
+ else if (notarizationConnectorType === NotarizationConnectorType.Iota) {
990
1069
  const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
991
1070
  coreConfig.types.notarizationConnector.push({
992
1071
  type: NotarizationConnectorType.Iota,
@@ -1017,6 +1096,7 @@ async function configureImmutableProof(coreConfig, envVars) {
1017
1096
  taskRetryCount: envCount(envVars, "immutableProofTaskRetryCount"),
1018
1097
  taskRetryInterval: envSecToMs(envVars, "immutableProofTaskRetryInterval"),
1019
1098
  taskFailureRetainFor: envMinToMs(envVars, "immutableProofTaskFailureRetainFor"),
1099
+ taskWorkerIdleTimeout: envSecToMs(envVars, "immutableProofTaskWorkerIdleTimeout"),
1020
1100
  sweepIntervalMinutes: envMinutes(envVars, "immutableProofSweepInterval"),
1021
1101
  sweepStaleThresholdMs: envMinToMs(envVars, "immutableProofSweepStaleThreshold"),
1022
1102
  sweepMaxAttempts: envCount(envVars, "immutableProofSweepMaxAttempts"),
@@ -1036,12 +1116,13 @@ async function configureImmutableProof(coreConfig, envVars) {
1036
1116
  */
1037
1117
  async function configureIdentity(coreConfig, envVars) {
1038
1118
  coreConfig.types.identityConnector ??= [];
1039
- if (envVars.identityConnector === IdentityConnectorType.EntityStorage) {
1119
+ const identityConnectorType = envChoice(envVars, "identityConnector", Object.values(IdentityConnectorType));
1120
+ if (identityConnectorType === IdentityConnectorType.EntityStorage) {
1040
1121
  coreConfig.types.identityConnector.push({
1041
1122
  type: IdentityConnectorType.EntityStorage
1042
1123
  });
1043
1124
  }
1044
- else if (envVars.identityConnector === IdentityConnectorType.Iota) {
1125
+ else if (identityConnectorType === IdentityConnectorType.Iota) {
1045
1126
  const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
1046
1127
  coreConfig.types.identityConnector.push({
1047
1128
  type: IdentityConnectorType.Iota,
@@ -1074,12 +1155,13 @@ async function configureIdentity(coreConfig, envVars) {
1074
1155
  */
1075
1156
  async function configureIdentityResolver(coreConfig, envVars) {
1076
1157
  coreConfig.types.identityResolverConnector ??= [];
1077
- if (envVars.identityResolverConnector === IdentityResolverConnectorType.EntityStorage) {
1158
+ const identityResolverConnectorType = envChoice(envVars, "identityResolverConnector", Object.values(IdentityResolverConnectorType));
1159
+ if (identityResolverConnectorType === IdentityResolverConnectorType.EntityStorage) {
1078
1160
  coreConfig.types.identityResolverConnector.push({
1079
1161
  type: IdentityResolverConnectorType.EntityStorage
1080
1162
  });
1081
1163
  }
1082
- else if (envVars.identityResolverConnector === IdentityResolverConnectorType.Iota) {
1164
+ else if (identityResolverConnectorType === IdentityResolverConnectorType.Iota) {
1083
1165
  const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
1084
1166
  coreConfig.types.identityResolverConnector.push({
1085
1167
  type: IdentityResolverConnectorType.Iota,
@@ -1093,7 +1175,7 @@ async function configureIdentityResolver(coreConfig, envVars) {
1093
1175
  }
1094
1176
  });
1095
1177
  }
1096
- else if (envVars.identityResolverConnector === IdentityResolverConnectorType.Universal) {
1178
+ else if (identityResolverConnectorType === IdentityResolverConnectorType.Universal) {
1097
1179
  coreConfig.types.identityResolverConnector.push({
1098
1180
  type: IdentityResolverConnectorType.Universal,
1099
1181
  options: {
@@ -1118,7 +1200,8 @@ async function configureIdentityResolver(coreConfig, envVars) {
1118
1200
  */
1119
1201
  async function configureIdentityProfile(coreConfig, envVars) {
1120
1202
  coreConfig.types.identityProfileConnector ??= [];
1121
- if (envVars.identityProfileConnector === IdentityConnectorType.EntityStorage) {
1203
+ const identityProfileConnectorType = envChoice(envVars, "identityProfileConnector", Object.values(IdentityProfileConnectorType));
1204
+ if (identityProfileConnectorType === IdentityProfileConnectorType.EntityStorage) {
1122
1205
  coreConfig.types.identityProfileConnector.push({
1123
1206
  type: IdentityProfileConnectorType.EntityStorage
1124
1207
  });
@@ -1136,7 +1219,8 @@ async function configureIdentityProfile(coreConfig, envVars) {
1136
1219
  */
1137
1220
  async function configureAttestation(coreConfig, envVars) {
1138
1221
  coreConfig.types.attestationConnector ??= [];
1139
- if (envVars.attestationConnector === AttestationConnectorType.Nft) {
1222
+ const attestationConnectorType = envChoice(envVars, "attestationConnector", Object.values(AttestationConnectorType));
1223
+ if (attestationConnectorType === AttestationConnectorType.Nft) {
1140
1224
  coreConfig.types.attestationConnector.push({
1141
1225
  type: AttestationConnectorType.Nft
1142
1226
  });
@@ -1198,23 +1282,24 @@ async function configureAuditableItemStream(coreConfig, envVars) {
1198
1282
  * @returns A promise that resolves when the data processing configuration has been applied.
1199
1283
  */
1200
1284
  async function configureDataProcessing(coreConfig, envVars) {
1201
- if (envBoolean(envVars, "dataProcessingEnabled", false)) {
1285
+ coreConfig.types.dataConverterConnector ??= [];
1286
+ const converterConnectors = envListToArray(envVars, "dataConverterConnectors", Object.values(DataConverterConnectorType));
1287
+ for (const converterConnector of converterConnectors) {
1288
+ coreConfig.types.dataConverterConnector.push({
1289
+ type: converterConnector
1290
+ });
1291
+ }
1292
+ coreConfig.types.dataExtractorConnector ??= [];
1293
+ const extractorConnectors = envListToArray(envVars, "dataExtractorConnectors", Object.values(DataExtractorConnectorType));
1294
+ for (const extractorConnector of extractorConnectors) {
1295
+ coreConfig.types.dataExtractorConnector.push({
1296
+ type: extractorConnector
1297
+ });
1298
+ }
1299
+ if (coreConfig.types.dataConverterConnector.length > 0 ||
1300
+ coreConfig.types.dataExtractorConnector.length > 0) {
1202
1301
  coreConfig.types.dataProcessingComponent ??= [];
1203
1302
  coreConfig.types.dataProcessingComponent.push({ type: DataProcessingComponentType.Service });
1204
- coreConfig.types.dataConverterConnector ??= [];
1205
- const converterConnectors = commaSeparatedListToArray(envVars.dataConverterConnectors);
1206
- for (const converterConnector of converterConnectors) {
1207
- coreConfig.types.dataConverterConnector.push({
1208
- type: converterConnector
1209
- });
1210
- }
1211
- coreConfig.types.dataExtractorConnector ??= [];
1212
- const extractorConnectors = commaSeparatedListToArray(envVars.dataExtractorConnectors);
1213
- for (const extractorConnector of extractorConnectors) {
1214
- coreConfig.types.dataExtractorConnector.push({
1215
- type: extractorConnector
1216
- });
1217
- }
1218
1303
  }
1219
1304
  }
1220
1305
  /**
@@ -1249,7 +1334,7 @@ async function configureTrust(coreConfig, envVars) {
1249
1334
  type: TrustComponentType.Service
1250
1335
  });
1251
1336
  coreConfig.types.trustGeneratorComponent ??= [];
1252
- const trustGeneratorTypes = commaSeparatedListToArray(envVars.trustGenerators);
1337
+ const trustGeneratorTypes = envListToArray(envVars, "trustGenerators", Object.values(TrustGeneratorComponentType));
1253
1338
  for (const trustGeneratorType of trustGeneratorTypes) {
1254
1339
  coreConfig.types.trustGeneratorComponent.push({
1255
1340
  type: trustGeneratorType,
@@ -1262,12 +1347,11 @@ async function configureTrust(coreConfig, envVars) {
1262
1347
  });
1263
1348
  }
1264
1349
  coreConfig.types.trustVerifierComponent ??= [];
1265
- const trustVerifierTypes = commaSeparatedListToArray(envVars.trustVerifiers);
1350
+ const trustVerifierTypes = envListToArray(envVars, "trustVerifiers", Object.values(TrustVerifierComponentType));
1266
1351
  for (const trustVerifierType of trustVerifierTypes) {
1267
- const type = trustVerifierType;
1268
- if (type === TrustVerifierComponentType.IdentityAllowDeny) {
1352
+ if (trustVerifierType === TrustVerifierComponentType.IdentityAllowDeny) {
1269
1353
  coreConfig.types.trustVerifierComponent.push({
1270
- type,
1354
+ type: TrustVerifierComponentType.IdentityAllowDeny,
1271
1355
  options: {
1272
1356
  config: {
1273
1357
  allowIdentities: commaSeparatedListToArray(envVars.trustIdentitiesAllow),
@@ -1276,9 +1360,9 @@ async function configureTrust(coreConfig, envVars) {
1276
1360
  }
1277
1361
  });
1278
1362
  }
1279
- else {
1363
+ else if (trustVerifierType === TrustVerifierComponentType.JwtVerifiableCredential) {
1280
1364
  coreConfig.types.trustVerifierComponent.push({
1281
- type
1365
+ type: TrustVerifierComponentType.JwtVerifiableCredential
1282
1366
  });
1283
1367
  }
1284
1368
  }
@@ -1356,49 +1440,49 @@ async function configureRightsManagement(coreConfig, envVars) {
1356
1440
  }
1357
1441
  });
1358
1442
  coreConfig.types.rightsManagementPolicyArbiterComponent ??= [];
1359
- const policyArbiterTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyArbiters);
1443
+ const policyArbiterTypes = envListToArray(envVars, "rightsManagementPolicyArbiters", Object.values(RightsManagementPolicyArbiterComponentType));
1360
1444
  for (const policyArbiterType of policyArbiterTypes) {
1361
1445
  coreConfig.types.rightsManagementPolicyArbiterComponent.push({
1362
1446
  type: policyArbiterType
1363
1447
  });
1364
1448
  }
1365
1449
  coreConfig.types.rightsManagementPolicyObligationEnforcerComponent ??= [];
1366
- const policyObligationEnforcerTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyObligationEnforcers);
1450
+ const policyObligationEnforcerTypes = envListToArray(envVars, "rightsManagementPolicyObligationEnforcers", Object.values(RightsManagementPolicyObligationEnforcerComponentType));
1367
1451
  for (const policyObligationEnforcerType of policyObligationEnforcerTypes) {
1368
1452
  coreConfig.types.rightsManagementPolicyObligationEnforcerComponent.push({
1369
1453
  type: policyObligationEnforcerType
1370
1454
  });
1371
1455
  }
1372
1456
  coreConfig.types.rightsManagementPolicyEnforcementProcessorComponent ??= [];
1373
- const policyEnforcementProcessTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyEnforcementProcessors);
1457
+ const policyEnforcementProcessTypes = envListToArray(envVars, "rightsManagementPolicyEnforcementProcessors", Object.values(RightsManagementPolicyEnforcementProcessorComponentType));
1374
1458
  for (const policyEnforcementProcessorType of policyEnforcementProcessTypes) {
1375
1459
  coreConfig.types.rightsManagementPolicyEnforcementProcessorComponent.push({
1376
1460
  type: policyEnforcementProcessorType
1377
1461
  });
1378
1462
  }
1379
1463
  coreConfig.types.rightsManagementPolicyExecutionActionComponent ??= [];
1380
- const policyExecutionActionTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyExecutionActions);
1464
+ const policyExecutionActionTypes = envListToArray(envVars, "rightsManagementPolicyExecutionActions", Object.values(RightsManagementPolicyExecutionActionComponentType));
1381
1465
  for (const policyExecutionActionType of policyExecutionActionTypes) {
1382
1466
  coreConfig.types.rightsManagementPolicyExecutionActionComponent.push({
1383
1467
  type: policyExecutionActionType
1384
1468
  });
1385
1469
  }
1386
1470
  coreConfig.types.rightsManagementPolicyInformationSourceComponent ??= [];
1387
- const policyInformationSourceTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyInformationSources);
1471
+ const policyInformationSourceTypes = envListToArray(envVars, "rightsManagementPolicyInformationSources", Object.values(RightsManagementPolicyInformationSourceComponentType));
1388
1472
  for (const policyInformationSourceType of policyInformationSourceTypes) {
1389
1473
  coreConfig.types.rightsManagementPolicyInformationSourceComponent.push({
1390
1474
  type: policyInformationSourceType
1391
1475
  });
1392
1476
  }
1393
1477
  coreConfig.types.rightsManagementPolicyRequesterComponent ??= [];
1394
- const policyRequesterTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyRequesters);
1478
+ const policyRequesterTypes = envListToArray(envVars, "rightsManagementPolicyRequesters", Object.values(RightsManagementPolicyRequesterComponentType));
1395
1479
  for (const policyRequesterType of policyRequesterTypes) {
1396
1480
  coreConfig.types.rightsManagementPolicyRequesterComponent.push({
1397
1481
  type: policyRequesterType
1398
1482
  });
1399
1483
  }
1400
1484
  coreConfig.types.rightsManagementPolicyNegotiatorComponent ??= [];
1401
- const policyNegotiatorTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyNegotiators);
1485
+ const policyNegotiatorTypes = envListToArray(envVars, "rightsManagementPolicyNegotiators", Object.values(RightsManagementPolicyNegotiatorComponentType));
1402
1486
  for (const policyNegotiatorType of policyNegotiatorTypes) {
1403
1487
  coreConfig.types.rightsManagementPolicyNegotiatorComponent.push({
1404
1488
  type: policyNegotiatorType
@@ -1448,7 +1532,7 @@ async function configureFederatedCatalogue(coreConfig, envVars) {
1448
1532
  }
1449
1533
  });
1450
1534
  coreConfig.types.federatedCatalogueFilterComponent ??= [];
1451
- const filters = commaSeparatedListToArray(envVars.federatedCatalogueFilters);
1535
+ const filters = envListToArray(envVars, "federatedCatalogueFilters", Object.values(FederatedCatalogueFilterComponentType));
1452
1536
  for (const filter of filters) {
1453
1537
  coreConfig.types.federatedCatalogueFilterComponent.push({
1454
1538
  type: filter,
@@ -1571,7 +1655,8 @@ export function isTrustRequired(envVars) {
1571
1655
  export function isBackgroundTasksRequired(envVars) {
1572
1656
  return (envBoolean(envVars, "dataspaceEnabled", false) ||
1573
1657
  isImmutableProofRequired(envVars) ||
1574
- envBoolean(envVars, "healthEnabled", false));
1658
+ envBoolean(envVars, "healthEnabled", false) ||
1659
+ commaSeparatedListToArray(envVars.telemetryConnector).includes(TelemetryConnectorType.EntityStorage));
1575
1660
  }
1576
1661
  /**
1577
1662
  * Checks if the immutable proof subsystem is required.
@@ -1619,7 +1704,8 @@ export function isTaskSchedulerRequired(envVars) {
1619
1704
  envBoolean(envVars, "dataspaceEnabled", false) ||
1620
1705
  isRightsManagementRequired(envVars) ||
1621
1706
  isAuthEntityStorageRequired(envVars) ||
1622
- isImmutableProofRequired(envVars));
1707
+ isImmutableProofRequired(envVars) ||
1708
+ isMailboxEnabled(envVars));
1623
1709
  }
1624
1710
  /**
1625
1711
  * Checks if the automation subsystem is required.
@@ -1646,6 +1732,20 @@ export function isTelemetryEnabled(envVars) {
1646
1732
  * @returns True if tracing is enabled.
1647
1733
  */
1648
1734
  export function isTracingEnabled(envVars) {
1649
- return commaSeparatedListToArray(envVars.tracingConnector).some(t => t === TracingConnectorType.EntityStorage || t === TracingConnectorType.OpenTelemetry);
1735
+ return commaSeparatedListToArray(envVars.tracingConnector).some(t => t === TracingConnectorType.EntityStorage ||
1736
+ t === TracingConnectorType.OpenTelemetry ||
1737
+ t === TracingConnectorType.Console);
1738
+ }
1739
+ /**
1740
+ * Checks if the mailbox subsystem is enabled.
1741
+ * Returns true when any component that depends on the mailbox subsystem is enabled.
1742
+ * @param envVars The environment variables.
1743
+ * @returns True if mailbox is enabled.
1744
+ */
1745
+ export function isMailboxEnabled(envVars) {
1746
+ return commaSeparatedListToArray(envVars.emailProtocolConnector).some(t => t === EmailProtocolConnectorType.Imap ||
1747
+ t === EmailProtocolConnectorType.Pop3 ||
1748
+ t === EmailProtocolConnectorType.Gmail ||
1749
+ t === EmailProtocolConnectorType.Outlook);
1650
1750
  }
1651
1751
  //# sourceMappingURL=engineEnvBuilder.js.map