@twin.org/node-core 0.0.2-next.9 → 0.0.3-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 (195) hide show
  1. package/README.md +1 -1
  2. package/dist/es/builders/engineEnvBuilder.js +1132 -0
  3. package/dist/es/builders/engineEnvBuilder.js.map +1 -0
  4. package/dist/es/builders/engineServerEnvBuilder.js +206 -0
  5. package/dist/es/builders/engineServerEnvBuilder.js.map +1 -0
  6. package/dist/es/builders/extensionsBuilder.js +109 -0
  7. package/dist/es/builders/extensionsBuilder.js.map +1 -0
  8. package/dist/es/cli.js +255 -0
  9. package/dist/es/cli.js.map +1 -0
  10. package/dist/es/commands/bootstrapLegacy.js +175 -0
  11. package/dist/es/commands/bootstrapLegacy.js.map +1 -0
  12. package/dist/es/commands/help.js +85 -0
  13. package/dist/es/commands/help.js.map +1 -0
  14. package/dist/es/commands/identityCreate.js +310 -0
  15. package/dist/es/commands/identityCreate.js.map +1 -0
  16. package/dist/es/commands/identityImports.js +76 -0
  17. package/dist/es/commands/identityImports.js.map +1 -0
  18. package/dist/es/commands/identityVerifiableCredentialCreate.js +140 -0
  19. package/dist/es/commands/identityVerifiableCredentialCreate.js.map +1 -0
  20. package/dist/es/commands/identityVerificationMethodCreate.js +208 -0
  21. package/dist/es/commands/identityVerificationMethodCreate.js.map +1 -0
  22. package/dist/es/commands/identityVerificationMethodImport.js +120 -0
  23. package/dist/es/commands/identityVerificationMethodImport.js.map +1 -0
  24. package/dist/es/commands/nodeSetIdentity.js +51 -0
  25. package/dist/es/commands/nodeSetIdentity.js.map +1 -0
  26. package/dist/es/commands/nodeSetTenant.js +49 -0
  27. package/dist/es/commands/nodeSetTenant.js.map +1 -0
  28. package/dist/es/commands/tenantCreate.js +120 -0
  29. package/dist/es/commands/tenantCreate.js.map +1 -0
  30. package/dist/es/commands/tenantImport.js +78 -0
  31. package/dist/es/commands/tenantImport.js.map +1 -0
  32. package/dist/es/commands/userCreate.js +197 -0
  33. package/dist/es/commands/userCreate.js.map +1 -0
  34. package/dist/es/commands/vaultKeyCreate.js +185 -0
  35. package/dist/es/commands/vaultKeyCreate.js.map +1 -0
  36. package/dist/es/commands/vaultKeyImport.js +98 -0
  37. package/dist/es/commands/vaultKeyImport.js.map +1 -0
  38. package/dist/es/defaults.js +28 -0
  39. package/dist/es/defaults.js.map +1 -0
  40. package/dist/es/index.js +27 -0
  41. package/dist/es/index.js.map +1 -0
  42. package/dist/es/models/ICacheMetadata.js +4 -0
  43. package/dist/es/models/ICacheMetadata.js.map +1 -0
  44. package/dist/es/models/ICliArgs.js +4 -0
  45. package/dist/es/models/ICliArgs.js.map +1 -0
  46. package/dist/es/models/ICliCommand.js +2 -0
  47. package/dist/es/models/ICliCommand.js.map +1 -0
  48. package/dist/es/models/ICliCommandDefinition.js +2 -0
  49. package/dist/es/models/ICliCommandDefinition.js.map +1 -0
  50. package/dist/es/models/ICliCommandDefinitionParam.js +2 -0
  51. package/dist/es/models/ICliCommandDefinitionParam.js.map +1 -0
  52. package/dist/es/models/IEngineEnvironmentVariables.js +4 -0
  53. package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -0
  54. package/dist/es/models/IEngineServerEnvironmentVariables.js +2 -0
  55. package/dist/es/models/IEngineServerEnvironmentVariables.js.map +1 -0
  56. package/dist/es/models/IModuleProtocol.js +2 -0
  57. package/dist/es/models/IModuleProtocol.js.map +1 -0
  58. package/dist/es/models/INodeEngineConfig.js +2 -0
  59. package/dist/es/models/INodeEngineConfig.js.map +1 -0
  60. package/dist/es/models/INodeEngineState.js +2 -0
  61. package/dist/es/models/INodeEngineState.js.map +1 -0
  62. package/dist/es/models/INodeEnvironmentVariables.js +2 -0
  63. package/dist/es/models/INodeEnvironmentVariables.js.map +1 -0
  64. package/dist/es/models/INodeOptions.js +2 -0
  65. package/dist/es/models/INodeOptions.js.map +1 -0
  66. package/dist/es/models/IProtocolHandlerResult.js +4 -0
  67. package/dist/es/models/IProtocolHandlerResult.js.map +1 -0
  68. package/dist/es/models/cliCommandParamType.js +4 -0
  69. package/dist/es/models/cliCommandParamType.js.map +1 -0
  70. package/dist/es/models/moduleProtocol.js +29 -0
  71. package/dist/es/models/moduleProtocol.js.map +1 -0
  72. package/dist/es/models/nodeExtensionMethods.js +2 -0
  73. package/dist/es/models/nodeExtensionMethods.js.map +1 -0
  74. package/dist/es/node.js +285 -0
  75. package/dist/es/node.js.map +1 -0
  76. package/dist/es/start.js +128 -0
  77. package/dist/es/start.js.map +1 -0
  78. package/dist/es/utils.js +397 -0
  79. package/dist/es/utils.js.map +1 -0
  80. package/dist/types/builders/engineEnvBuilder.d.ts +6 -2
  81. package/dist/types/builders/engineServerEnvBuilder.d.ts +7 -3
  82. package/dist/types/builders/extensionsBuilder.d.ts +32 -0
  83. package/dist/types/cli.d.ts +66 -0
  84. package/dist/types/commands/bootstrapLegacy.d.ts +66 -0
  85. package/dist/types/commands/help.d.ts +23 -0
  86. package/dist/types/commands/identityCreate.d.ts +39 -0
  87. package/dist/types/commands/identityImports.d.ts +24 -0
  88. package/dist/types/commands/identityVerifiableCredentialCreate.d.ts +43 -0
  89. package/dist/types/commands/identityVerificationMethodCreate.d.ts +47 -0
  90. package/dist/types/commands/identityVerificationMethodImport.d.ts +31 -0
  91. package/dist/types/commands/nodeSetIdentity.d.ts +22 -0
  92. package/dist/types/commands/nodeSetTenant.d.ts +22 -0
  93. package/dist/types/commands/tenantCreate.d.ts +35 -0
  94. package/dist/types/commands/tenantImport.d.ts +24 -0
  95. package/dist/types/commands/userCreate.d.ts +46 -0
  96. package/dist/types/commands/vaultKeyCreate.d.ts +43 -0
  97. package/dist/types/commands/vaultKeyImport.d.ts +28 -0
  98. package/dist/types/defaults.d.ts +16 -0
  99. package/dist/types/index.d.ts +24 -11
  100. package/dist/types/models/ICacheMetadata.d.ts +17 -0
  101. package/dist/types/models/ICliArgs.d.ts +20 -0
  102. package/dist/types/models/ICliCommand.d.ts +17 -0
  103. package/dist/types/models/ICliCommandDefinition.d.ts +46 -0
  104. package/dist/types/models/ICliCommandDefinitionParam.d.ts +35 -0
  105. package/dist/types/models/IEngineEnvironmentVariables.d.ts +154 -37
  106. package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +12 -3
  107. package/dist/types/models/IModuleProtocol.d.ts +18 -0
  108. package/dist/types/models/INodeEngineConfig.d.ts +6 -0
  109. package/dist/types/models/INodeEngineState.d.ts +14 -0
  110. package/dist/types/models/INodeEnvironmentVariables.d.ts +17 -15
  111. package/dist/types/models/INodeOptions.d.ts +14 -3
  112. package/dist/types/models/IProtocolHandlerResult.d.ts +13 -0
  113. package/dist/types/models/cliCommandParamType.d.ts +4 -0
  114. package/dist/types/models/moduleProtocol.d.ts +29 -0
  115. package/dist/types/models/nodeExtensionMethods.d.ts +27 -0
  116. package/dist/types/node.d.ts +21 -7
  117. package/dist/types/start.d.ts +25 -0
  118. package/dist/types/utils.d.ts +83 -6
  119. package/docs/changelog.md +241 -0
  120. package/docs/detailed-guide.md +129 -0
  121. package/docs/reference/functions/buildConfiguration.md +2 -2
  122. package/docs/reference/functions/buildEngineConfiguration.md +8 -2
  123. package/docs/reference/functions/buildEngineServerConfiguration.md +9 -3
  124. package/docs/reference/functions/constructCliCommand.md +27 -0
  125. package/docs/reference/functions/createModuleImportUrl.md +21 -0
  126. package/docs/reference/functions/directoryExists.md +19 -0
  127. package/docs/reference/functions/executeCommand.md +29 -0
  128. package/docs/reference/functions/extensionsConfiguration.md +25 -0
  129. package/docs/reference/functions/extensionsInitialiseEngine.md +25 -0
  130. package/docs/reference/functions/extensionsInitialiseEngineServer.md +31 -0
  131. package/docs/reference/functions/getEnvDefaults.md +19 -0
  132. package/docs/reference/functions/getExtensionsCacheDir.md +31 -0
  133. package/docs/reference/functions/getFiles.md +19 -0
  134. package/docs/reference/functions/getSubFolders.md +19 -0
  135. package/docs/reference/functions/handleHttpsProtocol.md +49 -0
  136. package/docs/reference/functions/handleNpmProtocol.md +31 -0
  137. package/docs/reference/functions/hashUrl.md +19 -0
  138. package/docs/reference/functions/initCli.md +27 -0
  139. package/docs/reference/functions/isCacheExpired.md +31 -0
  140. package/docs/reference/functions/overrideModuleImport.md +8 -2
  141. package/docs/reference/functions/parseCommandLineArgs.md +19 -0
  142. package/docs/reference/functions/parseModuleProtocol.md +19 -0
  143. package/docs/reference/functions/processEnvOptions.md +27 -0
  144. package/docs/reference/functions/registerCommands.md +9 -0
  145. package/docs/reference/functions/resolvePackageEntryPoint.md +32 -0
  146. package/docs/reference/functions/run.md +9 -3
  147. package/docs/reference/functions/shutdownExtensions.md +25 -0
  148. package/docs/reference/functions/start.md +17 -5
  149. package/docs/reference/functions/substituteEnvOptions.md +25 -0
  150. package/docs/reference/index.md +47 -10
  151. package/docs/reference/interfaces/ICacheMetadata.md +27 -0
  152. package/docs/reference/interfaces/ICliArgs.md +35 -0
  153. package/docs/reference/interfaces/ICliCommand.md +23 -0
  154. package/docs/reference/interfaces/ICliCommandDefinition.md +101 -0
  155. package/docs/reference/interfaces/ICliCommandDefinitionParam.md +65 -0
  156. package/docs/reference/interfaces/IEngineEnvironmentVariables.md +303 -60
  157. package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +1737 -5
  158. package/docs/reference/interfaces/IModuleProtocol.md +27 -0
  159. package/docs/reference/interfaces/INodeEngineConfig.md +7 -0
  160. package/docs/reference/interfaces/INodeEngineState.md +23 -0
  161. package/docs/reference/interfaces/INodeEnvironmentVariables.md +599 -198
  162. package/docs/reference/interfaces/INodeOptions.md +27 -3
  163. package/docs/reference/interfaces/IProtocolHandlerResult.md +19 -0
  164. package/docs/reference/type-aliases/CliCommandParamType.md +5 -0
  165. package/docs/reference/type-aliases/ModuleProtocol.md +5 -0
  166. package/docs/reference/type-aliases/NodeExtensionInitialiseEngineMethod.md +18 -0
  167. package/docs/reference/type-aliases/NodeExtensionInitialiseEngineServerMethod.md +24 -0
  168. package/docs/reference/type-aliases/NodeExtensionInitialiseMethod.md +23 -0
  169. package/docs/reference/type-aliases/NodeExtensionShutdownMethod.md +10 -0
  170. package/docs/reference/variables/ATTESTATION_VERIFICATION_METHOD_ID.md +3 -0
  171. package/docs/reference/variables/AUTH_SIGNING_KEY_ID.md +3 -0
  172. package/docs/reference/variables/BLOB_STORAGE_ENCRYPTION_KEY_ID.md +3 -0
  173. package/docs/reference/variables/CONTEXT_ID_HANDLER_FEATURE_DID.md +3 -0
  174. package/docs/reference/variables/CONTEXT_ID_HANDLER_FEATURE_TENANT.md +3 -0
  175. package/docs/reference/variables/IMMUTABLE_PROOF_VERIFICATION_METHOD_ID.md +3 -0
  176. package/docs/reference/variables/ModuleProtocol.md +37 -0
  177. package/docs/reference/variables/SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID.md +3 -0
  178. package/docs/reference/variables/VC_AUTHENTICATION_VERIFICATION_METHOD_ID.md +3 -0
  179. package/locales/en.json +479 -28
  180. package/package.json +29 -9
  181. package/dist/cjs/index.cjs +0 -1910
  182. package/dist/esm/index.mjs +0 -1870
  183. package/dist/types/bootstrap.d.ts +0 -59
  184. package/dist/types/models/nodeFeatures.d.ts +0 -21
  185. package/dist/types/server.d.ts +0 -17
  186. package/docs/reference/functions/bootstrap.md +0 -29
  187. package/docs/reference/functions/bootstrapAuth.md +0 -35
  188. package/docs/reference/functions/bootstrapBlobEncryption.md +0 -35
  189. package/docs/reference/functions/bootstrapImmutableProofMethod.md +0 -35
  190. package/docs/reference/functions/bootstrapNodeIdentity.md +0 -35
  191. package/docs/reference/functions/bootstrapNodeUser.md +0 -35
  192. package/docs/reference/functions/bootstrapSynchronisedStorage.md +0 -35
  193. package/docs/reference/functions/getFeatures.md +0 -19
  194. package/docs/reference/type-aliases/NodeFeatures.md +0 -5
  195. package/docs/reference/variables/NodeFeatures.md +0 -25
