@twin.org/node-core 0.9.4-next.4 → 0.9.4

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 (44) hide show
  1. package/dist/es/builders/engineEnvBuilder.js +365 -466
  2. package/dist/es/builders/engineEnvBuilder.js.map +1 -1
  3. package/dist/es/builders/engineServerEnvBuilder.js +2 -5
  4. package/dist/es/builders/engineServerEnvBuilder.js.map +1 -1
  5. package/dist/es/builders/helper/envHelpers.js +0 -39
  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/models/IEngineEnvironmentVariables.js.map +1 -1
  24. package/dist/es/models/IEngineServerEnvironmentVariables.js.map +1 -1
  25. package/dist/es/models/engineEnvironmentVariableKeys.js +2 -13
  26. package/dist/es/models/engineEnvironmentVariableKeys.js.map +1 -1
  27. package/dist/es/models/engineServerEnvironmentVariableKeys.js +0 -1
  28. package/dist/es/models/engineServerEnvironmentVariableKeys.js.map +1 -1
  29. package/dist/es/node.js +21 -40
  30. package/dist/es/node.js.map +1 -1
  31. package/dist/types/builders/engineEnvBuilder.d.ts +0 -7
  32. package/dist/types/builders/helper/envHelpers.d.ts +0 -30
  33. package/dist/types/models/IEngineEnvironmentVariables.d.ts +8 -44
  34. package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +0 -4
  35. package/docs/changelog.md +24 -171
  36. package/docs/reference/index.md +0 -1
  37. package/docs/reference/interfaces/IEngineEnvironmentVariables.md +13 -85
  38. package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +0 -8
  39. package/locales/en.json +1 -3
  40. package/package.json +34 -34
  41. package/dist/es/models/deprecatedEnvironmentVariableKeys.js +0 -16
  42. package/dist/es/models/deprecatedEnvironmentVariableKeys.js.map +0 -1
  43. package/dist/types/models/deprecatedEnvironmentVariableKeys.d.ts +0 -7
  44. package/docs/reference/functions/isMailboxEnabled.md +0 -20
@@ -1,16 +1,15 @@
1
1
  // Copyright 2024 IOTA Stiftung.
2
2
  // SPDX-License-Identifier: Apache-2.0.
3
- import { cpus } from "node:os";
4
3
  import path from "node:path";
5
4
  import { Is, Mutex } from "@twin.org/core";
6
5
  import { EngineCloneMode } from "@twin.org/engine-models";
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";
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";
8
7
  import { OpenTelemetryExporterTypes } from "@twin.org/logging-connector-opentelemetry";
9
8
  import { OpenTelemetryReaderTypes } from "@twin.org/telemetry-connector-opentelemetry";
10
9
  import { OpenTelemetryProcessorTypes } from "@twin.org/tracing-connector-opentelemetry";
11
10
  import { CONTEXT_ID_HANDLER_FEATURE_DID, CONTEXT_ID_HANDLER_FEATURE_TENANT } from "../defaults.js";
12
11
  import { isAuthEntityStorageRequired } from "./engineServerEnvBuilder.js";
13
- import { commaSeparatedListToArray, envArray, envBoolean, envChoice, envCount, envDateTime, envInteger, envListToArray, envMinToMs, envMinutes, envMs, envSecToMs, envSeconds } from "./helper/envHelpers.js";
12
+ import { commaSeparatedListToArray, envArray, envBoolean, envCount, envDateTime, envInteger, envMinToMs, envMinutes, envMs, envSecToMs, envSeconds } from "./helper/envHelpers.js";
14
13
  /**
15
14
  * Build the engine core configuration from environment variables.
16
15
  * @param envVars The environment variables.
@@ -33,7 +32,7 @@ export async function buildEngineConfiguration(envVars) {
33
32
  types: {}
34
33
  };
35
34
  const mutexTimeoutMs = envMs(envVars, "mutexTimeoutDefault");
36
- if (Is.notEmpty(mutexTimeoutMs)) {
35
+ if (!Is.empty(mutexTimeoutMs)) {
37
36
  Mutex.setDefaultTimeoutMs(mutexTimeoutMs);
38
37
  }
39
38
  await configureSchemaMigration(coreConfig, envVars);
@@ -52,7 +51,6 @@ export async function buildEngineConfiguration(envVars) {
52
51
  await configureMetricsCollector(coreConfig, envVars);
53
52
  await configureTracing(coreConfig, envVars);
54
53
  await configureMessaging(coreConfig, envVars);
55
- await configureMailbox(coreConfig, envVars);
56
54
  await configureAutomation(coreConfig, envVars);
57
55
  await configureHealth(coreConfig, envVars);
58
56
  await configureFaucet(coreConfig, envVars);
@@ -83,165 +81,163 @@ export async function buildEngineConfiguration(envVars) {
83
81
  async function configureEntityStorage(coreConfig, envVars) {
84
82
  coreConfig.types ??= {};
85
83
  coreConfig.types.entityStorageConnector ??= [];
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")
94
- }
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
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")
242
91
  }
243
- });
244
- }
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")
236
+ }
237
+ },
238
+ tablePrefix: envVars.entityStorageTablePrefix
239
+ }
240
+ });
245
241
  }
246
242
  const defaultEntityStorageConnectorType = envVars.entityStorageConnectorDefault ?? entityStorageConnectorTypes[0];
247
243
  if (Is.arrayValue(entityStorageConnectorTypes)) {
@@ -261,88 +257,85 @@ async function configureEntityStorage(coreConfig, envVars) {
261
257
  */
