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

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