@twin.org/node-core 0.0.2-next.2 → 0.0.2-next.21

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.
Files changed (52) hide show
  1. package/dist/cjs/index.cjs +864 -391
  2. package/dist/esm/index.mjs +852 -394
  3. package/dist/types/bootstrap.d.ts +9 -9
  4. package/dist/types/builders/engineEnvBuilder.d.ts +1 -1
  5. package/dist/types/builders/engineServerEnvBuilder.d.ts +3 -2
  6. package/dist/types/builders/extensionsBuilder.d.ts +32 -0
  7. package/dist/types/defaults.d.ts +6 -0
  8. package/dist/types/index.d.ts +4 -0
  9. package/dist/types/models/IEngineEnvironmentVariables.d.ts +188 -24
  10. package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +12 -3
  11. package/dist/types/models/INodeEngineConfig.d.ts +6 -0
  12. package/dist/types/models/INodeEnvironmentVariables.d.ts +1 -2
  13. package/dist/types/models/INodeOptions.d.ts +6 -1
  14. package/dist/types/models/nodeExtensionMethods.d.ts +27 -0
  15. package/dist/types/models/nodeFeatures.d.ts +4 -0
  16. package/dist/types/node.d.ts +7 -2
  17. package/dist/types/server.d.ts +4 -2
  18. package/dist/types/utils.d.ts +24 -0
  19. package/docs/changelog.md +138 -0
  20. package/docs/reference/functions/{bootstrapAttestationMethod.md → bootstrapSynchronisedStorage.md} +3 -3
  21. package/docs/reference/functions/buildConfiguration.md +2 -2
  22. package/docs/reference/functions/buildEngineConfiguration.md +2 -2
  23. package/docs/reference/functions/buildEngineServerConfiguration.md +9 -3
  24. package/docs/reference/functions/directoryExists.md +19 -0
  25. package/docs/reference/functions/extensionsConfiguration.md +25 -0
  26. package/docs/reference/functions/extensionsInitialiseEngine.md +25 -0
  27. package/docs/reference/functions/extensionsInitialiseEngineServer.md +31 -0
  28. package/docs/reference/functions/getFiles.md +19 -0
  29. package/docs/reference/functions/getSubFolders.md +19 -0
  30. package/docs/reference/functions/loadTextFile.md +19 -0
  31. package/docs/reference/functions/overrideModuleImport.md +17 -0
  32. package/docs/reference/functions/shutdownExtensions.md +25 -0
  33. package/docs/reference/functions/start.md +4 -4
  34. package/docs/reference/index.md +21 -1
  35. package/docs/reference/interfaces/IEngineEnvironmentVariables.md +374 -36
  36. package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +1673 -5
  37. package/docs/reference/interfaces/INodeEngineConfig.md +7 -0
  38. package/docs/reference/interfaces/INodeEnvironmentVariables.md +643 -137
  39. package/docs/reference/interfaces/INodeOptions.md +14 -2
  40. package/docs/reference/type-aliases/NodeExtensionInitialiseEngineMethod.md +18 -0
  41. package/docs/reference/type-aliases/NodeExtensionInitialiseEngineServerMethod.md +24 -0
  42. package/docs/reference/type-aliases/NodeExtensionInitialiseMethod.md +23 -0
  43. package/docs/reference/type-aliases/NodeExtensionShutdownMethod.md +10 -0
  44. package/docs/reference/variables/ATTESTATION_VERIFICATION_METHOD_ID.md +3 -0
  45. package/docs/reference/variables/AUTH_SIGNING_KEY_ID.md +3 -0
  46. package/docs/reference/variables/BLOB_STORAGE_ENCRYPTION_KEY_ID.md +3 -0
  47. package/docs/reference/variables/IMMUTABLE_PROOF_VERIFICATION_METHOD_ID.md +3 -0
  48. package/docs/reference/variables/NodeFeatures.md +7 -1
  49. package/docs/reference/variables/SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID.md +3 -0
  50. package/docs/reference/variables/VC_AUTHENTICATION_VERIFICATION_METHOD_ID.md +3 -0
  51. package/locales/en.json +15 -7
  52. package/package.json +18 -2
