@twin.org/node-core 0.0.1-next.9 → 0.0.2-next.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.
Files changed (38) hide show
  1. package/dist/cjs/index.cjs +1141 -53
  2. package/dist/esm/index.mjs +1141 -57
  3. package/dist/types/bootstrap.d.ts +9 -10
  4. package/dist/types/builders/engineEnvBuilder.d.ts +8 -0
  5. package/dist/types/builders/engineServerEnvBuilder.d.ts +13 -0
  6. package/dist/types/index.d.ts +6 -3
  7. package/dist/types/models/IEngineEnvironmentVariables.d.ts +389 -0
  8. package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +49 -0
  9. package/dist/types/models/{INodeVariables.d.ts → INodeEnvironmentVariables.d.ts} +3 -3
  10. package/dist/types/models/{IRunOptions.d.ts → INodeOptions.d.ts} +17 -1
  11. package/dist/types/node.d.ts +22 -3
  12. package/dist/types/server.d.ts +7 -14
  13. package/dist/types/utils.d.ts +8 -2
  14. package/docs/changelog.md +68 -0
  15. package/docs/reference/functions/bootstrap.md +2 -2
  16. package/docs/reference/functions/bootstrapAttestationMethod.md +2 -2
  17. package/docs/reference/functions/bootstrapAuth.md +2 -2
  18. package/docs/reference/functions/bootstrapBlobEncryption.md +2 -2
  19. package/docs/reference/functions/bootstrapImmutableProofMethod.md +2 -2
  20. package/docs/reference/functions/bootstrapNodeIdentity.md +2 -2
  21. package/docs/reference/functions/bootstrapNodeUser.md +2 -2
  22. package/docs/reference/functions/buildConfiguration.md +30 -0
  23. package/docs/reference/functions/buildEngineConfiguration.md +19 -0
  24. package/docs/reference/functions/buildEngineServerConfiguration.md +37 -0
  25. package/docs/reference/functions/getFeatures.md +1 -1
  26. package/docs/reference/functions/loadJsonFile.md +25 -0
  27. package/docs/reference/functions/run.md +3 -3
  28. package/docs/reference/functions/start.md +9 -39
  29. package/docs/reference/index.md +8 -3
  30. package/docs/reference/interfaces/IEngineEnvironmentVariables.md +775 -0
  31. package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +95 -0
  32. package/docs/reference/interfaces/INodeEnvironmentVariables.md +1343 -0
  33. package/docs/reference/interfaces/{IRunOptions.md → INodeOptions.md} +38 -1
  34. package/locales/en.json +0 -1
  35. package/package.json +1 -1
  36. package/dist/types/models/INodeState.d.ts +0 -10
  37. package/docs/reference/interfaces/INodeState.md +0 -15
  38. package/docs/reference/interfaces/INodeVariables.md +0 -59
package/docs/changelog.md CHANGED
@@ -1,5 +1,73 @@
1
1
  # @twin.org/node-core - Changelog
2
2
 
