@twin.org/node-core 0.0.3-next.5 → 0.0.3-next.50

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 (186) hide show
  1. package/README.md +3 -1
  2. package/dist/es/builders/engineEnvBuilder.js +463 -195
  3. package/dist/es/builders/engineEnvBuilder.js.map +1 -1
  4. package/dist/es/builders/engineServerEnvBuilder.js +89 -32
  5. package/dist/es/builders/engineServerEnvBuilder.js.map +1 -1
  6. package/dist/es/builders/extensionsBuilder.js.map +1 -1
  7. package/dist/es/cli.js +247 -0
  8. package/dist/es/cli.js.map +1 -0
  9. package/dist/es/commands/bootstrapLegacy.js +178 -0
  10. package/dist/es/commands/bootstrapLegacy.js.map +1 -0
  11. package/dist/es/commands/help.js +85 -0
  12. package/dist/es/commands/help.js.map +1 -0
  13. package/dist/es/commands/identityCreate.js +326 -0
  14. package/dist/es/commands/identityCreate.js.map +1 -0
  15. package/dist/es/commands/identityImports.js +81 -0
  16. package/dist/es/commands/identityImports.js.map +1 -0
  17. package/dist/es/commands/identityVerifiableCredentialCreate.js +145 -0
  18. package/dist/es/commands/identityVerifiableCredentialCreate.js.map +1 -0
  19. package/dist/es/commands/identityVerificationMethodCreate.js +227 -0
  20. package/dist/es/commands/identityVerificationMethodCreate.js.map +1 -0
  21. package/dist/es/commands/identityVerificationMethodImport.js +125 -0
  22. package/dist/es/commands/identityVerificationMethodImport.js.map +1 -0
  23. package/dist/es/commands/nodeSetIdentity.js +63 -0
  24. package/dist/es/commands/nodeSetIdentity.js.map +1 -0
  25. package/dist/es/commands/tenantCreate.js +137 -0
  26. package/dist/es/commands/tenantCreate.js.map +1 -0
  27. package/dist/es/commands/tenantImport.js +95 -0
  28. package/dist/es/commands/tenantImport.js.map +1 -0
  29. package/dist/es/commands/tenantToken.js +97 -0
  30. package/dist/es/commands/tenantToken.js.map +1 -0
  31. package/dist/es/commands/tenantUpdate.js +93 -0
  32. package/dist/es/commands/tenantUpdate.js.map +1 -0
  33. package/dist/es/commands/userCreate.js +239 -0
  34. package/dist/es/commands/userCreate.js.map +1 -0
  35. package/dist/es/commands/userUpdate.js +154 -0
  36. package/dist/es/commands/userUpdate.js.map +1 -0
  37. package/dist/es/commands/vaultKeyCreate.js +190 -0
  38. package/dist/es/commands/vaultKeyCreate.js.map +1 -0
  39. package/dist/es/commands/vaultKeyImport.js +103 -0
  40. package/dist/es/commands/vaultKeyImport.js.map +1 -0
  41. package/dist/es/defaults.js +18 -2
  42. package/dist/es/defaults.js.map +1 -1
  43. package/dist/es/index.js +11 -4
  44. package/dist/es/index.js.map +1 -1
  45. package/dist/es/models/ICliArgs.js +4 -0
  46. package/dist/es/models/ICliArgs.js.map +1 -0
  47. package/dist/es/models/ICliCommand.js +2 -0
  48. package/dist/es/models/ICliCommand.js.map +1 -0
  49. package/dist/es/models/ICliCommandDefinition.js +2 -0
  50. package/dist/es/models/ICliCommandDefinition.js.map +1 -0
  51. package/dist/es/models/ICliCommandDefinitionParam.js +2 -0
  52. package/dist/es/models/ICliCommandDefinitionParam.js.map +1 -0
  53. package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -1
  54. package/dist/es/models/IEngineServerEnvironmentVariables.js.map +1 -1
  55. package/dist/es/models/INodeEngineState.js.map +1 -1
  56. package/dist/es/models/INodeEnvironmentVariables.js.map +1 -1
  57. package/dist/es/models/INodeOptions.js.map +1 -1
  58. package/dist/es/models/cliCommandParamType.js +4 -0
  59. package/dist/es/models/cliCommandParamType.js.map +1 -0
  60. package/dist/es/models/nodeExtensionInitialiseEngineMethod.js +2 -0
  61. package/dist/es/models/nodeExtensionInitialiseEngineMethod.js.map +1 -0
  62. package/dist/es/models/nodeExtensionInitialiseEngineServerMethod.js +2 -0
  63. package/dist/es/models/nodeExtensionInitialiseEngineServerMethod.js.map +1 -0
  64. package/dist/es/models/nodeExtensionInitialiseMethod.js +2 -0
  65. package/dist/es/models/nodeExtensionInitialiseMethod.js.map +1 -0
  66. package/dist/es/models/nodeExtensionShutdownMethod.js +4 -0
  67. package/dist/es/models/nodeExtensionShutdownMethod.js.map +1 -0
  68. package/dist/es/node.js +86 -39
  69. package/dist/es/node.js.map +1 -1
  70. package/dist/es/{server.js → start.js} +72 -27
  71. package/dist/es/start.js.map +1 -0
  72. package/dist/es/utils.js +21 -25
  73. package/dist/es/utils.js.map +1 -1
  74. package/dist/types/builders/engineEnvBuilder.d.ts +67 -1
  75. package/dist/types/builders/engineServerEnvBuilder.d.ts +11 -2
  76. package/dist/types/cli.d.ts +56 -0
  77. package/dist/types/commands/bootstrapLegacy.d.ts +66 -0
  78. package/dist/types/commands/help.d.ts +23 -0
  79. package/dist/types/commands/identityCreate.d.ts +39 -0
  80. package/dist/types/commands/identityImports.d.ts +24 -0
  81. package/dist/types/commands/identityVerifiableCredentialCreate.d.ts +43 -0
  82. package/dist/types/commands/identityVerificationMethodCreate.d.ts +47 -0
  83. package/dist/types/commands/identityVerificationMethodImport.d.ts +31 -0
  84. package/dist/types/commands/nodeSetIdentity.d.ts +22 -0
  85. package/dist/types/commands/tenantCreate.d.ts +38 -0
  86. package/dist/types/commands/tenantImport.d.ts +26 -0
  87. package/dist/types/commands/tenantToken.d.ts +28 -0
  88. package/dist/types/commands/tenantUpdate.d.ts +26 -0
  89. package/dist/types/commands/userCreate.d.ts +51 -0
  90. package/dist/types/commands/userUpdate.d.ts +40 -0
  91. package/dist/types/commands/vaultKeyCreate.d.ts +43 -0
  92. package/dist/types/commands/vaultKeyImport.d.ts +28 -0
  93. package/dist/types/defaults.d.ts +10 -2
  94. package/dist/types/index.d.ts +11 -4
  95. package/dist/types/models/ICliArgs.d.ts +20 -0
  96. package/dist/types/models/ICliCommand.d.ts +17 -0
  97. package/dist/types/models/ICliCommandDefinition.d.ts +41 -0
  98. package/dist/types/models/ICliCommandDefinitionParam.d.ts +35 -0
  99. package/dist/types/models/IEngineEnvironmentVariables.d.ts +125 -100
  100. package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +8 -0
  101. package/dist/types/models/INodeEngineState.d.ts +0 -12
  102. package/dist/types/models/INodeEnvironmentVariables.d.ts +0 -38
  103. package/dist/types/models/INodeOptions.d.ts +6 -2
  104. package/dist/types/models/cliCommandParamType.d.ts +4 -0
  105. package/dist/types/models/nodeExtensionInitialiseEngineMethod.d.ts +7 -0
  106. package/dist/types/models/nodeExtensionInitialiseEngineServerMethod.d.ts +8 -0
  107. package/dist/types/models/nodeExtensionInitialiseMethod.d.ts +8 -0
  108. package/dist/types/models/nodeExtensionShutdownMethod.d.ts +5 -0
  109. package/dist/types/node.d.ts +5 -4
  110. package/dist/types/{server.d.ts → start.d.ts} +4 -2
  111. package/dist/types/utils.d.ts +6 -8
  112. package/docs/changelog.md +604 -178
  113. package/docs/examples.md +99 -1
  114. package/docs/reference/functions/buildConfiguration.md +1 -1
  115. package/docs/reference/functions/buildEngineServerConfiguration.md +1 -1
  116. package/docs/reference/functions/constructCliCommand.md +27 -0
  117. package/docs/reference/functions/executeCommand.md +29 -0
  118. package/docs/reference/functions/getEnvDefaults.md +19 -0
  119. package/docs/reference/functions/getScriptDirectory.md +19 -0
  120. package/docs/reference/functions/isAuthEntityStorageRequired.md +20 -0
  121. package/docs/reference/functions/isAutomationRequired.md +20 -0
  122. package/docs/reference/functions/isBackgroundTasksRequired.md +20 -0
  123. package/docs/reference/functions/isFederatedCatalogueRequired.md +20 -0
  124. package/docs/reference/functions/isImmutableProofRequired.md +20 -0
  125. package/docs/reference/functions/isRightsManagementRequired.md +23 -0
  126. package/docs/reference/functions/isTaskSchedulerRequired.md +20 -0
  127. package/docs/reference/functions/isTelemetryRequired.md +20 -0
  128. package/docs/reference/functions/isTrustRequired.md +20 -0
  129. package/docs/reference/functions/isUrlTransformerRequired.md +20 -0
  130. package/docs/reference/functions/parseCommandLineArgs.md +19 -0
  131. package/docs/reference/functions/processEnvOptions.md +27 -0
  132. package/docs/reference/functions/registerCommands.md +9 -0
  133. package/docs/reference/functions/resolvePackageEntryPoint.md +2 -2
  134. package/docs/reference/functions/run.md +8 -2
  135. package/docs/reference/functions/start.md +9 -3
  136. package/docs/reference/functions/substituteEnvOptions.md +25 -0
  137. package/docs/reference/index.md +26 -14
  138. package/docs/reference/interfaces/ICacheMetadata.md +3 -3
  139. package/docs/reference/interfaces/ICliArgs.md +35 -0
  140. package/docs/reference/interfaces/ICliCommand.md +23 -0
  141. package/docs/reference/interfaces/ICliCommandDefinition.md +87 -0
  142. package/docs/reference/interfaces/ICliCommandDefinitionParam.md +65 -0
  143. package/docs/reference/interfaces/IEngineEnvironmentVariables.md +405 -372
  144. package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +527 -450
  145. package/docs/reference/interfaces/IModuleProtocol.md +3 -3
  146. package/docs/reference/interfaces/INodeEngineState.md +2 -26
  147. package/docs/reference/interfaces/INodeEnvironmentVariables.md +545 -544
  148. package/docs/reference/interfaces/INodeOptions.md +44 -36
  149. package/docs/reference/interfaces/IProtocolHandlerResult.md +2 -2
  150. package/docs/reference/type-aliases/CliCommandParamType.md +5 -0
  151. package/docs/reference/type-aliases/NodeExtensionInitialiseEngineMethod.md +1 -1
  152. package/docs/reference/type-aliases/NodeExtensionInitialiseEngineServerMethod.md +1 -1
  153. package/docs/reference/type-aliases/NodeExtensionInitialiseMethod.md +1 -1
  154. package/docs/reference/type-aliases/NodeExtensionShutdownMethod.md +1 -1
  155. package/docs/reference/variables/ModuleProtocol.md +5 -5
  156. package/docs/reference/variables/TRUST_VERIFICATION_METHOD_ID.md +3 -0
  157. package/docs/reference/variables/URL_TRANSFORMER_ENCRYPTION_KEY_ID.md +3 -0
  158. package/locales/en.json +605 -30
  159. package/package.json +10 -6
  160. package/dist/es/bootstrap.js +0 -366
  161. package/dist/es/bootstrap.js.map +0 -1
  162. package/dist/es/identity.js +0 -182
  163. package/dist/es/identity.js.map +0 -1
  164. package/dist/es/models/nodeExtensionMethods.js +0 -2
  165. package/dist/es/models/nodeExtensionMethods.js.map +0 -1
  166. package/dist/es/models/nodeFeatures.js +0 -21
  167. package/dist/es/models/nodeFeatures.js.map +0 -1
  168. package/dist/es/server.js.map +0 -1
  169. package/dist/types/bootstrap.d.ts +0 -68
  170. package/dist/types/identity.d.ts +0 -14
  171. package/dist/types/models/nodeExtensionMethods.d.ts +0 -27
  172. package/dist/types/models/nodeFeatures.d.ts +0 -21
  173. package/docs/detailed-guide.md +0 -129
  174. package/docs/reference/functions/bootstrap.md +0 -29
  175. package/docs/reference/functions/bootstrapAuth.md +0 -35
  176. package/docs/reference/functions/bootstrapBlobEncryption.md +0 -35
  177. package/docs/reference/functions/bootstrapImmutableProofMethod.md +0 -35
  178. package/docs/reference/functions/bootstrapNodeAdminUser.md +0 -35
  179. package/docs/reference/functions/bootstrapNodeId.md +0 -35
  180. package/docs/reference/functions/bootstrapSynchronisedStorage.md +0 -35
  181. package/docs/reference/functions/bootstrapTenantId.md +0 -35
  182. package/docs/reference/functions/getFeatures.md +0 -19
  183. package/docs/reference/type-aliases/NodeFeatures.md +0 -5
  184. package/docs/reference/variables/NodeFeatures.md +0 -25
  185. package/docs/reference/variables/SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID.md +0 -3
  186. package/docs/reference/variables/VC_AUTHENTICATION_VERIFICATION_METHOD_ID.md +0 -3
