@twin.org/node-core 0.0.1-next.9 → 0.0.1
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 +1140 -53
- package/dist/esm/index.mjs +1141 -57
- package/dist/types/bootstrap.d.ts +9 -10
- package/dist/types/builders/engineEnvBuilder.d.ts +8 -0
- package/dist/types/builders/engineServerEnvBuilder.d.ts +13 -0
- package/dist/types/index.d.ts +5 -3
- package/dist/types/models/IEngineEnvironmentVariables.d.ts +389 -0
- package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +49 -0
- package/dist/types/models/{INodeVariables.d.ts → INodeEnvironmentVariables.d.ts} +3 -3
- package/dist/types/models/{IRunOptions.d.ts → INodeOptions.d.ts} +17 -1
- package/dist/types/node.d.ts +22 -3
- package/dist/types/server.d.ts +7 -14
- package/dist/types/utils.d.ts +8 -2
- package/docs/changelog.md +42 -0
- package/docs/reference/functions/bootstrap.md +2 -2
- package/docs/reference/functions/bootstrapAttestationMethod.md +2 -2
- package/docs/reference/functions/bootstrapAuth.md +2 -2
- package/docs/reference/functions/bootstrapBlobEncryption.md +2 -2
- package/docs/reference/functions/bootstrapImmutableProofMethod.md +2 -2
- package/docs/reference/functions/bootstrapNodeIdentity.md +2 -2
- package/docs/reference/functions/bootstrapNodeUser.md +2 -2
- package/docs/reference/functions/buildConfiguration.md +30 -0
- package/docs/reference/functions/buildEngineConfiguration.md +19 -0
- package/docs/reference/functions/getFeatures.md +1 -1
- package/docs/reference/functions/loadJsonFile.md +25 -0
- package/docs/reference/functions/run.md +3 -3
- package/docs/reference/functions/start.md +9 -39
- package/docs/reference/index.md +7 -3
- package/docs/reference/interfaces/IEngineEnvironmentVariables.md +775 -0
- package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +95 -0
- package/docs/reference/interfaces/INodeEnvironmentVariables.md +1343 -0
- package/docs/reference/interfaces/{IRunOptions.md → INodeOptions.md} +38 -1
- package/locales/en.json +0 -1
- package/package.json +15 -15
- package/dist/types/models/INodeState.d.ts +0 -10
- package/docs/reference/interfaces/INodeState.md +0 -15
- package/docs/reference/interfaces/INodeVariables.md +0 -59
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { IEngineCore, IEngineCoreContext } from "@twin.org/engine-models";
|
|
1
|
+
import type { IEngineCore, IEngineCoreContext, IEngineState } from "@twin.org/engine-models";
|
|
2
2
|
import type { IEngineServerConfig } from "@twin.org/engine-server-types";
|
|
3
|
-
import type {
|
|
4
|
-
import type { INodeVariables } from "./models/INodeVariables";
|
|
3
|
+
import type { INodeEnvironmentVariables } from "./models/INodeEnvironmentVariables";
|
|
5
4
|
import { NodeFeatures } from "./models/nodeFeatures";
|
|
6
5
|
/**
|
|
7
6
|
* Bootstrap the application.
|
|
@@ -9,7 +8,7 @@ import { NodeFeatures } from "./models/nodeFeatures";
|
|
|
9
8
|
* @param context The context for the node.
|
|
10
9
|
* @param envVars The environment variables for the node.
|
|
11
10
|
*/
|
|
12
|
-
export declare function bootstrap(engineCore: IEngineCore, context: IEngineCoreContext<IEngineServerConfig,
|
|
11
|
+
export declare function bootstrap(engineCore: IEngineCore, context: IEngineCoreContext<IEngineServerConfig, IEngineState>, envVars: INodeEnvironmentVariables): Promise<void>;
|
|
13
12
|
/**
|
|
14
13
|
* Bootstrap the node creating any necessary resources.
|
|
15
14
|
* @param engineCore The engine core for the node.
|
|
@@ -17,7 +16,7 @@ export declare function bootstrap(engineCore: IEngineCore, context: IEngineCoreC
|
|
|
17
16
|
* @param envVars The environment variables for the node.
|
|
18
17
|
* @param features The features that are enabled on the node. The features that are enabled on the node.
|
|
19
18
|
*/
|
|
20
|
-
export declare function bootstrapNodeIdentity(engineCore: IEngineCore, context: IEngineCoreContext<IEngineServerConfig,
|
|
19
|
+
export declare function bootstrapNodeIdentity(engineCore: IEngineCore, context: IEngineCoreContext<IEngineServerConfig, IEngineState>, envVars: INodeEnvironmentVariables, features: NodeFeatures[]): Promise<void>;
|
|
21
20
|
/**
|
|
22
21
|
* Bootstrap the user.
|
|
23
22
|
* @param engineCore The engine core for the node.
|
|
@@ -25,7 +24,7 @@ export declare function bootstrapNodeIdentity(engineCore: IEngineCore, context:
|
|
|
25
24
|
* @param envVars The environment variables for the node.
|
|
26
25
|
* @param features The features that are enabled on the node.
|
|
27
26
|
*/
|
|
28
|
-
export declare function bootstrapNodeUser(engineCore: IEngineCore, context: IEngineCoreContext<IEngineServerConfig,
|
|
27
|
+
export declare function bootstrapNodeUser(engineCore: IEngineCore, context: IEngineCoreContext<IEngineServerConfig, IEngineState>, envVars: INodeEnvironmentVariables, features: NodeFeatures[]): Promise<void>;
|
|
29
28
|
/**
|
|
30
29
|
* Bootstrap the attestation verification methods.
|
|
31
30
|
* @param engineCore The engine core for the node.
|
|
@@ -33,7 +32,7 @@ export declare function bootstrapNodeUser(engineCore: IEngineCore, context: IEng
|
|
|
33
32
|
* @param envVars The environment variables for the node.
|
|
34
33
|
* @param features The features that are enabled on the node.
|
|
35
34
|
*/
|
|
36
|
-
export declare function bootstrapAttestationMethod(engineCore: IEngineCore, context: IEngineCoreContext<IEngineServerConfig,
|
|
35
|
+
export declare function bootstrapAttestationMethod(engineCore: IEngineCore, context: IEngineCoreContext<IEngineServerConfig, IEngineState>, envVars: INodeEnvironmentVariables, features: NodeFeatures[]): Promise<void>;
|
|
37
36
|
/**
|
|
38
37
|
* Bootstrap the immutable proof verification methods.
|
|
39
38
|
* @param engineCore The engine core for the node.
|
|
@@ -41,7 +40,7 @@ export declare function bootstrapAttestationMethod(engineCore: IEngineCore, cont
|
|
|
41
40
|
* @param envVars The environment variables for the node.
|
|
42
41
|
* @param features The features that are enabled on the node.
|
|
43
42
|
*/
|
|
44
|
-
export declare function bootstrapImmutableProofMethod(engineCore: IEngineCore, context: IEngineCoreContext<IEngineServerConfig,
|
|
43
|
+
export declare function bootstrapImmutableProofMethod(engineCore: IEngineCore, context: IEngineCoreContext<IEngineServerConfig, IEngineState>, envVars: INodeEnvironmentVariables, features: NodeFeatures[]): Promise<void>;
|
|
45
44
|
/**
|
|
46
45
|
* Bootstrap the keys for blob encryption.
|
|
47
46
|
* @param engineCore The engine core for the node.
|
|
@@ -49,7 +48,7 @@ export declare function bootstrapImmutableProofMethod(engineCore: IEngineCore, c
|
|
|
49
48
|
* @param envVars The environment variables for the node.
|
|
50
49
|
* @param features The features that are enabled on the node.
|
|
51
50
|
*/
|
|
52
|
-
export declare function bootstrapBlobEncryption(engineCore: IEngineCore, context: IEngineCoreContext<IEngineServerConfig,
|
|
51
|
+
export declare function bootstrapBlobEncryption(engineCore: IEngineCore, context: IEngineCoreContext<IEngineServerConfig, IEngineState>, envVars: INodeEnvironmentVariables, features: NodeFeatures[]): Promise<void>;
|
|
53
52
|
/**
|
|
54
53
|
* Bootstrap the JWT signing key.
|
|
55
54
|
* @param engineCore The engine core for the node.
|
|
@@ -57,4 +56,4 @@ export declare function bootstrapBlobEncryption(engineCore: IEngineCore, context
|
|
|
57
56
|
* @param envVars The environment variables for the node.
|
|
58
57
|
* @param features The features that are enabled on the node.
|
|
59
58
|
*/
|
|
60
|
-
export declare function bootstrapAuth(engineCore: IEngineCore, context: IEngineCoreContext<IEngineServerConfig,
|
|
59
|
+
export declare function bootstrapAuth(engineCore: IEngineCore, context: IEngineCoreContext<IEngineServerConfig, IEngineState>, envVars: INodeEnvironmentVariables, features: NodeFeatures[]): Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type IEngineConfig } from "@twin.org/engine-types";
|
|
2
|
+
import type { IEngineEnvironmentVariables } from "../models/IEngineEnvironmentVariables";
|
|
3
|
+
/**
|
|
4
|
+
* Build the engine core configuration from environment variables.
|
|
5
|
+
* @param envVars The environment variables.
|
|
6
|
+
* @returns The config for the core.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildEngineConfiguration(envVars: IEngineEnvironmentVariables): IEngineConfig;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IServerInfo } from "@twin.org/api-models";
|
|
2
|
+
import type { IEngineCoreConfig } from "@twin.org/engine-models";
|
|
3
|
+
import { type IEngineServerConfig } from "@twin.org/engine-server-types";
|
|
4
|
+
import type { IEngineServerEnvironmentVariables } from "../models/IEngineServerEnvironmentVariables";
|
|
5
|
+
/**
|
|
6
|
+
* Handles the configuration of the server.
|
|
7
|
+
* @param envVars The environment variables for the engine server.
|
|
8
|
+
* @param coreEngineConfig The core engine config.
|
|
9
|
+
* @param serverInfo The server information.
|
|
10
|
+
* @param openApiSpecPath The path to the open api spec.
|
|
11
|
+
* @returns The the config for the core and the server.
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildEngineServerConfiguration(envVars: IEngineServerEnvironmentVariables, coreEngineConfig: IEngineCoreConfig, serverInfo: IServerInfo, openApiSpecPath?: string): IEngineServerConfig;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from "./bootstrap";
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./models/
|
|
4
|
-
export * from "./models/
|
|
2
|
+
export * from "./builders/engineEnvBuilder";
|
|
3
|
+
export * from "./models/IEngineEnvironmentVariables";
|
|
4
|
+
export * from "./models/IEngineServerEnvironmentVariables";
|
|
5
|
+
export * from "./models/INodeEnvironmentVariables";
|
|
6
|
+
export * from "./models/INodeOptions";
|
|
5
7
|
export * from "./models/nodeFeatures";
|
|
6
8
|
export * from "./node";
|
|
7
9
|
export * from "./server";
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The engine core environment variables.
|
|
3
|
+
*/
|
|
4
|
+
export interface IEngineEnvironmentVariables {
|
|
5
|
+
/**
|
|
6
|
+
* Start the engine in debug mode.
|
|
7
|
+
*/
|
|
8
|
+
debug?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The root directory for storing items like state file.
|
|
11
|
+
*/
|
|
12
|
+
storageFileRoot?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The name of the state file.
|
|
15
|
+
*/
|
|
16
|
+
stateFilename?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The type of the default entity storage: file, memory, aws-dynamodb, azure-cosmosdb, gcp-firestoredb, scylladb, mysql, mongodb, postgresql.
|
|
19
|
+
*/
|
|
20
|
+
entityStorageConnectorType?: string;
|
|
21
|
+
/**
|
|
22
|
+
* A prefix for all the table in entity-storage, can be empty.
|
|
23
|
+
*/
|
|
24
|
+
entityStorageTablePrefix?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Enable the file entity storage connector.
|
|
27
|
+
*/
|
|
28
|
+
entityFileEnable?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Enable the memory entity storage connector.
|
|
31
|
+
*/
|
|
32
|
+
entityMemoryEnable?: string;
|
|
33
|
+
/**
|
|
34
|
+
* AWS Dynamo DB access key id.
|
|
35
|
+
*/
|
|
36
|
+
awsDynamodbAccessKeyId?: string;
|
|
37
|
+
/**
|
|
38
|
+
* AWS Dynamo DB Endpoint if running local instance.
|
|
39
|
+
*/
|
|
40
|
+
awsDynamodbEndpoint?: string;
|
|
41
|
+
/**
|
|
42
|
+
* AWS Dynamo DB region.
|
|
43
|
+
*/
|
|
44
|
+
awsDynamodbRegion?: string;
|
|
45
|
+
/**
|
|
46
|
+
* AWS Dynamo DB secret access key.
|
|
47
|
+
*/
|
|
48
|
+
awsDynamodbSecretAccessKey?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Azure Cosmos DB key.
|
|
51
|
+
*/
|
|
52
|
+
azureCosmosdbKey?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Azure Cosmos DB container id.
|
|
55
|
+
*/
|
|
56
|
+
azureCosmosdbContainerId?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Azure Cosmos DB database id.
|
|
59
|
+
*/
|
|
60
|
+
azureCosmosdbDatabaseId?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Azure Cosmos DB endpoint.
|
|
63
|
+
*/
|
|
64
|
+
azureCosmosdbEndpoint?: string;
|
|
65
|
+
/**
|
|
66
|
+
* GCP Firestore collection name.
|
|
67
|
+
*/
|
|
68
|
+
gcpFirestoreCollectionName?: string;
|
|
69
|
+
/**
|
|
70
|
+
* GCP Firestore credentials.
|
|
71
|
+
*/
|
|
72
|
+
gcpFirestoreCredentials?: string;
|
|
73
|
+
/**
|
|
74
|
+
* GCP Firestore database id.
|
|
75
|
+
*/
|
|
76
|
+
gcpFirestoreDatabaseId?: string;
|
|
77
|
+
/**
|
|
78
|
+
* GCP Firestore endpoint.
|
|
79
|
+
*/
|
|
80
|
+
gcpFirestoreApiEndpoint?: string;
|
|
81
|
+
/**
|
|
82
|
+
* GCP Firestore project id.
|
|
83
|
+
*/
|
|
84
|
+
gcpFirestoreProjectId?: string;
|
|
85
|
+
/**
|
|
86
|
+
* ScyllaDB hosts as comma separated string.
|
|
87
|
+
*/
|
|
88
|
+
scylladbHosts?: string;
|
|
89
|
+
/**
|
|
90
|
+
* ScyllaDB keyspace.
|
|
91
|
+
*/
|
|
92
|
+
scylladbKeyspace?: string;
|
|
93
|
+
/**
|
|
94
|
+
* ScyllaDB local data center.
|
|
95
|
+
*/
|
|
96
|
+
scylladbLocalDataCenter?: string;
|
|
97
|
+
/**
|
|
98
|
+
* MySQL host.
|
|
99
|
+
*/
|
|
100
|
+
mySqlHost?: string;
|
|
101
|
+
/**
|
|
102
|
+
* MySQL port.
|
|
103
|
+
*/
|
|
104
|
+
mySqlPort?: number;
|
|
105
|
+
/**
|
|
106
|
+
* MySQL username.
|
|
107
|
+
*/
|
|
108
|
+
mySqlUser?: string;
|
|
109
|
+
/**
|
|
110
|
+
* MySQL password.
|
|
111
|
+
*/
|
|
112
|
+
mySqlPassword?: string;
|
|
113
|
+
/**
|
|
114
|
+
* MySQL Database.
|
|
115
|
+
*/
|
|
116
|
+
mySqlDatabase?: string;
|
|
117
|
+
/**
|
|
118
|
+
* MongoDB host.
|
|
119
|
+
*/
|
|
120
|
+
mongoDbHost?: string;
|
|
121
|
+
/**
|
|
122
|
+
* MongoDB port.
|
|
123
|
+
*/
|
|
124
|
+
mongoDbPort?: number;
|
|
125
|
+
/**
|
|
126
|
+
* MongoDB username.
|
|
127
|
+
*/
|
|
128
|
+
mongoDbUser?: string;
|
|
129
|
+
/**
|
|
130
|
+
* MongoDB password.
|
|
131
|
+
*/
|
|
132
|
+
mongoDbPassword?: string;
|
|
133
|
+
/**
|
|
134
|
+
* MongoDB Database.
|
|
135
|
+
*/
|
|
136
|
+
mongoDbDatabase?: string;
|
|
137
|
+
/**
|
|
138
|
+
* PostgreSQl host.
|
|
139
|
+
*/
|
|
140
|
+
postgreSqlHost?: string;
|
|
141
|
+
/**
|
|
142
|
+
* PostgreSQl port.
|
|
143
|
+
*/
|
|
144
|
+
postgreSqlPort?: number;
|
|
145
|
+
/**
|
|
146
|
+
* PostgreSQl username.
|
|
147
|
+
*/
|
|
148
|
+
postgreSqlUser?: string;
|
|
149
|
+
/**
|
|
150
|
+
* PostgreSQl password.
|
|
151
|
+
*/
|
|
152
|
+
postgreSqlPassword?: string;
|
|
153
|
+
/**
|
|
154
|
+
* PostgreSQl Database.
|
|
155
|
+
*/
|
|
156
|
+
postgreSqlDatabase?: string;
|
|
157
|
+
/**
|
|
158
|
+
* The security token for accessing IPFS API.
|
|
159
|
+
*/
|
|
160
|
+
ipfsBearerToken?: string;
|
|
161
|
+
/**
|
|
162
|
+
* The url for accessing IPFS API.
|
|
163
|
+
*/
|
|
164
|
+
ipfsApiUrl?: string;
|
|
165
|
+
/**
|
|
166
|
+
* The type of the default blob storage: memory, file, ipfs, aws-s3, azure-storage, gcp-storage.
|
|
167
|
+
*/
|
|
168
|
+
blobStorageConnectorType?: string;
|
|
169
|
+
/**
|
|
170
|
+
* Enable encryption for the blob storage.
|
|
171
|
+
*/
|
|
172
|
+
blobStorageEnableEncryption?: string;
|
|
173
|
+
/**
|
|
174
|
+
* The encryption key for the blob storage.
|
|
175
|
+
*/
|
|
176
|
+
blobStorageEncryptionKey?: string;
|
|
177
|
+
/**
|
|
178
|
+
* A prefix for all the blobs in blob-storage, can be empty.
|
|
179
|
+
*/
|
|
180
|
+
blobStoragePrefix?: string;
|
|
181
|
+
/**
|
|
182
|
+
* Enable the file blob storage connector.
|
|
183
|
+
*/
|
|
184
|
+
blobFileEnable?: string;
|
|
185
|
+
/**
|
|
186
|
+
* Enable the memory blob storage connector.
|
|
187
|
+
*/
|
|
188
|
+
blobMemoryEnable?: string;
|
|
189
|
+
/**
|
|
190
|
+
* AWS S3 access key id.
|
|
191
|
+
*/
|
|
192
|
+
awsS3AccessKeyId?: string;
|
|
193
|
+
/**
|
|
194
|
+
* AWS S3 bucket name.
|
|
195
|
+
*/
|
|
196
|
+
awsS3BucketName?: string;
|
|
197
|
+
/**
|
|
198
|
+
* AWS S3 endpoint.
|
|
199
|
+
*/
|
|
200
|
+
awsS3Endpoint?: string;
|
|
201
|
+
/**
|
|
202
|
+
* AWS S3 region.
|
|
203
|
+
*/
|
|
204
|
+
awsS3Region?: string;
|
|
205
|
+
/**
|
|
206
|
+
* AWS S3 secret access key.
|
|
207
|
+
*/
|
|
208
|
+
awsS3SecretAccessKey?: string;
|
|
209
|
+
/**
|
|
210
|
+
* Azure Storage account key.
|
|
211
|
+
*/
|
|
212
|
+
azureStorageAccountKey?: string;
|
|
213
|
+
/**
|
|
214
|
+
* Azure Storage account name.
|
|
215
|
+
*/
|
|
216
|
+
azureStorageAccountName?: string;
|
|
217
|
+
/**
|
|
218
|
+
* Azure Storage container.
|
|
219
|
+
*/
|
|
220
|
+
azureStorageContainerName?: string;
|
|
221
|
+
/**
|
|
222
|
+
* Azure Storage endpoint.
|
|
223
|
+
*/
|
|
224
|
+
azureStorageEndpoint?: string;
|
|
225
|
+
/**
|
|
226
|
+
* GCP Storage bucket.
|
|
227
|
+
*/
|
|
228
|
+
gcpStorageBucketName?: string;
|
|
229
|
+
/**
|
|
230
|
+
* GCP Storage credentials.
|
|
231
|
+
*/
|
|
232
|
+
gcpStorageCredentials?: string;
|
|
233
|
+
/**
|
|
234
|
+
* GCP Storage endpoint.
|
|
235
|
+
*/
|
|
236
|
+
gcpStorageEndpoint?: string;
|
|
237
|
+
/**
|
|
238
|
+
* GCP Storage project id.
|
|
239
|
+
*/
|
|
240
|
+
gcpStorageProjectId?: string;
|
|
241
|
+
/**
|
|
242
|
+
* The type of the default vault connector: entity-storage, hashicorp.
|
|
243
|
+
*/
|
|
244
|
+
vaultConnector?: string;
|
|
245
|
+
/**
|
|
246
|
+
* Hashicorp Vault token.
|
|
247
|
+
*/
|
|
248
|
+
hashicorpVaultToken?: string;
|
|
249
|
+
/**
|
|
250
|
+
* Hashicorp Vault endpoint.
|
|
251
|
+
*/
|
|
252
|
+
hashicorpVaultEndpoint?: string;
|
|
253
|
+
/**
|
|
254
|
+
* The type of background task connector, can be a comma separated list: console, entity-storage.
|
|
255
|
+
*/
|
|
256
|
+
loggingConnector?: string;
|
|
257
|
+
/**
|
|
258
|
+
* The type of background task connector: entity-storage.
|
|
259
|
+
*/
|
|
260
|
+
backgroundTaskConnector?: string;
|
|
261
|
+
/**
|
|
262
|
+
* The type of event bus connector: local.
|
|
263
|
+
*/
|
|
264
|
+
eventBusConnector?: string;
|
|
265
|
+
/**
|
|
266
|
+
* The type of event bus component: service.
|
|
267
|
+
*/
|
|
268
|
+
eventBusComponent?: string;
|
|
269
|
+
/**
|
|
270
|
+
* The type of messaging email connector: entity-storage, aws.
|
|
271
|
+
*/
|
|
272
|
+
messagingEmailConnector?: string;
|
|
273
|
+
/**
|
|
274
|
+
* The type of messaging sms connector: entity-storage, aws.
|
|
275
|
+
*/
|
|
276
|
+
messagingSmsConnector?: string;
|
|
277
|
+
/**
|
|
278
|
+
* The type of messaging push notification connector: entity-storage, aws.
|
|
279
|
+
*/
|
|
280
|
+
messagingPushNotificationConnector?: string;
|
|
281
|
+
/**
|
|
282
|
+
* The applications for the push notifications JSON stringified array of IAwsApplicationSettings.
|
|
283
|
+
*/
|
|
284
|
+
awsMessagingPushNotificationApplications?: string;
|
|
285
|
+
/**
|
|
286
|
+
* The type of messaging component: service.
|
|
287
|
+
*/
|
|
288
|
+
messagingComponent?: string;
|
|
289
|
+
/**
|
|
290
|
+
* The type of telemetry connector: entity-storage.
|
|
291
|
+
*/
|
|
292
|
+
telemetryConnector?: string;
|
|
293
|
+
/**
|
|
294
|
+
* The type of faucet connector: entity-storage, iota.
|
|
295
|
+
*/
|
|
296
|
+
faucetConnector?: string;
|
|
297
|
+
/**
|
|
298
|
+
* The type of wallet connector: entity-storage, iota.
|
|
299
|
+
*/
|
|
300
|
+
walletConnector?: string;
|
|
301
|
+
/**
|
|
302
|
+
* The type of NFT connector: entity-storage, iota.
|
|
303
|
+
*/
|
|
304
|
+
nftConnector?: string;
|
|
305
|
+
/**
|
|
306
|
+
* The type of identity connector: entity-storage, iota.
|
|
307
|
+
*/
|
|
308
|
+
identityConnector?: string;
|
|
309
|
+
/**
|
|
310
|
+
* The type of identity resolver connector: entity-storage, iota.
|
|
311
|
+
*/
|
|
312
|
+
identityResolverConnector?: string;
|
|
313
|
+
/**
|
|
314
|
+
* The type of verifiable storage connector: entity-storage, iota.
|
|
315
|
+
*/
|
|
316
|
+
verifiableStorageConnector?: string;
|
|
317
|
+
/**
|
|
318
|
+
* IOTA Faucet Endpoint.
|
|
319
|
+
*/
|
|
320
|
+
iotaFaucetEndpoint?: string;
|
|
321
|
+
/**
|
|
322
|
+
* IOTA Node Endpoint.
|
|
323
|
+
*/
|
|
324
|
+
iotaNodeEndpoint?: string;
|
|
325
|
+
/**
|
|
326
|
+
* IOTA network.
|
|
327
|
+
*/
|
|
328
|
+
iotaNetwork?: string;
|
|
329
|
+
/**
|
|
330
|
+
* IOTA coin type.
|
|
331
|
+
*/
|
|
332
|
+
iotaCoinType?: string;
|
|
333
|
+
/**
|
|
334
|
+
* IOTA Explorer Endpoint.
|
|
335
|
+
*/
|
|
336
|
+
iotaExplorerEndpoint?: string;
|
|
337
|
+
/**
|
|
338
|
+
* IOTA Gas Station Endpoint.
|
|
339
|
+
*/
|
|
340
|
+
iotaGasStationEndpoint?: string;
|
|
341
|
+
/**
|
|
342
|
+
* IOTA Gas Station Authentication Token.
|
|
343
|
+
*/
|
|
344
|
+
iotaGasStationAuthToken?: string;
|
|
345
|
+
/**
|
|
346
|
+
* Universal Resolver Endpoint.
|
|
347
|
+
*/
|
|
348
|
+
universalResolverEndpoint?: string;
|
|
349
|
+
/**
|
|
350
|
+
* The type of identity profile connector: entity-storage.
|
|
351
|
+
*/
|
|
352
|
+
identityProfileConnector?: string;
|
|
353
|
+
/**
|
|
354
|
+
* The identity verification method id to use with immutable proofs.
|
|
355
|
+
*/
|
|
356
|
+
immutableProofVerificationMethodId?: string;
|
|
357
|
+
/**
|
|
358
|
+
* The type of attestation connector: entity-storage, iota.
|
|
359
|
+
*/
|
|
360
|
+
attestationConnector?: string;
|
|
361
|
+
/**
|
|
362
|
+
* The identity verification method id to use with attestation.
|
|
363
|
+
*/
|
|
364
|
+
attestationVerificationMethodId?: string;
|
|
365
|
+
/**
|
|
366
|
+
* The type of the default data converters, can be a comma separated list: json, xml.
|
|
367
|
+
*/
|
|
368
|
+
dataConverterConnectors?: string;
|
|
369
|
+
/**
|
|
370
|
+
* The type of the default data extractor, can be a comma separated list: json-path.
|
|
371
|
+
*/
|
|
372
|
+
dataExtractorConnectors?: string;
|
|
373
|
+
/**
|
|
374
|
+
* Federated catalog TTL for the cache.
|
|
375
|
+
*/
|
|
376
|
+
federatedCatalogueCacheTtlMs?: number;
|
|
377
|
+
/**
|
|
378
|
+
* Federated catalog clearing house approver list, stringified array of DIDs.
|
|
379
|
+
*/
|
|
380
|
+
federatedCatalogueClearingHouseApproverList?: string;
|
|
381
|
+
/**
|
|
382
|
+
* Is the rights management enabled, defaults to false.
|
|
383
|
+
*/
|
|
384
|
+
rightsManagementEnabled?: string;
|
|
385
|
+
/**
|
|
386
|
+
* Is the task scheduler enabled, defaults to true.
|
|
387
|
+
*/
|
|
388
|
+
taskSchedulerEnabled?: string;
|
|
389
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The engine server environment variables.
|
|
3
|
+
*/
|
|
4
|
+
export interface IEngineServerEnvironmentVariables {
|
|
5
|
+
/**
|
|
6
|
+
* The port to serve the API from.
|
|
7
|
+
*/
|
|
8
|
+
port?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The host to serve the API from.
|
|
11
|
+
*/
|
|
12
|
+
host?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The CORS origins to allow, defaults to *.
|
|
15
|
+
*/
|
|
16
|
+
corsOrigins?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The CORS methods to allow, defaults to GET, POST, PUT, DELETE, OPTIONS.
|
|
19
|
+
*/
|
|
20
|
+
httpMethods?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The CORS headers to allow.
|
|
23
|
+
*/
|
|
24
|
+
httpAllowedHeaders?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The CORS headers to expose.
|
|
27
|
+
*/
|
|
28
|
+
httpExposedHeaders?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The type of auth admin processor to use on the API: entity-storage.
|
|
31
|
+
*/
|
|
32
|
+
authAdminProcessorType?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The type of auth processor to use on the API: entity-storage.
|
|
35
|
+
*/
|
|
36
|
+
authProcessorType?: string;
|
|
37
|
+
/**
|
|
38
|
+
* The id of the key in the vault to use for signing in auth operations.
|
|
39
|
+
*/
|
|
40
|
+
authSigningKeyId?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Additional MIME type processors to include, comma separated.
|
|
43
|
+
*/
|
|
44
|
+
mimeTypeProcessors?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Disable Node Identity route processors.
|
|
47
|
+
*/
|
|
48
|
+
disableNodeIdentity?: string;
|
|
49
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { IEngineEnvironmentVariables } from "
|
|
2
|
-
import type { IEngineServerEnvironmentVariables } from "
|
|
1
|
+
import type { IEngineEnvironmentVariables } from "./IEngineEnvironmentVariables";
|
|
2
|
+
import type { IEngineServerEnvironmentVariables } from "./IEngineServerEnvironmentVariables";
|
|
3
3
|
/**
|
|
4
4
|
* The environment variables for the node.
|
|
5
5
|
*/
|
|
6
|
-
export interface
|
|
6
|
+
export interface INodeEnvironmentVariables extends IEngineEnvironmentVariables, IEngineServerEnvironmentVariables {
|
|
7
7
|
/**
|
|
8
8
|
* The features that are enabled on the node.
|
|
9
9
|
* @default [NodeFeatures.NodeIdentity]
|
|
@@ -1,9 +1,10 @@
|
|
|
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 { INodeEnvironmentVariables } from "./INodeEnvironmentVariables";
|
|
3
4
|
/**
|
|
4
5
|
* The options when running the node.
|
|
5
6
|
*/
|
|
6
|
-
export interface
|
|
7
|
+
export interface INodeOptions {
|
|
7
8
|
/**
|
|
8
9
|
* The name of the server, defaults to "TWIN Node Server".
|
|
9
10
|
* @default "TWIN Node Server"
|
|
@@ -21,6 +22,17 @@ export interface IRunOptions {
|
|
|
21
22
|
* The prefix for environment variables, defaults to "TWIN_NODE_".
|
|
22
23
|
*/
|
|
23
24
|
envPrefix?: string;
|
|
25
|
+
/**
|
|
26
|
+
* A list of JSON files to load as configuration files.
|
|
27
|
+
* The files will be loaded in the order they are provided, and the last one will
|
|
28
|
+
* override any previous values.
|
|
29
|
+
*/
|
|
30
|
+
configFilenames?: string[];
|
|
31
|
+
/**
|
|
32
|
+
* Provides the ability to have some initial custom configuration for the engine.
|
|
33
|
+
* This will be merged with any configuration loaded from the environment variables.
|
|
34
|
+
*/
|
|
35
|
+
config?: IEngineConfig;
|
|
24
36
|
/**
|
|
25
37
|
* The directory to override the execution location, defaults to process directory.
|
|
26
38
|
*/
|
|
@@ -33,6 +45,10 @@ export interface IRunOptions {
|
|
|
33
45
|
* The path to the OpenAPI spec file, defaults to docs/open-api/spec.json.
|
|
34
46
|
*/
|
|
35
47
|
openApiSpecFile?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Method to extend the engine environment variables with any additional custom configuration.
|
|
50
|
+
*/
|
|
51
|
+
extendEnvVars?: (envVars: INodeEnvironmentVariables) => Promise<void>;
|
|
36
52
|
/**
|
|
37
53
|
* Method to extend the engine configuration with any additional custom configuration.
|
|
38
54
|
*/
|
package/dist/types/node.d.ts
CHANGED
|
@@ -1,7 +1,26 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IServerInfo } from "@twin.org/api-models";
|
|
2
|
+
import type { IEngineServerConfig } from "@twin.org/engine-server-types";
|
|
3
|
+
import type { INodeEnvironmentVariables } from "./models/INodeEnvironmentVariables";
|
|
4
|
+
import type { INodeOptions } from "./models/INodeOptions";
|
|
2
5
|
/**
|
|
3
6
|
* Run the TWIN Node server.
|
|
4
|
-
* @param
|
|
7
|
+
* @param nodeOptions Optional configuration options for running the server.
|
|
5
8
|
* @returns A promise that resolves when the server is started.
|
|
6
9
|
*/
|
|
7
|
-
export declare function run(
|
|
10
|
+
export declare function run(nodeOptions?: INodeOptions): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Build the configuration for the TWIN Node server.
|
|
13
|
+
* @param processEnv The environment variables from the process.
|
|
14
|
+
* @param options The options for running the server.
|
|
15
|
+
* @param serverInfo The server information.
|
|
16
|
+
* @returns A promise that resolves to the engine server configuration, environment prefix, environment variables,
|
|
17
|
+
* and options.
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildConfiguration(processEnv: {
|
|
20
|
+
[id: string]: string;
|
|
21
|
+
}, options: INodeOptions, serverInfo: IServerInfo): Promise<{
|
|
22
|
+
nodeEnvVars: INodeEnvironmentVariables & {
|
|
23
|
+
[id: string]: string | unknown;
|
|
24
|
+
};
|
|
25
|
+
engineServerConfig: IEngineServerConfig;
|
|
26
|
+
}>;
|
package/dist/types/server.d.ts
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
import type { IServerInfo } from "@twin.org/api-models";
|
|
2
1
|
import { Engine } from "@twin.org/engine";
|
|
3
|
-
import { type
|
|
2
|
+
import { type IEngineState } from "@twin.org/engine-models";
|
|
4
3
|
import { EngineServer } from "@twin.org/engine-server";
|
|
5
4
|
import type { IEngineServerConfig } from "@twin.org/engine-server-types";
|
|
6
|
-
import {
|
|
7
|
-
import type {
|
|
8
|
-
import type { INodeVariables } from "./models/INodeVariables";
|
|
5
|
+
import type { INodeEnvironmentVariables } from "./models/INodeEnvironmentVariables";
|
|
6
|
+
import type { INodeOptions } from "./models/INodeOptions";
|
|
9
7
|
/**
|
|
10
8
|
* Start the engine server.
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
9
|
+
* @param nodeOptions Optional run options for the engine server.
|
|
10
|
+
* @param engineServerConfig The configuration for the engine server.
|
|
13
11
|
* @param envVars The environment variables.
|
|
14
|
-
* @param openApiSpecFile Path to the OpenAPI spec file.
|
|
15
|
-
* @param stateStorage The state storage.
|
|
16
|
-
* @param extendConfig Extends the engine configuration with any additional custom configuration.
|
|
17
|
-
* @param extendEngine Extends the engine with any additional options.
|
|
18
|
-
* @param extendEngineServer Extends the engine server with any additional options.
|
|
19
12
|
* @returns The engine server.
|
|
20
13
|
*/
|
|
21
|
-
export declare function start(
|
|
22
|
-
engine: Engine<IEngineServerConfig,
|
|
14
|
+
export declare function start(nodeOptions: INodeOptions | undefined, engineServerConfig: IEngineServerConfig, envVars: INodeEnvironmentVariables): Promise<{
|
|
15
|
+
engine: Engine<IEngineServerConfig, IEngineState>;
|
|
23
16
|
server: EngineServer;
|
|
24
17
|
} | undefined>;
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { INodeEnvironmentVariables } from "./models/INodeEnvironmentVariables";
|
|
2
2
|
import { NodeFeatures } from "./models/nodeFeatures";
|
|
3
3
|
/**
|
|
4
4
|
* Initialise the locales for the application.
|
|
@@ -16,9 +16,15 @@ 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
|
+
* Load the JSON file.
|
|
21
|
+
* @param filename The filename of the JSON file to load.
|
|
22
|
+
* @returns The contents of the JSON file or null if it could not be loaded.
|
|
23
|
+
*/
|
|
24
|
+
export declare function loadJsonFile<T>(filename: string): Promise<T>;
|
|
19
25
|
/**
|
|
20
26
|
* Get the features that are enabled on the node.
|
|
21
27
|
* @param env The environment variables for the node.
|
|
22
28
|
* @returns The features that are enabled on the node.
|
|
23
29
|
*/
|
|
24
|
-
export declare function getFeatures(env:
|
|
30
|
+
export declare function getFeatures(env: INodeEnvironmentVariables): NodeFeatures[];
|