@twin.org/node-core 0.0.3-next.3 → 0.0.3-next.30
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 +194 -123
- package/dist/es/builders/engineEnvBuilder.js.map +1 -1
- package/dist/es/builders/engineServerEnvBuilder.js +51 -23
- package/dist/es/builders/engineServerEnvBuilder.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 +186 -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 +316 -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 +212 -0
- package/dist/es/commands/userCreate.js.map +1 -0
- package/dist/es/commands/userUpdate.js +132 -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 +17 -1
- package/dist/es/defaults.js.map +1 -1
- package/dist/es/index.js +7 -3
- 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/node.js +84 -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 +1 -1
- package/dist/types/builders/engineServerEnvBuilder.d.ts +4 -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 +49 -0
- package/dist/types/commands/userUpdate.d.ts +38 -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 +9 -1
- package/dist/types/index.d.ts +7 -3
- 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 +72 -56
- package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +4 -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/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 +199 -1
- 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/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 +14 -12
- 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 +349 -313
- package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +434 -370
- package/docs/reference/interfaces/IModuleProtocol.md +3 -3
- package/docs/reference/interfaces/INodeEngineState.md +4 -20
- package/docs/reference/interfaces/INodeEnvironmentVariables.md +448 -464
- 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/locales/en.json +589 -30
- package/package.json +6 -4
- package/dist/es/bootstrap.js +0 -360
- package/dist/es/bootstrap.js.map +0 -1
- package/dist/es/identity.js +0 -169
- package/dist/es/identity.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/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
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# TWIN Node Core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package provides the shared runtime foundation for hosting service workloads in a Node.js environment. It brings together reusable server capabilities, command tooling support, and integration patterns that help teams run API driven workloads with consistent behaviour.
|
|
4
|
+
|
|
5
|
+
By centralising this functionality, the package reduces duplication across applications and creates a stable base for extension as platform needs evolve. It is designed to support reliable day to day operation while keeping implementation concerns clear and maintainable.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
@@ -2,9 +2,8 @@
|
|
|
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 { 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, BackgroundTaskComponentType, BlobStorageComponentType, BlobStorageConnectorType, ContextIdHandlerComponentType, DataProcessingComponentType, DataspaceControlPlaneComponentType, DataspaceDataPlaneComponentType, DltConfigType, DocumentManagementComponentType, EngineTypeHelper, EntityStorageConnectorType, EventBusComponentType, EventBusConnectorType, FaucetConnectorType, FederatedCatalogueComponentType, IdentityComponentType, IdentityConnectorType, IdentityProfileComponentType, IdentityProfileConnectorType, IdentityResolverComponentType, IdentityResolverConnectorType, ImmutableProofComponentType, LoggingComponentType, LoggingConnectorType, MessagingAdminComponentType, MessagingComponentType, MessagingEmailConnectorType, MessagingPushNotificationConnectorType, MessagingSmsConnectorType, NftComponentType, NftConnectorType, RightsManagementPapComponentType, RightsManagementPdpComponentType, RightsManagementPepComponentType, RightsManagementPipComponentType, RightsManagementPmpComponentType, RightsManagementPnapComponentType, RightsManagementPnpComponentType, RightsManagementPxpComponentType, SynchronisedStorageComponentType, TaskSchedulerComponentType, TelemetryComponentType, TelemetryConnectorType, TenantAdminComponentType, TrustComponentType, VaultConnectorType, VerifiableStorageComponentType, VerifiableStorageConnectorType, WalletConnectorType } from "@twin.org/engine-types";
|
|
6
|
+
import { CONTEXT_ID_HANDLER_FEATURE_DID, CONTEXT_ID_HANDLER_FEATURE_TENANT } from "../defaults.js";
|
|
8
7
|
/**
|
|
9
8
|
* Build the engine core configuration from environment variables.
|
|
10
9
|
* @param envVars The environment variables.
|
|
@@ -19,6 +18,7 @@ export async function buildEngineConfiguration(envVars, contextIdKeys) {
|
|
|
19
18
|
}
|
|
20
19
|
const coreConfig = {
|
|
21
20
|
debug: Coerce.boolean(envVars.debug) ?? false,
|
|
21
|
+
silent: Coerce.boolean(envVars.silent) ?? false,
|
|
22
22
|
types: {}
|
|
23
23
|
};
|
|
24
24
|
await configureTenant(coreConfig, envVars);
|
|
@@ -45,11 +45,11 @@ export async function buildEngineConfiguration(envVars, contextIdKeys) {
|
|
|
45
45
|
await configureAuditableItemGraph(coreConfig, envVars);
|
|
46
46
|
await configureAuditableItemStream(coreConfig, envVars);
|
|
47
47
|
await configureDocumentManagement(coreConfig, envVars);
|
|
48
|
-
await
|
|
48
|
+
await configureTrust(coreConfig, envVars);
|
|
49
49
|
await configureRightsManagement(coreConfig, envVars);
|
|
50
50
|
await configureSynchronisedStorage(coreConfig, envVars);
|
|
51
51
|
await configureFederatedCatalogue(coreConfig, envVars);
|
|
52
|
-
await
|
|
52
|
+
await configureDataspace(coreConfig, envVars);
|
|
53
53
|
return coreConfig;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
@@ -60,7 +60,7 @@ export async function buildEngineConfiguration(envVars, contextIdKeys) {
|
|
|
60
60
|
async function configureEntityStorage(coreConfig, envVars) {
|
|
61
61
|
coreConfig.types ??= {};
|
|
62
62
|
coreConfig.types.entityStorageConnector ??= [];
|
|
63
|
-
const entityStorageConnectorTypes = envVars.entityStorageConnectorType
|
|
63
|
+
const entityStorageConnectorTypes = commaSeparatedListToArray(envVars.entityStorageConnectorType);
|
|
64
64
|
if (entityStorageConnectorTypes.includes(EntityStorageConnectorType.Memory)) {
|
|
65
65
|
coreConfig.types.entityStorageConnector.push({
|
|
66
66
|
type: EntityStorageConnectorType.Memory
|
|
@@ -84,7 +84,8 @@ async function configureEntityStorage(coreConfig, envVars) {
|
|
|
84
84
|
authMode: envVars.awsDynamodbAuthMode,
|
|
85
85
|
accessKeyId: envVars.awsDynamodbAccessKeyId,
|
|
86
86
|
secretAccessKey: envVars.awsDynamodbSecretAccessKey,
|
|
87
|
-
endpoint: envVars.awsDynamodbEndpoint
|
|
87
|
+
endpoint: envVars.awsDynamodbEndpoint,
|
|
88
|
+
connectionTimeoutMs: Coerce.integer(envVars.awsDynamodbConnectionTimeoutMs)
|
|
88
89
|
},
|
|
89
90
|
tablePrefix: envVars.entityStorageTablePrefix
|
|
90
91
|
}
|
|
@@ -124,7 +125,7 @@ async function configureEntityStorage(coreConfig, envVars) {
|
|
|
124
125
|
type: EntityStorageConnectorType.ScyllaDb,
|
|
125
126
|
options: {
|
|
126
127
|
config: {
|
|
127
|
-
hosts: envVars.scylladbHosts
|
|
128
|
+
hosts: commaSeparatedListToArray(envVars.scylladbHosts),
|
|
128
129
|
localDataCenter: envVars.scylladbLocalDataCenter ?? "",
|
|
129
130
|
keyspace: envVars.scylladbKeyspace ?? "",
|
|
130
131
|
port: Coerce.integer(envVars.scylladbPort)
|
|
@@ -179,15 +180,6 @@ async function configureEntityStorage(coreConfig, envVars) {
|
|
|
179
180
|
});
|
|
180
181
|
}
|
|
181
182
|
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
183
|
if (Is.arrayValue(entityStorageConnectorTypes)) {
|
|
192
184
|
for (const config of coreConfig.types.entityStorageConnector) {
|
|
193
185
|
if (config.type === defaultEntityStorageConnectorType) {
|
|
@@ -204,7 +196,7 @@ async function configureEntityStorage(coreConfig, envVars) {
|
|
|
204
196
|
*/
|
|
205
197
|
async function configureBlobStorage(coreConfig, envVars) {
|
|
206
198
|
coreConfig.types.blobStorageConnector ??= [];
|
|
207
|
-
const blobStorageConnectorTypes = envVars.blobStorageConnectorType
|
|
199
|
+
const blobStorageConnectorTypes = commaSeparatedListToArray(envVars.blobStorageConnectorType);
|
|
208
200
|
if (blobStorageConnectorTypes.includes(BlobStorageConnectorType.Memory)) {
|
|
209
201
|
coreConfig.types.blobStorageConnector.push({
|
|
210
202
|
type: BlobStorageConnectorType.Memory
|
|
@@ -301,7 +293,7 @@ async function configureBlobStorage(coreConfig, envVars) {
|
|
|
301
293
|
options: {
|
|
302
294
|
config: {
|
|
303
295
|
vaultKeyId: (envVars.blobStorageEnableEncryption ?? false)
|
|
304
|
-
?
|
|
296
|
+
? envVars.blobStorageEncryptionKeyId
|
|
305
297
|
: undefined
|
|
306
298
|
}
|
|
307
299
|
}
|
|
@@ -315,7 +307,7 @@ async function configureBlobStorage(coreConfig, envVars) {
|
|
|
315
307
|
*/
|
|
316
308
|
async function configureLogging(coreConfig, envVars) {
|
|
317
309
|
coreConfig.types.loggingConnector ??= [];
|
|
318
|
-
const loggingConnectorTypes = (envVars.loggingConnector
|
|
310
|
+
const loggingConnectorTypes = commaSeparatedListToArray(envVars.loggingConnector);
|
|
319
311
|
let additionalConnectorCount = 0;
|
|
320
312
|
for (const loggingConnector of loggingConnectorTypes) {
|
|
321
313
|
if (loggingConnector === LoggingConnectorType.Console) {
|
|
@@ -369,7 +361,12 @@ async function configureVault(coreConfig, envVars) {
|
|
|
369
361
|
coreConfig.types.vaultConnector ??= [];
|
|
370
362
|
if (envVars.vaultConnector === VaultConnectorType.EntityStorage) {
|
|
371
363
|
coreConfig.types.vaultConnector.push({
|
|
372
|
-
type: VaultConnectorType.EntityStorage
|
|
364
|
+
type: VaultConnectorType.EntityStorage,
|
|
365
|
+
options: {
|
|
366
|
+
config: {
|
|
367
|
+
prefix: envVars.vaultPrefix
|
|
368
|
+
}
|
|
369
|
+
}
|
|
373
370
|
});
|
|
374
371
|
}
|
|
375
372
|
else if (envVars.vaultConnector === VaultConnectorType.Hashicorp) {
|
|
@@ -378,7 +375,8 @@ async function configureVault(coreConfig, envVars) {
|
|
|
378
375
|
options: {
|
|
379
376
|
config: {
|
|
380
377
|
endpoint: envVars.hashicorpVaultEndpoint ?? "",
|
|
381
|
-
token: envVars.hashicorpVaultToken ?? ""
|
|
378
|
+
token: envVars.hashicorpVaultToken ?? "",
|
|
379
|
+
prefix: envVars.vaultPrefix
|
|
382
380
|
}
|
|
383
381
|
}
|
|
384
382
|
});
|
|
@@ -390,10 +388,10 @@ async function configureVault(coreConfig, envVars) {
|
|
|
390
388
|
* @param envVars The environment variables.
|
|
391
389
|
*/
|
|
392
390
|
async function configureBackgroundTask(coreConfig, envVars) {
|
|
393
|
-
coreConfig.types.
|
|
394
|
-
if (envVars.
|
|
395
|
-
coreConfig.types.
|
|
396
|
-
type:
|
|
391
|
+
coreConfig.types.backgroundTaskComponent ??= [];
|
|
392
|
+
if (Coerce.boolean(envVars.backgroundTasksEnabled) ?? false) {
|
|
393
|
+
coreConfig.types.backgroundTaskComponent.push({
|
|
394
|
+
type: BackgroundTaskComponentType.Service
|
|
397
395
|
});
|
|
398
396
|
}
|
|
399
397
|
}
|
|
@@ -528,7 +526,7 @@ async function configureMessaging(coreConfig, envVars) {
|
|
|
528
526
|
accessKeyId: envVars.awsSesAccessKeyId,
|
|
529
527
|
secretAccessKey: envVars.awsSesSecretAccessKey,
|
|
530
528
|
endpoint: envVars.awsSesEndpoint,
|
|
531
|
-
applicationsSettings: Is.
|
|
529
|
+
applicationsSettings: Is.array(envVars.awsMessagingPushNotificationApplications)
|
|
532
530
|
? JSON.parse(envVars.awsMessagingPushNotificationApplications)
|
|
533
531
|
: []
|
|
534
532
|
}
|
|
@@ -648,7 +646,7 @@ async function configureVerifiableStorage(coreConfig, envVars) {
|
|
|
648
646
|
type: ImmutableProofComponentType.Service,
|
|
649
647
|
options: {
|
|
650
648
|
config: {
|
|
651
|
-
verificationMethodId: envVars.immutableProofVerificationMethodId
|
|
649
|
+
verificationMethodId: envVars.immutableProofVerificationMethodId
|
|
652
650
|
}
|
|
653
651
|
}
|
|
654
652
|
});
|
|
@@ -671,7 +669,10 @@ async function configureIdentity(coreConfig, envVars) {
|
|
|
671
669
|
coreConfig.types.identityConnector.push({
|
|
672
670
|
type: IdentityConnectorType.Iota,
|
|
673
671
|
options: {
|
|
674
|
-
config:
|
|
672
|
+
config: {
|
|
673
|
+
...(dltConfig?.options?.config ?? {}),
|
|
674
|
+
walletAddressIndex: Coerce.integer(envVars.identityWalletAddressIndex) ?? 0
|
|
675
|
+
}
|
|
675
676
|
}
|
|
676
677
|
});
|
|
677
678
|
}
|
|
@@ -753,7 +754,7 @@ async function configureAttestation(coreConfig, envVars) {
|
|
|
753
754
|
type: AttestationComponentType.Service,
|
|
754
755
|
options: {
|
|
755
756
|
config: {
|
|
756
|
-
verificationMethodId: envVars.attestationVerificationMethodId
|
|
757
|
+
verificationMethodId: envVars.attestationVerificationMethodId
|
|
757
758
|
}
|
|
758
759
|
}
|
|
759
760
|
});
|
|
@@ -795,27 +796,18 @@ async function configureDataProcessing(coreConfig, envVars) {
|
|
|
795
796
|
coreConfig.types.dataProcessingComponent ??= [];
|
|
796
797
|
coreConfig.types.dataProcessingComponent.push({ type: DataProcessingComponentType.Service });
|
|
797
798
|
coreConfig.types.dataConverterConnector ??= [];
|
|
798
|
-
const converterConnectors = envVars.dataConverterConnectors
|
|
799
|
+
const converterConnectors = commaSeparatedListToArray(envVars.dataConverterConnectors);
|
|
799
800
|
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
|
-
}
|
|
801
|
+
coreConfig.types.dataConverterConnector.push({
|
|
802
|
+
type: converterConnector
|
|
803
|
+
});
|
|
810
804
|
}
|
|
811
805
|
coreConfig.types.dataExtractorConnector ??= [];
|
|
812
|
-
const extractorConnectors = envVars.dataExtractorConnectors
|
|
806
|
+
const extractorConnectors = commaSeparatedListToArray(envVars.dataExtractorConnectors);
|
|
813
807
|
for (const extractorConnector of extractorConnectors) {
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
});
|
|
818
|
-
}
|
|
808
|
+
coreConfig.types.dataExtractorConnector.push({
|
|
809
|
+
type: extractorConnector
|
|
810
|
+
});
|
|
819
811
|
}
|
|
820
812
|
}
|
|
821
813
|
}
|
|
@@ -833,23 +825,36 @@ async function configureDocumentManagement(coreConfig, envVars) {
|
|
|
833
825
|
}
|
|
834
826
|
}
|
|
835
827
|
/**
|
|
836
|
-
* Configures the
|
|
828
|
+
* Configures the trust components.
|
|
837
829
|
* @param coreConfig The core config.
|
|
838
830
|
* @param envVars The environment variables.
|
|
839
831
|
*/
|
|
840
|
-
async function
|
|
841
|
-
if (Coerce.boolean(envVars.
|
|
842
|
-
|
|
843
|
-
coreConfig.types.
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
832
|
+
async function configureTrust(coreConfig, envVars) {
|
|
833
|
+
if (Coerce.boolean(envVars.trustEnabled) ?? false) {
|
|
834
|
+
coreConfig.types.trustComponent ??= [];
|
|
835
|
+
coreConfig.types.trustComponent.push({
|
|
836
|
+
type: TrustComponentType.Service
|
|
837
|
+
});
|
|
838
|
+
coreConfig.types.trustGeneratorComponent ??= [];
|
|
839
|
+
const trustGeneratorTypes = commaSeparatedListToArray(envVars.trustGenerators);
|
|
840
|
+
for (const trustGeneratorType of trustGeneratorTypes) {
|
|
841
|
+
coreConfig.types.trustGeneratorComponent.push({
|
|
842
|
+
type: trustGeneratorType,
|
|
843
|
+
options: {
|
|
844
|
+
config: {
|
|
845
|
+
verificationMethodId: envVars.trustVerificationMethodId ?? "",
|
|
846
|
+
tokenTtlInSeconds: Coerce.integer(envVars.trustJwtTtlSeconds)
|
|
847
|
+
}
|
|
849
848
|
}
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
coreConfig.types.trustVerifierComponent ??= [];
|
|
852
|
+
const trustVerifierTypes = commaSeparatedListToArray(envVars.trustVerifiers);
|
|
853
|
+
for (const trustVerifierType of trustVerifierTypes) {
|
|
854
|
+
coreConfig.types.trustVerifierComponent.push({
|
|
855
|
+
type: trustVerifierType
|
|
856
|
+
});
|
|
857
|
+
}
|
|
853
858
|
}
|
|
854
859
|
}
|
|
855
860
|
/**
|
|
@@ -869,76 +874,97 @@ async function configureRightsManagement(coreConfig, envVars) {
|
|
|
869
874
|
});
|
|
870
875
|
coreConfig.types.rightsManagementPipComponent ??= [];
|
|
871
876
|
coreConfig.types.rightsManagementPipComponent.push({
|
|
872
|
-
type: RightsManagementPipComponentType.Service
|
|
873
|
-
options: {
|
|
874
|
-
informationModulesConfig: Is.arrayValue(envVars.rightsManagementInformationSources)
|
|
875
|
-
? envVars.rightsManagementInformationSources
|
|
876
|
-
: undefined
|
|
877
|
-
}
|
|
877
|
+
type: RightsManagementPipComponentType.Service
|
|
878
878
|
});
|
|
879
879
|
coreConfig.types.rightsManagementPxpComponent ??= [];
|
|
880
880
|
coreConfig.types.rightsManagementPxpComponent.push({
|
|
881
|
-
type: RightsManagementPxpComponentType.Service
|
|
882
|
-
options: {
|
|
883
|
-
actionModulesConfig: Is.arrayValue(envVars.rightsManagementExecutionActions)
|
|
884
|
-
? envVars.rightsManagementExecutionActions
|
|
885
|
-
: undefined
|
|
886
|
-
}
|
|
881
|
+
type: RightsManagementPxpComponentType.Service
|
|
887
882
|
});
|
|
888
883
|
coreConfig.types.rightsManagementPdpComponent ??= [];
|
|
889
884
|
coreConfig.types.rightsManagementPdpComponent.push({
|
|
890
|
-
type: RightsManagementPdpComponentType.Service
|
|
891
|
-
options: {
|
|
892
|
-
arbiterModulesConfig: Is.arrayValue(envVars.rightsManagementArbiters)
|
|
893
|
-
? envVars.rightsManagementArbiters
|
|
894
|
-
: undefined
|
|
895
|
-
}
|
|
885
|
+
type: RightsManagementPdpComponentType.Service
|
|
896
886
|
});
|
|
897
887
|
coreConfig.types.rightsManagementPepComponent ??= [];
|
|
898
888
|
coreConfig.types.rightsManagementPepComponent.push({
|
|
899
|
-
type: RightsManagementPepComponentType.Service
|
|
900
|
-
options: {
|
|
901
|
-
processorModulesConfig: Is.arrayValue(envVars.rightsManagementEnforcementProcessors)
|
|
902
|
-
? envVars.rightsManagementEnforcementProcessors
|
|
903
|
-
: undefined
|
|
904
|
-
}
|
|
889
|
+
type: RightsManagementPepComponentType.Service
|
|
905
890
|
});
|
|
906
891
|
coreConfig.types.rightsManagementPnpComponent ??= [];
|
|
892
|
+
// We add a multi instance REST client for the remote negotiations
|
|
893
|
+
// use a dummy endpoint for now as the actual endpoint will be provided in the config
|
|
894
|
+
// of the policy negotiator when it is used for remote negotiations
|
|
895
|
+
// We must add it before the service as the service needs to be able to request
|
|
896
|
+
// the REST client type from the engine core to be able to support remote negotiations
|
|
897
|
+
coreConfig.types.rightsManagementPnpComponent.push({
|
|
898
|
+
type: RightsManagementPnpComponentType.RestClient,
|
|
899
|
+
options: {
|
|
900
|
+
endpoint: "http://localhost"
|
|
901
|
+
},
|
|
902
|
+
isMultiInstance: true,
|
|
903
|
+
features: ["remote"]
|
|
904
|
+
});
|
|
907
905
|
coreConfig.types.rightsManagementPnpComponent.push({
|
|
908
906
|
type: RightsManagementPnpComponentType.Service,
|
|
909
907
|
options: {
|
|
910
|
-
negotiatorModulesConfig: Is.arrayValue(envVars.rightsManagementNegotiators)
|
|
911
|
-
? envVars.rightsManagementNegotiators
|
|
912
|
-
: undefined,
|
|
913
|
-
requesterModulesConfig: Is.arrayValue(envVars.rightsManagementRequesters)
|
|
914
|
-
? envVars.rightsManagementRequesters
|
|
915
|
-
: undefined,
|
|
916
908
|
config: {
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
? envVars.rightsManagementOffers
|
|
920
|
-
: [],
|
|
921
|
-
negotiationComponentCreator: async (url) => new PolicyNegotiationPointRestClient({ endpoint: url })
|
|
909
|
+
callbackPath: envVars.rightsManagementCallbackPath ?? "",
|
|
910
|
+
includeErrorDetails: coreConfig.debug ?? false
|
|
922
911
|
}
|
|
923
|
-
}
|
|
912
|
+
},
|
|
913
|
+
isDefault: true
|
|
924
914
|
});
|
|
925
915
|
coreConfig.types.rightsManagementPnapComponent ??= [];
|
|
926
916
|
coreConfig.types.rightsManagementPnapComponent.push({
|
|
927
917
|
type: RightsManagementPnapComponentType.Service
|
|
928
918
|
});
|
|
929
|
-
coreConfig.types.
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
919
|
+
coreConfig.types.rightsManagementPolicyArbiterComponent ??= [];
|
|
920
|
+
const policyArbiterTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyArbiters);
|
|
921
|
+
for (const policyArbiterType of policyArbiterTypes) {
|
|
922
|
+
coreConfig.types.rightsManagementPolicyArbiterComponent.push({
|
|
923
|
+
type: policyArbiterType
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
coreConfig.types.rightsManagementPolicyObligationEnforcerComponent ??= [];
|
|
927
|
+
const policyObligationEnforcerTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyObligationEnforcers);
|
|
928
|
+
for (const policyObligationEnforcerType of policyObligationEnforcerTypes) {
|
|
929
|
+
coreConfig.types.rightsManagementPolicyObligationEnforcerComponent.push({
|
|
930
|
+
type: policyObligationEnforcerType
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
coreConfig.types.rightsManagementPolicyEnforcementProcessorComponent ??= [];
|
|
934
|
+
const policyEnforcementProcessTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyEnforcementProcessors);
|
|
935
|
+
for (const policyEnforcementProcessorType of policyEnforcementProcessTypes) {
|
|
936
|
+
coreConfig.types.rightsManagementPolicyEnforcementProcessorComponent.push({
|
|
937
|
+
type: policyEnforcementProcessorType
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
coreConfig.types.rightsManagementPolicyExecutionActionComponent ??= [];
|
|
941
|
+
const policyExecutionActionTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyExecutionActions);
|
|
942
|
+
for (const policyExecutionActionType of policyExecutionActionTypes) {
|
|
943
|
+
coreConfig.types.rightsManagementPolicyExecutionActionComponent.push({
|
|
944
|
+
type: policyExecutionActionType
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
coreConfig.types.rightsManagementPolicyInformationSourceComponent ??= [];
|
|
948
|
+
const policyInformationSourceTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyInformationSources);
|
|
949
|
+
for (const policyInformationSourceType of policyInformationSourceTypes) {
|
|
950
|
+
coreConfig.types.rightsManagementPolicyInformationSourceComponent.push({
|
|
951
|
+
type: policyInformationSourceType
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
coreConfig.types.rightsManagementPolicyRequesterComponent ??= [];
|
|
955
|
+
const policyRequesterTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyRequesters);
|
|
956
|
+
for (const policyRequesterType of policyRequesterTypes) {
|
|
957
|
+
coreConfig.types.rightsManagementPolicyRequesterComponent.push({
|
|
958
|
+
type: policyRequesterType
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
coreConfig.types.rightsManagementPolicyNegotiatorComponent ??= [];
|
|
962
|
+
const policyNegotiatorTypes = commaSeparatedListToArray(envVars.rightsManagementPolicyNegotiators);
|
|
963
|
+
for (const policyNegotiatorType of policyNegotiatorTypes) {
|
|
964
|
+
coreConfig.types.rightsManagementPolicyNegotiatorComponent.push({
|
|
965
|
+
type: policyNegotiatorType
|
|
966
|
+
});
|
|
967
|
+
}
|
|
942
968
|
}
|
|
943
969
|
}
|
|
944
970
|
/**
|
|
@@ -974,8 +1000,7 @@ async function configureSynchronisedStorage(coreConfig, envVars) {
|
|
|
974
1000
|
options: {
|
|
975
1001
|
config: {
|
|
976
1002
|
verifiableStorageKeyId: verifiableStorageKeyId ?? "",
|
|
977
|
-
blobStorageEncryptionKeyId: envVars.synchronisedStorageBlobStorageEncryptionKeyId
|
|
978
|
-
SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID,
|
|
1003
|
+
blobStorageEncryptionKeyId: envVars.synchronisedStorageBlobStorageEncryptionKeyId,
|
|
979
1004
|
entityUpdateIntervalMinutes: Coerce.number(envVars.synchronisedStorageEntityUpdateIntervalMinutes),
|
|
980
1005
|
consolidationIntervalMinutes: Coerce.number(envVars.synchronisedStorageConsolidationIntervalMinutes),
|
|
981
1006
|
consolidationBatchSize: Coerce.number(envVars.synchronisedStorageConsolidationBatchSize),
|
|
@@ -1004,32 +1029,67 @@ async function configureSynchronisedStorage(coreConfig, envVars) {
|
|
|
1004
1029
|
*/
|
|
1005
1030
|
async function configureFederatedCatalogue(coreConfig, envVars) {
|
|
1006
1031
|
if (Coerce.boolean(envVars.federatedCatalogueEnabled) ?? false) {
|
|
1032
|
+
// If synchronised storage is enabled, then we need to add an entity storage connector
|
|
1033
|
+
// using synchronised storage for the federated catalogue component
|
|
1034
|
+
// as it relies on the synchronised storage to sync the data between the different instances of the federated catalogue
|
|
1035
|
+
let overrideEntityStorageType;
|
|
1036
|
+
if ((Coerce.boolean(envVars.synchronisedStorageEnabled) ?? false) &&
|
|
1037
|
+
Is.arrayValue(coreConfig.types.entityStorageConnector)) {
|
|
1038
|
+
let defaultConnector = coreConfig.types.entityStorageConnector.find(connector => connector.isDefault);
|
|
1039
|
+
if (Is.empty(defaultConnector)) {
|
|
1040
|
+
// If there is no default connector, we set the first one as the default one
|
|
1041
|
+
defaultConnector = coreConfig.types.entityStorageConnector[0];
|
|
1042
|
+
}
|
|
1043
|
+
overrideEntityStorageType = "federated-catalogue-dataset";
|
|
1044
|
+
coreConfig.types.entityStorageConnector ??= [];
|
|
1045
|
+
coreConfig.types.entityStorageConnector.push({
|
|
1046
|
+
type: EntityStorageConnectorType.Synchronised,
|
|
1047
|
+
overrideInstanceType: overrideEntityStorageType,
|
|
1048
|
+
options: {
|
|
1049
|
+
entityStorageConnectorType: defaultConnector.type
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1007
1053
|
coreConfig.types.federatedCatalogueComponent ??= [];
|
|
1008
1054
|
coreConfig.types.federatedCatalogueComponent.push({
|
|
1009
1055
|
type: FederatedCatalogueComponentType.Service,
|
|
1010
1056
|
options: {
|
|
1011
|
-
|
|
1012
|
-
subResourceCacheTtlMs: Coerce.number(envVars.federatedCatalogueCacheTtlMs),
|
|
1013
|
-
clearingHouseApproverList: Coerce.object(envVars.federatedCatalogueClearingHouseApproverList) ?? []
|
|
1014
|
-
}
|
|
1057
|
+
datasetEntityStorageType: overrideEntityStorageType
|
|
1015
1058
|
}
|
|
1016
1059
|
});
|
|
1060
|
+
coreConfig.types.federatedCatalogueFilterComponent ??= [];
|
|
1061
|
+
const filters = commaSeparatedListToArray(envVars.federatedCatalogueFilters);
|
|
1062
|
+
for (const filter of filters) {
|
|
1063
|
+
coreConfig.types.federatedCatalogueFilterComponent.push({
|
|
1064
|
+
type: filter,
|
|
1065
|
+
options: {}
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1017
1068
|
}
|
|
1018
1069
|
}
|
|
1019
1070
|
/**
|
|
1020
|
-
* Configures the data
|
|
1071
|
+
* Configures the dataspace control plane and data plane.
|
|
1021
1072
|
* @param coreConfig The core config.
|
|
1022
1073
|
* @param envVars The environment variables.
|
|
1023
1074
|
*/
|
|
1024
|
-
async function
|
|
1025
|
-
if (Coerce.boolean(envVars.
|
|
1026
|
-
coreConfig.types.
|
|
1027
|
-
coreConfig.types.
|
|
1028
|
-
type:
|
|
1075
|
+
async function configureDataspace(coreConfig, envVars) {
|
|
1076
|
+
if (Coerce.boolean(envVars.dataspaceEnabled) ?? false) {
|
|
1077
|
+
coreConfig.types.dataspaceControlPlaneComponent ??= [];
|
|
1078
|
+
coreConfig.types.dataspaceControlPlaneComponent.push({
|
|
1079
|
+
type: DataspaceControlPlaneComponentType.Service,
|
|
1080
|
+
options: {
|
|
1081
|
+
config: {
|
|
1082
|
+
dataPlanePath: envVars.dataspaceDataPlanePath
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
});
|
|
1086
|
+
coreConfig.types.dataspaceDataPlaneComponent ??= [];
|
|
1087
|
+
coreConfig.types.dataspaceDataPlaneComponent.push({
|
|
1088
|
+
type: DataspaceDataPlaneComponentType.Service,
|
|
1029
1089
|
options: {
|
|
1030
1090
|
config: {
|
|
1031
|
-
retainActivityLogsFor: Coerce.number(envVars.
|
|
1032
|
-
activityLogsCleanUpInterval: Coerce.number(envVars.
|
|
1091
|
+
retainActivityLogsFor: Coerce.number(envVars.dataspaceRetainActivityLogsFor),
|
|
1092
|
+
activityLogsCleanUpInterval: Coerce.number(envVars.dataspaceActivityLogsCleanUpInterval)
|
|
1033
1093
|
}
|
|
1034
1094
|
}
|
|
1035
1095
|
});
|
|
@@ -1067,4 +1127,15 @@ async function configureDlt(coreConfig, envVars) {
|
|
|
1067
1127
|
});
|
|
1068
1128
|
}
|
|
1069
1129
|
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Converts a comma separated list to an array.
|
|
1132
|
+
* @param value The comma separated list.
|
|
1133
|
+
* @returns The array.
|
|
1134
|
+
*/
|
|
1135
|
+
function commaSeparatedListToArray(value) {
|
|
1136
|
+
return (value ?? "")
|
|
1137
|
+
.split(",")
|
|
1138
|
+
.map(item => item.trim())
|
|
1139
|
+
.filter(item => item.length > 0);
|
|
1140
|
+
}
|
|
1070
1141
|
//# sourceMappingURL=engineEnvBuilder.js.map
|