262
258
  async function configureBlobStorage(coreConfig, envVars) {
263
259
  coreConfig.types.blobStorageConnector ??= [];
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
281
- }
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
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
336
286
  }
337
- });
338
- }
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
+ });
339
333
  }
340
334
  if (Is.arrayValue(blobStorageConnectorTypes)) {
341
335
  const defaultStorageConnectorType = envVars.blobStorageConnectorDefault ?? blobStorageConnectorTypes[0];
342
336
  for (const config of coreConfig.types.blobStorageConnector) {
343
337
  if (config.type === defaultStorageConnectorType) {
344
338
  config.isDefault = true;
345
- break;
346
339
  }
347
340
  }
348
341
  }
@@ -368,7 +361,7 @@ async function configureBlobStorage(coreConfig, envVars) {
368
361
  */
369
362
  async function configureLogging(coreConfig, envVars) {
370
363
  coreConfig.types.loggingConnector ??= [];
371
- const loggingConnectorTypes = envListToArray(envVars, "loggingConnector", Object.values(LoggingConnectorType));
364
+ const loggingConnectorTypes = commaSeparatedListToArray(envVars.loggingConnector);
372
365
  let additionalConnectorCount = 0;
373
366
  for (const loggingConnector of loggingConnectorTypes) {
374
367
  if (loggingConnector === LoggingConnectorType.Console) {
@@ -470,8 +463,7 @@ async function configureLogging(coreConfig, envVars) {
470
463
  */
471
464
  async function configureVault(coreConfig, envVars) {
472
465
  coreConfig.types.vaultConnector ??= [];
473
- const vaultConnectorType = envChoice(envVars, "vaultConnector", Object.values(VaultConnectorType));
474
- if (vaultConnectorType === VaultConnectorType.EntityStorage) {
466
+ if (envVars.vaultConnector === VaultConnectorType.EntityStorage) {
475
467
  coreConfig.types.vaultConnector.push({
476
468
  type: VaultConnectorType.EntityStorage,
477
469
  options: {
@@ -481,7 +473,7 @@ async function configureVault(coreConfig, envVars) {
481
473
  }
482
474
  });
483
475
  }
484
- else if (vaultConnectorType === VaultConnectorType.Hashicorp) {
476
+ else if (envVars.vaultConnector === VaultConnectorType.Hashicorp) {
485
477
  coreConfig.types.vaultConnector.push({
486
478
  type: VaultConnectorType.Hashicorp,
487
479
  options: {
@@ -504,16 +496,7 @@ async function configureBackgroundTask(coreConfig, envVars) {
504
496
  coreConfig.types.backgroundTaskComponent ??= [];
505
497
  if (isBackgroundTasksRequired(envVars)) {
506
498
  coreConfig.types.backgroundTaskComponent.push({
507
- type: BackgroundTaskComponentType.Service,
508
- options: {
509
- config: {
510
- maxSystemWorkerCount: envCount(envVars, "backgroundTaskMaxSystemWorkerCount", cpus().length * 2),
511
- taskInterval: envMs(envVars, "backgroundTaskInterval"),
512
- retryInterval: envMs(envVars, "backgroundTaskRetryInterval"),
513
- cleanupInterval: envMs(envVars, "backgroundTaskCleanupInterval"),
514
- workerShutdownTimeout: envMs(envVars, "backgroundTaskWorkerShutdownTimeout")
515
- }
516
- }
499
+ type: BackgroundTaskComponentType.Service
517
500
  });
518
501
  }
519
502
  }
@@ -525,8 +508,7 @@ async function configureBackgroundTask(coreConfig, envVars) {
525
508
  */
526
509
  async function configureEventBus(coreConfig, envVars) {
527
510
  coreConfig.types.eventBusConnector ??= [];
528
- const eventBusConnectorType = envChoice(envVars, "eventBusConnector", Object.values(EventBusConnectorType));
529
- if (eventBusConnectorType === EventBusConnectorType.Local) {
511
+ if (envVars.eventBusConnector === EventBusConnectorType.Local) {
530
512
  coreConfig.types.eventBusConnector.push({
531
513
  type: EventBusConnectorType.Local
532
514
  });
@@ -544,16 +526,16 @@ async function configureEventBus(coreConfig, envVars) {
544
526
  */
545
527
  async function configureTelemetry(coreConfig, envVars) {
546
528
  coreConfig.types.telemetryConnector ??= [];
547
- const telemetryConnectorTypes = envListToArray(envVars, "telemetryConnector", Object.values(TelemetryConnectorType));
529
+ const telemetryConnectorTypes = commaSeparatedListToArray(envVars.telemetryConnector);
548
530
  let additionalConnectorCount = 0;
549
- for (const telemetryConnectorType of telemetryConnectorTypes) {
550
- if (telemetryConnectorType === TelemetryConnectorType.Silent) {
531
+ for (const telemetryConnector of telemetryConnectorTypes) {
532
+ if (telemetryConnector === TelemetryConnectorType.Silent) {
551
533
  coreConfig.types.telemetryConnector.push({
552
534
  type: TelemetryConnectorType.Silent
553
535
  });
554
536
  additionalConnectorCount++;
555
537
  }
556
- else if (telemetryConnectorType === TelemetryConnectorType.EntityStorage) {
538
+ else if (telemetryConnector === TelemetryConnectorType.EntityStorage) {
557
539
  coreConfig.types.telemetryConnector.push({
558
540
  type: TelemetryConnectorType.EntityStorage,
559
541
  options: {
@@ -569,7 +551,7 @@ async function configureTelemetry(coreConfig, envVars) {
569
551
  });
570
552
  additionalConnectorCount++;
571
553
  }
572
- else if (telemetryConnectorType === TelemetryConnectorType.OpenTelemetry) {
554
+ else if (telemetryConnector === TelemetryConnectorType.OpenTelemetry) {
573
555
  let readers;
574
556
  if (envVars.openTelemetryReader === OpenTelemetryReaderTypes.Prometheus) {
575
557
  readers = {
@@ -632,10 +614,8 @@ async function configureMetricsCollector(coreConfig, envVars) {
632
614
  cloneMode: EngineCloneMode.Never
633
615
  });
634
616
  coreConfig.types.metricsProducerComponent ??= [];
635
- const metricsProducers = envListToArray(envVars, "telemetryMetricsProducers", Object.values(MetricsProducerComponentType), [
636
- MetricsProducerComponentType.System,
637
- MetricsProducerComponentType.Process
638
- ]);
617
+ const metricsProducers = commaSeparatedListToArray(envVars.telemetryMetricsProducers ??
618
+ [MetricsProducerComponentType.System, MetricsProducerComponentType.Process].join(","));
639
619
  for (const producerType of metricsProducers) {
640
620
  coreConfig.types.metricsProducerComponent.push({
641
621
  type: producerType,
@@ -653,16 +633,16 @@ async function configureMetricsCollector(coreConfig, envVars) {
653
633
  */
654
634
  async function configureTracing(coreConfig, envVars) {
655
635
  coreConfig.types.tracingConnector ??= [];
656
- const tracingConnectorTypes = envListToArray(envVars, "tracingConnector", Object.values(TracingConnectorType));
636
+ const tracingConnectorTypes = commaSeparatedListToArray(envVars.tracingConnector);
657
637
  let additionalConnectorCount = 0;
658
- for (const tracingConnectorType of tracingConnectorTypes) {
659
- if (tracingConnectorType === TracingConnectorType.Silent) {
638
+ for (const tracingConnector of tracingConnectorTypes) {
639
+ if (tracingConnector === TracingConnectorType.Silent) {
660
640
  coreConfig.types.tracingConnector.push({
661
641
  type: TracingConnectorType.Silent
662
642
  });
663
643
  additionalConnectorCount++;
664
644
  }
665
- else if (tracingConnectorType === TracingConnectorType.EntityStorage) {
645
+ else if (tracingConnector === TracingConnectorType.EntityStorage) {
666
646
  coreConfig.types.tracingConnector.push({
667
647
  type: TracingConnectorType.EntityStorage,
668
648
  options: {
@@ -673,13 +653,7 @@ async function configureTracing(coreConfig, envVars) {
673
653
  });
674
654
  additionalConnectorCount++;
675
655
  }
676
- else if (tracingConnectorType === TracingConnectorType.Console) {
677
- coreConfig.types.tracingConnector.push({
678
- type: TracingConnectorType.Console
679
- });
680
- additionalConnectorCount++;
681
- }
682
- else if (tracingConnectorType === TracingConnectorType.OpenTelemetry) {
656
+ else if (tracingConnector === TracingConnectorType.OpenTelemetry) {
683
657
  const otelTracingConfig = {
684
658
  tracerName: envVars.openTelemetryTracingTracerName,
685
659
  tracerVersion: envVars.openTelemetryTracingTracerVersion
@@ -735,13 +709,15 @@ async function configureAutomation(coreConfig, envVars) {
735
709
  coreConfig.types.automationComponent.push({
736
710
  type: AutomationComponentType.Service
737
711
  });
738
- const automationActionTypes = envListToArray(envVars, "automationActionTypes", Object.values(AutomationActionType));
739
- coreConfig.types.automationAction ??= [];
740
- for (const actionType of automationActionTypes) {
741
- coreConfig.types.automationAction.push({
742
- type: actionType,
743
- isMultiInstance: true
744
- });
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
+ }
745
721
  }
746
722
  }
747
723
  }
@@ -844,89 +820,69 @@ async function configureContextIdHandlers(coreConfig, envVars) {
844
820
  * @returns A promise that resolves when the messaging configuration has been applied.
845
821
  */
846
822
  async function configureMessaging(coreConfig, envVars) {
847
- coreConfig.types.messagingEmailConnector ??= [];
848
- coreConfig.types.messagingSmsConnector ??= [];
849
- coreConfig.types.messagingPushNotificationConnector ??= [];
850
- const messagingEmailConnectorType = envChoice(envVars, "messagingEmailConnector", Object.values(MessagingEmailConnectorType));
851
- if (messagingEmailConnectorType === MessagingEmailConnectorType.EntityStorage) {
852
- coreConfig.types.messagingEmailConnector.push({
853
- type: MessagingEmailConnectorType.EntityStorage
854
- });
855
- }
856
- else if (messagingEmailConnectorType === MessagingEmailConnectorType.Aws) {
857
- coreConfig.types.messagingEmailConnector.push({
858
- type: MessagingEmailConnectorType.Aws,
859
- options: {
860
- config: {
861
- region: envVars.awsSesRegion ?? "",
862
- authMode: envVars.awsSesAuthMode,
863
- accessKeyId: envVars.awsSesAccessKeyId,
864
- secretAccessKey: envVars.awsSesSecretAccessKey,
865
- endpoint: envVars.awsSesEndpoint
866
- }
867
- }
868
- });
869
- }
870
- else if (messagingEmailConnectorType === MessagingEmailConnectorType.Smtp) {
871
- coreConfig.types.messagingEmailConnector.push({
872
- type: MessagingEmailConnectorType.Smtp,
873
- options: {
874
- config: {
875
- host: envVars.smtpHost ?? "",
876
- port: envInteger(envVars, "smtpPort"),
877
- secure: envBoolean(envVars, "smtpSecure"),
878
- username: envVars.smtpUsername,
879
- password: envVars.smtpPassword
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
+ }
880
843
  }
881
- }
882
- });
883
- }
884
- const messagingSmsConnectorType = envChoice(envVars, "messagingSmsConnector", Object.values(MessagingSmsConnectorType));
885
- if (messagingSmsConnectorType === MessagingSmsConnectorType.EntityStorage) {
886
- coreConfig.types.messagingSmsConnector.push({
887
- type: MessagingSmsConnectorType.EntityStorage
888
- });
889
- }
890
- else if (messagingSmsConnectorType === MessagingSmsConnectorType.Aws) {
891
- coreConfig.types.messagingSmsConnector.push({
892
- type: MessagingSmsConnectorType.Aws,
893
- options: {
894
- config: {
895
- region: envVars.awsSesRegion ?? "",
896
- authMode: envVars.awsSesAuthMode,
897
- accessKeyId: envVars.awsSesAccessKeyId,
898
- secretAccessKey: envVars.awsSesSecretAccessKey,
899
- endpoint: envVars.awsSesEndpoint
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
+ }
900
862
  }
901
- }
902
- });
903
- }
904
- const messagingPushConnectorType = envChoice(envVars, "messagingPushNotificationConnector", Object.values(MessagingPushNotificationConnectorType));
905
- if (messagingPushConnectorType === MessagingPushNotificationConnectorType.EntityStorage) {
906
- coreConfig.types.messagingPushNotificationConnector.push({
907
- type: MessagingPushNotificationConnectorType.EntityStorage
908
- });
909
- }
910
- else if (messagingPushConnectorType === MessagingPushNotificationConnectorType.Aws) {
911
- coreConfig.types.messagingPushNotificationConnector.push({
912
- type: MessagingPushNotificationConnectorType.Aws,
913
- options: {
914
- config: {
915
- region: envVars.awsSesRegion ?? "",
916
- authMode: envVars.awsSesAuthMode,
917
- accessKeyId: envVars.awsSesAccessKeyId,
918
- secretAccessKey: envVars.awsSesSecretAccessKey,
919
- endpoint: envVars.awsSesEndpoint,
920
- applicationsSettings: envArray(envVars, "awsMessagingPushNotificationApplications", [])
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
+ }
921
883
  }
922
- }
923
- });
924
- }
925
- // If any messaging connectors are configured, then we should configure the messaging admin and
926
- // service components as well since they are required for the messaging connectors to work.
927
- if (coreConfig.types.messagingEmailConnector.length > 0 ||
928
- coreConfig.types.messagingSmsConnector.length > 0 ||
929
- coreConfig.types.messagingPushNotificationConnector.length > 0) {
884
+ });
885
+ }
930
886
  coreConfig.types.messagingAdminComponent ??= [];
931
887
  coreConfig.types.messagingAdminComponent.push({
932
888
  type: MessagingAdminComponentType.Service
@@ -935,40 +891,6 @@ async function configureMessaging(coreConfig, envVars) {
935
891
  coreConfig.types.messagingComponent.push({ type: MessagingComponentType.Service });
936
892
  }
937
893
  }
938
- /**
939
- * Configures mailbox components, mail storage components, and email protocol connectors.
940
- * @param coreConfig The core config.
941
- * @param envVars The environment variables.
942
- * @returns A promise that resolves when the mailbox configuration has been applied.
943
- */
944
- async function configureMailbox(coreConfig, envVars) {
945
- coreConfig.types.emailProtocolConnector ??= [];
946
- const emailProtocolConnectorTypes = envListToArray(envVars, "emailProtocolConnector", Object.values(EmailProtocolConnectorType));
947
- for (const emailProtocolConnectorType of emailProtocolConnectorTypes) {
948
- coreConfig.types.emailProtocolConnector.push({
949
- type: emailProtocolConnectorType,
950
- options: {
951
- config: {}
952
- },
953
- cloneMode: EngineCloneMode.Never,
954
- isMultiInstance: true
955
- });
956
- }
957
- // If email protocol connectors are configured, then we should configure the mailbox and mail store
958
- // components as well, since they are required for the email protocol connectors to work.
959
- if (coreConfig.types.emailProtocolConnector.length > 0) {
960
- coreConfig.types.mailStorageComponent ??= [];
961
- coreConfig.types.mailStorageComponent.push({
962
- type: MailStorageComponentType.Service,
963
- cloneMode: EngineCloneMode.Never
964
- });
965
- coreConfig.types.mailboxComponent ??= [];
966
- coreConfig.types.mailboxComponent.push({
967
- type: MailboxComponentType.Service,
968
- cloneMode: EngineCloneMode.Never
969
- });
970
- }
971
- }
972
894
  /**
973
895
  * Configures the faucet.
974
896
  * @param coreConfig The core config.
@@ -977,13 +899,12 @@ async function configureMailbox(coreConfig, envVars) {
977
899
  */
978
900
  async function configureFaucet(coreConfig, envVars) {
979
901
  coreConfig.types.faucetConnector ??= [];
980
- const faucetConnectorType = envChoice(envVars, "faucetConnector", Object.values(FaucetConnectorType));
981
- if (faucetConnectorType === FaucetConnectorType.EntityStorage) {
902
+ if (envVars.faucetConnector === FaucetConnectorType.EntityStorage) {
982
903
  coreConfig.types.faucetConnector.push({
983
904
  type: FaucetConnectorType.EntityStorage
984
905
  });
985
906
  }
986
- else if (faucetConnectorType === FaucetConnectorType.Iota &&
907
+ else if (envVars.faucetConnector === FaucetConnectorType.Iota &&
987
908
  Is.stringValue(envVars.iotaFaucetEndpoint)) {
988
909
  const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
989
910
  coreConfig.types.faucetConnector.push({
@@ -1006,13 +927,12 @@ async function configureFaucet(coreConfig, envVars) {
1006
927
  */
1007
928
  async function configureWallet(coreConfig, envVars) {
1008
929
  coreConfig.types.walletConnector ??= [];
1009
- const walletConnectorType = envChoice(envVars, "walletConnector", Object.values(WalletConnectorType));
1010
- if (walletConnectorType === WalletConnectorType.EntityStorage) {
930
+ if (envVars.walletConnector === WalletConnectorType.EntityStorage) {
1011
931
  coreConfig.types.walletConnector.push({
1012
932
  type: WalletConnectorType.EntityStorage
1013
933
  });
1014
934
  }
1015
- else if (walletConnectorType === WalletConnectorType.Iota) {
935
+ else if (envVars.walletConnector === WalletConnectorType.Iota) {
1016
936
  const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
1017
937
  coreConfig.types.walletConnector.push({
1018
938
  type: WalletConnectorType.Iota,
@@ -1030,13 +950,12 @@ async function configureWallet(coreConfig, envVars) {
1030
950
  */
1031
951
  async function configureNft(coreConfig, envVars) {
1032
952
  coreConfig.types.nftConnector ??= [];
1033
- const nftConnectorType = envChoice(envVars, "nftConnector", Object.values(NftConnectorType));
1034
- if (nftConnectorType === NftConnectorType.EntityStorage) {
953
+ if (envVars.nftConnector === NftConnectorType.EntityStorage) {
1035
954
  coreConfig.types.nftConnector.push({
1036
955
  type: NftConnectorType.EntityStorage
1037
956
  });
1038
957
  }
1039
- else if (nftConnectorType === NftConnectorType.Iota) {
958
+ else if (envVars.nftConnector === NftConnectorType.Iota) {
1040
959
  const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
1041
960
  const config = {
1042
961
  ...dltConfig?.options?.config,
@@ -1062,13 +981,12 @@ async function configureNft(coreConfig, envVars) {
1062
981
  */
1063
982
  async function configureNotarization(coreConfig, envVars) {
1064
983
  coreConfig.types.notarizationConnector ??= [];
1065
- const notarizationConnectorType = envChoice(envVars, "notarizationConnector", Object.values(NotarizationConnectorType));
1066
- if (notarizationConnectorType === NotarizationConnectorType.EntityStorage) {
984
+ if (envVars.notarizationConnector === NotarizationConnectorType.EntityStorage) {
1067
985
  coreConfig.types.notarizationConnector.push({
1068
986
  type: NotarizationConnectorType.EntityStorage
1069
987
  });
1070
988
  }
1071
- else if (notarizationConnectorType === NotarizationConnectorType.Iota) {
989
+ else if (envVars.notarizationConnector === NotarizationConnectorType.Iota) {
1072
990
  const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
1073
991
  coreConfig.types.notarizationConnector.push({
1074
992
  type: NotarizationConnectorType.Iota,
@@ -1118,13 +1036,12 @@ async function configureImmutableProof(coreConfig, envVars) {
1118
1036
  */
1119
1037
  async function configureIdentity(coreConfig, envVars) {
1120
1038
  coreConfig.types.identityConnector ??= [];
1121
- const identityConnectorType = envChoice(envVars, "identityConnector", Object.values(IdentityConnectorType));
1122
- if (identityConnectorType === IdentityConnectorType.EntityStorage) {
1039
+ if (envVars.identityConnector === IdentityConnectorType.EntityStorage) {
1123
1040
  coreConfig.types.identityConnector.push({
1124
1041
  type: IdentityConnectorType.EntityStorage
1125
1042
  });
1126
1043
  }
1127
- else if (identityConnectorType === IdentityConnectorType.Iota) {
1044
+ else if (envVars.identityConnector === IdentityConnectorType.Iota) {
1128
1045
  const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
1129
1046
  coreConfig.types.identityConnector.push({
1130
1047
  type: IdentityConnectorType.Iota,
@@ -1157,13 +1074,12 @@ async function configureIdentity(coreConfig, envVars) {
1157
1074
  */
1158
1075
  async function configureIdentityResolver(coreConfig, envVars) {
1159
1076
  coreConfig.types.identityResolverConnector ??= [];
1160
- const identityResolverConnectorType = envChoice(envVars, "identityResolverConnector", Object.values(IdentityResolverConnectorType));
1161
- if (identityResolverConnectorType === IdentityResolverConnectorType.EntityStorage) {
1077
+ if (envVars.identityResolverConnector === IdentityResolverConnectorType.EntityStorage) {
1162
1078
  coreConfig.types.identityResolverConnector.push({
1163
1079
  type: IdentityResolverConnectorType.EntityStorage
1164
1080
  });
1165
1081
  }
1166
- else if (identityResolverConnectorType === IdentityResolverConnectorType.Iota) {
1082
+ else if (envVars.identityResolverConnector === IdentityResolverConnectorType.Iota) {
1167
1083
  const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
1168
1084
  coreConfig.types.identityResolverConnector.push({
1169
1085
  type: IdentityResolverConnectorType.Iota,
@@ -1177,7 +1093,7 @@ async function configureIdentityResolver(coreConfig, envVars) {
1177
1093
  }
1178
1094
  });
1179
1095
  }
1180
- else if (identityResolverConnectorType === IdentityResolverConnectorType.Universal) {
1096
+ else if (envVars.identityResolverConnector === IdentityResolverConnectorType.Universal) {
1181
1097
  coreConfig.types.identityResolverConnector.push({
1182
1098
  type: IdentityResolverConnectorType.Universal,
1183
1099
  options: {
@@ -1202,8 +1118,7 @@ async function configureIdentityResolver(coreConfig, envVars) {
1202
1118
  */
1203
1119
  async function configureIdentityProfile(coreConfig, envVars) {
1204
1120
  coreConfig.types.identityProfileConnector ??= [];
1205
- const identityProfileConnectorType = envChoice(envVars, "identityProfileConnector", Object.values(IdentityProfileConnectorType));
1206
- if (identityProfileConnectorType === IdentityProfileConnectorType.EntityStorage) {
1121
+ if (envVars.identityProfileConnector === IdentityConnectorType.EntityStorage) {
1207
1122
  coreConfig.types.identityProfileConnector.push({
1208
1123
  type: IdentityProfileConnectorType.EntityStorage
1209
1124
  });
@@ -1221,8 +1136,7 @@ async function configureIdentityProfile(coreConfig, envVars) {
1221
1136
  */
1222
1137
  async function configureAttestation(coreConfig, envVars) {
1223
1138
  coreConfig.types.attestationConnector ??= [];
1224
- const attestationConnectorType = envChoice(envVars, "attestationConnector", Object.values(AttestationConnectorType));
1225
- if (attestationConnectorType === AttestationConnectorType.Nft) {
1139
+ if (envVars.attestationConnector === AttestationConnectorType.Nft) {
1226
1140
  coreConfig.types.attestationConnector.push({
1227
1141
  type: AttestationConnectorType.Nft
1228
1142
  });
@@ -1284,24 +1198,23 @@ async function configureAuditableItemStream(coreConfig, envVars) {
1284
1198
  * @returns A promise that resolves when the data processing configuration has been applied.
1285
1199
  */
1286
1200
  async function configureDataProcessing(coreConfig, envVars) {
1287
- coreConfig.types.dataConverterConnector ??= [];
1288
- const converterConnectors = envListToArray(envVars, "dataConverterConnectors", Object.values(DataConverterConnectorType));
1289
- for (const converterConnector of converterConnectors) {
1290
- coreConfig.types.dataConverterConnector.push({
1291
- type: converterConnector
1292
- });
1293
- }
1294
- coreConfig.types.dataExtractorConnector ??= [];
1295
- const extractorConnectors = envListToArray(envVars, "dataExtractorConnectors", Object.values(DataExtractorConnectorType));
1296
- for (const extractorConnector of extractorConnectors) {
1297
- coreConfig.types.dataExtractorConnector.push({
1298
- type: extractorConnector
1299
- });
1300
- }
1301
- if (coreConfig.types.dataConverterConnector.length > 0 ||
1302
- coreConfig.types.dataExtractorConnector.length > 0) {
1201
+ if (envBoolean(envVars, "dataProcessingEnabled", false)) {
1303
1202
  coreConfig.types.dataProcessingComponent ??= [];
1304
1203
  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
+ }
1305
1218
  }
1306
1219
  }
1307
1220
  /**
@@ -1336,7 +1249,7 @@ async function configureTrust(coreConfig, envVars) {
1336
1249
  type: TrustComponentType.Service
1337
1250
  });
1338
1251
  coreConfig.types.trustGeneratorComponent ??= [];
1339
- const trustGeneratorTypes = envListToArray(envVars, "trustGenerators", Object.values(TrustGeneratorComponentType));
1252
+ const trustGeneratorTypes = commaSeparatedListToArray(envVars.trustGenerators);
1340
1253
  for (const trustGeneratorType of trustGeneratorTypes) {
1341
1254
  coreConfig.types.trustGeneratorComponent.push({
1342
1255
  type: trustGeneratorType,
@@ -1349,11 +1262,12 @@ async function configureTrust(coreConfig, envVars) {
1349
1262
  });
1350
1263
  }
1351
1264
  coreConfig.types.trustVerifierComponent ??= [];
1352
- const trustVerifierTypes = envListToArray(envVars, "trustVerifiers", Object.values(TrustVerifierComponentType));
1265
+ const trustVerifierTypes = commaSeparatedListToArray(envVars.trustVerifiers);
1353
1266
  for (const trustVerifierType of trustVerifierTypes) {
1354
- if (trustVerifierType === TrustVerifierComponentType.IdentityAllowDeny) {
1267
+ const type = trustVerifierType;
1268
+ if (type === TrustVerifierComponentType.IdentityAllowDeny) {
1355
1269
  coreConfig.types.trustVerifierComponent.push({
1356
- type: TrustVerifierComponentType.IdentityAllowDeny,
1270
+ type,
1357
1271
  options: {
1358
1272
  config: {
1359
1273
  allowIdentities: commaSeparatedListToArray(envVars.trustIdentitiesAllow),
@@ -1362,9 +1276,9 @@ async function configureTrust(coreConfig, envVars) {
1362
1276
  }
1363
1277
  });
1364
1278
  }
1365
- else if (trustVerifierType === TrustVerifierComponentType.JwtVerifiableCredential) {
1279
+ else {
1366
1280
  coreConfig.types.trustVerifierComponent.push({
1367
- type: TrustVerifierComponentType.JwtVerifiableCredential
1281
+ type
1368
1282
  });
1369
1283
  }
1370
1284
  }
@@ -1442,49 +1356,49 @@ async function configureRightsManagement(coreConfig, envVars) {
1442
1356
  }
1443
1357
  });
1444
1358
  coreConfig.types.rightsManagementPolicyArbiterComponent ??= [];
1445
- const policyArbiterTypes = envListToArray(envVars, "rightsManagementPolicyArbiters", Object.values(RightsManagementPolicyArbiterComponentType));
1359
+ const policyArbiterTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyArbiters);
1446
1360
  for (const policyArbiterType of policyArbiterTypes) {
1447
1361
  coreConfig.types.rightsManagementPolicyArbiterComponent.push({
1448
1362
  type: policyArbiterType
1449
1363
  });
1450
1364
  }
1451
1365
  coreConfig.types.rightsManagementPolicyObligationEnforcerComponent ??= [];
1452
- const policyObligationEnforcerTypes = envListToArray(envVars, "rightsManagementPolicyObligationEnforcers", Object.values(RightsManagementPolicyObligationEnforcerComponentType));
1366
+ const policyObligationEnforcerTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyObligationEnforcers);
1453
1367
  for (const policyObligationEnforcerType of policyObligationEnforcerTypes) {
1454
1368
  coreConfig.types.rightsManagementPolicyObligationEnforcerComponent.push({
1455
1369
  type: policyObligationEnforcerType
1456
1370
  });
1457
1371
  }
1458
1372
  coreConfig.types.rightsManagementPolicyEnforcementProcessorComponent ??= [];
1459
- const policyEnforcementProcessTypes = envListToArray(envVars, "rightsManagementPolicyEnforcementProcessors", Object.values(RightsManagementPolicyEnforcementProcessorComponentType));
1373
+ const policyEnforcementProcessTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyEnforcementProcessors);
1460
1374
  for (const policyEnforcementProcessorType of policyEnforcementProcessTypes) {
1461
1375
  coreConfig.types.rightsManagementPolicyEnforcementProcessorComponent.push({
1462
1376
  type: policyEnforcementProcessorType
1463
1377
  });
1464
1378
  }
1465
1379
  coreConfig.types.rightsManagementPolicyExecutionActionComponent ??= [];
1466
- const policyExecutionActionTypes = envListToArray(envVars, "rightsManagementPolicyExecutionActions", Object.values(RightsManagementPolicyExecutionActionComponentType));
1380
+ const policyExecutionActionTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyExecutionActions);
1467
1381
  for (const policyExecutionActionType of policyExecutionActionTypes) {
1468
1382
  coreConfig.types.rightsManagementPolicyExecutionActionComponent.push({
1469
1383
  type: policyExecutionActionType
1470
1384
  });
1471
1385
  }
1472
1386
  coreConfig.types.rightsManagementPolicyInformationSourceComponent ??= [];
1473
- const policyInformationSourceTypes = envListToArray(envVars, "rightsManagementPolicyInformationSources", Object.values(RightsManagementPolicyInformationSourceComponentType));
1387
+ const policyInformationSourceTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyInformationSources);
1474
1388
  for (const policyInformationSourceType of policyInformationSourceTypes) {
1475
1389
  coreConfig.types.rightsManagementPolicyInformationSourceComponent.push({
1476
1390
  type: policyInformationSourceType
1477
1391
  });
1478
1392
  }
1479
1393
  coreConfig.types.rightsManagementPolicyRequesterComponent ??= [];
1480
- const policyRequesterTypes = envListToArray(envVars, "rightsManagementPolicyRequesters", Object.values(RightsManagementPolicyRequesterComponentType));
1394
+ const policyRequesterTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyRequesters);
1481
1395
  for (const policyRequesterType of policyRequesterTypes) {
1482
1396
  coreConfig.types.rightsManagementPolicyRequesterComponent.push({
1483
1397
  type: policyRequesterType
1484
1398
  });
1485
1399
  }
1486
1400
  coreConfig.types.rightsManagementPolicyNegotiatorComponent ??= [];
1487
- const policyNegotiatorTypes = envListToArray(envVars, "rightsManagementPolicyNegotiators", Object.values(RightsManagementPolicyNegotiatorComponentType));
1401
+ const policyNegotiatorTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyNegotiators);
1488
1402
  for (const policyNegotiatorType of policyNegotiatorTypes) {
1489
1403
  coreConfig.types.rightsManagementPolicyNegotiatorComponent.push({
1490
1404
  type: policyNegotiatorType
@@ -1534,7 +1448,7 @@ async function configureFederatedCatalogue(coreConfig, envVars) {
1534
1448
  }
1535
1449
  });
1536
1450
  coreConfig.types.federatedCatalogueFilterComponent ??= [];
1537
- const filters = envListToArray(envVars, "federatedCatalogueFilters", Object.values(FederatedCatalogueFilterComponentType));
1451
+ const filters = commaSeparatedListToArray(envVars.federatedCatalogueFilters);
1538
1452
  for (const filter of filters) {
1539
1453
  coreConfig.types.federatedCatalogueFilterComponent.push({
1540
1454
  type: filter,
@@ -1657,8 +1571,7 @@ export function isTrustRequired(envVars) {
1657
1571
  export function isBackgroundTasksRequired(envVars) {
1658
1572
  return (envBoolean(envVars, "dataspaceEnabled", false) ||
1659
1573
  isImmutableProofRequired(envVars) ||
1660
- envBoolean(envVars, "healthEnabled", false) ||
1661
- commaSeparatedListToArray(envVars.telemetryConnector).includes(TelemetryConnectorType.EntityStorage));
1574
+ envBoolean(envVars, "healthEnabled", false));
1662
1575
  }
1663
1576
  /**
1664
1577
  * Checks if the immutable proof subsystem is required.
@@ -1706,8 +1619,7 @@ export function isTaskSchedulerRequired(envVars) {
1706
1619
  envBoolean(envVars, "dataspaceEnabled", false) ||
1707
1620
  isRightsManagementRequired(envVars) ||
1708
1621
  isAuthEntityStorageRequired(envVars) ||
1709
- isImmutableProofRequired(envVars) ||
1710
- isMailboxEnabled(envVars));
1622
+ isImmutableProofRequired(envVars));
1711
1623
  }
1712
1624
  /**
1713
1625
  * Checks if the automation subsystem is required.
@@ -1734,19 +1646,6 @@ export function isTelemetryEnabled(envVars) {
1734
1646
  * @returns True if tracing is enabled.
1735
1647
  */
1736
1648
  export function isTracingEnabled(envVars) {
1737
- return commaSeparatedListToArray(envVars.tracingConnector).some(t => t === TracingConnectorType.EntityStorage ||
1738
- t === TracingConnectorType.OpenTelemetry ||
1739
- t === TracingConnectorType.Console);
1740
- }
1741
- /**
1742
- * Checks if the mailbox subsystem is enabled.
1743
- * Returns true when any component that depends on the mailbox subsystem is enabled.
1744
- * @param envVars The environment variables.
1745
- * @returns True if mailbox is enabled.
1746
- */
1747
- export function isMailboxEnabled(envVars) {
1748
- return commaSeparatedListToArray(envVars.emailProtocolConnector).some(t => t === EmailProtocolConnectorType.Imap ||
1749
- t === EmailProtocolConnectorType.Pop3 ||
1750
- t === EmailProtocolConnectorType.Gmail);
1649
+ return commaSeparatedListToArray(envVars.tracingConnector).some(t => t === TracingConnectorType.EntityStorage || t === TracingConnectorType.OpenTelemetry);
1751
1650
  }
1752
1651
  //# sourceMappingURL=engineEnvBuilder.js.map