@twin.org/node-core 0.0.3-next.9 → 0.9.0

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 (230) hide show
  1. package/README.md +3 -1
  2. package/dist/es/builders/engineEnvBuilder.js +470 -174
  3. package/dist/es/builders/engineEnvBuilder.js.map +1 -1
  4. package/dist/es/builders/engineServerEnvBuilder.js +87 -39
  5. package/dist/es/builders/engineServerEnvBuilder.js.map +1 -1
  6. package/dist/es/builders/extensionsBuilder.js +3 -3
  7. package/dist/es/builders/extensionsBuilder.js.map +1 -1
  8. package/dist/es/cli.js +254 -0
  9. package/dist/es/cli.js.map +1 -0
  10. package/dist/es/commands/bootstrapLegacy.js +312 -0
  11. package/dist/es/commands/bootstrapLegacy.js.map +1 -0
  12. package/dist/es/commands/help.js +86 -0
  13. package/dist/es/commands/help.js.map +1 -0
  14. package/dist/es/commands/identityCreate.js +377 -0
  15. package/dist/es/commands/identityCreate.js.map +1 -0
  16. package/dist/es/commands/identityImports.js +83 -0
  17. package/dist/es/commands/identityImports.js.map +1 -0
  18. package/dist/es/commands/identityVerifiableCredentialCreate.js +146 -0
  19. package/dist/es/commands/identityVerifiableCredentialCreate.js.map +1 -0
  20. package/dist/es/commands/identityVerificationMethodCreate.js +231 -0
  21. package/dist/es/commands/identityVerificationMethodCreate.js.map +1 -0
  22. package/dist/es/commands/identityVerificationMethodImport.js +127 -0
  23. package/dist/es/commands/identityVerificationMethodImport.js.map +1 -0
  24. package/dist/es/commands/nodeSetIdentity.js +69 -0
  25. package/dist/es/commands/nodeSetIdentity.js.map +1 -0
  26. package/dist/es/commands/removeTenantOrgAlias.js +83 -0
  27. package/dist/es/commands/removeTenantOrgAlias.js.map +1 -0
  28. package/dist/es/commands/setNodeOrgId.js +62 -0
  29. package/dist/es/commands/setNodeOrgId.js.map +1 -0
  30. package/dist/es/commands/setTenantOrgId.js +99 -0
  31. package/dist/es/commands/setTenantOrgId.js.map +1 -0
  32. package/dist/es/commands/tenantCreate.js +165 -0
  33. package/dist/es/commands/tenantCreate.js.map +1 -0
  34. package/dist/es/commands/tenantImport.js +108 -0
  35. package/dist/es/commands/tenantImport.js.map +1 -0
  36. package/dist/es/commands/tenantUpdate.js +108 -0
  37. package/dist/es/commands/tenantUpdate.js.map +1 -0
  38. package/dist/es/commands/userCreate.js +239 -0
  39. package/dist/es/commands/userCreate.js.map +1 -0
  40. package/dist/es/commands/userUpdate.js +154 -0
  41. package/dist/es/commands/userUpdate.js.map +1 -0
  42. package/dist/es/commands/vaultKeyCreate.js +191 -0
  43. package/dist/es/commands/vaultKeyCreate.js.map +1 -0
  44. package/dist/es/commands/vaultKeyImport.js +105 -0
  45. package/dist/es/commands/vaultKeyImport.js.map +1 -0
  46. package/dist/es/defaults.js +37 -2
  47. package/dist/es/defaults.js.map +1 -1
  48. package/dist/es/index.js +13 -4
  49. package/dist/es/index.js.map +1 -1
  50. package/dist/es/models/IBootstrapLegacyEnvironmentVariables.js +4 -0
  51. package/dist/es/models/IBootstrapLegacyEnvironmentVariables.js.map +1 -0
  52. package/dist/es/models/ICliArgs.js +4 -0
  53. package/dist/es/models/ICliArgs.js.map +1 -0
  54. package/dist/es/models/ICliCommand.js +2 -0
  55. package/dist/es/models/ICliCommand.js.map +1 -0
  56. package/dist/es/models/ICliCommandDefinition.js +2 -0
  57. package/dist/es/models/ICliCommandDefinition.js.map +1 -0
  58. package/dist/es/models/ICliCommandDefinitionParam.js +2 -0
  59. package/dist/es/models/ICliCommandDefinitionParam.js.map +1 -0
  60. package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -1
  61. package/dist/es/models/IEngineServerEnvironmentVariables.js +2 -0
  62. package/dist/es/models/IEngineServerEnvironmentVariables.js.map +1 -1
  63. package/dist/es/models/IEnvironmentVariables.js +2 -0
  64. package/dist/es/models/IEnvironmentVariables.js.map +1 -0
  65. package/dist/es/models/INodeEngineState.js.map +1 -1
  66. package/dist/es/models/INodeEnvironmentVariables.js +2 -0
  67. package/dist/es/models/INodeEnvironmentVariables.js.map +1 -1
  68. package/dist/es/models/INodeOptions.js.map +1 -1
  69. package/dist/es/models/bootstrapLegacyEnvironmentVariableKeys.js +24 -0
  70. package/dist/es/models/bootstrapLegacyEnvironmentVariableKeys.js.map +1 -0
  71. package/dist/es/models/cliCommandParamType.js +4 -0
  72. package/dist/es/models/cliCommandParamType.js.map +1 -0
  73. package/dist/es/models/engineEnvironmentVariableKeys.js +202 -0
  74. package/dist/es/models/engineEnvironmentVariableKeys.js.map +1 -0
  75. package/dist/es/models/engineServerEnvironmentVariableKeys.js +35 -0
  76. package/dist/es/models/engineServerEnvironmentVariableKeys.js.map +1 -0
  77. package/dist/es/models/nodeEnvironmentVariableKeys.js +18 -0
  78. package/dist/es/models/nodeEnvironmentVariableKeys.js.map +1 -0
  79. package/dist/es/models/nodeExtensionInitialiseEngineMethod.js +2 -0
  80. package/dist/es/models/nodeExtensionInitialiseEngineMethod.js.map +1 -0
  81. package/dist/es/models/nodeExtensionInitialiseEngineServerMethod.js +2 -0
  82. package/dist/es/models/nodeExtensionInitialiseEngineServerMethod.js.map +1 -0
  83. package/dist/es/models/nodeExtensionInitialiseMethod.js +2 -0
  84. package/dist/es/models/nodeExtensionInitialiseMethod.js.map +1 -0
  85. package/dist/es/models/nodeExtensionShutdownMethod.js +4 -0
  86. package/dist/es/models/nodeExtensionShutdownMethod.js.map +1 -0
  87. package/dist/es/node.js +180 -42
  88. package/dist/es/node.js.map +1 -1
  89. package/dist/es/start.js +189 -0
  90. package/dist/es/start.js.map +1 -0
  91. package/dist/es/utils.js +24 -27
  92. package/dist/es/utils.js.map +1 -1
  93. package/dist/types/builders/engineEnvBuilder.d.ts +60 -5
  94. package/dist/types/builders/engineServerEnvBuilder.d.ts +12 -3
  95. package/dist/types/builders/extensionsBuilder.d.ts +8 -8
  96. package/dist/types/cli.d.ts +56 -0
  97. package/dist/types/commands/bootstrapLegacy.d.ts +20 -0
  98. package/dist/types/commands/help.d.ts +24 -0
  99. package/dist/types/commands/identityCreate.d.ts +45 -0
  100. package/dist/types/commands/identityImports.d.ts +25 -0
  101. package/dist/types/commands/identityVerifiableCredentialCreate.d.ts +43 -0
  102. package/dist/types/commands/identityVerificationMethodCreate.d.ts +47 -0
  103. package/dist/types/commands/identityVerificationMethodImport.d.ts +32 -0
  104. package/dist/types/commands/nodeSetIdentity.d.ts +23 -0
  105. package/dist/types/commands/removeTenantOrgAlias.d.ts +24 -0
  106. package/dist/types/commands/setNodeOrgId.d.ts +24 -0
  107. package/dist/types/commands/setTenantOrgId.d.ts +38 -0
  108. package/dist/types/commands/tenantCreate.d.ts +41 -0
  109. package/dist/types/commands/tenantImport.d.ts +29 -0
  110. package/dist/types/commands/tenantUpdate.d.ts +29 -0
  111. package/dist/types/commands/userCreate.d.ts +51 -0
  112. package/dist/types/commands/userUpdate.d.ts +40 -0
  113. package/dist/types/commands/vaultKeyCreate.d.ts +43 -0
  114. package/dist/types/commands/vaultKeyImport.d.ts +29 -0
  115. package/dist/types/defaults.d.ts +30 -2
  116. package/dist/types/index.d.ts +13 -4
  117. package/dist/types/models/IBootstrapLegacyEnvironmentVariables.d.ts +56 -0
  118. package/dist/types/models/ICliArgs.d.ts +20 -0
  119. package/dist/types/models/ICliCommand.d.ts +17 -0
  120. package/dist/types/models/ICliCommandDefinition.d.ts +46 -0
  121. package/dist/types/models/ICliCommandDefinitionParam.d.ts +35 -0
  122. package/dist/types/models/IEngineEnvironmentVariables.d.ts +199 -96
  123. package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +9 -2
  124. package/dist/types/models/IEnvironmentVariables.d.ts +8 -0
  125. package/dist/types/models/INodeEngineState.d.ts +2 -9
  126. package/dist/types/models/INodeEnvironmentVariables.d.ts +1 -40
  127. package/dist/types/models/INodeOptions.d.ts +9 -5
  128. package/dist/types/models/bootstrapLegacyEnvironmentVariableKeys.d.ts +4 -0
  129. package/dist/types/models/cliCommandParamType.d.ts +4 -0
  130. package/dist/types/models/engineEnvironmentVariableKeys.d.ts +4 -0
  131. package/dist/types/models/engineServerEnvironmentVariableKeys.d.ts +7 -0
  132. package/dist/types/models/nodeEnvironmentVariableKeys.d.ts +5 -0
  133. package/dist/types/models/nodeExtensionInitialiseEngineMethod.d.ts +8 -0
  134. package/dist/types/models/nodeExtensionInitialiseEngineServerMethod.d.ts +9 -0
  135. package/dist/types/models/nodeExtensionInitialiseMethod.d.ts +9 -0
  136. package/dist/types/models/nodeExtensionShutdownMethod.d.ts +6 -0
  137. package/dist/types/node.d.ts +8 -7
  138. package/dist/types/{server.d.ts → start.d.ts} +6 -3
  139. package/dist/types/utils.d.ts +9 -10
  140. package/docs/changelog.md +883 -186
  141. package/docs/examples.md +99 -1
  142. package/docs/reference/functions/buildConfiguration.md +3 -3
  143. package/docs/reference/functions/buildEngineConfiguration.md +1 -7
  144. package/docs/reference/functions/buildEngineServerConfiguration.md +1 -1
  145. package/docs/reference/functions/constructCliCommand.md +27 -0
  146. package/docs/reference/functions/executeCommand.md +29 -0
  147. package/docs/reference/functions/extensionsConfiguration.md +1 -1
  148. package/docs/reference/functions/extensionsInitialiseEngine.md +2 -2
  149. package/docs/reference/functions/extensionsInitialiseEngineServer.md +2 -2
  150. package/docs/reference/functions/getEnvDefaults.md +19 -0
  151. package/docs/reference/functions/getScriptDirectory.md +19 -0
  152. package/docs/reference/functions/initialiseLocales.md +2 -0
  153. package/docs/reference/functions/isAuthEntityStorageRequired.md +20 -0
  154. package/docs/reference/functions/isAutomationRequired.md +20 -0
  155. package/docs/reference/functions/isBackgroundTasksRequired.md +20 -0
  156. package/docs/reference/functions/isFederatedCatalogueRequired.md +20 -0
  157. package/docs/reference/functions/isImmutableProofRequired.md +20 -0
  158. package/docs/reference/functions/isRightsManagementRequired.md +23 -0
  159. package/docs/reference/functions/isTaskSchedulerRequired.md +20 -0
  160. package/docs/reference/functions/isTelemetryRequired.md +20 -0
  161. package/docs/reference/functions/isTrustRequired.md +20 -0
  162. package/docs/reference/functions/loadJsonFile.md +1 -1
  163. package/docs/reference/functions/loadTextFile.md +1 -1
  164. package/docs/reference/functions/overrideModuleImport.md +1 -1
  165. package/docs/reference/functions/parseCommandLineArgs.md +19 -0
  166. package/docs/reference/functions/processEnvOptions.md +27 -0
  167. package/docs/reference/functions/registerCommands.md +9 -0
  168. package/docs/reference/functions/resolvePackageEntryPoint.md +2 -2
  169. package/docs/reference/functions/run.md +8 -2
  170. package/docs/reference/functions/shutdownExtensions.md +2 -2
  171. package/docs/reference/functions/start.md +10 -4
  172. package/docs/reference/functions/substituteEnvOptions.md +25 -0
  173. package/docs/reference/index.md +26 -14
  174. package/docs/reference/interfaces/IBootstrapLegacyEnvironmentVariables.md +117 -0
  175. package/docs/reference/interfaces/ICacheMetadata.md +3 -3
  176. package/docs/reference/interfaces/ICliArgs.md +35 -0
  177. package/docs/reference/interfaces/ICliCommand.md +23 -0
  178. package/docs/reference/interfaces/ICliCommandDefinition.md +101 -0
  179. package/docs/reference/interfaces/ICliCommandDefinitionParam.md +65 -0
  180. package/docs/reference/interfaces/IEngineEnvironmentVariables.md +553 -365
  181. package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +41 -1746
  182. package/docs/reference/interfaces/IModuleProtocol.md +3 -3
  183. package/docs/reference/interfaces/INodeEngineState.md +6 -21
  184. package/docs/reference/interfaces/INodeEnvironmentVariables.md +10 -1967
  185. package/docs/reference/interfaces/INodeOptions.md +46 -38
  186. package/docs/reference/interfaces/IProtocolHandlerResult.md +2 -2
  187. package/docs/reference/type-aliases/CliCommandParamType.md +5 -0
  188. package/docs/reference/type-aliases/IEnvironmentVariables.md +5 -0
  189. package/docs/reference/type-aliases/NodeExtensionInitialiseEngineMethod.md +3 -1
  190. package/docs/reference/type-aliases/NodeExtensionInitialiseEngineServerMethod.md +3 -1
  191. package/docs/reference/type-aliases/NodeExtensionInitialiseMethod.md +4 -2
  192. package/docs/reference/type-aliases/NodeExtensionShutdownMethod.md +3 -1
  193. package/docs/reference/variables/ATTESTATION_VERIFICATION_METHOD_ID.md +2 -0
  194. package/docs/reference/variables/AUTH_SIGNING_KEY_ID.md +2 -0
  195. package/docs/reference/variables/BLOB_STORAGE_ENCRYPTION_KEY_ID.md +2 -0
  196. package/docs/reference/variables/CONTEXT_ID_HANDLER_FEATURE_DID.md +2 -0
  197. package/docs/reference/variables/CONTEXT_ID_HANDLER_FEATURE_TENANT.md +2 -0
  198. package/docs/reference/variables/IMMUTABLE_PROOF_VERIFICATION_METHOD_ID.md +2 -0
  199. package/docs/reference/variables/ModuleProtocol.md +5 -5
  200. package/docs/reference/variables/TRUST_VERIFICATION_METHOD_ID.md +5 -0
  201. package/locales/en.json +680 -30
  202. package/package.json +30 -27
  203. package/dist/es/bootstrap.js +0 -383
  204. package/dist/es/bootstrap.js.map +0 -1
  205. package/dist/es/identity.js +0 -182
  206. package/dist/es/identity.js.map +0 -1
  207. package/dist/es/models/nodeExtensionMethods.js +0 -2
  208. package/dist/es/models/nodeExtensionMethods.js.map +0 -1
  209. package/dist/es/models/nodeFeatures.js +0 -21
  210. package/dist/es/models/nodeFeatures.js.map +0 -1
  211. package/dist/es/server.js +0 -81
  212. package/dist/es/server.js.map +0 -1
  213. package/dist/types/bootstrap.d.ts +0 -68
  214. package/dist/types/identity.d.ts +0 -14
  215. package/dist/types/models/nodeExtensionMethods.d.ts +0 -27
  216. package/dist/types/models/nodeFeatures.d.ts +0 -21
  217. package/docs/detailed-guide.md +0 -129
  218. package/docs/reference/functions/bootstrap.md +0 -29
  219. package/docs/reference/functions/bootstrapAuth.md +0 -35
  220. package/docs/reference/functions/bootstrapBlobEncryption.md +0 -35
  221. package/docs/reference/functions/bootstrapImmutableProofMethod.md +0 -35
  222. package/docs/reference/functions/bootstrapNodeAdminUser.md +0 -35
  223. package/docs/reference/functions/bootstrapNodeId.md +0 -35
  224. package/docs/reference/functions/bootstrapSynchronisedStorage.md +0 -35
  225. package/docs/reference/functions/bootstrapTenantId.md +0 -35
  226. package/docs/reference/functions/getFeatures.md +0 -19
  227. package/docs/reference/type-aliases/NodeFeatures.md +0 -5
  228. package/docs/reference/variables/NodeFeatures.md +0 -25
  229. package/docs/reference/variables/SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID.md +0 -3
  230. package/docs/reference/variables/VC_AUTHENTICATION_VERIFICATION_METHOD_ID.md +0 -3
