@twin.org/node-core 0.0.1-next.10

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 (43) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +21 -0
  3. package/dist/cjs/index.cjs +1718 -0
  4. package/dist/esm/index.mjs +1681 -0
  5. package/dist/types/bootstrap.d.ts +59 -0
  6. package/dist/types/builders/engineEnvBuilder.d.ts +8 -0
  7. package/dist/types/builders/engineServerEnvBuilder.d.ts +13 -0
  8. package/dist/types/index.d.ts +10 -0
  9. package/dist/types/models/IEngineEnvironmentVariables.d.ts +389 -0
  10. package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +45 -0
  11. package/dist/types/models/INodeEnvironmentVariables.d.ts +29 -0
  12. package/dist/types/models/INodeOptions.d.ts +69 -0
  13. package/dist/types/models/nodeFeatures.d.ts +17 -0
  14. package/dist/types/node.d.ts +26 -0
  15. package/dist/types/server.d.ts +17 -0
  16. package/dist/types/utils.d.ts +30 -0
  17. package/docs/changelog.md +76 -0
  18. package/docs/examples.md +1 -0
  19. package/docs/reference/functions/bootstrap.md +29 -0
  20. package/docs/reference/functions/bootstrapAttestationMethod.md +35 -0
  21. package/docs/reference/functions/bootstrapAuth.md +35 -0
  22. package/docs/reference/functions/bootstrapBlobEncryption.md +35 -0
  23. package/docs/reference/functions/bootstrapImmutableProofMethod.md +35 -0
  24. package/docs/reference/functions/bootstrapNodeIdentity.md +35 -0
  25. package/docs/reference/functions/bootstrapNodeUser.md +35 -0
  26. package/docs/reference/functions/buildConfiguration.md +30 -0
  27. package/docs/reference/functions/buildEngineConfiguration.md +19 -0
  28. package/docs/reference/functions/fileExists.md +19 -0
  29. package/docs/reference/functions/getExecutionDirectory.md +11 -0
  30. package/docs/reference/functions/getFeatures.md +19 -0
  31. package/docs/reference/functions/initialiseLocales.md +17 -0
  32. package/docs/reference/functions/loadJsonFile.md +25 -0
  33. package/docs/reference/functions/run.md +19 -0
  34. package/docs/reference/functions/start.md +31 -0
  35. package/docs/reference/index.md +35 -0
  36. package/docs/reference/interfaces/IEngineEnvironmentVariables.md +775 -0
  37. package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +87 -0
  38. package/docs/reference/interfaces/INodeEnvironmentVariables.md +1331 -0
  39. package/docs/reference/interfaces/INodeOptions.md +165 -0
  40. package/docs/reference/type-aliases/NodeFeatures.md +5 -0
  41. package/docs/reference/variables/NodeFeatures.md +19 -0
  42. package/locales/en.json +34 -0
  43. package/package.json +52 -0
