@twin.org/node-core 0.0.3-next.6 → 0.0.3-next.61

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 (206) hide show
  1. package/README.md +3 -1
  2. package/dist/es/builders/engineEnvBuilder.js +538 -213
  3. package/dist/es/builders/engineEnvBuilder.js.map +1 -1
  4. package/dist/es/builders/engineServerEnvBuilder.js +86 -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 +311 -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 +230 -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 +11 -4
  49. package/dist/es/index.js.map +1 -1
  50. package/dist/es/models/ICliArgs.js +4 -0
  51. package/dist/es/models/ICliArgs.js.map +1 -0
  52. package/dist/es/models/ICliCommand.js +2 -0
  53. package/dist/es/models/ICliCommand.js.map +1 -0
  54. package/dist/es/models/ICliCommandDefinition.js +2 -0
  55. package/dist/es/models/ICliCommandDefinition.js.map +1 -0
  56. package/dist/es/models/ICliCommandDefinitionParam.js +2 -0
  57. package/dist/es/models/ICliCommandDefinitionParam.js.map +1 -0
  58. package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -1
  59. package/dist/es/models/IEngineServerEnvironmentVariables.js.map +1 -1
  60. package/dist/es/models/INodeEngineState.js.map +1 -1
  61. package/dist/es/models/INodeEnvironmentVariables.js.map +1 -1
  62. package/dist/es/models/INodeOptions.js.map +1 -1
  63. package/dist/es/models/cliCommandParamType.js +4 -0
  64. package/dist/es/models/cliCommandParamType.js.map +1 -0
  65. package/dist/es/models/nodeExtensionInitialiseEngineMethod.js +2 -0
  66. package/dist/es/models/nodeExtensionInitialiseEngineMethod.js.map +1 -0
  67. package/dist/es/models/nodeExtensionInitialiseEngineServerMethod.js +2 -0
  68. package/dist/es/models/nodeExtensionInitialiseEngineServerMethod.js.map +1 -0
  69. package/dist/es/models/nodeExtensionInitialiseMethod.js +2 -0
  70. package/dist/es/models/nodeExtensionInitialiseMethod.js.map +1 -0
  71. package/dist/es/models/nodeExtensionShutdownMethod.js +4 -0
  72. package/dist/es/models/nodeExtensionShutdownMethod.js.map +1 -0
  73. package/dist/es/node.js +87 -40
  74. package/dist/es/node.js.map +1 -1
  75. package/dist/es/start.js +189 -0
  76. package/dist/es/start.js.map +1 -0
  77. package/dist/es/utils.js +24 -27
  78. package/dist/es/utils.js.map +1 -1
  79. package/dist/types/builders/engineEnvBuilder.d.ts +60 -5
  80. package/dist/types/builders/engineServerEnvBuilder.d.ts +11 -2
  81. package/dist/types/builders/extensionsBuilder.d.ts +3 -3
  82. package/dist/types/cli.d.ts +56 -0
  83. package/dist/types/commands/bootstrapLegacy.d.ts +67 -0
  84. package/dist/types/commands/help.d.ts +24 -0
  85. package/dist/types/commands/identityCreate.d.ts +45 -0
  86. package/dist/types/commands/identityImports.d.ts +25 -0
  87. package/dist/types/commands/identityVerifiableCredentialCreate.d.ts +43 -0
  88. package/dist/types/commands/identityVerificationMethodCreate.d.ts +47 -0
  89. package/dist/types/commands/identityVerificationMethodImport.d.ts +32 -0
  90. package/dist/types/commands/nodeSetIdentity.d.ts +23 -0
  91. package/dist/types/commands/removeTenantOrgAlias.d.ts +24 -0
  92. package/dist/types/commands/setNodeOrgId.d.ts +24 -0
  93. package/dist/types/commands/setTenantOrgId.d.ts +38 -0
  94. package/dist/types/commands/tenantCreate.d.ts +41 -0
  95. package/dist/types/commands/tenantImport.d.ts +29 -0
  96. package/dist/types/commands/tenantUpdate.d.ts +29 -0
  97. package/dist/types/commands/userCreate.d.ts +51 -0
  98. package/dist/types/commands/userUpdate.d.ts +40 -0
  99. package/dist/types/commands/vaultKeyCreate.d.ts +43 -0
  100. package/dist/types/commands/vaultKeyImport.d.ts +29 -0
  101. package/dist/types/defaults.d.ts +30 -2
  102. package/dist/types/index.d.ts +11 -4
  103. package/dist/types/models/ICliArgs.d.ts +20 -0
  104. package/dist/types/models/ICliCommand.d.ts +17 -0
  105. package/dist/types/models/ICliCommandDefinition.d.ts +46 -0
  106. package/dist/types/models/ICliCommandDefinitionParam.d.ts +35 -0
  107. package/dist/types/models/IEngineEnvironmentVariables.d.ts +168 -95
  108. package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +8 -0
  109. package/dist/types/models/INodeEngineState.d.ts +2 -9
  110. package/dist/types/models/INodeEnvironmentVariables.d.ts +0 -38
  111. package/dist/types/models/INodeOptions.d.ts +6 -2
  112. package/dist/types/models/cliCommandParamType.d.ts +4 -0
  113. package/dist/types/models/nodeExtensionInitialiseEngineMethod.d.ts +8 -0
  114. package/dist/types/models/nodeExtensionInitialiseEngineServerMethod.d.ts +9 -0
  115. package/dist/types/models/nodeExtensionInitialiseMethod.d.ts +9 -0
  116. package/dist/types/models/nodeExtensionShutdownMethod.d.ts +6 -0
  117. package/dist/types/node.d.ts +5 -4
  118. package/dist/types/{server.d.ts → start.d.ts} +4 -2
  119. package/dist/types/utils.d.ts +9 -10
  120. package/docs/changelog.md +682 -180
  121. package/docs/examples.md +99 -1
  122. package/docs/reference/functions/buildConfiguration.md +1 -1
  123. package/docs/reference/functions/buildEngineConfiguration.md +1 -7
  124. package/docs/reference/functions/buildEngineServerConfiguration.md +1 -1
  125. package/docs/reference/functions/constructCliCommand.md +27 -0
  126. package/docs/reference/functions/executeCommand.md +29 -0
  127. package/docs/reference/functions/extensionsInitialiseEngine.md +1 -1
  128. package/docs/reference/functions/extensionsInitialiseEngineServer.md +1 -1
  129. package/docs/reference/functions/getEnvDefaults.md +19 -0
  130. package/docs/reference/functions/getScriptDirectory.md +19 -0
  131. package/docs/reference/functions/initialiseLocales.md +2 -0
  132. package/docs/reference/functions/isAuthEntityStorageRequired.md +20 -0
  133. package/docs/reference/functions/isAutomationRequired.md +20 -0
  134. package/docs/reference/functions/isBackgroundTasksRequired.md +20 -0
  135. package/docs/reference/functions/isFederatedCatalogueRequired.md +20 -0
  136. package/docs/reference/functions/isImmutableProofRequired.md +20 -0
  137. package/docs/reference/functions/isRightsManagementRequired.md +23 -0
  138. package/docs/reference/functions/isTaskSchedulerRequired.md +20 -0
  139. package/docs/reference/functions/isTelemetryRequired.md +20 -0
  140. package/docs/reference/functions/isTrustRequired.md +20 -0
  141. package/docs/reference/functions/loadJsonFile.md +1 -1
  142. package/docs/reference/functions/loadTextFile.md +1 -1
  143. package/docs/reference/functions/parseCommandLineArgs.md +19 -0
  144. package/docs/reference/functions/processEnvOptions.md +27 -0
  145. package/docs/reference/functions/registerCommands.md +9 -0
  146. package/docs/reference/functions/resolvePackageEntryPoint.md +2 -2
  147. package/docs/reference/functions/run.md +8 -2
  148. package/docs/reference/functions/shutdownExtensions.md +1 -1
  149. package/docs/reference/functions/start.md +9 -3
  150. package/docs/reference/functions/substituteEnvOptions.md +25 -0
  151. package/docs/reference/index.md +24 -14
  152. package/docs/reference/interfaces/ICacheMetadata.md +3 -3
  153. package/docs/reference/interfaces/ICliArgs.md +35 -0
  154. package/docs/reference/interfaces/ICliCommand.md +23 -0
  155. package/docs/reference/interfaces/ICliCommandDefinition.md +101 -0
  156. package/docs/reference/interfaces/ICliCommandDefinitionParam.md +65 -0
  157. package/docs/reference/interfaces/IEngineEnvironmentVariables.md +488 -359
  158. package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +652 -431
  159. package/docs/reference/interfaces/IModuleProtocol.md +3 -3
  160. package/docs/reference/interfaces/INodeEngineState.md +6 -21
  161. package/docs/reference/interfaces/INodeEnvironmentVariables.md +661 -516
  162. package/docs/reference/interfaces/INodeOptions.md +44 -36
  163. package/docs/reference/interfaces/IProtocolHandlerResult.md +2 -2
  164. package/docs/reference/type-aliases/CliCommandParamType.md +5 -0
  165. package/docs/reference/type-aliases/NodeExtensionInitialiseEngineMethod.md +3 -1
  166. package/docs/reference/type-aliases/NodeExtensionInitialiseEngineServerMethod.md +3 -1
  167. package/docs/reference/type-aliases/NodeExtensionInitialiseMethod.md +3 -1
  168. package/docs/reference/type-aliases/NodeExtensionShutdownMethod.md +3 -1
  169. package/docs/reference/variables/ATTESTATION_VERIFICATION_METHOD_ID.md +2 -0
  170. package/docs/reference/variables/AUTH_SIGNING_KEY_ID.md +2 -0
  171. package/docs/reference/variables/BLOB_STORAGE_ENCRYPTION_KEY_ID.md +2 -0
  172. package/docs/reference/variables/CONTEXT_ID_HANDLER_FEATURE_DID.md +2 -0
  173. package/docs/reference/variables/CONTEXT_ID_HANDLER_FEATURE_TENANT.md +2 -0
  174. package/docs/reference/variables/IMMUTABLE_PROOF_VERIFICATION_METHOD_ID.md +2 -0
  175. package/docs/reference/variables/ModuleProtocol.md +5 -5
  176. package/docs/reference/variables/TRUST_VERIFICATION_METHOD_ID.md +5 -0
  177. package/locales/en.json +674 -30
  178. package/package.json +10 -6
  179. package/dist/es/bootstrap.js +0 -366
  180. package/dist/es/bootstrap.js.map +0 -1
  181. package/dist/es/identity.js +0 -182
  182. package/dist/es/identity.js.map +0 -1
  183. package/dist/es/models/nodeExtensionMethods.js +0 -2
  184. package/dist/es/models/nodeExtensionMethods.js.map +0 -1
  185. package/dist/es/models/nodeFeatures.js +0 -21
  186. package/dist/es/models/nodeFeatures.js.map +0 -1
  187. package/dist/es/server.js +0 -81
  188. package/dist/es/server.js.map +0 -1
  189. package/dist/types/bootstrap.d.ts +0 -68
  190. package/dist/types/identity.d.ts +0 -14
  191. package/dist/types/models/nodeExtensionMethods.d.ts +0 -27
  192. package/dist/types/models/nodeFeatures.d.ts +0 -21
  193. package/docs/detailed-guide.md +0 -129
  194. package/docs/reference/functions/bootstrap.md +0 -29
  195. package/docs/reference/functions/bootstrapAuth.md +0 -35
  196. package/docs/reference/functions/bootstrapBlobEncryption.md +0 -35
  197. package/docs/reference/functions/bootstrapImmutableProofMethod.md +0 -35
  198. package/docs/reference/functions/bootstrapNodeAdminUser.md +0 -35
  199. package/docs/reference/functions/bootstrapNodeId.md +0 -35
  200. package/docs/reference/functions/bootstrapSynchronisedStorage.md +0 -35
  201. package/docs/reference/functions/bootstrapTenantId.md +0 -35
  202. package/docs/reference/functions/getFeatures.md +0 -19
  203. package/docs/reference/type-aliases/NodeFeatures.md +0 -5
  204. package/docs/reference/variables/NodeFeatures.md +0 -25
  205. package/docs/reference/variables/SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID.md +0 -3
  206. 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, DataConverterConnectorType, DataExtractorConnectorType, DataProcessingComponentType, DataSpaceConnectorComponentType, DltConfigType, DocumentManagementComponentType, EngineTypeHelper, EntityStorageConnectorType, EventBusComponentType, EventBusConnectorType, FaucetConnectorType, FederatedCatalogueComponentType, FederatedCatalogueFilterComponentType, 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";
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,32 +56,40 @@ 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);
59
+ await configureTrust(coreConfig, envVars);
49
60
  await configureRightsManagement(coreConfig, envVars);