@@ -1,5 +1,5 @@
1
1
  import type { IEngineCore, IEngineCoreContext, IEngineState } from "@twin.org/engine-models";
2
- import type { IEngineServerConfig } from "@twin.org/engine-server-types";
2
+ import { type IEngineServerConfig } from "@twin.org/engine-server-types";
3
3
  import type { INodeEnvironmentVariables } from "./models/INodeEnvironmentVariables";
4
4
  import { NodeFeatures } from "./models/nodeFeatures";
5
5
  /**
@@ -25,14 +25,6 @@ export declare function bootstrapNodeIdentity(engineCore: IEngineCore, context:
25
25
  * @param features The features that are enabled on the node.
26
26
  */
27
27
  export declare function bootstrapNodeUser(engineCore: IEngineCore, context: IEngineCoreContext<IEngineServerConfig, IEngineState>, envVars: INodeEnvironmentVariables, features: NodeFeatures[]): Promise<void>;
28
- /**
29
- * Bootstrap the attestation verification methods.
30
- * @param engineCore The engine core for the node.
31
- * @param context The context for the node.
32
- * @param envVars The environment variables for the node.
33
- * @param features The features that are enabled on the node.
34
- */
35
- export declare function bootstrapAttestationMethod(engineCore: IEngineCore, context: IEngineCoreContext<IEngineServerConfig, IEngineState>, envVars: INodeEnvironmentVariables, features: NodeFeatures[]): Promise<void>;
36
28
  /**
37
29
  * Bootstrap the immutable proof verification methods.
38
30
  * @param engineCore The engine core for the node.
@@ -57,3 +49,11 @@ export declare function bootstrapBlobEncryption(engineCore: IEngineCore, context
57
49
  * @param features The features that are enabled on the node.
58
50
  */
59
51
  export declare function bootstrapAuth(engineCore: IEngineCore, context: IEngineCoreContext<IEngineServerConfig, IEngineState>, envVars: INodeEnvironmentVariables, features: NodeFeatures[]): Promise<void>;
52
+ /**
53
+ * Bootstrap the synchronised storage blob encryption and verification methods.
54
+ * @param engineCore The engine core for the node.
55
+ * @param context The context for the node.
56
+ * @param envVars The environment variables for the node.
57
+ * @param features The features that are enabled on the node.
58
+ */
59
+ export declare function bootstrapSynchronisedStorage(engineCore: IEngineCore, context: IEngineCoreContext<IEngineServerConfig, IEngineState>, envVars: INodeEnvironmentVariables, features: NodeFeatures[]): Promise<void>;
@@ -5,4 +5,4 @@ import type { IEngineEnvironmentVariables } from "../models/IEngineEnvironmentVa
5
5
  * @param envVars The environment variables.
6
6
  * @returns The config for the core.
7
7
  */
8
- export declare function buildEngineConfiguration(envVars: IEngineEnvironmentVariables): IEngineConfig;
8
+ export declare function buildEngineConfiguration(envVars: IEngineEnvironmentVariables): Promise<IEngineConfig>;
@@ -8,6 +8,7 @@ import type { IEngineServerEnvironmentVariables } from "../models/IEngineServerE
8
8
  * @param coreEngineConfig The core engine config.
9
9
  * @param serverInfo The server information.
10
10
  * @param openApiSpecPath The path to the open api spec.
11
- * @returns The the config for the core and the server.
11
+ * @param favIconPath The path to the favicon.
12
+ * @returns The config for the core and the server.
12
13
  */
