@twin.org/node-core 0.0.1-next.2
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/LICENSE +201 -0
- package/README.md +33 -0
- package/dist/cjs/index.cjs +612 -0
- package/dist/esm/index.mjs +578 -0
- package/dist/types/bootstrap.d.ts +60 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/models/INodeState.d.ts +10 -0
- package/dist/types/models/INodeVariables.d.ts +29 -0
- package/dist/types/models/nodeFeatures.d.ts +17 -0
- package/dist/types/node.d.ts +21 -0
- package/dist/types/server.d.ts +21 -0
- package/dist/types/utils.d.ts +24 -0
- package/docs/changelog.md +8 -0
- package/docs/reference/functions/bootstrap.md +29 -0
- package/docs/reference/functions/bootstrapAttestationMethod.md +35 -0
- package/docs/reference/functions/bootstrapAuth.md +35 -0
- package/docs/reference/functions/bootstrapBlobEncryption.md +35 -0
- package/docs/reference/functions/bootstrapImmutableProofMethod.md +35 -0
- package/docs/reference/functions/bootstrapNodeIdentity.md +35 -0
- package/docs/reference/functions/bootstrapNodeUser.md +35 -0
- package/docs/reference/functions/fileExists.md +19 -0
- package/docs/reference/functions/getExecutionDirectory.md +11 -0
- package/docs/reference/functions/getFeatures.md +19 -0
- package/docs/reference/functions/initialiseLocales.md +17 -0
- package/docs/reference/functions/run.md +59 -0
- package/docs/reference/functions/start.md +43 -0
- package/docs/reference/index.md +30 -0
- package/docs/reference/interfaces/INodeState.md +15 -0
- package/docs/reference/interfaces/INodeVariables.md +59 -0
- package/docs/reference/type-aliases/NodeFeatures.md +5 -0
- package/docs/reference/variables/NodeFeatures.md +19 -0
- package/locales/en.json +34 -0
- package/package.json +52 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { IEngineEnvironmentVariables } from "@twin.org/engine";
|
|
2
|
+
import type { IEngineServerEnvironmentVariables } from "@twin.org/engine-server";
|
|
3
|
+
/**
|
|
4
|
+
* The environment variables for the node.
|
|
5
|
+
*/
|
|
6
|
+
export interface INodeVariables extends IEngineEnvironmentVariables, IEngineServerEnvironmentVariables {
|
|
7
|
+
/**
|
|
8
|
+
* The features that are enabled on the node.
|
|
9
|
+
* @default [NodeFeatures.NodeIdentity]
|
|
10
|
+
*/
|
|
11
|
+
features?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The identity of the node which, if empty and node-identity feature is enabled it will be generated.
|
|
14
|
+
*/
|
|
15
|
+
identity?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The mnemonic for the identity, if empty and node-identity feature is enabled it will be randomly generated.
|
|
18
|
+
*/
|
|
19
|
+
mnemonic?: string;
|
|
20
|
+
/**
|
|
21
|
+
* If the node-user feature is enabled, this will be the name of the user.
|
|
22
|
+
* @default admin@node
|
|
23
|
+
*/
|
|
24
|
+
username?: string;
|
|
25
|
+
/**
|
|
26
|
+
* If the node-user feature is enabled, this will be the password of the user, if empty it will be randomly generated.
|
|
27
|
+
*/
|
|
28
|
+
password?: string;
|
|
29
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The features that can be enabled on the node.
|
|
3
|
+
*/
|
|
4
|
+
export declare const NodeFeatures: {
|
|
5
|
+
/**
|
|
6
|
+
* NodeIdentity - generates an identity for the node if not provided in config.
|
|
7
|
+
*/
|
|
8
|
+
readonly NodeIdentity: "node-identity";
|
|
9
|
+
/**
|
|
10
|
+
* NodeUser - generates a user for the node if not provided in config.
|
|
11
|
+
*/
|
|
12
|
+
readonly NodeUser: "node-user";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The features that can be enabled on the node.
|
|
16
|
+
*/
|
|
17
|
+
export type NodeFeatures = (typeof NodeFeatures)[keyof typeof NodeFeatures];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run the TWIN Node server.
|
|
3
|
+
* @param options Optional options for the server.
|
|
4
|
+
* @param options.serverName Optional name of the server, defaults to "TWIN Node Server".
|
|
5
|
+
* @param options.serverVersion Optional version of the server, defaults to current version.
|
|
6
|
+
* @param options.envFilenames Additional environment variable filenames to load, defaults to .env.
|
|
7
|
+
* @param options.envPrefix Optional prefix for environment variables, defaults to "TWIN_NODE_".
|
|
8
|
+
* @param options.executionDirectory Optional directory to override the execution location, defaults to process directory.
|
|
9
|
+
* @param options.localesDirectory Optional directory to override the locales directory, defaults to the locales directory.
|
|
10
|
+
* @param options.openApiSpecFile Optional path to the OpenAPI spec file, defaults to docs/open-api/spec.json.
|
|
11
|
+
* @returns A promise that resolves when the server is started.
|
|
12
|
+
*/
|
|
13
|
+
export declare function run(options?: {
|
|
14
|
+
serverName?: string;
|
|
15
|
+
serverVersion?: string;
|
|
16
|
+
envFilenames?: string[];
|
|
17
|
+
envPrefix?: string;
|
|
18
|
+
executionDirectory?: string;
|
|
19
|
+
localesDirectory?: string;
|
|
20
|
+
openApiSpecFile?: string;
|
|
21
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IServerInfo } from "@twin.org/api-models";
|
|
2
|
+
import { Engine } from "@twin.org/engine";
|
|
3
|
+
import { type IEngineStateStorage } from "@twin.org/engine-models";
|
|
4
|
+
import { EngineServer } from "@twin.org/engine-server";
|
|
5
|
+
import type { IEngineServerConfig } from "@twin.org/engine-server-types";
|
|
6
|
+
import { type IEngineConfig } from "@twin.org/engine-types";
|
|
7
|
+
import type { INodeState } from "./models/INodeState";
|
|
8
|
+
import type { INodeVariables } from "./models/INodeVariables";
|
|
9
|
+
/**
|
|
10
|
+
* Start the engine server.
|
|
11
|
+
* @param serverInfo The server information.
|
|
12
|
+
* @param envVars The environment variables.
|
|
13
|
+
* @param openApiSpecFile Path to the OpenAPI spec file.
|
|
14
|
+
* @param stateStorage The state storage.
|
|
15
|
+
* @param extendConfig Extends the engine configuration with any additional custom configuration.
|
|
16
|
+
* @returns The engine server.
|
|
17
|
+
*/
|
|
18
|
+
export declare function start(serverInfo: IServerInfo, envVars: INodeVariables, openApiSpecFile?: string, stateStorage?: IEngineStateStorage, extendConfig?: (config: IEngineConfig) => Promise<void>): Promise<{
|
|
19
|
+
engine: Engine<IEngineServerConfig, INodeState>;
|
|
20
|
+
server: EngineServer;
|
|
21
|
+
} | undefined>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { INodeVariables } from "./models/INodeVariables";
|
|
2
|
+
import { NodeFeatures } from "./models/nodeFeatures";
|
|
3
|
+
/**
|
|
4
|
+
* Initialise the locales for the application.
|
|
5
|
+
* @param localesDirectory The directory containing the locales.
|
|
6
|
+
*/
|
|
7
|
+
export declare function initialiseLocales(localesDirectory: string): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Get the directory where the application is being executed.
|
|
10
|
+
* @returns The execution directory.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getExecutionDirectory(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Does the specified file exist.
|
|
15
|
+
* @param filename The filename to check for existence.
|
|
16
|
+
* @returns True if the file exists.
|
|
17
|
+
*/
|
|
18
|
+
export declare function fileExists(filename: string): Promise<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* Get the features that are enabled on the node.
|
|
21
|
+
* @param env The environment variables for the node.
|
|
22
|
+
* @returns The features that are enabled on the node.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getFeatures(env: INodeVariables): NodeFeatures[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.0.1-next.2](https://github.com/twinfoundation/node/compare/node-core-v0.0.1-next.1...node-core-v0.0.1-next.2) (2025-05-27)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* initial commit ([522f1e5](https://github.com/twinfoundation/node/commit/522f1e515348f9b1dd1eeb3170b1249e2b0b5371))
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Function: bootstrap()
|
|
2
|
+
|
|
3
|
+
> **bootstrap**(`engineCore`, `context`, `envVars`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Bootstrap the application.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### engineCore
|
|
10
|
+
|
|
11
|
+
`IEngineCore`
|
|
12
|
+
|
|
13
|
+
The engine core for the node.
|
|
14
|
+
|
|
15
|
+
### context
|
|
16
|
+
|
|
17
|
+
`IEngineCoreContext`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>
|
|
18
|
+
|
|
19
|
+
The context for the node.
|
|
20
|
+
|
|
21
|
+
### envVars
|
|
22
|
+
|
|
23
|
+
[`INodeVariables`](../interfaces/INodeVariables.md)
|
|
24
|
+
|
|
25
|
+
The environment variables for the node.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Function: bootstrapAttestationMethod()
|
|
2
|
+
|
|
3
|
+
> **bootstrapAttestationMethod**(`engineCore`, `context`, `envVars`, `features`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Bootstrap the attestation verification methods.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### engineCore
|
|
10
|
+
|
|
11
|
+
`IEngineCore`
|
|
12
|
+
|
|
13
|
+
The engine core for the node.
|
|
14
|
+
|
|
15
|
+
### context
|
|
16
|
+
|
|
17
|
+
`IEngineCoreContext`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>
|
|
18
|
+
|
|
19
|
+
The context for the node.
|
|
20
|
+
|
|
21
|
+
### envVars
|
|
22
|
+
|
|
23
|
+
[`INodeVariables`](../interfaces/INodeVariables.md)
|
|
24
|
+
|
|
25
|
+
The environment variables for the node.
|
|
26
|
+
|
|
27
|
+
### features
|
|
28
|
+
|
|
29
|
+
[`NodeFeatures`](../type-aliases/NodeFeatures.md)[]
|
|
30
|
+
|
|
31
|
+
The features that are enabled on the node.
|
|
32
|
+
|
|
33
|
+
## Returns
|
|
34
|
+
|
|
35
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Function: bootstrapAuth()
|
|
2
|
+
|
|
3
|
+
> **bootstrapAuth**(`engineCore`, `context`, `envVars`, `features`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Bootstrap the JWT signing key.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### engineCore
|
|
10
|
+
|
|
11
|
+
`IEngineCore`
|
|
12
|
+
|
|
13
|
+
The engine core for the node.
|
|
14
|
+
|
|
15
|
+
### context
|
|
16
|
+
|
|
17
|
+
`IEngineCoreContext`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>
|
|
18
|
+
|
|
19
|
+
The context for the node.
|
|
20
|
+
|
|
21
|
+
### envVars
|
|
22
|
+
|
|
23
|
+
[`INodeVariables`](../interfaces/INodeVariables.md)
|
|
24
|
+
|
|
25
|
+
The environment variables for the node.
|
|
26
|
+
|
|
27
|
+
### features
|
|
28
|
+
|
|
29
|
+
[`NodeFeatures`](../type-aliases/NodeFeatures.md)[]
|
|
30
|
+
|
|
31
|
+
The features that are enabled on the node.
|
|
32
|
+
|
|
33
|
+
## Returns
|
|
34
|
+
|
|
35
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Function: bootstrapBlobEncryption()
|
|
2
|
+
|
|
3
|
+
> **bootstrapBlobEncryption**(`engineCore`, `context`, `envVars`, `features`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Bootstrap the keys for blob encryption.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### engineCore
|
|
10
|
+
|
|
11
|
+
`IEngineCore`
|
|
12
|
+
|
|
13
|
+
The engine core for the node.
|
|
14
|
+
|
|
15
|
+
### context
|
|
16
|
+
|
|
17
|
+
`IEngineCoreContext`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>
|
|
18
|
+
|
|
19
|
+
The context for the node.
|
|
20
|
+
|
|
21
|
+
### envVars
|
|
22
|
+
|
|
23
|
+
[`INodeVariables`](../interfaces/INodeVariables.md)
|
|
24
|
+
|
|
25
|
+
The environment variables for the node.
|
|
26
|
+
|
|
27
|
+
### features
|
|
28
|
+
|
|
29
|
+
[`NodeFeatures`](../type-aliases/NodeFeatures.md)[]
|
|
30
|
+
|
|
31
|
+
The features that are enabled on the node.
|
|
32
|
+
|
|
33
|
+
## Returns
|
|
34
|
+
|
|
35
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Function: bootstrapImmutableProofMethod()
|
|
2
|
+
|
|
3
|
+
> **bootstrapImmutableProofMethod**(`engineCore`, `context`, `envVars`, `features`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Bootstrap the immutable proof verification methods.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### engineCore
|
|
10
|
+
|
|
11
|
+
`IEngineCore`
|
|
12
|
+
|
|
13
|
+
The engine core for the node.
|
|
14
|
+
|
|
15
|
+
### context
|
|
16
|
+
|
|
17
|
+
`IEngineCoreContext`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>
|
|
18
|
+
|
|
19
|
+
The context for the node.
|
|
20
|
+
|
|
21
|
+
### envVars
|
|
22
|
+
|
|
23
|
+
[`INodeVariables`](../interfaces/INodeVariables.md)
|
|
24
|
+
|
|
25
|
+
The environment variables for the node.
|
|
26
|
+
|
|
27
|
+
### features
|
|
28
|
+
|
|
29
|
+
[`NodeFeatures`](../type-aliases/NodeFeatures.md)[]
|
|
30
|
+
|
|
31
|
+
The features that are enabled on the node.
|
|
32
|
+
|
|
33
|
+
## Returns
|
|
34
|
+
|
|
35
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Function: bootstrapNodeIdentity()
|
|
2
|
+
|
|
3
|
+
> **bootstrapNodeIdentity**(`engineCore`, `context`, `envVars`, `features`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Bootstrap the node creating any necessary resources.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### engineCore
|
|
10
|
+
|
|
11
|
+
`IEngineCore`
|
|
12
|
+
|
|
13
|
+
The engine core for the node.
|
|
14
|
+
|
|
15
|
+
### context
|
|
16
|
+
|
|
17
|
+
`IEngineCoreContext`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>
|
|
18
|
+
|
|
19
|
+
The context for the node.
|
|
20
|
+
|
|
21
|
+
### envVars
|
|
22
|
+
|
|
23
|
+
[`INodeVariables`](../interfaces/INodeVariables.md)
|
|
24
|
+
|
|
25
|
+
The environment variables for the node.
|
|
26
|
+
|
|
27
|
+
### features
|
|
28
|
+
|
|
29
|
+
[`NodeFeatures`](../type-aliases/NodeFeatures.md)[]
|
|
30
|
+
|
|
31
|
+
The features that are enabled on the node. The features that are enabled on the node.
|
|
32
|
+
|
|
33
|
+
## Returns
|
|
34
|
+
|
|
35
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Function: bootstrapNodeUser()
|
|
2
|
+
|
|
3
|
+
> **bootstrapNodeUser**(`engineCore`, `context`, `envVars`, `features`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Bootstrap the user.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### engineCore
|
|
10
|
+
|
|
11
|
+
`IEngineCore`
|
|
12
|
+
|
|
13
|
+
The engine core for the node.
|
|
14
|
+
|
|
15
|
+
### context
|
|
16
|
+
|
|
17
|
+
`IEngineCoreContext`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>
|
|
18
|
+
|
|
19
|
+
The context for the node.
|
|
20
|
+
|
|
21
|
+
### envVars
|
|
22
|
+
|
|
23
|
+
[`INodeVariables`](../interfaces/INodeVariables.md)
|
|
24
|
+
|
|
25
|
+
The environment variables for the node.
|
|
26
|
+
|
|
27
|
+
### features
|
|
28
|
+
|
|
29
|
+
[`NodeFeatures`](../type-aliases/NodeFeatures.md)[]
|
|
30
|
+
|
|
31
|
+
The features that are enabled on the node.
|
|
32
|
+
|
|
33
|
+
## Returns
|
|
34
|
+
|
|
35
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Function: fileExists()
|
|
2
|
+
|
|
3
|
+
> **fileExists**(`filename`): `Promise`\<`boolean`\>
|
|
4
|
+
|
|
5
|
+
Does the specified file exist.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### filename
|
|
10
|
+
|
|
11
|
+
`string`
|
|
12
|
+
|
|
13
|
+
The filename to check for existence.
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
`Promise`\<`boolean`\>
|
|
18
|
+
|
|
19
|
+
True if the file exists.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Function: getFeatures()
|
|
2
|
+
|
|
3
|
+
> **getFeatures**(`env`): [`NodeFeatures`](../type-aliases/NodeFeatures.md)[]
|
|
4
|
+
|
|
5
|
+
Get the features that are enabled on the node.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### env
|
|
10
|
+
|
|
11
|
+
[`INodeVariables`](../interfaces/INodeVariables.md)
|
|
12
|
+
|
|
13
|
+
The environment variables for the node.
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
[`NodeFeatures`](../type-aliases/NodeFeatures.md)[]
|
|
18
|
+
|
|
19
|
+
The features that are enabled on the node.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Function: initialiseLocales()
|
|
2
|
+
|
|
3
|
+
> **initialiseLocales**(`localesDirectory`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Initialise the locales for the application.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### localesDirectory
|
|
10
|
+
|
|
11
|
+
`string`
|
|
12
|
+
|
|
13
|
+
The directory containing the locales.
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
`Promise`\<`void`\>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Function: run()
|
|
2
|
+
|
|
3
|
+
> **run**(`options?`): `Promise`\<`void`\>
|
|
4
|
+
|
|
5
|
+
Run the TWIN Node server.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### options?
|
|
10
|
+
|
|
11
|
+
Optional options for the server.
|
|
12
|
+
|
|
13
|
+
#### serverName?
|
|
14
|
+
|
|
15
|
+
`string`
|
|
16
|
+
|
|
17
|
+
Optional name of the server, defaults to "TWIN Node Server".
|
|
18
|
+
|
|
19
|
+
#### serverVersion?
|
|
20
|
+
|
|
21
|
+
`string`
|
|
22
|
+
|
|
23
|
+
Optional version of the server, defaults to current version.
|
|
24
|
+
|
|
25
|
+
#### envFilenames?
|
|
26
|
+
|
|
27
|
+
`string`[]
|
|
28
|
+
|
|
29
|
+
Additional environment variable filenames to load, defaults to .env.
|
|
30
|
+
|
|
31
|
+
#### envPrefix?
|
|
32
|
+
|
|
33
|
+
`string`
|
|
34
|
+
|
|
35
|
+
Optional prefix for environment variables, defaults to "TWIN_NODE_".
|
|
36
|
+
|
|
37
|
+
#### executionDirectory?
|
|
38
|
+
|
|
39
|
+
`string`
|
|
40
|
+
|
|
41
|
+
Optional directory to override the execution location, defaults to process directory.
|
|
42
|
+
|
|
43
|
+
#### localesDirectory?
|
|
44
|
+
|
|
45
|
+
`string`
|
|
46
|
+
|
|
47
|
+
Optional directory to override the locales directory, defaults to the locales directory.
|
|
48
|
+
|
|
49
|
+
#### openApiSpecFile?
|
|
50
|
+
|
|
51
|
+
`string`
|
|
52
|
+
|
|
53
|
+
Optional path to the OpenAPI spec file, defaults to docs/open-api/spec.json.
|
|
54
|
+
|
|
55
|
+
## Returns
|
|
56
|
+
|
|
57
|
+
`Promise`\<`void`\>
|
|
58
|
+
|
|
59
|
+
A promise that resolves when the server is started.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Function: start()
|
|
2
|
+
|
|
3
|
+
> **start**(`serverInfo`, `envVars`, `openApiSpecFile?`, `stateStorage?`, `extendConfig?`): `Promise`\<`undefined` \| \{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>; `server`: `EngineServer`; \}\>
|
|
4
|
+
|
|
5
|
+
Start the engine server.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### serverInfo
|
|
10
|
+
|
|
11
|
+
`IServerInfo`
|
|
12
|
+
|
|
13
|
+
The server information.
|
|
14
|
+
|
|
15
|
+
### envVars
|
|
16
|
+
|
|
17
|
+
[`INodeVariables`](../interfaces/INodeVariables.md)
|
|
18
|
+
|
|
19
|
+
The environment variables.
|
|
20
|
+
|
|
21
|
+
### openApiSpecFile?
|
|
22
|
+
|
|
23
|
+
`string`
|
|
24
|
+
|
|
25
|
+
Path to the OpenAPI spec file.
|
|
26
|
+
|
|
27
|
+
### stateStorage?
|
|
28
|
+
|
|
29
|
+
`IEngineStateStorage`\<`IEngineState`\>
|
|
30
|
+
|
|
31
|
+
The state storage.
|
|
32
|
+
|
|
33
|
+
### extendConfig?
|
|
34
|
+
|
|
35
|
+
(`config`) => `Promise`\<`void`\>
|
|
36
|
+
|
|
37
|
+
Extends the engine configuration with any additional custom configuration.
|
|
38
|
+
|
|
39
|
+
## Returns
|
|
40
|
+
|
|
41
|
+
`Promise`\<`undefined` \| \{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>; `server`: `EngineServer`; \}\>
|
|
42
|
+
|
|
43
|
+
The engine server.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @twin.org/node-core
|
|
2
|
+
|
|
3
|
+
## Interfaces
|
|
4
|
+
|
|
5
|
+
- [INodeState](interfaces/INodeState.md)
|
|
6
|
+
- [INodeVariables](interfaces/INodeVariables.md)
|
|
7
|
+
|
|
8
|
+
## Type Aliases
|
|
9
|
+
|
|
10
|
+
- [NodeFeatures](type-aliases/NodeFeatures.md)
|
|
11
|
+
|
|
12
|
+
## Variables
|
|
13
|
+
|
|
14
|
+
- [NodeFeatures](variables/NodeFeatures.md)
|
|
15
|
+
|
|
16
|
+
## Functions
|
|
17
|
+
|
|
18
|
+
- [bootstrap](functions/bootstrap.md)
|
|
19
|
+
- [bootstrapNodeIdentity](functions/bootstrapNodeIdentity.md)
|
|
20
|
+
- [bootstrapNodeUser](functions/bootstrapNodeUser.md)
|
|
21
|
+
- [bootstrapAttestationMethod](functions/bootstrapAttestationMethod.md)
|
|
22
|
+
- [bootstrapImmutableProofMethod](functions/bootstrapImmutableProofMethod.md)
|
|
23
|
+
- [bootstrapBlobEncryption](functions/bootstrapBlobEncryption.md)
|
|
24
|
+
- [bootstrapAuth](functions/bootstrapAuth.md)
|
|
25
|
+
- [run](functions/run.md)
|
|
26
|
+
- [start](functions/start.md)
|
|
27
|
+
- [initialiseLocales](functions/initialiseLocales.md)
|
|
28
|
+
- [getExecutionDirectory](functions/getExecutionDirectory.md)
|
|
29
|
+
- [fileExists](functions/fileExists.md)
|
|
30
|
+
- [getFeatures](functions/getFeatures.md)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Interface: INodeVariables
|
|
2
|
+
|
|
3
|
+
The environment variables for the node.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `IEngineEnvironmentVariables`.`IEngineServerEnvironmentVariables`
|
|
8
|
+
|
|
9
|
+
## Properties
|
|
10
|
+
|
|
11
|
+
### features?
|
|
12
|
+
|
|
13
|
+
> `optional` **features**: `string`
|
|
14
|
+
|
|
15
|
+
The features that are enabled on the node.
|
|
16
|
+
|
|
17
|
+
#### Default
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
[NodeFeatures.NodeIdentity]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
***
|
|
24
|
+
|
|
25
|
+
### identity?
|
|
26
|
+
|
|
27
|
+
> `optional` **identity**: `string`
|
|
28
|
+
|
|
29
|
+
The identity of the node which, if empty and node-identity feature is enabled it will be generated.
|
|
30
|
+
|
|
31
|
+
***
|
|
32
|
+
|
|
33
|
+
### mnemonic?
|
|
34
|
+
|
|
35
|
+
> `optional` **mnemonic**: `string`
|
|
36
|
+
|
|
37
|
+
The mnemonic for the identity, if empty and node-identity feature is enabled it will be randomly generated.
|
|
38
|
+
|
|
39
|
+
***
|
|
40
|
+
|
|
41
|
+
### username?
|
|
42
|
+
|
|
43
|
+
> `optional` **username**: `string`
|
|
44
|
+
|
|
45
|
+
If the node-user feature is enabled, this will be the name of the user.
|
|
46
|
+
|
|
47
|
+
#### Default
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
admin@node
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
***
|
|
54
|
+
|
|
55
|
+
### password?
|
|
56
|
+
|
|
57
|
+
> `optional` **password**: `string`
|
|
58
|
+
|
|
59
|
+
If the node-user feature is enabled, this will be the password of the user, if empty it will be randomly generated.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Variable: NodeFeatures
|
|
2
|
+
|
|
3
|
+
> `const` **NodeFeatures**: `object`
|
|
4
|
+
|
|
5
|
+
The features that can be enabled on the node.
|
|
6
|
+
|
|
7
|
+
## Type declaration
|
|
8
|
+
|
|
9
|
+
### NodeIdentity
|
|
10
|
+
|
|
11
|
+
> `readonly` **NodeIdentity**: `"node-identity"` = `"node-identity"`
|
|
12
|
+
|
|
13
|
+
NodeIdentity - generates an identity for the node if not provided in config.
|
|
14
|
+
|
|
15
|
+
### NodeUser
|
|
16
|
+
|
|
17
|
+
> `readonly` **NodeUser**: `"node-user"` = `"node-user"`
|
|
18
|
+
|
|
19
|
+
NodeUser - generates a user for the node if not provided in config.
|