@twin.org/node-core 0.0.1-next.4 → 0.0.1-next.7
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/dist/cjs/index.cjs +34 -15
- package/dist/esm/index.mjs +34 -15
- package/dist/types/models/IRunOptions.d.ts +10 -2
- package/dist/types/server.d.ts +5 -3
- package/docs/changelog.md +32 -3
- package/docs/reference/functions/start.md +14 -2
- package/docs/reference/interfaces/IRunOptions.md +38 -2
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -308,10 +308,10 @@ async function bootstrapNodeUser(engineCore, context, envVars, features) {
|
|
|
308
308
|
const authUserEntityStorage = entityStorageModels.EntityStorageConnectorFactory.get(core.StringHelper.kebabCase("AuthenticationUser"));
|
|
309
309
|
const email = envVars.username ?? DEFAULT_NODE_USERNAME;
|
|
310
310
|
let nodeAdminUser = await authUserEntityStorage.get(email);
|
|
311
|
-
const generatedPassword = envVars.password ?? crypto.PasswordGenerator.generate(16);
|
|
312
|
-
const passwordBytes = core.Converter.utf8ToBytes(generatedPassword);
|
|
313
311
|
if (core.Is.empty(nodeAdminUser)) {
|
|
314
312
|
engineCore.logInfo(core.I18n.formatMessage("node.creatingNodeUser"));
|
|
313
|
+
const generatedPassword = envVars.password ?? crypto.PasswordGenerator.generate(16);
|
|
314
|
+
const passwordBytes = core.Converter.utf8ToBytes(generatedPassword);
|
|
315
315
|
const saltBytes = core.RandomHelper.generate(16);
|
|
316
316
|
const hashedPassword = await apiAuthEntityStorageService.PasswordHelper.hashPassword(passwordBytes, saltBytes);
|
|
317
317
|
nodeAdminUser = {
|
|
@@ -327,12 +327,21 @@ async function bootstrapNodeUser(engineCore, context, envVars, features) {
|
|
|
327
327
|
else {
|
|
328
328
|
engineCore.logInfo(core.I18n.formatMessage("node.existingNodeUser"));
|
|
329
329
|
// The user already exists, so double check the other details match
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
if (nodeAdminUser.identity !== context.state.nodeIdentity ||
|
|
333
|
-
nodeAdminUser.password !== hashedPassword) {
|
|
334
|
-
nodeAdminUser.password = hashedPassword;
|
|
330
|
+
let needsUpdate = false;
|
|
331
|
+
if (nodeAdminUser.identity !== context.state.nodeIdentity) {
|
|
335
332
|
nodeAdminUser.identity = context.state.nodeIdentity;
|
|
333
|
+
needsUpdate = true;
|
|
334
|
+
}
|
|
335
|
+
if (core.Is.stringValue(envVars.password)) {
|
|
336
|
+
const passwordBytes = core.Converter.utf8ToBytes(envVars.password);
|
|
337
|
+
const saltBytes = core.Converter.base64ToBytes(nodeAdminUser.salt);
|
|
338
|
+
const hashedPassword = await apiAuthEntityStorageService.PasswordHelper.hashPassword(passwordBytes, saltBytes);
|
|
339
|
+
if (nodeAdminUser.password !== hashedPassword) {
|
|
340
|
+
nodeAdminUser.password = hashedPassword;
|
|
341
|
+
needsUpdate = true;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if (needsUpdate) {
|
|
336
345
|
await authUserEntityStorage.set(nodeAdminUser);
|
|
337
346
|
}
|
|
338
347
|
}
|
|
@@ -495,10 +504,12 @@ async function bootstrapAuth(engineCore, context, envVars, features) {
|
|
|
495
504
|
* @param envVars The environment variables.
|
|
496
505
|
* @param openApiSpecFile Path to the OpenAPI spec file.
|
|
497
506
|
* @param stateStorage The state storage.
|
|
498
|
-
* @param
|
|
507
|
+
* @param extendConfig Extends the engine configuration with any additional custom configuration.
|
|
508
|
+
* @param extendEngine Extends the engine with any additional options.
|
|
509
|
+
* @param extendEngineServer Extends the engine server with any additional options.
|
|
499
510
|
* @returns The engine server.
|
|
500
511
|
*/
|
|
501
|
-
async function start(serverInfo, envVarsPrefix, envVars, openApiSpecFile, stateStorage,
|
|
512
|
+
async function start(serverInfo, envVarsPrefix, envVars, openApiSpecFile, stateStorage, extendConfig, extendEngine, extendEngineServer) {
|
|
502
513
|
envVars.storageFileRoot ??= "";
|
|
503
514
|
if ((envVars.entityStorageConnectorType === engineTypes.EntityStorageConnectorType.File ||
|
|
504
515
|
envVars.blobStorageConnectorType === engineTypes.BlobStorageConnectorType.File ||
|
|
@@ -511,8 +522,8 @@ async function start(serverInfo, envVarsPrefix, envVars, openApiSpecFile, stateS
|
|
|
511
522
|
// Build the engine configuration from the environment variables.
|
|
512
523
|
const engineConfig = engine.buildEngineConfiguration(envVars);
|
|
513
524
|
// Extend the engine configuration with a custom type.
|
|
514
|
-
if (core.Is.function(
|
|
515
|
-
await
|
|
525
|
+
if (core.Is.function(extendConfig)) {
|
|
526
|
+
await extendConfig(engineConfig);
|
|
516
527
|
}
|
|
517
528
|
// Build the server configuration from the environment variables.
|
|
518
529
|
const serverConfig = engineServer.buildEngineServerConfiguration(envVars, engineConfig, serverInfo, openApiSpecFile);
|
|
@@ -522,11 +533,19 @@ async function start(serverInfo, envVarsPrefix, envVars, openApiSpecFile, stateS
|
|
|
522
533
|
stateStorage: stateStorage ?? new engineCore.FileStateStorage(envVars.stateFilename ?? ""),
|
|
523
534
|
customBootstrap: async (core, engineContext) => bootstrap(core, engineContext, envVars)
|
|
524
535
|
});
|
|
536
|
+
// Extend the engine.
|
|
537
|
+
if (core.Is.function(extendEngine)) {
|
|
538
|
+
await extendEngine(engine$1);
|
|
539
|
+
}
|
|
540
|
+
// Construct the server with the engine.
|
|
541
|
+
const server = new engineServer.EngineServer({ engineCore: engine$1 });
|
|
542
|
+
// Extend the engine server.
|
|
543
|
+
if (core.Is.function(extendEngineServer)) {
|
|
544
|
+
await extendEngineServer(server);
|
|
545
|
+
}
|
|
525
546
|
// Need to register the engine with the factory so that background tasks
|
|
526
547
|
// can clone it to spawn new instances.
|
|
527
548
|
engineModels.EngineCoreFactory.register("engine", () => engine$1);
|
|
528
|
-
// Construct the server with the engine.
|
|
529
|
-
const server = new engineServer.EngineServer({ engineCore: engine$1 });
|
|
530
549
|
// Start the server, which also starts the engine.
|
|
531
550
|
const canContinue = await server.start();
|
|
532
551
|
if (canContinue) {
|
|
@@ -549,7 +568,7 @@ async function run(options) {
|
|
|
549
568
|
try {
|
|
550
569
|
const serverInfo = {
|
|
551
570
|
name: options?.serverName ?? "TWIN Node Server",
|
|
552
|
-
version: options?.serverVersion ?? "0.0.1-next.
|
|
571
|
+
version: options?.serverVersion ?? "0.0.1-next.7" // x-release-please-version
|
|
553
572
|
};
|
|
554
573
|
console.log(`\u001B[4m🌩️ ${serverInfo.name} v${serverInfo.version}\u001B[24m\n`);
|
|
555
574
|
const executionDirectory = options?.executionDirectory ?? getExecutionDirectory();
|
|
@@ -579,7 +598,7 @@ async function run(options) {
|
|
|
579
598
|
throw new core.GeneralError("node", "noEnvVars", { prefix: envPrefix });
|
|
580
599
|
}
|
|
581
600
|
console.info();
|
|
582
|
-
const startResult = await start(serverInfo, envPrefix, envVars, options?.openApiSpecFile, options.stateStorage, options.
|
|
601
|
+
const startResult = await start(serverInfo, envPrefix, envVars, options?.openApiSpecFile, options.stateStorage, options.extendConfig, options.extendEngine, options.extendEngineServer);
|
|
583
602
|
if (!core.Is.empty(startResult)) {
|
|
584
603
|
for (const signal of ["SIGHUP", "SIGINT", "SIGTERM"]) {
|
|
585
604
|
process.on(signal, async () => {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -287,10 +287,10 @@ async function bootstrapNodeUser(engineCore, context, envVars, features) {
|
|
|
287
287
|
const authUserEntityStorage = EntityStorageConnectorFactory.get(StringHelper.kebabCase("AuthenticationUser"));
|
|
288
288
|
const email = envVars.username ?? DEFAULT_NODE_USERNAME;
|
|
289
289
|
let nodeAdminUser = await authUserEntityStorage.get(email);
|
|
290
|
-
const generatedPassword = envVars.password ?? PasswordGenerator.generate(16);
|
|
291
|
-
const passwordBytes = Converter.utf8ToBytes(generatedPassword);
|
|
292
290
|
if (Is.empty(nodeAdminUser)) {
|
|
293
291
|
engineCore.logInfo(I18n.formatMessage("node.creatingNodeUser"));
|
|
292
|
+
const generatedPassword = envVars.password ?? PasswordGenerator.generate(16);
|
|
293
|
+
const passwordBytes = Converter.utf8ToBytes(generatedPassword);
|
|
294
294
|
const saltBytes = RandomHelper.generate(16);
|
|
295
295
|
const hashedPassword = await PasswordHelper.hashPassword(passwordBytes, saltBytes);
|
|
296
296
|
nodeAdminUser = {
|
|
@@ -306,12 +306,21 @@ async function bootstrapNodeUser(engineCore, context, envVars, features) {
|
|
|
306
306
|
else {
|
|
307
307
|
engineCore.logInfo(I18n.formatMessage("node.existingNodeUser"));
|
|
308
308
|
// The user already exists, so double check the other details match
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
if (nodeAdminUser.identity !== context.state.nodeIdentity ||
|
|
312
|
-
nodeAdminUser.password !== hashedPassword) {
|
|
313
|
-
nodeAdminUser.password = hashedPassword;
|
|
309
|
+
let needsUpdate = false;
|
|
310
|
+
if (nodeAdminUser.identity !== context.state.nodeIdentity) {
|
|
314
311
|
nodeAdminUser.identity = context.state.nodeIdentity;
|
|
312
|
+
needsUpdate = true;
|
|
313
|
+
}
|
|
314
|
+
if (Is.stringValue(envVars.password)) {
|
|
315
|
+
const passwordBytes = Converter.utf8ToBytes(envVars.password);
|
|
316
|
+
const saltBytes = Converter.base64ToBytes(nodeAdminUser.salt);
|
|
317
|
+
const hashedPassword = await PasswordHelper.hashPassword(passwordBytes, saltBytes);
|
|
318
|
+
if (nodeAdminUser.password !== hashedPassword) {
|
|
319
|
+
nodeAdminUser.password = hashedPassword;
|
|
320
|
+
needsUpdate = true;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
if (needsUpdate) {
|
|
315
324
|
await authUserEntityStorage.set(nodeAdminUser);
|
|
316
325
|
}
|
|
317
326
|
}
|
|
@@ -474,10 +483,12 @@ async function bootstrapAuth(engineCore, context, envVars, features) {
|
|
|
474
483
|
* @param envVars The environment variables.
|
|
475
484
|
* @param openApiSpecFile Path to the OpenAPI spec file.
|
|
476
485
|
* @param stateStorage The state storage.
|
|
477
|
-
* @param
|
|
486
|
+
* @param extendConfig Extends the engine configuration with any additional custom configuration.
|
|
487
|
+
* @param extendEngine Extends the engine with any additional options.
|
|
488
|
+
* @param extendEngineServer Extends the engine server with any additional options.
|
|
478
489
|
* @returns The engine server.
|
|
479
490
|
*/
|
|
480
|
-
async function start(serverInfo, envVarsPrefix, envVars, openApiSpecFile, stateStorage,
|
|
491
|
+
async function start(serverInfo, envVarsPrefix, envVars, openApiSpecFile, stateStorage, extendConfig, extendEngine, extendEngineServer) {
|
|
481
492
|
envVars.storageFileRoot ??= "";
|
|
482
493
|
if ((envVars.entityStorageConnectorType === EntityStorageConnectorType.File ||
|
|
483
494
|
envVars.blobStorageConnectorType === BlobStorageConnectorType.File ||
|
|
@@ -490,8 +501,8 @@ async function start(serverInfo, envVarsPrefix, envVars, openApiSpecFile, stateS
|
|
|
490
501
|
// Build the engine configuration from the environment variables.
|
|
491
502
|
const engineConfig = buildEngineConfiguration(envVars);
|
|
492
503
|
// Extend the engine configuration with a custom type.
|
|
493
|
-
if (Is.function(
|
|
494
|
-
await
|
|
504
|
+
if (Is.function(extendConfig)) {
|
|
505
|
+
await extendConfig(engineConfig);
|
|
495
506
|
}
|
|
496
507
|
// Build the server configuration from the environment variables.
|
|
497
508
|
const serverConfig = buildEngineServerConfiguration(envVars, engineConfig, serverInfo, openApiSpecFile);
|
|
@@ -501,11 +512,19 @@ async function start(serverInfo, envVarsPrefix, envVars, openApiSpecFile, stateS
|
|
|
501
512
|
stateStorage: stateStorage ?? new FileStateStorage(envVars.stateFilename ?? ""),
|
|
502
513
|
customBootstrap: async (core, engineContext) => bootstrap(core, engineContext, envVars)
|
|
503
514
|
});
|
|
515
|
+
// Extend the engine.
|
|
516
|
+
if (Is.function(extendEngine)) {
|
|
517
|
+
await extendEngine(engine);
|
|
518
|
+
}
|
|
519
|
+
// Construct the server with the engine.
|
|
520
|
+
const server = new EngineServer({ engineCore: engine });
|
|
521
|
+
// Extend the engine server.
|
|
522
|
+
if (Is.function(extendEngineServer)) {
|
|
523
|
+
await extendEngineServer(server);
|
|
524
|
+
}
|
|
504
525
|
// Need to register the engine with the factory so that background tasks
|
|
505
526
|
// can clone it to spawn new instances.
|
|
506
527
|
EngineCoreFactory.register("engine", () => engine);
|
|
507
|
-
// Construct the server with the engine.
|
|
508
|
-
const server = new EngineServer({ engineCore: engine });
|
|
509
528
|
// Start the server, which also starts the engine.
|
|
510
529
|
const canContinue = await server.start();
|
|
511
530
|
if (canContinue) {
|
|
@@ -528,7 +547,7 @@ async function run(options) {
|
|
|
528
547
|
try {
|
|
529
548
|
const serverInfo = {
|
|
530
549
|
name: options?.serverName ?? "TWIN Node Server",
|
|
531
|
-
version: options?.serverVersion ?? "0.0.1-next.
|
|
550
|
+
version: options?.serverVersion ?? "0.0.1-next.7" // x-release-please-version
|
|
532
551
|
};
|
|
533
552
|
console.log(`\u001B[4m🌩️ ${serverInfo.name} v${serverInfo.version}\u001B[24m\n`);
|
|
534
553
|
const executionDirectory = options?.executionDirectory ?? getExecutionDirectory();
|
|
@@ -558,7 +577,7 @@ async function run(options) {
|
|
|
558
577
|
throw new GeneralError("node", "noEnvVars", { prefix: envPrefix });
|
|
559
578
|
}
|
|
560
579
|
console.info();
|
|
561
|
-
const startResult = await start(serverInfo, envPrefix, envVars, options?.openApiSpecFile, options.stateStorage, options.
|
|
580
|
+
const startResult = await start(serverInfo, envPrefix, envVars, options?.openApiSpecFile, options.stateStorage, options.extendConfig, options.extendEngine, options.extendEngineServer);
|
|
562
581
|
if (!Is.empty(startResult)) {
|
|
563
582
|
for (const signal of ["SIGHUP", "SIGINT", "SIGTERM"]) {
|
|
564
583
|
process.on(signal, async () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IEngineStateStorage } from "@twin.org/engine-models";
|
|
1
|
+
import type { IEngineCore, IEngineServer, IEngineStateStorage } from "@twin.org/engine-models";
|
|
2
2
|
import type { IEngineConfig } from "@twin.org/engine-types";
|
|
3
3
|
/**
|
|
4
4
|
* The options when running the node.
|
|
@@ -36,7 +36,15 @@ export interface IRunOptions {
|
|
|
36
36
|
/**
|
|
37
37
|
* Method to extend the engine configuration with any additional custom configuration.
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
extendConfig?: (config: IEngineConfig) => Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Method to extend the engine with any additional options.
|
|
42
|
+
*/
|
|
43
|
+
extendEngine?: (engine: IEngineCore) => Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Method to extend the engine server with any additional options.
|
|
46
|
+
*/
|
|
47
|
+
extendEngineServer?: (engineServer: IEngineServer) => Promise<void>;
|
|
40
48
|
/**
|
|
41
49
|
* The state storage to use for the engine.
|
|
42
50
|
* If not provided, a default file-based state storage will be used.
|
package/dist/types/server.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IServerInfo } from "@twin.org/api-models";
|
|
2
2
|
import { Engine } from "@twin.org/engine";
|
|
3
|
-
import { type IEngineStateStorage } from "@twin.org/engine-models";
|
|
3
|
+
import { type IEngineCore, type IEngineServer, type IEngineStateStorage } from "@twin.org/engine-models";
|
|
4
4
|
import { EngineServer } from "@twin.org/engine-server";
|
|
5
5
|
import type { IEngineServerConfig } from "@twin.org/engine-server-types";
|
|
6
6
|
import { type IEngineConfig } from "@twin.org/engine-types";
|
|
@@ -13,10 +13,12 @@ import type { INodeVariables } from "./models/INodeVariables";
|
|
|
13
13
|
* @param envVars The environment variables.
|
|
14
14
|
* @param openApiSpecFile Path to the OpenAPI spec file.
|
|
15
15
|
* @param stateStorage The state storage.
|
|
16
|
-
* @param
|
|
16
|
+
* @param extendConfig Extends the engine configuration with any additional custom configuration.
|
|
17
|
+
* @param extendEngine Extends the engine with any additional options.
|
|
18
|
+
* @param extendEngineServer Extends the engine server with any additional options.
|
|
17
19
|
* @returns The engine server.
|
|
18
20
|
*/
|
|
19
|
-
export declare function start(serverInfo: IServerInfo, envVarsPrefix: string, envVars: INodeVariables, openApiSpecFile?: string, stateStorage?: IEngineStateStorage,
|
|
21
|
+
export declare function start(serverInfo: IServerInfo, envVarsPrefix: string, envVars: INodeVariables, openApiSpecFile?: string, stateStorage?: IEngineStateStorage, extendConfig?: (config: IEngineConfig) => Promise<void>, extendEngine?: (engine: IEngineCore) => Promise<void>, extendEngineServer?: (engineServer: IEngineServer) => Promise<void>): Promise<{
|
|
20
22
|
engine: Engine<IEngineServerConfig, INodeState>;
|
|
21
23
|
server: EngineServer;
|
|
22
24
|
} | undefined>;
|
package/docs/changelog.md
CHANGED
|
@@ -1,16 +1,45 @@
|
|
|
1
1
|
# @twin.org/node-core - Changelog
|
|
2
2
|
|
|
3
|
-
## [0.0.1-next.
|
|
3
|
+
## [0.0.1-next.7](https://github.com/twinfoundation/node/compare/node-core-v0.0.1-next.6...node-core-v0.0.1-next.7) (2025-06-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* adding a condition to verify if the password exists when bootstrapping ([6030a42](https://github.com/twinfoundation/node/commit/6030a42bdaf581678d96932fd0b809396bf7b8b0))
|
|
9
|
+
* adding a condition to verify if the password exists when bootstrapping ([c66f396](https://github.com/twinfoundation/node/commit/c66f396717394161a7647d1f08b3d87729d96e96))
|
|
10
|
+
* pr comments [#1](https://github.com/twinfoundation/node/issues/1) ([66e795b](https://github.com/twinfoundation/node/commit/66e795b16c372ab131ec1de30085aee90e4dbbd0))
|
|
4
11
|
|
|
12
|
+
## [0.0.1-next.6](https://github.com/twinfoundation/node/compare/node-core-v0.0.1-next.5...node-core-v0.0.1-next.6) (2025-06-12)
|
|
5
13
|
|
|
6
14
|
### Features
|
|
7
15
|
|
|
8
|
-
|
|
16
|
+
- add extend engine and server methods ([ec09c7e](https://github.com/twinfoundation/node/commit/ec09c7eb882d9f5797f2fd372e96cad1a3716f59))
|
|
17
|
+
- add extend engine and server methods ([0136a6f](https://github.com/twinfoundation/node/commit/0136a6f3f4e1a82b1427ee9618b8a17c79bc7fda))
|
|
18
|
+
- additional run options ([c35e5bb](https://github.com/twinfoundation/node/commit/c35e5bbb8a80fe6a36628d41f64585b3723d9ad7))
|
|
19
|
+
- improve error reporting ([fcd39a1](https://github.com/twinfoundation/node/commit/fcd39a18da2a6ce33965a99ca5f2f36f4aba712f))
|
|
20
|
+
- initial commit ([522f1e5](https://github.com/twinfoundation/node/commit/522f1e515348f9b1dd1eeb3170b1249e2b0b5371))
|
|
21
|
+
- node app use JavaScript ([14fe08c](https://github.com/twinfoundation/node/commit/14fe08cb760dd885a5dac9056a4d5dbc3d61df64))
|
|
22
|
+
- update dependencies ([9d25f16](https://github.com/twinfoundation/node/commit/9d25f16f1d554cd38f3bec28fdf7f8fff892ceaf))
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
- broken docs ([61479fd](https://github.com/twinfoundation/node/commit/61479fd618f766d22c5aafec5277e1a89e22b453))
|
|
27
|
+
|
|
28
|
+
## [0.0.1-next.5](https://github.com/twinfoundation/node/compare/node-core-v0.0.1-next.4...node-core-v0.0.1-next.5) (2025-06-12)
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
- add extend engine and server methods ([0136a6f](https://github.com/twinfoundation/node/commit/0136a6f3f4e1a82b1427ee9618b8a17c79bc7fda))
|
|
33
|
+
|
|
34
|
+
## [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)
|
|
35
|
+
|
|
36
|
+
### Features
|
|
9
37
|
|
|
38
|
+
- improve error reporting ([fcd39a1](https://github.com/twinfoundation/node/commit/fcd39a18da2a6ce33965a99ca5f2f36f4aba712f))
|
|
10
39
|
|
|
11
40
|
### Bug Fixes
|
|
12
41
|
|
|
13
|
-
|
|
42
|
+
- broken docs ([61479fd](https://github.com/twinfoundation/node/commit/61479fd618f766d22c5aafec5277e1a89e22b453))
|
|
14
43
|
|
|
15
44
|
## [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
45
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Function: start()
|
|
2
2
|
|
|
3
|
-
> **start**(`serverInfo`, `envVarsPrefix`, `envVars`, `openApiSpecFile?`, `stateStorage?`, `
|
|
3
|
+
> **start**(`serverInfo`, `envVarsPrefix`, `envVars`, `openApiSpecFile?`, `stateStorage?`, `extendConfig?`, `extendEngine?`, `extendEngineServer?`): `Promise`\<`undefined` \| \{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>; `server`: `EngineServer`; \}\>
|
|
4
4
|
|
|
5
5
|
Start the engine server.
|
|
6
6
|
|
|
@@ -36,12 +36,24 @@ Path to the OpenAPI spec file.
|
|
|
36
36
|
|
|
37
37
|
The state storage.
|
|
38
38
|
|
|
39
|
-
###
|
|
39
|
+
### extendConfig?
|
|
40
40
|
|
|
41
41
|
(`config`) => `Promise`\<`void`\>
|
|
42
42
|
|
|
43
43
|
Extends the engine configuration with any additional custom configuration.
|
|
44
44
|
|
|
45
|
+
### extendEngine?
|
|
46
|
+
|
|
47
|
+
(`engine`) => `Promise`\<`void`\>
|
|
48
|
+
|
|
49
|
+
Extends the engine with any additional options.
|
|
50
|
+
|
|
51
|
+
### extendEngineServer?
|
|
52
|
+
|
|
53
|
+
(`engineServer`) => `Promise`\<`void`\>
|
|
54
|
+
|
|
55
|
+
Extends the engine server with any additional options.
|
|
56
|
+
|
|
45
57
|
## Returns
|
|
46
58
|
|
|
47
59
|
`Promise`\<`undefined` \| \{ `engine`: `Engine`\<`IEngineServerConfig`, [`INodeState`](../interfaces/INodeState.md)\>; `server`: `EngineServer`; \}\>
|
|
@@ -66,9 +66,9 @@ The path to the OpenAPI spec file, defaults to docs/open-api/spec.json.
|
|
|
66
66
|
|
|
67
67
|
***
|
|
68
68
|
|
|
69
|
-
###
|
|
69
|
+
### extendConfig()?
|
|
70
70
|
|
|
71
|
-
> `optional` **
|
|
71
|
+
> `optional` **extendConfig**: (`config`) => `Promise`\<`void`\>
|
|
72
72
|
|
|
73
73
|
Method to extend the engine configuration with any additional custom configuration.
|
|
74
74
|
|
|
@@ -84,6 +84,42 @@ Method to extend the engine configuration with any additional custom configurati
|
|
|
84
84
|
|
|
85
85
|
***
|
|
86
86
|
|
|
87
|
+
### extendEngine()?
|
|
88
|
+
|
|
89
|
+
> `optional` **extendEngine**: (`engine`) => `Promise`\<`void`\>
|
|
90
|
+
|
|
91
|
+
Method to extend the engine with any additional options.
|
|
92
|
+
|
|
93
|
+
#### Parameters
|
|
94
|
+
|
|
95
|
+
##### engine
|
|
96
|
+
|
|
97
|
+
`IEngineCore`
|
|
98
|
+
|
|
99
|
+
#### Returns
|
|
100
|
+
|
|
101
|
+
`Promise`\<`void`\>
|
|
102
|
+
|
|
103
|
+
***
|
|
104
|
+
|
|
105
|
+
### extendEngineServer()?
|
|
106
|
+
|
|
107
|
+
> `optional` **extendEngineServer**: (`engineServer`) => `Promise`\<`void`\>
|
|
108
|
+
|
|
109
|
+
Method to extend the engine server with any additional options.
|
|
110
|
+
|
|
111
|
+
#### Parameters
|
|
112
|
+
|
|
113
|
+
##### engineServer
|
|
114
|
+
|
|
115
|
+
`IEngineServer`
|
|
116
|
+
|
|
117
|
+
#### Returns
|
|
118
|
+
|
|
119
|
+
`Promise`\<`void`\>
|
|
120
|
+
|
|
121
|
+
***
|
|
122
|
+
|
|
87
123
|
### stateStorage?
|
|
88
124
|
|
|
89
125
|
> `optional` **stateStorage**: `IEngineStateStorage`\<`IEngineState`\>
|