@twin.org/node-core 0.0.3-next.6 → 0.0.3-next.60

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 (206) hide show
  1. package/README.md +3 -1
  2. package/dist/es/builders/engineEnvBuilder.js +538 -213
  3. package/dist/es/builders/engineEnvBuilder.js.map +1 -1
  4. package/dist/es/builders/engineServerEnvBuilder.js +86 -39
  5. package/dist/es/builders/engineServerEnvBuilder.js.map +1 -1
  6. package/dist/es/builders/extensionsBuilder.js +3 -3
  7. package/dist/es/builders/extensionsBuilder.js.map +1 -1
  8. package/dist/es/cli.js +254 -0
  9. package/dist/es/cli.js.map +1 -0
  10. package/dist/es/commands/bootstrapLegacy.js +311 -0
  11. package/dist/es/commands/bootstrapLegacy.js.map +1 -0
  12. package/dist/es/commands/help.js +86 -0
  13. package/dist/es/commands/help.js.map +1 -0
  14. package/dist/es/commands/identityCreate.js +377 -0
  15. package/dist/es/commands/identityCreate.js.map +1 -0
  16. package/dist/es/commands/identityImports.js +83 -0
  17. package/dist/es/commands/identityImports.js.map +1 -0
  18. package/dist/es/commands/identityVerifiableCredentialCreate.js +146 -0
  19. package/dist/es/commands/identityVerifiableCredentialCreate.js.map +1 -0
  20. package/dist/es/commands/identityVerificationMethodCreate.js +230 -0
  21. package/dist/es/commands/identityVerificationMethodCreate.js.map +1 -0
  22. package/dist/es/commands/identityVerificationMethodImport.js +127 -0
  23. package/dist/es/commands/identityVerificationMethodImport.js.map +1 -0
  24. package/dist/es/commands/nodeSetIdentity.js +69 -0
  25. package/dist/es/commands/nodeSetIdentity.js.map +1 -0
  26. package/dist/es/commands/removeTenantOrgAlias.js +83 -0
  27. package/dist/es/commands/removeTenantOrgAlias.js.map +1 -0
  28. package/dist/es/commands/setNodeOrgId.js +62 -0
  29. package/dist/es/commands/setNodeOrgId.js.map +1 -0
  30. package/dist/es/commands/setTenantOrgId.js +99 -0
  31. package/dist/es/commands/setTenantOrgId.js.map +1 -0
  32. package/dist/es/commands/tenantCreate.js +165 -0
  33. package/dist/es/commands/tenantCreate.js.map +1 -0
  34. package/dist/es/commands/tenantImport.js +108 -0
  35. package/dist/es/commands/tenantImport.js.map +1 -0
  36. package/dist/es/commands/tenantUpdate.js +108 -0
  37. package/dist/es/commands/tenantUpdate.js.map +1 -0
  38. package/dist/es/commands/userCreate.js +239 -0
  39. package/dist/es/commands/userCreate.js.map +1 -0
  40. package/dist/es/commands/userUpdate.js +154 -0
  41. package/dist/es/commands/userUpdate.js.map +1 -0
  42. package/dist/es/commands/vaultKeyCreate.js +191 -0
  43. package/dist/es/commands/vaultKeyCreate.js.map +1 -0
  44. package/dist/es/commands/vaultKeyImport.js +105 -0
  45. package/dist/es/commands/vaultKeyImport.js.map +1 -0
  46. package/dist/es/defaults.js +37 -2
  47. package/dist/es/defaults.js.map +1 -1
  48. package/dist/es/index.js +11 -4
  49. package/dist/es/index.js.map +1 -1
  50. package/dist/es/models/ICliArgs.js +4 -0
  51. package/dist/es/models/ICliArgs.js.map +1 -0
  52. package/dist/es/models/ICliCommand.js +2 -0
  53. package/dist/es/models/ICliCommand.js.map +1 -0
  54. package/dist/es/models/ICliCommandDefinition.js +2 -0
  55. package/dist/es/models/ICliCommandDefinition.js.map +1 -0
  56. package/dist/es/models/ICliCommandDefinitionParam.js +2 -0
  57. package/dist/es/models/ICliCommandDefinitionParam.js.map +1 -0
  58. package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -1
  59. package/dist/es/models/IEngineServerEnvironmentVariables.js.map +1 -1
  60. package/dist/es/models/INodeEngineState.js.map +1 -1
  61. package/dist/es/models/INodeEnvironmentVariables.js.map +1 -1
  62. package/dist/es/models/INodeOptions.js.map +1 -1
  63. package/dist/es/models/cliCommandParamType.js +4 -0
  64. package/dist/es/models/cliCommandParamType.js.map +1 -0
  65. package/dist/es/models/nodeExtensionInitialiseEngineMethod.js +2 -0
  66. package/dist/es/models/nodeExtensionInitialiseEngineMethod.js.map +1 -0
  67. package/dist/es/models/nodeExtensionInitialiseEngineServerMethod.js +2 -0
  68. package/dist/es/models/nodeExtensionInitialiseEngineServerMethod.js.map +1 -0
  69. package/dist/es/models/nodeExtensionInitialiseMethod.js +2 -0
  70. package/dist/es/models/nodeExtensionInitialiseMethod.js.map +1 -0
  71. package/dist/es/models/nodeExtensionShutdownMethod.js +4 -0
  72. package/dist/es/models/nodeExtensionShutdownMethod.js.map +1 -0
  73. package/dist/es/node.js +87 -40
  74. package/dist/es/node.js.map +1 -1
  75. package/dist/es/start.js +189 -0
  76. package/dist/es/start.js.map +1 -0
  77. package/dist/es/utils.js +24 -27
  78. package/dist/es/utils.js.map +1 -1
  79. package/dist/types/builders/engineEnvBuilder.d.ts +60 -5
  80. package/dist/types/builders/engineServerEnvBuilder.d.ts +11 -2
  81. package/dist/types/builders/extensionsBuilder.d.ts +3 -3
  82. package/dist/types/cli.d.ts +56 -0
  83. package/dist/types/commands/bootstrapLegacy.d.ts +67 -0
  84. package/dist/types/commands/help.d.ts +24 -0
  85. package/dist/types/commands/identityCreate.d.ts +45 -0
  86. package/dist/types/commands/identityImports.d.ts +25 -0
  87. package/dist/types/commands/identityVerifiableCredentialCreate.d.ts +43 -0
  88. package/dist/types/commands/identityVerificationMethodCreate.d.ts +47 -0
  89. package/dist/types/commands/identityVerificationMethodImport.d.ts +32 -0
  90. package/dist/types/commands/nodeSetIdentity.d.ts +23 -0
  91. package/dist/types/commands/removeTenantOrgAlias.d.ts +24 -0
  92. package/dist/types/commands/setNodeOrgId.d.ts +24 -0
  93. package/dist/types/commands/setTenantOrgId.d.ts +38 -0
  94. package/dist/types/commands/tenantCreate.d.ts +41 -0
  95. package/dist/types/commands/tenantImport.d.ts +29 -0
  96. package/dist/types/commands/tenantUpdate.d.ts +29 -0
  97. package/dist/types/commands/userCreate.d.ts +51 -0
  98. package/dist/types/commands/userUpdate.d.ts +40 -0
  99. package/dist/types/commands/vaultKeyCreate.d.ts +43 -0
  100. package/dist/types/commands/vaultKeyImport.d.ts +29 -0
  101. package/dist/types/defaults.d.ts +30 -2
  102. package/dist/types/index.d.ts +11 -4
  103. package/dist/types/models/ICliArgs.d.ts +20 -0
  104. package/dist/types/models/ICliCommand.d.ts +17 -0
  105. package/dist/types/models/ICliCommandDefinition.d.ts +46 -0
  106. package/dist/types/models/ICliCommandDefinitionParam.d.ts +35 -0
  107. package/dist/types/models/IEngineEnvironmentVariables.d.ts +168 -95
  108. package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +8 -0
  109. package/dist/types/models/INodeEngineState.d.ts +2 -9
  110. package/dist/types/models/INodeEnvironmentVariables.d.ts +0 -38
  111. package/dist/types/models/INodeOptions.d.ts +6 -2
  112. package/dist/types/models/cliCommandParamType.d.ts +4 -0
  113. package/dist/types/models/nodeExtensionInitialiseEngineMethod.d.ts +8 -0
  114. package/dist/types/models/nodeExtensionInitialiseEngineServerMethod.d.ts +9 -0
  115. package/dist/types/models/nodeExtensionInitialiseMethod.d.ts +9 -0
  116. package/dist/types/models/nodeExtensionShutdownMethod.d.ts +6 -0
  117. package/dist/types/node.d.ts +5 -4
  118. package/dist/types/{server.d.ts → start.d.ts} +4 -2
  119. package/dist/types/utils.d.ts +9 -10
  120. package/docs/changelog.md +675 -180
  121. package/docs/examples.md +99 -1
  122. package/docs/reference/functions/buildConfiguration.md +1 -1
  123. package/docs/reference/functions/buildEngineConfiguration.md +1 -7
  124. package/docs/reference/functions/buildEngineServerConfiguration.md +1 -1
  125. package/docs/reference/functions/constructCliCommand.md +27 -0
  126. package/docs/reference/functions/executeCommand.md +29 -0
  127. package/docs/reference/functions/extensionsInitialiseEngine.md +1 -1
  128. package/docs/reference/functions/extensionsInitialiseEngineServer.md +1 -1
  129. package/docs/reference/functions/getEnvDefaults.md +19 -0
  130. package/docs/reference/functions/getScriptDirectory.md +19 -0
  131. package/docs/reference/functions/initialiseLocales.md +2 -0
  132. package/docs/reference/functions/isAuthEntityStorageRequired.md +20 -0
  133. package/docs/reference/functions/isAutomationRequired.md +20 -0
  134. package/docs/reference/functions/isBackgroundTasksRequired.md +20 -0
  135. package/docs/reference/functions/isFederatedCatalogueRequired.md +20 -0
  136. package/docs/reference/functions/isImmutableProofRequired.md +20 -0
  137. package/docs/reference/functions/isRightsManagementRequired.md +23 -0
  138. package/docs/reference/functions/isTaskSchedulerRequired.md +20 -0
  139. package/docs/reference/functions/isTelemetryRequired.md +20 -0
  140. package/docs/reference/functions/isTrustRequired.md +20 -0
  141. package/docs/reference/functions/loadJsonFile.md +1 -1
  142. package/docs/reference/functions/loadTextFile.md +1 -1
  143. package/docs/reference/functions/parseCommandLineArgs.md +19 -0
  144. package/docs/reference/functions/processEnvOptions.md +27 -0
  145. package/docs/reference/functions/registerCommands.md +9 -0
  146. package/docs/reference/functions/resolvePackageEntryPoint.md +2 -2
  147. package/docs/reference/functions/run.md +8 -2
  148. package/docs/reference/functions/shutdownExtensions.md +1 -1
  149. package/docs/reference/functions/start.md +9 -3
  150. package/docs/reference/functions/substituteEnvOptions.md +25 -0
  151. package/docs/reference/index.md +24 -14
  152. package/docs/reference/interfaces/ICacheMetadata.md +3 -3
  153. package/docs/reference/interfaces/ICliArgs.md +35 -0
  154. package/docs/reference/interfaces/ICliCommand.md +23 -0
  155. package/docs/reference/interfaces/ICliCommandDefinition.md +101 -0
  156. package/docs/reference/interfaces/ICliCommandDefinitionParam.md +65 -0
  157. package/docs/reference/interfaces/IEngineEnvironmentVariables.md +488 -359
  158. package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +652 -431
  159. package/docs/reference/interfaces/IModuleProtocol.md +3 -3
  160. package/docs/reference/interfaces/INodeEngineState.md +6 -21
  161. package/docs/reference/interfaces/INodeEnvironmentVariables.md +661 -516
  162. package/docs/reference/interfaces/INodeOptions.md +44 -36
  163. package/docs/reference/interfaces/IProtocolHandlerResult.md +2 -2
  164. package/docs/reference/type-aliases/CliCommandParamType.md +5 -0
  165. package/docs/reference/type-aliases/NodeExtensionInitialiseEngineMethod.md +3 -1
  166. package/docs/reference/type-aliases/NodeExtensionInitialiseEngineServerMethod.md +3 -1
  167. package/docs/reference/type-aliases/NodeExtensionInitialiseMethod.md +3 -1
  168. package/docs/reference/type-aliases/NodeExtensionShutdownMethod.md +3 -1
  169. package/docs/reference/variables/ATTESTATION_VERIFICATION_METHOD_ID.md +2 -0
  170. package/docs/reference/variables/AUTH_SIGNING_KEY_ID.md +2 -0
  171. package/docs/reference/variables/BLOB_STORAGE_ENCRYPTION_KEY_ID.md +2 -0
  172. package/docs/reference/variables/CONTEXT_ID_HANDLER_FEATURE_DID.md +2 -0
  173. package/docs/reference/variables/CONTEXT_ID_HANDLER_FEATURE_TENANT.md +2 -0
  174. package/docs/reference/variables/IMMUTABLE_PROOF_VERIFICATION_METHOD_ID.md +2 -0
  175. package/docs/reference/variables/ModuleProtocol.md +5 -5
  176. package/docs/reference/variables/TRUST_VERIFICATION_METHOD_ID.md +5 -0
  177. package/locales/en.json +674 -30
  178. package/package.json +10 -6
  179. package/dist/es/bootstrap.js +0 -366
  180. package/dist/es/bootstrap.js.map +0 -1
  181. package/dist/es/identity.js +0 -182
  182. package/dist/es/identity.js.map +0 -1
  183. package/dist/es/models/nodeExtensionMethods.js +0 -2
  184. package/dist/es/models/nodeExtensionMethods.js.map +0 -1
  185. package/dist/es/models/nodeFeatures.js +0 -21
  186. package/dist/es/models/nodeFeatures.js.map +0 -1
  187. package/dist/es/server.js +0 -81
  188. package/dist/es/server.js.map +0 -1
  189. package/dist/types/bootstrap.d.ts +0 -68
  190. package/dist/types/identity.d.ts +0 -14
  191. package/dist/types/models/nodeExtensionMethods.d.ts +0 -27
  192. package/dist/types/models/nodeFeatures.d.ts +0 -21
  193. package/docs/detailed-guide.md +0 -129
  194. package/docs/reference/functions/bootstrap.md +0 -29
  195. package/docs/reference/functions/bootstrapAuth.md +0 -35
  196. package/docs/reference/functions/bootstrapBlobEncryption.md +0 -35
  197. package/docs/reference/functions/bootstrapImmutableProofMethod.md +0 -35
  198. package/docs/reference/functions/bootstrapNodeAdminUser.md +0 -35
  199. package/docs/reference/functions/bootstrapNodeId.md +0 -35
  200. package/docs/reference/functions/bootstrapSynchronisedStorage.md +0 -35
  201. package/docs/reference/functions/bootstrapTenantId.md +0 -35
  202. package/docs/reference/functions/getFeatures.md +0 -19
  203. package/docs/reference/type-aliases/NodeFeatures.md +0 -5
  204. package/docs/reference/variables/NodeFeatures.md +0 -25
  205. package/docs/reference/variables/SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID.md +0 -3
  206. package/docs/reference/variables/VC_AUTHENTICATION_VERIFICATION_METHOD_ID.md +0 -3
