@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
@@ -0,0 +1,25 @@
1
+ # Function: extensionsConfiguration()
2
+
3
+ > **extensionsConfiguration**(`envVars`, `nodeEngineConfig`): `Promise`\<[`INodeEngineConfig`](../interfaces/INodeEngineConfig.md)\>
4
+
5
+ Handles the configuration of the extensions.
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`\<[`INodeEngineConfig`](../interfaces/INodeEngineConfig.md)\>
24
+
25
+ The config for the core and the server.
@@ -0,0 +1,25 @@
1
+ # Function: extensionsInitialiseEngine()
2
+
3
+ > **extensionsInitialiseEngine**(`envVars`, `engineCore`): `Promise`\<`void`\>
4
+
5
+ Handles the initialisation of the extensions when the engine has been constructed.
6
+
7
+ ## Parameters
8
+
9
+ ### envVars
10
+
11
+ [`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
12
+
13
+ The environment variables for the node.
14
+
15
+ ### engineCore
16
+
17
+ `IEngineCore`
18
+
19
+ The engine core instance.
20
+
21
+ ## Returns
22
+
23
+ `Promise`\<`void`\>
24
+
25
+ Nothing.
@@ -0,0 +1,31 @@
1
+ # Function: extensionsInitialiseEngineServer()
2
+
3
+ > **extensionsInitialiseEngineServer**(`envVars`, `engineCore`, `engineServer`): `Promise`\<`void`\>
4
+
5
+ Handles the initialisation of the extensions when the engine server has been constructed.
6
+
7
+ ## Parameters
8
+
9
+ ### envVars
10
+
11
+ [`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
12
+
13
+ The environment variables for the node.
14
+
15
+ ### engineCore
16
+
17
+ `IEngineCore`
18
+
19
+ The engine core instance.
20
+
21
+ ### engineServer
22
+
23
+ `IEngineServer`
24
+
25
+ The engine server instance.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`void`\>
30
+
31
+ Nothing.
@@ -0,0 +1,19 @@
1
+ # Function: getEnvDefaults()
2
+
3
+ > **getEnvDefaults**(`envPrefix`): `object`
4
+
5
+ Get the default environment variables for the node.
6
+
7
+ ## Parameters
8
+
9
+ ### envPrefix
10
+
11
+ `string`
12
+
13
+ The environment variable prefix.
14
+
15
+ ## Returns
16
+
17
+ `object`
18
+
19
+ The default environment variables.
@@ -0,0 +1,31 @@
1
+ # Function: getExtensionsCacheDir()
2
+
3
+ > **getExtensionsCacheDir**(`executionDirectory`, `protocol`, `cacheDirectory?`): `string`
4
+
5
+ Get the extensions cache directory.
6
+
7
+ ## Parameters
8
+
9
+ ### executionDirectory
10
+
11
+ `string`
12
+
13
+ The execution directory.
14
+
15
+ ### protocol
16
+
17
+ [`ModuleProtocol`](../type-aliases/ModuleProtocol.md)
18
+
19
+ The protocol type for subdirectory organization.
20
+
21
+ ### cacheDirectory?
22
+
23
+ `string`
24
+
25
+ The cache directory base path.
26
+
27
+ ## Returns
28
+
29
+ `string`
30
+
31
+ The cache directory path.
@@ -0,0 +1,19 @@
1
+ # Function: getFiles()
2
+
3
+ > **getFiles**(`directory`): `Promise`\<`string`[]\>
4
+
5
+ Get the files in the directory.
6
+
7
+ ## Parameters
8
+
9
+ ### directory
10
+
11
+ `string`
12
+
13
+ The directory to get the files from.
14
+
15
+ ## Returns
16
+
17
+ `Promise`\<`string`[]\>
18
+
19
+ The list of files in the directory.
@@ -0,0 +1,19 @@
1
+ # Function: getSubFolders()
2
+
3
+ > **getSubFolders**(`directory`): `Promise`\<`string`[]\>
4
+
5
+ Get the sub folders for the folder.
6
+
7
+ ## Parameters
8
+
9
+ ### directory
10
+
11
+ `string`
12
+
13
+ The directory to get the sub folders.
14
+
15
+ ## Returns
16
+
17
+ `Promise`\<`string`[]\>
18
+
19
+ The list of sub folders.
@@ -0,0 +1,49 @@
1
+ # Function: handleHttpsProtocol()
2
+
3
+ > **handleHttpsProtocol**(`url`, `executionDirectory`, `maxSizeMb`, `cacheDirectory?`, `ttlHours?`, `forceRefresh?`): `Promise`\<[`IProtocolHandlerResult`](../interfaces/IProtocolHandlerResult.md)\>
4
+
5
+ Handle the https: protocol by downloading the module if needed.
6
+
7
+ ## Parameters
8
+
9
+ ### url
10
+
11
+ `string`
12
+
13
+ The HTTPS URL to download from.
14
+
15
+ ### executionDirectory
16
+
17
+ `string`
18
+
19
+ The execution directory.
20
+
21
+ ### maxSizeMb
22
+
23
+ `number`
24
+
25
+ The maximum size in MB for the download.
26
+
27
+ ### cacheDirectory?
28
+
29
+ `string`
30
+
31
+ The cache directory base path.
32
+
33
+ ### ttlHours?
34
+
35
+ `number`
36
+
37
+ TTL in hours for cache expiration.
38
+
39
+ ### forceRefresh?
40
+
41
+ `boolean`
42
+
43
+ Whether to force refresh the cache.
44
+
45
+ ## Returns
46
+
47
+ `Promise`\<[`IProtocolHandlerResult`](../interfaces/IProtocolHandlerResult.md)\>
48
+
49
+ The resolved path to the downloaded module.
@@ -0,0 +1,31 @@
1
+ # Function: handleNpmProtocol()
2
+
3
+ > **handleNpmProtocol**(`packageName`, `executionDirectory`, `cacheDirectory?`): `Promise`\<[`IProtocolHandlerResult`](../interfaces/IProtocolHandlerResult.md)\>
4
+
5
+ Handle the npm: protocol by installing the package if needed.
6
+
7
+ ## Parameters
8
+
9
+ ### packageName
10
+
11
+ `string`
12
+
13
+ The npm package name (without npm: prefix).
14
+
15
+ ### executionDirectory
16
+
17
+ `string`
18
+
19
+ The execution directory.
20
+
21
+ ### cacheDirectory?
22
+
23
+ `string`
24
+
25
+ The cache directory base path.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<[`IProtocolHandlerResult`](../interfaces/IProtocolHandlerResult.md)\>
30
+
31
+ The resolved path to the installed module.
@@ -0,0 +1,19 @@
1
+ # Function: hashUrl()
2
+
3
+ > **hashUrl**(`url`): `string`
4
+
5
+ Hash a URL to create a safe filename.
6
+
7
+ ## Parameters
8
+
9
+ ### url
10
+
11
+ `string`
12
+
13
+ The URL to hash.
14
+
15
+ ## Returns
16
+
17
+ `string`
18
+
19
+ A hashed filename safe for the filesystem.
@@ -0,0 +1,27 @@
1
+ # Function: initCli()
2
+
3
+ > **initCli**(`processEnv`, `args?`): [`ICliCommand`](../interfaces/ICliCommand.md) \| `undefined`
4
+
5
+ Initialise the CLI.
6
+
7
+ ## Parameters
8
+
9
+ ### processEnv
10
+
11
+ The environment variables from the process.
12
+
13
+ ### args?
14
+
15
+ `string`[]
16
+
17
+ The command line arguments.
18
+
19
+ ## Returns
20
+
21
+ [`ICliCommand`](../interfaces/ICliCommand.md) \| `undefined`
22
+
23
+ The constructed CLI command if there is one.
24
+
25
+ ## Throws
26
+
27
+ GeneralError if the command is missing or invalid.
@@ -0,0 +1,31 @@
1
+ # Function: isCacheExpired()
2
+
3
+ > **isCacheExpired**(`metadataPath`, `ttlHours`, `forceRefresh`): `Promise`\<`boolean`\>
4
+
5
+ Check if a cached file has expired based on TTL and force refresh settings.
6
+
7
+ ## Parameters
8
+
9
+ ### metadataPath
10
+
11
+ `string`
12
+
13
+ Path to the cache metadata file.
14
+
15
+ ### ttlHours
16
+
17
+ `number`
18
+
19
+ Time to live in hours.
20
+
21
+ ### forceRefresh
22
+
23
+ `boolean`
24
+
25
+ Whether to force refresh regardless of TTL.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`boolean`\>
30
+
31
+ True if the cache is expired or should be refreshed.
@@ -1,8 +1,8 @@
1
1
  # Function: overrideModuleImport()
2
2
 
3
- > **overrideModuleImport**(`executionDirectory`): `void`
3
+ > **overrideModuleImport**(`executionDirectory`, `envVars?`): `void`
4
4
 
5
- Override module imports to use local files where possible.
5
+ Override module imports to support protocol-based loading (npm:, https:) and local files.
6
6
 
7
7
  ## Parameters
8
8
 
@@ -12,6 +12,12 @@ Override module imports to use local files where possible.
12
12
 
13
13
  The execution directory for resolving local module paths.
14
14
 
15
+ ### envVars?
16
+
17
+ [`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
18
+
19
+ The environment variables containing extension configuration (optional, uses defaults if not provided).
20
+
15
21
  ## Returns
16
22
 
17
23
  `void`
@@ -0,0 +1,19 @@
1
+ # Function: parseCommandLineArgs()
2
+
3
+ > **parseCommandLineArgs**(`args?`): [`ICliArgs`](../interfaces/ICliArgs.md)
4
+
5
+ Parse command line arguments.
6
+
7
+ ## Parameters
8
+
9
+ ### args?
10
+
11
+ `string`[]
12
+
13
+ The command line arguments.
14
+
15
+ ## Returns
16
+
17
+ [`ICliArgs`](../interfaces/ICliArgs.md)
18
+
19
+ The parsed command line arguments.
@@ -0,0 +1,19 @@
1
+ # Function: parseModuleProtocol()
2
+
3
+ > **parseModuleProtocol**(`moduleName`): [`IModuleProtocol`](../interfaces/IModuleProtocol.md)
4
+
5
+ Parse the protocol from a module name.
6
+
7
+ ## Parameters
8
+
9
+ ### moduleName
10
+
11
+ `string`
12
+
13
+ The module name to parse.
14
+
15
+ ## Returns
16
+
17
+ [`IModuleProtocol`](../interfaces/IModuleProtocol.md)
18
+
19
+ The parsed protocol information.
@@ -0,0 +1,27 @@
1
+ # Function: processEnvOptions()
2
+
3
+ > **processEnvOptions**(`processEnv`, `options`): `void`
4
+
5
+ Load the env files and process the options.
6
+
7
+ ## Parameters
8
+
9
+ ### processEnv
10
+
11
+ The environment variables from the process.
12
+
13
+ ### options
14
+
15
+ `object`[]
16
+
17
+ The options.
18
+
19
+ ## Returns
20
+
21
+ `void`
22
+
23
+ The processed parameters.
24
+
25
+ ## Throws
26
+
27
+ GeneralError if an env file has errors.
@@ -0,0 +1,9 @@
1
+ # Function: registerCommands()
2
+
3
+ > **registerCommands**(): `void`
4
+
5
+ Register available CLI commands.
6
+
7
+ ## Returns
8
+
9
+ `void`
@@ -0,0 +1,32 @@
1
+ # Function: resolvePackageEntryPoint()
2
+
3
+ > **resolvePackageEntryPoint**(`packagePath`, `packageName`, `fallback`): `Promise`\<`string`\>
4
+
5
+ Resolve the main entry point from a package directory using Node.js resolution with fallback.
6
+ Uses require.resolve() when possible for standard Node.js behavior, with manual fallback.
7
+
8
+ ## Parameters
9
+
10
+ ### packagePath
11
+
12
+ `string`
13
+
14
+ The absolute path to the package directory.
15
+
16
+ ### packageName
17
+
18
+ `string`
19
+
20
+ The package name for require.resolve().
21
+
22
+ ### fallback
23
+
24
+ `string` = `"index.js"`
25
+
26
+ The fallback file name if no entry point is found.
27
+
28
+ ## Returns
29
+
30
+ `Promise`\<`string`\>
31
+
32
+ The resolved entry point file name (relative to package directory).
@@ -1,6 +1,6 @@
1
1
  # Function: run()
2
2
 
3
- > **run**(`nodeOptions?`): `Promise`\<`void`\>
3
+ > **run**(`nodeOptions?`, `args?`): `Promise`\<\{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeEngineState`](../interfaces/INodeEngineState.md)\>; `server`: `EngineServer`; `shutdown`: () => `Promise`\<`void`\>; \} \| `undefined`\>
4
4
 
5
5
  Run the TWIN Node server.
6
6
 
@@ -12,8 +12,14 @@ Run the TWIN Node server.
12
12
 
13
13
  Optional configuration options for running the server.
14
14
 
15
+ ### args?
16
+
17
+ `string`[]
18
+
19
+ Optional command line arguments.
20
+
15
21
  ## Returns
16
22
 
17
- `Promise`\<`void`\>
23
+ `Promise`\<\{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeEngineState`](../interfaces/INodeEngineState.md)\>; `server`: `EngineServer`; `shutdown`: () => `Promise`\<`void`\>; \} \| `undefined`\>
18
24
 