@@ -26,6 +26,18 @@ The version of the server, defaults to the current version.
26
26
 
27
27
  ***
28
28
 
29
+ ### envVars?
30
+
31
+ > `optional` **envVars**: `object`
32
+
33
+ Additional environment variables to set.
34
+
35
+ #### Index Signature
36
+
37
+ \[`key`: `string`\]: `string`
38
+
39
+ ***
40
+
29
41
  ### envFilenames?
30
42
 
31
43
  > `optional` **envFilenames**: `string`[]
@@ -38,7 +50,7 @@ Additional environment variable filenames to load, defaults to .env.
38
50
 
39
51
  > `optional` **envPrefix**: `string`
40
52
 
41
- The prefix for environment variables, defaults to "TWIN_NODE_".
53
+ The prefix for environment variables, defaults to "TWIN_".
42
54
 
43
55
  ***
44
56
 
@@ -113,15 +125,19 @@ Method to extend the engine environment variables with any additional custom con
113
125
 
114
126
  ### extendConfig()?
115
127
 
116
- > `optional` **extendConfig**: (`config`) => `Promise`\<`void`\>
128
+ > `optional` **extendConfig**: (`envVars`, `config`) => `Promise`\<`void`\>
117
129
 
118
130
  Method to extend the engine configuration with any additional custom configuration.