3
+ ## [0.0.2-next.1](https://github.com/twinfoundation/node/compare/node-core-v0.0.2-next.0...node-core-v0.0.2-next.1) (2025-07-15)
4
+
5
+
6
+ ### Features
7
+
8
+ * add auth admin component ([1661e57](https://github.com/twinfoundation/node/commit/1661e57a699d5cf9ebde333e3cbc3aaea89d7c9c))
9
+ * add extend engine and server methods ([ec09c7e](https://github.com/twinfoundation/node/commit/ec09c7eb882d9f5797f2fd372e96cad1a3716f59))
10
+ * add extend engine and server methods ([0136a6f](https://github.com/twinfoundation/node/commit/0136a6f3f4e1a82b1427ee9618b8a17c79bc7fda))
11
+ * add missing export ([e8eb621](https://github.com/twinfoundation/node/commit/e8eb6213937a202520b164a9970a891004122b61))
12
+ * additional run options ([c35e5bb](https://github.com/twinfoundation/node/commit/c35e5bbb8a80fe6a36628d41f64585b3723d9ad7))
13
+ * additional startup logging ([0740293](https://github.com/twinfoundation/node/commit/0740293b366032f2907046603abf587c9c324aff))
14
+ * improve default options and spec ([b538721](https://github.com/twinfoundation/node/commit/b538721902e7f65021d2715148ba59409ccce035))
15
+ * improve error reporting ([fcd39a1](https://github.com/twinfoundation/node/commit/fcd39a18da2a6ce33965a99ca5f2f36f4aba712f))
16
+ * initial commit ([522f1e5](https://github.com/twinfoundation/node/commit/522f1e515348f9b1dd1eeb3170b1249e2b0b5371))
17
+ * migrate env config from engine to node ([5da29b8](https://github.com/twinfoundation/node/commit/5da29b8d714495308320d237a68e84355bba2b47))
18
+ * node app use JavaScript ([14fe08c](https://github.com/twinfoundation/node/commit/14fe08cb760dd885a5dac9056a4d5dbc3d61df64))
19
+ * update dependencies ([9d25f16](https://github.com/twinfoundation/node/commit/9d25f16f1d554cd38f3bec28fdf7f8fff892ceaf))
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * adding a condition to verify if the password exists when bootstrapping ([6030a42](https://github.com/twinfoundation/node/commit/6030a42bdaf581678d96932fd0b809396bf7b8b0))
25
+ * adding a condition to verify if the password exists when bootstrapping ([c66f396](https://github.com/twinfoundation/node/commit/c66f396717394161a7647d1f08b3d87729d96e96))
26
+ * broken docs ([61479fd](https://github.com/twinfoundation/node/commit/61479fd618f766d22c5aafec5277e1a89e22b453))
27
+ * pr comments [#1](https://github.com/twinfoundation/node/issues/1) ([66e795b](https://github.com/twinfoundation/node/commit/66e795b16c372ab131ec1de30085aee90e4dbbd0))
28
+
29
+ ## 0.0.1 (2025-07-11)
30
+
31
+
32
+ ### Features
33
+
34
+ * add auth admin component ([1661e57](https://github.com/twinfoundation/node/commit/1661e57a699d5cf9ebde333e3cbc3aaea89d7c9c))
35
+ * add extend engine and server methods ([ec09c7e](https://github.com/twinfoundation/node/commit/ec09c7eb882d9f5797f2fd372e96cad1a3716f59))
36
+ * add extend engine and server methods ([0136a6f](https://github.com/twinfoundation/node/commit/0136a6f3f4e1a82b1427ee9618b8a17c79bc7fda))
37
+ * additional run options ([c35e5bb](https://github.com/twinfoundation/node/commit/c35e5bbb8a80fe6a36628d41f64585b3723d9ad7))
38
+ * additional startup logging ([0740293](https://github.com/twinfoundation/node/commit/0740293b366032f2907046603abf587c9c324aff))
39
+ * improve default options and spec ([b538721](https://github.com/twinfoundation/node/commit/b538721902e7f65021d2715148ba59409ccce035))
40
+ * improve error reporting ([fcd39a1](https://github.com/twinfoundation/node/commit/fcd39a18da2a6ce33965a99ca5f2f36f4aba712f))
41
+ * initial commit ([522f1e5](https://github.com/twinfoundation/node/commit/522f1e515348f9b1dd1eeb3170b1249e2b0b5371))
42
+ * migrate env config from engine to node ([5da29b8](https://github.com/twinfoundation/node/commit/5da29b8d714495308320d237a68e84355bba2b47))
43
+ * node app use JavaScript ([14fe08c](https://github.com/twinfoundation/node/commit/14fe08cb760dd885a5dac9056a4d5dbc3d61df64))
44
+ * release to production ([6319a38](https://github.com/twinfoundation/node/commit/6319a38490a2c2809622f8acd170cb92bfa06942))
45
+ * release to production ([4f44403](https://github.com/twinfoundation/node/commit/4f444039832edce8fae562baa7c900ccdc2181da))
46
+ * release to production ([2d96e37](https://github.com/twinfoundation/node/commit/2d96e3737bd9663bc0d1171c2ff2c7f8b2ab01bb))
47
+ * update dependencies ([9d25f16](https://github.com/twinfoundation/node/commit/9d25f16f1d554cd38f3bec28fdf7f8fff892ceaf))
48
+
49
+
50
+ ### Bug Fixes
51
+
52
+ * adding a condition to verify if the password exists when bootstrapping ([6030a42](https://github.com/twinfoundation/node/commit/6030a42bdaf581678d96932fd0b809396bf7b8b0))
53
+ * adding a condition to verify if the password exists when bootstrapping ([c66f396](https://github.com/twinfoundation/node/commit/c66f396717394161a7647d1f08b3d87729d96e96))
54
+ * broken docs ([61479fd](https://github.com/twinfoundation/node/commit/61479fd618f766d22c5aafec5277e1a89e22b453))
55
+ * pr comments [#1](https://github.com/twinfoundation/node/issues/1) ([66e795b](https://github.com/twinfoundation/node/commit/66e795b16c372ab131ec1de30085aee90e4dbbd0))
56
+
57
+ ## [0.0.1-next.11](https://github.com/twinfoundation/node/compare/node-core-v0.0.1-next.10...node-core-v0.0.1-next.11) (2025-07-11)
58
+
59
+
60
+ ### Features
61
+
62
+ * add auth admin component ([1661e57](https://github.com/twinfoundation/node/commit/1661e57a699d5cf9ebde333e3cbc3aaea89d7c9c))
63
+
64
+ ## [0.0.1-next.10](https://github.com/twinfoundation/node/compare/node-core-v0.0.1-next.9...node-core-v0.0.1-next.10) (2025-07-11)
65
+
66
+
67
+ ### Features
68
+
69
+ * migrate env config from engine to node ([5da29b8](https://github.com/twinfoundation/node/commit/5da29b8d714495308320d237a68e84355bba2b47))
70
+
3
71
  ## [0.0.1-next.9](https://github.com/twinfoundation/node/compare/node-core-v0.0.1-next.8...node-core-v0.0.1-next.9) (2025-06-20)
4
72
 
5
73
 
@@ -14,13 +14,13 @@ The engine core for the node.
14
14
 
15
15
  ### context
16
16
 
17
- `IEngineCoreContext`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>
17
+ `IEngineCoreContext`\<`IEngineServerConfig`, `IEngineState`\>
18
18
 
19
19
  The context for the node.
20
20
 
21
21
  ### envVars
22
22
 
23
- [`INodeVariables`](../interfaces/INodeVariables.md)
23
+ [`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
24
24
 
25
25
  The environment variables for the node.
26
26
 
@@ -14,13 +14,13 @@ The engine core for the node.
14
14
 
15
15
  ### context
16
16
 
17
- `IEngineCoreContext`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>
17
+ `IEngineCoreContext`\<`IEngineServerConfig`, `IEngineState`\>
18
18
 
19
19
  The context for the node.
20
20
 
21
21
  ### envVars
22
22
 
23
- [`INodeVariables`](../interfaces/INodeVariables.md)
23
+ [`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
24
24
 
25
25
  The environment variables for the node.
26
26
 
@@ -14,13 +14,13 @@ The engine core for the node.
14
14
 
15
15
  ### context
16
16
 
17
- `IEngineCoreContext`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>
17
+ `IEngineCoreContext`\<`IEngineServerConfig`, `IEngineState`\>
18
18
 
19
19
  The context for the node.
20
20
 
21
21
  ### envVars
22
22
 
23
- [`INodeVariables`](../interfaces/INodeVariables.md)
23
+ [`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
24
24
 
25
25
  The environment variables for the node.
26
26
 
@@ -14,13 +14,13 @@ The engine core for the node.
14
14
 
15
15
  ### context
16
16
 
17
- `IEngineCoreContext`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>
17
+ `IEngineCoreContext`\<`IEngineServerConfig`, `IEngineState`\>
18
18
 
19
19
  The context for the node.
20
20
 
21
21
  ### envVars
22
22
 
23
- [`INodeVariables`](../interfaces/INodeVariables.md)
23
+ [`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
24
24
 
25
25
  The environment variables for the node.
26
26
 
@@ -14,13 +14,13 @@ The engine core for the node.
14
14
 
15
15
  ### context
16
16
 
17
- `IEngineCoreContext`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>
17
+ `IEngineCoreContext`\<`IEngineServerConfig`, `IEngineState`\>
18
18
 
19
19
  The context for the node.
20
20
 
21
21
  ### envVars
22
22
 
23
- [`INodeVariables`](../interfaces/INodeVariables.md)
23
+ [`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
24
24
 
25
25
  The environment variables for the node.
26
26
 
@@ -14,13 +14,13 @@ The engine core for the node.
14
14
 
15
15
  ### context
16
16
 
17
- `IEngineCoreContext`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>
17
+ `IEngineCoreContext`\<`IEngineServerConfig`, `IEngineState`\>
18
18
 
19
19
  The context for the node.
20
20
 
21
21
  ### envVars
22
22
 
23
- [`INodeVariables`](../interfaces/INodeVariables.md)
23
+ [`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
24
24
 
25
25
  The environment variables for the node.
26
26
 
@@ -14,13 +14,13 @@ The engine core for the node.
14
14
 
15
15
  ### context
16
16
 
17
- `IEngineCoreContext`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>
17
+ `IEngineCoreContext`\<`IEngineServerConfig`, `IEngineState`\>
18
18
 
19
19
  The context for the node.
20
20
 
21
21
  ### envVars
22
22
 
23
- [`INodeVariables`](../interfaces/INodeVariables.md)
23
+ [`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
24
24
 
25
25
  The environment variables for the node.
26
26
 
@@ -0,0 +1,30 @@
1
+ # Function: buildConfiguration()
2
+
3
+ > **buildConfiguration**(`processEnv`, `options`, `serverInfo`): `Promise`\<\{ `nodeEnvVars`: [`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md) & `object`; `engineServerConfig`: `IEngineServerConfig`; \}\>
4
+
5
+ Build the configuration for the TWIN Node server.
6
+
7
+ ## Parameters
8
+
9
+ ### processEnv
10
+
11
+ The environment variables from the process.
12
+
13
+ ### options
14
+
15
+ [`INodeOptions`](../interfaces/INodeOptions.md)
16
+
17
+ The options for running the server.
18
+
19
+ ### serverInfo
20
+
21
+ `IServerInfo`
22
+
23
+ The server information.
24
+
25
+ ## Returns
26
+
27
+ `Promise`\<\{ `nodeEnvVars`: [`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md) & `object`; `engineServerConfig`: `IEngineServerConfig`; \}\>
28
+
29
+ A promise that resolves to the engine server configuration, environment prefix, environment variables,
30
+ and options.
@@ -0,0 +1,19 @@
1
+ # Function: buildEngineConfiguration()
2
+
3
+ > **buildEngineConfiguration**(`envVars`): `IEngineConfig`
4
+
5
+ Build the engine core configuration from environment variables.
6
+
7
+ ## Parameters
8
+
9
+ ### envVars
10
+
11
+ [`IEngineEnvironmentVariables`](../interfaces/IEngineEnvironmentVariables.md)
12
+
13
+ The environment variables.
14
+
15
+ ## Returns
16
+
17
+ `IEngineConfig`
18
+
19
+ The config for the core.
@@ -0,0 +1,37 @@
1
+ # Function: buildEngineServerConfiguration()
2
+
3
+ > **buildEngineServerConfiguration**(`envVars`, `coreEngineConfig`, `serverInfo`, `openApiSpecPath?`): `IEngineServerConfig`
4
+
5
+ Handles the configuration of the server.
6
+
7
+ ## Parameters
8
+
9
+ ### envVars
10
+
11
+ [`IEngineServerEnvironmentVariables`](../interfaces/IEngineServerEnvironmentVariables.md)
12
+
13
+ The environment variables for the engine server.
14
+
15
+ ### coreEngineConfig
16
+
17
+ `IEngineCoreConfig`
18
+
19
+ The core engine config.
20
+
21
+ ### serverInfo
22
+
23
+ `IServerInfo`
24
+
25
+ The server information.
26
+
27
+ ### openApiSpecPath?
28
+
29
+ `string`
30
+
31
+ The path to the open api spec.
32
+
33
+ ## Returns
34
+
35
+ `IEngineServerConfig`
36
+
37
+ The the config for the core and the server.
@@ -8,7 +8,7 @@ Get the features that are enabled on the node.
8
8
 
9
9
  ### env
10
10
 
11
- [`INodeVariables`](../interfaces/INodeVariables.md)
11
+ [`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
12
12
 
13
13
  The environment variables for the node.
14
14
 
@@ -0,0 +1,25 @@
1
+ # Function: loadJsonFile()
2
+
3
+ > **loadJsonFile**\<`T`\>(`filename`): `Promise`\<`T`\>
4
+
5
+ Load the JSON file.
6
+
7
+ ## Type Parameters
8
+
9
+ ### T
10
+
11
+ `T`
12
+
13
+ ## Parameters
14
+
15
+ ### filename
16
+
17
+ `string`
18
+
19
+ The filename of the JSON file to load.
20
+
21
+ ## Returns
22
+
23
+ `Promise`\<`T`\>
24
+
25
+ The contents of the JSON file or null if it could not be loaded.
@@ -1,14 +1,14 @@
1
1
  # Function: run()
2
2
 
3
- > **run**(`options?`): `Promise`\<`void`\>
3
+ > **run**(`nodeOptions?`): `Promise`\<`void`\>
4
4
 
5
5
  Run the TWIN Node server.
6
6
 
7
7
  ## Parameters
8
8
 
9
- ### options?
9
+ ### nodeOptions?
10
10
 
11
- [`IRunOptions`](../interfaces/IRunOptions.md)
11
+ [`INodeOptions`](../interfaces/INodeOptions.md)
12
12
 
13
13
  Optional configuration options for running the server.
14
14
 
@@ -1,61 +1,31 @@
1
1
  # Function: start()
2
2
 
3
- > **start**(`serverInfo`, `envVarsPrefix`, `envVars`, `openApiSpecFile?`, `stateStorage?`, `extendConfig?`, `extendEngine?`, `extendEngineServer?`): `Promise`\<`undefined` \| \{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>; `server`: `EngineServer`; \}\>
3
+ > **start**(`nodeOptions`, `engineServerConfig`, `envVars`): `Promise`\<`undefined` \| \{ `engine`: `Engine`\<`IEngineServerConfig`, `IEngineState`\>; `server`: `EngineServer`; \}\>
4
4
 
5
5
  Start the engine server.
6
6
 
7
7
  ## Parameters
8
8
 
9
- ### serverInfo
9
+ ### nodeOptions
10
10
 
11
- `IServerInfo`
11
+ Optional run options for the engine server.
12
12
 
13
- The server information.
13
+ `undefined` | [`INodeOptions`](../interfaces/INodeOptions.md)
14
14
 
15
- ### envVarsPrefix
15
+ ### engineServerConfig
16
16
 
17
- `string`
17
+ `IEngineServerConfig`
18
18
 
19
- The prefix for the environment variables.
19
+ The configuration for the engine server.
20
20
 
21
21
  ### envVars
22
22
 
23
- [`INodeVariables`](../interfaces/INodeVariables.md)
23
+ [`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
24
24
 
25
25
  The environment variables.
26
26
 
27
- ### openApiSpecFile?
28
-
29
- `string`
30
-
31
- Path to the OpenAPI spec file.
32
-
33
- ### stateStorage?
34
-
35
- `IEngineStateStorage`\<`IEngineState`\>
36
-
37
- The state storage.
38
-
39
- ### extendConfig?
40
-
41
- (`config`) => `Promise`\<`void`\>
42
-
43
- Extends the engine configuration with any additional custom configuration.
44
-
45
- ### extendEngine?
46
-
47
- (`engine`) => `Promise`\<`void`\>
48
-
49
- Extends the engine with any additional options.
50
-
51
- ### extendEngineServer?
52
-
53
- (`engineServer`) => `Promise`\<`void`\>
54
-
55
- Extends the engine server with any additional options.
56
-
57
27
  ## Returns
58
28
 
59
- `Promise`\<`undefined` \| \{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>; `server`: `EngineServer`; \}\>
29
+ `Promise`\<`undefined` \| \{ `engine`: `Engine`\<`IEngineServerConfig`, `IEngineState`\>; `server`: `EngineServer`; \}\>
60
30
 
61
31
  The engine server.
@@ -2,9 +2,10 @@
2
2
 
3
3
  ## Interfaces
4
4
 
5
- - [INodeState](interfaces/INodeState.md)
6
- - [INodeVariables](interfaces/INodeVariables.md)
7
- - [IRunOptions](interfaces/IRunOptions.md)
5
+ - [IEngineEnvironmentVariables](interfaces/IEngineEnvironmentVariables.md)
6
+ - [IEngineServerEnvironmentVariables](interfaces/IEngineServerEnvironmentVariables.md)
7
+ - [INodeEnvironmentVariables](interfaces/INodeEnvironmentVariables.md)
8
+ - [INodeOptions](interfaces/INodeOptions.md)
8
9
 
9
10
  ## Type Aliases
10
11
 
@@ -23,9 +24,13 @@
23
24
  - [bootstrapImmutableProofMethod](functions/bootstrapImmutableProofMethod.md)
24
25
  - [bootstrapBlobEncryption](functions/bootstrapBlobEncryption.md)
25
26
  - [bootstrapAuth](functions/bootstrapAuth.md)
27
+ - [buildEngineConfiguration](functions/buildEngineConfiguration.md)
28
+ - [buildEngineServerConfiguration](functions/buildEngineServerConfiguration.md)
26
29
  - [run](functions/run.md)
30
+ - [buildConfiguration](functions/buildConfiguration.md)
27
31
  - [start](functions/start.md)
28
32
  - [initialiseLocales](functions/initialiseLocales.md)
29
33
  - [getExecutionDirectory](functions/getExecutionDirectory.md)
30
34
  - [fileExists](functions/fileExists.md)
35
+ - [loadJsonFile](functions/loadJsonFile.md)
31
36
  - [getFeatures](functions/getFeatures.md)