package/docs/examples.md CHANGED
@@ -1 +1,99 @@
1
- # @twin.org/node-core - Examples
1
+ # Node Core Examples
2
+
3
+ These snippets show practical runtime setup patterns, state inspection, and controlled shutdown so you can move from local development to automation with predictable behaviour.
4
+
5
+ ## Engine
6
+
7
+ ```typescript
8
+ import { run } from '@twin.org/node-core';
9
+
10
+ const runtime = await run(
11
+ {
12
+ disableProcessExitOnFailure: true,
13
+ envVars: {
14
+ TWIN_HOST: '127.0.0.1',
15
+ TWIN_PORT: '8080',
16
+ TWIN_STORAGE_FILE_ROOT: './storage',
17
+ TWIN_STATE_FILENAME: 'engine-state.json'
18
+ }
19
+ },
20
+ ['node', 'index.js']
21
+ );
22
+
23
+ if (runtime) {
24
+ const state = runtime.engine.getState();
25
+ console.log(typeof state); // object
26
+ console.log(state.nodeId ?? 'not-configured'); // not-configured
27
+ await runtime.shutdown();
28
+ }
29
+ ```
30
+
31
+ ```typescript
32
+ import { run } from '@twin.org/node-core';
33
+
34
+ const runtime = await run(
35
+ {
36
+ disableProcessExitOnFailure: true,
37
+ envVars: {
38
+ TWIN_HOST: '127.0.0.1',
39
+ TWIN_PORT: '8081',
40
+ TWIN_STORAGE_FILE_ROOT: './storage',
41
+ TWIN_STATE_FILENAME: 'engine-state.json'
42
+ }
43
+ },
44
+ ['node', 'index.js']
45
+ );
46
+
47
+ if (runtime) {
48
+ await runtime.engine.logInfo('Startup validation completed');
49
+ const state = runtime.engine.getState();
50
+ console.log(Object.keys(state).length >= 0); // true
51
+ await runtime.shutdown();
52
+ }
53
+ ```
54
+
55
+ ## EngineServer
56
+
57
+ ```typescript
58
+ import type { IServerInfo } from '@twin.org/api-models';
59
+ import type { INodeOptions } from '@twin.org/node-core';
60
+ import { buildConfiguration, start } from '@twin.org/node-core';
61
+
62
+ const processEnv: Record<string, string> = {
63
+ TWIN_HOST: '127.0.0.1',
64
+ TWIN_PORT: '8082',
65
+ TWIN_STORAGE_FILE_ROOT: './storage',
66
+ TWIN_STATE_FILENAME: 'engine-state.json'
67
+ };
68
+
69
+ const options: INodeOptions = {
70
+ disableProcessExitOnFailure: true,
71
+ envPrefix: 'TWIN_',
72
+ executionDirectory: process.cwd(),
73
+ scriptDirectory: process.cwd()
74
+ };
75
+
76
+ const serverInfo: IServerInfo = {
77
+ name: 'Local Runtime',
78
+ version: '0.0.0-dev'
79
+ };
80
+
81
+ const { nodeEngineConfig, nodeEnvVars, availableContextIdKeys } = await buildConfiguration(
82
+ processEnv,
83
+ options,
84
+ serverInfo
85
+ );
86
+
87
+ const runtime = await start(
88
+ options,
89
+ nodeEngineConfig,
90
+ nodeEnvVars,
91
+ undefined,
92
+ availableContextIdKeys
93
+ );
94
+
95
+ if (runtime) {
96
+ console.log(typeof runtime.server.stop); // function
97
+ await runtime.server.stop();
98
+ }
99
+ ```
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **buildConfiguration**(`processEnv`, `options`, `serverInfo`): `Promise`\<\{ `nodeEnvVars`: [`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md) & `object`; `nodeEngineConfig`: [`INodeEngineConfig`](../interfaces/INodeEngineConfig.md); `availableContextIdKeys`: `object`[]; \}\>
4
4
 
5
- Build the configuration for the TWIN Node server.
5
+ Build the configuration for the TWIN Node.
6
6
 
7
7
  ## Parameters
8
8
 
@@ -1,6 +1,6 @@
1
1
  # Function: buildEngineConfiguration()
2
2
 
3
- > **buildEngineConfiguration**(`envVars`, `contextIdKeys`): `Promise`\<`IEngineConfig`\>
3
+ > **buildEngineConfiguration**(`envVars`): `Promise`\<`IEngineConfig`\>
4
4
 
5
5
  Build the engine core configuration from environment variables.
6
6
 
@@ -12,12 +12,6 @@ Build the engine core configuration from environment variables.
12
12
 
13
13
  The environment variables.
14
14
 
15
- ### contextIdKeys
16
-
17
- `object`[]
18
-
19
- The context ID keys.
20
-
21
15
  ## Returns
22
16
 
23
17
  `Promise`\<`IEngineConfig`\>
@@ -8,7 +8,7 @@ Handles the configuration of the server.
8
8
 
9
9
  ### envVars
10
10
 
11
- [`IEngineServerEnvironmentVariables`](../interfaces/IEngineServerEnvironmentVariables.md)
11
+ [`IEngineServerEnvironmentVariables`](../interfaces/IEngineServerEnvironmentVariables.md) & `object`
12
12
 
13
13
  The environment variables for the engine server.
14
14
 
@@ -0,0 +1,27 @@
1
+ # Function: constructCliCommand()
2
+
3
+ > **constructCliCommand**(`processEnv`, `cliArgs`): [`ICliCommand`](../interfaces/ICliCommand.md) \| `undefined`
4
+
5
+ Construct the CLI command from the parsed arguments.
6
+
7
+ ## Parameters
8
+
9
+ ### processEnv
10
+
11
+ The environment variables from the process.
12
+
13
+ ### cliArgs
14
+
15
+ [`ICliArgs`](../interfaces/ICliArgs.md)
16
+
17
+ The parsed CLI arguments.
18
+
19
+ ## Returns
20
+
21
+ [`ICliCommand`](../interfaces/ICliCommand.md) \| `undefined`
22
+
23
+ The constructed CLI command.
24
+
25
+ ## Throws
26
+
27
+ GeneralError if the command is missing.
@@ -0,0 +1,29 @@
1
+ # Function: executeCommand()
2
+
3
+ > **executeCommand**(`engineCore`, `envVars`, `cliCommand`): `Promise`\<`void`\>
4
+
5
+ Execute the CLI command.
6
+
7
+ ## Parameters
8
+
9
+ ### engineCore
10
+
11
+ `IEngineCore`
12
+
13
+ The engine core.
14
+
15
+ ### envVars
16
+
17
+ [`INodeEnvironmentVariables`](../interfaces/INodeEnvironmentVariables.md)
18
+
19
+ The environment variables for the node.
20
+
21
+ ### cliCommand
22
+
23
+ [`ICliCommand`](../interfaces/ICliCommand.md)
24
+
25
+ The CLI command to execute.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`void`\>
@@ -22,4 +22,4 @@ The engine core instance.
22
22
 
23
23
  `Promise`\<`void`\>
24
24
 
25
- Nothing.
25
+ A promise that resolves when all extension engine initialisation methods have completed.
@@ -28,4 +28,4 @@ The engine server instance.
28
28
 
29
29
  `Promise`\<`void`\>
30
30
 
31
- Nothing.
31
+ A promise that resolves when all extension engine-server initialisation methods have completed.
@@ -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,19 @@
1
+ # Function: getScriptDirectory()
2
+
3
+ > **getScriptDirectory**(`args?`): `string`
4
+
5
+ Get the directory where the script is located.
6
+
7
+ ## Parameters
8
+
9
+ ### args?
10
+
11
+ `string`[]
12
+
13
+ The command line arguments.
14
+
15
+ ## Returns
16
+
17
+ `string`
18
+
19
+ The directory containing the entry-point script, or the current working directory if not determinable.
@@ -15,3 +15,5 @@ The directory containing the locales.
15
15
  ## Returns
16
16
 
17
17
  `Promise`\<`void`\>
18
+
19
+ A promise that resolves when the locale dictionary has been loaded.
@@ -0,0 +1,20 @@
1
+ # Function: isAuthEntityStorageRequired()
2
+
3
+ > **isAuthEntityStorageRequired**(`envVars`): `boolean`
4
+
5
+ Checks if the authentication entity storage subsystem is required.
6
+ Returns true when any component that depends on the authentication entity storage subsystem is enabled.
7
+
8
+ ## Parameters
9
+
10
+ ### envVars
11
+
12
+ [`IEngineServerEnvironmentVariables`](../interfaces/IEngineServerEnvironmentVariables.md)
13
+
14
+ The environment variables.
15
+
16
+ ## Returns
17
+
18
+ `boolean`
19
+
20
+ True if authentication entity storage is enabled.
@@ -0,0 +1,20 @@
1
+ # Function: isAutomationRequired()
2
+
3
+ > **isAutomationRequired**(`envVars`): `boolean`
4
+
5
+ Checks if the automation subsystem is required.
6
+ Returns true when any component that depends on the automation subsystem is enabled.
7
+
8
+ ## Parameters
9
+
10
+ ### envVars
11
+
12
+ [`IEngineEnvironmentVariables`](../interfaces/IEngineEnvironmentVariables.md)
13
+
14
+ The environment variables.
15
+
16
+ ## Returns
17
+
18
+ `boolean`
19
+
20
+ True if automation is enabled.
@@ -0,0 +1,20 @@
1
+ # Function: isBackgroundTasksRequired()
2
+
3
+ > **isBackgroundTasksRequired**(`envVars`): `boolean`
4
+
5
+ Checks if the background tasks subsystem is required.
6
+ Returns true when any component that depends on the background tasks subsystem is enabled.
7
+
8
+ ## Parameters
9
+
10
+ ### envVars
11
+
12
+ [`IEngineEnvironmentVariables`](../interfaces/IEngineEnvironmentVariables.md)
13
+
14
+ The environment variables.
15
+
16
+ ## Returns
17
+
18
+ `boolean`
19
+
20
+ True if dataspace or verifiable storage is enabled.
@@ -0,0 +1,20 @@
1
+ # Function: isFederatedCatalogueRequired()
2
+
3
+ > **isFederatedCatalogueRequired**(`envVars`): `boolean`
4
+
5
+ Checks if the federated catalogue subsystem is required.
6
+ Returns true when the catalogue is explicitly enabled, a remote endpoint is configured, filters are set, or dataspace is enabled.
7
+
8
+ ## Parameters
9
+
10
+ ### envVars
11
+
12
+ [`IEngineEnvironmentVariables`](../interfaces/IEngineEnvironmentVariables.md)
13
+
14
+ The environment variables.
15
+
16
+ ## Returns
17
+
18
+ `boolean`
19
+
20
+ True if the federated catalogue is required.
@@ -0,0 +1,20 @@
1
+ # Function: isImmutableProofRequired()
2
+
3
+ > **isImmutableProofRequired**(`envVars`): `boolean`
4
+
5
+ Checks if the immutable proof subsystem is required.
6
+ Returns true when any component that depends on the immutable proof subsystem is enabled.
7
+
8
+ ## Parameters
9
+
10
+ ### envVars
11
+
12
+ [`IEngineEnvironmentVariables`](../interfaces/IEngineEnvironmentVariables.md)
13
+
14
+ The environment variables.
15
+
16
+ ## Returns
17
+
18
+ `boolean`
19
+
20
+ True if verifiable storage is enabled.
@@ -0,0 +1,23 @@
1
+ # Function: isRightsManagementRequired()
2
+
3
+ > **isRightsManagementRequired**(`envVars`): `boolean`
4
+
5
+ Checks if the rights management subsystem is required.
6
+ Returns true when any component that depends on the rights management subsystem is enabled.
7
+ Note: rights management has no standalone enable flag - it is gated entirely on
8
+ `dataspaceEnabled`. Setting `TWIN_RIGHTS_MANAGEMENT_*` env var in isolation does not
9
+ enable the subsystem; `TWIN_DATASPACE_ENABLED` must also be true.
10
+
11
+ ## Parameters
12
+
13
+ ### envVars
14
+
15
+ [`IEngineEnvironmentVariables`](../interfaces/IEngineEnvironmentVariables.md)
16
+
17
+ The environment variables.
18
+
19
+ ## Returns
20
+
21
+ `boolean`
22
+
23
+ True if rights management is enabled.
@@ -0,0 +1,20 @@
1
+ # Function: isTaskSchedulerRequired()
2
+
3
+ > **isTaskSchedulerRequired**(`envVars`): `boolean`
4
+
5
+ Checks if the task scheduler subsystem is required.
6
+ Returns true when any component that depends on the task scheduler subsystem is enabled.
7
+
8
+ ## Parameters
9
+
10
+ ### envVars
11
+
12
+ [`IEngineEnvironmentVariables`](../interfaces/IEngineEnvironmentVariables.md)
13
+
14
+ The environment variables.
15
+
16
+ ## Returns
17
+
18
+ `boolean`
19
+
20
+ True if task scheduler is enabled.
@@ -0,0 +1,20 @@
1
+ # Function: isTelemetryRequired()
2
+
3
+ > **isTelemetryRequired**(`envVars`): `boolean`
4
+
5
+ Checks if the telemetry subsystem is required.
6
+ Returns true when any component that depends on the telemetry subsystem is enabled.
7
+
8
+ ## Parameters
9
+
10
+ ### envVars
11
+
12
+ [`IEngineEnvironmentVariables`](../interfaces/IEngineEnvironmentVariables.md)
13
+
14
+ The environment variables.
15
+
16
+ ## Returns
17
+
18
+ `boolean`
19
+
20
+ True if telemetry is enabled.
@@ -0,0 +1,20 @@
1
+ # Function: isTrustRequired()
2
+
3
+ > **isTrustRequired**(`envVars`): `boolean`
4
+
5
+ Checks if the trust subsystem is required.
6
+ Returns true when any component that depends on the trust subsystem is enabled.
7
+
8
+ ## Parameters
9
+
10
+ ### envVars
11
+
12
+ [`IEngineEnvironmentVariables`](../interfaces/IEngineEnvironmentVariables.md)
13
+
14
+ The environment variables.
15
+
16
+ ## Returns
17
+
18
+ `boolean`
19
+
20
+ True if rights-management, or dataspace is enabled.
@@ -22,4 +22,4 @@ The filename of the JSON file to load.
22
22
 
23
23
  `Promise`\<`T`\>
24
24
 
25
- The contents of the JSON file or null if it could not be loaded.
25
+ The parsed JSON content of the file.
@@ -16,4 +16,4 @@ The filename of the text file to load.
16
16
 
17
17
  `Promise`\<`string`\>
18
18
 
19
- The contents of the text file if it could not be loaded.
19
+ The contents of the text file as a UTF-8 string.
@@ -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,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 substituted options, mutated in place with env variable values resolved.
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 all built-in CLI command definitions into the shared command map.
6
+
7
+ ## Returns
8
+
9
+ `void`
@@ -1,6 +1,6 @@
1
1
  # Function: resolvePackageEntryPoint()
2
2
 
3
- > **resolvePackageEntryPoint**(`packagePath`, `packageName`, `fallback`): `Promise`\<`string`\>
3
+ > **resolvePackageEntryPoint**(`packagePath`, `packageName`, `fallback?`): `Promise`\<`string`\>
4
4
 
5
5
  Resolve the main entry point from a package directory using Node.js resolution with fallback.
6
6
  Uses require.resolve() when possible for standard Node.js behavior, with manual fallback.
@@ -19,7 +19,7 @@ The absolute path to the package directory.
19
19
 
20
20
  The package name for require.resolve().
21
21
 
22
- ### fallback
22
+ ### fallback?
23
23
 
24
24
  `string` = `"index.js"`
25
25
 
@@ -1,8 +1,8 @@
1
1
  # Function: run()
2
2
 
3
- > **run**(`nodeOptions?`): `Promise`\<\{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeEngineState`](../interfaces/INodeEngineState.md)\>; `server`: `EngineServer`; `shutdown`: () => `Promise`\<`void`\>; \} \| `undefined`\>
3
+ > **run**(`nodeOptions?`, `args?`): `Promise`\<\{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeEngineState`](../interfaces/INodeEngineState.md)\>; `server`: `EngineServer`; `shutdown`: () => `Promise`\<`void`\>; \} \| `undefined`\>
4
4
 
5
- Run the TWIN Node server.
5
+ Run the TWIN Node.
6
6
 
7
7
  ## Parameters
8
8
 
@@ -12,6 +12,12 @@ 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
23
  `Promise`\<\{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeEngineState`](../interfaces/INodeEngineState.md)\>; `server`: `EngineServer`; `shutdown`: () => `Promise`\<`void`\>; \} \| `undefined`\>
@@ -22,4 +22,4 @@ The engine core instance.
22
22
 
23
23
  `Promise`\<`void`\>
24
24
 
25
- Nothing.
25
+ A promise that resolves when all extension shutdown methods have completed.
@@ -1,6 +1,6 @@
1
1
  # Function: start()
2
2
 
3
- > **start**(`nodeOptions`, `nodeEngineConfig`, `envVars`, `availableContextIdKeys?`): `Promise`\<\{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeEngineState`](../interfaces/INodeEngineState.md)\>; `server`: `EngineServer`; `shutdown`: () => `Promise`\<`void`\>; \} \| `undefined`\>
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
 
@@ -8,9 +8,9 @@ Start the engine server.
8
8
 
9
9
  ### nodeOptions
10
10
 
11
- Optional run options for the engine server.
11
+ [`INodeOptions`](../interfaces/INodeOptions.md) \| `undefined`
12
12
 
13
- [`INodeOptions`](../interfaces/INodeOptions.md) | `undefined`
13
+ Optional run options for the engine server.
14
14
 
15
15
  ### nodeEngineConfig
16
16
 
@@ -24,6 +24,12 @@ 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
+
27
33
  ### availableContextIdKeys?
28
34
 
29
35
  `object`[]
@@ -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.