@twin.org/node-core 0.0.3-next.4 → 0.0.3-next.40
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.
- package/README.md +3 -1
- package/dist/es/builders/engineEnvBuilder.js +443 -126
- package/dist/es/builders/engineEnvBuilder.js.map +1 -1
- package/dist/es/builders/engineServerEnvBuilder.js +89 -32
- package/dist/es/builders/engineServerEnvBuilder.js.map +1 -1
- package/dist/es/builders/extensionsBuilder.js.map +1 -1
- package/dist/es/cli.js +247 -0
- package/dist/es/cli.js.map +1 -0
- package/dist/es/commands/bootstrapLegacy.js +199 -0
- package/dist/es/commands/bootstrapLegacy.js.map +1 -0
- package/dist/es/commands/help.js +85 -0
- package/dist/es/commands/help.js.map +1 -0
- package/dist/es/commands/identityCreate.js +327 -0
- package/dist/es/commands/identityCreate.js.map +1 -0
- package/dist/es/commands/identityImports.js +82 -0
- package/dist/es/commands/identityImports.js.map +1 -0
- package/dist/es/commands/identityVerifiableCredentialCreate.js +146 -0
- package/dist/es/commands/identityVerifiableCredentialCreate.js.map +1 -0
- package/dist/es/commands/identityVerificationMethodCreate.js +228 -0
- package/dist/es/commands/identityVerificationMethodCreate.js.map +1 -0
- package/dist/es/commands/identityVerificationMethodImport.js +126 -0
- package/dist/es/commands/identityVerificationMethodImport.js.map +1 -0
- package/dist/es/commands/nodeSetIdentity.js +64 -0
- package/dist/es/commands/nodeSetIdentity.js.map +1 -0
- package/dist/es/commands/nodeSetTenant.js +68 -0
- package/dist/es/commands/nodeSetTenant.js.map +1 -0
- package/dist/es/commands/tenantCreate.js +139 -0
- package/dist/es/commands/tenantCreate.js.map +1 -0
- package/dist/es/commands/tenantImport.js +97 -0
- package/dist/es/commands/tenantImport.js.map +1 -0
- package/dist/es/commands/tenantUpdate.js +94 -0
- package/dist/es/commands/tenantUpdate.js.map +1 -0
- package/dist/es/commands/userCreate.js +239 -0
- package/dist/es/commands/userCreate.js.map +1 -0
- package/dist/es/commands/userUpdate.js +154 -0
- package/dist/es/commands/userUpdate.js.map +1 -0
- package/dist/es/commands/vaultKeyCreate.js +191 -0
- package/dist/es/commands/vaultKeyCreate.js.map +1 -0
- package/dist/es/commands/vaultKeyImport.js +104 -0
- package/dist/es/commands/vaultKeyImport.js.map +1 -0
- package/dist/es/defaults.js +19 -1
- package/dist/es/defaults.js.map +1 -1
- package/dist/es/index.js +11 -4
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/ICliArgs.js +4 -0
- package/dist/es/models/ICliArgs.js.map +1 -0
- package/dist/es/models/ICliCommand.js +2 -0
- package/dist/es/models/ICliCommand.js.map +1 -0
- package/dist/es/models/ICliCommandDefinition.js +2 -0
- package/dist/es/models/ICliCommandDefinition.js.map +1 -0
- package/dist/es/models/ICliCommandDefinitionParam.js +2 -0
- package/dist/es/models/ICliCommandDefinitionParam.js.map +1 -0
- package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -1
- package/dist/es/models/IEngineServerEnvironmentVariables.js.map +1 -1
- package/dist/es/models/INodeEngineState.js.map +1 -1
- package/dist/es/models/INodeEnvironmentVariables.js.map +1 -1
- package/dist/es/models/INodeOptions.js.map +1 -1
- package/dist/es/models/cliCommandParamType.js +4 -0
- package/dist/es/models/cliCommandParamType.js.map +1 -0
- package/dist/es/models/nodeExtensionInitialiseEngineMethod.js +2 -0
- package/dist/es/models/nodeExtensionInitialiseEngineMethod.js.map +1 -0
- package/dist/es/models/nodeExtensionInitialiseEngineServerMethod.js +2 -0
- package/dist/es/models/nodeExtensionInitialiseEngineServerMethod.js.map +1 -0
- package/dist/es/models/nodeExtensionInitialiseMethod.js +2 -0
- package/dist/es/models/nodeExtensionInitialiseMethod.js.map +1 -0
- package/dist/es/models/nodeExtensionShutdownMethod.js +4 -0
- package/dist/es/models/nodeExtensionShutdownMethod.js.map +1 -0
- package/dist/es/node.js +86 -39
- package/dist/es/node.js.map +1 -1
- package/dist/es/start.js +139 -0
- package/dist/es/start.js.map +1 -0
- package/dist/es/utils.js +12 -22
- package/dist/es/utils.js.map +1 -1
- package/dist/types/builders/engineEnvBuilder.d.ts +64 -1
- package/dist/types/builders/engineServerEnvBuilder.d.ts +11 -2
- package/dist/types/cli.d.ts +56 -0
- package/dist/types/commands/bootstrapLegacy.d.ts +66 -0
- package/dist/types/commands/help.d.ts +23 -0
- package/dist/types/commands/identityCreate.d.ts +39 -0
- package/dist/types/commands/identityImports.d.ts +24 -0
- package/dist/types/commands/identityVerifiableCredentialCreate.d.ts +43 -0
- package/dist/types/commands/identityVerificationMethodCreate.d.ts +47 -0
- package/dist/types/commands/identityVerificationMethodImport.d.ts +31 -0
- package/dist/types/commands/nodeSetIdentity.d.ts +22 -0
- package/dist/types/commands/nodeSetTenant.d.ts +22 -0
- package/dist/types/commands/tenantCreate.d.ts +38 -0
- package/dist/types/commands/tenantImport.d.ts +26 -0
- package/dist/types/commands/tenantUpdate.d.ts +26 -0
- package/dist/types/commands/userCreate.d.ts +51 -0
- package/dist/types/commands/userUpdate.d.ts +40 -0
- package/dist/types/commands/vaultKeyCreate.d.ts +43 -0
- package/dist/types/commands/vaultKeyImport.d.ts +28 -0
- package/dist/types/defaults.d.ts +10 -1
- package/dist/types/index.d.ts +11 -4
- package/dist/types/models/ICliArgs.d.ts +20 -0
- package/dist/types/models/ICliCommand.d.ts +17 -0
- package/dist/types/models/ICliCommandDefinition.d.ts +46 -0
- package/dist/types/models/ICliCommandDefinitionParam.d.ts +35 -0
- package/dist/types/models/IEngineEnvironmentVariables.d.ts +117 -60
- package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +8 -0
- package/dist/types/models/INodeEngineState.d.ts +0 -8
- package/dist/types/models/INodeEnvironmentVariables.d.ts +0 -38
- package/dist/types/models/INodeOptions.d.ts +6 -2
- package/dist/types/models/cliCommandParamType.d.ts +4 -0
- package/dist/types/models/nodeExtensionInitialiseEngineMethod.d.ts +7 -0
- package/dist/types/models/nodeExtensionInitialiseEngineServerMethod.d.ts +8 -0
- package/dist/types/models/nodeExtensionInitialiseMethod.d.ts +8 -0
- package/dist/types/models/nodeExtensionShutdownMethod.d.ts +5 -0
- package/dist/types/node.d.ts +5 -4
- package/dist/types/{server.d.ts → start.d.ts} +4 -2
- package/dist/types/utils.d.ts +6 -8
- package/docs/changelog.md +532 -176
- package/docs/examples.md +99 -1
- package/docs/reference/functions/buildConfiguration.md +1 -1
- package/docs/reference/functions/buildEngineServerConfiguration.md +1 -1
- package/docs/reference/functions/constructCliCommand.md +27 -0
- package/docs/reference/functions/executeCommand.md +29 -0
- package/docs/reference/functions/getEnvDefaults.md +19 -0
- package/docs/reference/functions/getScriptDirectory.md +19 -0
- package/docs/reference/functions/isAuthEntityStorageRequired.md +20 -0
- package/docs/reference/functions/isAutomationRequired.md +20 -0
- package/docs/reference/functions/isBackgroundTasksRequired.md +20 -0
- package/docs/reference/functions/isFederatedCatalogueRequired.md +20 -0
- package/docs/reference/functions/isImmutableProofRequired.md +20 -0
- package/docs/reference/functions/isRightsManagementRequired.md +20 -0
- package/docs/reference/functions/isTaskSchedulerRequired.md +20 -0
- package/docs/reference/functions/isTelemetryRequired.md +20 -0
- package/docs/reference/functions/isTrustRequired.md +20 -0
- package/docs/reference/functions/isUrlTransformerRequired.md +20 -0
- package/docs/reference/functions/parseCommandLineArgs.md +19 -0
- package/docs/reference/functions/processEnvOptions.md +27 -0
- package/docs/reference/functions/registerCommands.md +9 -0
- package/docs/reference/functions/resolvePackageEntryPoint.md +2 -2
- package/docs/reference/functions/run.md +8 -2
- package/docs/reference/functions/start.md +9 -3
- package/docs/reference/functions/substituteEnvOptions.md +25 -0
- package/docs/reference/index.md +26 -13
- package/docs/reference/interfaces/ICacheMetadata.md +3 -3
- package/docs/reference/interfaces/ICliArgs.md +35 -0
- package/docs/reference/interfaces/ICliCommand.md +23 -0
- package/docs/reference/interfaces/ICliCommandDefinition.md +101 -0
- package/docs/reference/interfaces/ICliCommandDefinitionParam.md +65 -0
- package/docs/reference/interfaces/IEngineEnvironmentVariables.md +420 -311
- package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +545 -368
- package/docs/reference/interfaces/IModuleProtocol.md +3 -3
- package/docs/reference/interfaces/INodeEngineState.md +4 -20
- package/docs/reference/interfaces/INodeEnvironmentVariables.md +551 -450
- package/docs/reference/interfaces/INodeOptions.md +44 -36
- package/docs/reference/interfaces/IProtocolHandlerResult.md +2 -2
- package/docs/reference/type-aliases/CliCommandParamType.md +5 -0
- package/docs/reference/type-aliases/NodeExtensionInitialiseEngineMethod.md +1 -1
- package/docs/reference/type-aliases/NodeExtensionInitialiseEngineServerMethod.md +1 -1
- package/docs/reference/type-aliases/NodeExtensionInitialiseMethod.md +1 -1
- package/docs/reference/type-aliases/NodeExtensionShutdownMethod.md +1 -1
- package/docs/reference/variables/ModuleProtocol.md +5 -5
- package/docs/reference/variables/TRUST_VERIFICATION_METHOD_ID.md +3 -0
- package/docs/reference/variables/URL_TRANSFORMER_ENCRYPTION_KEY_ID.md +3 -0
- package/locales/en.json +600 -30
- package/package.json +10 -6
- package/dist/es/bootstrap.js +0 -366
- package/dist/es/bootstrap.js.map +0 -1
- package/dist/es/identity.js +0 -182
- package/dist/es/identity.js.map +0 -1
- package/dist/es/models/nodeExtensionMethods.js +0 -2
- package/dist/es/models/nodeExtensionMethods.js.map +0 -1
- package/dist/es/models/nodeFeatures.js +0 -21
- package/dist/es/models/nodeFeatures.js.map +0 -1
- package/dist/es/server.js +0 -81
- package/dist/es/server.js.map +0 -1
- package/dist/types/bootstrap.d.ts +0 -68
- package/dist/types/identity.d.ts +0 -14
- package/dist/types/models/nodeExtensionMethods.d.ts +0 -27
- package/dist/types/models/nodeFeatures.d.ts +0 -21
- package/docs/detailed-guide.md +0 -129
- package/docs/reference/functions/bootstrap.md +0 -29
- package/docs/reference/functions/bootstrapAuth.md +0 -35
- package/docs/reference/functions/bootstrapBlobEncryption.md +0 -35
- package/docs/reference/functions/bootstrapImmutableProofMethod.md +0 -35
- package/docs/reference/functions/bootstrapNodeAdminUser.md +0 -35
- package/docs/reference/functions/bootstrapNodeId.md +0 -35
- package/docs/reference/functions/bootstrapSynchronisedStorage.md +0 -35
- package/docs/reference/functions/bootstrapTenantId.md +0 -35
- package/docs/reference/functions/getFeatures.md +0 -19
- package/docs/reference/type-aliases/NodeFeatures.md +0 -5
- package/docs/reference/variables/NodeFeatures.md +0 -25
- 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,
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
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, SynchronisedStorageComponentType, TaskSchedulerComponentType, TelemetryComponentType, TelemetryConnectorType, TenantAdminComponentType, TrustComponentType, UrlTransformerComponentType, VaultConnectorType, VerifiableStorageComponentType, VerifiableStorageConnectorType, 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,17 @@ 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);
|
|
45
|
+
await configureNotarization(coreConfig, envVars);
|
|
39
46
|
await configureVerifiableStorage(coreConfig, envVars);
|
|
47
|
+
await configureImmutableProof(coreConfig, envVars);
|
|
40
48
|
await configureIdentity(coreConfig, envVars);
|
|
41
49
|
await configureIdentityResolver(coreConfig, envVars);
|
|
42
50
|
await configureIdentityProfile(coreConfig, envVars);
|
|
@@ -45,11 +53,11 @@ export async function buildEngineConfiguration(envVars, contextIdKeys) {
|
|
|
45
53
|
await configureAuditableItemGraph(coreConfig, envVars);
|
|
46
54
|
await configureAuditableItemStream(coreConfig, envVars);
|
|
47
55
|
await configureDocumentManagement(coreConfig, envVars);
|
|
48
|
-
await
|
|
56
|
+
await configureTrust(coreConfig, envVars);
|
|
49
57
|
await configureRightsManagement(coreConfig, envVars);
|
|
50
58
|
await configureSynchronisedStorage(coreConfig, envVars);
|
|
51
59
|
await configureFederatedCatalogue(coreConfig, envVars);
|
|
52
|
-
await
|
|
60
|
+
await configureDataspace(coreConfig, envVars);
|
|
53
61
|
return coreConfig;
|
|
54
62
|
}
|
|
55
63
|
/**
|
|
@@ -60,7 +68,7 @@ export async function buildEngineConfiguration(envVars, contextIdKeys) {
|
|
|
60
68
|
async function configureEntityStorage(coreConfig, envVars) {
|
|
61
69
|
coreConfig.types ??= {};
|
|
62
70
|
coreConfig.types.entityStorageConnector ??= [];
|
|
63
|
-
const entityStorageConnectorTypes = envVars.entityStorageConnectorType
|
|
71
|
+
const entityStorageConnectorTypes = commaSeparatedListToArray(envVars.entityStorageConnectorType);
|
|
64
72
|
if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.Memory)) {
|
|
65
73
|
coreConfig.types.entityStorageConnector.push({
|
|
66
74
|
type: EntityStorageConnectorType.Memory
|
|
@@ -84,7 +92,8 @@ async function configureEntityStorage(coreConfig, envVars) {
|
|
|
84
92
|
authMode: envVars.awsDynamodbAuthMode,
|
|
85
93
|
accessKeyId: envVars.awsDynamodbAccessKeyId,
|
|
86
94
|
secretAccessKey: envVars.awsDynamodbSecretAccessKey,
|
|
87
|
-
endpoint: envVars.awsDynamodbEndpoint
|
|
95
|
+
endpoint: envVars.awsDynamodbEndpoint,
|
|
96
|
+
connectionTimeoutMs: Coerce.integer(envVars.awsDynamodbConnectionTimeoutMs)
|
|
88
97
|
},
|
|
89
98
|
tablePrefix: envVars.entityStorageTablePrefix
|
|
90
99
|
}
|
|
@@ -124,7 +133,7 @@ async function configureEntityStorage(coreConfig, envVars) {
|
|
|
124
133
|
type: EntityStorageConnectorType.ScyllaDb,
|
|
125
134
|
options: {
|
|
126
135
|
config: {
|
|
127
|
-
hosts: envVars.scylladbHosts
|
|
136
|
+
hosts: commaSeparatedListToArray(envVars.scylladbHosts),
|
|
128
137
|
localDataCenter: envVars.scylladbLocalDataCenter ?? "",
|
|
129
138
|
keyspace: envVars.scylladbKeyspace ?? "",
|
|
130
139
|
port: Coerce.integer(envVars.scylladbPort)
|
|
@@ -179,15 +188,6 @@ async function configureEntityStorage(coreConfig, envVars) {
|
|
|
179
188
|
});
|
|
180
189
|
}
|
|
181
190
|
const defaultEntityStorageConnectorType = envVars.entityStorageConnectorDefault ?? entityStorageConnectorTypes[0];
|
|
182
|
-
if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.Synchronised)) {
|
|
183
|
-
// For synchronised storage we use the default connector as the one we wrap for real DB operations
|
|
184
|
-
coreConfig.types.entityStorageConnector.push({
|
|
185
|
-
type: EntityStorageConnectorType.Synchronised,
|
|
186
|
-
options: {
|
|
187
|
-
entityStorageConnectorType: defaultEntityStorageConnectorType
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
191
|
if (Is.arrayValue(entityStorageConnectorTypes)) {
|
|
192
192
|
for (const config of coreConfig.types.entityStorageConnector) {
|
|
193
193
|
if (config.type === defaultEntityStorageConnectorType) {
|
|
@@ -204,7 +204,7 @@ async function configureEntityStorage(coreConfig, envVars) {
|
|
|
204
204
|
*/
|
|
205
205
|
async function configureBlobStorage(coreConfig, envVars) {
|
|
206
206
|
coreConfig.types.blobStorageConnector ??= [];
|
|
207
|
-
const blobStorageConnectorTypes = envVars.blobStorageConnectorType
|
|
207
|
+
const blobStorageConnectorTypes = commaSeparatedListToArray(envVars.blobStorageConnectorType);
|
|
208
208
|
if (blobStorageConnectorTypes.includes(BlobStorageConnectorType.Memory)) {
|
|
209
209
|
coreConfig.types.blobStorageConnector.push({
|
|
210
210
|
type: BlobStorageConnectorType.Memory
|
|
@@ -301,7 +301,7 @@ async function configureBlobStorage(coreConfig, envVars) {
|
|
|
301
301
|
options: {
|
|
302
302
|
config: {
|
|
303
303
|
vaultKeyId: (envVars.blobStorageEnableEncryption ?? false)
|
|
304
|
-
?
|
|
304
|
+
? envVars.blobStorageEncryptionKeyId
|
|
305
305
|
: undefined
|
|
306
306
|
}
|
|
307
307
|
}
|
|
@@ -315,7 +315,7 @@ async function configureBlobStorage(coreConfig, envVars) {
|
|
|
315
315
|
*/
|
|
316
316
|
async function configureLogging(coreConfig, envVars) {
|
|
317
317
|
coreConfig.types.loggingConnector ??= [];
|
|
318
|
-
const loggingConnectorTypes = (envVars.loggingConnector
|
|
318
|
+
const loggingConnectorTypes = commaSeparatedListToArray(envVars.loggingConnector);
|
|
319
319
|
let additionalConnectorCount = 0;
|
|
320
320
|
for (const loggingConnector of loggingConnectorTypes) {
|
|
321
321
|
if (loggingConnector === LoggingConnectorType.Console) {
|
|
@@ -369,7 +369,12 @@ async function configureVault(coreConfig, envVars) {
|
|
|
369
369
|
coreConfig.types.vaultConnector ??= [];
|
|
370
370
|
if (envVars.vaultConnector === VaultConnectorType.EntityStorage) {
|
|
371
371
|
coreConfig.types.vaultConnector.push({
|
|
372
|
-
type: VaultConnectorType.EntityStorage
|
|
372
|
+
type: VaultConnectorType.EntityStorage,
|
|
373
|
+
options: {
|
|
374
|
+
config: {
|
|
375
|
+
prefix: envVars.vaultPrefix
|
|
376
|
+
}
|
|
377
|
+
}
|
|
373
378
|
});
|
|
374
379
|
}
|
|
375
380
|
else if (envVars.vaultConnector === VaultConnectorType.Hashicorp) {
|
|
@@ -378,7 +383,8 @@ async function configureVault(coreConfig, envVars) {
|
|
|
378
383
|
options: {
|
|
379
384
|
config: {
|
|
380
385
|
endpoint: envVars.hashicorpVaultEndpoint ?? "",
|
|
381
|
-
token: envVars.hashicorpVaultToken ?? ""
|
|
386
|
+
token: envVars.hashicorpVaultToken ?? "",
|
|
387
|
+
prefix: envVars.vaultPrefix
|
|
382
388
|
}
|
|
383
389
|
}
|
|
384
390
|
});
|
|
@@ -390,10 +396,10 @@ async function configureVault(coreConfig, envVars) {
|
|
|
390
396
|
* @param envVars The environment variables.
|
|
391
397
|
*/
|
|
392
398
|
async function configureBackgroundTask(coreConfig, envVars) {
|
|
393
|
-
coreConfig.types.
|
|
394
|
-
if (envVars
|
|
395
|
-
coreConfig.types.
|
|
396
|
-
type:
|
|
399
|
+
coreConfig.types.backgroundTaskComponent ??= [];
|
|
400
|
+
if (isBackgroundTasksRequired(envVars)) {
|
|
401
|
+
coreConfig.types.backgroundTaskComponent.push({
|
|
402
|
+
type: BackgroundTaskComponentType.Service
|
|
397
403
|
});
|
|
398
404
|
}
|
|
399
405
|
}
|
|
@@ -426,11 +432,120 @@ async function configureTelemetry(coreConfig, envVars) {
|
|
|
426
432
|
type: TelemetryConnectorType.EntityStorage
|
|
427
433
|
});
|
|
428
434
|
}
|
|
435
|
+
else if (envVars.telemetryConnector === TelemetryConnectorType.OpenTelemetry) {
|
|
436
|
+
let readers;
|
|
437
|
+
if (envVars.openTelemetryReader === "prometheus") {
|
|
438
|
+
readers = {
|
|
439
|
+
prometheus: {
|
|
440
|
+
type: OpenTelemetryReaderTypes.Prometheus,
|
|
441
|
+
port: Coerce.integer(envVars.openTelemetryPrometheusPort)
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
coreConfig.types.telemetryConnector.push({
|
|
446
|
+
type: TelemetryConnectorType.OpenTelemetry,
|
|
447
|
+
options: {
|
|
448
|
+
config: {
|
|
449
|
+
meterName: envVars.openTelemetryMeterName,
|
|
450
|
+
meterVersion: envVars.openTelemetryMeterVersion,
|
|
451
|
+
readers
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
}
|
|
429
456
|
if (coreConfig.types.telemetryConnector.length > 0) {
|
|
430
457
|
coreConfig.types.telemetryComponent ??= [];
|
|
431
458
|
coreConfig.types.telemetryComponent.push({ type: TelemetryComponentType.Service });
|
|
432
459
|
}
|
|
433
460
|
}
|
|
461
|
+
/**
|
|
462
|
+
* Configures the metrics producers and orchestrator service.
|
|
463
|
+
* @param coreConfig The core config.
|
|
464
|
+
* @param envVars The environment variables.
|
|
465
|
+
*/
|
|
466
|
+
async function configureMetricsCollector(coreConfig, envVars) {
|
|
467
|
+
if (isTelemetryRequired(envVars)) {
|
|
468
|
+
const intervalSec = Coerce.integer(envVars.telemetryMetricsCollectorIntervalSeconds) ?? 60;
|
|
469
|
+
coreConfig.types.metricsCollectorComponent ??= [];
|
|
470
|
+
coreConfig.types.metricsCollectorComponent.push({
|
|
471
|
+
type: MetricsCollectorComponentType.Service,
|
|
472
|
+
options: { config: { intervalMs: intervalSec * 1000 } }
|
|
473
|
+
});
|
|
474
|
+
const maxHistory = Coerce.integer(envVars.telemetryMetricsProducerMaxHistory) ?? 1440;
|
|
475
|
+
coreConfig.types.metricsProducerComponent ??= [];
|
|
476
|
+
const metricsProducers = commaSeparatedListToArray(envVars.telemetryMetricsProducers ??
|
|
477
|
+
[MetricsProducerComponentType.System, MetricsProducerComponentType.Process].join(","));
|
|
478
|
+
for (const producerType of metricsProducers) {
|
|
479
|
+
coreConfig.types.metricsProducerComponent.push({
|
|
480
|
+
type: producerType,
|
|
481
|
+
options: { maxHistory }
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Configures the automation.
|
|
488
|
+
* @param coreConfig The core config.
|
|
489
|
+
* @param envVars The environment variables.
|
|
490
|
+
*/
|
|
491
|
+
async function configureAutomation(coreConfig, envVars) {
|
|
492
|
+
coreConfig.types.automationComponent ??= [];
|
|
493
|
+
if (isAutomationRequired(envVars)) {
|
|
494
|
+
coreConfig.types.automationComponent.push({
|
|
495
|
+
type: AutomationComponentType.Service
|
|
496
|
+
});
|
|
497
|
+
const automationActionTypes = commaSeparatedListToArray(envVars.automationActionTypes);
|
|
498
|
+
if (Is.arrayValue(automationActionTypes)) {
|
|
499
|
+
coreConfig.types.automationAction ??= [];
|
|
500
|
+
for (const actionType of automationActionTypes) {
|
|
501
|
+
coreConfig.types.automationAction.push({
|
|
502
|
+
type: actionType,
|
|
503
|
+
isMultiInstance: true
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Configures the health.
|
|
511
|
+
* @param coreConfig The core config.
|
|
512
|
+
* @param envVars The environment variables.
|
|
513
|
+
*/
|
|
514
|
+
async function configureHealth(coreConfig, envVars) {
|
|
515
|
+
coreConfig.types.healthComponent ??= [];
|
|
516
|
+
if (Coerce.boolean(envVars.healthEnabled) ?? false) {
|
|
517
|
+
coreConfig.types.healthComponent.push({
|
|
518
|
+
type: HealthComponentType.Service,
|
|
519
|
+
options: {
|
|
520
|
+
config: {
|
|
521
|
+
healthCheckInterval: (Coerce.integer(envVars.healthIntervalSeconds) ?? 60) * 1000,
|
|
522
|
+
initialInterval: (Coerce.integer(envVars.healthStartupIntervalSeconds) ?? 2) * 1000
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Configures the url transformer.
|
|
530
|
+
* @param coreConfig The core config.
|
|
531
|
+
* @param envVars The environment variables.
|
|
532
|
+
*/
|
|
533
|
+
async function configureUrlTransformer(coreConfig, envVars) {
|
|
534
|
+
coreConfig.types.urlTransformerComponent ??= [];
|
|
535
|
+
if (isUrlTransformerRequired(envVars) ?? false) {
|
|
536
|
+
coreConfig.types.urlTransformerComponent.push({
|
|
537
|
+
type: UrlTransformerComponentType.Service,
|
|
538
|
+
options: {
|
|
539
|
+
config: {
|
|
540
|
+
paramEncryptionKeyName: envVars.urlTransformerEncryptionKeyId,
|
|
541
|
+
queryParamNames: {
|
|
542
|
+
tenant: "tenant-token"
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
}
|
|
434
549
|
/**
|
|
435
550
|
* Configures the tenant.
|
|
436
551
|
* @param coreConfig The core config.
|
|
@@ -528,7 +643,7 @@ async function configureMessaging(coreConfig, envVars) {
|
|
|
528
643
|
accessKeyId: envVars.awsSesAccessKeyId,
|
|
529
644
|
secretAccessKey: envVars.awsSesSecretAccessKey,
|
|
530
645
|
endpoint: envVars.awsSesEndpoint,
|
|
531
|
-
applicationsSettings: Is.
|
|
646
|
+
applicationsSettings: Is.array(envVars.awsMessagingPushNotificationApplications)
|
|
532
647
|
? JSON.parse(envVars.awsMessagingPushNotificationApplications)
|
|
533
648
|
: []
|
|
534
649
|
}
|
|
@@ -617,6 +732,32 @@ async function configureNft(coreConfig, envVars) {
|
|
|
617
732
|
coreConfig.types.nftComponent.push({ type: NftComponentType.Service });
|
|
618
733
|
}
|
|
619
734
|
}
|
|
735
|
+
/**
|
|
736
|
+
* Configures the notarization.
|
|
737
|
+
* @param coreConfig The core config.
|
|
738
|
+
* @param envVars The environment variables.
|
|
739
|
+
*/
|
|
740
|
+
async function configureNotarization(coreConfig, envVars) {
|
|
741
|
+
coreConfig.types.notarizationConnector ??= [];
|
|
742
|
+
if (envVars.notarizationConnector === NotarizationConnectorType.EntityStorage) {
|
|
743
|
+
coreConfig.types.notarizationConnector.push({
|
|
744
|
+
type: NotarizationConnectorType.EntityStorage
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
else if (envVars.notarizationConnector === NotarizationConnectorType.Iota) {
|
|
748
|
+
const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
|
|
749
|
+
coreConfig.types.notarizationConnector.push({
|
|
750
|
+
type: NotarizationConnectorType.Iota,
|
|
751
|
+
options: {
|
|
752
|
+
config: dltConfig?.options?.config ?? {}
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
if (coreConfig.types.notarizationConnector.length > 0) {
|
|
757
|
+
coreConfig.types.notarizationComponent ??= [];
|
|
758
|
+
coreConfig.types.notarizationComponent.push({ type: NotarizationComponentType.Service });
|
|
759
|
+
}
|
|
760
|
+
}
|
|
620
761
|
/**
|
|
621
762
|
* Configures the verifiable storage.
|
|
622
763
|
* @param coreConfig The core config.
|
|
@@ -643,12 +784,21 @@ async function configureVerifiableStorage(coreConfig, envVars) {
|
|
|
643
784
|
coreConfig.types.verifiableStorageComponent.push({
|
|
644
785
|
type: VerifiableStorageComponentType.Service
|
|
645
786
|
});
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Configures the immutable proof.
|
|
791
|
+
* @param coreConfig The core config.
|
|
792
|
+
* @param envVars The environment variables.
|
|
793
|
+
*/
|
|
794
|
+
async function configureImmutableProof(coreConfig, envVars) {
|
|
795
|
+
if (isImmutableProofRequired(envVars)) {
|
|
646
796
|
coreConfig.types.immutableProofComponent ??= [];
|
|
647
797
|
coreConfig.types.immutableProofComponent.push({
|
|
648
798
|
type: ImmutableProofComponentType.Service,
|
|
649
799
|
options: {
|
|
650
800
|
config: {
|
|
651
|
-
verificationMethodId: envVars.immutableProofVerificationMethodId
|
|
801
|
+
verificationMethodId: envVars.immutableProofVerificationMethodId
|
|
652
802
|
}
|
|
653
803
|
}
|
|
654
804
|
});
|
|
@@ -671,7 +821,10 @@ async function configureIdentity(coreConfig, envVars) {
|
|
|
671
821
|
coreConfig.types.identityConnector.push({
|
|
672
822
|
type: IdentityConnectorType.Iota,
|
|
673
823
|
options: {
|
|
674
|
-
config:
|
|
824
|
+
config: {
|
|
825
|
+
...(dltConfig?.options?.config ?? {}),
|
|
826
|
+
walletAddressIndex: Coerce.integer(envVars.identityWalletAddressIndex) ?? 0
|
|
827
|
+
}
|
|
675
828
|
}
|
|
676
829
|
});
|
|
677
830
|
}
|
|
@@ -753,7 +906,7 @@ async function configureAttestation(coreConfig, envVars) {
|
|
|
753
906
|
type: AttestationComponentType.Service,
|
|
754
907
|
options: {
|
|
755
908
|
config: {
|
|
756
|
-
verificationMethodId: envVars.attestationVerificationMethodId
|
|
909
|
+
verificationMethodId: envVars.attestationVerificationMethodId
|
|
757
910
|
}
|
|
758
911
|
}
|
|
759
912
|
});
|
|
@@ -795,27 +948,18 @@ async function configureDataProcessing(coreConfig, envVars) {
|
|
|
795
948
|
coreConfig.types.dataProcessingComponent ??= [];
|
|
796
949
|
coreConfig.types.dataProcessingComponent.push({ type: DataProcessingComponentType.Service });
|
|
797
950
|
coreConfig.types.dataConverterConnector ??= [];
|
|
798
|
-
const converterConnectors = envVars.dataConverterConnectors
|
|
951
|
+
const converterConnectors = commaSeparatedListToArray(envVars.dataConverterConnectors);
|
|
799
952
|
for (const converterConnector of converterConnectors) {
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
});
|
|
804
|
-
}
|
|
805
|
-
else if (converterConnector === DataConverterConnectorType.Xml) {
|
|
806
|
-
coreConfig.types.dataConverterConnector.push({
|
|
807
|
-
type: DataConverterConnectorType.Xml
|
|
808
|
-
});
|
|
809
|
-
}
|
|
953
|
+
coreConfig.types.dataConverterConnector.push({
|
|
954
|
+
type: converterConnector
|
|
955
|
+
});
|
|
810
956
|
}
|
|
811
957
|
coreConfig.types.dataExtractorConnector ??= [];
|
|
812
|
-
const extractorConnectors = envVars.dataExtractorConnectors
|
|
958
|
+
const extractorConnectors = commaSeparatedListToArray(envVars.dataExtractorConnectors);
|
|
813
959
|
for (const extractorConnector of extractorConnectors) {
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
});
|
|
818
|
-
}
|
|
960
|
+
coreConfig.types.dataExtractorConnector.push({
|
|
961
|
+
type: extractorConnector
|
|
962
|
+
});
|
|
819
963
|
}
|
|
820
964
|
}
|
|
821
965
|
}
|
|
@@ -833,23 +977,36 @@ async function configureDocumentManagement(coreConfig, envVars) {
|
|
|
833
977
|
}
|
|
834
978
|
}
|
|
835
979
|
/**
|
|
836
|
-
* Configures the
|
|
980
|
+
* Configures the trust components.
|
|
837
981
|
* @param coreConfig The core config.
|
|
838
982
|
* @param envVars The environment variables.
|
|
839
983
|
*/
|
|
840
|
-
async function
|
|
841
|
-
if (
|
|
842
|
-
|
|
843
|
-
coreConfig.types.
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
984
|
+
async function configureTrust(coreConfig, envVars) {
|
|
985
|
+
if (isTrustRequired(envVars)) {
|
|
986
|
+
coreConfig.types.trustComponent ??= [];
|
|
987
|
+
coreConfig.types.trustComponent.push({
|
|
988
|
+
type: TrustComponentType.Service
|
|
989
|
+
});
|
|
990
|
+
coreConfig.types.trustGeneratorComponent ??= [];
|
|
991
|
+
const trustGeneratorTypes = commaSeparatedListToArray(envVars.trustGenerators);
|
|
992
|
+
for (const trustGeneratorType of trustGeneratorTypes) {
|
|
993
|
+
coreConfig.types.trustGeneratorComponent.push({
|
|
994
|
+
type: trustGeneratorType,
|
|
995
|
+
options: {
|
|
996
|
+
config: {
|
|
997
|
+
verificationMethodId: envVars.trustVerificationMethodId ?? "",
|
|
998
|
+
tokenTtlInSeconds: Coerce.integer(envVars.trustJwtTtlSeconds)
|
|
999
|
+
}
|
|
849
1000
|
}
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
coreConfig.types.trustVerifierComponent ??= [];
|
|
1004
|
+
const trustVerifierTypes = commaSeparatedListToArray(envVars.trustVerifiers);
|
|
1005
|
+
for (const trustVerifierType of trustVerifierTypes) {
|
|
1006
|
+
coreConfig.types.trustVerifierComponent.push({
|
|
1007
|
+
type: trustVerifierType
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
853
1010
|
}
|
|
854
1011
|
}
|
|
855
1012
|
/**
|
|
@@ -858,7 +1015,7 @@ async function configureVerifiableCredentialAuthentication(coreConfig, envVars)
|
|
|
858
1015
|
* @param envVars The environment variables.
|
|
859
1016
|
*/
|
|
860
1017
|
async function configureRightsManagement(coreConfig, envVars) {
|
|
861
|
-
if (
|
|
1018
|
+
if (isRightsManagementRequired(envVars)) {
|
|
862
1019
|
coreConfig.types.rightsManagementPapComponent ??= [];
|
|
863
1020
|
coreConfig.types.rightsManagementPapComponent.push({
|
|
864
1021
|
type: RightsManagementPapComponentType.Service
|
|
@@ -869,76 +1026,100 @@ async function configureRightsManagement(coreConfig, envVars) {
|
|
|
869
1026
|
});
|
|
870
1027
|
coreConfig.types.rightsManagementPipComponent ??= [];
|
|
871
1028
|
coreConfig.types.rightsManagementPipComponent.push({
|
|
872
|
-
type: RightsManagementPipComponentType.Service
|
|
873
|
-
options: {
|
|
874
|
-
informationModulesConfig: Is.arrayValue(envVars.rightsManagementInformationSources)
|
|
875
|
-
? envVars.rightsManagementInformationSources
|
|
876
|
-
: undefined
|
|
877
|
-
}
|
|
1029
|
+
type: RightsManagementPipComponentType.Service
|
|
878
1030
|
});
|
|
879
1031
|
coreConfig.types.rightsManagementPxpComponent ??= [];
|
|
880
1032
|
coreConfig.types.rightsManagementPxpComponent.push({
|
|
881
|
-
type: RightsManagementPxpComponentType.Service
|
|
882
|
-
options: {
|
|
883
|
-
actionModulesConfig: Is.arrayValue(envVars.rightsManagementExecutionActions)
|
|
884
|
-
? envVars.rightsManagementExecutionActions
|
|
885
|
-
: undefined
|
|
886
|
-
}
|
|
1033
|
+
type: RightsManagementPxpComponentType.Service
|
|
887
1034
|
});
|
|
888
1035
|
coreConfig.types.rightsManagementPdpComponent ??= [];
|
|
889
1036
|
coreConfig.types.rightsManagementPdpComponent.push({
|
|
890
|
-
type: RightsManagementPdpComponentType.Service
|
|
891
|
-
options: {
|
|
892
|
-
arbiterModulesConfig: Is.arrayValue(envVars.rightsManagementArbiters)
|
|
893
|
-
? envVars.rightsManagementArbiters
|
|
894
|
-
: undefined
|
|
895
|
-
}
|
|
1037
|
+
type: RightsManagementPdpComponentType.Service
|
|
896
1038
|
});
|
|
897
1039
|
coreConfig.types.rightsManagementPepComponent ??= [];
|
|
898
1040
|
coreConfig.types.rightsManagementPepComponent.push({
|
|
899
|
-
type: RightsManagementPepComponentType.Service
|
|
900
|
-
options: {
|
|
901
|
-
processorModulesConfig: Is.arrayValue(envVars.rightsManagementEnforcementProcessors)
|
|
902
|
-
? envVars.rightsManagementEnforcementProcessors
|
|
903
|
-
: undefined
|
|
904
|
-
}
|
|
1041
|
+
type: RightsManagementPepComponentType.Service
|
|
905
1042
|
});
|
|
906
1043
|
coreConfig.types.rightsManagementPnpComponent ??= [];
|
|
1044
|
+
// Single source of truth for the rights-management mount path.
|
|
1045
|
+
const rightsManagementPath = envVars.rightsManagementCallbackPath ?? "rights-management";
|
|
1046
|
+
// We add a multi instance REST client for the remote negotiations
|
|
1047
|
+
// use a dummy endpoint for now as the actual endpoint will be provided in the config
|
|
1048
|
+
// of the policy negotiator when it is used for remote negotiations
|
|
1049
|
+
// We must add it before the service as the service needs to be able to request
|
|
1050
|
+
// the REST client type from the engine core to be able to support remote negotiations
|
|
1051
|
+
coreConfig.types.rightsManagementPnpComponent.push({
|
|
1052
|
+
type: RightsManagementPnpComponentType.RestClient,
|
|
1053
|
+
options: {
|
|
1054
|
+
endpoint: "http://localhost",
|
|
1055
|
+
pathPrefix: rightsManagementPath
|
|
1056
|
+
},
|
|
1057
|
+
isMultiInstance: true,
|
|
1058
|
+
features: ["remote"]
|
|
1059
|
+
});
|
|
907
1060
|
coreConfig.types.rightsManagementPnpComponent.push({
|
|
908
1061
|
type: RightsManagementPnpComponentType.Service,
|
|
909
1062
|
options: {
|
|
910
|
-
negotiatorModulesConfig: Is.arrayValue(envVars.rightsManagementNegotiators)
|
|
911
|
-
? envVars.rightsManagementNegotiators
|
|
912
|
-
: undefined,
|
|
913
|
-
requesterModulesConfig: Is.arrayValue(envVars.rightsManagementRequesters)
|
|
914
|
-
? envVars.rightsManagementRequesters
|
|
915
|
-
: undefined,
|
|
916
1063
|
config: {
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
? envVars.rightsManagementOffers
|
|
920
|
-
: [],
|
|
921
|
-
negotiationComponentCreator: async (url) => new PolicyNegotiationPointRestClient({ endpoint: url })
|
|
1064
|
+
callbackPath: rightsManagementPath,
|
|
1065
|
+
includeErrorDetails: coreConfig.debug ?? false
|
|
922
1066
|
}
|
|
923
|
-
}
|
|
1067
|
+
},
|
|
1068
|
+
isDefault: true
|
|
924
1069
|
});
|
|
925
1070
|
coreConfig.types.rightsManagementPnapComponent ??= [];
|
|
926
1071
|
coreConfig.types.rightsManagementPnapComponent.push({
|
|
927
1072
|
type: RightsManagementPnapComponentType.Service
|
|
928
1073
|
});
|
|
929
|
-
coreConfig.types.
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1074
|
+
coreConfig.types.rightsManagementPolicyArbiterComponent ??= [];
|
|
1075
|
+
const policyArbiterTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyArbiters);
|
|
1076
|
+
for (const policyArbiterType of policyArbiterTypes) {
|
|
1077
|
+
coreConfig.types.rightsManagementPolicyArbiterComponent.push({
|
|
1078
|
+
type: policyArbiterType
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
coreConfig.types.rightsManagementPolicyObligationEnforcerComponent ??= [];
|
|
1082
|
+
const policyObligationEnforcerTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyObligationEnforcers);
|
|
1083
|
+
for (const policyObligationEnforcerType of policyObligationEnforcerTypes) {
|
|
1084
|
+
coreConfig.types.rightsManagementPolicyObligationEnforcerComponent.push({
|
|
1085
|
+
type: policyObligationEnforcerType
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
coreConfig.types.rightsManagementPolicyEnforcementProcessorComponent ??= [];
|
|
1089
|
+
const policyEnforcementProcessTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyEnforcementProcessors);
|
|
1090
|
+
for (const policyEnforcementProcessorType of policyEnforcementProcessTypes) {
|
|
1091
|
+
coreConfig.types.rightsManagementPolicyEnforcementProcessorComponent.push({
|
|
1092
|
+
type: policyEnforcementProcessorType
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
coreConfig.types.rightsManagementPolicyExecutionActionComponent ??= [];
|
|
1096
|
+
const policyExecutionActionTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyExecutionActions);
|
|
1097
|
+
for (const policyExecutionActionType of policyExecutionActionTypes) {
|
|
1098
|
+
coreConfig.types.rightsManagementPolicyExecutionActionComponent.push({
|
|
1099
|
+
type: policyExecutionActionType
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
coreConfig.types.rightsManagementPolicyInformationSourceComponent ??= [];
|
|
1103
|
+
const policyInformationSourceTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyInformationSources);
|
|
1104
|
+
for (const policyInformationSourceType of policyInformationSourceTypes) {
|
|
1105
|
+
coreConfig.types.rightsManagementPolicyInformationSourceComponent.push({
|
|
1106
|
+
type: policyInformationSourceType
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
coreConfig.types.rightsManagementPolicyRequesterComponent ??= [];
|
|
1110
|
+
const policyRequesterTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyRequesters);
|
|
1111
|
+
for (const policyRequesterType of policyRequesterTypes) {
|
|
1112
|
+
coreConfig.types.rightsManagementPolicyRequesterComponent.push({
|
|
1113
|
+
type: policyRequesterType
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
coreConfig.types.rightsManagementPolicyNegotiatorComponent ??= [];
|
|
1117
|
+
const policyNegotiatorTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyNegotiators);
|
|
1118
|
+
for (const policyNegotiatorType of policyNegotiatorTypes) {
|
|
1119
|
+
coreConfig.types.rightsManagementPolicyNegotiatorComponent.push({
|
|
1120
|
+
type: policyNegotiatorType
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
942
1123
|
}
|
|
943
1124
|
}
|
|
944
1125
|
/**
|
|
@@ -947,7 +1128,7 @@ async function configureRightsManagement(coreConfig, envVars) {
|
|
|
947
1128
|
* @param envVars The environment variables.
|
|
948
1129
|
*/
|
|
949
1130
|
async function configureTaskScheduler(coreConfig, envVars) {
|
|
950
|
-
if (
|
|
1131
|
+
if (isTaskSchedulerRequired(envVars)) {
|
|
951
1132
|
coreConfig.types.taskSchedulerComponent ??= [];
|
|
952
1133
|
coreConfig.types.taskSchedulerComponent.push({
|
|
953
1134
|
type: TaskSchedulerComponentType.Service
|
|
@@ -974,8 +1155,7 @@ async function configureSynchronisedStorage(coreConfig, envVars) {
|
|
|
974
1155
|
options: {
|
|
975
1156
|
config: {
|
|
976
1157
|
verifiableStorageKeyId: verifiableStorageKeyId ?? "",
|
|
977
|
-
blobStorageEncryptionKeyId: envVars.synchronisedStorageBlobStorageEncryptionKeyId
|
|
978
|
-
SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID,
|
|
1158
|
+
blobStorageEncryptionKeyId: envVars.synchronisedStorageBlobStorageEncryptionKeyId,
|
|
979
1159
|
entityUpdateIntervalMinutes: Coerce.number(envVars.synchronisedStorageEntityUpdateIntervalMinutes),
|
|
980
1160
|
consolidationIntervalMinutes: Coerce.number(envVars.synchronisedStorageConsolidationIntervalMinutes),
|
|
981
1161
|
consolidationBatchSize: Coerce.number(envVars.synchronisedStorageConsolidationBatchSize),
|
|
@@ -1003,33 +1183,68 @@ async function configureSynchronisedStorage(coreConfig, envVars) {
|
|
|
1003
1183
|
* @param envVars The environment variables.
|
|
1004
1184
|
*/
|
|
1005
1185
|
async function configureFederatedCatalogue(coreConfig, envVars) {
|
|
1006
|
-
if (
|
|
1186
|
+
if (isFederatedCatalogueRequired(envVars)) {
|
|
1187
|
+
// If synchronised storage is enabled, then we need to add an entity storage connector
|
|
1188
|
+
// using synchronised storage for the federated catalogue component
|
|
1189
|
+
// as it relies on the synchronised storage to sync the data between the different instances of the federated catalogue
|
|
1190
|
+
let overrideEntityStorageType;
|
|
1191
|
+
if ((Coerce.boolean(envVars.synchronisedStorageEnabled) ?? false) &&
|
|
1192
|
+
Is.arrayValue(coreConfig.types.entityStorageConnector)) {
|
|
1193
|
+
let defaultConnector = coreConfig.types.entityStorageConnector.find(connector => connector.isDefault);
|
|
1194
|
+
if (Is.empty(defaultConnector)) {
|
|
1195
|
+
// If there is no default connector, we set the first one as the default one
|
|
1196
|
+
defaultConnector = coreConfig.types.entityStorageConnector[0];
|
|
1197
|
+
}
|
|
1198
|
+
overrideEntityStorageType = "federated-catalogue-dataset";
|
|
1199
|
+
coreConfig.types.entityStorageConnector ??= [];
|
|
1200
|
+
coreConfig.types.entityStorageConnector.push({
|
|
1201
|
+
type: EntityStorageConnectorType.Synchronised,
|
|
1202
|
+
overrideInstanceType: overrideEntityStorageType,
|
|
1203
|
+
options: {
|
|
1204
|
+
entityStorageConnectorType: defaultConnector.type
|
|
1205
|
+
}
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1007
1208
|
coreConfig.types.federatedCatalogueComponent ??= [];
|
|
1008
1209
|
coreConfig.types.federatedCatalogueComponent.push({
|
|
1009
1210
|
type: FederatedCatalogueComponentType.Service,
|
|
1010
1211
|
options: {
|
|
1011
|
-
|
|
1012
|
-
subResourceCacheTtlMs: Coerce.number(envVars.federatedCatalogueCacheTtlMs),
|
|
1013
|
-
clearingHouseApproverList: Coerce.object(envVars.federatedCatalogueClearingHouseApproverList) ?? []
|
|
1014
|
-
}
|
|
1212
|
+
datasetEntityStorageType: overrideEntityStorageType
|
|
1015
1213
|
}
|
|
1016
1214
|
});
|
|
1215
|
+
coreConfig.types.federatedCatalogueFilterComponent ??= [];
|
|
1216
|
+
const filters = commaSeparatedListToArray(envVars.federatedCatalogueFilters);
|
|
1217
|
+
for (const filter of filters) {
|
|
1218
|
+
coreConfig.types.federatedCatalogueFilterComponent.push({
|
|
1219
|
+
type: filter,
|
|
1220
|
+
options: {}
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1017
1223
|
}
|
|
1018
1224
|
}
|
|
1019
1225
|
/**
|
|
1020
|
-
* Configures the data
|
|
1226
|
+
* Configures the dataspace control plane and data plane.
|
|
1021
1227
|
* @param coreConfig The core config.
|
|
1022
1228
|
* @param envVars The environment variables.
|
|
1023
1229
|
*/
|
|
1024
|
-
async function
|
|
1025
|
-
if (Coerce.boolean(envVars.
|
|
1026
|
-
coreConfig.types.
|
|
1027
|
-
coreConfig.types.
|
|
1028
|
-
type:
|
|
1230
|
+
async function configureDataspace(coreConfig, envVars) {
|
|
1231
|
+
if (Coerce.boolean(envVars.dataspaceEnabled) ?? false) {
|
|
1232
|
+
coreConfig.types.dataspaceControlPlaneComponent ??= [];
|
|
1233
|
+
coreConfig.types.dataspaceControlPlaneComponent.push({
|
|
1234
|
+
type: DataspaceControlPlaneComponentType.Service,
|
|
1235
|
+
options: {
|
|
1236
|
+
config: {
|
|
1237
|
+
dataPlanePath: envVars.dataspaceDataPlanePath
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
});
|
|
1241
|
+
coreConfig.types.dataspaceDataPlaneComponent ??= [];
|
|
1242
|
+
coreConfig.types.dataspaceDataPlaneComponent.push({
|
|
1243
|
+
type: DataspaceDataPlaneComponentType.Service,
|
|
1029
1244
|
options: {
|
|
1030
1245
|
config: {
|
|
1031
|
-
retainActivityLogsFor: Coerce.number(envVars.
|
|
1032
|
-
activityLogsCleanUpInterval: Coerce.number(envVars.
|
|
1246
|
+
retainActivityLogsFor: Coerce.number(envVars.dataspaceRetainActivityLogsFor),
|
|
1247
|
+
activityLogsCleanUpInterval: Coerce.number(envVars.dataspaceActivityLogsCleanUpInterval)
|
|
1033
1248
|
}
|
|
1034
1249
|
}
|
|
1035
1250
|
});
|
|
@@ -1067,4 +1282,106 @@ async function configureDlt(coreConfig, envVars) {
|
|
|
1067
1282
|
});
|
|
1068
1283
|
}
|
|
1069
1284
|
}
|
|
1285
|
+
/**
|
|
1286
|
+
* Converts a comma separated list to an array.
|
|
1287
|
+
* @param value The comma separated list.
|
|
1288
|
+
* @returns The array.
|
|
1289
|
+
*/
|
|
1290
|
+
function commaSeparatedListToArray(value) {
|
|
1291
|
+
return (value ?? "")
|
|
1292
|
+
.split(",")
|
|
1293
|
+
.map(item => item.trim())
|
|
1294
|
+
.filter(item => item.length > 0);
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* Checks if the trust subsystem is required.
|
|
1298
|
+
* Returns true when any component that depends on the trust subsystem is enabled.
|
|
1299
|
+
* @param envVars The environment variables.
|
|
1300
|
+
* @returns True if rights-management, synchronised-storage, or dataspace is enabled.
|
|
1301
|
+
*/
|
|
1302
|
+
export function isTrustRequired(envVars) {
|
|
1303
|
+
return (isRightsManagementRequired(envVars) ||
|
|
1304
|
+
(Coerce.boolean(envVars.dataspaceEnabled) ?? false) ||
|
|
1305
|
+
(Coerce.boolean(envVars.synchronisedStorageEnabled) ?? false));
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* Checks if the URL transformer subsystem is required.
|
|
1309
|
+
* Returns true when any component that depends on the URL transformer subsystem is enabled.
|
|
1310
|
+
* @param envVars The environment variables.
|
|
1311
|
+
* @returns True if rights-management, dataspace, federated-catalogue, or tenant is enabled.
|
|
1312
|
+
*/
|
|
1313
|
+
export function isUrlTransformerRequired(envVars) {
|
|
1314
|
+
return (isRightsManagementRequired(envVars) ||
|
|
1315
|
+
(Coerce.boolean(envVars.dataspaceEnabled) ?? false) ||
|
|
1316
|
+
(Coerce.boolean(envVars.tenantEnabled) ?? false) ||
|
|
1317
|
+
isFederatedCatalogueRequired(envVars));
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Checks if the background tasks subsystem is required.
|
|
1321
|
+
* Returns true when any component that depends on the background tasks subsystem is enabled.
|
|
1322
|
+
* @param envVars The environment variables.
|
|
1323
|
+
* @returns True if dataspace or verifiable storage is enabled.
|
|
1324
|
+
*/
|
|
1325
|
+
export function isBackgroundTasksRequired(envVars) {
|
|
1326
|
+
return (Coerce.boolean(envVars.dataspaceEnabled) ?? false) || isImmutableProofRequired(envVars);
|
|
1327
|
+
}
|
|
1328
|
+
/**
|
|
1329
|
+
* Checks if the immutable proof subsystem is required.
|
|
1330
|
+
* Returns true when any component that depends on the immutable proof subsystem is enabled.
|
|
1331
|
+
* @param envVars The environment variables.
|
|
1332
|
+
* @returns True if verifiable storage is enabled.
|
|
1333
|
+
*/
|
|
1334
|
+
export function isImmutableProofRequired(envVars) {
|
|
1335
|
+
return (envVars.verifiableStorageConnector === VerifiableStorageConnectorType.EntityStorage ||
|
|
1336
|
+
envVars.verifiableStorageConnector === VerifiableStorageConnectorType.Iota);
|
|
1337
|
+
}
|
|
1338
|
+
/**
|
|
1339
|
+
* Checks if the immutable proof subsystem is required.
|
|
1340
|
+
* Returns true when any component that depends on the immutable proof subsystem is enabled.
|
|
1341
|
+
* @param envVars The environment variables.
|
|
1342
|
+
* @returns True if verifiable storage is enabled.
|
|
1343
|
+
*/
|
|
1344
|
+
export function isFederatedCatalogueRequired(envVars) {
|
|
1345
|
+
return Coerce.boolean(envVars.dataspaceEnabled) ?? false;
|
|
1346
|
+
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Checks if the rights management subsystem is required.
|
|
1349
|
+
* Returns true when any component that depends on the rights management subsystem is enabled.
|
|
1350
|
+
* @param envVars The environment variables.
|
|
1351
|
+
* @returns True if rights management is enabled.
|
|
1352
|
+
*/
|
|
1353
|
+
export function isRightsManagementRequired(envVars) {
|
|
1354
|
+
return Coerce.boolean(envVars.dataspaceEnabled) ?? false;
|
|
1355
|
+
}
|
|
1356
|
+
/**
|
|
1357
|
+
* Checks if the task scheduler subsystem is required.
|
|
1358
|
+
* Returns true when any component that depends on the task scheduler subsystem is enabled.
|
|
1359
|
+
* @param envVars The environment variables.
|
|
1360
|
+
* @returns True if task scheduler is enabled.
|
|
1361
|
+
*/
|
|
1362
|
+
export function isTaskSchedulerRequired(envVars) {
|
|
1363
|
+
return ((Coerce.boolean(envVars.dataspaceEnabled) ?? false) ||
|
|
1364
|
+
(Coerce.boolean(envVars.synchronisedStorageEnabled) ?? false) ||
|
|
1365
|
+
isRightsManagementRequired(envVars) ||
|
|
1366
|
+
isAuthEntityStorageRequired(envVars));
|
|
1367
|
+
}
|
|
1368
|
+
/**
|
|
1369
|
+
* Checks if the automation subsystem is required.
|
|
1370
|
+
* Returns true when any component that depends on the automation subsystem is enabled.
|
|
1371
|
+
* @param envVars The environment variables.
|
|
1372
|
+
* @returns True if automation is enabled.
|
|
1373
|
+
*/
|
|
1374
|
+
export function isAutomationRequired(envVars) {
|
|
1375
|
+
return isRightsManagementRequired(envVars);
|
|
1376
|
+
}
|
|
1377
|
+
/**
|
|
1378
|
+
* Checks if the telemetry subsystem is required.
|
|
1379
|
+
* Returns true when any component that depends on the telemetry subsystem is enabled.
|
|
1380
|
+
* @param envVars The environment variables.
|
|
1381
|
+
* @returns True if telemetry is enabled.
|
|
1382
|
+
*/
|
|
1383
|
+
export function isTelemetryRequired(envVars) {
|
|
1384
|
+
return (envVars.telemetryConnector === TelemetryConnectorType.EntityStorage ||
|
|
1385
|
+
envVars.telemetryConnector === TelemetryConnectorType.OpenTelemetry);
|
|
1386
|
+
}
|
|
1070
1387
|
//# sourceMappingURL=engineEnvBuilder.js.map
|