13
- export declare function buildEngineServerConfiguration(envVars: IEngineServerEnvironmentVariables, coreEngineConfig: IEngineCoreConfig, serverInfo: IServerInfo, openApiSpecPath?: string): IEngineServerConfig;
14
+ export declare function buildEngineServerConfiguration(envVars: IEngineServerEnvironmentVariables, coreEngineConfig: IEngineCoreConfig, serverInfo: IServerInfo, openApiSpecPath?: string, favIconPath?: string): Promise<IEngineServerConfig>;
@@ -0,0 +1,32 @@
1
+ import type { IEngineCore, IEngineServer } from "@twin.org/engine-models";
2
+ import type { INodeEngineConfig } from "../models/INodeEngineConfig";
3
+ import type { INodeEnvironmentVariables } from "../models/INodeEnvironmentVariables";
4
+ /**
5
+ * Handles the configuration of the extensions.
6
+ * @param envVars The environment variables for the node.
7
+ * @param nodeEngineConfig The node engine config.
8
+ * @returns The config for the core and the server.
9
+ */
10
+ export declare function extensionsConfiguration(envVars: INodeEnvironmentVariables, nodeEngineConfig: INodeEngineConfig): Promise<INodeEngineConfig>;
11
+ /**
12
+ * Handles the initialisation of the extensions when the engine has been constructed.
13
+ * @param envVars The environment variables for the node.
14
+ * @param engineCore The engine core instance.
15
+ * @returns Nothing.
16
+ */
17
+ export declare function extensionsInitialiseEngine(envVars: INodeEnvironmentVariables, engineCore: IEngineCore): Promise<void>;
18
+ /**
19
+ * Handles the initialisation of the extensions when the engine server has been constructed.
20
+ * @param envVars The environment variables for the node.
21
+ * @param engineCore The engine core instance.
22
+ * @param engineServer The engine server instance.
23
+ * @returns Nothing.
24
+ */
25
+ export declare function extensionsInitialiseEngineServer(envVars: INodeEnvironmentVariables, engineCore: IEngineCore, engineServer: IEngineServer): Promise<void>;
26
+ /**
27
+ * Handles the shutdown of the extensions.
28
+ * @param envVars The environment variables for the node.
29
+ * @param engineCore The engine core instance.
30
+ * @returns Nothing.
31
+ */
32
+ export declare function shutdownExtensions(envVars: INodeEnvironmentVariables, engineCore: IEngineCore): Promise<void>;
@@ -0,0 +1,6 @@
1
+ export declare const ATTESTATION_VERIFICATION_METHOD_ID = "attestation-assertion";
2
+ export declare const IMMUTABLE_PROOF_VERIFICATION_METHOD_ID = "immutable-proof-assertion";
3
+ export declare const BLOB_STORAGE_ENCRYPTION_KEY_ID = "blob-encryption";
4
+ export declare const SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID = "synchronised-storage-blob-encryption";
5
+ export declare const VC_AUTHENTICATION_VERIFICATION_METHOD_ID = "node-authentication-assertion";
6
+ export declare const AUTH_SIGNING_KEY_ID = "auth-signing";
@@ -1,10 +1,14 @@
1
1
  export * from "./bootstrap";
2
2
  export * from "./builders/engineEnvBuilder";
3
3
  export * from "./builders/engineServerEnvBuilder";
4
+ export * from "./builders/extensionsBuilder";
5
+ export * from "./defaults";
4
6
  export * from "./models/IEngineEnvironmentVariables";
5
7
  export * from "./models/IEngineServerEnvironmentVariables";
8
+ export * from "./models/INodeEngineConfig";
6
9
  export * from "./models/INodeEnvironmentVariables";
7
10
  export * from "./models/INodeOptions";
11
+ export * from "./models/nodeExtensionMethods";
8
12
  export * from "./models/nodeFeatures";
9
13
  export * from "./node";
10
14
  export * from "./server";