19
- A promise that resolves when the server is started.
25
+ A promise that resolves when the server is started containing a shutdown method.
@@ -0,0 +1,25 @@
1
+ # Function: shutdownExtensions()
2
+
3
+ > **shutdownExtensions**(`envVars`, `engineCore`): `Promise`\<`void`\>
4
+
5
+ Handles the shutdown of the extensions.
6
+
7
+ ## Parameters
8
+
9
+ ### envVars
10
+
11
+ [`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
12
+
13
+ The environment variables for the node.
14
+
15
+ ### engineCore
16
+
17
+ `IEngineCore`
18
+
19
+ The engine core instance.
20
+
21
+ ## Returns
22
+
23
+ `Promise`\<`void`\>
24
+
25
+ Nothing.
@@ -1,6 +1,6 @@
1
1
  # Function: start()
2
2
 
3
- > **start**(`nodeOptions`, `engineServerConfig`, `envVars`): `Promise`\<`undefined` \| \{ `engine`: `Engine`\<`IEngineServerConfig`, `IEngineState`\>; `server`: `EngineServer`; \}\>
3
+ > **start**(`nodeOptions`, `nodeEngineConfig`, `envVars`, `cliCommand?`, `availableContextIdKeys?`): `Promise`\<\{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeEngineState`](../interfaces/INodeEngineState.md)\>; `server`: `EngineServer`; `shutdown`: () => `Promise`\<`void`\>; \} \| `undefined`\>
4
4
 