@@ -1,17 +1,17 @@
1
1
  // Copyright 2024 IOTA Stiftung.
2
2
  // SPDX-License-Identifier: Apache-2.0.
3
3
  import path from "node:path";
4
- import { Coerce, Is } from "@twin.org/core";
5
- import { AttestationComponentType, AttestationConnectorType, AuditableItemGraphComponentType, AuditableItemStreamComponentType, AuthenticationGeneratorComponentType, BackgroundTaskComponentType, BlobStorageComponentType, BlobStorageConnectorType, ContextIdHandlerComponentType, 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, TrustComponentType, 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";
4
+ import { Coerce, Is, Mutex } from "@twin.org/core";
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, PlatformComponentType, RightsManagementPapComponentType, RightsManagementPdpComponentType, RightsManagementPepComponentType, RightsManagementPipComponentType, RightsManagementPmpComponentType, RightsManagementPnapComponentType, RightsManagementPnpComponentType, RightsManagementPxpComponentType, TaskSchedulerComponentType, TelemetryComponentType, TelemetryConnectorType, TenantAdminComponentType, TrustComponentType, TrustVerifierComponentType, 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.
11
- * @param contextIdKeys The context ID keys.
12
12
  * @returns The config for the core.
13
13
  */
14
- export async function buildEngineConfiguration(envVars, contextIdKeys) {
14
+ export async function buildEngineConfiguration(envVars) {
15
15
  if (Is.stringValue(envVars.storageFileRoot)) {
16
16
  envVars.stateFilename ??= "engine-state.json";
17
17
  envVars.storageFileRoot = path.resolve(envVars.storageFileRoot);
@@ -19,8 +19,15 @@ export async function buildEngineConfiguration(envVars, contextIdKeys) {
19
19
  }
20
20
  const coreConfig = {
21
21
  debug: Coerce.boolean(envVars.debug) ?? false,
22
+ silent: Coerce.boolean(envVars.silent) ?? false,
23
+ silentLoggers: commaSeparatedListToArray(envVars.loggingSilentComponents),
22
24
  types: {}
23
25
  };
26
+ const mutexTimeoutMs = Coerce.integer(envVars.mutexTimeoutMsDefault);
27
+ if (!Is.empty(mutexTimeoutMs)) {
28
+ Mutex.setDefaultTimeoutMs(mutexTimeoutMs);
29
+ }
30
+ await configurePlatform(coreConfig, envVars);
24
31
  await configureTenant(coreConfig, envVars);
25
32
  await configureContextIdHandlers(coreConfig, envVars);
26
33
  await configureEntityStorage(coreConfig, envVars);
@@ -32,11 +39,15 @@ export async function buildEngineConfiguration(envVars, contextIdKeys) {
32
39
  await configureTaskScheduler(coreConfig, envVars);
33
40
  await configureEventBus(coreConfig, envVars);
34
41
  await configureTelemetry(coreConfig, envVars);
42
+ await configureMetricsCollector(coreConfig, envVars);
35
43
  await configureMessaging(coreConfig, envVars);
44
+ await configureAutomation(coreConfig, envVars);
45
+ await configureHealth(coreConfig, envVars);
36
46
  await configureFaucet(coreConfig, envVars);
37
47
  await configureWallet(coreConfig, envVars);
38
48
  await configureNft(coreConfig, envVars);
39
- await configureVerifiableStorage(coreConfig, envVars);
49
+ await configureNotarization(coreConfig, envVars);
50
+ await configureImmutableProof(coreConfig, envVars);
40
51
  await configureIdentity(coreConfig, envVars);
41
52
  await configureIdentityResolver(coreConfig, envVars);
42
53
  await configureIdentityProfile(coreConfig, envVars);
@@ -45,18 +56,17 @@ export async function buildEngineConfiguration(envVars, contextIdKeys) {
45
56
  await configureAuditableItemGraph(coreConfig, envVars);
46
57
  await configureAuditableItemStream(coreConfig, envVars);
47
58
  await configureDocumentManagement(coreConfig, envVars);
48
- await configureVerifiableCredentialAuthentication(coreConfig, envVars);
49
59
  await configureTrust(coreConfig, envVars);
50
60
  await configureRightsManagement(coreConfig, envVars);
51
- await configureSynchronisedStorage(coreConfig, envVars);
52
61
  await configureFederatedCatalogue(coreConfig, envVars);
53
- await configureDataSpaceConnector(coreConfig, envVars);
62
+ await configureDataspace(coreConfig, envVars);
54
63
  return coreConfig;
55
64
  }
56
65
  /**
57
66
  * Configures the entity storage.
58
67
  * @param coreConfig The core config.
59
68
  * @param envVars The environment variables.
69
+ * @returns A promise that resolves when the entity storage configuration has been applied.
60
70
  */
61
71
  async function configureEntityStorage(coreConfig, envVars) {
62
72
  coreConfig.types ??= {};
@@ -64,14 +74,22 @@ async function configureEntityStorage(coreConfig, envVars) {
64
74
  const entityStorageConnectorTypes = commaSeparatedListToArray(envVars.entityStorageConnectorType);
65
75
  if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.Memory)) {
66
76
  coreConfig.types.entityStorageConnector.push({
67
- type: EntityStorageConnectorType.Memory
77
+ type: EntityStorageConnectorType.Memory,
78
+ options: {
79
+ config: {
80
+ mutexTimeoutMs: Coerce.integer(envVars.entityStorageMemoryMutexTimeout)
81
+ }
82
+ }
68
83
  });
69
84
  }
70
85
  if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.File)) {
71
86
  coreConfig.types.entityStorageConnector.push({
72
87
  type: EntityStorageConnectorType.File,
73
88
  options: {
74
- config: { directory: envVars.storageFileRoot ?? "" },
89
+ config: {
90
+ directory: envVars.storageFileRoot ?? "",
91
+ mutexTimeoutMs: Coerce.integer(envVars.entityStorageFileMutexTimeout)
92
+ },
75
93
  folderPrefix: envVars.entityStorageTablePrefix
76
94
  }
77
95
  });
@@ -86,7 +104,7 @@ async function configureEntityStorage(coreConfig, envVars) {
86
104
  accessKeyId: envVars.awsDynamodbAccessKeyId,
87
105
  secretAccessKey: envVars.awsDynamodbSecretAccessKey,
88
106
  endpoint: envVars.awsDynamodbEndpoint,
89
- connectionTimeoutMs: Coerce.integer(envVars.awsDynamodbConnectionTimeoutMs)
107
+ connectionTimeoutMs: Coerce.integer(envVars.awsDynamodbConnectionTimeout)
90
108
  },
91
109
  tablePrefix: envVars.entityStorageTablePrefix
92
110
  }
@@ -115,7 +133,7 @@ async function configureEntityStorage(coreConfig, envVars) {
115
133
  credentials: envVars.gcpFirestoreCredentials ?? "",
116
134
  databaseId: envVars.gcpFirestoreDatabaseId ?? "",
117
135
  collectionName: envVars.gcpFirestoreCollectionName ?? "",
118
- endpoint: envVars.gcpFirestoreApiEndpoint ?? ""
136
+ endpoint: envVars.gcpFirestoreEndpoint ?? ""
119
137
  },
120
138
  tablePrefix: envVars.entityStorageTablePrefix
121
139
  }
@@ -181,15 +199,6 @@ async function configureEntityStorage(coreConfig, envVars) {
181
199
  });
182
200
  }
