@twin.org/node-core 0.0.1-next.2 → 0.0.1-next.4
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 +7 -19
- package/dist/cjs/index.cjs +14 -15
- package/dist/esm/index.mjs +14 -15
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/IRunOptions.d.ts +45 -0
- package/dist/types/node.d.ts +3 -17
- package/dist/types/server.d.ts +3 -2
- package/docs/changelog.md +21 -3
- package/docs/examples.md +1 -0
- package/docs/reference/functions/run.md +2 -42
- package/docs/reference/functions/start.md +8 -2
- package/docs/reference/index.md +1 -0
- package/docs/reference/interfaces/IRunOptions.md +92 -0
- package/locales/en.json +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,32 +1,20 @@
|
|
|
1
1
|
# TWIN Node Core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TWIN Node Core for serving APIs using the specified configuration
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
To install the dependencies, perform a full build and start the server.
|
|
8
|
-
|
|
9
|
-
```shell
|
|
10
|
-
npm install
|
|
11
|
-
npm run dist
|
|
12
|
-
npm start
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Development mode
|
|
16
|
-
|
|
17
|
-
Once you have performed a full build you can run the server in development mode, this will watch the TypeScript code, rebuild if there are any changes, and relaunch the server.
|
|
5
|
+
## Installation
|
|
18
6
|
|
|
19
7
|
```shell
|
|
20
|
-
npm
|
|
8
|
+
npm install @twin.org/node-core
|
|
21
9
|
```
|
|
22
10
|
|
|
23
|
-
##
|
|
11
|
+
## Examples
|
|
24
12
|
|
|
25
|
-
|
|
13
|
+
Usage of the APIs is shown in the examples [docs/examples.md](docs/examples.md)
|
|
26
14
|
|
|
27
|
-
##
|
|
15
|
+
## Reference
|
|
28
16
|
|
|
29
|
-
|
|
17
|
+
Detailed reference documentation for the API can be found in [docs/reference/index.md](docs/reference/index.md)
|
|
30
18
|
|
|
31
19
|
## Changelog
|
|
32
20
|
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -491,25 +491,28 @@ async function bootstrapAuth(engineCore, context, envVars, features) {
|
|
|
491
491
|
/**
|
|
492
492
|
* Start the engine server.
|
|
493
493
|
* @param serverInfo The server information.
|
|
494
|
+
* @param envVarsPrefix The prefix for the environment variables.
|
|
494
495
|
* @param envVars The environment variables.
|
|
495
496
|
* @param openApiSpecFile Path to the OpenAPI spec file.
|
|
496
497
|
* @param stateStorage The state storage.
|
|
497
|
-
* @param
|
|
498
|
+
* @param customConfig Extends the engine configuration with any additional custom configuration.
|
|
498
499
|
* @returns The engine server.
|
|
499
500
|
*/
|
|
500
|
-
async function start(serverInfo, envVars, openApiSpecFile, stateStorage,
|
|
501
|
+
async function start(serverInfo, envVarsPrefix, envVars, openApiSpecFile, stateStorage, customConfig) {
|
|
501
502
|
envVars.storageFileRoot ??= "";
|
|
502
503
|
if ((envVars.entityStorageConnectorType === engineTypes.EntityStorageConnectorType.File ||
|
|
503
504
|
envVars.blobStorageConnectorType === engineTypes.BlobStorageConnectorType.File ||
|
|
504
505
|
core.Is.empty(stateStorage)) &&
|
|
505
506
|
!core.Is.stringValue(envVars.storageFileRoot)) {
|
|
506
|
-
throw new core.GeneralError("node", "storageFileRootNotSet"
|
|
507
|
+
throw new core.GeneralError("node", "storageFileRootNotSet", {
|
|
508
|
+
storageFileRoot: `${envVarsPrefix}_STORAGE_FILE_ROOT`
|
|
509
|
+
});
|
|
507
510
|
}
|
|
508
511
|
// Build the engine configuration from the environment variables.
|
|
509
512
|
const engineConfig = engine.buildEngineConfiguration(envVars);
|
|
510
513
|
// Extend the engine configuration with a custom type.
|
|
511
|
-
if (core.Is.function(
|
|
512
|
-
await
|
|
514
|
+
if (core.Is.function(customConfig)) {
|
|
515
|
+
await customConfig(engineConfig);
|
|
513
516
|
}
|
|
514
517
|
// Build the server configuration from the environment variables.
|
|
515
518
|
const serverConfig = engineServer.buildEngineServerConfiguration(envVars, engineConfig, serverInfo, openApiSpecFile);
|
|
@@ -539,21 +542,14 @@ async function start(serverInfo, envVars, openApiSpecFile, stateStorage, extendC
|
|
|
539
542
|
/* eslint-disable no-console */
|
|
540
543
|
/**
|
|
541
544
|
* Run the TWIN Node server.
|
|
542
|
-
* @param options Optional options for the server.
|
|
543
|
-
* @param options.serverName Optional name of the server, defaults to "TWIN Node Server".
|
|
544
|
-
* @param options.serverVersion Optional version of the server, defaults to current version.
|
|
545
|
-
* @param options.envFilenames Additional environment variable filenames to load, defaults to .env.
|
|
546
|
-
* @param options.envPrefix Optional prefix for environment variables, defaults to "TWIN_NODE_".
|
|
547
|
-
* @param options.executionDirectory Optional directory to override the execution location, defaults to process directory.
|
|
548
|
-
* @param options.localesDirectory Optional directory to override the locales directory, defaults to the locales directory.
|
|
549
|
-
* @param options.openApiSpecFile Optional path to the OpenAPI spec file, defaults to docs/open-api/spec.json.
|
|
545
|
+
* @param options Optional configuration options for running the server.
|
|
550
546
|
* @returns A promise that resolves when the server is started.
|
|
551
547
|
*/
|
|
552
548
|
async function run(options) {
|
|
553
549
|
try {
|
|
554
550
|
const serverInfo = {
|
|
555
551
|
name: options?.serverName ?? "TWIN Node Server",
|
|
556
|
-
version: options?.serverVersion ?? "0.0.1-next.
|
|
552
|
+
version: options?.serverVersion ?? "0.0.1-next.4" // x-release-please-version
|
|
557
553
|
};
|
|
558
554
|
console.log(`\u001B[4m🌩️ ${serverInfo.name} v${serverInfo.version}\u001B[24m\n`);
|
|
559
555
|
const executionDirectory = options?.executionDirectory ?? getExecutionDirectory();
|
|
@@ -579,8 +575,11 @@ async function run(options) {
|
|
|
579
575
|
const envPrefix = options?.envPrefix ?? "TWIN_NODE_";
|
|
580
576
|
console.info("Environment Prefix:", envPrefix);
|
|
581
577
|
const envVars = core.EnvHelper.envToJson(process.env, envPrefix);
|
|
578
|
+
if (Object.keys(envVars).length === 0) {
|
|
579
|
+
throw new core.GeneralError("node", "noEnvVars", { prefix: envPrefix });
|
|
580
|
+
}
|
|
582
581
|
console.info();
|
|
583
|
-
const startResult = await start(serverInfo, envVars, options?.openApiSpecFile);
|
|
582
|
+
const startResult = await start(serverInfo, envPrefix, envVars, options?.openApiSpecFile, options.stateStorage, options.customConfig);
|
|
584
583
|
if (!core.Is.empty(startResult)) {
|
|
585
584
|
for (const signal of ["SIGHUP", "SIGINT", "SIGTERM"]) {
|
|
586
585
|
process.on(signal, async () => {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -470,25 +470,28 @@ async function bootstrapAuth(engineCore, context, envVars, features) {
|
|
|
470
470
|
/**
|
|
471
471
|
* Start the engine server.
|
|
472
472
|
* @param serverInfo The server information.
|
|
473
|
+
* @param envVarsPrefix The prefix for the environment variables.
|
|
473
474
|
* @param envVars The environment variables.
|
|
474
475
|
* @param openApiSpecFile Path to the OpenAPI spec file.
|
|
475
476
|
* @param stateStorage The state storage.
|
|
476
|
-
* @param
|
|
477
|
+
* @param customConfig Extends the engine configuration with any additional custom configuration.
|
|
477
478
|
* @returns The engine server.
|
|
478
479
|
*/
|
|
479
|
-
async function start(serverInfo, envVars, openApiSpecFile, stateStorage,
|
|
480
|
+
async function start(serverInfo, envVarsPrefix, envVars, openApiSpecFile, stateStorage, customConfig) {
|
|
480
481
|
envVars.storageFileRoot ??= "";
|
|
481
482
|
if ((envVars.entityStorageConnectorType === EntityStorageConnectorType.File ||
|
|
482
483
|
envVars.blobStorageConnectorType === BlobStorageConnectorType.File ||
|
|
483
484
|
Is.empty(stateStorage)) &&
|
|
484
485
|
!Is.stringValue(envVars.storageFileRoot)) {
|
|
485
|
-
throw new GeneralError("node", "storageFileRootNotSet"
|
|
486
|
+
throw new GeneralError("node", "storageFileRootNotSet", {
|
|
487
|
+
storageFileRoot: `${envVarsPrefix}_STORAGE_FILE_ROOT`
|
|
488
|
+
});
|
|
486
489
|
}
|
|
487
490
|
// Build the engine configuration from the environment variables.
|
|
488
491
|
const engineConfig = buildEngineConfiguration(envVars);
|
|
489
492
|
// Extend the engine configuration with a custom type.
|
|
490
|
-
if (Is.function(
|
|
491
|
-
await
|
|
493
|
+
if (Is.function(customConfig)) {
|
|
494
|
+
await customConfig(engineConfig);
|
|
492
495
|
}
|
|
493
496
|
// Build the server configuration from the environment variables.
|
|
494
497
|
const serverConfig = buildEngineServerConfiguration(envVars, engineConfig, serverInfo, openApiSpecFile);
|
|
@@ -518,21 +521,14 @@ async function start(serverInfo, envVars, openApiSpecFile, stateStorage, extendC
|
|
|
518
521
|
/* eslint-disable no-console */
|
|
519
522
|
/**
|
|
520
523
|
* Run the TWIN Node server.
|
|
521
|
-
* @param options Optional options for the server.
|
|
522
|
-
* @param options.serverName Optional name of the server, defaults to "TWIN Node Server".
|
|
523
|
-
* @param options.serverVersion Optional version of the server, defaults to current version.
|
|
524
|
-
* @param options.envFilenames Additional environment variable filenames to load, defaults to .env.
|
|
525
|
-
* @param options.envPrefix Optional prefix for environment variables, defaults to "TWIN_NODE_".
|
|
526
|
-
* @param options.executionDirectory Optional directory to override the execution location, defaults to process directory.
|
|
527
|
-
* @param options.localesDirectory Optional directory to override the locales directory, defaults to the locales directory.
|
|
528
|
-
* @param options.openApiSpecFile Optional path to the OpenAPI spec file, defaults to docs/open-api/spec.json.
|
|
524
|
+
* @param options Optional configuration options for running the server.
|
|
529
525
|
* @returns A promise that resolves when the server is started.
|
|
530
526
|
*/
|
|
531
527
|
async function run(options) {
|
|
532
528
|
try {
|
|
533
529
|
const serverInfo = {
|
|
534
530
|
name: options?.serverName ?? "TWIN Node Server",
|
|
535
|
-
version: options?.serverVersion ?? "0.0.1-next.
|
|
531
|
+
version: options?.serverVersion ?? "0.0.1-next.4" // x-release-please-version
|
|
536
532
|
};
|
|
537
533
|
console.log(`\u001B[4m🌩️ ${serverInfo.name} v${serverInfo.version}\u001B[24m\n`);
|
|
538
534
|
const executionDirectory = options?.executionDirectory ?? getExecutionDirectory();
|
|
@@ -558,8 +554,11 @@ async function run(options) {
|
|
|
558
554
|
const envPrefix = options?.envPrefix ?? "TWIN_NODE_";
|
|
559
555
|
console.info("Environment Prefix:", envPrefix);
|
|
560
556
|
const envVars = EnvHelper.envToJson(process.env, envPrefix);
|
|
557
|
+
if (Object.keys(envVars).length === 0) {
|
|
558
|
+
throw new GeneralError("node", "noEnvVars", { prefix: envPrefix });
|
|
559
|
+
}
|
|
561
560
|
console.info();
|
|
562
|
-
const startResult = await start(serverInfo, envVars, options?.openApiSpecFile);
|
|
561
|
+
const startResult = await start(serverInfo, envPrefix, envVars, options?.openApiSpecFile, options.stateStorage, options.customConfig);
|
|
563
562
|
if (!Is.empty(startResult)) {
|
|
564
563
|
for (const signal of ["SIGHUP", "SIGINT", "SIGTERM"]) {
|
|
565
564
|
process.on(signal, async () => {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { IEngineStateStorage } from "@twin.org/engine-models";
|
|
2
|
+
import type { IEngineConfig } from "@twin.org/engine-types";
|
|
3
|
+
/**
|
|
4
|
+
* The options when running the node.
|
|
5
|
+
*/
|
|
6
|
+
export interface IRunOptions {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the server, defaults to "TWIN Node Server".
|
|
9
|
+
* @default "TWIN Node Server"
|
|
10
|
+
*/
|
|
11
|
+
serverName?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The version of the server, defaults to the current version.
|
|
14
|
+
*/
|
|
15
|
+
serverVersion?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Additional environment variable filenames to load, defaults to .env.
|
|
18
|
+
*/
|
|
19
|
+
envFilenames?: string[];
|
|
20
|
+
/**
|
|
21
|
+
* The prefix for environment variables, defaults to "TWIN_NODE_".
|
|
22
|
+
*/
|
|
23
|
+
envPrefix?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The directory to override the execution location, defaults to process directory.
|
|
26
|
+
*/
|
|
27
|
+
executionDirectory?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The directory to override the locales directory, defaults to the locales directory.
|
|
30
|
+
*/
|
|
31
|
+
localesDirectory?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The path to the OpenAPI spec file, defaults to docs/open-api/spec.json.
|
|
34
|
+
*/
|
|
35
|
+
openApiSpecFile?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Method to extend the engine configuration with any additional custom configuration.
|
|
38
|
+
*/
|
|
39
|
+
customConfig?: (config: IEngineConfig) => Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* The state storage to use for the engine.
|
|
42
|
+
* If not provided, a default file-based state storage will be used.
|
|
43
|
+
*/
|
|
44
|
+
stateStorage?: IEngineStateStorage;
|
|
45
|
+
}
|
package/dist/types/node.d.ts
CHANGED
|
@@ -1,21 +1,7 @@
|
|
|
1
|
+
import type { IRunOptions } from "./models/IRunOptions";
|
|
1
2
|
/**
|
|
2
3
|
* 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.
|
|
4
|
+
* @param options Optional configuration options for running the server.
|
|
11
5
|
* @returns A promise that resolves when the server is started.
|
|
12
6
|
*/
|
|
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>;
|
|
7
|
+
export declare function run(options?: IRunOptions): Promise<void>;
|
package/dist/types/server.d.ts
CHANGED
|
@@ -9,13 +9,14 @@ import type { INodeVariables } from "./models/INodeVariables";
|
|
|
9
9
|
/**
|
|
10
10
|
* Start the engine server.
|
|
11
11
|
* @param serverInfo The server information.
|
|
12
|
+
* @param envVarsPrefix The prefix for the environment variables.
|
|
12
13
|
* @param envVars The environment variables.
|
|
13
14
|
* @param openApiSpecFile Path to the OpenAPI spec file.
|
|
14
15
|
* @param stateStorage The state storage.
|
|
15
|
-
* @param
|
|
16
|
+
* @param customConfig Extends the engine configuration with any additional custom configuration.
|
|
16
17
|
* @returns The engine server.
|
|
17
18
|
*/
|
|
18
|
-
export declare function start(serverInfo: IServerInfo, envVars: INodeVariables, openApiSpecFile?: string, stateStorage?: IEngineStateStorage,
|
|
19
|
+
export declare function start(serverInfo: IServerInfo, envVarsPrefix: string, envVars: INodeVariables, openApiSpecFile?: string, stateStorage?: IEngineStateStorage, customConfig?: (config: IEngineConfig) => Promise<void>): Promise<{
|
|
19
20
|
engine: Engine<IEngineServerConfig, INodeState>;
|
|
20
21
|
server: EngineServer;
|
|
21
22
|
} | undefined>;
|
package/docs/changelog.md
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
1
|
-
# Changelog
|
|
1
|
+
# @twin.org/node-core - Changelog
|
|
2
2
|
|
|
3
|
-
## [0.0.1-next.
|
|
3
|
+
## [0.0.1-next.4](https://github.com/twinfoundation/node/compare/node-core-v0.0.1-next.3...node-core-v0.0.1-next.4) (2025-05-27)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* improve error reporting ([fcd39a1](https://github.com/twinfoundation/node/commit/fcd39a18da2a6ce33965a99ca5f2f36f4aba712f))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
4
12
|
|
|
13
|
+
* broken docs ([61479fd](https://github.com/twinfoundation/node/commit/61479fd618f766d22c5aafec5277e1a89e22b453))
|
|
14
|
+
|
|
15
|
+
## [0.0.1-next.3](https://github.com/twinfoundation/node/compare/node-core-v0.0.1-next.2...node-core-v0.0.1-next.3) (2025-05-27)
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
- additional run options ([c35e5bb](https://github.com/twinfoundation/node/commit/c35e5bbb8a80fe6a36628d41f64585b3723d9ad7))
|
|
20
|
+
- node app use JavaScript ([14fe08c](https://github.com/twinfoundation/node/commit/14fe08cb760dd885a5dac9056a4d5dbc3d61df64))
|
|
21
|
+
|
|
22
|
+
## [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)
|
|
5
23
|
|
|
6
24
|
### Features
|
|
7
25
|
|
|
8
|
-
|
|
26
|
+
- initial commit ([522f1e5](https://github.com/twinfoundation/node/commit/522f1e515348f9b1dd1eeb3170b1249e2b0b5371))
|
package/docs/examples.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @twin.org/node-core - Examples
|
|
@@ -8,49 +8,9 @@ Run the TWIN Node server.
|
|
|
8
8
|
|
|
9
9
|
### options?
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
[`IRunOptions`](../interfaces/IRunOptions.md)
|
|
12
12
|
|
|
13
|
-
|
|
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.
|
|
13
|
+
Optional configuration options for running the server.
|
|
54
14
|
|
|
55
15
|
## Returns
|
|
56
16
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Function: start()
|
|
2
2
|
|
|
3
|
-
> **start**(`serverInfo`, `envVars`, `openApiSpecFile?`, `stateStorage?`, `
|
|
3
|
+
> **start**(`serverInfo`, `envVarsPrefix`, `envVars`, `openApiSpecFile?`, `stateStorage?`, `customConfig?`): `Promise`\<`undefined` \| \{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>; `server`: `EngineServer`; \}\>
|
|
4
4
|
|
|
5
5
|
Start the engine server.
|
|
6
6
|
|
|
@@ -12,6 +12,12 @@ Start the engine server.
|
|
|
12
12
|
|
|
13
13
|
The server information.
|
|
14
14
|
|
|
15
|
+
### envVarsPrefix
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The prefix for the environment variables.
|
|
20
|
+
|
|
15
21
|
### envVars
|
|
16
22
|
|
|
17
23
|
[`INodeVariables`](../interfaces/INodeVariables.md)
|
|
@@ -30,7 +36,7 @@ Path to the OpenAPI spec file.
|
|
|
30
36
|
|
|
31
37
|
The state storage.
|
|
32
38
|
|
|
33
|
-
###
|
|
39
|
+
### customConfig?
|
|
34
40
|
|
|
35
41
|
(`config`) => `Promise`\<`void`\>
|
|
36
42
|
|
package/docs/reference/index.md
CHANGED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Interface: IRunOptions
|
|
2
|
+
|
|
3
|
+
The options when running the node.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### serverName?
|
|
8
|
+
|
|
9
|
+
> `optional` **serverName**: `string`
|
|
10
|
+
|
|
11
|
+
The name of the server, defaults to "TWIN Node Server".
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
"TWIN Node Server"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### serverVersion?
|
|
22
|
+
|
|
23
|
+
> `optional` **serverVersion**: `string`
|
|
24
|
+
|
|
25
|
+
The version of the server, defaults to the current version.
|
|
26
|
+
|
|
27
|
+
***
|
|
28
|
+
|
|
29
|
+
### envFilenames?
|
|
30
|
+
|
|
31
|
+
> `optional` **envFilenames**: `string`[]
|
|
32
|
+
|
|
33
|
+
Additional environment variable filenames to load, defaults to .env.
|
|
34
|
+
|
|
35
|
+
***
|
|
36
|
+
|
|
37
|
+
### envPrefix?
|
|
38
|
+
|
|
39
|
+
> `optional` **envPrefix**: `string`
|
|
40
|
+
|
|
41
|
+
The prefix for environment variables, defaults to "TWIN_NODE_".
|
|
42
|
+
|
|
43
|
+
***
|
|
44
|
+
|
|
45
|
+
### executionDirectory?
|
|
46
|
+
|
|
47
|
+
> `optional` **executionDirectory**: `string`
|
|
48
|
+
|
|
49
|
+
The directory to override the execution location, defaults to process directory.
|
|
50
|
+
|
|
51
|
+
***
|
|
52
|
+
|
|
53
|
+
### localesDirectory?
|
|
54
|
+
|
|
55
|
+
> `optional` **localesDirectory**: `string`
|
|
56
|
+
|
|
57
|
+
The directory to override the locales directory, defaults to the locales directory.
|
|
58
|
+
|
|
59
|
+
***
|
|
60
|
+
|
|
61
|
+
### openApiSpecFile?
|
|
62
|
+
|
|
63
|
+
> `optional` **openApiSpecFile**: `string`
|
|
64
|
+
|
|
65
|
+
The path to the OpenAPI spec file, defaults to docs/open-api/spec.json.
|
|
66
|
+
|
|
67
|
+
***
|
|
68
|
+
|
|
69
|
+
### customConfig()?
|
|
70
|
+
|
|
71
|
+
> `optional` **customConfig**: (`config`) => `Promise`\<`void`\>
|
|
72
|
+
|
|
73
|
+
Method to extend the engine configuration with any additional custom configuration.
|
|
74
|
+
|
|
75
|
+
#### Parameters
|
|
76
|
+
|
|
77
|
+
##### config
|
|
78
|
+
|
|
79
|
+
`IEngineConfig`
|
|
80
|
+
|
|
81
|
+
#### Returns
|
|
82
|
+
|
|
83
|
+
`Promise`\<`void`\>
|
|
84
|
+
|
|
85
|
+
***
|
|
86
|
+
|
|
87
|
+
### stateStorage?
|
|
88
|
+
|
|
89
|
+
> `optional` **stateStorage**: `IEngineStateStorage`\<`IEngineState`\>
|
|
90
|
+
|
|
91
|
+
The state storage to use for the engine.
|
|
92
|
+
If not provided, a default file-based state storage will be used.
|
package/locales/en.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"error": {
|
|
3
3
|
"node": {
|
|
4
|
-
"noEnvVars": "There are no environment variables starting
|
|
5
|
-
"storageFileRootNotSet": "
|
|
4
|
+
"noEnvVars": "There are no environment variables starting \"{prefix}\" the server will not start without them, please set them in the shell or create a .env file",
|
|
5
|
+
"storageFileRootNotSet": "{storageFileRoot} is not set, the server will not start without it, please set it in the shell or create a .env file"
|
|
6
6
|
}
|
|
7
7
|
},
|
|
8
8
|
"node": {
|