50
- await configureSynchronisedStorage(coreConfig, envVars);
51
61
  await configureFederatedCatalogue(coreConfig, envVars);
52
- await configureDataSpaceConnector(coreConfig, envVars);
62
+ await configureDataspace(coreConfig, envVars);
53
63
  return coreConfig;
54
64
  }
55
65
  /**
56
66
  * Configures the entity storage.
57
67
  * @param coreConfig The core config.
58
68
  * @param envVars The environment variables.
69
+ * @returns A promise that resolves when the entity storage configuration has been applied.
59
70
  */
60
71
  async function configureEntityStorage(coreConfig, envVars) {
61
72
  coreConfig.types ??= {};
62
73
  coreConfig.types.entityStorageConnector ??= [];
63
- const entityStorageConnectorTypes = envVars.entityStorageConnectorType?.split(",") ?? [];
74
+ const entityStorageConnectorTypes = commaSeparatedListToArray(envVars.entityStorageConnectorType);
64
75
  if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.Memory)) {
65
76
  coreConfig.types.entityStorageConnector.push({
66
- type: EntityStorageConnectorType.Memory
77
+ type: EntityStorageConnectorType.Memory,
78
+ options: {
79
+ config: {
80
+ mutexTimeoutMs: Coerce.integer(envVars.entityStorageMemoryMutexTimeoutMs)
81
+ }
82
+ }
67
83
  });
68
84
  }
69
85
  if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.File)) {
70
86
  coreConfig.types.entityStorageConnector.push({
71
87
  type: EntityStorageConnectorType.File,
72
88
  options: {
73
- config: { directory: envVars.storageFileRoot ?? "" },
89
+ config: {
90
+ directory: envVars.storageFileRoot ?? "",
91
+ mutexTimeoutMs: Coerce.integer(envVars.entityStorageFileMutexTimeoutMs)
92
+ },
74
93
  folderPrefix: envVars.entityStorageTablePrefix
75
94
  }
76
95
  });
@@ -114,7 +133,7 @@ async function configureEntityStorage(coreConfig, envVars) {
114
133
  credentials: envVars.gcpFirestoreCredentials ?? "",
115
134
  databaseId: envVars.gcpFirestoreDatabaseId ?? "",
116
135
  collectionName: envVars.gcpFirestoreCollectionName ?? "",
117
- endpoint: envVars.gcpFirestoreApiEndpoint ?? ""
136
+ endpoint: envVars.gcpFirestoreEndpoint ?? ""
118
137
  },
119
138
  tablePrefix: envVars.entityStorageTablePrefix
120
139
  }