183
201
  const defaultEntityStorageConnectorType = envVars.entityStorageConnectorDefault ?? entityStorageConnectorTypes[0];
184
- if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.Synchronised)) {
185
- // For synchronised storage we use the default connector as the one we wrap for real DB operations
186
- coreConfig.types.entityStorageConnector.push({
187
- type: EntityStorageConnectorType.Synchronised,
188
- options: {
189
- entityStorageConnectorType: defaultEntityStorageConnectorType
190
- }
191
- });
192
- }
193
202
  if (Is.arrayValue(entityStorageConnectorTypes)) {
194
203
  for (const config of coreConfig.types.entityStorageConnector) {
195
204
  if (config.type === defaultEntityStorageConnectorType) {
@@ -203,6 +212,7 @@ async function configureEntityStorage(coreConfig, envVars) {
203
212
  * Configures the blob storage.
204
213
  * @param coreConfig The core config.
205
214
  * @param envVars The environment variables.
215
+ * @returns A promise that resolves when the blob storage configuration has been applied.
206
216
  */
207
217
  async function configureBlobStorage(coreConfig, envVars) {
208
218
  coreConfig.types.blobStorageConnector ??= [];
@@ -274,7 +284,7 @@ async function configureBlobStorage(coreConfig, envVars) {
274
284
  projectId: envVars.gcpStorageProjectId ?? "",
275
285
  credentials: envVars.gcpStorageCredentials ?? "",
276
286
  bucketName: envVars.gcpStorageBucketName ?? "",
277
- apiEndpoint: envVars.gcpFirestoreApiEndpoint
287
+ apiEndpoint: envVars.gcpFirestoreEndpoint
278
288
  },
279
289
  storagePrefix: envVars.blobStoragePrefix
280
290
  }
@@ -286,14 +296,6 @@ async function configureBlobStorage(coreConfig, envVars) {
286
296
  if (config.type === defaultStorageConnectorType) {
287
297
  config.isDefault = true;
288
298
  }
289
- // If this blob storage connector is the one to use for public access
290
- // then add it as a feature
291
- if (Is.stringValue(envVars.blobStorageConnectorPublic) &&
292
- config.type === envVars.blobStorageConnectorPublic) {
293
- config.features ??= [];
294
- config.features.push("public");
295
- break;
296
- }
297
299
  }
298
300
  }
299
301
  if (coreConfig.types.blobStorageConnector.length > 0) {
@@ -303,7 +305,7 @@ async function configureBlobStorage(coreConfig, envVars) {
303
305
  options: {
304
306
  config: {
305
307
  vaultKeyId: (envVars.blobStorageEnableEncryption ?? false)
306
- ? (envVars.blobStorageEncryptionKeyId ?? BLOB_STORAGE_ENCRYPTION_KEY_ID)
308
+ ? envVars.blobStorageEncryptionKeyId
307
309
  : undefined
308
310
  }
309
311
  }
@@ -314,6 +316,7 @@ async function configureBlobStorage(coreConfig, envVars) {
314
316
  * Configures the logging.
315
317
  * @param coreConfig The core config.
316
318
  * @param envVars The environment variables.
319
+ * @returns A promise that resolves when the logging configuration has been applied.
317
320
  */
318
321
  async function configureLogging(coreConfig, envVars) {
319
322
  coreConfig.types.loggingConnector ??= [];
@@ -334,7 +337,14 @@ async function configureLogging(coreConfig, envVars) {
334
337
  }
335
338
  else if (loggingConnector === LoggingConnectorType.EntityStorage) {
336
339
  coreConfig.types.loggingConnector.push({
337
- type: LoggingConnectorType.EntityStorage
340
+ type: LoggingConnectorType.EntityStorage,
341
+ options: {
342
+ config: {
343
+ batchSize: Coerce.integer(envVars.loggingBatchSize),
344
+ batchIntervalMs: (Coerce.integer(envVars.loggingBatchFlushInterval) ?? 5) * 1000,
345
+ mutexTimeoutMs: Coerce.integer(envVars.loggingMutexTimeout)
346
+ }
347
+ }
338
348
  });
339
349
  additionalConnectorCount++;
340
350
  }
@@ -366,12 +376,18 @@ async function configureLogging(coreConfig, envVars) {
366
376
  * Configures the vault.
367
377
  * @param coreConfig The core config.
368
378
  * @param envVars The environment variables.
379
+ * @returns A promise that resolves when the vault configuration has been applied.
369
380
  */
370
381
  async function configureVault(coreConfig, envVars) {
371
382
  coreConfig.types.vaultConnector ??= [];
372
383
  if (envVars.vaultConnector === VaultConnectorType.EntityStorage) {
373
384
  coreConfig.types.vaultConnector.push({
374
- type: VaultConnectorType.EntityStorage
385
+ type: VaultConnectorType.EntityStorage,
386
+ options: {
387
+ config: {
388
+ prefix: envVars.vaultPrefix
389
+ }
390
+ }
375
391
  });
376
392
  }
377
393
  else if (envVars.vaultConnector === VaultConnectorType.Hashicorp) {
@@ -380,7 +396,8 @@ async function configureVault(coreConfig, envVars) {
380
396
  options: {
381
397
  config: {
382
398
  endpoint: envVars.hashicorpVaultEndpoint ?? "",
383
- token: envVars.hashicorpVaultToken ?? ""
399
+ token: envVars.hashicorpVaultToken ?? "",
400
+ prefix: envVars.vaultPrefix
384
401
  }
385
402
  }
386
403
  });
@@ -390,19 +407,21 @@ async function configureVault(coreConfig, envVars) {
390
407
  * Configures the background task.
391
408
  * @param coreConfig The core config.
392
409
  * @param envVars The environment variables.
410
+ * @returns A promise that resolves when the background task configuration has been applied.
393
411
  */
394
412
  async function configureBackgroundTask(coreConfig, envVars) {
395
413
  coreConfig.types.backgroundTaskComponent ??= [];
396
- if (Coerce.boolean(envVars.backgroundTasksEnabled) ?? false) {
414
+ if (isBackgroundTasksRequired(envVars)) {
397
415
  coreConfig.types.backgroundTaskComponent.push({
398
416
  type: BackgroundTaskComponentType.Service
399
417
  });
400
418
  }
401
419
  }
402
420
  /**
403
- * Configures the event bud.
421
+ * Configures the event bus.
404
422
  * @param coreConfig The core config.
405
423
  * @param envVars The environment variables.
424
+ * @returns A promise that resolves when the event bus configuration has been applied.
406
425
  */
407
426
  async function configureEventBus(coreConfig, envVars) {
408
427
  coreConfig.types.eventBusConnector ??= [];
@@ -420,6 +439,7 @@ async function configureEventBus(coreConfig, envVars) {
420
439
  * Configures the telemetry.
421
440
  * @param coreConfig The core config.
422
441
  * @param envVars The environment variables.
442
+ * @returns A promise that resolves when the telemetry configuration has been applied.
423
443
  */
424
444
  async function configureTelemetry(coreConfig, envVars) {
425
445
  coreConfig.types.telemetryConnector ??= [];
@@ -428,30 +448,140 @@ async function configureTelemetry(coreConfig, envVars) {
428
448
  type: TelemetryConnectorType.EntityStorage
429
449
  });
430
450
  }
451
+ else if (envVars.telemetryConnector === TelemetryConnectorType.OpenTelemetry) {
452
+ let readers;
453
+ if (envVars.openTelemetryReader === "prometheus") {
454
+ readers = {
455
+ prometheus: {
456
+ type: OpenTelemetryReaderTypes.Prometheus,
457
+ port: Coerce.integer(envVars.openTelemetryPrometheusPort)
458
+ }
459
+ };
460
+ }
461
+ coreConfig.types.telemetryConnector.push({
462
+ type: TelemetryConnectorType.OpenTelemetry,
463
+ options: {
464
+ config: {
465
+ meterName: envVars.openTelemetryMeterName,
466
+ meterVersion: envVars.openTelemetryMeterVersion,
467
+ readers
468
+ }
469
+ }
470
+ });
471
+ }
431
472
  if (coreConfig.types.telemetryConnector.length > 0) {
432
473
  coreConfig.types.telemetryComponent ??= [];
433
474
  coreConfig.types.telemetryComponent.push({ type: TelemetryComponentType.Service });
434
475
  }
435
476
  }
477
+ /**
478
+ * Configures the metrics producers and orchestrator service.
479
+ * @param coreConfig The core config.
480
+ * @param envVars The environment variables.
481
+ * @returns A promise that resolves when the metrics collector configuration has been applied.
482
+ */
483
+ async function configureMetricsCollector(coreConfig, envVars) {
484
+ if (isTelemetryRequired(envVars)) {
485
+ const intervalSec = Coerce.integer(envVars.telemetryMetricsCollectorInterval) ?? 60;
486
+ coreConfig.types.metricsCollectorComponent ??= [];
487
+ coreConfig.types.metricsCollectorComponent.push({
488
+ type: MetricsCollectorComponentType.Service,
489
+ options: { config: { intervalMs: intervalSec * 1000 } }
490
+ });
491
+ const maxHistory = Coerce.integer(envVars.telemetryMetricsProducerMaxHistory) ?? 1440;
492
+ coreConfig.types.metricsProducerComponent ??= [];
493
+ const metricsProducers = commaSeparatedListToArray(envVars.telemetryMetricsProducers ??
494
+ [MetricsProducerComponentType.System, MetricsProducerComponentType.Process].join(","));
495
+ for (const producerType of metricsProducers) {
496
+ coreConfig.types.metricsProducerComponent.push({
497
+ type: producerType,
498
+ options: { maxHistory }
499
+ });
500
+ }
501
+ }
502
+ }
503
+ /**
504
+ * Configures the automation.
505
+ * @param coreConfig The core config.
506
+ * @param envVars The environment variables.
507
+ * @returns A promise that resolves when the automation configuration has been applied.
508
+ */
509
+ async function configureAutomation(coreConfig, envVars) {
510
+ coreConfig.types.automationComponent ??= [];
511
+ if (isAutomationRequired(envVars)) {
512
+ coreConfig.types.automationComponent.push({
513
+ type: AutomationComponentType.Service
514
+ });
515
+ const automationActionTypes = commaSeparatedListToArray(envVars.automationActionTypes);
516
+ if (Is.arrayValue(automationActionTypes)) {
517
+ coreConfig.types.automationAction ??= [];
518
+ for (const actionType of automationActionTypes) {
519
+ coreConfig.types.automationAction.push({
520
+ type: actionType,
521
+ isMultiInstance: true
522
+ });
523
+ }
524
+ }
525
+ }
526
+ }
527
+ /**
528
+ * Configures the health.
529
+ * @param coreConfig The core config.
530
+ * @param envVars The environment variables.
531
+ * @returns A promise that resolves when the health configuration has been applied.
532
+ */
533
+ async function configureHealth(coreConfig, envVars) {
534
+ coreConfig.types.healthComponent ??= [];
535
+ if (Coerce.boolean(envVars.healthEnabled) ?? false) {
536
+ coreConfig.types.healthComponent.push({
537
+ type: HealthComponentType.Service,
538
+ options: {
539
+ config: {
540
+ healthCheckInterval: (Coerce.integer(envVars.healthInterval) ?? 60) * 1000,
541
+ initialInterval: (Coerce.integer(envVars.healthStartupInterval) ?? 2) * 1000
542
+ }
543
+ }
544
+ });
545
+ }
546
+ }
547
+ /**
548
+ * Configures the platform.
549
+ * @param coreConfig The core config.
550
+ * @param envVars The environment variables.
551
+ * @returns A promise that resolves when the platform configuration has been applied.
552
+ */
553
+ async function configurePlatform(coreConfig, envVars) {
554
+ const isTenantEnabled = Coerce.boolean(envVars.tenantEnabled) ?? false;
555
+ coreConfig.types.platformComponent ??= [];
556
+ coreConfig.types.platformComponent.push({
557
+ type: PlatformComponentType.Service,
558
+ options: {
559
+ config: {
560
+ isMultiTenant: isTenantEnabled
561
+ }
562
+ }
563
+ });
564
+ }
436
565
  /**
437
566
  * Configures the tenant.
438
567
  * @param coreConfig The core config.
439
568
  * @param envVars The environment variables.
569
+ * @returns A promise that resolves when the tenant configuration has been applied.
440
570
  */
441
571
  async function configureTenant(coreConfig, envVars) {
442
- if (Coerce.boolean(envVars.tenantEnabled) ?? false) {
572
+ const isTenantEnabled = Coerce.boolean(envVars.tenantEnabled) ?? false;
573
+ if (isTenantEnabled) {
443
574
  coreConfig.types.tenantAdminComponent ??= [];
444
575
  coreConfig.types.tenantAdminComponent.push({
445
576
  type: TenantAdminComponentType.Service
446
577
  });
447
- coreConfig.types.tenantComponent ??= [];
448
- coreConfig.types.tenantComponent.push({ type: TenantAdminComponentType.Service });
449
578
  }
450
579
  }
451
580
  /**
452
- * Configures the context id handlers.
581
+ * Configures the context ID handlers.
453
582
  * @param coreConfig The core config.
454
583
  * @param envVars The environment variables.
584
+ * @returns A promise that resolves when the context ID handler configuration has been applied.
455
585
  */
456
586
  async function configureContextIdHandlers(coreConfig, envVars) {
457
587
  coreConfig.types.contextIdHandlerComponent ??= [];
@@ -470,6 +600,7 @@ async function configureContextIdHandlers(coreConfig, envVars) {
470
600
  * Configures the messaging.
471
601
  * @param coreConfig The core config.
472
602
  * @param envVars The environment variables.
603
+ * @returns A promise that resolves when the messaging configuration has been applied.
473
604
  */
474
605
  async function configureMessaging(coreConfig, envVars) {
475
606
  if (Coerce.boolean(envVars.messagingEnabled) ?? false) {
@@ -521,6 +652,16 @@ async function configureMessaging(coreConfig, envVars) {
521
652
  });
522
653
  }
523
654
  else if (envVars.messagingPushNotificationConnector === MessagingPushNotificationConnectorType.Aws) {
655
+ let messagingApps;
656
+ if (Is.stringValue(envVars.awsMessagingPushNotificationApplications)) {
657
+ try {
658
+ messagingApps = JSON.parse(envVars.awsMessagingPushNotificationApplications);
659
+ }
660
+ catch { }
661
+ }
662
+ else if (Is.array(envVars.awsMessagingPushNotificationApplications)) {
663
+ messagingApps = envVars.awsMessagingPushNotificationApplications;
664
+ }
524
665
  coreConfig.types.messagingPushNotificationConnector.push({
525
666
  type: MessagingPushNotificationConnectorType.Aws,
526
667
  options: {
@@ -530,9 +671,7 @@ async function configureMessaging(coreConfig, envVars) {
530
671
  accessKeyId: envVars.awsSesAccessKeyId,
531
672
  secretAccessKey: envVars.awsSesSecretAccessKey,
532
673
  endpoint: envVars.awsSesEndpoint,
533
- applicationsSettings: Is.json(envVars.awsMessagingPushNotificationApplications)
534
- ? JSON.parse(envVars.awsMessagingPushNotificationApplications)
535
- : []
674
+ applicationsSettings: messagingApps ?? []
536
675
  }
537
676
  }
538
677
  });
@@ -549,6 +688,7 @@ async function configureMessaging(coreConfig, envVars) {
549
688
  * Configures the faucet.
550
689
  * @param coreConfig The core config.
551
690
  * @param envVars The environment variables.
691
+ * @returns A promise that resolves when the faucet configuration has been applied.
552
692
  */
553
693
  async function configureFaucet(coreConfig, envVars) {
554
694
  coreConfig.types.faucetConnector ??= [];
@@ -575,6 +715,7 @@ async function configureFaucet(coreConfig, envVars) {
575
715
  * Configures the wallet.
576
716
  * @param coreConfig The core config.
577
717
  * @param envVars The environment variables.
718
+ * @returns A promise that resolves when the wallet configuration has been applied.
578
719
  */
579
720
  async function configureWallet(coreConfig, envVars) {
580
721
  coreConfig.types.walletConnector ??= [];
@@ -597,6 +738,7 @@ async function configureWallet(coreConfig, envVars) {
597
738
  * Configures the NFT.
598
739
  * @param coreConfig The core config.
599
740
  * @param envVars The environment variables.
741
+ * @returns A promise that resolves when the NFT configuration has been applied.
600
742
  */
601
743
  async function configureNft(coreConfig, envVars) {
602
744
  coreConfig.types.nftConnector ??= [];
@@ -607,10 +749,14 @@ async function configureNft(coreConfig, envVars) {
607
749
  }
608
750
  else if (envVars.nftConnector === NftConnectorType.Iota) {
609
751
  const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
752
+ const config = {
753
+ ...dltConfig?.options?.config,
754
+ deploymentPkgId: Is.stringValue(envVars.nftPackageId) ? envVars.nftPackageId : undefined
755
+ };
610
756
  coreConfig.types.nftConnector.push({
611
757
  type: NftConnectorType.Iota,
612
758
  options: {
613
- config: dltConfig?.options?.config ?? {}
759
+ config
614
760
  }
615
761
  });
616
762
  }
@@ -620,37 +766,46 @@ async function configureNft(coreConfig, envVars) {
620
766
  }
621
767
  }
622
768
  /**
623
- * Configures the verifiable storage.
769
+ * Configures the notarization.
624
770
  * @param coreConfig The core config.
625
771
  * @param envVars The environment variables.
772
+ * @returns A promise that resolves when the notarization configuration has been applied.
626
773
  */
627
- async function configureVerifiableStorage(coreConfig, envVars) {
628
- coreConfig.types.verifiableStorageConnector ??= [];
629
- if (envVars.verifiableStorageConnector === VerifiableStorageConnectorType.EntityStorage) {
630
- coreConfig.types.verifiableStorageConnector.push({
631
- type: VerifiableStorageConnectorType.EntityStorage
774
+ async function configureNotarization(coreConfig, envVars) {
775
+ coreConfig.types.notarizationConnector ??= [];
776
+ if (envVars.notarizationConnector === NotarizationConnectorType.EntityStorage) {
777
+ coreConfig.types.notarizationConnector.push({
778
+ type: NotarizationConnectorType.EntityStorage
632
779
  });
633
780
  }
634
- else if (envVars.verifiableStorageConnector === VerifiableStorageConnectorType.Iota) {
781
+ else if (envVars.notarizationConnector === NotarizationConnectorType.Iota) {
635
782
  const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
636
- coreConfig.types.verifiableStorageConnector.push({
637
- type: VerifiableStorageConnectorType.Iota,
783
+ coreConfig.types.notarizationConnector.push({
784
+ type: NotarizationConnectorType.Iota,
638
785
  options: {
639
786
  config: dltConfig?.options?.config ?? {}
640
787
  }
641
788
  });
642
789
  }
643
- if (coreConfig.types.verifiableStorageConnector.length > 0) {
644
- coreConfig.types.verifiableStorageComponent ??= [];
645
- coreConfig.types.verifiableStorageComponent.push({
646
- type: VerifiableStorageComponentType.Service
647
- });
790
+ if (coreConfig.types.notarizationConnector.length > 0) {
791
+ coreConfig.types.notarizationComponent ??= [];
792
+ coreConfig.types.notarizationComponent.push({ type: NotarizationComponentType.Service });
793
+ }
794
+ }
795
+ /**
796
+ * Configures the immutable proof.
797
+ * @param coreConfig The core config.
798
+ * @param envVars The environment variables.
799
+ * @returns A promise that resolves when the immutable proof configuration has been applied.
800
+ */
801
+ async function configureImmutableProof(coreConfig, envVars) {
802
+ if (isImmutableProofRequired(envVars)) {
648
803
  coreConfig.types.immutableProofComponent ??= [];
649
804
  coreConfig.types.immutableProofComponent.push({
650
805
  type: ImmutableProofComponentType.Service,
651
806
  options: {
652
807
  config: {
653
- verificationMethodId: envVars.immutableProofVerificationMethodId ?? IMMUTABLE_PROOF_VERIFICATION_METHOD_ID
808
+ verificationMethodId: envVars.immutableProofVerificationMethodId
654
809
  }
655
810
  }
656
811
  });
@@ -660,6 +815,7 @@ async function configureVerifiableStorage(coreConfig, envVars) {
660
815
  * Configures the identity.
661
816
  * @param coreConfig The core config.
662
817
  * @param envVars The environment variables.
818
+ * @returns A promise that resolves when the identity configuration has been applied.
663
819
  */
664
820
  async function configureIdentity(coreConfig, envVars) {
665
821
  coreConfig.types.identityConnector ??= [];
@@ -673,7 +829,13 @@ async function configureIdentity(coreConfig, envVars) {
673
829
  coreConfig.types.identityConnector.push({
674
830
  type: IdentityConnectorType.Iota,
675
831
  options: {
676
- config: dltConfig?.options?.config ?? {}
832
+ config: {
833
+ ...(dltConfig?.options?.config ?? {}),
834
+ identityPkgId: Is.stringValue(envVars.iotaIdentityPackageId)
835
+ ? envVars.iotaIdentityPackageId
836
+ : undefined,
837
+ walletAddressIndex: Coerce.integer(envVars.identityWalletAddressIndex) ?? 0
838
+ }
677
839
  }
678
840
  });
679
841
  }
@@ -686,6 +848,7 @@ async function configureIdentity(coreConfig, envVars) {
686
848
  * Configures the identity resolver.
687
849
  * @param coreConfig The core config.
688
850
  * @param envVars The environment variables.
851
+ * @returns A promise that resolves when the identity resolver configuration has been applied.
689
852
  */
690
853
  async function configureIdentityResolver(coreConfig, envVars) {
691
854
  coreConfig.types.identityResolverConnector ??= [];
@@ -699,7 +862,12 @@ async function configureIdentityResolver(coreConfig, envVars) {
699
862
  coreConfig.types.identityResolverConnector.push({
700
863
  type: IdentityResolverConnectorType.Iota,
701
864
  options: {
702
- config: dltConfig?.options?.config ?? {}
865
+ config: {
866
+ ...dltConfig?.options?.config,
867
+ identityPkgId: Is.stringValue(envVars.iotaIdentityPackageId)
868
+ ? envVars.iotaIdentityPackageId
869
+ : undefined
870
+ }
703
871
  }
704
872
  });
705
873
  }
@@ -724,6 +892,7 @@ async function configureIdentityResolver(coreConfig, envVars) {
724
892
  * Configures the identity profile.
725
893
  * @param coreConfig The core config.
726
894
  * @param envVars The environment variables.
895
+ * @returns A promise that resolves when the identity profile configuration has been applied.
727
896
  */
728
897
  async function configureIdentityProfile(coreConfig, envVars) {
729
898
  coreConfig.types.identityProfileConnector ??= [];
@@ -741,6 +910,7 @@ async function configureIdentityProfile(coreConfig, envVars) {
741
910
  * Configures the attestation.
742
911
  * @param coreConfig The core config.
743
912
  * @param envVars The environment variables.
913
+ * @returns A promise that resolves when the attestation configuration has been applied.
744
914
  */
745
915
  async function configureAttestation(coreConfig, envVars) {
746
916
  coreConfig.types.attestationConnector ??= [];
@@ -755,7 +925,7 @@ async function configureAttestation(coreConfig, envVars) {
755
925
  type: AttestationComponentType.Service,
756
926
  options: {
757
927
  config: {
758
- verificationMethodId: envVars.attestationVerificationMethodId ?? ATTESTATION_VERIFICATION_METHOD_ID
928
+ verificationMethodId: envVars.attestationVerificationMethodId
759
929
  }
760
930
  }
761
931
  });
@@ -765,12 +935,18 @@ async function configureAttestation(coreConfig, envVars) {
765
935
  * Configures the auditable item graph.
766
936
  * @param coreConfig The core config.
767
937
  * @param envVars The environment variables.
938
+ * @returns A promise that resolves when the auditable item graph configuration has been applied.
768
939
  */
769
940
  async function configureAuditableItemGraph(coreConfig, envVars) {
770
941
  if (Coerce.boolean(envVars.auditableItemGraphEnabled) ?? false) {
771
942
  coreConfig.types.auditableItemGraphComponent ??= [];
772
943
  coreConfig.types.auditableItemGraphComponent.push({
773
- type: AuditableItemGraphComponentType.Service
944
+ type: AuditableItemGraphComponentType.Service,
945
+ options: {
946
+ config: {
947
+ mutexTimeoutMs: Coerce.integer(envVars.auditableItemGraphMutexTimeout)
948
+ }
949
+ }
774
950
  });
775
951
  }
776
952
  }
@@ -778,12 +954,18 @@ async function configureAuditableItemGraph(coreConfig, envVars) {
778
954
  * Configures the auditable item stream.
779
955
  * @param coreConfig The core config.
780
956
  * @param envVars The environment variables.
957
+ * @returns A promise that resolves when the auditable item stream configuration has been applied.
781
958
  */
782
959
  async function configureAuditableItemStream(coreConfig, envVars) {
783
960
  if (Coerce.boolean(envVars.auditableItemStreamEnabled) ?? false) {
784
961
  coreConfig.types.auditableItemStreamComponent ??= [];
785
962
  coreConfig.types.auditableItemStreamComponent.push({
786
- type: AuditableItemStreamComponentType.Service
963
+ type: AuditableItemStreamComponentType.Service,
964
+ options: {
965
+ config: {
966
+ mutexTimeoutMs: Coerce.integer(envVars.auditableItemStreamMutexTimeout)
967
+ }
968
+ }
787
969
  });
788
970
  }
789
971
  }
@@ -791,6 +973,7 @@ async function configureAuditableItemStream(coreConfig, envVars) {
791
973
  * Configures the data processing.
792
974
  * @param coreConfig The core config.
793
975
  * @param envVars The environment variables.
976
+ * @returns A promise that resolves when the data processing configuration has been applied.
794
977
  */
795
978
  async function configureDataProcessing(coreConfig, envVars) {
796
979
  if (Coerce.boolean(envVars.dataProcessingEnabled) ?? false) {
@@ -816,32 +999,18 @@ async function configureDataProcessing(coreConfig, envVars) {
816
999
  * Configures the document management.
817
1000
  * @param coreConfig The core config.
818
1001
  * @param envVars The environment variables.
1002
+ * @returns A promise that resolves when the document management configuration has been applied.
819
1003
  */
820
1004
  async function configureDocumentManagement(coreConfig, envVars) {
821
1005
  if (Coerce.boolean(envVars.documentManagementEnabled) ?? false) {
822
1006
  coreConfig.types.documentManagementComponent ??= [];
823
1007
  coreConfig.types.documentManagementComponent.push({
824
- type: DocumentManagementComponentType.Service
825
- });
826
- }
827
- }
828
- /**
829
- * Configures the verifiable credential authentication.
830
- * @param coreConfig The core config.
831
- * @param envVars The environment variables.
832
- */
833
- async function configureVerifiableCredentialAuthentication(coreConfig, envVars) {
834
- if (Coerce.boolean(envVars.vcAuthenticationEnabled) ?? false) {
835
- // Can only perform VC authentication if identity component is available
836
- coreConfig.types.authenticationGeneratorComponent ??= [];
837
- coreConfig.types.authenticationGeneratorComponent.push({
838
- type: AuthenticationGeneratorComponentType.VerifiableCredential,
1008
+ type: DocumentManagementComponentType.Service,
839
1009
  options: {
840
1010
  config: {
841
- verificationMethodId: envVars.vcAuthenticationVerificationMethodId ?? VC_AUTHENTICATION_VERIFICATION_METHOD_ID
1011
+ mutexTimeoutMs: Coerce.integer(envVars.documentManagementMutexTimeout)
842
1012
  }
843
- },
844
- features: ["verifiable-credential"]
1013
+ }
845
1014
  });
846
1015
  }
847
1016
  }
@@ -849,9 +1018,10 @@ async function configureVerifiableCredentialAuthentication(coreConfig, envVars)
849
1018
  * Configures the trust components.
850
1019
  * @param coreConfig The core config.
851
1020
  * @param envVars The environment variables.
1021
+ * @returns A promise that resolves when the trust configuration has been applied.
852
1022
  */
853
1023
  async function configureTrust(coreConfig, envVars) {
854
- if (Coerce.boolean(envVars.trustEnabled) ?? false) {
1024
+ if (isTrustRequired(envVars)) {
855
1025
  coreConfig.types.trustComponent ??= [];
856
1026
  coreConfig.types.trustComponent.push({
857
1027
  type: TrustComponentType.Service
@@ -863,7 +1033,8 @@ async function configureTrust(coreConfig, envVars) {
863
1033
  type: trustGeneratorType,
864
1034
  options: {
865
1035
  config: {
866
- verificationMethodId: envVars.trustVerificationMethodId ?? VC_AUTHENTICATION_VERIFICATION_METHOD_ID
1036
+ verificationMethodId: envVars.trustVerificationMethodId ?? "",
1037
+ tokenTtlInSeconds: Coerce.integer(envVars.trustJwtTtl)
867
1038
  }
868
1039
  }
869
1040
  });
@@ -871,9 +1042,23 @@ async function configureTrust(coreConfig, envVars) {
871
1042
  coreConfig.types.trustVerifierComponent ??= [];
872
1043
  const trustVerifierTypes = commaSeparatedListToArray(envVars.trustVerifiers);
873
1044
  for (const trustVerifierType of trustVerifierTypes) {
874
- coreConfig.types.trustVerifierComponent.push({
875
- type: trustVerifierType
876
- });
1045
+ const type = trustVerifierType;
1046
+ if (type === TrustVerifierComponentType.IdentityAllowDeny) {
1047
+ coreConfig.types.trustVerifierComponent.push({
1048
+ type,
1049
+ options: {
1050
+ config: {
1051
+ allowIdentities: commaSeparatedListToArray(envVars.trustIdentitiesAllow),
1052
+ denyIdentities: commaSeparatedListToArray(envVars.trustIdentitiesDeny)
1053
+ }
1054
+ }
1055
+ });
1056
+ }
1057
+ else {
1058
+ coreConfig.types.trustVerifierComponent.push({
1059
+ type
1060
+ });
1061
+ }
877
1062
  }
878
1063
  }
879
1064
  }
@@ -881,9 +1066,10 @@ async function configureTrust(coreConfig, envVars) {
881
1066
  * Configures the rights management.
882
1067
  * @param coreConfig The core config.
883
1068
  * @param envVars The environment variables.
1069
+ * @returns A promise that resolves when the rights management configuration has been applied.
884
1070
  */
885
1071
  async function configureRightsManagement(coreConfig, envVars) {
886
- if (Coerce.boolean(envVars.rightsManagementEnabled) ?? false) {
1072
+ if (isRightsManagementRequired(envVars)) {
887
1073
  coreConfig.types.rightsManagementPapComponent ??= [];
888
1074
  coreConfig.types.rightsManagementPapComponent.push({
889
1075
  type: RightsManagementPapComponentType.Service
@@ -909,39 +1095,44 @@ async function configureRightsManagement(coreConfig, envVars) {
909
1095
  type: RightsManagementPepComponentType.Service
910
1096
  });
911
1097
  coreConfig.types.rightsManagementPnpComponent ??= [];
1098
+ // Single source of truth for the rights-management mount path.
1099
+ const rightsManagementPath = envVars.rightsManagementCallbackPath ?? "rights-management";
1100
+ // We add a multi instance REST client for the remote negotiations
1101
+ // use a dummy endpoint for now as the actual endpoint will be provided in the config
1102
+ // of the policy negotiator when it is used for remote negotiations
1103
+ // We must add it before the service as the service needs to be able to request
1104
+ // the REST client type from the engine core to be able to support remote negotiations
1105
+ coreConfig.types.rightsManagementPnpComponent.push({
1106
+ type: RightsManagementPnpComponentType.RestClient,
1107
+ options: {
1108
+ // The endpoint is required in config, but as this is multi-instance
1109
+ // the actual endpoint will be provided in the config when it is constructed
1110
+ endpoint: "http://localhost",
1111
+ pathPrefix: rightsManagementPath
1112
+ },
1113
+ isMultiInstance: true,
1114
+ features: ["remote"]
1115
+ });
912
1116
  coreConfig.types.rightsManagementPnpComponent.push({
913
1117
  type: RightsManagementPnpComponentType.Service,
914
1118
  options: {
915
1119
  config: {
916
- baseCallbackUrl: envVars.rightsManagementBaseCallbackUrl ?? "",
917
- negotiationComponentCreator: async (url) => new PolicyNegotiationPointRestClient({ endpoint: url })
1120
+ callbackPath: rightsManagementPath,
1121
+ includeErrorDetails: coreConfig.debug ?? false,
1122
+ mutexTimeoutMs: Coerce.integer(envVars.rightsManagementMutexTimeout)
918
1123
  }
919
- }
1124
+ },
1125
+ isDefault: true
920
1126
  });
921
1127
  coreConfig.types.rightsManagementPnapComponent ??= [];
922
1128
  coreConfig.types.rightsManagementPnapComponent.push({
923
- type: RightsManagementPnapComponentType.Service
924
- });
925
- coreConfig.types.rightsManagementDapComponent ??= [];
926
- coreConfig.types.rightsManagementDapComponent.push({
927
- type: RightsManagementDapComponentType.Service
928
- });
929
- coreConfig.types.rightsManagementDarpComponent ??= [];
930
- coreConfig.types.rightsManagementDarpComponent.push({
931
- type: RightsManagementDarpComponentType.Service,
1129
+ type: RightsManagementPnapComponentType.Service,
932
1130
  options: {
933
1131
  config: {
934
- dataAccessComponentCreator: async (url) => new DataAccessPointRestClient({ endpoint: url })
1132
+ mutexTimeoutMs: Coerce.integer(envVars.rightsManagementMutexTimeout)
935
1133
  }
936
1134
  }
937
1135
  });
938
- coreConfig.types.rightsManagementDataAccessHandlerComponent ??= [];
939
- const dataAccessHandlerTypes = commaSeparatedListToArray(envVars.rightsManagementDataAccessHandlers);
940
- for (const dataAccessHandlerType of dataAccessHandlerTypes) {
941
- coreConfig.types.rightsManagementDataAccessHandlerComponent.push({
942
- type: dataAccessHandlerType
943
- });
944
- }
945
1136
  coreConfig.types.rightsManagementPolicyArbiterComponent ??= [];
946
1137
  const policyArbiterTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyArbiters);
947
1138
  for (const policyArbiterType of policyArbiterTypes) {
@@ -949,6 +1140,13 @@ async function configureRightsManagement(coreConfig, envVars) {
949
1140
  type: policyArbiterType
950
1141
  });
951
1142
  }
1143
+ coreConfig.types.rightsManagementPolicyObligationEnforcerComponent ??= [];
1144
+ const policyObligationEnforcerTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyObligationEnforcers);
1145
+ for (const policyObligationEnforcerType of policyObligationEnforcerTypes) {
1146
+ coreConfig.types.rightsManagementPolicyObligationEnforcerComponent.push({
1147
+ type: policyObligationEnforcerType
1148
+ });
1149
+ }
952
1150
  coreConfig.types.rightsManagementPolicyEnforcementProcessorComponent ??= [];
953
1151
  const policyEnforcementProcessTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyEnforcementProcessors);
954
1152
  for (const policyEnforcementProcessorType of policyEnforcementProcessTypes) {
@@ -990,94 +1188,105 @@ async function configureRightsManagement(coreConfig, envVars) {
990
1188
  * Configures the task scheduler.
991
1189
  * @param coreConfig The core config.
992
1190
  * @param envVars The environment variables.
1191
+ * @returns A promise that resolves when the task scheduler configuration has been applied.
993
1192
  */
994
1193
  async function configureTaskScheduler(coreConfig, envVars) {
995
- if (Coerce.boolean(envVars.taskSchedulerEnabled) ?? false) {
1194
+ if (isTaskSchedulerRequired(envVars)) {
996
1195
  coreConfig.types.taskSchedulerComponent ??= [];
997
1196
  coreConfig.types.taskSchedulerComponent.push({
998
1197
  type: TaskSchedulerComponentType.Service
999
1198
  });
1000
1199
  }
1001
1200
  }
1002
- /**
1003
- * Configures the synchronised storage.
1004
- * @param coreConfig The core config.
1005
- * @param envVars The environment variables.
1006
- */
1007
- async function configureSynchronisedStorage(coreConfig, envVars) {
1008
- if (Is.arrayValue(coreConfig.types.identityResolverComponent) &&
1009
- (Coerce.boolean(envVars.synchronisedStorageEnabled) ?? false)) {
1010
- // Check if the config provides a custom verifiable storage key id
1011
- let verifiableStorageKeyId = Coerce.string(envVars.synchronisedStorageVerifiableStorageKeyId);
1012
- if (!Is.stringValue(verifiableStorageKeyId)) {
1013
- // No custom key so default to the network setting
1014
- verifiableStorageKeyId = envVars.iotaNetwork;
1015
- }
1016
- coreConfig.types.synchronisedStorageComponent ??= [];
1017
- coreConfig.types.synchronisedStorageComponent.push({
1018
- type: SynchronisedStorageComponentType.Service,
1019
- options: {
1020
- config: {
1021
- verifiableStorageKeyId: verifiableStorageKeyId ?? "",
1022
- blobStorageEncryptionKeyId: envVars.synchronisedStorageBlobStorageEncryptionKeyId ??
1023
- SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID,
1024
- entityUpdateIntervalMinutes: Coerce.number(envVars.synchronisedStorageEntityUpdateIntervalMinutes),
1025
- consolidationIntervalMinutes: Coerce.number(envVars.synchronisedStorageConsolidationIntervalMinutes),
1026
- consolidationBatchSize: Coerce.number(envVars.synchronisedStorageConsolidationBatchSize),
1027
- maxConsolidations: Coerce.number(envVars.synchronisedStorageMaxConsolidations)
1028
- }
1029
- }
1030
- });
1031
- // If there is a trusted url set, we need to add a client
1032
- // and give it a feature of trusted so that when the synchronised
1033
- // storage is created it can pickup the correct component
1034
- if (Is.stringValue(envVars.synchronisedStorageTrustedUrl)) {
1035
- coreConfig.types.synchronisedStorageComponent.push({
1036
- type: SynchronisedStorageComponentType.RestClient,
1037
- options: {
1038
- endpoint: envVars.synchronisedStorageTrustedUrl
1039
- },
1040
- features: ["trusted"]
1041
- });
1042
- }
1043
- }
1044
- }
1045
1201
  /**
1046
1202
  * Configures the federated catalogue.
1047
1203
  * @param coreConfig The core config.
1048
1204
  * @param envVars The environment variables.
1205
+ * @returns A promise that resolves when the federated catalogue configuration has been applied.
1049
1206
  */
1050
1207
  async function configureFederatedCatalogue(coreConfig, envVars) {
1051
- if (Coerce.boolean(envVars.federatedCatalogueEnabled) ?? false) {
1208
+ if (isFederatedCatalogueRequired(envVars)) {
1052
1209
  coreConfig.types.federatedCatalogueComponent ??= [];
1053
- coreConfig.types.federatedCatalogueComponent.push({
1054
- type: FederatedCatalogueComponentType.Service,
1055
- options: {}
1056
- });
1057
- coreConfig.types.federatedCatalogueFilterComponent ??= [];
1058
- const filters = commaSeparatedListToArray(envVars.federatedCatalogueFilters);
1059
- for (const filter of filters) {
1060
- coreConfig.types.federatedCatalogueFilterComponent.push({
1061
- type: filter,
1062
- options: {}
1210
+ if (Is.stringValue(envVars.federatedCatalogueRemoteEndpoint)) {
1211
+ coreConfig.types.federatedCatalogueComponent.push({
1212
+ type: FederatedCatalogueComponentType.RestClient,
1213
+ options: {
1214
+ endpoint: envVars.federatedCatalogueRemoteEndpoint
1215
+ }
1063
1216
  });
1064
1217
  }
1218
+ else {
1219
+ coreConfig.types.federatedCatalogueComponent.push({
1220
+ type: FederatedCatalogueComponentType.Service,
1221
+ options: {
1222
+ config: {
1223
+ mutexTimeoutMs: Coerce.integer(envVars.federatedCatalogueMutexTimeout)
1224
+ }
1225
+ }
1226
+ });
1227
+ coreConfig.types.federatedCatalogueFilterComponent ??= [];
1228
+ const filters = commaSeparatedListToArray(envVars.federatedCatalogueFilters);
1229
+ for (const filter of filters) {
1230
+ coreConfig.types.federatedCatalogueFilterComponent.push({
1231
+ type: filter,
1232
+ options: {}
1233
+ });
1234
+ }
1235
+ }
1065
1236
  }
1066
1237
  }
1067
1238
  /**
1068
- * Configures the data space connector.
1239
+ * Configures the dataspace control plane and data plane.
1069
1240
  * @param coreConfig The core config.
1070
1241
  * @param envVars The environment variables.
1242
+ * @returns A promise that resolves when the dataspace configuration has been applied.
1071
1243
  */
1072
- async function configureDataSpaceConnector(coreConfig, envVars) {
1073
- if (Coerce.boolean(envVars.dataSpaceConnectorEnabled) ?? false) {
1074
- coreConfig.types.dataSpaceConnectorComponent ??= [];
1075
- coreConfig.types.dataSpaceConnectorComponent.push({
1076
- type: DataSpaceConnectorComponentType.Service,
1244
+ async function configureDataspace(coreConfig, envVars) {
1245
+ if (Coerce.boolean(envVars.dataspaceEnabled) ?? false) {
1246
+ coreConfig.types.dataspaceControlPlaneComponent ??= [];
1247
+ // We add a multi instance REST client for remote/consumer-initiated transfers.
1248
+ coreConfig.types.dataspaceControlPlaneComponent.push({
1249
+ type: DataspaceControlPlaneComponentType.RestClient,
1250
+ options: {
1251
+ endpoint: "http://localhost"
1252
+ },
1253
+ isMultiInstance: true,
1254
+ features: ["remote"]
1255
+ });
1256
+ const stalledNegotiationTimeout = Coerce.integer(envVars.dataspaceStalledNegotiationTimeout);
1257
+ const stalledTransferTimeout = Coerce.integer(envVars.dataspaceStalledTransferTimeout);
1258
+ coreConfig.types.dataspaceControlPlaneComponent.push({
1259
+ type: DataspaceControlPlaneComponentType.Service,
1077
1260
  options: {
1078
1261
  config: {
1079
- retainActivityLogsFor: Coerce.number(envVars.dataSpaceConnectorRetainActivityLogsFor),
1080
- activityLogsCleanUpInterval: Coerce.number(envVars.dataSpaceConnectorActivityLogsCleanUpInterval)
1262
+ // Must match the control-plane REST mount, as it is combined with the public origin
1263
+ // to build the consumer's advertised callback address;
1264
+ callbackPath: envVars.dataspaceCallbackPath ?? "dataspace-control-plane",
1265
+ dataPlanePath: envVars.dataspaceDataPlanePath,
1266
+ autoStartTransfers: Coerce.boolean(envVars.dataspaceAutoStartTransfers),
1267
+ stalledNegotiationTimeoutMs: !Is.empty(stalledNegotiationTimeout)
1268
+ ? stalledNegotiationTimeout * 1000
1269
+ : undefined,
1270
+ stalledTransferTimeoutMs: !Is.empty(stalledTransferTimeout)
1271
+ ? stalledTransferTimeout * 1000
1272
+ : undefined
1273
+ }
1274
+ },
1275
+ isDefault: true
1276
+ });
1277
+ const retainActivityLogsFor = Coerce.integer(envVars.dataspaceRetainActivityLogsFor);
1278
+ const activityLogsCleanUpInterval = Coerce.integer(envVars.dataspaceActivityLogsCleanupInterval);
1279
+ coreConfig.types.dataspaceDataPlaneComponent ??= [];
1280
+ coreConfig.types.dataspaceDataPlaneComponent.push({
1281
+ type: DataspaceDataPlaneComponentType.Service,
1282
+ options: {
1283
+ config: {
1284
+ retainActivityLogsForMs: !Is.empty(retainActivityLogsFor)
1285
+ ? retainActivityLogsFor * 1000
1286
+ : undefined,
1287
+ activityLogsCleanUpIntervalMs: !Is.empty(activityLogsCleanUpInterval)
1288
+ ? activityLogsCleanUpInterval * 1000
1289
+ : undefined
1081
1290
  }
1082
1291
  }
1083
1292
  });
@@ -1087,6 +1296,7 @@ async function configureDataSpaceConnector(coreConfig, envVars) {
1087
1296
  * Configures the DLT.
1088
1297
  * @param coreConfig The core config.
1089
1298
  * @param envVars The environment variables.
1299
+ * @returns A promise that resolves when the DLT configuration has been applied.
1090
1300
  */
1091
1301
  async function configureDlt(coreConfig, envVars) {
1092
1302
  // Create centralized DLT configuration for IOTA if essential IOTA variables are set
@@ -1108,7 +1318,7 @@ async function configureDlt(coreConfig, envVars) {
1108
1318
  url: envVars.iotaNodeEndpoint ?? ""
1109
1319
  },
1110
1320
  network: envVars.iotaNetwork ?? "",
1111
- coinType: Coerce.number(envVars.iotaCoinType),
1321
+ coinType: Coerce.integer(envVars.iotaCoinType),
1112
1322
  gasStation: gasStationConfig
1113
1323
  }
1114
1324
  }
@@ -1126,4 +1336,90 @@ function commaSeparatedListToArray(value) {
1126
1336
  .map(item => item.trim())
1127
1337
  .filter(item => item.length > 0);
1128
1338
  }
1339
+ /**
1340
+ * Checks if the trust subsystem is required.
1341
+ * Returns true when any component that depends on the trust subsystem is enabled.
1342
+ * @param envVars The environment variables.
1343
+ * @returns True if rights-management, or dataspace is enabled.
1344
+ */
1345
+ export function isTrustRequired(envVars) {
1346
+ return (isRightsManagementRequired(envVars) ||
1347
+ (Coerce.boolean(envVars.dataspaceEnabled) ?? false) ||
1348
+ isFederatedCatalogueRequired(envVars));
1349
+ }
1350
+ /**
1351
+ * Checks if the background tasks subsystem is required.
1352
+ * Returns true when any component that depends on the background tasks subsystem is enabled.
1353
+ * @param envVars The environment variables.
1354
+ * @returns True if dataspace or verifiable storage is enabled.
1355
+ */
1356
+ export function isBackgroundTasksRequired(envVars) {
1357
+ return (Coerce.boolean(envVars.dataspaceEnabled) ?? false) || isImmutableProofRequired(envVars);
1358
+ }
1359
+ /**
1360
+ * Checks if the immutable proof subsystem is required.
1361
+ * Returns true when any component that depends on the immutable proof subsystem is enabled.
1362
+ * @param envVars The environment variables.
1363
+ * @returns True if verifiable storage is enabled.
1364
+ */
1365
+ export function isImmutableProofRequired(envVars) {
1366
+ return ((Coerce.boolean(envVars.auditableItemGraphEnabled) ?? false) ||
1367
+ (Coerce.boolean(envVars.auditableItemStreamEnabled) ?? false) ||
1368
+ (Coerce.boolean(envVars.documentManagementEnabled) ?? false));
1369
+ }
1370
+ /**
1371
+ * Checks if the federated catalogue subsystem is required.
1372
+ * Returns true when the catalogue is explicitly enabled, a remote endpoint is configured, filters are set, or dataspace is enabled.
1373
+ * @param envVars The environment variables.
1374
+ * @returns True if the federated catalogue is required.
1375
+ */
1376
+ export function isFederatedCatalogueRequired(envVars) {
1377
+ return ((Coerce.boolean(envVars.federatedCatalogueEnabled) ?? false) ||
1378
+ Is.stringValue(envVars.federatedCatalogueRemoteEndpoint) ||
1379
+ Is.stringValue(envVars.federatedCatalogueFilters) ||
1380
+ (Coerce.boolean(envVars.dataspaceEnabled) ?? false));
1381
+ }
1382
+ /**
1383
+ * Checks if the rights management subsystem is required.
1384
+ * Returns true when any component that depends on the rights management subsystem is enabled.
1385
+ * Note: rights management has no standalone enable flag - it is gated entirely on
1386
+ * `dataspaceEnabled`. Setting `TWIN_RIGHTS_MANAGEMENT_*` env var in isolation does not
1387
+ * enable the subsystem; `TWIN_DATASPACE_ENABLED` must also be true.
1388
+ * @param envVars The environment variables.
1389
+ * @returns True if rights management is enabled.
1390
+ */
1391
+ export function isRightsManagementRequired(envVars) {
1392
+ return Coerce.boolean(envVars.dataspaceEnabled) ?? false;
1393
+ }
1394
+ /**
1395
+ * Checks if the task scheduler subsystem is required.
1396
+ * Returns true when any component that depends on the task scheduler subsystem is enabled.
1397
+ * @param envVars The environment variables.
1398
+ * @returns True if task scheduler is enabled.
1399
+ */
1400
+ export function isTaskSchedulerRequired(envVars) {
1401
+ return ((Coerce.boolean(envVars.taskSchedulerEnabled) ?? false) ||
1402
+ (Coerce.boolean(envVars.dataspaceEnabled) ?? false) ||
1403
+ isRightsManagementRequired(envVars) ||
1404
+ isAuthEntityStorageRequired(envVars));
1405
+ }
1406
+ /**
1407
+ * Checks if the automation subsystem is required.
1408
+ * Returns true when any component that depends on the automation subsystem is enabled.
1409
+ * @param envVars The environment variables.
1410
+ * @returns True if automation is enabled.
1411
+ */
1412
+ export function isAutomationRequired(envVars) {
1413
+ return isRightsManagementRequired(envVars);
1414
+ }
1415
+ /**
1416
+ * Checks if the telemetry subsystem is required.
1417
+ * Returns true when any component that depends on the telemetry subsystem is enabled.
1418
+ * @param envVars The environment variables.
1419
+ * @returns True if telemetry is enabled.
1420
+ */
1421
+ export function isTelemetryRequired(envVars) {
1422
+ return (envVars.telemetryConnector === TelemetryConnectorType.EntityStorage ||
1423
+ envVars.telemetryConnector === TelemetryConnectorType.OpenTelemetry);
1424
+ }
1129
1425
  //# sourceMappingURL=engineEnvBuilder.js.map