@@ -23,14 +23,14 @@ export interface IEngineEnvironmentVariables {
23
23
  * The default entity storage connector to use, defaults to the first one in the list.
24
24
  */
25
25
  entityStorageConnectorDefault?: string;
26
- /**
27
- * Entity storage connector for decentralized storage
28
- */
29
- entityStorageConnectorDecentralised?: string;
30
26
  /**
31
27
  * A prefix for all the table in entity-storage, can be empty.
32
28
  */
33
29
  entityStorageTablePrefix?: string;
30
+ /**
31
+ * AWS DynamoDB auth mode, either credentials or pod.
32
+ */
33
+ awsDynamodbAuthMode?: string;
34
34
  /**
35
35
  * AWS Dynamo DB access key id.
36
36
  */
@@ -177,41 +177,50 @@ export interface IEngineEnvironmentVariables {
177
177
  */
178
178
  blobStorageConnectorDefault?: string;
179
179
  /**
180
- * Blog storage connector for decentralized storage
180
+ * Blog storage connector which has public access.
181
181
  */
182
- blobStorageConnectorDecentralised?: string;
182
+ blobStorageConnectorPublic?: string;
183
183
  /**
184
184
  * Enable encryption for the blob storage.
185
185
  */
186
186
  blobStorageEnableEncryption?: string;
187
187
  /**
188
- * The encryption key for the blob storage.
188
+ * The id of the encryption key for the blob storage.
189
189
  */
190
- blobStorageEncryptionKey?: string;
190
+ blobStorageEncryptionKeyId?: string;
191
+ /**
192
+ * A symmetric encryption key for the blob storage, should be ChaCha20Poly1305 in base64 format.
193
+ * If encryption is enabled but a key is not provided one will be generated.
194
+ */
195
+ blobStorageSymmetricEncryptionKey?: string;
191
196
  /**
192
197
  * A prefix for all the blobs in blob-storage, can be empty.
193
198
  */
194
199
  blobStoragePrefix?: string;
195
200
  /**
196
- * AWS S3 access key id.
201
+ * AWS S3 region.
197
202
  */
198
- awsS3AccessKeyId?: string;
203
+ awsS3Region?: string;
199
204
  /**
200
205
  * AWS S3 bucket name.
201
206
  */
202
207
  awsS3BucketName?: string;
203
208
  /**
204
- * AWS S3 endpoint.
209
+ * AWS S3 auth mode, either credentials or pod, defaults to credentials.
205
210
  */
206
- awsS3Endpoint?: string;
211
+ awsS3AuthMode?: string;
207
212
  /**
208
- * AWS S3 region.
213
+ * AWS S3 access key id.
209
214
  */
210
- awsS3Region?: string;
215
+ awsS3AccessKeyId?: string;
211
216
  /**
212
217
  * AWS S3 secret access key.
213
218
  */
214
219
  awsS3SecretAccessKey?: string;
220
+ /**
221
+ * AWS S3 endpoint.
222
+ */
223
+ awsS3Endpoint?: string;
215
224
  /**
216
225
  * Azure Storage account key.
217
226
  */
@@ -257,7 +266,7 @@ export interface IEngineEnvironmentVariables {
257
266
  */
258
267
  hashicorpVaultEndpoint?: string;
259
268
  /**
260
- * The type of background task connector, can be a comma separated list: console, entity-storage.
269
+ * The type of logging task connector, can be a comma separated list: console, entity-storage.
261
270
  */
262
271
  loggingConnector?: string;
263
272
  /**
@@ -273,25 +282,50 @@ export interface IEngineEnvironmentVariables {
273
282
  */
274
283
  eventBusComponent?: string;
275
284
  /**
276
- * The type of messaging email connector: entity-storage, aws.
285
+ * Are the messaging components enabled, defaults to false.
277
286
  */
278
- messagingEmailConnector?: string;
287
+ messagingEnabled?: string;
279
288
  /**
280
- * The type of messaging sms connector: entity-storage, aws.
289
+ * An initial set of templates for the messages.
290
+ * Use the @json: prefix to specify the path to the JSON file.
281
291
  */
282
- messagingSmsConnector?: string;
292
+ messagingTemplates?: string;
283
293
  /**
284
- * The type of messaging push notification connector: entity-storage, aws.
294
+ * AWS SES region.
285
295
  */
286
- messagingPushNotificationConnector?: string;
296
+ awsSesRegion?: string;
297
+ /**
298
+ * AWS SES auth mode, either credentials or pod, defaults to credentials.
299
+ */
300
+ awsSesAuthMode?: string;
301
+ /**
302
+ * AWS SES secret access key.
303
+ */
304
+ awsSesSecretAccessKey?: string;
305
+ /**
306
+ * AWS SES access key id.
307
+ */
308
+ awsSesAccessKeyId?: string;
309
+ /**
310
+ * AWS SES endpoint.
311
+ */
312
+ awsSesEndpoint?: string;
287
313
  /**
288
314
  * The applications for the push notifications JSON stringified array of IAwsApplicationSettings.
289
315
  */
290
316
  awsMessagingPushNotificationApplications?: string;
291
317
  /**
292
- * The type of messaging component: service.
318
+ * The type of messaging email connector: entity-storage, aws.
293
319
  */
294
- messagingComponent?: string;
320
+ messagingEmailConnector?: string;
321
+ /**
322
+ * The type of messaging sms connector: entity-storage, aws.
323
+ */
324
+ messagingSmsConnector?: string;
325
+ /**
326
+ * The type of messaging push notification connector: entity-storage, aws.
327
+ */
328
+ messagingPushNotificationConnector?: string;
295
329
  /**
296
330
  * The type of telemetry connector: entity-storage.
297
331
  */
@@ -368,6 +402,10 @@ export interface IEngineEnvironmentVariables {
368
402
  * The identity verification method id to use with attestation.
369
403
  */
370
404
  attestationVerificationMethodId?: string;
405
+ /**
406
+ * Is the data processing enabled, defaults to false.
407
+ */
408
+ dataProcessingEnabled?: string;
371
409
  /**
372
410
  * The type of the default data converters, can be a comma separated list: json, xml.
373
411
  */
@@ -376,6 +414,66 @@ export interface IEngineEnvironmentVariables {
376
414
  * The type of the default data extractor, can be a comma separated list: json-path.
377
415
  */
378
416
  dataExtractorConnectors?: string;
417
+ /**
418
+ * Is the auditable item graph enabled, defaults to false.
419
+ */
420
+ auditableItemGraphEnabled?: string;
421
+ /**
422
+ * Is the auditable item stream enabled, defaults to false.
423
+ */
424
+ auditableItemStreamEnabled?: string;
425
+ /**
426
+ * Is the document management enabled, defaults to false.
427
+ */
428
+ documentManagementEnabled?: string;
429
+ /**
430
+ * Is the synchronised storage enabled, defaults to false.
431
+ */
432
+ synchronisedStorageEnabled?: string;
433
+ /**
434
+ * Url which points to the api for a trusted synchronised storage node, not required if this is a trusted node.
435
+ */
436
+ synchronisedStorageTrustedUrl?: string;
437
+ /**
438
+ * The key for the smart contract which contains the verifiable storage pointer store for synchronised storage.
439
+ * This only required if using a custom verifiable storage item, otherwise it will default to the network name.
440
+ */
441
+ synchronisedStorageVerifiableStorageKeyId?: string;
442
+ /**
443
+ * The key from the vault which is used to encrypt the synchronised storage blobs.
444
+ * Only required for trusted nodes, as regular nodes will request from the trusted nodes.
445
+ * Defaults to synchronised-storage-blob-encryption
446
+ */
447
+ synchronisedStorageBlobStorageEncryptionKeyId?: string;
448
+ /**
449
+ * The key used for blob encryption, should be ChaCha20Poly1305 encoded as base64.
450
+ * Only required for trusted nodes, as regular nodes will not write encrypted data.
451
+ */
452
+ synchronisedStorageBlobStorageKey?: string;
453
+ /**
454
+ * How often to check for entity updates in minutes.
455
+ * @default 5
456
+ */
457
+ synchronisedStorageEntityUpdateIntervalMinutes?: string;
458
+ /**
459
+ * Interval to perform consolidation of changesets, only used if this is a trusted node.
460
+ * @default 60
461
+ */
462
+ synchronisedStorageConsolidationIntervalMinutes?: string;
463
+ /**
464
+ * The number of entities to process in a single consolidation batch, only used if this is a trusted node.
465
+ * @default 1000
466
+ */
467
+ synchronisedStorageConsolidationBatchSize?: string;
468
+ /**
469
+ * The maximum number of consolidations to keep in storage, only used if this is a trusted node.
470
+ * @default 5
471
+ */
472
+ synchronisedStorageMaxConsolidations?: string;
473
+ /**
474
+ * Is the federated catalogue enabled, defaults to false.
475
+ */
476
+ federatedCatalogueEnabled?: string;
379
477
  /**
380
478
  * Federated catalog TTL for the cache.
381
479
  */
@@ -389,7 +487,73 @@ export interface IEngineEnvironmentVariables {
389
487
  */
390
488
  rightsManagementEnabled?: string;
391
489
  /**
392
- * Is the task scheduler enabled, defaults to true.
490
+ * What is the base callback url for rights management negotiations e.g. https://my-node/rights-management.
491
+ */
492
+ rightsManagementBaseCallbackUrl?: string;
493
+ /**
494
+ * The rights management configuration which includes the information sources modules to load.
495
+ * Use the @json: prefix to specify the path to the JSON configuration file.
496
+ */
497
+ rightsManagementInformationSources?: string;
498
+ /**
499
+ * The rights management configuration which includes the negotiator modules to load.
500
+ * Use the @json: prefix to specify the path to the JSON configuration file.
501
+ */
502
+ rightsManagementNegotiators?: string;
503
+ /**
504
+ * The rights management configuration which includes the requester modules to load.
505
+ * Use the @json: prefix to specify the path to the JSON configuration file.
506
+ */
507
+ rightsManagementRequesters?: string;
508
+ /**
509
+ * The rights management configuration which includes the execution actions modules to load.
510
+ * Use the @json: prefix to specify the path to the JSON configuration file.
511
+ */
512
+ rightsManagementExecutionActions?: string;
513
+ /**
514
+ * The rights management configuration which includes the enforcement processor modules to load.
515
+ * Use the @json: prefix to specify the path to the JSON configuration file.
516
+ */
517
+ rightsManagementEnforcementProcessors?: string;
518
+ /**
519
+ * The rights management configuration which includes the arbiter modules to load.
520
+ * Use the @json: prefix to specify the path to the JSON configuration file.
521
+ */
522
+ rightsManagementArbiters?: string;
523
+ /**
524
+ * The rights management configuration which includes the offer modules to load.
525
+ * Use the @json: prefix to specify the path to the JSON configuration file.
526
+ */
527
+ rightsManagementOffers?: string;
528
+ /**
529
+ * Is the task scheduler enabled, defaults to false.
393
530
  */
394
531
  taskSchedulerEnabled?: string;
532
+ /**
533
+ * Is the data space connector enabled, defaults to false.
534
+ */
535
+ dataSpaceConnectorEnabled?: string;
536
+ /**
537
+ * The length of time to retain the activity logs for in minutes, set to -1 to keep forever.
538
+ * @default 10
539
+ */
540
+ dataSpaceConnectorRetainActivityLogsFor?: string;
541
+ /**
542
+ * The interval for cleaning up the activity logs.
543
+ * @default 60
544
+ */
545
+ dataSpaceConnectorActivityLogsCleanUpInterval?: string;
546
+ /**
547
+ * Enable verifiable credential authentication for the API.
548
+ */
549
+ vcAuthenticationEnabled?: string;
550
+ /**
551
+ * Verifiable credential assertion for node to node communication.
552
+ * Defaults to node-authentication-assertion.
553
+ */
554
+ vcAuthenticationVerificationMethodId?: string;
555
+ /**
556
+ * A comma separated list of additional node extensions to load, the initialiseExtension method will be called for each extension.
557
+ */
558
+ extensions?: string;
395
559
  }
@@ -1,7 +1,8 @@
1
+ import type { IEngineEnvironmentVariables } from "./IEngineEnvironmentVariables";
1
2
  /**
2
3
  * The engine server environment variables.
3
4
  */
4
- export interface IEngineServerEnvironmentVariables {
5
+ export interface IEngineServerEnvironmentVariables extends IEngineEnvironmentVariables {
5
6
  /**
6
7
  * The port to serve the API from.
7
8
  */
@@ -43,7 +44,15 @@ export interface IEngineServerEnvironmentVariables {
43
44
  */
44
45
  mimeTypeProcessors?: string;
45
46
  /**
46
- * Disable Node Identity route processors.
47
+ * Include the body in the REST logging output, useful for debugging.
47
48
  */
48
- disableNodeIdentity?: string;
49
+ routeLoggingIncludeBody?: string;
50
+ /**
51
+ * Include the full base 64 output in the REST logging output, useful for debugging.
52
+ */
53
+ routeLoggingFullBase64?: string;
54
+ /**
55
+ * List of properties to obfuscate in the REST logging output, comma separated.
56
+ */
57
+ routeLoggingObfuscateProperties?: string;
49
58
  }
@@ -0,0 +1,6 @@
1
+ import type { IEngineServerConfig } from "@twin.org/engine-server-types";
2
+ /**
3
+ * The config for the node.
4
+ */
5
+ export interface INodeEngineConfig extends IEngineServerConfig {
6
+ }
@@ -1,9 +1,8 @@
1
- import type { IEngineEnvironmentVariables } from "./IEngineEnvironmentVariables";
2
1
  import type { IEngineServerEnvironmentVariables } from "./IEngineServerEnvironmentVariables";
3
2
  /**
4
3
  * The environment variables for the node.
5
4
  */
6
- export interface INodeEnvironmentVariables extends IEngineEnvironmentVariables, IEngineServerEnvironmentVariables {
5
+ export interface INodeEnvironmentVariables extends IEngineServerEnvironmentVariables {
7
6
  /**
8
7
  * The features that are enabled on the node.
9
8
  * @default [NodeFeatures.NodeIdentity]
@@ -1,5 +1,6 @@
1
1
  import type { IEngineCore, IEngineServer, IEngineStateStorage } from "@twin.org/engine-models";
2
2
  import type { IEngineConfig } from "@twin.org/engine-types";
3
+ import type { INodeEngineConfig } from "./INodeEngineConfig";
3
4
  import type { INodeEnvironmentVariables } from "./INodeEnvironmentVariables";
4
5
  /**
5
6
  * The options when running the node.
@@ -45,6 +46,10 @@ export interface INodeOptions {
45
46
  * The path to the OpenAPI spec file, defaults to docs/open-api/spec.json.
46
47
  */
47
48
  openApiSpecFile?: string;
49
+ /**
50
+ * The path to the favicon, defaults to static/favicon.png.
51
+ */
52
+ favIconFile?: string;
48
53
  /**
49
54
  * Method to extend the engine environment variables with any additional custom configuration.
50
55
  */
@@ -52,7 +57,7 @@ export interface INodeOptions {
52
57
  /**
53
58
  * Method to extend the engine configuration with any additional custom configuration.
54
59
  */
55
- extendConfig?: (config: IEngineConfig) => Promise<void>;
60
+ extendConfig?: (envVars: INodeEnvironmentVariables, config: INodeEngineConfig) => Promise<void>;
56
61
  /**
57
62
  * Method to extend the engine with any additional options.
58
63
  */
@@ -0,0 +1,27 @@
1
+ import type { IEngineCore, IEngineServer } from "@twin.org/engine-models";
2
+ import type { INodeEngineConfig } from "./INodeEngineConfig";
3
+ import type { INodeEnvironmentVariables } from "./INodeEnvironmentVariables";
4
+ /**
5
+ * The type for the initialise method of an extension module.
6
+ * @param envVars The environment variables for the node.
7
+ * @param nodeEngineConfig The node engine config.
8
+ */
9
+ export type NodeExtensionInitialiseMethod = (envVars: INodeEnvironmentVariables, nodeEngineConfig: INodeEngineConfig) => Promise<void>;
10
+ /**
11
+ * The type for the initialise engine method of an extension module.
12
+ * This is called when the engine has been constructed but not yet started.
13
+ * @param engineCore The engine core instance.
14
+ */
15
+ export type NodeExtensionInitialiseEngineMethod = (engineCore: IEngineCore) => Promise<void>;
16
+ /**
17
+ * The type for the initialise engine server method of an extension module.
18
+ * This is called when the engine server has been constructed but not yet started.
19
+ * @param engineCore The engine core instance.
20
+ * @param engineServer The engine server instance.
21
+ */
22
+ export type NodeExtensionInitialiseEngineServerMethod = (engineCore: IEngineCore, engineServer: IEngineServer) => Promise<void>;
23
+ /**
24
+ * The type for the shutdown method of an extension module.
25
+ * This is called when the engine is shutting down.
26
+ */
27
+ export type NodeExtensionShutdownMethod = () => Promise<void>;
@@ -10,6 +10,10 @@ export declare const NodeFeatures: {
10
10
  * NodeUser - generates a user for the node if not provided in config.
11
11
  */
12
12
  readonly NodeUser: "node-user";
13
+ /**
14
+ * NodeWallet - generates a wallet for the node and funds it when there is a faucet available.
15
+ */
16
+ readonly NodeWallet: "node-wallet";
13
17
  };
14
18
  /**
15
19
  * The features that can be enabled on the node.
@@ -1,5 +1,5 @@
1
1
  import type { IServerInfo } from "@twin.org/api-models";
2
- import type { IEngineServerConfig } from "@twin.org/engine-server-types";
2
+ import type { INodeEngineConfig } from "./models/INodeEngineConfig";
3
3
  import type { INodeEnvironmentVariables } from "./models/INodeEnvironmentVariables";
4
4
  import type { INodeOptions } from "./models/INodeOptions";
5
5
  /**
@@ -22,5 +22,10 @@ export declare function buildConfiguration(processEnv: {
22
22
  nodeEnvVars: INodeEnvironmentVariables & {
23
23
  [id: string]: string | unknown;
24
24
  };
25
- engineServerConfig: IEngineServerConfig;
25
+ nodeEngineConfig: INodeEngineConfig;
26
26
  }>;
27
+ /**
28
+ * Override module imports to use local files where possible.
29
+ * @param executionDirectory The execution directory for resolving local module paths.
30
+ */
31
+ export declare function overrideModuleImport(executionDirectory: string): void;
@@ -2,16 +2,18 @@ import { Engine } from "@twin.org/engine";
2
2
  import { type IEngineState } from "@twin.org/engine-models";
3
3
  import { EngineServer } from "@twin.org/engine-server";
4
4
  import type { IEngineServerConfig } from "@twin.org/engine-server-types";
5
+ import type { INodeEngineConfig } from "./models/INodeEngineConfig";
5
6
  import type { INodeEnvironmentVariables } from "./models/INodeEnvironmentVariables";
6
7
  import type { INodeOptions } from "./models/INodeOptions";
7
8
  /**
8
9
  * Start the engine server.
9
10
  * @param nodeOptions Optional run options for the engine server.
10
- * @param engineServerConfig The configuration for the engine server.
11
+ * @param nodeEngineConfig The configuration for the engine server.
11
12
  * @param envVars The environment variables.
12
13
  * @returns The engine server.
13
14
  */
14
- export declare function start(nodeOptions: INodeOptions | undefined, engineServerConfig: IEngineServerConfig, envVars: INodeEnvironmentVariables): Promise<{
15
+ export declare function start(nodeOptions: INodeOptions | undefined, nodeEngineConfig: INodeEngineConfig, envVars: INodeEnvironmentVariables): Promise<{
15
16
  engine: Engine<IEngineServerConfig, IEngineState>;
16
17
  server: EngineServer;
18
+ shutdown: () => Promise<void>;
17
19
  } | undefined>;
@@ -16,6 +16,30 @@ export declare function getExecutionDirectory(): string;
16
16
  * @returns True if the file exists.
17
17
  */
18
18
  export declare function fileExists(filename: string): Promise<boolean>;
19
+ /**
20
+ * Does the specified directory exist.
21
+ * @param directory The directory to check for existence.
22
+ * @returns True if the directory exists.
23
+ */
24
+ export declare function directoryExists(directory: string): Promise<boolean>;
25
+ /**
26
+ * Get the sub folders for the folder.
27
+ * @param directory The directory to get the sub folders.
28
+ * @returns The list of sub folders.
29
+ */
30
+ export declare function getSubFolders(directory: string): Promise<string[]>;
31
+ /**
32
+ * Get the files in the directory.
33
+ * @param directory The directory to get the files from.
34
+ * @returns The list of files in the directory.
35
+ */
36
+ export declare function getFiles(directory: string): Promise<string[]>;
37
+ /**
38
+ * Load the text file.
39
+ * @param filename The filename of the text file to load.
40
+ * @returns The contents of the text file if it could not be loaded.
41
+ */
42
+ export declare function loadTextFile(filename: string): Promise<string>;
19
43
  /**
20
44
  * Load the JSON file.
21
45
  * @param filename The filename of the JSON file to load.