119
131
 
120
132
  #### Parameters
121
133
 
134
+ ##### envVars
135
+
136
+ [`INodeEnvironmentVariables`](INodeEnvironmentVariables.md)
137
+
122
138
  ##### config
123
139
 
124
- `IEngineConfig`
140
+ [`INodeEngineConfig`](INodeEngineConfig.md)
125
141
 
126
142
  #### Returns
127
143
 
@@ -171,3 +187,11 @@ Method to extend the engine server with any additional options.
171
187
 
172
188
  The state storage to use for the engine.
173
189
  If not provided, a default file-based state storage will be used.
190
+
191
+ ***
192
+
193
+ ### disableProcessExitOnFailure?
194
+
195
+ > `optional` **disableProcessExitOnFailure**: `boolean`
196
+
197
+ Disables process.exit calls on fatal errors and throws instead.
@@ -0,0 +1,19 @@
1
+ # Interface: IProtocolHandlerResult
2
+
3
+ The result from a protocol handler.
4
+
5
+ ## Properties
6
+
7
+ ### resolvedPath
8
+
9
+ > **resolvedPath**: `string`
10
+
11
+ The resolved path to the module file.
12
+
13
+ ***
14
+
15
+ ### cached
16
+
17
+ > **cached**: `boolean`
18
+
19
+ Whether the module was cached.
@@ -0,0 +1,5 @@
1
+ # Type Alias: CliCommandParamType
2
+
3
+ > **CliCommandParamType** = `string` \| `number` \| `boolean`
4
+
5
+ Type for the properties in commands.
@@ -0,0 +1,5 @@
1
+ # Type Alias: ModuleProtocol
2
+
3
+ > **ModuleProtocol** = *typeof* [`ModuleProtocol`](../variables/ModuleProtocol.md)\[keyof *typeof* [`ModuleProtocol`](../variables/ModuleProtocol.md)\]
4
+
5
+ The protocol type for a module.
@@ -0,0 +1,18 @@
1
+ # Type Alias: NodeExtensionInitialiseEngineMethod()
2
+
3
+ > **NodeExtensionInitialiseEngineMethod** = (`engineCore`) => `Promise`\<`void`\>
4
+
5
+ The type for the initialise engine method of an extension module.
6
+ This is called when the engine has been constructed but not yet started.
7
+
8
+ ## Parameters
9
+
10
+ ### engineCore
11
+
12
+ `IEngineCore`
13
+
14
+ The engine core instance.
15
+
16
+ ## Returns
17
+
18
+ `Promise`\<`void`\>
@@ -0,0 +1,24 @@
1
+ # Type Alias: NodeExtensionInitialiseEngineServerMethod()
2
+
3
+ > **NodeExtensionInitialiseEngineServerMethod** = (`engineCore`, `engineServer`) => `Promise`\<`void`\>
4
+
5
+ The type for the initialise engine server method of an extension module.
6
+ This is called when the engine server has been constructed but not yet started.
7
+
8
+ ## Parameters
9
+
10
+ ### engineCore
11
+
12
+ `IEngineCore`
13
+
14
+ The engine core instance.
15
+
16
+ ### engineServer
17
+
18
+ `IEngineServer`
19
+
20
+ The engine server instance.
21
+
22
+ ## Returns
23
+
24
+ `Promise`\<`void`\>
@@ -0,0 +1,23 @@
1
+ # Type Alias: NodeExtensionInitialiseMethod()
2
+
3
+ > **NodeExtensionInitialiseMethod** = (`envVars`, `nodeEngineConfig`) => `Promise`\<`void`\>
4
+
5
+ The type for the initialise method of an extension module.
6
+
7
+ ## Parameters
8
+
9
+ ### envVars
10
+
11
+ [`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
12
+
13
+ The environment variables for the node.
14
+
15
+ ### nodeEngineConfig
16
+
17
+ [`INodeEngineConfig`](../interfaces/INodeEngineConfig.md)
18
+
19
+ The node engine config.
20
+
21
+ ## Returns
22
+
23
+ `Promise`\<`void`\>
@@ -0,0 +1,10 @@
1
+ # Type Alias: NodeExtensionShutdownMethod()
2
+
3
+ > **NodeExtensionShutdownMethod** = () => `Promise`\<`void`\>
4
+
5
+ The type for the shutdown method of an extension module.
6
+ This is called when the engine is shutting down.
7
+
8
+ ## Returns
9
+
10
+ `Promise`\<`void`\>
@@ -0,0 +1,3 @@
1
+ # Variable: ATTESTATION\_VERIFICATION\_METHOD\_ID
2
+
3
+ > `const` **ATTESTATION\_VERIFICATION\_METHOD\_ID**: `"attestation-assertion"` = `"attestation-assertion"`
@@ -0,0 +1,3 @@
1
+ # Variable: AUTH\_SIGNING\_KEY\_ID
2
+
3
+ > `const` **AUTH\_SIGNING\_KEY\_ID**: `"auth-signing"` = `"auth-signing"`
@@ -0,0 +1,3 @@
1
+ # Variable: BLOB\_STORAGE\_ENCRYPTION\_KEY\_ID
2
+
3
+ > `const` **BLOB\_STORAGE\_ENCRYPTION\_KEY\_ID**: `"blob-encryption"` = `"blob-encryption"`
@@ -0,0 +1,3 @@
1
+ # Variable: CONTEXT\_ID\_HANDLER\_FEATURE\_DID
2
+
3
+ > `const` **CONTEXT\_ID\_HANDLER\_FEATURE\_DID**: `"did"` = `"did"`
@@ -0,0 +1,3 @@
1
+ # Variable: CONTEXT\_ID\_HANDLER\_FEATURE\_TENANT
2
+
3
+ > `const` **CONTEXT\_ID\_HANDLER\_FEATURE\_TENANT**: `"tenant"` = `"tenant"`
@@ -0,0 +1,3 @@
1
+ # Variable: IMMUTABLE\_PROOF\_VERIFICATION\_METHOD\_ID
2
+
3
+ > `const` **IMMUTABLE\_PROOF\_VERIFICATION\_METHOD\_ID**: `"immutable-proof-assertion"` = `"immutable-proof-assertion"`
@@ -0,0 +1,37 @@
1
+ # Variable: ModuleProtocol
2
+
3
+ > `const` **ModuleProtocol**: `object`
4
+
5
+ The protocol types for modules.
6
+
7
+ ## Type Declaration
8
+
9
+ ### Local
10
+
11
+ > `readonly` **Local**: `"local"` = `"local"`
12
+
13
+ Local module (starts with . or / or file://).
14
+
15
+ ### Npm
16
+
17
+ > `readonly` **Npm**: `"npm"` = `"npm"`
18
+
19
+ NPM package (starts with npm:).
20
+
21
+ ### Https
22
+
23
+ > `readonly` **Https**: `"https"` = `"https"`
24
+
25
+ HTTPS URL (starts with https://).
26
+
27
+ ### Http
28
+
29
+ > `readonly` **Http**: `"http"` = `"http"`
30
+
31
+ HTTP URL (starts with http://).
32
+
33
+ ### Default
34
+
35
+ > `readonly` **Default**: `"default"` = `"default"`
36
+
37
+ Default/standard module resolution.
@@ -0,0 +1,3 @@
1
+ # Variable: SYNCHRONISED\_STORAGE\_BLOB\_STORAGE\_ENCRYPTION\_KEY\_ID
2
+
3
+ > `const` **SYNCHRONISED\_STORAGE\_BLOB\_STORAGE\_ENCRYPTION\_KEY\_ID**: `"synchronised-storage-blob-encryption"` = `"synchronised-storage-blob-encryption"`
@@ -0,0 +1,3 @@
1
+ # Variable: VC\_AUTHENTICATION\_VERIFICATION\_METHOD\_ID
2
+
3
+ > `const` **VC\_AUTHENTICATION\_VERIFICATION\_METHOD\_ID**: `"vc-authentication-assertion"` = `"vc-authentication-assertion"`