@twin.org/node-core 0.0.3-next.34 → 0.0.3-next.36
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/dist/es/builders/engineEnvBuilder.js +132 -10
- package/dist/es/builders/engineEnvBuilder.js.map +1 -1
- package/dist/es/builders/engineServerEnvBuilder.js +18 -2
- package/dist/es/builders/engineServerEnvBuilder.js.map +1 -1
- package/dist/es/commands/bootstrapLegacy.js +28 -23
- package/dist/es/commands/bootstrapLegacy.js.map +1 -1
- package/dist/es/commands/identityCreate.js +11 -1
- package/dist/es/commands/identityCreate.js.map +1 -1
- package/dist/es/commands/identityVerificationMethodImport.js +1 -1
- package/dist/es/commands/identityVerificationMethodImport.js.map +1 -1
- package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -1
- package/dist/es/models/IEngineServerEnvironmentVariables.js.map +1 -1
- package/dist/es/node.js +6 -2
- package/dist/es/node.js.map +1 -1
- package/dist/types/builders/engineEnvBuilder.d.ts +56 -0
- package/dist/types/builders/engineServerEnvBuilder.d.ts +7 -0
- package/dist/types/models/IEngineEnvironmentVariables.d.ts +26 -27
- package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +4 -0
- package/docs/changelog.md +18 -2
- 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/isTrustRequired.md +20 -0
- package/docs/reference/functions/isUrlTransformerRequired.md +20 -0
- package/docs/reference/index.md +9 -0
- package/docs/reference/interfaces/IEngineEnvironmentVariables.md +43 -52
- package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +68 -77
- package/docs/reference/interfaces/INodeEnvironmentVariables.md +72 -77
- package/package.json +5 -4
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { Coerce, Is } from "@twin.org/core";
|
|
5
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, 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";
|
|
6
7
|
import { CONTEXT_ID_HANDLER_FEATURE_DID, CONTEXT_ID_HANDLER_FEATURE_TENANT } from "../defaults.js";
|
|
8
|
+
import { isAuthEntityStorageRequired } from "./engineServerEnvBuilder.js";
|
|
7
9
|
/**
|
|
8
10
|
* Build the engine core configuration from environment variables.
|
|
9
11
|
* @param envVars The environment variables.
|
|
@@ -41,6 +43,7 @@ export async function buildEngineConfiguration(envVars, contextIdKeys) {
|
|
|
41
43
|
await configureNft(coreConfig, envVars);
|
|
42
44
|
await configureNotarization(coreConfig, envVars);
|
|
43
45
|
await configureVerifiableStorage(coreConfig, envVars);
|
|
46
|
+
await configureImmutableProof(coreConfig, envVars);
|
|
44
47
|
await configureIdentity(coreConfig, envVars);
|
|
45
48
|
await configureIdentityResolver(coreConfig, envVars);
|
|
46
49
|
await configureIdentityProfile(coreConfig, envVars);
|
|
@@ -393,7 +396,7 @@ async function configureVault(coreConfig, envVars) {
|
|
|
393
396
|
*/
|
|
394
397
|
async function configureBackgroundTask(coreConfig, envVars) {
|
|
395
398
|
coreConfig.types.backgroundTaskComponent ??= [];
|
|
396
|
-
if (
|
|
399
|
+
if (isBackgroundTasksRequired(envVars)) {
|
|
397
400
|
coreConfig.types.backgroundTaskComponent.push({
|
|
398
401
|
type: BackgroundTaskComponentType.Service
|
|
399
402
|
});
|
|
@@ -428,6 +431,27 @@ async function configureTelemetry(coreConfig, envVars) {
|
|
|
428
431
|
type: TelemetryConnectorType.EntityStorage
|
|
429
432
|
});
|
|
430
433
|
}
|
|
434
|
+
else if (envVars.telemetryConnector === TelemetryConnectorType.OpenTelemetry) {
|
|
435
|
+
let readers;
|
|
436
|
+
if (envVars.openTelemetryReader === "prometheus") {
|
|
437
|
+
readers = {
|
|
438
|
+
prometheus: {
|
|
439
|
+
type: OpenTelemetryReaderTypes.Prometheus,
|
|
440
|
+
port: Coerce.integer(envVars.openTelemetryPrometheusPort)
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
coreConfig.types.telemetryConnector.push({
|
|
445
|
+
type: TelemetryConnectorType.OpenTelemetry,
|
|
446
|
+
options: {
|
|
447
|
+
config: {
|
|
448
|
+
meterName: envVars.openTelemetryMeterName,
|
|
449
|
+
meterVersion: envVars.openTelemetryMeterVersion,
|
|
450
|
+
readers
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
}
|
|
431
455
|
if (coreConfig.types.telemetryConnector.length > 0) {
|
|
432
456
|
coreConfig.types.telemetryComponent ??= [];
|
|
433
457
|
coreConfig.types.telemetryComponent.push({ type: TelemetryComponentType.Service });
|
|
@@ -440,7 +464,7 @@ async function configureTelemetry(coreConfig, envVars) {
|
|
|
440
464
|
*/
|
|
441
465
|
async function configureAutomation(coreConfig, envVars) {
|
|
442
466
|
coreConfig.types.automationComponent ??= [];
|
|
443
|
-
if (
|
|
467
|
+
if (isAutomationRequired(envVars)) {
|
|
444
468
|
coreConfig.types.automationComponent.push({
|
|
445
469
|
type: AutomationComponentType.Service
|
|
446
470
|
});
|
|
@@ -465,7 +489,12 @@ async function configureHealth(coreConfig, envVars) {
|
|
|
465
489
|
coreConfig.types.healthComponent ??= [];
|
|
466
490
|
if (Coerce.boolean(envVars.healthEnabled) ?? false) {
|
|
467
491
|
coreConfig.types.healthComponent.push({
|
|
468
|
-
type: HealthComponentType.Service
|
|
492
|
+
type: HealthComponentType.Service,
|
|
493
|
+
options: {
|
|
494
|
+
config: {
|
|
495
|
+
healthCheckInterval: (Coerce.integer(envVars.healthIntervalSeconds) ?? 60) * 1000
|
|
496
|
+
}
|
|
497
|
+
}
|
|
469
498
|
});
|
|
470
499
|
}
|
|
471
500
|
}
|
|
@@ -476,7 +505,7 @@ async function configureHealth(coreConfig, envVars) {
|
|
|
476
505
|
*/
|
|
477
506
|
async function configureUrlTransformer(coreConfig, envVars) {
|
|
478
507
|
coreConfig.types.urlTransformerComponent ??= [];
|
|
479
|
-
if (
|
|
508
|
+
if (isUrlTransformerRequired(envVars) ?? false) {
|
|
480
509
|
coreConfig.types.urlTransformerComponent.push({
|
|
481
510
|
type: UrlTransformerComponentType.Service,
|
|
482
511
|
options: {
|
|
@@ -728,6 +757,15 @@ async function configureVerifiableStorage(coreConfig, envVars) {
|
|
|
728
757
|
coreConfig.types.verifiableStorageComponent.push({
|
|
729
758
|
type: VerifiableStorageComponentType.Service
|
|
730
759
|
});
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Configures the immutable proof.
|
|
764
|
+
* @param coreConfig The core config.
|
|
765
|
+
* @param envVars The environment variables.
|
|
766
|
+
*/
|
|
767
|
+
async function configureImmutableProof(coreConfig, envVars) {
|
|
768
|
+
if (isImmutableProofRequired(envVars)) {
|
|
731
769
|
coreConfig.types.immutableProofComponent ??= [];
|
|
732
770
|
coreConfig.types.immutableProofComponent.push({
|
|
733
771
|
type: ImmutableProofComponentType.Service,
|
|
@@ -917,7 +955,7 @@ async function configureDocumentManagement(coreConfig, envVars) {
|
|
|
917
955
|
* @param envVars The environment variables.
|
|
918
956
|
*/
|
|
919
957
|
async function configureTrust(coreConfig, envVars) {
|
|
920
|
-
if (
|
|
958
|
+
if (isTrustRequired(envVars)) {
|
|
921
959
|
coreConfig.types.trustComponent ??= [];
|
|
922
960
|
coreConfig.types.trustComponent.push({
|
|
923
961
|
type: TrustComponentType.Service
|
|
@@ -950,7 +988,7 @@ async function configureTrust(coreConfig, envVars) {
|
|
|
950
988
|
* @param envVars The environment variables.
|
|
951
989
|
*/
|
|
952
990
|
async function configureRightsManagement(coreConfig, envVars) {
|
|
953
|
-
if (
|
|
991
|
+
if (isRightsManagementRequired(envVars)) {
|
|
954
992
|
coreConfig.types.rightsManagementPapComponent ??= [];
|
|
955
993
|
coreConfig.types.rightsManagementPapComponent.push({
|
|
956
994
|
type: RightsManagementPapComponentType.Service
|
|
@@ -976,6 +1014,8 @@ async function configureRightsManagement(coreConfig, envVars) {
|
|
|
976
1014
|
type: RightsManagementPepComponentType.Service
|
|
977
1015
|
});
|
|
978
1016
|
coreConfig.types.rightsManagementPnpComponent ??= [];
|
|
1017
|
+
// Single source of truth for the rights-management mount path.
|
|
1018
|
+
const rightsManagementPath = envVars.rightsManagementCallbackPath ?? "rights-management";
|
|
979
1019
|
// We add a multi instance REST client for the remote negotiations
|
|
980
1020
|
// use a dummy endpoint for now as the actual endpoint will be provided in the config
|
|
981
1021
|
// of the policy negotiator when it is used for remote negotiations
|
|
@@ -984,7 +1024,8 @@ async function configureRightsManagement(coreConfig, envVars) {
|
|
|
984
1024
|
coreConfig.types.rightsManagementPnpComponent.push({
|
|
985
1025
|
type: RightsManagementPnpComponentType.RestClient,
|
|
986
1026
|
options: {
|
|
987
|
-
endpoint: "http://localhost"
|
|
1027
|
+
endpoint: "http://localhost",
|
|
1028
|
+
pathPrefix: rightsManagementPath
|
|
988
1029
|
},
|
|
989
1030
|
isMultiInstance: true,
|
|
990
1031
|
features: ["remote"]
|
|
@@ -993,7 +1034,7 @@ async function configureRightsManagement(coreConfig, envVars) {
|
|
|
993
1034
|
type: RightsManagementPnpComponentType.Service,
|
|
994
1035
|
options: {
|
|
995
1036
|
config: {
|
|
996
|
-
callbackPath:
|
|
1037
|
+
callbackPath: rightsManagementPath,
|
|
997
1038
|
includeErrorDetails: coreConfig.debug ?? false
|
|
998
1039
|
}
|
|
999
1040
|
},
|
|
@@ -1060,7 +1101,7 @@ async function configureRightsManagement(coreConfig, envVars) {
|
|
|
1060
1101
|
* @param envVars The environment variables.
|
|
1061
1102
|
*/
|
|
1062
1103
|
async function configureTaskScheduler(coreConfig, envVars) {
|
|
1063
|
-
if (
|
|
1104
|
+
if (isTaskSchedulerRequired(envVars)) {
|
|
1064
1105
|
coreConfig.types.taskSchedulerComponent ??= [];
|
|
1065
1106
|
coreConfig.types.taskSchedulerComponent.push({
|
|
1066
1107
|
type: TaskSchedulerComponentType.Service
|
|
@@ -1115,7 +1156,7 @@ async function configureSynchronisedStorage(coreConfig, envVars) {
|
|
|
1115
1156
|
* @param envVars The environment variables.
|
|
1116
1157
|
*/
|
|
1117
1158
|
async function configureFederatedCatalogue(coreConfig, envVars) {
|
|
1118
|
-
if (
|
|
1159
|
+
if (isFederatedCatalogueRequired(envVars)) {
|
|
1119
1160
|
// If synchronised storage is enabled, then we need to add an entity storage connector
|
|
1120
1161
|
// using synchronised storage for the federated catalogue component
|
|
1121
1162
|
// as it relies on the synchronised storage to sync the data between the different instances of the federated catalogue
|
|
@@ -1225,4 +1266,85 @@ function commaSeparatedListToArray(value) {
|
|
|
1225
1266
|
.map(item => item.trim())
|
|
1226
1267
|
.filter(item => item.length > 0);
|
|
1227
1268
|
}
|
|
1269
|
+
/**
|
|
1270
|
+
* Checks if the trust subsystem is required.
|
|
1271
|
+
* Returns true when any component that depends on the trust subsystem is enabled.
|
|
1272
|
+
* @param envVars The environment variables.
|
|
1273
|
+
* @returns True if rights-management, synchronised-storage, or dataspace is enabled.
|
|
1274
|
+
*/
|
|
1275
|
+
export function isTrustRequired(envVars) {
|
|
1276
|
+
return (isRightsManagementRequired(envVars) ||
|
|
1277
|
+
(Coerce.boolean(envVars.dataspaceEnabled) ?? false) ||
|
|
1278
|
+
(Coerce.boolean(envVars.synchronisedStorageEnabled) ?? false));
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Checks if the URL transformer subsystem is required.
|
|
1282
|
+
* Returns true when any component that depends on the URL transformer subsystem is enabled.
|
|
1283
|
+
* @param envVars The environment variables.
|
|
1284
|
+
* @returns True if rights-management, dataspace, federated-catalogue, or tenant is enabled.
|
|
1285
|
+
*/
|
|
1286
|
+
export function isUrlTransformerRequired(envVars) {
|
|
1287
|
+
return (isRightsManagementRequired(envVars) ||
|
|
1288
|
+
(Coerce.boolean(envVars.dataspaceEnabled) ?? false) ||
|
|
1289
|
+
(Coerce.boolean(envVars.tenantEnabled) ?? false) ||
|
|
1290
|
+
isFederatedCatalogueRequired(envVars));
|
|
1291
|
+
}
|
|
1292
|
+
/**
|
|
1293
|
+
* Checks if the background tasks subsystem is required.
|
|
1294
|
+
* Returns true when any component that depends on the background tasks subsystem is enabled.
|
|
1295
|
+
* @param envVars The environment variables.
|
|
1296
|
+
* @returns True if dataspace or verifiable storage is enabled.
|
|
1297
|
+
*/
|
|
1298
|
+
export function isBackgroundTasksRequired(envVars) {
|
|
1299
|
+
return (Coerce.boolean(envVars.dataspaceEnabled) ?? false) || isImmutableProofRequired(envVars);
|
|
1300
|
+
}
|
|
1301
|
+
/**
|
|
1302
|
+
* Checks if the immutable proof subsystem is required.
|
|
1303
|
+
* Returns true when any component that depends on the immutable proof subsystem is enabled.
|
|
1304
|
+
* @param envVars The environment variables.
|
|
1305
|
+
* @returns True if verifiable storage is enabled.
|
|
1306
|
+
*/
|
|
1307
|
+
export function isImmutableProofRequired(envVars) {
|
|
1308
|
+
return (envVars.verifiableStorageConnector === VerifiableStorageConnectorType.EntityStorage ||
|
|
1309
|
+
envVars.verifiableStorageConnector === VerifiableStorageConnectorType.Iota);
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Checks if the immutable proof subsystem is required.
|
|
1313
|
+
* Returns true when any component that depends on the immutable proof subsystem is enabled.
|
|
1314
|
+
* @param envVars The environment variables.
|
|
1315
|
+
* @returns True if verifiable storage is enabled.
|
|
1316
|
+
*/
|
|
1317
|
+
export function isFederatedCatalogueRequired(envVars) {
|
|
1318
|
+
return Coerce.boolean(envVars.dataspaceEnabled) ?? false;
|
|
1319
|
+
}
|
|
1320
|
+
/**
|
|
1321
|
+
* Checks if the rights management subsystem is required.
|
|
1322
|
+
* Returns true when any component that depends on the rights management subsystem is enabled.
|
|
1323
|
+
* @param envVars The environment variables.
|
|
1324
|
+
* @returns True if rights management is enabled.
|
|
1325
|
+
*/
|
|
1326
|
+
export function isRightsManagementRequired(envVars) {
|
|
1327
|
+
return Coerce.boolean(envVars.dataspaceEnabled) ?? false;
|
|
1328
|
+
}
|
|
1329
|
+
/**
|
|
1330
|
+
* Checks if the task scheduler subsystem is required.
|
|
1331
|
+
* Returns true when any component that depends on the task scheduler subsystem is enabled.
|
|
1332
|
+
* @param envVars The environment variables.
|
|
1333
|
+
* @returns True if task scheduler is enabled.
|
|
1334
|
+
*/
|
|
1335
|
+
export function isTaskSchedulerRequired(envVars) {
|
|
1336
|
+
return ((Coerce.boolean(envVars.dataspaceEnabled) ?? false) ||
|
|
1337
|
+
(Coerce.boolean(envVars.synchronisedStorageEnabled) ?? false) ||
|
|
1338
|
+
isRightsManagementRequired(envVars) ||
|
|
1339
|
+
isAuthEntityStorageRequired(envVars));
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* Checks if the automation subsystem is required.
|
|
1343
|
+
* Returns true when any component that depends on the automation subsystem is enabled.
|
|
1344
|
+
* @param envVars The environment variables.
|
|
1345
|
+
* @returns True if automation is enabled.
|
|
1346
|
+
*/
|
|
1347
|
+
export function isAutomationRequired(envVars) {
|
|
1348
|
+
return isRightsManagementRequired(envVars);
|
|
1349
|
+
}
|
|
1228
1350
|
//# sourceMappingURL=engineEnvBuilder.js.map
|