@twin.org/engine 0.0.1-next.14
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/LICENSE +201 -0
- package/README.md +21 -0
- package/dist/cjs/index.cjs +591 -0
- package/dist/esm/index.mjs +587 -0
- package/dist/types/engine.d.ts +17 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/models/IEngineEnvironmentVariables.d.ts +265 -0
- package/dist/types/utils/engineEnvBuilder.d.ts +8 -0
- package/dist/types/utils/envHelper.d.ts +15 -0
- package/docs/changelog.md +5 -0
- package/docs/examples.md +1 -0
- package/docs/reference/classes/Engine.md +47 -0
- package/docs/reference/classes/EnvHelper.md +41 -0
- package/docs/reference/functions/buildEngineConfiguration.md +17 -0
- package/docs/reference/index.md +14 -0
- package/docs/reference/interfaces/IEngineEnvironmentVariables.md +523 -0
- package/locales/en.json +43 -0
- package/package.json +39 -0
|
@@ -0,0 +1,265 @@
|
|
|
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.
|
|
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
|
+
* The security token for accessing IPFS API.
|
|
99
|
+
*/
|
|
100
|
+
ipfsBearerToken: string;
|
|
101
|
+
/**
|
|
102
|
+
* The url for accessing IPFS API.
|
|
103
|
+
*/
|
|
104
|
+
ipfsApiUrl: string;
|
|
105
|
+
/**
|
|
106
|
+
* The type of the default blob storage: memory, file, ipfs, aws-s3, azure-storage, gcp-storage.
|
|
107
|
+
*/
|
|
108
|
+
blobStorageConnectorType: string;
|
|
109
|
+
/**
|
|
110
|
+
* Enable encryption for the blob storage.
|
|
111
|
+
*/
|
|
112
|
+
blobStorageEnableEncryption: string;
|
|
113
|
+
/**
|
|
114
|
+
* The encryption key for the blob storage.
|
|
115
|
+
*/
|
|
116
|
+
blobStorageEncryptionKey: string;
|
|
117
|
+
/**
|
|
118
|
+
* A prefix for all the blobs in blob-storage, can be empty.
|
|
119
|
+
*/
|
|
120
|
+
blobStoragePrefix: string;
|
|
121
|
+
/**
|
|
122
|
+
* Enable the file blob storage connector.
|
|
123
|
+
*/
|
|
124
|
+
blobFileEnable: string;
|
|
125
|
+
/**
|
|
126
|
+
* Enable the memory blob storage connector.
|
|
127
|
+
*/
|
|
128
|
+
blobMemoryEnable: string;
|
|
129
|
+
/**
|
|
130
|
+
* AWS S3 access key id.
|
|
131
|
+
*/
|
|
132
|
+
awsS3AccessKeyId: string;
|
|
133
|
+
/**
|
|
134
|
+
* AWS S3 bucket name.
|
|
135
|
+
*/
|
|
136
|
+
awsS3BucketName: string;
|
|
137
|
+
/**
|
|
138
|
+
* AWS S3 endpoint.
|
|
139
|
+
*/
|
|
140
|
+
awsS3Endpoint: string;
|
|
141
|
+
/**
|
|
142
|
+
* AWS S3 region.
|
|
143
|
+
*/
|
|
144
|
+
awsS3Region: string;
|
|
145
|
+
/**
|
|
146
|
+
* AWS S3 secret access key.
|
|
147
|
+
*/
|
|
148
|
+
awsS3SecretAccessKey: string;
|
|
149
|
+
/**
|
|
150
|
+
* Azure Storage account key.
|
|
151
|
+
*/
|
|
152
|
+
azureStorageAccountKey: string;
|
|
153
|
+
/**
|
|
154
|
+
* Azure Storage account name.
|
|
155
|
+
*/
|
|
156
|
+
azureStorageAccountName: string;
|
|
157
|
+
/**
|
|
158
|
+
* Azure Storage container.
|
|
159
|
+
*/
|
|
160
|
+
azureStorageContainerName: string;
|
|
161
|
+
/**
|
|
162
|
+
* Azure Storage endpoint.
|
|
163
|
+
*/
|
|
164
|
+
azureStorageEndpoint: string;
|
|
165
|
+
/**
|
|
166
|
+
* GCP Storage bucket.
|
|
167
|
+
*/
|
|
168
|
+
gcpStorageBucketName: string;
|
|
169
|
+
/**
|
|
170
|
+
* GCP Storage credentials.
|
|
171
|
+
*/
|
|
172
|
+
gcpStorageCredentials: string;
|
|
173
|
+
/**
|
|
174
|
+
* GCP Storage endpoint.
|
|
175
|
+
*/
|
|
176
|
+
gcpStorageEndpoint: string;
|
|
177
|
+
/**
|
|
178
|
+
* GCP Storage project id.
|
|
179
|
+
*/
|
|
180
|
+
gcpStorageProjectId: string;
|
|
181
|
+
/**
|
|
182
|
+
* The type of the default vault connector: entity-storage, hashicorp.
|
|
183
|
+
*/
|
|
184
|
+
vaultConnector: string;
|
|
185
|
+
/**
|
|
186
|
+
* Hashicorp Vault token.
|
|
187
|
+
*/
|
|
188
|
+
hashicorpVaultToken: string;
|
|
189
|
+
/**
|
|
190
|
+
* Hashicorp Vault endpoint.
|
|
191
|
+
*/
|
|
192
|
+
hashicorpVaultEndpoint: string;
|
|
193
|
+
/**
|
|
194
|
+
* The type of background task connector, can be a comma separated list: console, entity-storage.
|
|
195
|
+
*/
|
|
196
|
+
loggingConnector: string;
|
|
197
|
+
/**
|
|
198
|
+
* The type of background task connector: entity-storage.
|
|
199
|
+
*/
|
|
200
|
+
backgroundTaskConnector: string;
|
|
201
|
+
/**
|
|
202
|
+
* The type of telemetry connector: entity-storage.
|
|
203
|
+
*/
|
|
204
|
+
telemetryConnector: string;
|
|
205
|
+
/**
|
|
206
|
+
* The type of faucet connector: entity-storage, iota.
|
|
207
|
+
*/
|
|
208
|
+
faucetConnector: string;
|
|
209
|
+
/**
|
|
210
|
+
* The type of wallet connector: entity-storage, iota.
|
|
211
|
+
*/
|
|
212
|
+
walletConnector: string;
|
|
213
|
+
/**
|
|
214
|
+
* The type of NFT connector: entity-storage, iota.
|
|
215
|
+
*/
|
|
216
|
+
nftConnector: string;
|
|
217
|
+
/**
|
|
218
|
+
* The type of identity connector: entity-storage, iota.
|
|
219
|
+
*/
|
|
220
|
+
identityConnector: string;
|
|
221
|
+
/**
|
|
222
|
+
* The type of immutable storage connector: entity-storage, iota.
|
|
223
|
+
*/
|
|
224
|
+
immutableStorageConnector: string;
|
|
225
|
+
/**
|
|
226
|
+
* IOTA Faucet Endpoint.
|
|
227
|
+
*/
|
|
228
|
+
iotaFaucetEndpoint: string;
|
|
229
|
+
/**
|
|
230
|
+
* IOTA Node Endpoint.
|
|
231
|
+
*/
|
|
232
|
+
iotaNodeEndpoint: string;
|
|
233
|
+
/**
|
|
234
|
+
* IOTA Bech32 HRP
|
|
235
|
+
*/
|
|
236
|
+
iotaBech32Hrp: string;
|
|
237
|
+
/**
|
|
238
|
+
* IOTA coin type.
|
|
239
|
+
*/
|
|
240
|
+
iotaCoinType: string;
|
|
241
|
+
/**
|
|
242
|
+
* IOTA Explorer Endpoint.
|
|
243
|
+
*/
|
|
244
|
+
iotaExplorerEndpoint: string;
|
|
245
|
+
/**
|
|
246
|
+
* The type of identity profile connector: entity-storage.
|
|
247
|
+
*/
|
|
248
|
+
identityProfileConnector: string;
|
|
249
|
+
/**
|
|
250
|
+
* The identity assertion method id to use with immutable proofs.
|
|
251
|
+
*/
|
|
252
|
+
immutableProofAssertionMethodId: string;
|
|
253
|
+
/**
|
|
254
|
+
* The hash key from the vault to use with immutable proofs.
|
|
255
|
+
*/
|
|
256
|
+
immutableProofHashKeyId: string;
|
|
257
|
+
/**
|
|
258
|
+
* The type of attestation connector: entity-storage, iota.
|
|
259
|
+
*/
|
|
260
|
+
attestationConnector: string;
|
|
261
|
+
/**
|
|
262
|
+
* The identity assertion method id to use with attestation.
|
|
263
|
+
*/
|
|
264
|
+
attestationAssertionMethodId: string;
|
|
265
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type IEngineCoreTypesConfig } 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): IEngineCoreTypesConfig;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IEngineEnvironmentVariables } from "../models/IEngineEnvironmentVariables";
|
|
2
|
+
/**
|
|
3
|
+
* Environment variable helper.
|
|
4
|
+
*/
|
|
5
|
+
export declare class EnvHelper {
|
|
6
|
+
/**
|
|
7
|
+
* Get the environment variable as an object with camel cased names.
|
|
8
|
+
* @param envVars The environment variables.
|
|
9
|
+
* @param prefix The prefix of the environment variables.
|
|
10
|
+
* @returns The object with camel cased names.
|
|
11
|
+
*/
|
|
12
|
+
static envToJson<T = IEngineEnvironmentVariables>(envVars: {
|
|
13
|
+
[id: string]: string | undefined;
|
|
14
|
+
}, prefix: string): T;
|
|
15
|
+
}
|
package/docs/examples.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @twin.org/engine - Examples
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Class: Engine\<C, S\>
|
|
2
|
+
|
|
3
|
+
The engine with built in types.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `EngineCore`\<`C`, `S`\>
|
|
8
|
+
|
|
9
|
+
## Type Parameters
|
|
10
|
+
|
|
11
|
+
• **C** *extends* `IEngineCoreTypesConfig` = `IEngineCoreTypesConfig`
|
|
12
|
+
|
|
13
|
+
• **S** *extends* `IEngineState` = `IEngineState`
|
|
14
|
+
|
|
15
|
+
## Constructors
|
|
16
|
+
|
|
17
|
+
### new Engine()
|
|
18
|
+
|
|
19
|
+
> **new Engine**\<`C`, `S`\>(`options`?): [`Engine`](Engine.md)\<`C`, `S`\>
|
|
20
|
+
|
|
21
|
+
Create a new instance of Engine.
|
|
22
|
+
|
|
23
|
+
#### Parameters
|
|
24
|
+
|
|
25
|
+
• **options?**: `IEngineCoreOptions`\<`C`, `S`\>
|
|
26
|
+
|
|
27
|
+
The options for the engine.
|
|
28
|
+
|
|
29
|
+
#### Returns
|
|
30
|
+
|
|
31
|
+
[`Engine`](Engine.md)\<`C`, `S`\>
|
|
32
|
+
|
|
33
|
+
#### Overrides
|
|
34
|
+
|
|
35
|
+
`EngineCore<C, S>.constructor`
|
|
36
|
+
|
|
37
|
+
## Properties
|
|
38
|
+
|
|
39
|
+
### CLASS\_NAME
|
|
40
|
+
|
|
41
|
+
> `readonly` **CLASS\_NAME**: `string`
|
|
42
|
+
|
|
43
|
+
Runtime name for the class.
|
|
44
|
+
|
|
45
|
+
#### Overrides
|
|
46
|
+
|
|
47
|
+
`EngineCore.CLASS_NAME`
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Class: EnvHelper
|
|
2
|
+
|
|
3
|
+
Environment variable helper.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### new EnvHelper()
|
|
8
|
+
|
|
9
|
+
> **new EnvHelper**(): [`EnvHelper`](EnvHelper.md)
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
[`EnvHelper`](EnvHelper.md)
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### envToJson()
|
|
18
|
+
|
|
19
|
+
> `static` **envToJson**\<`T`\>(`envVars`, `prefix`): `T`
|
|
20
|
+
|
|
21
|
+
Get the environment variable as an object with camel cased names.
|
|
22
|
+
|
|
23
|
+
#### Type Parameters
|
|
24
|
+
|
|
25
|
+
• **T** = [`IEngineEnvironmentVariables`](../interfaces/IEngineEnvironmentVariables.md)
|
|
26
|
+
|
|
27
|
+
#### Parameters
|
|
28
|
+
|
|
29
|
+
• **envVars**
|
|
30
|
+
|
|
31
|
+
The environment variables.
|
|
32
|
+
|
|
33
|
+
• **prefix**: `string`
|
|
34
|
+
|
|
35
|
+
The prefix of the environment variables.
|
|
36
|
+
|
|
37
|
+
#### Returns
|
|
38
|
+
|
|
39
|
+
`T`
|
|
40
|
+
|
|
41
|
+
The object with camel cased names.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Function: buildEngineConfiguration()
|
|
2
|
+
|
|
3
|
+
> **buildEngineConfiguration**(`envVars`): `IEngineCoreTypesConfig`
|
|
4
|
+
|
|
5
|
+
Build the engine core configuration from environment variables.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
• **envVars**: [`IEngineEnvironmentVariables`](../interfaces/IEngineEnvironmentVariables.md)
|
|
10
|
+
|
|
11
|
+
The environment variables.
|
|
12
|
+
|
|
13
|
+
## Returns
|
|
14
|
+
|
|
15
|
+
`IEngineCoreTypesConfig`
|
|
16
|
+
|
|
17
|
+
The config for the core.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# @twin.org/engine
|
|
2
|
+
|
|
3
|
+
## Classes
|
|
4
|
+
|
|
5
|
+
- [Engine](classes/Engine.md)
|
|
6
|
+
- [EnvHelper](classes/EnvHelper.md)
|
|
7
|
+
|
|
8
|
+
## Interfaces
|
|
9
|
+
|
|
10
|
+
- [IEngineEnvironmentVariables](interfaces/IEngineEnvironmentVariables.md)
|
|
11
|
+
|
|
12
|
+
## Functions
|
|
13
|
+
|
|
14
|
+
- [buildEngineConfiguration](functions/buildEngineConfiguration.md)
|