@twin.org/node-core 0.0.2-next.14 → 0.0.2-next.16
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/cjs/index.cjs +239 -186
- package/dist/esm/index.mjs +240 -190
- package/dist/types/builders/engineEnvBuilder.d.ts +1 -1
- package/dist/types/builders/engineServerEnvBuilder.d.ts +1 -1
- package/dist/types/models/IEngineEnvironmentVariables.d.ts +49 -8
- package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +2 -5
- package/dist/types/models/INodeEnvironmentVariables.d.ts +1 -2
- package/dist/types/utils.d.ts +18 -0
- package/docs/changelog.md +14 -0
- package/docs/reference/functions/buildEngineConfiguration.md +2 -2
- package/docs/reference/functions/buildEngineServerConfiguration.md +2 -2
- package/docs/reference/functions/directoryExists.md +19 -0
- package/docs/reference/functions/getFiles.md +19 -0
- package/docs/reference/functions/getSubFolders.md +19 -0
- package/docs/reference/index.md +3 -0
- package/docs/reference/interfaces/IEngineEnvironmentVariables.md +94 -13
- package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +1583 -10
- package/docs/reference/interfaces/INodeEnvironmentVariables.md +252 -143
- package/package.json +2 -2
package/dist/esm/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { PasswordHelper } from '@twin.org/api-auth-entity-storage-service';
|
|
2
|
-
import { I18n, Is, Converter, RandomHelper,
|
|
2
|
+
import { I18n, Is, Coerce, Converter, RandomHelper, Urn, GeneralError, ErrorHelper, EnvHelper } from '@twin.org/core';
|
|
3
3
|
import { PasswordGenerator, Bip39 } from '@twin.org/crypto';
|
|
4
4
|
import { AuthenticationComponentType, InformationComponentType, RestRouteProcessorType, SocketRouteProcessorType, AuthenticationAdminComponentType } from '@twin.org/engine-server-types';
|
|
5
|
-
import { WalletConnectorType, IdentityConnectorType, EntityStorageConnectorType, BlobStorageConnectorType, BlobStorageComponentType, VaultConnectorType, DltConfigType, LoggingConnectorType, LoggingComponentType, BackgroundTaskConnectorType, TaskSchedulerComponentType, EventBusConnectorType, EventBusComponentType, TelemetryConnectorType, TelemetryComponentType, MessagingEmailConnectorType, MessagingSmsConnectorType, MessagingPushNotificationConnectorType, MessagingComponentType, FaucetConnectorType, NftConnectorType, NftComponentType, VerifiableStorageConnectorType, VerifiableStorageComponentType, ImmutableProofComponentType,
|
|
5
|
+
import { WalletConnectorType, IdentityConnectorType, EntityStorageConnectorType, BlobStorageConnectorType, BlobStorageComponentType, VaultConnectorType, DltConfigType, LoggingConnectorType, LoggingComponentType, BackgroundTaskConnectorType, TaskSchedulerComponentType, EventBusConnectorType, EventBusComponentType, TelemetryConnectorType, TelemetryComponentType, MessagingEmailConnectorType, MessagingSmsConnectorType, MessagingPushNotificationConnectorType, MessagingAdminComponentType, MessagingComponentType, FaucetConnectorType, EngineTypeHelper, NftConnectorType, NftComponentType, VerifiableStorageConnectorType, VerifiableStorageComponentType, ImmutableProofComponentType, IdentityComponentType, IdentityResolverConnectorType, IdentityResolverComponentType, IdentityProfileConnectorType, IdentityProfileComponentType, AttestationConnectorType, AttestationComponentType, DataProcessingComponentType, DataConverterConnectorType, DataExtractorConnectorType, AuditableItemGraphComponentType, AuditableItemStreamComponentType, DocumentManagementComponentType, AuthenticationGeneratorComponentType, RightsManagementPapComponentType, RightsManagementPmpComponentType, RightsManagementPipComponentType, RightsManagementPxpComponentType, RightsManagementPdpComponentType, RightsManagementPepComponentType, RightsManagementPnpComponentType, RightsManagementPnapComponentType, RightsManagementDapComponentType, RightsManagementDarpComponentType, SynchronisedStorageComponentType, FederatedCatalogueComponentType, DataSpaceConnectorComponentType } from '@twin.org/engine-types';
|
|
6
6
|
import { EntityStorageConnectorFactory } from '@twin.org/entity-storage-models';
|
|
7
7
|
import { IdentityProfileConnectorFactory, IdentityConnectorFactory, IdentityResolverConnectorFactory, DocumentHelper } from '@twin.org/identity-models';
|
|
8
8
|
import { VaultConnectorFactory, VaultKeyType } from '@twin.org/vault-models';
|
|
9
9
|
import { WalletConnectorFactory } from '@twin.org/wallet-models';
|
|
10
|
-
import { readFile, stat } from 'node:fs/promises';
|
|
10
|
+
import { readFile, stat, readdir } from 'node:fs/promises';
|
|
11
11
|
import path from 'node:path';
|
|
12
12
|
import { PolicyNegotiationPointClient, DataAccessPointClient } from '@twin.org/rights-management-rest-client';
|
|
13
13
|
import { addDefaultRestPaths, addDefaultSocketPaths, EngineServer } from '@twin.org/engine-server';
|
|
@@ -77,6 +77,64 @@ async function fileExists(filename) {
|
|
|
77
77
|
return false;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Does the specified directory exist.
|
|
82
|
+
* @param directory The directory to check for existence.
|
|
83
|
+
* @returns True if the directory exists.
|
|
84
|
+
*/
|
|
85
|
+
async function directoryExists(directory) {
|
|
86
|
+
try {
|
|
87
|
+
const stats = await stat(directory);
|
|
88
|
+
return stats.isDirectory();
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get the sub folders for the folder.
|
|
96
|
+
* @param directory The directory to get the sub folders.
|
|
97
|
+
* @returns The list of sub folders.
|
|
98
|
+
*/
|
|
99
|
+
async function getSubFolders(directory) {
|
|
100
|
+
try {
|
|
101
|
+
const dir = await readdir(directory);
|
|
102
|
+
const folders = [];
|
|
103
|
+
for (const dirEntry of dir) {
|
|
104
|
+
const fullPath = path.join(directory, dirEntry);
|
|
105
|
+
const stats = await stat(fullPath);
|
|
106
|
+
if (stats.isDirectory()) {
|
|
107
|
+
folders.push(fullPath);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return folders;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return [];
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Get the files in the directory.
|
|
118
|
+
* @param directory The directory to get the files from.
|
|
119
|
+
* @returns The list of files in the directory.
|
|
120
|
+
*/
|
|
121
|
+
async function getFiles(directory) {
|
|
122
|
+
try {
|
|
123
|
+
const dir = await readdir(directory);
|
|
124
|
+
const files = [];
|
|
125
|
+
for (const dirEntry of dir) {
|
|
126
|
+
const fullPath = path.join(directory, dirEntry);
|
|
127
|
+
const stats = await stat(fullPath);
|
|
128
|
+
if (stats.isFile()) {
|
|
129
|
+
files.push(fullPath);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return files;
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
return [];
|
|
136
|
+
}
|
|
137
|
+
}
|
|
80
138
|
/**
|
|
81
139
|
* Load the text file.
|
|
82
140
|
* @param filename The filename of the text file to load.
|
|
@@ -132,7 +190,9 @@ async function bootstrap(engineCore, context, envVars) {
|
|
|
132
190
|
await bootstrapBlobEncryption(engineCore, context, envVars);
|
|
133
191
|
await addVerificationMethod(engineCore, context, "attestation", envVars.attestationVerificationMethodId);
|
|
134
192
|
await addVerificationMethod(engineCore, context, "immutable proof", envVars.immutableProofVerificationMethodId);
|
|
135
|
-
|
|
193
|
+
if (Coerce.boolean(envVars.vcAuthenticationEnabled) ?? false) {
|
|
194
|
+
await addVerificationMethod(engineCore, context, "verifiable credential authentication", envVars.vcAuthenticationVerificationMethodId);
|
|
195
|
+
}
|
|
136
196
|
await bootstrapSynchronisedStorage(engineCore, context, envVars);
|
|
137
197
|
}
|
|
138
198
|
/**
|
|
@@ -244,7 +304,7 @@ async function finaliseWallet(engineCore, envVars, features, finalIdentity, addr
|
|
|
244
304
|
// If we are using entity storage for wallet the identity associated with the
|
|
245
305
|
// address will be wrong, so fix it
|
|
246
306
|
if (defaultWalletConnectorType.startsWith(WalletConnectorType.EntityStorage)) {
|
|
247
|
-
const walletAddress = EntityStorageConnectorFactory.get(
|
|
307
|
+
const walletAddress = EntityStorageConnectorFactory.get("wallet-address");
|
|
248
308
|
const addr = await walletAddress.get(addresses[0]);
|
|
249
309
|
if (!Is.empty(addr)) {
|
|
250
310
|
addr.identity = finalIdentity;
|
|
@@ -314,7 +374,7 @@ async function bootstrapNodeUser(engineCore, context, envVars, features) {
|
|
|
314
374
|
const defaultAuthenticationComponentType = engineCore.getRegisteredInstanceType("authenticationComponent");
|
|
315
375
|
if (defaultAuthenticationComponentType.startsWith(AuthenticationComponentType.EntityStorage) &&
|
|
316
376
|
Is.stringValue(context.state.nodeIdentity)) {
|
|
317
|
-
const authUserEntityStorage = EntityStorageConnectorFactory.get(
|
|
377
|
+
const authUserEntityStorage = EntityStorageConnectorFactory.get("authentication-user");
|
|
318
378
|
const email = envVars.username ?? DEFAULT_NODE_USERNAME;
|
|
319
379
|
let nodeAdminUser = await authUserEntityStorage.get(email);
|
|
320
380
|
if (Is.empty(nodeAdminUser)) {
|
|
@@ -355,8 +415,8 @@ async function bootstrapNodeUser(engineCore, context, envVars, features) {
|
|
|
355
415
|
}
|
|
356
416
|
}
|
|
357
417
|
// We have create a node user, now we need to create a profile for the user
|
|
358
|
-
const
|
|
359
|
-
const identityProfileConnector = IdentityProfileConnectorFactory.get(
|
|
418
|
+
const defaultIdentityProfileConnectorType = engineCore.getRegisteredInstanceType("identityProfileConnector");
|
|
419
|
+
const identityProfileConnector = IdentityProfileConnectorFactory.get(defaultIdentityProfileConnectorType);
|
|
360
420
|
if (identityProfileConnector) {
|
|
361
421
|
let userProfile;
|
|
362
422
|
try {
|
|
@@ -538,7 +598,7 @@ async function addVerificationMethod(engineCore, context, verificationMethodTitl
|
|
|
538
598
|
* @param envVars The environment variables.
|
|
539
599
|
* @returns The config for the core.
|
|
540
600
|
*/
|
|
541
|
-
function buildEngineConfiguration(envVars) {
|
|
601
|
+
async function buildEngineConfiguration(envVars) {
|
|
542
602
|
if (Is.stringValue(envVars.storageFileRoot)) {
|
|
543
603
|
envVars.stateFilename ??= "engine-state.json";
|
|
544
604
|
envVars.storageFileRoot = path.resolve(envVars.storageFileRoot);
|
|
@@ -554,50 +614,41 @@ function buildEngineConfiguration(envVars) {
|
|
|
554
614
|
debug: Coerce.boolean(envVars.debug) ?? false,
|
|
555
615
|
types: {}
|
|
556
616
|
};
|
|
557
|
-
configureEntityStorage(coreConfig, envVars);
|
|
558
|
-
configureBlobStorage(coreConfig, envVars);
|
|
559
|
-
configureVault(coreConfig, envVars);
|
|
560
|
-
configureDlt(coreConfig, envVars);
|
|
561
|
-
configureLogging(coreConfig, envVars);
|
|
562
|
-
configureBackgroundTask(coreConfig, envVars);
|
|
563
|
-
configureTaskScheduler(coreConfig, envVars);
|
|
564
|
-
configureEventBus(coreConfig, envVars);
|
|
565
|
-
configureTelemetry(coreConfig, envVars);
|
|
566
|
-
configureMessaging(coreConfig, envVars);
|
|
567
|
-
configureFaucet(coreConfig, envVars);
|
|
568
|
-
configureWallet(coreConfig, envVars);
|
|
569
|
-
configureNft(coreConfig, envVars);
|
|
570
|
-
configureVerifiableStorage(coreConfig, envVars);
|
|
571
|
-
configureIdentity(coreConfig, envVars);
|
|
572
|
-
configureIdentityResolver(coreConfig, envVars);
|
|
573
|
-
configureIdentityProfile(coreConfig, envVars);
|
|
574
|
-
configureAttestation(coreConfig, envVars);
|
|
575
|
-
configureDataProcessing(coreConfig, envVars);
|
|
576
|
-
configureAuditableItemGraph(coreConfig);
|
|
577
|
-
configureAuditableItemStream(coreConfig);
|
|
578
|
-
configureDocumentManagement(coreConfig);
|
|
579
|
-
|
|
580
|
-
configureRightsManagement(coreConfig, envVars);
|
|
581
|
-
configureSynchronisedStorage(coreConfig, envVars);
|
|
582
|
-
configureFederatedCatalogue(coreConfig, envVars);
|
|
583
|
-
configureDataSpaceConnector(coreConfig, envVars);
|
|
617
|
+
await configureEntityStorage(coreConfig, envVars);
|
|
618
|
+
await configureBlobStorage(coreConfig, envVars);
|
|
619
|
+
await configureVault(coreConfig, envVars);
|
|
620
|
+
await configureDlt(coreConfig, envVars);
|
|
621
|
+
await configureLogging(coreConfig, envVars);
|
|
622
|
+
await configureBackgroundTask(coreConfig, envVars);
|
|
623
|
+
await configureTaskScheduler(coreConfig, envVars);
|
|
624
|
+
await configureEventBus(coreConfig, envVars);
|
|
625
|
+
await configureTelemetry(coreConfig, envVars);
|
|
626
|
+
await configureMessaging(coreConfig, envVars);
|
|
627
|
+
await configureFaucet(coreConfig, envVars);
|
|
628
|
+
await configureWallet(coreConfig, envVars);
|
|
629
|
+
await configureNft(coreConfig, envVars);
|
|
630
|
+
await configureVerifiableStorage(coreConfig, envVars);
|
|
631
|
+
await configureIdentity(coreConfig, envVars);
|
|
632
|
+
await configureIdentityResolver(coreConfig, envVars);
|
|
633
|
+
await configureIdentityProfile(coreConfig, envVars);
|
|
634
|
+
await configureAttestation(coreConfig, envVars);
|
|
635
|
+
await configureDataProcessing(coreConfig, envVars);
|
|
636
|
+
await configureAuditableItemGraph(coreConfig, envVars);
|
|
637
|
+
await configureAuditableItemStream(coreConfig, envVars);
|
|
638
|
+
await configureDocumentManagement(coreConfig, envVars);
|
|
639
|
+
await configureVerifiableCredentialAuthentication(coreConfig, envVars);
|
|
640
|
+
await configureRightsManagement(coreConfig, envVars);
|
|
641
|
+
await configureSynchronisedStorage(coreConfig, envVars);
|
|
642
|
+
await configureFederatedCatalogue(coreConfig, envVars);
|
|
643
|
+
await configureDataSpaceConnector(coreConfig, envVars);
|
|
584
644
|
return coreConfig;
|
|
585
645
|
}
|
|
586
|
-
/**
|
|
587
|
-
* Helper function to get IOTA configuration from centralized dltConfig.
|
|
588
|
-
* @param coreConfig The core config.
|
|
589
|
-
* @returns The IOTA configuration if found, undefined otherwise.
|
|
590
|
-
*/
|
|
591
|
-
function getIotaConfig(coreConfig) {
|
|
592
|
-
const dltConfig = coreConfig.types.dltConfig?.find(config => config.type === DltConfigType.Iota && config.isDefault);
|
|
593
|
-
return dltConfig?.options?.config;
|
|
594
|
-
}
|
|
595
646
|
/**
|
|
596
647
|
* Configures the entity storage.
|
|
597
648
|
* @param coreConfig The core config.
|
|
598
649
|
* @param envVars The environment variables.
|
|
599
650
|
*/
|
|
600
|
-
function configureEntityStorage(coreConfig, envVars) {
|
|
651
|
+
async function configureEntityStorage(coreConfig, envVars) {
|
|
601
652
|
coreConfig.types ??= {};
|
|
602
653
|
coreConfig.types.entityStorageConnector ??= [];
|
|
603
654
|
const entityStorageConnectorTypes = envVars.entityStorageConnectorType?.split(",") ?? [];
|
|
@@ -741,7 +792,7 @@ function configureEntityStorage(coreConfig, envVars) {
|
|
|
741
792
|
* @param coreConfig The core config.
|
|
742
793
|
* @param envVars The environment variables.
|
|
743
794
|
*/
|
|
744
|
-
function configureBlobStorage(coreConfig, envVars) {
|
|
795
|
+
async function configureBlobStorage(coreConfig, envVars) {
|
|
745
796
|
coreConfig.types.blobStorageConnector ??= [];
|
|
746
797
|
const blobStorageConnectorTypes = envVars.blobStorageConnectorType?.split(",") ?? [];
|
|
747
798
|
if (blobStorageConnectorTypes.includes(BlobStorageConnectorType.Memory)) {
|
|
@@ -851,7 +902,7 @@ function configureBlobStorage(coreConfig, envVars) {
|
|
|
851
902
|
* @param coreConfig The core config.
|
|
852
903
|
* @param envVars The environment variables.
|
|
853
904
|
*/
|
|
854
|
-
function configureLogging(coreConfig, envVars) {
|
|
905
|
+
async function configureLogging(coreConfig, envVars) {
|
|
855
906
|
coreConfig.types.loggingConnector ??= [];
|
|
856
907
|
const loggingConnectors = (envVars.loggingConnector ?? "").split(",");
|
|
857
908
|
for (const loggingConnector of loggingConnectors) {
|
|
@@ -893,7 +944,7 @@ function configureLogging(coreConfig, envVars) {
|
|
|
893
944
|
* @param coreConfig The core config.
|
|
894
945
|
* @param envVars The environment variables.
|
|
895
946
|
*/
|
|
896
|
-
function configureVault(coreConfig, envVars) {
|
|
947
|
+
async function configureVault(coreConfig, envVars) {
|
|
897
948
|
coreConfig.types.vaultConnector ??= [];
|
|
898
949
|
if (envVars.vaultConnector === VaultConnectorType.EntityStorage) {
|
|
899
950
|
coreConfig.types.vaultConnector.push({
|
|
@@ -917,7 +968,7 @@ function configureVault(coreConfig, envVars) {
|
|
|
917
968
|
* @param coreConfig The core config.
|
|
918
969
|
* @param envVars The environment variables.
|
|
919
970
|
*/
|
|
920
|
-
function configureBackgroundTask(coreConfig, envVars) {
|
|
971
|
+
async function configureBackgroundTask(coreConfig, envVars) {
|
|
921
972
|
coreConfig.types.backgroundTaskConnector ??= [];
|
|
922
973
|
if (envVars.backgroundTaskConnector === BackgroundTaskConnectorType.EntityStorage) {
|
|
923
974
|
coreConfig.types.backgroundTaskConnector.push({
|
|
@@ -930,7 +981,7 @@ function configureBackgroundTask(coreConfig, envVars) {
|
|
|
930
981
|
* @param coreConfig The core config.
|
|
931
982
|
* @param envVars The environment variables.
|
|
932
983
|
*/
|
|
933
|
-
function configureEventBus(coreConfig, envVars) {
|
|
984
|
+
async function configureEventBus(coreConfig, envVars) {
|
|
934
985
|
coreConfig.types.eventBusConnector ??= [];
|
|
935
986
|
if (envVars.eventBusConnector === EventBusConnectorType.Local) {
|
|
936
987
|
coreConfig.types.eventBusConnector.push({
|
|
@@ -947,7 +998,7 @@ function configureEventBus(coreConfig, envVars) {
|
|
|
947
998
|
* @param coreConfig The core config.
|
|
948
999
|
* @param envVars The environment variables.
|
|
949
1000
|
*/
|
|
950
|
-
function configureTelemetry(coreConfig, envVars) {
|
|
1001
|
+
async function configureTelemetry(coreConfig, envVars) {
|
|
951
1002
|
coreConfig.types.telemetryConnector ??= [];
|
|
952
1003
|
if (envVars.telemetryConnector === TelemetryConnectorType.EntityStorage) {
|
|
953
1004
|
coreConfig.types.telemetryConnector.push({
|
|
@@ -964,71 +1015,81 @@ function configureTelemetry(coreConfig, envVars) {
|
|
|
964
1015
|
* @param coreConfig The core config.
|
|
965
1016
|
* @param envVars The environment variables.
|
|
966
1017
|
*/
|
|
967
|
-
function configureMessaging(coreConfig, envVars) {
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
1018
|
+
async function configureMessaging(coreConfig, envVars) {
|
|
1019
|
+
if (Coerce.boolean(envVars.messagingEnabled) ?? false) {
|
|
1020
|
+
coreConfig.types.messagingEmailConnector ??= [];
|
|
1021
|
+
coreConfig.types.messagingSmsConnector ??= [];
|
|
1022
|
+
coreConfig.types.messagingPushNotificationConnector ??= [];
|
|
1023
|
+
if (envVars.messagingEmailConnector === MessagingEmailConnectorType.EntityStorage) {
|
|
1024
|
+
coreConfig.types.messagingEmailConnector.push({
|
|
1025
|
+
type: MessagingEmailConnectorType.EntityStorage
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
else if (envVars.messagingEmailConnector === MessagingEmailConnectorType.Aws) {
|
|
1029
|
+
coreConfig.types.messagingEmailConnector.push({
|
|
1030
|
+
type: MessagingEmailConnectorType.Aws,
|
|
1031
|
+
options: {
|
|
1032
|
+
config: {
|
|
1033
|
+
region: envVars.awsS3Region ?? "",
|
|
1034
|
+
accessKeyId: envVars.awsS3AccessKeyId ?? "",
|
|
1035
|
+
secretAccessKey: envVars.awsS3SecretAccessKey ?? "",
|
|
1036
|
+
endpoint: envVars.awsS3Endpoint ?? ""
|
|
1037
|
+
}
|
|
985
1038
|
}
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
if (envVars.messagingSmsConnector === MessagingSmsConnectorType.EntityStorage) {
|
|
1042
|
+
coreConfig.types.messagingSmsConnector.push({
|
|
1043
|
+
type: MessagingSmsConnectorType.EntityStorage
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
else if (envVars.messagingSmsConnector === MessagingSmsConnectorType.Aws) {
|
|
1047
|
+
coreConfig.types.messagingSmsConnector.push({
|
|
1048
|
+
type: MessagingSmsConnectorType.Aws,
|
|
1049
|
+
options: {
|
|
1050
|
+
config: {
|
|
1051
|
+
region: envVars.awsS3Region ?? "",
|
|
1052
|
+
accessKeyId: envVars.awsS3AccessKeyId ?? "",
|
|
1053
|
+
secretAccessKey: envVars.awsS3SecretAccessKey ?? "",
|
|
1054
|
+
endpoint: envVars.awsS3Endpoint ?? ""
|
|
1055
|
+
}
|
|
1003
1056
|
}
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
if (envVars.messagingPushNotificationConnector ===
|
|
1060
|
+
MessagingPushNotificationConnectorType.EntityStorage) {
|
|
1061
|
+
coreConfig.types.messagingPushNotificationConnector.push({
|
|
1062
|
+
type: MessagingPushNotificationConnectorType.EntityStorage
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
else if (envVars.messagingPushNotificationConnector === MessagingPushNotificationConnectorType.Aws) {
|
|
1066
|
+
coreConfig.types.messagingPushNotificationConnector.push({
|
|
1067
|
+
type: MessagingPushNotificationConnectorType.Aws,
|
|
1068
|
+
options: {
|
|
1069
|
+
config: {
|
|
1070
|
+
region: envVars.awsSesRegion ?? "",
|
|
1071
|
+
accessKeyId: envVars.awsSesAccessKeyId ?? "",
|
|
1072
|
+
secretAccessKey: envVars.awsSesSecretAccessKey ?? "",
|
|
1073
|
+
endpoint: envVars.awsSesEndpoint,
|
|
1074
|
+
applicationsSettings: Is.json(envVars.awsMessagingPushNotificationApplications)
|
|
1075
|
+
? JSON.parse(envVars.awsMessagingPushNotificationApplications)
|
|
1076
|
+
: []
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
const templates = Is.arrayValue(envVars.messagingTemplates)
|
|
1082
|
+
? envVars.messagingTemplates
|
|
1083
|
+
: undefined;
|
|
1084
|
+
coreConfig.types.messagingAdminComponent ??= [];
|
|
1085
|
+
coreConfig.types.messagingAdminComponent.push({
|
|
1086
|
+
type: MessagingAdminComponentType.Service,
|
|
1016
1087
|
options: {
|
|
1017
1088
|
config: {
|
|
1018
|
-
|
|
1019
|
-
accessKeyId: envVars.awsS3AccessKeyId ?? "",
|
|
1020
|
-
secretAccessKey: envVars.awsS3SecretAccessKey ?? "",
|
|
1021
|
-
endpoint: envVars.awsS3Endpoint ?? "",
|
|
1022
|
-
applicationsSettings: Is.json(envVars.awsMessagingPushNotificationApplications)
|
|
1023
|
-
? JSON.parse(envVars.awsMessagingPushNotificationApplications)
|
|
1024
|
-
: []
|
|
1089
|
+
templates
|
|
1025
1090
|
}
|
|
1026
1091
|
}
|
|
1027
1092
|
});
|
|
1028
|
-
}
|
|
1029
|
-
if (coreConfig.types.messagingEmailConnector.length > 0 ||
|
|
1030
|
-
coreConfig.types.messagingSmsConnector.length > 0 ||
|
|
1031
|
-
coreConfig.types.messagingPushNotificationConnector.length > 0) {
|
|
1032
1093
|
coreConfig.types.messagingComponent ??= [];
|
|
1033
1094
|
coreConfig.types.messagingComponent.push({ type: MessagingComponentType.Service });
|
|
1034
1095
|
}
|
|
@@ -1038,7 +1099,7 @@ function configureMessaging(coreConfig, envVars) {
|
|
|
1038
1099
|
* @param coreConfig The core config.
|
|
1039
1100
|
* @param envVars The environment variables.
|
|
1040
1101
|
*/
|
|
1041
|
-
function configureFaucet(coreConfig, envVars) {
|
|
1102
|
+
async function configureFaucet(coreConfig, envVars) {
|
|
1042
1103
|
coreConfig.types.faucetConnector ??= [];
|
|
1043
1104
|
if (envVars.faucetConnector === FaucetConnectorType.EntityStorage) {
|
|
1044
1105
|
coreConfig.types.faucetConnector.push({
|
|
@@ -1046,14 +1107,14 @@ function configureFaucet(coreConfig, envVars) {
|
|
|
1046
1107
|
});
|
|
1047
1108
|
}
|
|
1048
1109
|
else if (envVars.faucetConnector === FaucetConnectorType.Iota) {
|
|
1049
|
-
const
|
|
1110
|
+
const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
|
|
1050
1111
|
coreConfig.types.faucetConnector.push({
|
|
1051
1112
|
type: FaucetConnectorType.Iota,
|
|
1052
1113
|
options: {
|
|
1053
1114
|
config: {
|
|
1054
1115
|
endpoint: envVars.iotaFaucetEndpoint ?? "",
|
|
1055
|
-
clientOptions:
|
|
1056
|
-
network:
|
|
1116
|
+
clientOptions: dltConfig?.options?.config?.clientOptions ?? { url: "" },
|
|
1117
|
+
network: dltConfig?.options?.config?.network ?? ""
|
|
1057
1118
|
}
|
|
1058
1119
|
}
|
|
1059
1120
|
});
|
|
@@ -1064,7 +1125,7 @@ function configureFaucet(coreConfig, envVars) {
|
|
|
1064
1125
|
* @param coreConfig The core config.
|
|
1065
1126
|
* @param envVars The environment variables.
|
|
1066
1127
|
*/
|
|
1067
|
-
function configureWallet(coreConfig, envVars) {
|
|
1128
|
+
async function configureWallet(coreConfig, envVars) {
|
|
1068
1129
|
coreConfig.types.walletConnector ??= [];
|
|
1069
1130
|
if (envVars.walletConnector === WalletConnectorType.EntityStorage) {
|
|
1070
1131
|
coreConfig.types.walletConnector.push({
|
|
@@ -1072,11 +1133,11 @@ function configureWallet(coreConfig, envVars) {
|
|
|
1072
1133
|
});
|
|
1073
1134
|
}
|
|
1074
1135
|
else if (envVars.walletConnector === WalletConnectorType.Iota) {
|
|
1075
|
-
const
|
|
1136
|
+
const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
|
|
1076
1137
|
coreConfig.types.walletConnector.push({
|
|
1077
1138
|
type: WalletConnectorType.Iota,
|
|
1078
1139
|
options: {
|
|
1079
|
-
config:
|
|
1140
|
+
config: dltConfig?.options?.config ?? {}
|
|
1080
1141
|
}
|
|
1081
1142
|
});
|
|
1082
1143
|
}
|
|
@@ -1086,7 +1147,7 @@ function configureWallet(coreConfig, envVars) {
|
|
|
1086
1147
|
* @param coreConfig The core config.
|
|
1087
1148
|
* @param envVars The environment variables.
|
|
1088
1149
|
*/
|
|
1089
|
-
function configureNft(coreConfig, envVars) {
|
|
1150
|
+
async function configureNft(coreConfig, envVars) {
|
|
1090
1151
|
coreConfig.types.nftConnector ??= [];
|
|
1091
1152
|
if (envVars.nftConnector === NftConnectorType.EntityStorage) {
|
|
1092
1153
|
coreConfig.types.nftConnector.push({
|
|
@@ -1094,11 +1155,11 @@ function configureNft(coreConfig, envVars) {
|
|
|
1094
1155
|
});
|
|
1095
1156
|
}
|
|
1096
1157
|
else if (envVars.nftConnector === NftConnectorType.Iota) {
|
|
1097
|
-
const
|
|
1158
|
+
const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
|
|
1098
1159
|
coreConfig.types.nftConnector.push({
|
|
1099
1160
|
type: NftConnectorType.Iota,
|
|
1100
1161
|
options: {
|
|
1101
|
-
config:
|
|
1162
|
+
config: dltConfig?.options?.config ?? {}
|
|
1102
1163
|
}
|
|
1103
1164
|
});
|
|
1104
1165
|
}
|
|
@@ -1112,7 +1173,7 @@ function configureNft(coreConfig, envVars) {
|
|
|
1112
1173
|
* @param coreConfig The core config.
|
|
1113
1174
|
* @param envVars The environment variables.
|
|
1114
1175
|
*/
|
|
1115
|
-
function configureVerifiableStorage(coreConfig, envVars) {
|
|
1176
|
+
async function configureVerifiableStorage(coreConfig, envVars) {
|
|
1116
1177
|
coreConfig.types.verifiableStorageConnector ??= [];
|
|
1117
1178
|
if (envVars.verifiableStorageConnector === VerifiableStorageConnectorType.EntityStorage) {
|
|
1118
1179
|
coreConfig.types.verifiableStorageConnector.push({
|
|
@@ -1120,11 +1181,11 @@ function configureVerifiableStorage(coreConfig, envVars) {
|
|
|
1120
1181
|
});
|
|
1121
1182
|
}
|
|
1122
1183
|
else if (envVars.verifiableStorageConnector === VerifiableStorageConnectorType.Iota) {
|
|
1123
|
-
const
|
|
1184
|
+
const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
|
|
1124
1185
|
coreConfig.types.verifiableStorageConnector.push({
|
|
1125
1186
|
type: VerifiableStorageConnectorType.Iota,
|
|
1126
1187
|
options: {
|
|
1127
|
-
config:
|
|
1188
|
+
config: dltConfig?.options?.config ?? {}
|
|
1128
1189
|
}
|
|
1129
1190
|
});
|
|
1130
1191
|
}
|
|
@@ -1142,14 +1203,6 @@ function configureVerifiableStorage(coreConfig, envVars) {
|
|
|
1142
1203
|
}
|
|
1143
1204
|
}
|
|
1144
1205
|
});
|
|
1145
|
-
coreConfig.types.auditableItemGraphComponent ??= [];
|
|
1146
|
-
coreConfig.types.auditableItemGraphComponent.push({
|
|
1147
|
-
type: AuditableItemGraphComponentType.Service
|
|
1148
|
-
});
|
|
1149
|
-
coreConfig.types.auditableItemStreamComponent ??= [];
|
|
1150
|
-
coreConfig.types.auditableItemStreamComponent.push({
|
|
1151
|
-
type: AuditableItemStreamComponentType.Service
|
|
1152
|
-
});
|
|
1153
1206
|
}
|
|
1154
1207
|
}
|
|
1155
1208
|
/**
|
|
@@ -1157,7 +1210,7 @@ function configureVerifiableStorage(coreConfig, envVars) {
|
|
|
1157
1210
|
* @param coreConfig The core config.
|
|
1158
1211
|
* @param envVars The environment variables.
|
|
1159
1212
|
*/
|
|
1160
|
-
function configureIdentity(coreConfig, envVars) {
|
|
1213
|
+
async function configureIdentity(coreConfig, envVars) {
|
|
1161
1214
|
coreConfig.types.identityConnector ??= [];
|
|
1162
1215
|
if (envVars.identityConnector === IdentityConnectorType.EntityStorage) {
|
|
1163
1216
|
coreConfig.types.identityConnector.push({
|
|
@@ -1165,11 +1218,11 @@ function configureIdentity(coreConfig, envVars) {
|
|
|
1165
1218
|
});
|
|
1166
1219
|
}
|
|
1167
1220
|
else if (envVars.identityConnector === IdentityConnectorType.Iota) {
|
|
1168
|
-
const
|
|
1221
|
+
const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
|
|
1169
1222
|
coreConfig.types.identityConnector.push({
|
|
1170
1223
|
type: IdentityConnectorType.Iota,
|
|
1171
1224
|
options: {
|
|
1172
|
-
config:
|
|
1225
|
+
config: dltConfig?.options?.config ?? {}
|
|
1173
1226
|
}
|
|
1174
1227
|
});
|
|
1175
1228
|
}
|
|
@@ -1183,7 +1236,7 @@ function configureIdentity(coreConfig, envVars) {
|
|
|
1183
1236
|
* @param coreConfig The core config.
|
|
1184
1237
|
* @param envVars The environment variables.
|
|
1185
1238
|
*/
|
|
1186
|
-
function configureIdentityResolver(coreConfig, envVars) {
|
|
1239
|
+
async function configureIdentityResolver(coreConfig, envVars) {
|
|
1187
1240
|
coreConfig.types.identityResolverConnector ??= [];
|
|
1188
1241
|
if (envVars.identityResolverConnector === IdentityResolverConnectorType.EntityStorage) {
|
|
1189
1242
|
coreConfig.types.identityResolverConnector.push({
|
|
@@ -1191,11 +1244,11 @@ function configureIdentityResolver(coreConfig, envVars) {
|
|
|
1191
1244
|
});
|
|
1192
1245
|
}
|
|
1193
1246
|
else if (envVars.identityResolverConnector === IdentityResolverConnectorType.Iota) {
|
|
1194
|
-
const
|
|
1247
|
+
const dltConfig = EngineTypeHelper.getConfigOfType(coreConfig, "dltConfig", DltConfigType.Iota);
|
|
1195
1248
|
coreConfig.types.identityResolverConnector.push({
|
|
1196
1249
|
type: IdentityResolverConnectorType.Iota,
|
|
1197
1250
|
options: {
|
|
1198
|
-
config:
|
|
1251
|
+
config: dltConfig?.options?.config ?? {}
|
|
1199
1252
|
}
|
|
1200
1253
|
});
|
|
1201
1254
|
}
|
|
@@ -1221,7 +1274,7 @@ function configureIdentityResolver(coreConfig, envVars) {
|
|
|
1221
1274
|
* @param coreConfig The core config.
|
|
1222
1275
|
* @param envVars The environment variables.
|
|
1223
1276
|
*/
|
|
1224
|
-
function configureIdentityProfile(coreConfig, envVars) {
|
|
1277
|
+
async function configureIdentityProfile(coreConfig, envVars) {
|
|
1225
1278
|
coreConfig.types.identityProfileConnector ??= [];
|
|
1226
1279
|
if (envVars.identityProfileConnector === IdentityConnectorType.EntityStorage) {
|
|
1227
1280
|
coreConfig.types.identityProfileConnector.push({
|
|
@@ -1238,7 +1291,7 @@ function configureIdentityProfile(coreConfig, envVars) {
|
|
|
1238
1291
|
* @param coreConfig The core config.
|
|
1239
1292
|
* @param envVars The environment variables.
|
|
1240
1293
|
*/
|
|
1241
|
-
function configureAttestation(coreConfig, envVars) {
|
|
1294
|
+
async function configureAttestation(coreConfig, envVars) {
|
|
1242
1295
|
coreConfig.types.attestationConnector ??= [];
|
|
1243
1296
|
if (envVars.attestationConnector === AttestationConnectorType.Nft) {
|
|
1244
1297
|
coreConfig.types.attestationConnector.push({
|
|
@@ -1262,8 +1315,8 @@ function configureAttestation(coreConfig, envVars) {
|
|
|
1262
1315
|
* @param coreConfig The core config.
|
|
1263
1316
|
* @param envVars The environment variables.
|
|
1264
1317
|
*/
|
|
1265
|
-
function configureAuditableItemGraph(coreConfig, envVars) {
|
|
1266
|
-
if (
|
|
1318
|
+
async function configureAuditableItemGraph(coreConfig, envVars) {
|
|
1319
|
+
if (Coerce.boolean(envVars.auditableItemGraphEnabled) ?? false) {
|
|
1267
1320
|
coreConfig.types.auditableItemGraphComponent ??= [];
|
|
1268
1321
|
coreConfig.types.auditableItemGraphComponent.push({
|
|
1269
1322
|
type: AuditableItemGraphComponentType.Service
|
|
@@ -1275,8 +1328,8 @@ function configureAuditableItemGraph(coreConfig, envVars) {
|
|
|
1275
1328
|
* @param coreConfig The core config.
|
|
1276
1329
|
* @param envVars The environment variables.
|
|
1277
1330
|
*/
|
|
1278
|
-
function configureAuditableItemStream(coreConfig, envVars) {
|
|
1279
|
-
if (
|
|
1331
|
+
async function configureAuditableItemStream(coreConfig, envVars) {
|
|
1332
|
+
if (Coerce.boolean(envVars.auditableItemStreamEnabled) ?? false) {
|
|
1280
1333
|
coreConfig.types.auditableItemStreamComponent ??= [];
|
|
1281
1334
|
coreConfig.types.auditableItemStreamComponent.push({
|
|
1282
1335
|
type: AuditableItemStreamComponentType.Service
|
|
@@ -1288,34 +1341,33 @@ function configureAuditableItemStream(coreConfig, envVars) {
|
|
|
1288
1341
|
* @param coreConfig The core config.
|
|
1289
1342
|
* @param envVars The environment variables.
|
|
1290
1343
|
*/
|
|
1291
|
-
function configureDataProcessing(coreConfig, envVars) {
|
|
1292
|
-
|
|
1293
|
-
coreConfig.types.dataExtractorConnector ??= [];
|
|
1294
|
-
const converterConnectors = envVars.dataConverterConnectors?.split(",") ?? [];
|
|
1295
|
-
for (const converterConnector of converterConnectors) {
|
|
1296
|
-
if (converterConnector === DataConverterConnectorType.Json) {
|
|
1297
|
-
coreConfig.types.dataConverterConnector.push({
|
|
1298
|
-
type: DataConverterConnectorType.Json
|
|
1299
|
-
});
|
|
1300
|
-
}
|
|
1301
|
-
else if (converterConnector === DataConverterConnectorType.Xml) {
|
|
1302
|
-
coreConfig.types.dataConverterConnector.push({
|
|
1303
|
-
type: DataConverterConnectorType.Xml
|
|
1304
|
-
});
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
const extractorConnectors = envVars.dataExtractorConnectors?.split(",") ?? [];
|
|
1308
|
-
for (const extractorConnector of extractorConnectors) {
|
|
1309
|
-
if (extractorConnector === DataExtractorConnectorType.JsonPath) {
|
|
1310
|
-
coreConfig.types.dataExtractorConnector.push({
|
|
1311
|
-
type: DataExtractorConnectorType.JsonPath
|
|
1312
|
-
});
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
if (coreConfig.types.dataConverterConnector.length > 0 ||
|
|
1316
|
-
coreConfig.types.dataExtractorConnector.length > 0) {
|
|
1344
|
+
async function configureDataProcessing(coreConfig, envVars) {
|
|
1345
|
+
if (Coerce.boolean(envVars.dataProcessingEnabled) ?? false) {
|
|
1317
1346
|
coreConfig.types.dataProcessingComponent ??= [];
|
|
1318
1347
|
coreConfig.types.dataProcessingComponent.push({ type: DataProcessingComponentType.Service });
|
|
1348
|
+
coreConfig.types.dataConverterConnector ??= [];
|
|
1349
|
+
const converterConnectors = envVars.dataConverterConnectors?.split(",") ?? [];
|
|
1350
|
+
for (const converterConnector of converterConnectors) {
|
|
1351
|
+
if (converterConnector === DataConverterConnectorType.Json) {
|
|
1352
|
+
coreConfig.types.dataConverterConnector.push({
|
|
1353
|
+
type: DataConverterConnectorType.Json
|
|
1354
|
+
});
|
|
1355
|
+
}
|
|
1356
|
+
else if (converterConnector === DataConverterConnectorType.Xml) {
|
|
1357
|
+
coreConfig.types.dataConverterConnector.push({
|
|
1358
|
+
type: DataConverterConnectorType.Xml
|
|
1359
|
+
});
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
coreConfig.types.dataExtractorConnector ??= [];
|
|
1363
|
+
const extractorConnectors = envVars.dataExtractorConnectors?.split(",") ?? [];
|
|
1364
|
+
for (const extractorConnector of extractorConnectors) {
|
|
1365
|
+
if (extractorConnector === DataExtractorConnectorType.JsonPath) {
|
|
1366
|
+
coreConfig.types.dataExtractorConnector.push({
|
|
1367
|
+
type: DataExtractorConnectorType.JsonPath
|
|
1368
|
+
});
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1319
1371
|
}
|
|
1320
1372
|
}
|
|
1321
1373
|
/**
|
|
@@ -1323,10 +1375,8 @@ function configureDataProcessing(coreConfig, envVars) {
|
|
|
1323
1375
|
* @param coreConfig The core config.
|
|
1324
1376
|
* @param envVars The environment variables.
|
|
1325
1377
|
*/
|
|
1326
|
-
function configureDocumentManagement(coreConfig, envVars) {
|
|
1327
|
-
if (
|
|
1328
|
-
Is.arrayValue(coreConfig.types.blobStorageComponent) &&
|
|
1329
|
-
Is.arrayValue(coreConfig.types.attestationComponent)) {
|
|
1378
|
+
async function configureDocumentManagement(coreConfig, envVars) {
|
|
1379
|
+
if (Coerce.boolean(envVars.documentManagementEnabled) ?? false) {
|
|
1330
1380
|
coreConfig.types.documentManagementComponent ??= [];
|
|
1331
1381
|
coreConfig.types.documentManagementComponent.push({
|
|
1332
1382
|
type: DocumentManagementComponentType.Service
|
|
@@ -1334,12 +1384,12 @@ function configureDocumentManagement(coreConfig, envVars) {
|
|
|
1334
1384
|
}
|
|
1335
1385
|
}
|
|
1336
1386
|
/**
|
|
1337
|
-
* Configures the
|
|
1387
|
+
* Configures the verifiable credential authentication.
|
|
1338
1388
|
* @param coreConfig The core config.
|
|
1339
1389
|
* @param envVars The environment variables.
|
|
1340
1390
|
*/
|
|
1341
|
-
function
|
|
1342
|
-
if (
|
|
1391
|
+
async function configureVerifiableCredentialAuthentication(coreConfig, envVars) {
|
|
1392
|
+
if (Coerce.boolean(envVars.vcAuthenticationEnabled) ?? false) {
|
|
1343
1393
|
// Can only perform VC authentication if identity component is available
|
|
1344
1394
|
coreConfig.types.authenticationGeneratorComponent ??= [];
|
|
1345
1395
|
coreConfig.types.authenticationGeneratorComponent.push({
|
|
@@ -1356,7 +1406,7 @@ function configureNodeToNode(coreConfig, envVars) {
|
|
|
1356
1406
|
* @param coreConfig The core config.
|
|
1357
1407
|
* @param envVars The environment variables.
|
|
1358
1408
|
*/
|
|
1359
|
-
function configureRightsManagement(coreConfig, envVars) {
|
|
1409
|
+
async function configureRightsManagement(coreConfig, envVars) {
|
|
1360
1410
|
if (Coerce.boolean(envVars.rightsManagementEnabled) ?? false) {
|
|
1361
1411
|
coreConfig.types.rightsManagementPapComponent ??= [];
|
|
1362
1412
|
coreConfig.types.rightsManagementPapComponent.push({
|
|
@@ -1445,7 +1495,7 @@ function configureRightsManagement(coreConfig, envVars) {
|
|
|
1445
1495
|
* @param coreConfig The core config.
|
|
1446
1496
|
* @param envVars The environment variables.
|
|
1447
1497
|
*/
|
|
1448
|
-
function configureTaskScheduler(coreConfig, envVars) {
|
|
1498
|
+
async function configureTaskScheduler(coreConfig, envVars) {
|
|
1449
1499
|
if (Coerce.boolean(envVars.taskSchedulerEnabled) ?? false) {
|
|
1450
1500
|
coreConfig.types.taskSchedulerComponent ??= [];
|
|
1451
1501
|
coreConfig.types.taskSchedulerComponent.push({
|
|
@@ -1458,7 +1508,7 @@ function configureTaskScheduler(coreConfig, envVars) {
|
|
|
1458
1508
|
* @param coreConfig The core config.
|
|
1459
1509
|
* @param envVars The environment variables.
|
|
1460
1510
|
*/
|
|
1461
|
-
function configureSynchronisedStorage(coreConfig, envVars) {
|
|
1511
|
+
async function configureSynchronisedStorage(coreConfig, envVars) {
|
|
1462
1512
|
if (Is.arrayValue(coreConfig.types.identityResolverComponent) &&
|
|
1463
1513
|
(Coerce.boolean(envVars.synchronisedStorageEnabled) ?? false)) {
|
|
1464
1514
|
// Check if the config provides a custom verifiable storage key id
|
|
@@ -1500,7 +1550,7 @@ function configureSynchronisedStorage(coreConfig, envVars) {
|
|
|
1500
1550
|
* @param coreConfig The core config.
|
|
1501
1551
|
* @param envVars The environment variables.
|
|
1502
1552
|
*/
|
|
1503
|
-
function configureFederatedCatalogue(coreConfig, envVars) {
|
|
1553
|
+
async function configureFederatedCatalogue(coreConfig, envVars) {
|
|
1504
1554
|
if (Coerce.boolean(envVars.federatedCatalogueEnabled) ?? false) {
|
|
1505
1555
|
coreConfig.types.federatedCatalogueComponent ??= [];
|
|
1506
1556
|
coreConfig.types.federatedCatalogueComponent.push({
|
|
@@ -1519,7 +1569,7 @@ function configureFederatedCatalogue(coreConfig, envVars) {
|
|
|
1519
1569
|
* @param coreConfig The core config.
|
|
1520
1570
|
* @param envVars The environment variables.
|
|
1521
1571
|
*/
|
|
1522
|
-
function configureDataSpaceConnector(coreConfig, envVars) {
|
|
1572
|
+
async function configureDataSpaceConnector(coreConfig, envVars) {
|
|
1523
1573
|
if (Coerce.boolean(envVars.dataSpaceConnectorEnabled) ?? false) {
|
|
1524
1574
|
coreConfig.types.dataSpaceConnectorComponent ??= [];
|
|
1525
1575
|
coreConfig.types.dataSpaceConnectorComponent.push({
|
|
@@ -1539,7 +1589,7 @@ function configureDataSpaceConnector(coreConfig, envVars) {
|
|
|
1539
1589
|
* @param coreConfig The core config.
|
|
1540
1590
|
* @param envVars The environment variables.
|
|
1541
1591
|
*/
|
|
1542
|
-
function configureDlt(coreConfig, envVars) {
|
|
1592
|
+
async function configureDlt(coreConfig, envVars) {
|
|
1543
1593
|
// Create centralized DLT configuration for IOTA if essential IOTA variables are set
|
|
1544
1594
|
if (Is.stringValue(envVars.iotaNodeEndpoint) && Is.stringValue(envVars.iotaNetwork)) {
|
|
1545
1595
|
coreConfig.types.dltConfig ??= [];
|
|
@@ -1576,7 +1626,7 @@ function configureDlt(coreConfig, envVars) {
|
|
|
1576
1626
|
* @param favIconPath The path to the favicon.
|
|
1577
1627
|
* @returns The the config for the core and the server.
|
|
1578
1628
|
*/
|
|
1579
|
-
function buildEngineServerConfiguration(envVars, coreEngineConfig, serverInfo, openApiSpecPath, favIconPath) {
|
|
1629
|
+
async function buildEngineServerConfiguration(envVars, coreEngineConfig, serverInfo, openApiSpecPath, favIconPath) {
|
|
1580
1630
|
envVars.authSigningKeyId ??= "auth-signing";
|
|
1581
1631
|
const webServerOptions = {
|
|
1582
1632
|
port: Coerce.number(envVars.port),
|
|
@@ -1714,7 +1764,7 @@ function buildEngineServerConfiguration(envVars, coreEngineConfig, serverInfo, o
|
|
|
1714
1764
|
}
|
|
1715
1765
|
});
|
|
1716
1766
|
}
|
|
1717
|
-
if (Coerce.boolean(envVars.
|
|
1767
|
+
if (Coerce.boolean(envVars.vcAuthenticationEnabled) ?? false) {
|
|
1718
1768
|
serverConfig.types.restRouteProcessor.push({
|
|
1719
1769
|
type: RestRouteProcessorType.AuthVerifiableCredential
|
|
1720
1770
|
});
|
|
@@ -1756,13 +1806,13 @@ async function start(nodeOptions, engineServerConfig, envVars) {
|
|
|
1756
1806
|
stateStorage: nodeOptions?.stateStorage ?? new FileStateStorage(envVars.stateFilename ?? ""),
|
|
1757
1807
|
customBootstrap: async (core, engineContext) => bootstrap(core, engineContext, envVars)
|
|
1758
1808
|
});
|
|
1809
|
+
// Construct the server with the engine.
|
|
1810
|
+
const server = new EngineServer({ engineCore: engine });
|
|
1759
1811
|
// Extend the engine.
|
|
1760
1812
|
if (Is.function(nodeOptions?.extendEngine)) {
|
|
1761
1813
|
console.info("Extending Engine");
|
|
1762
1814
|
await nodeOptions.extendEngine(engine);
|
|
1763
1815
|
}
|
|
1764
|
-
// Construct the server with the engine.
|
|
1765
|
-
const server = new EngineServer({ engineCore: engine });
|
|
1766
1816
|
// Extend the engine server.
|
|
1767
1817
|
if (Is.function(nodeOptions?.extendEngineServer)) {
|
|
1768
1818
|
console.info("Extending Engine Server");
|
|
@@ -1794,7 +1844,7 @@ async function run(nodeOptions) {
|
|
|
1794
1844
|
nodeOptions ??= {};
|
|
1795
1845
|
const serverInfo = {
|
|
1796
1846
|
name: nodeOptions?.serverName ?? "TWIN Node Server",
|
|
1797
|
-
version: nodeOptions?.serverVersion ?? "0.0.2-next.
|
|
1847
|
+
version: nodeOptions?.serverVersion ?? "0.0.2-next.16" // x-release-please-version
|
|
1798
1848
|
};
|
|
1799
1849
|
console.log(`\u001B[4m🌩️ ${serverInfo.name} v${serverInfo.version}\u001B[24m\n`);
|
|
1800
1850
|
if (!Is.stringValue(nodeOptions?.executionDirectory)) {
|
|
@@ -1897,8 +1947,8 @@ async function buildConfiguration(processEnv, options, serverInfo) {
|
|
|
1897
1947
|
await options.extendEnvVars(envVars);
|
|
1898
1948
|
}
|
|
1899
1949
|
// Build the engine configuration from the environment variables.
|
|
1900
|
-
const coreConfig = buildEngineConfiguration(envVars);
|
|
1901
|
-
const engineServerConfig = buildEngineServerConfiguration(envVars, coreConfig, serverInfo, options?.openApiSpecFile, options?.favIconFile);
|
|
1950
|
+
const coreConfig = await buildEngineConfiguration(envVars);
|
|
1951
|
+
const engineServerConfig = await buildEngineServerConfiguration(envVars, coreConfig, serverInfo, options?.openApiSpecFile, options?.favIconFile);
|
|
1902
1952
|
// Merge any custom configuration provided in the options.
|
|
1903
1953
|
if (Is.arrayValue(options?.configFilenames)) {
|
|
1904
1954
|
for (const configFile of options.configFilenames) {
|
|
@@ -1954,4 +2004,4 @@ function overrideModuleImport(executionDirectory) {
|
|
|
1954
2004
|
});
|
|
1955
2005
|
}
|
|
1956
2006
|
|
|
1957
|
-
export { NodeFeatures, bootstrap, bootstrapAuth, bootstrapBlobEncryption, bootstrapImmutableProofMethod, bootstrapNodeIdentity, bootstrapNodeUser, bootstrapSynchronisedStorage, buildConfiguration, buildEngineConfiguration, buildEngineServerConfiguration, fileExists, getExecutionDirectory, getFeatures, initialiseLocales, loadJsonFile, loadTextFile, overrideModuleImport, run, start };
|
|
2007
|
+
export { NodeFeatures, bootstrap, bootstrapAuth, bootstrapBlobEncryption, bootstrapImmutableProofMethod, bootstrapNodeIdentity, bootstrapNodeUser, bootstrapSynchronisedStorage, buildConfiguration, buildEngineConfiguration, buildEngineServerConfiguration, directoryExists, fileExists, getExecutionDirectory, getFeatures, getFiles, getSubFolders, initialiseLocales, loadJsonFile, loadTextFile, overrideModuleImport, run, start };
|