5
5
  Start the engine server.
6
6
 
@@ -10,11 +10,11 @@ Start the engine server.
10
10
 
11
11
  Optional run options for the engine server.
12
12
 
13
- `undefined` | [`INodeOptions`](../interfaces/INodeOptions.md)
13
+ [`INodeOptions`](../interfaces/INodeOptions.md) | `undefined`
14
14
 
15
- ### engineServerConfig
15
+ ### nodeEngineConfig
16
16
 
17
- `IEngineServerConfig`
17
+ [`INodeEngineConfig`](../interfaces/INodeEngineConfig.md)
18
18
 
19
19
  The configuration for the engine server.
20
20
 
@@ -24,8 +24,20 @@ The configuration for the engine server.
24
24
 
25
25
  The environment variables.
26
26
 
27
+ ### cliCommand?
28
+
29
+ [`ICliCommand`](../interfaces/ICliCommand.md)
30
+
31
+ The constructed CLI command (optional).
32
+
33
+ ### availableContextIdKeys?
34
+
35
+ `object`[]
36
+
37
+ The context ID keys available for operation.
38
+
27
39
  ## Returns
28
40
 
29
- `Promise`\<`undefined` \| \{ `engine`: `Engine`\<`IEngineServerConfig`, `IEngineState`\>; `server`: `EngineServer`; \}\>
41
+ `Promise`\<\{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeEngineState`](../interfaces/INodeEngineState.md)\>; `server`: `EngineServer`; `shutdown`: () => `Promise`\<`void`\>; \} \| `undefined`\>
30
42
 
31
43
  The engine server.
@@ -0,0 +1,25 @@
1
+ # Function: substituteEnvOptions()
2
+
3
+ > **substituteEnvOptions**(`processEnv`, `options`): `void`
4
+
5
+ Process options and replace any env variables with their values.
6
+
7
+ ## Parameters
8
+
9
+ ### processEnv
10
+
11
+ The environment variables from the process.
12
+
13
+ ### options
14
+
15
+ `object`[]
16
+
17
+ The options.
18
+
19
+ ## Returns
20
+
21
+ `void`
22
+
23
+ ## Throws
24
+
25
+ GeneralError if an env variable is missing.
@@ -2,30 +2,57 @@
2
2
 
3
3
  ## Interfaces
4
4
 
5
+ - [ICacheMetadata](interfaces/ICacheMetadata.md)
6
+ - [ICliArgs](interfaces/ICliArgs.md)
7
+ - [ICliCommand](interfaces/ICliCommand.md)
8
+ - [ICliCommandDefinition](interfaces/ICliCommandDefinition.md)
9
+ - [ICliCommandDefinitionParam](interfaces/ICliCommandDefinitionParam.md)
5
10
  - [IEngineEnvironmentVariables](interfaces/IEngineEnvironmentVariables.md)
6
11
  - [IEngineServerEnvironmentVariables](interfaces/IEngineServerEnvironmentVariables.md)
12
+ - [IModuleProtocol](interfaces/IModuleProtocol.md)
13
+ - [INodeEngineConfig](interfaces/INodeEngineConfig.md)
14
+ - [INodeEngineState](interfaces/INodeEngineState.md)
7
15
  - [INodeEnvironmentVariables](interfaces/INodeEnvironmentVariables.md)
8
16
  - [INodeOptions](interfaces/INodeOptions.md)
17
+ - [IProtocolHandlerResult](interfaces/IProtocolHandlerResult.md)
9
18
 
10
19
  ## Type Aliases
11
20
 
12
- - [NodeFeatures](type-aliases/NodeFeatures.md)
21
+ - [CliCommandParamType](type-aliases/CliCommandParamType.md)
22
+ - [ModuleProtocol](type-aliases/ModuleProtocol.md)
23
+ - [NodeExtensionInitialiseMethod](type-aliases/NodeExtensionInitialiseMethod.md)
24
+ - [NodeExtensionInitialiseEngineMethod](type-aliases/NodeExtensionInitialiseEngineMethod.md)
25
+ - [NodeExtensionInitialiseEngineServerMethod](type-aliases/NodeExtensionInitialiseEngineServerMethod.md)
26
+ - [NodeExtensionShutdownMethod](type-aliases/NodeExtensionShutdownMethod.md)
13
27
 
14
28
  ## Variables
15
29
 
16
- - [NodeFeatures](variables/NodeFeatures.md)
30
+ - [ATTESTATION\_VERIFICATION\_METHOD\_ID](variables/ATTESTATION_VERIFICATION_METHOD_ID.md)
31
+ - [IMMUTABLE\_PROOF\_VERIFICATION\_METHOD\_ID](variables/IMMUTABLE_PROOF_VERIFICATION_METHOD_ID.md)
32
+ - [BLOB\_STORAGE\_ENCRYPTION\_KEY\_ID](variables/BLOB_STORAGE_ENCRYPTION_KEY_ID.md)
33
+ - [SYNCHRONISED\_STORAGE\_BLOB\_STORAGE\_ENCRYPTION\_KEY\_ID](variables/SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID.md)
34
+ - [VC\_AUTHENTICATION\_VERIFICATION\_METHOD\_ID](variables/VC_AUTHENTICATION_VERIFICATION_METHOD_ID.md)
35
+ - [AUTH\_SIGNING\_KEY\_ID](variables/AUTH_SIGNING_KEY_ID.md)
36
+ - [CONTEXT\_ID\_HANDLER\_FEATURE\_DID](variables/CONTEXT_ID_HANDLER_FEATURE_DID.md)
37
+ - [CONTEXT\_ID\_HANDLER\_FEATURE\_TENANT](variables/CONTEXT_ID_HANDLER_FEATURE_TENANT.md)
38
+ - [ModuleProtocol](variables/ModuleProtocol.md)
17
39
 
18
40
  ## Functions
19
41
 
20
- - [bootstrap](functions/bootstrap.md)
21
- - [bootstrapNodeIdentity](functions/bootstrapNodeIdentity.md)
22
- - [bootstrapNodeUser](functions/bootstrapNodeUser.md)
23
- - [bootstrapImmutableProofMethod](functions/bootstrapImmutableProofMethod.md)
24
- - [bootstrapBlobEncryption](functions/bootstrapBlobEncryption.md)
25
- - [bootstrapAuth](functions/bootstrapAuth.md)
26
- - [bootstrapSynchronisedStorage](functions/bootstrapSynchronisedStorage.md)
27
42
  - [buildEngineConfiguration](functions/buildEngineConfiguration.md)
28
43
  - [buildEngineServerConfiguration](functions/buildEngineServerConfiguration.md)
44
+ - [extensionsConfiguration](functions/extensionsConfiguration.md)
45
+ - [extensionsInitialiseEngine](functions/extensionsInitialiseEngine.md)
46
+ - [extensionsInitialiseEngineServer](functions/extensionsInitialiseEngineServer.md)
47
+ - [shutdownExtensions](functions/shutdownExtensions.md)
48
+ - [initCli](functions/initCli.md)
49
+ - [parseCommandLineArgs](functions/parseCommandLineArgs.md)
50
+ - [constructCliCommand](functions/constructCliCommand.md)
51
+ - [executeCommand](functions/executeCommand.md)
52
+ - [processEnvOptions](functions/processEnvOptions.md)
53
+ - [substituteEnvOptions](functions/substituteEnvOptions.md)
54
+ - [registerCommands](functions/registerCommands.md)
55
+ - [getEnvDefaults](functions/getEnvDefaults.md)
29
56
  - [run](functions/run.md)
30
57
  - [buildConfiguration](functions/buildConfiguration.md)
31
58
  - [overrideModuleImport](functions/overrideModuleImport.md)
@@ -33,6 +60,16 @@
33
60
  - [initialiseLocales](functions/initialiseLocales.md)
34
61
  - [getExecutionDirectory](functions/getExecutionDirectory.md)
35
62
  - [fileExists](functions/fileExists.md)
63
+ - [directoryExists](functions/directoryExists.md)
64
+ - [getSubFolders](functions/getSubFolders.md)
65
+ - [getFiles](functions/getFiles.md)
36
66
  - [loadTextFile](functions/loadTextFile.md)
37
67
  - [loadJsonFile](functions/loadJsonFile.md)
38
- - [getFeatures](functions/getFeatures.md)
68
+ - [parseModuleProtocol](functions/parseModuleProtocol.md)
69
+ - [hashUrl](functions/hashUrl.md)
70
+ - [getExtensionsCacheDir](functions/getExtensionsCacheDir.md)
71
+ - [handleNpmProtocol](functions/handleNpmProtocol.md)
72
+ - [isCacheExpired](functions/isCacheExpired.md)
73
+ - [handleHttpsProtocol](functions/handleHttpsProtocol.md)
74
+ - [resolvePackageEntryPoint](functions/resolvePackageEntryPoint.md)
75
+ - [createModuleImportUrl](functions/createModuleImportUrl.md)