@@ -2,9 +2,10 @@
2
2
  // SPDX-License-Identifier: Apache-2.0.
3
3
  import path from "node:path";
4
4
  import { Coerce, Is } from "@twin.org/core";
5
- import { AttestationComponentType, AttestationConnectorType, AuditableItemGraphComponentType, AuditableItemStreamComponentType, AuthenticationGeneratorComponentType, BackgroundTaskConnectorType, BlobStorageComponentType, BlobStorageConnectorType, ContextIdHandlerComponentType, DataConverterConnectorType, DataExtractorConnectorType, DataProcessingComponentType, DataSpaceConnectorComponentType, DltConfigType, DocumentManagementComponentType, EngineTypeHelper, EntityStorageConnectorType, EventBusComponentType, EventBusConnectorType, FaucetConnectorType, FederatedCatalogueComponentType, IdentityComponentType, IdentityConnectorType, IdentityProfileComponentType, IdentityProfileConnectorType, IdentityResolverComponentType, IdentityResolverConnectorType, ImmutableProofComponentType, LoggingComponentType, LoggingConnectorType, MessagingAdminComponentType, MessagingComponentType, MessagingEmailConnectorType, MessagingPushNotificationConnectorType, MessagingSmsConnectorType, NftComponentType, NftConnectorType, RightsManagementDapComponentType, RightsManagementDarpComponentType, RightsManagementPapComponentType, RightsManagementPdpComponentType, RightsManagementPepComponentType, RightsManagementPipComponentType, RightsManagementPmpComponentType, RightsManagementPnapComponentType, RightsManagementPnpComponentType, RightsManagementPxpComponentType, SynchronisedStorageComponentType, TaskSchedulerComponentType, TelemetryComponentType, TelemetryConnectorType, TenantAdminComponentType, VaultConnectorType, VerifiableStorageComponentType, VerifiableStorageConnectorType, WalletConnectorType } from "@twin.org/engine-types";
6
- import { DataAccessPointRestClient, PolicyNegotiationPointRestClient } from "@twin.org/rights-management-rest-client";
7
- import { ATTESTATION_VERIFICATION_METHOD_ID, BLOB_STORAGE_ENCRYPTION_KEY_ID, CONTEXT_ID_HANDLER_FEATURE_DID, CONTEXT_ID_HANDLER_FEATURE_TENANT, IMMUTABLE_PROOF_VERIFICATION_METHOD_ID, SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID, VC_AUTHENTICATION_VERIFICATION_METHOD_ID } from "../defaults.js";
5
+ 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, RightsManagementPapComponentType, RightsManagementPdpComponentType, RightsManagementPepComponentType, RightsManagementPipComponentType, RightsManagementPmpComponentType, RightsManagementPnapComponentType, RightsManagementPnpComponentType, RightsManagementPxpComponentType, TaskSchedulerComponentType, TelemetryComponentType, TelemetryConnectorType, TenantAdminComponentType, TenantComponentType, TrustComponentType, TrustVerifierComponentType, UrlTransformerComponentType, VaultConnectorType, WalletConnectorType } from "@twin.org/engine-types";
6
+ import { OpenTelemetryReaderTypes } from "@twin.org/telemetry-connector-opentelemetry";
7
+ import { CONTEXT_ID_HANDLER_FEATURE_DID, CONTEXT_ID_HANDLER_FEATURE_TENANT } from "../defaults.js";
8
+ import { isAuthEntityStorageRequired } from "./engineServerEnvBuilder.js";
8
9
  /**
9
10
  * Build the engine core configuration from environment variables.
10
11
  * @param envVars The environment variables.
@@ -19,6 +20,7 @@ export async function buildEngineConfiguration(envVars, contextIdKeys) {
19
20
  }
20
21
  const coreConfig = {
21
22
  debug: Coerce.boolean(envVars.debug) ?? false,
23
+ silent: Coerce.boolean(envVars.silent) ?? false,
22
24
  types: {}
23
25
  };
24
26
  await configureTenant(coreConfig, envVars);
@@ -32,11 +34,16 @@ export async function buildEngineConfiguration(envVars, contextIdKeys) {
32
34
  await configureTaskScheduler(coreConfig, envVars);
33
35
  await configureEventBus(coreConfig, envVars);
34
36
  await configureTelemetry(coreConfig, envVars);
37
+ await configureMetricsCollector(coreConfig, envVars);
35
38
  await configureMessaging(coreConfig, envVars);
39
+ await configureAutomation(coreConfig, envVars);
40
+ await configureHealth(coreConfig, envVars);
41
+ await configureUrlTransformer(coreConfig, envVars);
36
42
  await configureFaucet(coreConfig, envVars);
37
43
  await configureWallet(coreConfig, envVars);
38
44
  await configureNft(coreConfig, envVars);
39
- await configureVerifiableStorage(coreConfig, envVars);
45
+ await configureNotarization(coreConfig, envVars);
46
+ await configureImmutableProof(coreConfig, envVars);
40
47
  await configureIdentity(coreConfig, envVars);
41
48
  await configureIdentityResolver(coreConfig, envVars);
42
49
  await configureIdentityProfile(coreConfig, envVars);
@@ -45,11 +52,10 @@ export async function buildEngineConfiguration(envVars, contextIdKeys) {
45
52
  await configureAuditableItemGraph(coreConfig, envVars);
46
53
  await configureAuditableItemStream(coreConfig, envVars);
47
54
  await configureDocumentManagement(coreConfig, envVars);
48
- await configureVerifiableCredentialAuthentication(coreConfig, envVars);
55
+ await configureTrust(coreConfig, envVars);
49
56
  await configureRightsManagement(coreConfig, envVars);
50
- await configureSynchronisedStorage(coreConfig, envVars);
51
57
  await configureFederatedCatalogue(coreConfig, envVars);
52
- await configureDataSpaceConnector(coreConfig, envVars);
58
+ await configureDataspace(coreConfig, envVars);
53
59
  return coreConfig;
54
60
  }
55
61
  /**
@@ -60,7 +66,7 @@ export async function buildEngineConfiguration(envVars, contextIdKeys) {
60
66
  async function configureEntityStorage(coreConfig, envVars) {
61
67
  coreConfig.types ??= {};
62
68
  coreConfig.types.entityStorageConnector ??= [];
63
- const entityStorageConnectorTypes = envVars.entityStorageConnectorType?.split(",") ?? [];
69
+ const entityStorageConnectorTypes = commaSeparatedListToArray(envVars.entityStorageConnectorType);
64
70
  if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.Memory)) {
65
71
  coreConfig.types.entityStorageConnector.push({
66
72
  type: EntityStorageConnectorType.Memory
@@ -125,7 +131,7 @@ async function configureEntityStorage(coreConfig, envVars) {
125
131
  type: EntityStorageConnectorType.ScyllaDb,
126
132
  options: {
127
133
  config: {
128
- hosts: envVars.scylladbHosts?.split(",") ?? [],
134
+ hosts: commaSeparatedListToArray(envVars.scylladbHosts),
129
135
  localDataCenter: envVars.scylladbLocalDataCenter ?? "",
130
136
  keyspace: envVars.scylladbKeyspace ?? "",
131
137
  port: Coerce.integer(envVars.scylladbPort)
@@ -180,15 +186,6 @@ async function configureEntityStorage(coreConfig, envVars) {
180
186
  });
181
187
  }
182
188
  const defaultEntityStorageConnectorType = envVars.entityStorageConnectorDefault ?? entityStorageConnectorTypes[0];
183
- if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.Synchronised)) {
184
- // For synchronised storage we use the default connector as the one we wrap for real DB operations
185
- coreConfig.types.entityStorageConnector.push({
186
- type: EntityStorageConnectorType.Synchronised,
187
- options: {
188
- entityStorageConnectorType: defaultEntityStorageConnectorType
189
- }
190
- });
191
- }
192
189
  if (Is.arrayValue(entityStorageConnectorTypes)) {
193
190
  for (const config of coreConfig.types.entityStorageConnector) {
194
191
  if (config.type === defaultEntityStorageConnectorType) {
@@ -205,7 +202,7 @@ async function configureEntityStorage(coreConfig, envVars) {
205
202
  */
