@twin.org/node-core 0.0.3-next.49 → 0.0.3-next.50
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 +40 -123
- package/dist/es/builders/engineEnvBuilder.js.map +1 -1
- package/dist/es/commands/bootstrapLegacy.js +1 -13
- package/dist/es/commands/bootstrapLegacy.js.map +1 -1
- package/dist/es/defaults.js +0 -2
- package/dist/es/defaults.js.map +1 -1
- package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -1
- package/dist/es/node.js +1 -1
- package/dist/es/node.js.map +1 -1
- package/dist/types/builders/engineEnvBuilder.d.ts +1 -1
- package/dist/types/defaults.d.ts +0 -1
- package/dist/types/models/IEngineEnvironmentVariables.d.ts +14 -54
- package/docs/changelog.md +7 -0
- package/docs/reference/functions/isTrustRequired.md +1 -1
- package/docs/reference/index.md +0 -1
- package/docs/reference/interfaces/IEngineEnvironmentVariables.md +25 -117
- package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +36 -160
- package/docs/reference/interfaces/INodeEnvironmentVariables.md +36 -160
- package/locales/en.json +0 -1
- package/package.json +1 -1
- package/docs/reference/variables/SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID.md +0 -3
|
@@ -2,7 +2,7 @@
|
|
|
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, 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,
|
|
5
|
+
import { AttestationComponentType, AttestationConnectorType, AuditableItemGraphComponentType, AuditableItemStreamComponentType, AutomationComponentType, BackgroundTaskComponentType, BlobStorageComponentType, BlobStorageConnectorType, ContextIdHandlerComponentType, DataProcessingComponentType, DataspaceControlPlaneComponentType, DataspaceDataPlaneComponentType, DltConfigType, DocumentManagementComponentType, EngineTypeHelper, EntityStorageConnectorType, EventBusComponentType, EventBusConnectorType, FaucetConnectorType, FederatedCatalogueComponentType, HealthComponentType, IdentityComponentType, IdentityConnectorType, IdentityProfileComponentType, IdentityProfileConnectorType, IdentityResolverComponentType, IdentityResolverConnectorType, ImmutableProofComponentType, LoggingComponentType, LoggingConnectorType, MessagingAdminComponentType, MessagingComponentType, MessagingEmailConnectorType, MessagingPushNotificationConnectorType, MessagingSmsConnectorType, MetricsCollectorComponentType, MetricsProducerComponentType, NftComponentType, NftConnectorType, NotarizationComponentType, NotarizationConnectorType, RightsManagementPapComponentType, RightsManagementPdpComponentType, RightsManagementPepComponentType, RightsManagementPipComponentType, RightsManagementPmpComponentType, RightsManagementPnapComponentType, RightsManagementPnpComponentType, RightsManagementPxpComponentType, TaskSchedulerComponentType, TelemetryComponentType, TelemetryConnectorType, TenantAdminComponentType, TenantComponentType, TrustComponentType, TrustVerifierComponentType, UrlTransformerComponentType, VaultConnectorType, WalletConnectorType } from "@twin.org/engine-types";
|
|
6
6
|
import { OpenTelemetryReaderTypes } from "@twin.org/telemetry-connector-opentelemetry";
|
|
7
7
|
import { CONTEXT_ID_HANDLER_FEATURE_DID, CONTEXT_ID_HANDLER_FEATURE_TENANT } from "../defaults.js";
|
|
8
8
|
import { isAuthEntityStorageRequired } from "./engineServerEnvBuilder.js";
|
|
@@ -43,7 +43,6 @@ export async function buildEngineConfiguration(envVars, contextIdKeys) {
|
|
|
43
43
|
await configureWallet(coreConfig, envVars);
|
|
44
44
|
await configureNft(coreConfig, envVars);
|
|
45
45
|
await configureNotarization(coreConfig, envVars);
|
|
46
|
-
await configureVerifiableStorage(coreConfig, envVars);
|
|
47
46
|
await configureImmutableProof(coreConfig, envVars);
|
|
48
47
|
await configureIdentity(coreConfig, envVars);
|
|
49
48
|
await configureIdentityResolver(coreConfig, envVars);
|
|
@@ -55,7 +54,6 @@ export async function buildEngineConfiguration(envVars, contextIdKeys) {
|
|
|
55
54
|
await configureDocumentManagement(coreConfig, envVars);
|
|
56
55
|
await configureTrust(coreConfig, envVars);
|
|
57
56
|
await configureRightsManagement(coreConfig, envVars);
|
|
58
|
-
await configureSynchronisedStorage(coreConfig, envVars);
|
|
59
57
|
await configureFederatedCatalogue(coreConfig, envVars);
|
|
60
58
|
await configureDataspace(coreConfig, envVars);
|
|
61
59
|
return coreConfig;
|
|
@@ -284,14 +282,6 @@ async function configureBlobStorage(coreConfig, envVars) {
|
|
|
284
282
|
if (config.type === defaultStorageConnectorType) {
|
|
285
283
|
config.isDefault = true;
|
|
286
284
|
}
|
|
287
|
-
// If this blob storage connector is the one to use for public access
|
|
288
|
-
// then add it as a feature
|
|
289
|
-
if (Is.stringValue(envVars.blobStorageConnectorPublic) &&
|
|
290
|
-
config.type === envVars.blobStorageConnectorPublic) {
|
|
291
|
-
config.features ??= [];
|
|
292
|
-
config.features.push("public");
|
|
293
|
-
break;
|
|
294
|
-
}
|
|
295
285
|
}
|
|
296
286
|
}
|
|
297
287
|
if (coreConfig.types.blobStorageConnector.length > 0) {
|
|
@@ -764,40 +754,6 @@ async function configureNotarization(coreConfig, envVars) {
|
|
|
764
754
|
coreConfig.types.notarizationComponent.push({ type: NotarizationComponentType.Service });
|
|
765
755
|
}
|
|
766
756
|
}
|
|
767
|
-
/**
|
|
768
|
-
* Configures the verifiable storage.
|
|
769
|
-
* @param coreConfig The core config.
|
|
770
|
-
* @param envVars The environment variables.
|
|
771
|
-
*/
|
|
772
|
-
async function configureVerifiableStorage(coreConfig, envVars) {
|
|
773
|
-
coreConfig.types.verifiableStorageConnector ??= [];
|
|
774
|
-
if (envVars.verifiableStorageConnector === VerifiableStorageConnectorType.EntityStorage) {
|
|
775
|
-
coreConfig.types.verifiableStorageConnector.push({
|
|
776
|
-
type: VerifiableStorageConnectorType.EntityStorage
|
|
777
|
-
});
|
|
778
|
-
}
|
|
779
|
-
else if (envVars.verifiableStorageConnector === VerifiableStorageConnectorType.Iota) {
|
|
780
|
-
const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
|
|
781
|
-
const config = {
|
|
782
|
-
...dltConfig?.options?.config,
|
|
783
|
-
deploymentPkgId: Is.stringValue(envVars.verifiableStoragePackageId)
|
|
784
|
-
? envVars.verifiableStoragePackageId
|
|
785
|
-
: undefined
|
|
786
|
-
};
|
|
787
|
-
coreConfig.types.verifiableStorageConnector.push({
|
|
788
|
-
type: VerifiableStorageConnectorType.Iota,
|
|
789
|
-
options: {
|
|
790
|
-
config
|
|
791
|
-
}
|
|
792
|
-
});
|
|
793
|
-
}
|
|
794
|
-
if (coreConfig.types.verifiableStorageConnector.length > 0) {
|
|
795
|
-
coreConfig.types.verifiableStorageComponent ??= [];
|
|
796
|
-
coreConfig.types.verifiableStorageComponent.push({
|
|
797
|
-
type: VerifiableStorageComponentType.Service
|
|
798
|
-
});
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
757
|
/**
|
|
802
758
|
* Configures the immutable proof.
|
|
803
759
|
* @param coreConfig The core config.
|
|
@@ -1023,9 +979,23 @@ async function configureTrust(coreConfig, envVars) {
|
|
|
1023
979
|
coreConfig.types.trustVerifierComponent ??= [];
|
|
1024
980
|
const trustVerifierTypes = commaSeparatedListToArray(envVars.trustVerifiers);
|
|
1025
981
|
for (const trustVerifierType of trustVerifierTypes) {
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
982
|
+
const type = trustVerifierType;
|
|
983
|
+
if (type === TrustVerifierComponentType.IdentityAllowDeny) {
|
|
984
|
+
coreConfig.types.trustVerifierComponent.push({
|
|
985
|
+
type,
|
|
986
|
+
options: {
|
|
987
|
+
config: {
|
|
988
|
+
allowIdentities: commaSeparatedListToArray(envVars.trustIdentitiesAllow),
|
|
989
|
+
denyIdentities: commaSeparatedListToArray(envVars.trustIdentitiesDeny)
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
else {
|
|
995
|
+
coreConfig.types.trustVerifierComponent.push({
|
|
996
|
+
type
|
|
997
|
+
});
|
|
998
|
+
}
|
|
1029
999
|
}
|
|
1030
1000
|
}
|
|
1031
1001
|
}
|
|
@@ -1155,48 +1125,6 @@ async function configureTaskScheduler(coreConfig, envVars) {
|
|
|
1155
1125
|
});
|
|
1156
1126
|
}
|
|
1157
1127
|
}
|
|
1158
|
-
/**
|
|
1159
|
-
* Configures the synchronised storage.
|
|
1160
|
-
* @param coreConfig The core config.
|
|
1161
|
-
* @param envVars The environment variables.
|
|
1162
|
-
*/
|
|
1163
|
-
async function configureSynchronisedStorage(coreConfig, envVars) {
|
|
1164
|
-
if (Is.arrayValue(coreConfig.types.identityResolverComponent) &&
|
|
1165
|
-
(Coerce.boolean(envVars.synchronisedStorageEnabled) ?? false)) {
|
|
1166
|
-
// Check if the config provides a custom verifiable storage key id
|
|
1167
|
-
let verifiableStorageKeyId = Coerce.string(envVars.synchronisedStorageVerifiableStorageKeyId);
|
|
1168
|
-
if (!Is.stringValue(verifiableStorageKeyId)) {
|
|
1169
|
-
// No custom key so default to the network setting
|
|
1170
|
-
verifiableStorageKeyId = envVars.iotaNetwork;
|
|
1171
|
-
}
|
|
1172
|
-
coreConfig.types.synchronisedStorageComponent ??= [];
|
|
1173
|
-
coreConfig.types.synchronisedStorageComponent.push({
|
|
1174
|
-
type: SynchronisedStorageComponentType.Service,
|
|
1175
|
-
options: {
|
|
1176
|
-
config: {
|
|
1177
|
-
verifiableStorageKeyId: verifiableStorageKeyId ?? "",
|
|
1178
|
-
blobStorageEncryptionKeyId: envVars.synchronisedStorageBlobStorageEncryptionKeyId,
|
|
1179
|
-
entityUpdateIntervalMinutes: Coerce.number(envVars.synchronisedStorageEntityUpdateIntervalMinutes),
|
|
1180
|
-
consolidationIntervalMinutes: Coerce.number(envVars.synchronisedStorageConsolidationIntervalMinutes),
|
|
1181
|
-
consolidationBatchSize: Coerce.number(envVars.synchronisedStorageConsolidationBatchSize),
|
|
1182
|
-
maxConsolidations: Coerce.number(envVars.synchronisedStorageMaxConsolidations)
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
});
|
|
1186
|
-
// If there is a trusted url set, we need to add a client
|
|
1187
|
-
// and give it a feature of trusted so that when the synchronised
|
|
1188
|
-
// storage is created it can pickup the correct component
|
|
1189
|
-
if (Is.stringValue(envVars.synchronisedStorageTrustedUrl)) {
|
|
1190
|
-
coreConfig.types.synchronisedStorageComponent.push({
|
|
1191
|
-
type: SynchronisedStorageComponentType.RestClient,
|
|
1192
|
-
options: {
|
|
1193
|
-
endpoint: envVars.synchronisedStorageTrustedUrl
|
|
1194
|
-
},
|
|
1195
|
-
features: ["trusted"]
|
|
1196
|
-
});
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
1128
|
/**
|
|
1201
1129
|
* Configures the federated catalogue.
|
|
1202
1130
|
* @param coreConfig The core config.
|
|
@@ -1204,41 +1132,28 @@ async function configureSynchronisedStorage(coreConfig, envVars) {
|
|
|
1204
1132
|
*/
|
|
1205
1133
|
async function configureFederatedCatalogue(coreConfig, envVars) {
|
|
1206
1134
|
if (isFederatedCatalogueRequired(envVars)) {
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
if ((Coerce.boolean(envVars.synchronisedStorageEnabled) ?? false) &&
|
|
1212
|
-
Is.arrayValue(coreConfig.types.entityStorageConnector)) {
|
|
1213
|
-
let defaultConnector = coreConfig.types.entityStorageConnector.find(connector => connector.isDefault);
|
|
1214
|
-
if (Is.empty(defaultConnector)) {
|
|
1215
|
-
// If there is no default connector, we set the first one as the default one
|
|
1216
|
-
defaultConnector = coreConfig.types.entityStorageConnector[0];
|
|
1217
|
-
}
|
|
1218
|
-
overrideEntityStorageType = "federated-catalogue-dataset";
|
|
1219
|
-
coreConfig.types.entityStorageConnector ??= [];
|
|
1220
|
-
coreConfig.types.entityStorageConnector.push({
|
|
1221
|
-
type: EntityStorageConnectorType.Synchronised,
|
|
1222
|
-
overrideInstanceType: overrideEntityStorageType,
|
|
1135
|
+
coreConfig.types.federatedCatalogueComponent ??= [];
|
|
1136
|
+
if (Is.stringValue(envVars.federatedCatalogueRemoteEndpoint)) {
|
|
1137
|
+
coreConfig.types.federatedCatalogueComponent.push({
|
|
1138
|
+
type: FederatedCatalogueComponentType.RestClient,
|
|
1223
1139
|
options: {
|
|
1224
|
-
|
|
1140
|
+
endpoint: envVars.federatedCatalogueRemoteEndpoint
|
|
1225
1141
|
}
|
|
1226
1142
|
});
|
|
1227
1143
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
options: {
|
|
1232
|
-
datasetEntityStorageType: overrideEntityStorageType
|
|
1233
|
-
}
|
|
1234
|
-
});
|
|
1235
|
-
coreConfig.types.federatedCatalogueFilterComponent ??= [];
|
|
1236
|
-
const filters = commaSeparatedListToArray(envVars.federatedCatalogueFilters);
|
|
1237
|
-
for (const filter of filters) {
|
|
1238
|
-
coreConfig.types.federatedCatalogueFilterComponent.push({
|
|
1239
|
-
type: filter,
|
|
1144
|
+
else {
|
|
1145
|
+
coreConfig.types.federatedCatalogueComponent.push({
|
|
1146
|
+
type: FederatedCatalogueComponentType.Service,
|
|
1240
1147
|
options: {}
|
|
1241
1148
|
});
|
|
1149
|
+
coreConfig.types.federatedCatalogueFilterComponent ??= [];
|
|
1150
|
+
const filters = commaSeparatedListToArray(envVars.federatedCatalogueFilters);
|
|
1151
|
+
for (const filter of filters) {
|
|
1152
|
+
coreConfig.types.federatedCatalogueFilterComponent.push({
|
|
1153
|
+
type: filter,
|
|
1154
|
+
options: {}
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1242
1157
|
}
|
|
1243
1158
|
}
|
|
1244
1159
|
}
|
|
@@ -1327,12 +1242,12 @@ function commaSeparatedListToArray(value) {
|
|
|
1327
1242
|
* Checks if the trust subsystem is required.
|
|
1328
1243
|
* Returns true when any component that depends on the trust subsystem is enabled.
|
|
1329
1244
|
* @param envVars The environment variables.
|
|
1330
|
-
* @returns True if rights-management,
|
|
1245
|
+
* @returns True if rights-management, or dataspace is enabled.
|
|
1331
1246
|
*/
|
|
1332
1247
|
export function isTrustRequired(envVars) {
|
|
1333
1248
|
return (isRightsManagementRequired(envVars) ||
|
|
1334
1249
|
(Coerce.boolean(envVars.dataspaceEnabled) ?? false) ||
|
|
1335
|
-
(
|
|
1250
|
+
isFederatedCatalogueRequired(envVars));
|
|
1336
1251
|
}
|
|
1337
1252
|
/**
|
|
1338
1253
|
* Checks if the URL transformer subsystem is required.
|
|
@@ -1374,7 +1289,10 @@ export function isImmutableProofRequired(envVars) {
|
|
|
1374
1289
|
* @returns True if verifiable storage is enabled.
|
|
1375
1290
|
*/
|
|
1376
1291
|
export function isFederatedCatalogueRequired(envVars) {
|
|
1377
|
-
return Coerce.boolean(envVars.
|
|
1292
|
+
return ((Coerce.boolean(envVars.federatedCatalogueEnabled) ?? false) ||
|
|
1293
|
+
Is.stringValue(envVars.federatedCatalogueRemoteEndpoint) ||
|
|
1294
|
+
Is.stringValue(envVars.federatedCatalogueFilters) ||
|
|
1295
|
+
(Coerce.boolean(envVars.dataspaceEnabled) ?? false));
|
|
1378
1296
|
}
|
|
1379
1297
|
/**
|
|
1380
1298
|
* Checks if the rights management subsystem is required.
|
|
@@ -1396,7 +1314,6 @@ export function isRightsManagementRequired(envVars) {
|
|
|
1396
1314
|
*/
|
|
1397
1315
|
export function isTaskSchedulerRequired(envVars) {
|
|
1398
1316
|
return ((Coerce.boolean(envVars.dataspaceEnabled) ?? false) ||
|
|
1399
|
-
(Coerce.boolean(envVars.synchronisedStorageEnabled) ?? false) ||
|
|
1400
1317
|
isRightsManagementRequired(envVars) ||
|
|
1401
1318
|
isAuthEntityStorageRequired(envVars));
|
|
1402
1319
|
}
|