@@ -125,7 +144,7 @@ async function configureEntityStorage(coreConfig, envVars) {
125
144
  type: EntityStorageConnectorType.ScyllaDb,
126
145
  options: {
127
146
  config: {
128
- hosts: envVars.scylladbHosts?.split(",") ?? [],
147
+ hosts: commaSeparatedListToArray(envVars.scylladbHosts),
129
148
  localDataCenter: envVars.scylladbLocalDataCenter ?? "",
130
149
  keyspace: envVars.scylladbKeyspace ?? "",
131
150
  port: Coerce.integer(envVars.scylladbPort)
@@ -180,15 +199,6 @@ async function configureEntityStorage(coreConfig, envVars) {
180
199
  });
181
200
  }
182
201
  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
202
  if (Is.arrayValue(entityStorageConnectorTypes)) {
193
203
  for (const config of coreConfig.types.entityStorageConnector) {
194
204
  if (config.type === defaultEntityStorageConnectorType) {
@@ -202,10 +212,11 @@ async function configureEntityStorage(coreConfig, envVars) {
202
212
  * Configures the blob storage.
203
213
  * @param coreConfig The core config.
204
214
  * @param envVars The environment variables.
215
+ * @returns A promise that resolves when the blob storage configuration has been applied.
205
216
  */
206
217
  async function configureBlobStorage(coreConfig, envVars) {
207
218
  coreConfig.types.blobStorageConnector ??= [];
208
- const blobStorageConnectorTypes = envVars.blobStorageConnectorType?.split(",") ?? [];
219
+ const blobStorageConnectorTypes = commaSeparatedListToArray(envVars.blobStorageConnectorType);
209
220
  if (blobStorageConnectorTypes.includes(BlobStorageConnectorType.Memory)) {
210
221
  coreConfig.types.blobStorageConnector.push({
211
222
  type: BlobStorageConnectorType.Memory
@@ -273,7 +284,7 @@ async function configureBlobStorage(coreConfig, envVars) {
273
284
  projectId: envVars.gcpStorageProjectId ?? "",
274
285
  credentials: envVars.gcpStorageCredentials ?? "",
275
286
  bucketName: envVars.gcpStorageBucketName ?? "",
276
- apiEndpoint: envVars.gcpFirestoreApiEndpoint
287
+ apiEndpoint: envVars.gcpFirestoreEndpoint
277
288
  },
278
289
  storagePrefix: envVars.blobStoragePrefix
279
290
  }
@@ -285,14 +296,6 @@ async function configureBlobStorage(coreConfig, envVars) {
285
296
  if (config.type === defaultStorageConnectorType) {
286
297
  config.isDefault = true;
287
298
  }
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
299
  }
297
300
  }
298
301
  if (coreConfig.types.blobStorageConnector.length > 0) {
@@ -302,7 +305,7 @@ async function configureBlobStorage(coreConfig, envVars) {
302
305
  options: {
303
306
  config: {
304
307
  vaultKeyId: (envVars.blobStorageEnableEncryption ?? false)
305
- ? (envVars.blobStorageEncryptionKeyId ?? BLOB_STORAGE_ENCRYPTION_KEY_ID)
308
+ ? envVars.blobStorageEncryptionKeyId
306
309
  : undefined
307
310
  }
308
311
  }
@@ -313,10 +316,11 @@ async function configureBlobStorage(coreConfig, envVars) {
313
316
  * Configures the logging.
314
317
  * @param coreConfig The core config.
315
318
  * @param envVars The environment variables.
319
+ * @returns A promise that resolves when the logging configuration has been applied.
316
320
  */
317
321
  async function configureLogging(coreConfig, envVars) {
318
322
  coreConfig.types.loggingConnector ??= [];
319
- const loggingConnectorTypes = (envVars.loggingConnector ?? "").split(",");
323
+ const loggingConnectorTypes = commaSeparatedListToArray(envVars.loggingConnector);
320
324
  let additionalConnectorCount = 0;
321
325
  for (const loggingConnector of loggingConnectorTypes) {
322
326
  if (loggingConnector === LoggingConnectorType.Console) {
@@ -333,7 +337,14 @@ async function configureLogging(coreConfig, envVars) {
333
337
  }
334
338
  else if (loggingConnector === LoggingConnectorType.EntityStorage) {
335
339
  coreConfig.types.loggingConnector.push({
336
- type: LoggingConnectorType.EntityStorage
340
+ type: LoggingConnectorType.EntityStorage,
341
+ options: {
342
+ config: {
343
+ batchSize: Coerce.integer(envVars.loggingBatchSize),
344
+ batchIntervalMs: (Coerce.integer(envVars.loggingBatchFlushIntervalSeconds) ?? 5) * 1000,
345
+ mutexTimeoutMs: Coerce.integer(envVars.loggingMutexTimeoutMs)
346
+ }
347
+ }
337
348
  });
338
349
  additionalConnectorCount++;
339
350
  }
@@ -365,12 +376,18 @@ async function configureLogging(coreConfig, envVars) {
365
376
  * Configures the vault.
366
377
  * @param coreConfig The core config.
367
378
  * @param envVars The environment variables.
379
+ * @returns A promise that resolves when the vault configuration has been applied.
368
380
  */
369
381
  async function configureVault(coreConfig, envVars) {
370
382
  coreConfig.types.vaultConnector ??= [];
371
383
  if (envVars.vaultConnector === VaultConnectorType.EntityStorage) {
372
384
  coreConfig.types.vaultConnector.push({
373
- type: VaultConnectorType.EntityStorage
385
+ type: VaultConnectorType.EntityStorage,
386
+ options: {
387
+ config: {
388
+ prefix: envVars.vaultPrefix
389
+ }
390
+ }
374
391
  });
375
392
  }
376
393
  else if (envVars.vaultConnector === VaultConnectorType.Hashicorp) {
@@ -379,7 +396,8 @@ async function configureVault(coreConfig, envVars) {
379
396
  options: {
380
397
  config: {
381
398
  endpoint: envVars.hashicorpVaultEndpoint ?? "",
382
- token: envVars.hashicorpVaultToken ?? ""
399
+ token: envVars.hashicorpVaultToken ?? "",
400
+ prefix: envVars.vaultPrefix
383
401
  }
384
402
  }
385
403
  });
@@ -389,19 +407,21 @@ async function configureVault(coreConfig, envVars) {
389
407
  * Configures the background task.
390
408
  * @param coreConfig The core config.
391
409
  * @param envVars The environment variables.
410
+ * @returns A promise that resolves when the background task configuration has been applied.
392
411
  */
393
412
  async function configureBackgroundTask(coreConfig, envVars) {
394
413
  coreConfig.types.backgroundTaskComponent ??= [];
395
- if (Coerce.boolean(envVars.backgroundTasksEnabled) ?? false) {
414
+ if (isBackgroundTasksRequired(envVars)) {
396
415
  coreConfig.types.backgroundTaskComponent.push({
397
416
  type: BackgroundTaskComponentType.Service
398
417
  });
399
418
  }
400
419
  }
401
420
  /**
402
- * Configures the event bud.
421
+ * Configures the event bus.
403
422
  * @param coreConfig The core config.
404
423
  * @param envVars The environment variables.
424
+ * @returns A promise that resolves when the event bus configuration has been applied.
405
425
  */
406
426
  async function configureEventBus(coreConfig, envVars) {
407
427
  coreConfig.types.eventBusConnector ??= [];
@@ -419,6 +439,7 @@ async function configureEventBus(coreConfig, envVars) {
419
439
  * Configures the telemetry.
420
440
  * @param coreConfig The core config.
421
441
  * @param envVars The environment variables.
442
+ * @returns A promise that resolves when the telemetry configuration has been applied.
422
443
  */
423
444
  async function configureTelemetry(coreConfig, envVars) {
424
445
  coreConfig.types.telemetryConnector ??= [];
@@ -427,30 +448,140 @@ async function configureTelemetry(coreConfig, envVars) {
427
448
  type: TelemetryConnectorType.EntityStorage
428
449
  });
429
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
+ }
430
472
  if (coreConfig.types.telemetryConnector.length > 0) {
431
473
  coreConfig.types.telemetryComponent ??= [];
432
474
  coreConfig.types.telemetryComponent.push({ type: TelemetryComponentType.Service });
433
475
  }
434
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.telemetryMetricsCollectorIntervalSeconds) ?? 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.healthIntervalSeconds) ?? 60) * 1000,
541
+ initialInterval: (Coerce.integer(envVars.healthStartupIntervalSeconds) ?? 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
+ }
435
565
  /**
436
566
  * Configures the tenant.
437
567
  * @param coreConfig The core config.
438
568
  * @param envVars The environment variables.
569
+ * @returns A promise that resolves when the tenant configuration has been applied.
439
570
  */
440
571
  async function configureTenant(coreConfig, envVars) {
441
- if (Coerce.boolean(envVars.tenantEnabled) ?? false) {
572
+ const isTenantEnabled = Coerce.boolean(envVars.tenantEnabled) ?? false;
573
+ if (isTenantEnabled) {
442
574
  coreConfig.types.tenantAdminComponent ??= [];
443
575
  coreConfig.types.tenantAdminComponent.push({
444
576
  type: TenantAdminComponentType.Service
445
577
  });
446
- coreConfig.types.tenantComponent ??= [];
447
- coreConfig.types.tenantComponent.push({ type: TenantAdminComponentType.Service });
448
578
  }
449
579
  }
450
580
  /**
451
- * Configures the context id handlers.
581
+ * Configures the context ID handlers.
452
582
  * @param coreConfig The core config.
453
583
  * @param envVars The environment variables.
584
+ * @returns A promise that resolves when the context ID handler configuration has been applied.
454
585
  */
455
586
  async function configureContextIdHandlers(coreConfig, envVars) {
456
587
  coreConfig.types.contextIdHandlerComponent ??= [];
@@ -469,6 +600,7 @@ async function configureContextIdHandlers(coreConfig, envVars) {
469
600
  * Configures the messaging.
470
601
  * @param coreConfig The core config.
471
602
  * @param envVars The environment variables.
603
+ * @returns A promise that resolves when the messaging configuration has been applied.
472
604
  */
473
605
  async function configureMessaging(coreConfig, envVars) {
474
606
  if (Coerce.boolean(envVars.messagingEnabled) ?? false) {
@@ -520,6 +652,16 @@ async function configureMessaging(coreConfig, envVars) {
520
652
  });
521
653
  }
522
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
+ }
523
665
  coreConfig.types.messagingPushNotificationConnector.push({
524
666
  type: MessagingPushNotificationConnectorType.Aws,
525
667
  options: {
@@ -529,9 +671,7 @@ async function configureMessaging(coreConfig, envVars) {
529
671
  accessKeyId: envVars.awsSesAccessKeyId,
530
672
  secretAccessKey: envVars.awsSesSecretAccessKey,
531
673
  endpoint: envVars.awsSesEndpoint,
532
- applicationsSettings: Is.json(envVars.awsMessagingPushNotificationApplications)
533
- ? JSON.parse(envVars.awsMessagingPushNotificationApplications)
534
- : []
674
+ applicationsSettings: messagingApps ?? []
535
675
  }
536
676
  }
537
677
  });
@@ -548,6 +688,7 @@ async function configureMessaging(coreConfig, envVars) {
548
688
  * Configures the faucet.
549
689
  * @param coreConfig The core config.
550
690
  * @param envVars The environment variables.
691
+ * @returns A promise that resolves when the faucet configuration has been applied.
551
692
  */
552
693
  async function configureFaucet(coreConfig, envVars) {
553
694
  coreConfig.types.faucetConnector ??= [];
@@ -574,6 +715,7 @@ async function configureFaucet(coreConfig, envVars) {
574
715
  * Configures the wallet.
575
716
  * @param coreConfig The core config.
576
717
  * @param envVars The environment variables.
718
+ * @returns A promise that resolves when the wallet configuration has been applied.
577
719
  */
578
720
  async function configureWallet(coreConfig, envVars) {
579
721
  coreConfig.types.walletConnector ??= [];
@@ -596,6 +738,7 @@ async function configureWallet(coreConfig, envVars) {
596
738
  * Configures the NFT.
597
739
  * @param coreConfig The core config.
598
740
  * @param envVars The environment variables.
741
+ * @returns A promise that resolves when the NFT configuration has been applied.
599
742
  */
600
743
  async function configureNft(coreConfig, envVars) {
601
744
  coreConfig.types.nftConnector ??= [];
@@ -606,10 +749,14 @@ async function configureNft(coreConfig, envVars) {
606
749
  }
607
750
  else if (envVars.nftConnector === NftConnectorType.Iota) {
608
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
+ };
609
756
  coreConfig.types.nftConnector.push({
610
757
  type: NftConnectorType.Iota,
611
758
  options: {
612
- config: dltConfig?.options?.config ?? {}
759
+ config
613
760
  }
614
761
  });
615
762
  }
@@ -619,37 +766,46 @@ async function configureNft(coreConfig, envVars) {
619
766
  }
620
767
  }
621
768
  /**
622
- * Configures the verifiable storage.
769
+ * Configures the notarization.
623
770
  * @param coreConfig The core config.
624
771
  * @param envVars The environment variables.
772
+ * @returns A promise that resolves when the notarization configuration has been applied.
625
773
  */
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
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
631
779
  });
632
780
  }
633
- else if (envVars.verifiableStorageConnector === VerifiableStorageConnectorType.Iota) {
781
+ else if (envVars.notarizationConnector === NotarizationConnectorType.Iota) {
634
782
  const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
635
- coreConfig.types.verifiableStorageConnector.push({
636
- type: VerifiableStorageConnectorType.Iota,
783
+ coreConfig.types.notarizationConnector.push({
784
+ type: NotarizationConnectorType.Iota,
637
785
  options: {
638
786
  config: dltConfig?.options?.config ?? {}
639
787
  }
640
788
  });
641
789
  }
642
- if (coreConfig.types.verifiableStorageConnector.length > 0) {
643
- coreConfig.types.verifiableStorageComponent ??= [];
644
- coreConfig.types.verifiableStorageComponent.push({
645
- type: VerifiableStorageComponentType.Service
646
- });
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)) {
647
803
  coreConfig.types.immutableProofComponent ??= [];
648
804
  coreConfig.types.immutableProofComponent.push({
649
805
  type: ImmutableProofComponentType.Service,
650
806
  options: {
651
807
  config: {
652
- verificationMethodId: envVars.immutableProofVerificationMethodId ?? IMMUTABLE_PROOF_VERIFICATION_METHOD_ID
808
+ verificationMethodId: envVars.immutableProofVerificationMethodId
653
809
  }
654
810
  }
655
811
  });
@@ -659,6 +815,7 @@ async function configureVerifiableStorage(coreConfig, envVars) {
659
815
  * Configures the identity.
660
816
  * @param coreConfig The core config.
661
817
  * @param envVars The environment variables.
818
+ * @returns A promise that resolves when the identity configuration has been applied.
662
819
  */
663
820
  async function configureIdentity(coreConfig, envVars) {
664
821
  coreConfig.types.identityConnector ??= [];
@@ -672,7 +829,13 @@ async function configureIdentity(coreConfig, envVars) {
672
829
  coreConfig.types.identityConnector.push({
673
830
  type: IdentityConnectorType.Iota,
674
831
  options: {
675
- 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
+ }
676
839
  }
677
840
  });
678
841
  }
@@ -685,6 +848,7 @@ async function configureIdentity(coreConfig, envVars) {
685
848
  * Configures the identity resolver.
686
849
  * @param coreConfig The core config.
687
850
  * @param envVars The environment variables.
851
+ * @returns A promise that resolves when the identity resolver configuration has been applied.
688
852
  */
689
853
  async function configureIdentityResolver(coreConfig, envVars) {
690
854
  coreConfig.types.identityResolverConnector ??= [];
@@ -698,7 +862,12 @@ async function configureIdentityResolver(coreConfig, envVars) {
698
862
  coreConfig.types.identityResolverConnector.push({
699
863
  type: IdentityResolverConnectorType.Iota,
700
864
  options: {
701
- config: dltConfig?.options?.config ?? {}
865
+ config: {
866
+ ...dltConfig?.options?.config,
867
+ identityPkgId: Is.stringValue(envVars.iotaIdentityPackageId)
868
+ ? envVars.iotaIdentityPackageId
869
+ : undefined
870
+ }
702
871
  }
703
872
  });
704
873
  }
@@ -723,6 +892,7 @@ async function configureIdentityResolver(coreConfig, envVars) {
723
892
  * Configures the identity profile.
724
893
  * @param coreConfig The core config.
725
894
  * @param envVars The environment variables.
895
+ * @returns A promise that resolves when the identity profile configuration has been applied.
726
896
  */
727
897
  async function configureIdentityProfile(coreConfig, envVars) {
728
898
  coreConfig.types.identityProfileConnector ??= [];
@@ -740,6 +910,7 @@ async function configureIdentityProfile(coreConfig, envVars) {
740
910
  * Configures the attestation.
741
911
  * @param coreConfig The core config.
742
912
  * @param envVars The environment variables.
913
+ * @returns A promise that resolves when the attestation configuration has been applied.
743
914
  */
744
915
  async function configureAttestation(coreConfig, envVars) {
745
916
  coreConfig.types.attestationConnector ??= [];
@@ -754,7 +925,7 @@ async function configureAttestation(coreConfig, envVars) {
754
925
  type: AttestationComponentType.Service,
755
926
  options: {
756
927
  config: {
757
- verificationMethodId: envVars.attestationVerificationMethodId ?? ATTESTATION_VERIFICATION_METHOD_ID
928
+ verificationMethodId: envVars.attestationVerificationMethodId
758
929
  }
759
930
  }
760
931
  });
@@ -764,12 +935,18 @@ async function configureAttestation(coreConfig, envVars) {
764
935
  * Configures the auditable item graph.
765
936
  * @param coreConfig The core config.
766
937
  * @param envVars The environment variables.
938
+ * @returns A promise that resolves when the auditable item graph configuration has been applied.
767
939
  */
768
940
  async function configureAuditableItemGraph(coreConfig, envVars) {
769
941
  if (Coerce.boolean(envVars.auditableItemGraphEnabled) ?? false) {
770
942
  coreConfig.types.auditableItemGraphComponent ??= [];
771
943
  coreConfig.types.auditableItemGraphComponent.push({
772
- type: AuditableItemGraphComponentType.Service
944
+ type: AuditableItemGraphComponentType.Service,
945
+ options: {
946
+ config: {
947
+ mutexTimeoutMs: Coerce.integer(envVars.auditableItemGraphMutexTimeoutMs)
948
+ }
949
+ }
773
950
  });
774
951
  }
775
952
  }
@@ -777,12 +954,18 @@ async function configureAuditableItemGraph(coreConfig, envVars) {
777
954
  * Configures the auditable item stream.
778
955
  * @param coreConfig The core config.
779
956
  * @param envVars The environment variables.
957
+ * @returns A promise that resolves when the auditable item stream configuration has been applied.
780
958
  */
781
959
  async function configureAuditableItemStream(coreConfig, envVars) {
782
960
  if (Coerce.boolean(envVars.auditableItemStreamEnabled) ?? false) {
783
961
  coreConfig.types.auditableItemStreamComponent ??= [];
784
962
  coreConfig.types.auditableItemStreamComponent.push({
785
- type: AuditableItemStreamComponentType.Service
963
+ type: AuditableItemStreamComponentType.Service,
964
+ options: {
965
+ config: {
966
+ mutexTimeoutMs: Coerce.integer(envVars.auditableItemStreamMutexTimeoutMs)
967
+ }
968
+ }
786
969
  });
787
970
  }
788
971
  }
@@ -790,33 +973,25 @@ async function configureAuditableItemStream(coreConfig, envVars) {
790
973
  * Configures the data processing.
791
974
  * @param coreConfig The core config.
792
975
  * @param envVars The environment variables.
976
+ * @returns A promise that resolves when the data processing configuration has been applied.
793
977
  */
794
978
  async function configureDataProcessing(coreConfig, envVars) {
795
979
  if (Coerce.boolean(envVars.dataProcessingEnabled) ?? false) {
796
980
  coreConfig.types.dataProcessingComponent ??= [];
797
981
  coreConfig.types.dataProcessingComponent.push({ type: DataProcessingComponentType.Service });
798
982
  coreConfig.types.dataConverterConnector ??= [];
799
- const converterConnectors = envVars.dataConverterConnectors?.split(",") ?? [];
983
+ const converterConnectors = commaSeparatedListToArray(envVars.dataConverterConnectors);
800
984
  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
- }
985
+ coreConfig.types.dataConverterConnector.push({
986
+ type: converterConnector
987
+ });
811
988
  }
812
989
  coreConfig.types.dataExtractorConnector ??= [];
813
- const extractorConnectors = envVars.dataExtractorConnectors?.split(",") ?? [];
990
+ const extractorConnectors = commaSeparatedListToArray(envVars.dataExtractorConnectors);
814
991
  for (const extractorConnector of extractorConnectors) {
815
- if (extractorConnector === DataExtractorConnectorType.JsonPath) {
816
- coreConfig.types.dataExtractorConnector.push({
817
- type: DataExtractorConnectorType.JsonPath
818
- });
819
- }
992
+ coreConfig.types.dataExtractorConnector.push({
993
+ type: extractorConnector
994
+ });
820
995
  }
821
996
  }
822
997
  }
@@ -824,42 +999,77 @@ async function configureDataProcessing(coreConfig, envVars) {
824
999
  * Configures the document management.
825
1000
  * @param coreConfig The core config.
826
1001
  * @param envVars The environment variables.
1002
+ * @returns A promise that resolves when the document management configuration has been applied.
827
1003
  */
828
1004
  async function configureDocumentManagement(coreConfig, envVars) {
829
1005
  if (Coerce.boolean(envVars.documentManagementEnabled) ?? false) {
830
1006
  coreConfig.types.documentManagementComponent ??= [];
831
1007
  coreConfig.types.documentManagementComponent.push({
832
- type: DocumentManagementComponentType.Service
1008
+ type: DocumentManagementComponentType.Service,
1009
+ options: {
1010
+ config: {
1011
+ mutexTimeoutMs: Coerce.integer(envVars.documentManagementMutexTimeoutMs)
1012
+ }
1013
+ }
833
1014
  });
834
1015
  }
835
1016
  }
836
1017
  /**
837
- * Configures the verifiable credential authentication.
1018
+ * Configures the trust components.
838
1019
  * @param coreConfig The core config.
839
1020
  * @param envVars The environment variables.
1021
+ * @returns A promise that resolves when the trust configuration has been applied.
840
1022
  */
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
1023
+ async function configureTrust(coreConfig, envVars) {
1024
+ if (isTrustRequired(envVars)) {
1025
+ coreConfig.types.trustComponent ??= [];
1026
+ coreConfig.types.trustComponent.push({
1027
+ type: TrustComponentType.Service
1028
+ });
1029
+ coreConfig.types.trustGeneratorComponent ??= [];
1030
+ const trustGeneratorTypes = commaSeparatedListToArray(envVars.trustGenerators);
1031
+ for (const trustGeneratorType of trustGeneratorTypes) {
1032
+ coreConfig.types.trustGeneratorComponent.push({
1033
+ type: trustGeneratorType,
1034
+ options: {
1035
+ config: {
1036
+ verificationMethodId: envVars.trustVerificationMethodId ?? "",
1037
+ tokenTtlInSeconds: Coerce.integer(envVars.trustJwtTtlSeconds)
1038
+ }
850
1039
  }
851
- },
852
- features: ["verifiable-credential"]
853
- });
1040
+ });
1041
+ }
1042
+ coreConfig.types.trustVerifierComponent ??= [];
1043
+ const trustVerifierTypes = commaSeparatedListToArray(envVars.trustVerifiers);
1044
+ for (const trustVerifierType of trustVerifierTypes) {
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
+ }
1062
+ }
854
1063
  }
855
1064
  }
856
1065
  /**
857
1066
  * Configures the rights management.
858
1067
  * @param coreConfig The core config.
859
1068
  * @param envVars The environment variables.
1069
+ * @returns A promise that resolves when the rights management configuration has been applied.
860
1070
  */
861
1071
  async function configureRightsManagement(coreConfig, envVars) {
862
- if (Coerce.boolean(envVars.rightsManagementEnabled) ?? false) {
1072
+ if (isRightsManagementRequired(envVars)) {
863
1073
  coreConfig.types.rightsManagementPapComponent ??= [];
864
1074
  coreConfig.types.rightsManagementPapComponent.push({
865
1075
  type: RightsManagementPapComponentType.Service
@@ -870,156 +1080,153 @@ async function configureRightsManagement(coreConfig, envVars) {
870
1080
  });
871
1081
  coreConfig.types.rightsManagementPipComponent ??= [];
872
1082
  coreConfig.types.rightsManagementPipComponent.push({
873
- type: RightsManagementPipComponentType.Service,
874
- options: {
875
- informationModulesConfig: Is.arrayValue(envVars.rightsManagementInformationSources)
876
- ? envVars.rightsManagementInformationSources
877
- : undefined
878
- }
1083
+ type: RightsManagementPipComponentType.Service
879
1084
  });
880
1085
  coreConfig.types.rightsManagementPxpComponent ??= [];
881
1086
  coreConfig.types.rightsManagementPxpComponent.push({
882
- type: RightsManagementPxpComponentType.Service,
883
- options: {
884
- actionModulesConfig: Is.arrayValue(envVars.rightsManagementExecutionActions)
885
- ? envVars.rightsManagementExecutionActions
886
- : undefined
887
- }
1087
+ type: RightsManagementPxpComponentType.Service
888
1088
  });
889
1089
  coreConfig.types.rightsManagementPdpComponent ??= [];
890
1090
  coreConfig.types.rightsManagementPdpComponent.push({
891
- type: RightsManagementPdpComponentType.Service,
892
- options: {
893
- arbiterModulesConfig: Is.arrayValue(envVars.rightsManagementArbiters)
894
- ? envVars.rightsManagementArbiters
895
- : undefined
896
- }
1091
+ type: RightsManagementPdpComponentType.Service
897
1092
  });
898
1093
  coreConfig.types.rightsManagementPepComponent ??= [];
899
1094
  coreConfig.types.rightsManagementPepComponent.push({
900
- type: RightsManagementPepComponentType.Service,
901
- options: {
902
- processorModulesConfig: Is.arrayValue(envVars.rightsManagementEnforcementProcessors)
903
- ? envVars.rightsManagementEnforcementProcessors
904
- : undefined
905
- }
1095
+ type: RightsManagementPepComponentType.Service
906
1096
  });
907
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
+ endpoint: "http://localhost",
1109
+ pathPrefix: rightsManagementPath
1110
+ },
1111
+ isMultiInstance: true,
1112
+ features: ["remote"]
1113
+ });
908
1114
  coreConfig.types.rightsManagementPnpComponent.push({
909
1115
  type: RightsManagementPnpComponentType.Service,
910
1116
  options: {
911
- negotiatorModulesConfig: Is.arrayValue(envVars.rightsManagementNegotiators)
912
- ? envVars.rightsManagementNegotiators
913
- : undefined,
914
- requesterModulesConfig: Is.arrayValue(envVars.rightsManagementRequesters)
915
- ? envVars.rightsManagementRequesters
916
- : undefined,
917
1117
  config: {
918
- baseCallbackUrl: envVars.rightsManagementBaseCallbackUrl ?? "",
919
- offers: Is.arrayValue(envVars.rightsManagementOffers)
920
- ? envVars.rightsManagementOffers
921
- : [],
922
- negotiationComponentCreator: async (url) => new PolicyNegotiationPointRestClient({ endpoint: url })
1118
+ callbackPath: rightsManagementPath,
1119
+ includeErrorDetails: coreConfig.debug ?? false,
1120
+ mutexTimeoutMs: Coerce.integer(envVars.rightsManagementMutexTimeoutMs)
923
1121
  }
924
- }
1122
+ },
1123
+ isDefault: true
925
1124
  });
926
1125
  coreConfig.types.rightsManagementPnapComponent ??= [];
927
1126
  coreConfig.types.rightsManagementPnapComponent.push({
928
- type: RightsManagementPnapComponentType.Service
929
- });
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,
1127
+ type: RightsManagementPnapComponentType.Service,
937
1128
  options: {
938
1129
  config: {
939
- dataAccessComponentCreator: async (url) => new DataAccessPointRestClient({ endpoint: url })
1130
+ mutexTimeoutMs: Coerce.integer(envVars.rightsManagementMutexTimeoutMs)
940
1131
  }
941
1132
  }
942
1133
  });
1134
+ coreConfig.types.rightsManagementPolicyArbiterComponent ??= [];
1135
+ const policyArbiterTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyArbiters);
1136
+ for (const policyArbiterType of policyArbiterTypes) {
1137
+ coreConfig.types.rightsManagementPolicyArbiterComponent.push({
1138
+ type: policyArbiterType
1139
+ });
1140
+ }
1141
+ coreConfig.types.rightsManagementPolicyObligationEnforcerComponent ??= [];
1142
+ const policyObligationEnforcerTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyObligationEnforcers);
1143
+ for (const policyObligationEnforcerType of policyObligationEnforcerTypes) {
1144
+ coreConfig.types.rightsManagementPolicyObligationEnforcerComponent.push({
1145
+ type: policyObligationEnforcerType
1146
+ });
1147
+ }
1148
+ coreConfig.types.rightsManagementPolicyEnforcementProcessorComponent ??= [];
1149
+ const policyEnforcementProcessTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyEnforcementProcessors);
1150
+ for (const policyEnforcementProcessorType of policyEnforcementProcessTypes) {
1151
+ coreConfig.types.rightsManagementPolicyEnforcementProcessorComponent.push({
1152
+ type: policyEnforcementProcessorType
1153
+ });
1154
+ }
1155
+ coreConfig.types.rightsManagementPolicyExecutionActionComponent ??= [];
1156
+ const policyExecutionActionTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyExecutionActions);
1157
+ for (const policyExecutionActionType of policyExecutionActionTypes) {
1158
+ coreConfig.types.rightsManagementPolicyExecutionActionComponent.push({
1159
+ type: policyExecutionActionType
1160
+ });
1161
+ }
1162
+ coreConfig.types.rightsManagementPolicyInformationSourceComponent ??= [];
1163
+ const policyInformationSourceTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyInformationSources);
1164
+ for (const policyInformationSourceType of policyInformationSourceTypes) {
1165
+ coreConfig.types.rightsManagementPolicyInformationSourceComponent.push({
1166
+ type: policyInformationSourceType
1167
+ });
1168
+ }
1169
+ coreConfig.types.rightsManagementPolicyRequesterComponent ??= [];
1170
+ const policyRequesterTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyRequesters);
1171
+ for (const policyRequesterType of policyRequesterTypes) {
1172
+ coreConfig.types.rightsManagementPolicyRequesterComponent.push({
1173
+ type: policyRequesterType
1174
+ });
1175
+ }
1176
+ coreConfig.types.rightsManagementPolicyNegotiatorComponent ??= [];
1177
+ const policyNegotiatorTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyNegotiators);
1178
+ for (const policyNegotiatorType of policyNegotiatorTypes) {
1179
+ coreConfig.types.rightsManagementPolicyNegotiatorComponent.push({
1180
+ type: policyNegotiatorType
1181
+ });
1182
+ }
943
1183
  }
944
1184
  }
945
1185
  /**
946
1186
  * Configures the task scheduler.
947
1187
  * @param coreConfig The core config.
948
1188
  * @param envVars The environment variables.
1189
+ * @returns A promise that resolves when the task scheduler configuration has been applied.
949
1190
  */
950
1191
  async function configureTaskScheduler(coreConfig, envVars) {
951
- if (Coerce.boolean(envVars.taskSchedulerEnabled) ?? false) {
1192
+ if (isTaskSchedulerRequired(envVars)) {
952
1193
  coreConfig.types.taskSchedulerComponent ??= [];
953
1194
  coreConfig.types.taskSchedulerComponent.push({
954
1195
  type: TaskSchedulerComponentType.Service
955
1196
  });
956
1197
  }
957
1198
  }
958
- /**
959
- * Configures the synchronised storage.
960
- * @param coreConfig The core config.
961
- * @param envVars The environment variables.
962
- */
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,
993
- options: {
994
- endpoint: envVars.synchronisedStorageTrustedUrl
995
- },
996
- features: ["trusted"]
997
- });
998
- }
999
- }
1000
- }
1001
1199
  /**
1002
1200
  * Configures the federated catalogue.
1003
1201
  * @param coreConfig The core config.
1004
1202
  * @param envVars The environment variables.
1203
+ * @returns A promise that resolves when the federated catalogue configuration has been applied.
1005
1204
  */
1006
1205
  async function configureFederatedCatalogue(coreConfig, envVars) {
1007
- if (Coerce.boolean(envVars.federatedCatalogueEnabled) ?? false) {
1206
+ if (isFederatedCatalogueRequired(envVars)) {
1008
1207
  coreConfig.types.federatedCatalogueComponent ??= [];
1009
- coreConfig.types.federatedCatalogueComponent.push({
1010
- type: FederatedCatalogueComponentType.Service,
1011
- options: {}
1012
- });
1013
- coreConfig.types.federatedCatalogueFilterComponent ??= [];
1014
- const filters = (envVars.federatedCatalogueFilters ?? "")
1015
- .split(",")
1016
- .map(filter => filter.trim())
1017
- .filter(filter => filter.length > 0);
1018
- for (const filter of filters) {
1019
- const type = FederatedCatalogueFilterComponentType[filter];
1020
- if (type) {
1208
+ if (Is.stringValue(envVars.federatedCatalogueRemoteEndpoint)) {
1209
+ coreConfig.types.federatedCatalogueComponent.push({
1210
+ type: FederatedCatalogueComponentType.RestClient,
1211
+ options: {
1212
+ endpoint: envVars.federatedCatalogueRemoteEndpoint
1213
+ }
1214
+ });
1215
+ }
1216
+ else {
1217
+ coreConfig.types.federatedCatalogueComponent.push({
1218
+ type: FederatedCatalogueComponentType.Service,
1219
+ options: {
1220
+ config: {
1221
+ mutexTimeoutMs: Coerce.integer(envVars.federatedCatalogueMutexTimeoutMs)
1222
+ }
1223
+ }
1224
+ });
1225
+ coreConfig.types.federatedCatalogueFilterComponent ??= [];
1226
+ const filters = commaSeparatedListToArray(envVars.federatedCatalogueFilters);
1227
+ for (const filter of filters) {
1021
1228
  coreConfig.types.federatedCatalogueFilterComponent.push({
1022
- type,
1229
+ type: filter,
1023
1230
  options: {}
1024
1231
  });
1025
1232
  }
@@ -1027,19 +1234,39 @@ async function configureFederatedCatalogue(coreConfig, envVars) {
1027
1234
  }
1028
1235
  }
1029
1236
  /**
1030
- * Configures the data space connector.
1237
+ * Configures the dataspace control plane and data plane.
1031
1238
  * @param coreConfig The core config.
1032
1239
  * @param envVars The environment variables.
1240
+ * @returns A promise that resolves when the dataspace configuration has been applied.
1033
1241
  */
1034
- async function configureDataSpaceConnector(coreConfig, envVars) {
1035
- if (Coerce.boolean(envVars.dataSpaceConnectorEnabled) ?? false) {
1036
- coreConfig.types.dataSpaceConnectorComponent ??= [];
1037
- coreConfig.types.dataSpaceConnectorComponent.push({
1038
- type: DataSpaceConnectorComponentType.Service,
1242
+ async function configureDataspace(coreConfig, envVars) {
1243
+ if (Coerce.boolean(envVars.dataspaceEnabled) ?? false) {
1244
+ coreConfig.types.dataspaceControlPlaneComponent ??= [];
1245
+ // We add a multi instance REST client for remote/consumer-initiated transfers.
1246
+ coreConfig.types.dataspaceControlPlaneComponent.push({
1247
+ type: DataspaceControlPlaneComponentType.RestClient,
1248
+ options: {
1249
+ endpoint: "http://localhost"
1250
+ },
1251
+ isMultiInstance: true,
1252
+ features: ["remote"]
1253
+ });
1254
+ coreConfig.types.dataspaceControlPlaneComponent.push({
1255
+ type: DataspaceControlPlaneComponentType.Service,
1039
1256
  options: {
1040
1257
  config: {
1041
- retainActivityLogsFor: Coerce.number(envVars.dataSpaceConnectorRetainActivityLogsFor),
1042
- activityLogsCleanUpInterval: Coerce.number(envVars.dataSpaceConnectorActivityLogsCleanUpInterval)
1258
+ dataPlanePath: envVars.dataspaceDataPlanePath
1259
+ }
1260
+ },
1261
+ isDefault: true
1262
+ });
1263
+ coreConfig.types.dataspaceDataPlaneComponent ??= [];
1264
+ coreConfig.types.dataspaceDataPlaneComponent.push({
1265
+ type: DataspaceDataPlaneComponentType.Service,
1266
+ options: {
1267
+ config: {
1268
+ retainActivityLogsFor: Coerce.number(envVars.dataspaceRetainActivityLogsFor),
1269
+ activityLogsCleanUpInterval: Coerce.number(envVars.dataspaceActivityLogsCleanupInterval)
1043
1270
  }
1044
1271
  }
1045
1272
  });
@@ -1049,6 +1276,7 @@ async function configureDataSpaceConnector(coreConfig, envVars) {
1049
1276
  * Configures the DLT.
1050
1277
  * @param coreConfig The core config.
1051
1278
  * @param envVars The environment variables.
1279
+ * @returns A promise that resolves when the DLT configuration has been applied.
1052
1280
  */
1053
1281
  async function configureDlt(coreConfig, envVars) {
1054
1282
  // Create centralized DLT configuration for IOTA if essential IOTA variables are set
@@ -1077,4 +1305,101 @@ async function configureDlt(coreConfig, envVars) {
1077
1305
  });
1078
1306
  }
1079
1307
  }
1308
+ /**
1309
+ * Converts a comma separated list to an array.
1310
+ * @param value The comma separated list.
1311
+ * @returns The array.
1312
+ */
1313
+ function commaSeparatedListToArray(value) {
1314
+ return (value ?? "")
1315
+ .split(",")
1316
+ .map(item => item.trim())
1317
+ .filter(item => item.length > 0);
1318
+ }
1319
+ /**
1320
+ * Checks if the trust subsystem is required.
1321
+ * Returns true when any component that depends on the trust subsystem is enabled.
1322
+ * @param envVars The environment variables.
1323
+ * @returns True if rights-management, or dataspace is enabled.
1324
+ */
1325
+ export function isTrustRequired(envVars) {
1326
+ return (isRightsManagementRequired(envVars) ||
1327
+ (Coerce.boolean(envVars.dataspaceEnabled) ?? false) ||
1328
+ isFederatedCatalogueRequired(envVars));
1329
+ }
1330
+ /**
1331
+ * Checks if the background tasks subsystem is required.
1332
+ * Returns true when any component that depends on the background tasks subsystem is enabled.
1333
+ * @param envVars The environment variables.
1334
+ * @returns True if dataspace or verifiable storage is enabled.
1335
+ */
1336
+ export function isBackgroundTasksRequired(envVars) {
1337
+ return (Coerce.boolean(envVars.dataspaceEnabled) ?? false) || isImmutableProofRequired(envVars);
1338
+ }
1339
+ /**
1340
+ * Checks if the immutable proof subsystem is required.
1341
+ * Returns true when any component that depends on the immutable proof subsystem is enabled.
1342
+ * @param envVars The environment variables.
1343
+ * @returns True if verifiable storage is enabled.
1344
+ */
1345
+ export function isImmutableProofRequired(envVars) {
1346
+ return ((Coerce.boolean(envVars.auditableItemGraphEnabled) ?? false) ||
1347
+ (Coerce.boolean(envVars.auditableItemStreamEnabled) ?? false) ||
1348
+ (Coerce.boolean(envVars.documentManagementEnabled) ?? false));
1349
+ }
1350
+ /**
1351
+ * Checks if the federated catalogue subsystem is required.
1352
+ * Returns true when the catalogue is explicitly enabled, a remote endpoint is configured, filters are set, or dataspace is enabled.
1353
+ * @param envVars The environment variables.
1354
+ * @returns True if the federated catalogue is required.
1355
+ */
1356
+ export function isFederatedCatalogueRequired(envVars) {
1357
+ return ((Coerce.boolean(envVars.federatedCatalogueEnabled) ?? false) ||
1358
+ Is.stringValue(envVars.federatedCatalogueRemoteEndpoint) ||
1359
+ Is.stringValue(envVars.federatedCatalogueFilters) ||
1360
+ (Coerce.boolean(envVars.dataspaceEnabled) ?? false));
1361
+ }
1362
+ /**
1363
+ * Checks if the rights management subsystem is required.
1364
+ * Returns true when any component that depends on the rights management subsystem is enabled.
1365
+ * Note: rights management has no standalone enable flag - it is gated entirely on
1366
+ * `dataspaceEnabled`. Setting `TWIN_RIGHTS_MANAGEMENT_*` env var in isolation does not
1367
+ * enable the subsystem; `TWIN_DATASPACE_ENABLED` must also be true.
1368
+ * @param envVars The environment variables.
1369
+ * @returns True if rights management is enabled.
1370
+ */
1371
+ export function isRightsManagementRequired(envVars) {
1372
+ return Coerce.boolean(envVars.dataspaceEnabled) ?? false;
1373
+ }
1374
+ /**
1375
+ * Checks if the task scheduler subsystem is required.
1376
+ * Returns true when any component that depends on the task scheduler subsystem is enabled.
1377
+ * @param envVars The environment variables.
1378
+ * @returns True if task scheduler is enabled.
1379
+ */
1380
+ export function isTaskSchedulerRequired(envVars) {
1381
+ return ((Coerce.boolean(envVars.taskSchedulerEnabled) ?? false) ||
1382
+ (Coerce.boolean(envVars.dataspaceEnabled) ?? false) ||
1383
+ isRightsManagementRequired(envVars) ||
1384
+ isAuthEntityStorageRequired(envVars));
1385
+ }
1386
+ /**
1387
+ * Checks if the automation subsystem is required.
1388
+ * Returns true when any component that depends on the automation subsystem is enabled.
1389
+ * @param envVars The environment variables.
1390
+ * @returns True if automation is enabled.
1391
+ */
1392
+ export function isAutomationRequired(envVars) {
1393
+ return isRightsManagementRequired(envVars);
1394
+ }
1395
+ /**
1396
+ * Checks if the telemetry subsystem is required.
1397
+ * Returns true when any component that depends on the telemetry subsystem is enabled.
1398
+ * @param envVars The environment variables.
1399
+ * @returns True if telemetry is enabled.
1400
+ */
1401
+ export function isTelemetryRequired(envVars) {
1402
+ return (envVars.telemetryConnector === TelemetryConnectorType.EntityStorage ||
1403
+ envVars.telemetryConnector === TelemetryConnectorType.OpenTelemetry);
1404
+ }
1080
1405
  //# sourceMappingURL=engineEnvBuilder.js.map