@@ -0,0 +1,165 @@
1
+ # Interface: INodeOptions
2
+
3
+ The options when running the node.
4
+
5
+ ## Properties
6
+
7
+ ### serverName?
8
+
9
+ > `optional` **serverName**: `string`
10
+
11
+ The name of the server, defaults to "TWIN Node Server".
12
+
13
+ #### Default
14
+
15
+ ```ts
16
+ "TWIN Node Server"
17
+ ```
18
+
19
+ ***
20
+
21
+ ### serverVersion?
22
+
23
+ > `optional` **serverVersion**: `string`
24
+
25
+ The version of the server, defaults to the current version.
26
+
27
+ ***
28
+
29
+ ### envFilenames?
30
+
31
+ > `optional` **envFilenames**: `string`[]
32
+
33
+ Additional environment variable filenames to load, defaults to .env.
34
+
35
+ ***
36
+
37
+ ### envPrefix?
38
+
39
+ > `optional` **envPrefix**: `string`
40
+
41
+ The prefix for environment variables, defaults to "TWIN_NODE_".
42
+
43
+ ***
44
+
45
+ ### configFilenames?
46
+
47
+ > `optional` **configFilenames**: `string`[]
48
+
49
+ A list of JSON files to load as configuration files.
50
+ The files will be loaded in the order they are provided, and the last one will
51
+ override any previous values.
52
+
53
+ ***
54
+
55
+ ### config?
56
+
57
+ > `optional` **config**: `IEngineConfig`
58
+
59
+ Provides the ability to have some initial custom configuration for the engine.
60
+ This will be merged with any configuration loaded from the environment variables.
61
+
62
+ ***
63
+
64
+ ### executionDirectory?
65
+
66
+ > `optional` **executionDirectory**: `string`
67
+
68
+ The directory to override the execution location, defaults to process directory.
69
+
70
+ ***
71
+
72
+ ### localesDirectory?
73
+
74
+ > `optional` **localesDirectory**: `string`
75
+
76
+ The directory to override the locales directory, defaults to the locales directory.
77
+
78
+ ***
79
+
80
+ ### openApiSpecFile?
81
+
82
+ > `optional` **openApiSpecFile**: `string`
83
+
84
+ The path to the OpenAPI spec file, defaults to docs/open-api/spec.json.
85
+
86
+ ***
87
+
88
+ ### extendEnvVars()?
89
+
90
+ > `optional` **extendEnvVars**: (`envVars`) => `Promise`\<`void`\>
91
+
92
+ Method to extend the engine environment variables with any additional custom configuration.
93
+
94
+ #### Parameters
95
+
96
+ ##### envVars
97
+
98
+ [`INodeEnvironmentVariables`](INodeEnvironmentVariables.md)
99
+
100
+ #### Returns
101
+
102
+ `Promise`\<`void`\>
103
+
104
+ ***
105
+
106
+ ### extendConfig()?
107
+
108
+ > `optional` **extendConfig**: (`config`) => `Promise`\<`void`\>
109
+
110
+ Method to extend the engine configuration with any additional custom configuration.
111
+
112
+ #### Parameters
113
+
114
+ ##### config
115
+
116
+ `IEngineConfig`
117
+
118
+ #### Returns
119
+
120
+ `Promise`\<`void`\>
121
+
122
+ ***
123
+
124
+ ### extendEngine()?
125
+
126
+ > `optional` **extendEngine**: (`engine`) => `Promise`\<`void`\>
127
+
128
+ Method to extend the engine with any additional options.
129
+
130
+ #### Parameters
131
+
132
+ ##### engine
133
+
134
+ `IEngineCore`
135
+
136
+ #### Returns
137
+
138
+ `Promise`\<`void`\>
139
+
140
+ ***
141
+
142
+ ### extendEngineServer()?
143
+
144
+ > `optional` **extendEngineServer**: (`engineServer`) => `Promise`\<`void`\>
145
+
146
+ Method to extend the engine server with any additional options.
147
+
148
+ #### Parameters
149
+
150
+ ##### engineServer
151
+
152
+ `IEngineServer`
153
+
154
+ #### Returns
155
+
156
+ `Promise`\<`void`\>
157
+
158
+ ***
159
+
160
+ ### stateStorage?
161
+
162
+ > `optional` **stateStorage**: `IEngineStateStorage`\<`IEngineState`\>
163
+
164
+ The state storage to use for the engine.
165
+ If not provided, a default file-based state storage will be used.
@@ -0,0 +1,5 @@
1
+ # Type Alias: NodeFeatures
2
+
3
+ > **NodeFeatures** = *typeof* [`NodeFeatures`](../variables/NodeFeatures.md)\[keyof *typeof* [`NodeFeatures`](../variables/NodeFeatures.md)\]
4
+
5
+ The features that can be enabled on the node.
@@ -0,0 +1,19 @@
1
+ # Variable: NodeFeatures
2
+
3
+ > `const` **NodeFeatures**: `object`
4
+
5
+ The features that can be enabled on the node.
6
+
7
+ ## Type declaration
8
+
9
+ ### NodeIdentity
10
+
11
+ > `readonly` **NodeIdentity**: `"node-identity"` = `"node-identity"`
12
+
13
+ NodeIdentity - generates an identity for the node if not provided in config.
14
+
15
+ ### NodeUser
16
+
17
+ > `readonly` **NodeUser**: `"node-user"` = `"node-user"`
18
+
19
+ NodeUser - generates a user for the node if not provided in config.
@@ -0,0 +1,34 @@
1
+ {
2
+ "error": {
3
+ "node": {
4
+ "storageFileRootNotSet": "{storageFileRoot} is not set, the server will not start without it, please set it in the shell or create a .env file"
5
+ }
6
+ },
7
+ "node": {
8
+ "terminateSignal": "Server terminating",
9
+ "generatingMnemonic": "Generating mnemonic \"{mnemonic}\"",
10
+ "storingMnemonic": "Storing mnemonic",
11
+ "existingMnemonic": "Mnemonic already exists",
12
+ "fundingWallet": "Funding wallet \"{address}\"",
13
+ "fundedWallet": "Wallet already funded",
14
+ "generatingNodeIdentity": "Generating node identity",
15
+ "existingNodeIdentity": "Node identity already exists \"{identity}\"",
16
+ "createdNodeIdentity": "Node identity created \"{identity}\"",
17
+ "identityExplorer": "Identity explorer \"{url}\"",
18
+ "creatingNodeUser": "Creating node user \"{email}\"",
19
+ "existingNodeUser": "Node user already exists \"{email}\"",
20
+ "creatingAuthKey": "Creating authentication key \"{keyName}\"",
21
+ "existingAuthKey": "Authentication key already exists \"{keyName}\"",
22
+ "addingAttestation": "Adding attestation verification method \"{methodId}\"",
23
+ "existingAttestation": "Attestation verification method already exists \"{methodId}\"",
24
+ "addingImmutableProof": "Adding immutable proof verification method \"{methodId}\"",
25
+ "existingImmutableProof": "Immutable proof verification method already exists \"{methodId}\"",
26
+ "creatingBlobEncryptionKey": "Creating blob encryption key \"{keyName}\"",
27
+ "existingBlobEncryptionKey": "Blob encryption key already exists \"{keyName}\"",
28
+ "creatingUserProfile": "Creating user profile \"{identity}\"",
29
+ "existingUserProfile": "User profile already exists \"{identity}\"",
30
+ "nodeIdentity": "Node identity \"{identity}\"",
31
+ "nodeAdminUserEmail": "Node Admin User Email \"{email}\"",
32
+ "nodeAdminUserPassword": "Node Admin User Password \"{password}\""
33
+ }
34
+ }
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@twin.org/node-core",
3
+ "version": "0.0.1-next.10",
4
+ "description": "TWIN Node Core for serving APIs using the specified configuration",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/twinfoundation/node.git",
8
+ "directory": "packages/node-core"
9
+ },
10
+ "author": "martyn.janes@iota.org",
11
+ "license": "Apache-2.0",
12
+ "type": "module",
13
+ "engines": {
14
+ "node": ">=20.0.0"
15
+ },
16
+ "dependencies": {
17
+ "@twin.org/api-auth-entity-storage-service": "next",
18
+ "@twin.org/core": "next",
19
+ "@twin.org/crypto": "next",
20
+ "@twin.org/engine": "next",
21
+ "@twin.org/engine-core": "next",
22
+ "@twin.org/engine-models": "next",
23
+ "@twin.org/engine-server": "next",
24
+ "@twin.org/engine-server-types": "next",
25
+ "@twin.org/engine-types": "next",
26
+ "@twin.org/entity": "next",
27
+ "@twin.org/entity-storage-models": "next",
28
+ "@twin.org/identity-models": "next",
29
+ "@twin.org/vault-models": "next",
30
+ "@twin.org/wallet-models": "next",
31
+ "dotenv": "16.5.0",
32
+ "schema-dts": "1.1.5"
33
+ },
34
+ "main": "./dist/cjs/index.cjs",
35
+ "module": "./dist/esm/index.mjs",
36
+ "types": "./dist/types/index.d.ts",
37
+ "exports": {
38
+ ".": {
39
+ "types": "./dist/types/index.d.ts",
40
+ "require": "./dist/cjs/index.cjs",
41
+ "import": "./dist/esm/index.mjs"
42
+ },
43
+ "./locales/*.json": "./locales/*.json"
44
+ },
45
+ "files": [
46
+ "dist/cjs",
47
+ "dist/esm",
48
+ "dist/types",
49
+ "locales",
50
+ "docs"
51
+ ]
52
+ }