206
203
  async function configureBlobStorage(coreConfig, envVars) {
207
204
  coreConfig.types.blobStorageConnector ??= [];
208
- const blobStorageConnectorTypes = envVars.blobStorageConnectorType?.split(",") ?? [];
205
+ const blobStorageConnectorTypes = commaSeparatedListToArray(envVars.blobStorageConnectorType);
209
206
  if (blobStorageConnectorTypes.includes(BlobStorageConnectorType.Memory)) {
210
207
  coreConfig.types.blobStorageConnector.push({
211
208
  type: BlobStorageConnectorType.Memory
@@ -285,14 +282,6 @@ async function configureBlobStorage(coreConfig, envVars) {
285
282
  if (config.type === defaultStorageConnectorType) {
286
283
  config.isDefault = true;
287
284
  }
288
- // If this blob storage connector is the one to use for public access
289
- // then add it as a feature
290
- if (Is.stringValue(envVars.blobStorageConnectorPublic) &&
291
- config.type === envVars.blobStorageConnectorPublic) {
292
- config.features ??= [];
293
- config.features.push("public");
294
- break;
295
- }
296
285
  }
297
286
  }
298
287
  if (coreConfig.types.blobStorageConnector.length > 0) {
@@ -302,7 +291,7 @@ async function configureBlobStorage(coreConfig, envVars) {
302
291
  options: {
303
292
  config: {
304
293
  vaultKeyId: (envVars.blobStorageEnableEncryption ?? false)
305
- ? (envVars.blobStorageEncryptionKeyId ?? BLOB_STORAGE_ENCRYPTION_KEY_ID)
294
+ ? envVars.blobStorageEncryptionKeyId
306
295
  : undefined
307
296
  }
308
297
  }
@@ -316,7 +305,7 @@ async function configureBlobStorage(coreConfig, envVars) {
316
305
  */
317
306
  async function configureLogging(coreConfig, envVars) {
318
307
  coreConfig.types.loggingConnector ??= [];
319
- const loggingConnectorTypes = (envVars.loggingConnector ?? "").split(",");
308
+ const loggingConnectorTypes = commaSeparatedListToArray(envVars.loggingConnector);
320
309
  let additionalConnectorCount = 0;
321
310
  for (const loggingConnector of loggingConnectorTypes) {
322
311
  if (loggingConnector === LoggingConnectorType.Console) {
@@ -370,7 +359,12 @@ async function configureVault(coreConfig, envVars) {
370
359
  coreConfig.types.vaultConnector ??= [];
371
360
  if (envVars.vaultConnector === VaultConnectorType.EntityStorage) {
372
361
  coreConfig.types.vaultConnector.push({
373
- type: VaultConnectorType.EntityStorage
362
+ type: VaultConnectorType.EntityStorage,
363
+ options: {
364
+ config: {
365
+ prefix: envVars.vaultPrefix
366
+ }
367
+ }
374
368
  });
375
369
  }
376
370
  else if (envVars.vaultConnector === VaultConnectorType.Hashicorp) {
@@ -379,7 +373,8 @@ async function configureVault(coreConfig, envVars) {
379
373
  options: {
380
374
  config: {
381
375
  endpoint: envVars.hashicorpVaultEndpoint ?? "",
382
- token: envVars.hashicorpVaultToken ?? ""
376
+ token: envVars.hashicorpVaultToken ?? "",
377
+ prefix: envVars.vaultPrefix
383
378
  }
384
379
  }
385
380
  });
@@ -391,10 +386,10 @@ async function configureVault(coreConfig, envVars) {
391
386
  * @param envVars The environment variables.
392
387
  */
393
388
  async function configureBackgroundTask(coreConfig, envVars) {
394
- coreConfig.types.backgroundTaskConnector ??= [];
395
- if (envVars.backgroundTaskConnector === BackgroundTaskConnectorType.EntityStorage) {
396
- coreConfig.types.backgroundTaskConnector.push({
397
- type: BackgroundTaskConnectorType.EntityStorage
389
+ coreConfig.types.backgroundTaskComponent ??= [];
390
+ if (isBackgroundTasksRequired(envVars)) {
391
+ coreConfig.types.backgroundTaskComponent.push({
392
+ type: BackgroundTaskComponentType.Service
398
393
  });
399
394
  }
400
395
  }
@@ -427,11 +422,120 @@ async function configureTelemetry(coreConfig, envVars) {
427
422
  type: TelemetryConnectorType.EntityStorage
428
423
  });
429
424
  }
425
+ else if (envVars.telemetryConnector === TelemetryConnectorType.OpenTelemetry) {
426
+ let readers;
427
+ if (envVars.openTelemetryReader === "prometheus") {
428
+ readers = {
429
+ prometheus: {
430
+ type: OpenTelemetryReaderTypes.Prometheus,
431
+ port: Coerce.integer(envVars.openTelemetryPrometheusPort)
432
+ }
433
+ };
434
+ }
435
+ coreConfig.types.telemetryConnector.push({
436
+ type: TelemetryConnectorType.OpenTelemetry,
437
+ options: {
438
+ config: {
439
+ meterName: envVars.openTelemetryMeterName,
440
+ meterVersion: envVars.openTelemetryMeterVersion,
441
+ readers
442
+ }
443
+ }
444
+ });
445
+ }
430
446
  if (coreConfig.types.telemetryConnector.length > 0) {
431
447
  coreConfig.types.telemetryComponent ??= [];
432
448
  coreConfig.types.telemetryComponent.push({ type: TelemetryComponentType.Service });
433
449
  }
434
450
  }
451
+ /**
452
+ * Configures the metrics producers and orchestrator service.
453
+ * @param coreConfig The core config.
454
+ * @param envVars The environment variables.
455
+ */
456
+ async function configureMetricsCollector(coreConfig, envVars) {
457
+ if (isTelemetryRequired(envVars)) {
458
+ const intervalSec = Coerce.integer(envVars.telemetryMetricsCollectorIntervalSeconds) ?? 60;
459
+ coreConfig.types.metricsCollectorComponent ??= [];
460
+ coreConfig.types.metricsCollectorComponent.push({
461
+ type: MetricsCollectorComponentType.Service,
462
+ options: { config: { intervalMs: intervalSec * 1000 } }
463
+ });
464
+ const maxHistory = Coerce.integer(envVars.telemetryMetricsProducerMaxHistory) ?? 1440;
465
+ coreConfig.types.metricsProducerComponent ??= [];
466
+ const metricsProducers = commaSeparatedListToArray(envVars.telemetryMetricsProducers ??
467
+ [MetricsProducerComponentType.System, MetricsProducerComponentType.Process].join(","));
468
+ for (const producerType of metricsProducers) {
469
+ coreConfig.types.metricsProducerComponent.push({
470
+ type: producerType,
471
+ options: { maxHistory }
472
+ });
473
+ }
474
+ }
475
+ }
476
+ /**
477
+ * Configures the automation.
478
+ * @param coreConfig The core config.
479
+ * @param envVars The environment variables.
480
+ */
481
+ async function configureAutomation(coreConfig, envVars) {
482
+ coreConfig.types.automationComponent ??= [];
483
+ if (isAutomationRequired(envVars)) {
484
+ coreConfig.types.automationComponent.push({
485
+ type: AutomationComponentType.Service
486
+ });
487
+ const automationActionTypes = commaSeparatedListToArray(envVars.automationActionTypes);
488
+ if (Is.arrayValue(automationActionTypes)) {
489
+ coreConfig.types.automationAction ??= [];
490
+ for (const actionType of automationActionTypes) {
491
+ coreConfig.types.automationAction.push({
492
+ type: actionType,
493
+ isMultiInstance: true
494
+ });
495
+ }
496
+ }
497
+ }
498
+ }
499
+ /**
500
+ * Configures the health.
501
+ * @param coreConfig The core config.
502
+ * @param envVars The environment variables.
503
+ */
504
+ async function configureHealth(coreConfig, envVars) {
505
+ coreConfig.types.healthComponent ??= [];
506
+ if (Coerce.boolean(envVars.healthEnabled) ?? false) {
507
+ coreConfig.types.healthComponent.push({
508
+ type: HealthComponentType.Service,
509
+ options: {
510
+ config: {
511
+ healthCheckInterval: (Coerce.integer(envVars.healthIntervalSeconds) ?? 60) * 1000,
512
+ initialInterval: (Coerce.integer(envVars.healthStartupIntervalSeconds) ?? 2) * 1000
513
+ }
514
+ }
515
+ });
516
+ }
517
+ }
518
+ /**
519
+ * Configures the url transformer.
520
+ * @param coreConfig The core config.
521
+ * @param envVars The environment variables.
522
+ */
523
+ async function configureUrlTransformer(coreConfig, envVars) {
524
+ coreConfig.types.urlTransformerComponent ??= [];
525
+ if (isUrlTransformerRequired(envVars) ?? false) {
526
+ coreConfig.types.urlTransformerComponent.push({
527
+ type: UrlTransformerComponentType.Service,
528
+ options: {
529
+ config: {
530
+ paramEncryptionKeyName: envVars.urlTransformerEncryptionKeyId,
531
+ queryParamNames: {
532
+ tenant: "tenant-token"
533
+ }
534
+ }
535
+ }
536
+ });
537
+ }
538
+ }
435
539
  /**
436
540
  * Configures the tenant.
437
541
  * @param coreConfig The core config.
@@ -439,12 +543,14 @@ async function configureTelemetry(coreConfig, envVars) {
439
543
  */
440
544
  async function configureTenant(coreConfig, envVars) {
441
545
  if (Coerce.boolean(envVars.tenantEnabled) ?? false) {
546
+ coreConfig.types.tenantComponent ??= [];
547
+ coreConfig.types.tenantComponent.push({
548
+ type: TenantComponentType.Service
549
+ });
442
550
  coreConfig.types.tenantAdminComponent ??= [];
443
551
  coreConfig.types.tenantAdminComponent.push({
444
552
  type: TenantAdminComponentType.Service
445
553
  });
446
- coreConfig.types.tenantComponent ??= [];
447
- coreConfig.types.tenantComponent.push({ type: TenantAdminComponentType.Service });
448
554
  }
449
555
  }
450
556
  /**
@@ -529,7 +635,7 @@ async function configureMessaging(coreConfig, envVars) {
529
635
  accessKeyId: envVars.awsSesAccessKeyId,
530
636
  secretAccessKey: envVars.awsSesSecretAccessKey,
531
637
  endpoint: envVars.awsSesEndpoint,
532
- applicationsSettings: Is.json(envVars.awsMessagingPushNotificationApplications)
638
+ applicationsSettings: Is.array(envVars.awsMessagingPushNotificationApplications)
533
639
  ? JSON.parse(envVars.awsMessagingPushNotificationApplications)
534
640
  : []
535
641
  }
@@ -606,10 +712,14 @@ async function configureNft(coreConfig, envVars) {
606
712
  }
607
713
  else if (envVars.nftConnector === NftConnectorType.Iota) {
608
714
  const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
715
+ const config = {
716
+ ...dltConfig?.options?.config,
717
+ deploymentPkgId: Is.stringValue(envVars.nftPackageId) ? envVars.nftPackageId : undefined
718
+ };
609
719
  coreConfig.types.nftConnector.push({
610
720
  type: NftConnectorType.Iota,
611
721
  options: {
612
- config: dltConfig?.options?.config ?? {}
722
+ config
613
723
  }
614
724
  });
615
725
  }
@@ -619,37 +729,44 @@ async function configureNft(coreConfig, envVars) {
619
729
  }
620
730
  }
621
731
  /**
622
- * Configures the verifiable storage.
732
+ * Configures the notarization.
623
733
  * @param coreConfig The core config.
624
734
  * @param envVars The environment variables.
625
735
  */
626
- async function configureVerifiableStorage(coreConfig, envVars) {
627
- coreConfig.types.verifiableStorageConnector ??= [];
628
- if (envVars.verifiableStorageConnector === VerifiableStorageConnectorType.EntityStorage) {
629
- coreConfig.types.verifiableStorageConnector.push({
630
- type: VerifiableStorageConnectorType.EntityStorage
736
+ async function configureNotarization(coreConfig, envVars) {
737
+ coreConfig.types.notarizationConnector ??= [];
738
+ if (envVars.notarizationConnector === NotarizationConnectorType.EntityStorage) {
739
+ coreConfig.types.notarizationConnector.push({
740
+ type: NotarizationConnectorType.EntityStorage
631
741
  });
632
742
  }
633
- else if (envVars.verifiableStorageConnector === VerifiableStorageConnectorType.Iota) {
743
+ else if (envVars.notarizationConnector === NotarizationConnectorType.Iota) {
634
744
  const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
635
- coreConfig.types.verifiableStorageConnector.push({
636
- type: VerifiableStorageConnectorType.Iota,
745
+ coreConfig.types.notarizationConnector.push({
746
+ type: NotarizationConnectorType.Iota,
637
747
  options: {
638
748
  config: dltConfig?.options?.config ?? {}
639
749
  }
640
750
  });
641
751
  }
642
- if (coreConfig.types.verifiableStorageConnector.length > 0) {
643
- coreConfig.types.verifiableStorageComponent ??= [];
644
- coreConfig.types.verifiableStorageComponent.push({
645
- type: VerifiableStorageComponentType.Service
646
- });
752
+ if (coreConfig.types.notarizationConnector.length > 0) {
753
+ coreConfig.types.notarizationComponent ??= [];
754
+ coreConfig.types.notarizationComponent.push({ type: NotarizationComponentType.Service });
755
+ }
756
+ }
757
+ /**
758
+ * Configures the immutable proof.
759
+ * @param coreConfig The core config.
760
+ * @param envVars The environment variables.
761
+ */
762
+ async function configureImmutableProof(coreConfig, envVars) {
763
+ if (isImmutableProofRequired(envVars)) {
647
764
  coreConfig.types.immutableProofComponent ??= [];
648
765
  coreConfig.types.immutableProofComponent.push({
649
766
  type: ImmutableProofComponentType.Service,
650
767
  options: {
651
768
  config: {
652
- verificationMethodId: envVars.immutableProofVerificationMethodId ?? IMMUTABLE_PROOF_VERIFICATION_METHOD_ID
769
+ verificationMethodId: envVars.immutableProofVerificationMethodId
653
770
  }
654
771
  }
655
772
  });
@@ -672,7 +789,13 @@ async function configureIdentity(coreConfig, envVars) {
672
789
  coreConfig.types.identityConnector.push({
673
790
  type: IdentityConnectorType.Iota,
674
791
  options: {
675
- config: dltConfig?.options?.config ?? {}
792
+ config: {
793
+ ...(dltConfig?.options?.config ?? {}),
794
+ identityPkgId: Is.stringValue(envVars.iotaIdentityPackageId)
795
+ ? envVars.iotaIdentityPackageId
796
+ : undefined,
797
+ walletAddressIndex: Coerce.integer(envVars.identityWalletAddressIndex) ?? 0
798
+ }
676
799
  }
677
800
  });
678
801
  }
@@ -698,7 +821,12 @@ async function configureIdentityResolver(coreConfig, envVars) {
698
821
  coreConfig.types.identityResolverConnector.push({
699
822
  type: IdentityResolverConnectorType.Iota,
700
823
  options: {
701
- config: dltConfig?.options?.config ?? {}
824
+ config: {
825
+ ...dltConfig?.options?.config,
826
+ identityPkgId: Is.stringValue(envVars.iotaIdentityPackageId)
827
+ ? envVars.iotaIdentityPackageId
828
+ : undefined
829
+ }
702
830
  }
703
831
  });
704
832
  }
@@ -754,7 +882,7 @@ async function configureAttestation(coreConfig, envVars) {
754
882
  type: AttestationComponentType.Service,
755
883
  options: {
756
884
  config: {
757
- verificationMethodId: envVars.attestationVerificationMethodId ?? ATTESTATION_VERIFICATION_METHOD_ID
885
+ verificationMethodId: envVars.attestationVerificationMethodId
758
886
  }
759
887
  }
760
888
  });
@@ -796,27 +924,18 @@ async function configureDataProcessing(coreConfig, envVars) {
796
924
  coreConfig.types.dataProcessingComponent ??= [];
797
925
  coreConfig.types.dataProcessingComponent.push({ type: DataProcessingComponentType.Service });
798
926
  coreConfig.types.dataConverterConnector ??= [];
799
- const converterConnectors = envVars.dataConverterConnectors?.split(",") ?? [];
927
+ const converterConnectors = commaSeparatedListToArray(envVars.dataConverterConnectors);
800
928
  for (const converterConnector of converterConnectors) {
801
- if (converterConnector === DataConverterConnectorType.Json) {
802
- coreConfig.types.dataConverterConnector.push({
803
- type: DataConverterConnectorType.Json
804
- });
805
- }
806
- else if (converterConnector === DataConverterConnectorType.Xml) {
807
- coreConfig.types.dataConverterConnector.push({
808
- type: DataConverterConnectorType.Xml
809
- });
810
- }
929
+ coreConfig.types.dataConverterConnector.push({
930
+ type: converterConnector
931
+ });
811
932
  }
812
933
  coreConfig.types.dataExtractorConnector ??= [];
813
- const extractorConnectors = envVars.dataExtractorConnectors?.split(",") ?? [];
934
+ const extractorConnectors = commaSeparatedListToArray(envVars.dataExtractorConnectors);
814
935
  for (const extractorConnector of extractorConnectors) {
815
- if (extractorConnector === DataExtractorConnectorType.JsonPath) {
816
- coreConfig.types.dataExtractorConnector.push({
817
- type: DataExtractorConnectorType.JsonPath
818
- });
819
- }
936
+ coreConfig.types.dataExtractorConnector.push({
937
+ type: extractorConnector
938
+ });
820
939
  }
821
940
  }
822
941
  }
@@ -834,23 +953,50 @@ async function configureDocumentManagement(coreConfig, envVars) {
834
953
  }
835
954
  }
836
955
  /**
837
- * Configures the verifiable credential authentication.
956
+ * Configures the trust components.
838
957
  * @param coreConfig The core config.
839
958
  * @param envVars The environment variables.
840
959
  */
841
- async function configureVerifiableCredentialAuthentication(coreConfig, envVars) {
842
- if (Coerce.boolean(envVars.vcAuthenticationEnabled) ?? false) {
843
- // Can only perform VC authentication if identity component is available
844
- coreConfig.types.authenticationGeneratorComponent ??= [];
845
- coreConfig.types.authenticationGeneratorComponent.push({
846
- type: AuthenticationGeneratorComponentType.VerifiableCredential,
847
- options: {
848
- config: {
849
- verificationMethodId: envVars.vcAuthenticationVerificationMethodId ?? VC_AUTHENTICATION_VERIFICATION_METHOD_ID
960
+ async function configureTrust(coreConfig, envVars) {
961
+ if (isTrustRequired(envVars)) {
962
+ coreConfig.types.trustComponent ??= [];
963
+ coreConfig.types.trustComponent.push({
964
+ type: TrustComponentType.Service
965
+ });
966
+ coreConfig.types.trustGeneratorComponent ??= [];
967
+ const trustGeneratorTypes = commaSeparatedListToArray(envVars.trustGenerators);
968
+ for (const trustGeneratorType of trustGeneratorTypes) {
969
+ coreConfig.types.trustGeneratorComponent.push({
970
+ type: trustGeneratorType,
971
+ options: {
972
+ config: {
973
+ verificationMethodId: envVars.trustVerificationMethodId ?? "",
974
+ tokenTtlInSeconds: Coerce.integer(envVars.trustJwtTtlSeconds)
975
+ }
850
976
  }
851
- },
852
- features: ["verifiable-credential"]
853
- });
977
+ });
978
+ }
979
+ coreConfig.types.trustVerifierComponent ??= [];
980
+ const trustVerifierTypes = commaSeparatedListToArray(envVars.trustVerifiers);
981
+ for (const trustVerifierType of trustVerifierTypes) {
982
+ const type = trustVerifierType;
983
+ if (type === TrustVerifierComponentType.IdentityAllowDeny) {
984
+ coreConfig.types.trustVerifierComponent.push({
985
+ type,
986
+ options: {
987
+ config: {
988
+ allowIdentities: commaSeparatedListToArray(envVars.trustIdentitiesAllow),
989
+ denyIdentities: commaSeparatedListToArray(envVars.trustIdentitiesDeny)
990
+ }
991
+ }
992
+ });
993
+ }
994
+ else {
995
+ coreConfig.types.trustVerifierComponent.push({
996
+ type
997
+ });
998
+ }
999
+ }
854
1000
  }
855
1001
  }
856
1002
  /**
@@ -859,7 +1005,7 @@ async function configureVerifiableCredentialAuthentication(coreConfig, envVars)
859
1005
  * @param envVars The environment variables.
860
1006
  */
861
1007
  async function configureRightsManagement(coreConfig, envVars) {
862
- if (Coerce.boolean(envVars.rightsManagementEnabled) ?? false) {
1008
+ if (isRightsManagementRequired(envVars)) {
863
1009
  coreConfig.types.rightsManagementPapComponent ??= [];
864
1010
  coreConfig.types.rightsManagementPapComponent.push({
865
1011
  type: RightsManagementPapComponentType.Service
@@ -870,76 +1016,100 @@ async function configureRightsManagement(coreConfig, envVars) {
870
1016
  });
871
1017
  coreConfig.types.rightsManagementPipComponent ??= [];
872
1018
  coreConfig.types.rightsManagementPipComponent.push({
873
- type: RightsManagementPipComponentType.Service,
874
- options: {
875
- informationModulesConfig: Is.arrayValue(envVars.rightsManagementInformationSources)
876
- ? envVars.rightsManagementInformationSources
877
- : undefined
878
- }
1019
+ type: RightsManagementPipComponentType.Service
879
1020
  });
880
1021
  coreConfig.types.rightsManagementPxpComponent ??= [];
881
1022
  coreConfig.types.rightsManagementPxpComponent.push({
882
- type: RightsManagementPxpComponentType.Service,
883
- options: {
884
- actionModulesConfig: Is.arrayValue(envVars.rightsManagementExecutionActions)
885
- ? envVars.rightsManagementExecutionActions
886
- : undefined
887
- }
1023
+ type: RightsManagementPxpComponentType.Service
888
1024
  });
889
1025
  coreConfig.types.rightsManagementPdpComponent ??= [];
890
1026
  coreConfig.types.rightsManagementPdpComponent.push({
891
- type: RightsManagementPdpComponentType.Service,
892
- options: {
893
- arbiterModulesConfig: Is.arrayValue(envVars.rightsManagementArbiters)
894
- ? envVars.rightsManagementArbiters
895
- : undefined
896
- }
1027
+ type: RightsManagementPdpComponentType.Service
897
1028
  });
898
1029
  coreConfig.types.rightsManagementPepComponent ??= [];
899
1030
  coreConfig.types.rightsManagementPepComponent.push({
900
- type: RightsManagementPepComponentType.Service,
901
- options: {
902
- processorModulesConfig: Is.arrayValue(envVars.rightsManagementEnforcementProcessors)
903
- ? envVars.rightsManagementEnforcementProcessors
904
- : undefined
905
- }
1031
+ type: RightsManagementPepComponentType.Service
906
1032
  });
907
1033
  coreConfig.types.rightsManagementPnpComponent ??= [];
1034
+ // Single source of truth for the rights-management mount path.
1035
+ const rightsManagementPath = envVars.rightsManagementCallbackPath ?? "rights-management";
1036
+ // We add a multi instance REST client for the remote negotiations
1037
+ // use a dummy endpoint for now as the actual endpoint will be provided in the config
1038
+ // of the policy negotiator when it is used for remote negotiations
1039
+ // We must add it before the service as the service needs to be able to request
1040
+ // the REST client type from the engine core to be able to support remote negotiations
1041
+ coreConfig.types.rightsManagementPnpComponent.push({
1042
+ type: RightsManagementPnpComponentType.RestClient,
1043
+ options: {
1044
+ endpoint: "http://localhost",
1045
+ pathPrefix: rightsManagementPath
1046
+ },
1047
+ isMultiInstance: true,
1048
+ features: ["remote"]
1049
+ });
908
1050
  coreConfig.types.rightsManagementPnpComponent.push({
909
1051
  type: RightsManagementPnpComponentType.Service,
910
1052
  options: {
911
- negotiatorModulesConfig: Is.arrayValue(envVars.rightsManagementNegotiators)
912
- ? envVars.rightsManagementNegotiators
913
- : undefined,
914
- requesterModulesConfig: Is.arrayValue(envVars.rightsManagementRequesters)
915
- ? envVars.rightsManagementRequesters
916
- : undefined,
917
1053
  config: {
918
- baseCallbackUrl: envVars.rightsManagementBaseCallbackUrl ?? "",
919
- offers: Is.arrayValue(envVars.rightsManagementOffers)
920
- ? envVars.rightsManagementOffers
921
- : [],
922
- negotiationComponentCreator: async (url) => new PolicyNegotiationPointRestClient({ endpoint: url })
1054
+ callbackPath: rightsManagementPath,
1055
+ includeErrorDetails: coreConfig.debug ?? false
923
1056
  }
924
- }
1057
+ },
1058
+ isDefault: true
925
1059
  });
926
1060
  coreConfig.types.rightsManagementPnapComponent ??= [];
927
1061
  coreConfig.types.rightsManagementPnapComponent.push({
928
1062
  type: RightsManagementPnapComponentType.Service
929
1063
  });
930
- coreConfig.types.rightsManagementDapComponent ??= [];
931
- coreConfig.types.rightsManagementDapComponent.push({
932
- type: RightsManagementDapComponentType.Service
933
- });
934
- coreConfig.types.rightsManagementDarpComponent ??= [];
935
- coreConfig.types.rightsManagementDarpComponent.push({
936
- type: RightsManagementDarpComponentType.Service,
937
- options: {
938
- config: {
939
- dataAccessComponentCreator: async (url) => new DataAccessPointRestClient({ endpoint: url })
940
- }
941
- }
942
- });
1064
+ coreConfig.types.rightsManagementPolicyArbiterComponent ??= [];
1065
+ const policyArbiterTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyArbiters);
1066
+ for (const policyArbiterType of policyArbiterTypes) {
1067
+ coreConfig.types.rightsManagementPolicyArbiterComponent.push({
1068
+ type: policyArbiterType
1069
+ });
1070
+ }
1071
+ coreConfig.types.rightsManagementPolicyObligationEnforcerComponent ??= [];
1072
+ const policyObligationEnforcerTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyObligationEnforcers);
1073
+ for (const policyObligationEnforcerType of policyObligationEnforcerTypes) {
1074
+ coreConfig.types.rightsManagementPolicyObligationEnforcerComponent.push({
1075
+ type: policyObligationEnforcerType
1076
+ });
1077
+ }
1078
+ coreConfig.types.rightsManagementPolicyEnforcementProcessorComponent ??= [];
1079
+ const policyEnforcementProcessTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyEnforcementProcessors);
1080
+ for (const policyEnforcementProcessorType of policyEnforcementProcessTypes) {
1081
+ coreConfig.types.rightsManagementPolicyEnforcementProcessorComponent.push({
1082
+ type: policyEnforcementProcessorType
1083
+ });
1084
+ }
1085
+ coreConfig.types.rightsManagementPolicyExecutionActionComponent ??= [];
1086
+ const policyExecutionActionTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyExecutionActions);
1087
+ for (const policyExecutionActionType of policyExecutionActionTypes) {
1088
+ coreConfig.types.rightsManagementPolicyExecutionActionComponent.push({
1089
+ type: policyExecutionActionType
1090
+ });
1091
+ }
1092
+ coreConfig.types.rightsManagementPolicyInformationSourceComponent ??= [];
1093
+ const policyInformationSourceTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyInformationSources);
1094
+ for (const policyInformationSourceType of policyInformationSourceTypes) {
1095
+ coreConfig.types.rightsManagementPolicyInformationSourceComponent.push({
1096
+ type: policyInformationSourceType
1097
+ });
1098
+ }
1099
+ coreConfig.types.rightsManagementPolicyRequesterComponent ??= [];
1100
+ const policyRequesterTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyRequesters);
1101
+ for (const policyRequesterType of policyRequesterTypes) {
1102
+ coreConfig.types.rightsManagementPolicyRequesterComponent.push({
1103
+ type: policyRequesterType
1104
+ });
1105
+ }
1106
+ coreConfig.types.rightsManagementPolicyNegotiatorComponent ??= [];
1107
+ const policyNegotiatorTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyNegotiators);
1108
+ for (const policyNegotiatorType of policyNegotiatorTypes) {
1109
+ coreConfig.types.rightsManagementPolicyNegotiatorComponent.push({
1110
+ type: policyNegotiatorType
1111
+ });
1112
+ }
943
1113
  }
944
1114
  }
945
1115
  /**
@@ -948,7 +1118,7 @@ async function configureRightsManagement(coreConfig, envVars) {
948
1118
  * @param envVars The environment variables.
949
1119
  */
950
1120
  async function configureTaskScheduler(coreConfig, envVars) {
951
- if (Coerce.boolean(envVars.taskSchedulerEnabled) ?? false) {
1121
+ if (isTaskSchedulerRequired(envVars)) {
952
1122
  coreConfig.types.taskSchedulerComponent ??= [];
953
1123
  coreConfig.types.taskSchedulerComponent.push({
954
1124
  type: TaskSchedulerComponentType.Service
@@ -956,81 +1126,70 @@ async function configureTaskScheduler(coreConfig, envVars) {
956
1126
  }
957
1127
  }
958
1128
  /**
959
- * Configures the synchronised storage.
1129
+ * Configures the federated catalogue.
960
1130
  * @param coreConfig The core config.
961
1131
  * @param envVars The environment variables.
962
1132
  */
963
- async function configureSynchronisedStorage(coreConfig, envVars) {
964
- if (Is.arrayValue(coreConfig.types.identityResolverComponent) &&
965
- (Coerce.boolean(envVars.synchronisedStorageEnabled) ?? false)) {
966
- // Check if the config provides a custom verifiable storage key id
967
- let verifiableStorageKeyId = Coerce.string(envVars.synchronisedStorageVerifiableStorageKeyId);
968
- if (!Is.stringValue(verifiableStorageKeyId)) {
969
- // No custom key so default to the network setting
970
- verifiableStorageKeyId = envVars.iotaNetwork;
971
- }
972
- coreConfig.types.synchronisedStorageComponent ??= [];
973
- coreConfig.types.synchronisedStorageComponent.push({
974
- type: SynchronisedStorageComponentType.Service,
975
- options: {
976
- config: {
977
- verifiableStorageKeyId: verifiableStorageKeyId ?? "",
978
- blobStorageEncryptionKeyId: envVars.synchronisedStorageBlobStorageEncryptionKeyId ??
979
- SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID,
980
- entityUpdateIntervalMinutes: Coerce.number(envVars.synchronisedStorageEntityUpdateIntervalMinutes),
981
- consolidationIntervalMinutes: Coerce.number(envVars.synchronisedStorageConsolidationIntervalMinutes),
982
- consolidationBatchSize: Coerce.number(envVars.synchronisedStorageConsolidationBatchSize),
983
- maxConsolidations: Coerce.number(envVars.synchronisedStorageMaxConsolidations)
984
- }
985
- }
986
- });
987
- // If there is a trusted url set, we need to add a client
988
- // and give it a feature of trusted so that when the synchronised
989
- // storage is created it can pickup the correct component
990
- if (Is.stringValue(envVars.synchronisedStorageTrustedUrl)) {
991
- coreConfig.types.synchronisedStorageComponent.push({
992
- type: SynchronisedStorageComponentType.RestClient,
1133
+ async function configureFederatedCatalogue(coreConfig, envVars) {
1134
+ if (isFederatedCatalogueRequired(envVars)) {
1135
+ coreConfig.types.federatedCatalogueComponent ??= [];
1136
+ if (Is.stringValue(envVars.federatedCatalogueRemoteEndpoint)) {
1137
+ coreConfig.types.federatedCatalogueComponent.push({
1138
+ type: FederatedCatalogueComponentType.RestClient,
993
1139
  options: {
994
- endpoint: envVars.synchronisedStorageTrustedUrl
995
- },
996
- features: ["trusted"]
1140
+ endpoint: envVars.federatedCatalogueRemoteEndpoint
1141
+ }
1142
+ });
1143
+ }
1144
+ else {
1145
+ coreConfig.types.federatedCatalogueComponent.push({
1146
+ type: FederatedCatalogueComponentType.Service,
1147
+ options: {}
997
1148
  });
1149
+ coreConfig.types.federatedCatalogueFilterComponent ??= [];
1150
+ const filters = commaSeparatedListToArray(envVars.federatedCatalogueFilters);
1151
+ for (const filter of filters) {
1152
+ coreConfig.types.federatedCatalogueFilterComponent.push({
1153
+ type: filter,
1154
+ options: {}
1155
+ });
1156
+ }
998
1157
  }
999
1158
  }
1000
1159
  }
1001
1160
  /**
1002
- * Configures the federated catalogue.
1161
+ * Configures the dataspace control plane and data plane.
1003
1162
  * @param coreConfig The core config.
1004
1163
  * @param envVars The environment variables.
1005
1164
  */
1006
- async function configureFederatedCatalogue(coreConfig, envVars) {
1007
- if (Coerce.boolean(envVars.federatedCatalogueEnabled) ?? false) {
1008
- coreConfig.types.federatedCatalogueComponent ??= [];
1009
- coreConfig.types.federatedCatalogueComponent.push({
1010
- type: FederatedCatalogueComponentType.Service,
1165
+ async function configureDataspace(coreConfig, envVars) {
1166
+ if (Coerce.boolean(envVars.dataspaceEnabled) ?? false) {
1167
+ coreConfig.types.dataspaceControlPlaneComponent ??= [];
1168
+ // We add a multi instance REST client for remote/consumer-initiated transfers.
1169
+ coreConfig.types.dataspaceControlPlaneComponent.push({
1170
+ type: DataspaceControlPlaneComponentType.RestClient,
1171
+ options: {
1172
+ endpoint: "http://localhost"
1173
+ },
1174
+ isMultiInstance: true,
1175
+ features: ["remote"]
1176
+ });
1177
+ coreConfig.types.dataspaceControlPlaneComponent.push({
1178
+ type: DataspaceControlPlaneComponentType.Service,
1011
1179
  options: {
1012
1180
  config: {
1013
- subResourceCacheTtlMs: Coerce.number(envVars.federatedCatalogueCacheTtlMs),
1014
- clearingHouseApproverList: Coerce.object(envVars.federatedCatalogueClearingHouseApproverList) ?? []
1181
+ dataPlanePath: envVars.dataspaceDataPlanePath
1015
1182
  }
1016
- }
1183
+ },
1184
+ isDefault: true
1017
1185
  });
1018
- }
1019
- }
1020
- /**
1021
- * Configures the data space connector.
1022
- * @param coreConfig The core config.
1023
- * @param envVars The environment variables.
1024
- */
1025
- async function configureDataSpaceConnector(coreConfig, envVars) {
1026
- if (Coerce.boolean(envVars.dataSpaceConnectorEnabled) ?? false) {
1027
- coreConfig.types.dataSpaceConnectorComponent ??= [];
1028
- coreConfig.types.dataSpaceConnectorComponent.push({
1029
- type: DataSpaceConnectorComponentType.Service,
1186
+ coreConfig.types.dataspaceDataPlaneComponent ??= [];
1187
+ coreConfig.types.dataspaceDataPlaneComponent.push({
1188
+ type: DataspaceDataPlaneComponentType.Service,
1030
1189
  options: {
1031
1190
  config: {
1032
- retainActivityLogsFor: Coerce.number(envVars.dataSpaceConnectorRetainActivityLogsFor),
1033
- activityLogsCleanUpInterval: Coerce.number(envVars.dataSpaceConnectorActivityLogsCleanUpInterval)
1191
+ retainActivityLogsFor: Coerce.number(envVars.dataspaceRetainActivityLogsFor),
1192
+ activityLogsCleanUpInterval: Coerce.number(envVars.dataspaceActivityLogsCleanUpInterval)
1034
1193
  }
1035
1194
  }
1036
1195
  });
@@ -1068,4 +1227,113 @@ async function configureDlt(coreConfig, envVars) {
1068
1227
  });
1069
1228
  }
1070
1229
  }
1230
+ /**
1231
+ * Converts a comma separated list to an array.
1232
+ * @param value The comma separated list.
1233
+ * @returns The array.
1234
+ */
1235
+ function commaSeparatedListToArray(value) {
1236
+ return (value ?? "")
1237
+ .split(",")
1238
+ .map(item => item.trim())
1239
+ .filter(item => item.length > 0);
1240
+ }
1241
+ /**
1242
+ * Checks if the trust subsystem is required.
1243
+ * Returns true when any component that depends on the trust subsystem is enabled.
1244
+ * @param envVars The environment variables.
1245
+ * @returns True if rights-management, or dataspace is enabled.
1246
+ */
1247
+ export function isTrustRequired(envVars) {
1248
+ return (isRightsManagementRequired(envVars) ||
1249
+ (Coerce.boolean(envVars.dataspaceEnabled) ?? false) ||
1250
+ isFederatedCatalogueRequired(envVars));
1251
+ }
1252
+ /**
1253
+ * Checks if the URL transformer subsystem is required.
1254
+ * Returns true when any component that depends on the URL transformer subsystem is enabled.
1255
+ * @param envVars The environment variables.
1256
+ * @returns True if rights-management, dataspace, federated-catalogue, tenant, or auth entity storage is enabled.
1257
+ */
1258
+ export function isUrlTransformerRequired(envVars) {
1259
+ return (isRightsManagementRequired(envVars) ||
1260
+ (Coerce.boolean(envVars.dataspaceEnabled) ?? false) ||
1261
+ (Coerce.boolean(envVars.tenantEnabled) ?? false) ||
1262
+ isFederatedCatalogueRequired(envVars) ||
1263
+ isAuthEntityStorageRequired(envVars));
1264
+ }
1265
+ /**
1266
+ * Checks if the background tasks subsystem is required.
1267
+ * Returns true when any component that depends on the background tasks subsystem is enabled.
1268
+ * @param envVars The environment variables.
1269
+ * @returns True if dataspace or verifiable storage is enabled.
1270
+ */
1271
+ export function isBackgroundTasksRequired(envVars) {
1272
+ return (Coerce.boolean(envVars.dataspaceEnabled) ?? false) || isImmutableProofRequired(envVars);
1273
+ }
1274
+ /**
1275
+ * Checks if the immutable proof subsystem is required.
1276
+ * Returns true when any component that depends on the immutable proof subsystem is enabled.
1277
+ * @param envVars The environment variables.
1278
+ * @returns True if verifiable storage is enabled.
1279
+ */
1280
+ export function isImmutableProofRequired(envVars) {
1281
+ return ((Coerce.boolean(envVars.auditableItemGraphEnabled) ?? false) ||
1282
+ (Coerce.boolean(envVars.auditableItemStreamEnabled) ?? false) ||
1283
+ (Coerce.boolean(envVars.documentManagementEnabled) ?? false));
1284
+ }
1285
+ /**
1286
+ * Checks if the immutable proof subsystem is required.
1287
+ * Returns true when any component that depends on the immutable proof subsystem is enabled.
1288
+ * @param envVars The environment variables.
1289
+ * @returns True if verifiable storage is enabled.
1290
+ */
1291
+ export function isFederatedCatalogueRequired(envVars) {
1292
+ return ((Coerce.boolean(envVars.federatedCatalogueEnabled) ?? false) ||
1293
+ Is.stringValue(envVars.federatedCatalogueRemoteEndpoint) ||
1294
+ Is.stringValue(envVars.federatedCatalogueFilters) ||
1295
+ (Coerce.boolean(envVars.dataspaceEnabled) ?? false));
1296
+ }
1297
+ /**
1298
+ * Checks if the rights management subsystem is required.
1299
+ * Returns true when any component that depends on the rights management subsystem is enabled.
1300
+ * Note: rights management has no standalone enable flag — it is gated entirely on
1301
+ * `dataspaceEnabled`. Setting `TWIN_RIGHTS_MANAGEMENT_*` env var in isolation does not
1302
+ * enable the subsystem; `TWIN_DATASPACE_ENABLED` must also be true.
1303
+ * @param envVars The environment variables.
1304
+ * @returns True if rights management is enabled.
1305
+ */
1306
+ export function isRightsManagementRequired(envVars) {
1307
+ return Coerce.boolean(envVars.dataspaceEnabled) ?? false;
1308
+ }
1309
+ /**
1310
+ * Checks if the task scheduler subsystem is required.
1311
+ * Returns true when any component that depends on the task scheduler subsystem is enabled.
1312
+ * @param envVars The environment variables.
1313
+ * @returns True if task scheduler is enabled.
1314
+ */
1315
+ export function isTaskSchedulerRequired(envVars) {
1316
+ return ((Coerce.boolean(envVars.dataspaceEnabled) ?? false) ||
1317
+ isRightsManagementRequired(envVars) ||
1318
+ isAuthEntityStorageRequired(envVars));
1319
+ }
1320
+ /**
1321
+ * Checks if the automation subsystem is required.
1322
+ * Returns true when any component that depends on the automation subsystem is enabled.
1323
+ * @param envVars The environment variables.
1324
+ * @returns True if automation is enabled.
1325
+ */
1326
+ export function isAutomationRequired(envVars) {
1327
+ return isRightsManagementRequired(envVars);
1328
+ }
1329
+ /**
1330
+ * Checks if the telemetry subsystem is required.
1331
+ * Returns true when any component that depends on the telemetry subsystem is enabled.
1332
+ * @param envVars The environment variables.
1333
+ * @returns True if telemetry is enabled.
1334
+ */
1335
+ export function isTelemetryRequired(envVars) {
1336
+ return (envVars.telemetryConnector === TelemetryConnectorType.EntityStorage ||
1337
+ envVars.telemetryConnector === TelemetryConnectorType.OpenTelemetry);
1338
+ }
1071
1339
  //# sourceMappingURL=engineEnvBuilder.js.map