@twin.org/node-core 0.0.3-next.3 → 0.0.3-next.31
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.
- package/README.md +3 -1
- package/dist/es/builders/engineEnvBuilder.js +194 -123
- package/dist/es/builders/engineEnvBuilder.js.map +1 -1
- package/dist/es/builders/engineServerEnvBuilder.js +63 -24
- package/dist/es/builders/engineServerEnvBuilder.js.map +1 -1
- package/dist/es/cli.js +247 -0
- package/dist/es/cli.js.map +1 -0
- package/dist/es/commands/bootstrapLegacy.js +186 -0
- package/dist/es/commands/bootstrapLegacy.js.map +1 -0
- package/dist/es/commands/help.js +85 -0
- package/dist/es/commands/help.js.map +1 -0
- package/dist/es/commands/identityCreate.js +316 -0
- package/dist/es/commands/identityCreate.js.map +1 -0
- package/dist/es/commands/identityImports.js +82 -0
- package/dist/es/commands/identityImports.js.map +1 -0
- package/dist/es/commands/identityVerifiableCredentialCreate.js +146 -0
- package/dist/es/commands/identityVerifiableCredentialCreate.js.map +1 -0
- package/dist/es/commands/identityVerificationMethodCreate.js +228 -0
- package/dist/es/commands/identityVerificationMethodCreate.js.map +1 -0
- package/dist/es/commands/identityVerificationMethodImport.js +126 -0
- package/dist/es/commands/identityVerificationMethodImport.js.map +1 -0
- package/dist/es/commands/nodeSetIdentity.js +64 -0
- package/dist/es/commands/nodeSetIdentity.js.map +1 -0
- package/dist/es/commands/nodeSetTenant.js +68 -0
- package/dist/es/commands/nodeSetTenant.js.map +1 -0
- package/dist/es/commands/tenantCreate.js +139 -0
- package/dist/es/commands/tenantCreate.js.map +1 -0
- package/dist/es/commands/tenantImport.js +97 -0
- package/dist/es/commands/tenantImport.js.map +1 -0
- package/dist/es/commands/tenantUpdate.js +94 -0
- package/dist/es/commands/tenantUpdate.js.map +1 -0
- package/dist/es/commands/userCreate.js +212 -0
- package/dist/es/commands/userCreate.js.map +1 -0
- package/dist/es/commands/userUpdate.js +132 -0
- package/dist/es/commands/userUpdate.js.map +1 -0
- package/dist/es/commands/vaultKeyCreate.js +191 -0
- package/dist/es/commands/vaultKeyCreate.js.map +1 -0
- package/dist/es/commands/vaultKeyImport.js +104 -0
- package/dist/es/commands/vaultKeyImport.js.map +1 -0
- package/dist/es/defaults.js +17 -1
- package/dist/es/defaults.js.map +1 -1
- package/dist/es/index.js +7 -3
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/ICliArgs.js +4 -0
- package/dist/es/models/ICliArgs.js.map +1 -0
- package/dist/es/models/ICliCommand.js +2 -0
- package/dist/es/models/ICliCommand.js.map +1 -0
- package/dist/es/models/ICliCommandDefinition.js +2 -0
- package/dist/es/models/ICliCommandDefinition.js.map +1 -0
- package/dist/es/models/ICliCommandDefinitionParam.js +2 -0
- package/dist/es/models/ICliCommandDefinitionParam.js.map +1 -0
- package/dist/es/models/IEngineEnvironmentVariables.js.map +1 -1
- package/dist/es/models/IEngineServerEnvironmentVariables.js.map +1 -1
- package/dist/es/models/INodeEngineState.js.map +1 -1
- package/dist/es/models/INodeEnvironmentVariables.js.map +1 -1
- package/dist/es/models/INodeOptions.js.map +1 -1
- package/dist/es/models/cliCommandParamType.js +4 -0
- package/dist/es/models/cliCommandParamType.js.map +1 -0
- package/dist/es/node.js +84 -39
- package/dist/es/node.js.map +1 -1
- package/dist/es/start.js +139 -0
- package/dist/es/start.js.map +1 -0
- package/dist/es/utils.js +12 -22
- package/dist/es/utils.js.map +1 -1
- package/dist/types/builders/engineEnvBuilder.d.ts +1 -1
- package/dist/types/builders/engineServerEnvBuilder.d.ts +4 -2
- package/dist/types/cli.d.ts +56 -0
- package/dist/types/commands/bootstrapLegacy.d.ts +66 -0
- package/dist/types/commands/help.d.ts +23 -0
- package/dist/types/commands/identityCreate.d.ts +39 -0
- package/dist/types/commands/identityImports.d.ts +24 -0
- package/dist/types/commands/identityVerifiableCredentialCreate.d.ts +43 -0
- package/dist/types/commands/identityVerificationMethodCreate.d.ts +47 -0
- package/dist/types/commands/identityVerificationMethodImport.d.ts +31 -0
- package/dist/types/commands/nodeSetIdentity.d.ts +22 -0
- package/dist/types/commands/nodeSetTenant.d.ts +22 -0
- package/dist/types/commands/tenantCreate.d.ts +38 -0
- package/dist/types/commands/tenantImport.d.ts +26 -0
- package/dist/types/commands/tenantUpdate.d.ts +26 -0
- package/dist/types/commands/userCreate.d.ts +49 -0
- package/dist/types/commands/userUpdate.d.ts +38 -0
- package/dist/types/commands/vaultKeyCreate.d.ts +43 -0
- package/dist/types/commands/vaultKeyImport.d.ts +28 -0
- package/dist/types/defaults.d.ts +9 -1
- package/dist/types/index.d.ts +7 -3
- package/dist/types/models/ICliArgs.d.ts +20 -0
- package/dist/types/models/ICliCommand.d.ts +17 -0
- package/dist/types/models/ICliCommandDefinition.d.ts +46 -0
- package/dist/types/models/ICliCommandDefinitionParam.d.ts +35 -0
- package/dist/types/models/IEngineEnvironmentVariables.d.ts +72 -56
- package/dist/types/models/IEngineServerEnvironmentVariables.d.ts +4 -0
- package/dist/types/models/INodeEngineState.d.ts +0 -8
- package/dist/types/models/INodeEnvironmentVariables.d.ts +0 -38
- package/dist/types/models/INodeOptions.d.ts +6 -2
- package/dist/types/models/cliCommandParamType.d.ts +4 -0
- package/dist/types/node.d.ts +5 -4
- package/dist/types/{server.d.ts → start.d.ts} +4 -2
- package/dist/types/utils.d.ts +6 -8
- package/docs/changelog.md +206 -1
- package/docs/examples.md +99 -1
- package/docs/reference/functions/buildConfiguration.md +1 -1
- package/docs/reference/functions/buildEngineServerConfiguration.md +1 -1
- package/docs/reference/functions/constructCliCommand.md +27 -0
- package/docs/reference/functions/executeCommand.md +29 -0
- package/docs/reference/functions/getEnvDefaults.md +19 -0
- package/docs/reference/functions/getScriptDirectory.md +19 -0
- package/docs/reference/functions/parseCommandLineArgs.md +19 -0
- package/docs/reference/functions/processEnvOptions.md +27 -0
- package/docs/reference/functions/registerCommands.md +9 -0
- package/docs/reference/functions/resolvePackageEntryPoint.md +2 -2
- package/docs/reference/functions/run.md +8 -2
- package/docs/reference/functions/start.md +9 -3
- package/docs/reference/functions/substituteEnvOptions.md +25 -0
- package/docs/reference/index.md +14 -12
- package/docs/reference/interfaces/ICacheMetadata.md +3 -3
- package/docs/reference/interfaces/ICliArgs.md +35 -0
- package/docs/reference/interfaces/ICliCommand.md +23 -0
- package/docs/reference/interfaces/ICliCommandDefinition.md +101 -0
- package/docs/reference/interfaces/ICliCommandDefinitionParam.md +65 -0
- package/docs/reference/interfaces/IEngineEnvironmentVariables.md +349 -313
- package/docs/reference/interfaces/IEngineServerEnvironmentVariables.md +434 -370
- package/docs/reference/interfaces/IModuleProtocol.md +3 -3
- package/docs/reference/interfaces/INodeEngineState.md +4 -20
- package/docs/reference/interfaces/INodeEnvironmentVariables.md +448 -464
- package/docs/reference/interfaces/INodeOptions.md +44 -36
- package/docs/reference/interfaces/IProtocolHandlerResult.md +2 -2
- package/docs/reference/type-aliases/CliCommandParamType.md +5 -0
- package/docs/reference/type-aliases/NodeExtensionInitialiseEngineMethod.md +1 -1
- package/docs/reference/type-aliases/NodeExtensionInitialiseEngineServerMethod.md +1 -1
- package/docs/reference/type-aliases/NodeExtensionInitialiseMethod.md +1 -1
- package/docs/reference/type-aliases/NodeExtensionShutdownMethod.md +1 -1
- package/docs/reference/variables/ModuleProtocol.md +5 -5
- package/docs/reference/variables/TRUST_VERIFICATION_METHOD_ID.md +3 -0
- package/locales/en.json +589 -30
- package/package.json +6 -4
- package/dist/es/bootstrap.js +0 -360
- package/dist/es/bootstrap.js.map +0 -1
- package/dist/es/identity.js +0 -169
- package/dist/es/identity.js.map +0 -1
- package/dist/es/models/nodeFeatures.js +0 -21
- package/dist/es/models/nodeFeatures.js.map +0 -1
- package/dist/es/server.js +0 -81
- package/dist/es/server.js.map +0 -1
- package/dist/types/bootstrap.d.ts +0 -68
- package/dist/types/identity.d.ts +0 -14
- package/dist/types/models/nodeFeatures.d.ts +0 -21
- package/docs/detailed-guide.md +0 -129
- package/docs/reference/functions/bootstrap.md +0 -29
- package/docs/reference/functions/bootstrapAuth.md +0 -35
- package/docs/reference/functions/bootstrapBlobEncryption.md +0 -35
- package/docs/reference/functions/bootstrapImmutableProofMethod.md +0 -35
- package/docs/reference/functions/bootstrapNodeAdminUser.md +0 -35
- package/docs/reference/functions/bootstrapNodeId.md +0 -35
- package/docs/reference/functions/bootstrapSynchronisedStorage.md +0 -35
- package/docs/reference/functions/bootstrapTenantId.md +0 -35
- package/docs/reference/functions/getFeatures.md +0 -19
- package/docs/reference/type-aliases/NodeFeatures.md +0 -5
- package/docs/reference/variables/NodeFeatures.md +0 -25
- package/docs/reference/variables/VC_AUTHENTICATION_VERIFICATION_METHOD_ID.md +0 -3
package/docs/examples.md
CHANGED
|
@@ -1 +1,99 @@
|
|
|
1
|
-
#
|
|
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
|
|
5
|
+
Build the configuration for the TWIN Node.
|
|
6
6
|
|
|
7
7
|
## Parameters
|
|
8
8
|
|
|
@@ -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`\>
|
|
@@ -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 execution directory.
|
|
@@ -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 processed parameters.
|
|
24
|
+
|
|
25
|
+
## Throws
|
|
26
|
+
|
|
27
|
+
GeneralError if an env file has errors.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Function: resolvePackageEntryPoint()
|
|
2
2
|
|
|
3
|
-
> **resolvePackageEntryPoint**(`packagePath`, `packageName`, `fallback
|
|
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
|
|
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`\>
|
|
@@ -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
|
-
|
|
11
|
+
[`INodeOptions`](../interfaces/INodeOptions.md) \| `undefined`
|
|
12
12
|
|
|
13
|
-
|
|
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.
|
package/docs/reference/index.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
## Interfaces
|
|
4
4
|
|
|
5
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)
|
|
6
10
|
- [IEngineEnvironmentVariables](interfaces/IEngineEnvironmentVariables.md)
|
|
7
11
|
- [IEngineServerEnvironmentVariables](interfaces/IEngineServerEnvironmentVariables.md)
|
|
8
12
|
- [IModuleProtocol](interfaces/IModuleProtocol.md)
|
|
@@ -14,12 +18,12 @@
|
|
|
14
18
|
|
|
15
19
|
## Type Aliases
|
|
16
20
|
|
|
21
|
+
- [CliCommandParamType](type-aliases/CliCommandParamType.md)
|
|
17
22
|
- [ModuleProtocol](type-aliases/ModuleProtocol.md)
|
|
18
23
|
- [NodeExtensionInitialiseMethod](type-aliases/NodeExtensionInitialiseMethod.md)
|
|
19
24
|
- [NodeExtensionInitialiseEngineMethod](type-aliases/NodeExtensionInitialiseEngineMethod.md)
|
|
20
25
|
- [NodeExtensionInitialiseEngineServerMethod](type-aliases/NodeExtensionInitialiseEngineServerMethod.md)
|
|
21
26
|
- [NodeExtensionShutdownMethod](type-aliases/NodeExtensionShutdownMethod.md)
|
|
22
|
-
- [NodeFeatures](type-aliases/NodeFeatures.md)
|
|
23
27
|
|
|
24
28
|
## Variables
|
|
25
29
|
|
|
@@ -27,42 +31,40 @@
|
|
|
27
31
|
- [IMMUTABLE\_PROOF\_VERIFICATION\_METHOD\_ID](variables/IMMUTABLE_PROOF_VERIFICATION_METHOD_ID.md)
|
|
28
32
|
- [BLOB\_STORAGE\_ENCRYPTION\_KEY\_ID](variables/BLOB_STORAGE_ENCRYPTION_KEY_ID.md)
|
|
29
33
|
- [SYNCHRONISED\_STORAGE\_BLOB\_STORAGE\_ENCRYPTION\_KEY\_ID](variables/SYNCHRONISED_STORAGE_BLOB_STORAGE_ENCRYPTION_KEY_ID.md)
|
|
30
|
-
- [
|
|
34
|
+
- [TRUST\_VERIFICATION\_METHOD\_ID](variables/TRUST_VERIFICATION_METHOD_ID.md)
|
|
31
35
|
- [AUTH\_SIGNING\_KEY\_ID](variables/AUTH_SIGNING_KEY_ID.md)
|
|
32
36
|
- [CONTEXT\_ID\_HANDLER\_FEATURE\_DID](variables/CONTEXT_ID_HANDLER_FEATURE_DID.md)
|
|
33
37
|
- [CONTEXT\_ID\_HANDLER\_FEATURE\_TENANT](variables/CONTEXT_ID_HANDLER_FEATURE_TENANT.md)
|
|
34
38
|
- [ModuleProtocol](variables/ModuleProtocol.md)
|
|
35
|
-
- [NodeFeatures](variables/NodeFeatures.md)
|
|
36
39
|
|
|
37
40
|
## Functions
|
|
38
41
|
|
|
39
|
-
- [bootstrap](functions/bootstrap.md)
|
|
40
|
-
- [bootstrapNodeId](functions/bootstrapNodeId.md)
|
|
41
|
-
- [bootstrapTenantId](functions/bootstrapTenantId.md)
|
|
42
|
-
- [bootstrapNodeAdminUser](functions/bootstrapNodeAdminUser.md)
|
|
43
|
-
- [bootstrapImmutableProofMethod](functions/bootstrapImmutableProofMethod.md)
|
|
44
|
-
- [bootstrapBlobEncryption](functions/bootstrapBlobEncryption.md)
|
|
45
|
-
- [bootstrapAuth](functions/bootstrapAuth.md)
|
|
46
|
-
- [bootstrapSynchronisedStorage](functions/bootstrapSynchronisedStorage.md)
|
|
47
42
|
- [buildEngineConfiguration](functions/buildEngineConfiguration.md)
|
|
48
43
|
- [buildEngineServerConfiguration](functions/buildEngineServerConfiguration.md)
|
|
49
44
|
- [extensionsConfiguration](functions/extensionsConfiguration.md)
|
|
50
45
|
- [extensionsInitialiseEngine](functions/extensionsInitialiseEngine.md)
|
|
51
46
|
- [extensionsInitialiseEngineServer](functions/extensionsInitialiseEngineServer.md)
|
|
52
47
|
- [shutdownExtensions](functions/shutdownExtensions.md)
|
|
48
|
+
- [parseCommandLineArgs](functions/parseCommandLineArgs.md)
|
|
49
|
+
- [constructCliCommand](functions/constructCliCommand.md)
|
|
50
|
+
- [executeCommand](functions/executeCommand.md)
|
|
51
|
+
- [processEnvOptions](functions/processEnvOptions.md)
|
|
52
|
+
- [substituteEnvOptions](functions/substituteEnvOptions.md)
|
|
53
|
+
- [registerCommands](functions/registerCommands.md)
|
|
54
|
+
- [getEnvDefaults](functions/getEnvDefaults.md)
|
|
53
55
|
- [run](functions/run.md)
|
|
54
56
|
- [buildConfiguration](functions/buildConfiguration.md)
|
|
55
57
|
- [overrideModuleImport](functions/overrideModuleImport.md)
|
|
56
58
|
- [start](functions/start.md)
|
|
57
59
|
- [initialiseLocales](functions/initialiseLocales.md)
|
|
58
60
|
- [getExecutionDirectory](functions/getExecutionDirectory.md)
|
|
61
|
+
- [getScriptDirectory](functions/getScriptDirectory.md)
|
|
59
62
|
- [fileExists](functions/fileExists.md)
|
|
60
63
|
- [directoryExists](functions/directoryExists.md)
|
|
61
64
|
- [getSubFolders](functions/getSubFolders.md)
|
|
62
65
|
- [getFiles](functions/getFiles.md)
|
|
63
66
|
- [loadTextFile](functions/loadTextFile.md)
|
|
64
67
|
- [loadJsonFile](functions/loadJsonFile.md)
|
|
65
|
-
- [getFeatures](functions/getFeatures.md)
|
|
66
68
|
- [parseModuleProtocol](functions/parseModuleProtocol.md)
|
|
67
69
|
- [hashUrl](functions/hashUrl.md)
|
|
68
70
|
- [getExtensionsCacheDir](functions/getExtensionsCacheDir.md)
|
|
@@ -4,7 +4,7 @@ Metadata for cached HTTPS extensions.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### downloadedAt
|
|
7
|
+
### downloadedAt {#downloadedat}
|
|
8
8
|
|
|
9
9
|
> **downloadedAt**: `number`
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ Timestamp when the file was downloaded.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### url
|
|
15
|
+
### url {#url}
|
|
16
16
|
|
|
17
17
|
> **url**: `string`
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ Original URL of the cached file.
|
|
|
20
20
|
|
|
21
21
|
***
|
|
22
22
|
|
|
23
|
-
### size
|
|
23
|
+
### size {#size}
|
|
24
24
|
|
|
25
25
|
> **size**: `number`
|
|
26
26
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Interface: ICliArgs
|
|
2
|
+
|
|
3
|
+
Command to execute in the CLI.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### nodePath? {#nodepath}
|
|
8
|
+
|
|
9
|
+
> `optional` **nodePath?**: `string`
|
|
10
|
+
|
|
11
|
+
The path of the node executable.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### scriptPath? {#scriptpath}
|
|
16
|
+
|
|
17
|
+
> `optional` **scriptPath?**: `string`
|
|
18
|
+
|
|
19
|
+
The path of the script to execute.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### options? {#options}
|
|
24
|
+
|
|
25
|
+
> `optional` **options?**: `object`[]
|
|
26
|
+
|
|
27
|
+
The command line options.
|
|
28
|
+
|
|
29
|
+
#### key
|
|
30
|
+
|
|
31
|
+
> **key**: `string`
|
|
32
|
+
|
|
33
|
+
#### value
|
|
34
|
+
|
|
35
|
+
> **value**: `string`
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Interface: ICliCommand
|
|
2
|
+
|
|
3
|
+
Command to execute in the CLI.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### definition {#definition}
|
|
8
|
+
|
|
9
|
+
> **definition**: [`ICliCommandDefinition`](ICliCommandDefinition.md)
|
|
10
|
+
|
|
11
|
+
The command to execute.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### params {#params}
|
|
16
|
+
|
|
17
|
+
> **params**: `object`
|
|
18
|
+
|
|
19
|
+
The params to execute the command with.
|
|
20
|
+
|
|
21
|
+
#### Index Signature
|
|
22
|
+
|
|
23
|
+
\[`id`: `string`\]: [`CliCommandParamType`](../type-aliases/CliCommandParamType.md)
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Interface: ICliCommandDefinition
|
|
2
|
+
|
|
3
|
+
Command to execute in the CLI.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### command {#command}
|
|
8
|
+
|
|
9
|
+
> **command**: `string`
|
|
10
|
+
|
|
11
|
+
The command name.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### description {#description}
|
|
16
|
+
|
|
17
|
+
> **description**: `string`
|
|
18
|
+
|
|
19
|
+
The command description.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### example {#example}
|
|
24
|
+
|
|
25
|
+
> **example**: `string`
|
|
26
|
+
|
|
27
|
+
The example.
|
|
28
|
+
|
|
29
|
+
***
|
|
30
|
+
|
|
31
|
+
### params {#params}
|
|
32
|
+
|
|
33
|
+
> **params**: [`ICliCommandDefinitionParam`](ICliCommandDefinitionParam.md)[]
|
|
34
|
+
|
|
35
|
+
The params available for the command.
|
|
36
|
+
|
|
37
|
+
***
|
|
38
|
+
|
|
39
|
+
### action {#action}
|
|
40
|
+
|
|
41
|
+
> **action**: (`engineCore`, `envVars`, `params`) => `Promise`\<`unknown`\>
|
|
42
|
+
|
|
43
|
+
The method to execute for the command.
|
|
44
|
+
|
|
45
|
+
#### Parameters
|
|
46
|
+
|
|
47
|
+
##### engineCore
|
|
48
|
+
|
|
49
|
+
`IEngineCore`
|
|
50
|
+
|
|
51
|
+
##### envVars
|
|
52
|
+
|
|
53
|
+
[`INodeEnvironmentVariables`](INodeEnvironmentVariables.md)
|
|
54
|
+
|
|
55
|
+
##### params
|
|
56
|
+
|
|
57
|
+
#### Returns
|
|
58
|
+
|
|
59
|
+
`Promise`\<`unknown`\>
|
|
60
|
+
|
|
61
|
+
***
|
|
62
|
+
|
|
63
|
+
### requiresEngineStarted? {#requiresenginestarted}
|
|
64
|
+
|
|
65
|
+
> `optional` **requiresEngineStarted?**: `boolean`
|
|
66
|
+
|
|
67
|
+
Indicates whether the engine needs to be started before executing the command.
|
|
68
|
+
|
|
69
|
+
#### Default
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
true
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
***
|
|
76
|
+
|
|
77
|
+
### requiresNodeIdentity? {#requiresnodeidentity}
|
|
78
|
+
|
|
79
|
+
> `optional` **requiresNodeIdentity?**: `boolean`
|
|
80
|
+
|
|
81
|
+
Indicates whether the engine needs the node identity to be set if configured to use.
|
|
82
|
+
|
|
83
|
+
#### Default
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
true
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
***
|
|
90
|
+
|
|
91
|
+
### requiresTenantId? {#requirestenantid}
|
|
92
|
+
|
|
93
|
+
> `optional` **requiresTenantId?**: `boolean`
|
|
94
|
+
|
|
95
|
+
Indicates whether the engine needs the tenant id to be set if configured to use.
|
|
96
|
+
|
|
97
|
+
#### Default
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
true
|
|
101
|
+
```
|