@twin.org/engine-core 0.0.2-next.22 → 0.0.2-next.24
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 +44 -36
- package/dist/esm/index.mjs +45 -37
- package/dist/types/engineCore.d.ts +11 -2
- package/docs/changelog.md +28 -0
- package/docs/reference/classes/EngineCore.md +19 -3
- package/locales/en.json +0 -4
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -45,7 +45,7 @@ class MemoryStateStorage {
|
|
|
45
45
|
* @returns The state of the engine or undefined if it doesn't exist.
|
|
46
46
|
*/
|
|
47
47
|
async load(engineCore) {
|
|
48
|
-
engineCore.logInfo(core.I18n.formatMessage(`${
|
|
48
|
+
engineCore.logInfo(core.I18n.formatMessage(`${"memoryStateStorage"}.loading`, {
|
|
49
49
|
filename: this._engineState
|
|
50
50
|
}));
|
|
51
51
|
return this._engineState;
|
|
@@ -58,7 +58,7 @@ class MemoryStateStorage {
|
|
|
58
58
|
*/
|
|
59
59
|
async save(engineCore, state) {
|
|
60
60
|
if (!this._readonlyMode) {
|
|
61
|
-
engineCore.logInfo(core.I18n.formatMessage(`${
|
|
61
|
+
engineCore.logInfo(core.I18n.formatMessage(`${"memoryStateStorage"}.saving`));
|
|
62
62
|
this._engineState = state;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -71,12 +71,15 @@ class MemoryStateStorage {
|
|
|
71
71
|
*/
|
|
72
72
|
class EngineCore {
|
|
73
73
|
/**
|
|
74
|
-
* Name for the engine logger, used for direct console logging.
|
|
74
|
+
* Name for the engine logger component, used for direct console logging.
|
|
75
75
|
*/
|
|
76
|
-
static
|
|
76
|
+
static LOGGING_COMPONENT_TYPE_NAME = "engine-logging-service";
|
|
77
|
+
/**
|
|
78
|
+
* Name for the engine logger connector, used for direct console logging.
|
|
79
|
+
*/
|
|
80
|
+
static LOGGING_CONNECTOR_TYPE_NAME = "engine-logging-connector";
|
|
77
81
|
/**
|
|
78
82
|
* Runtime name for the class.
|
|
79
|
-
* @internal
|
|
80
83
|
*/
|
|
81
84
|
static CLASS_NAME = "EngineCore";
|
|
82
85
|
/**
|
|
@@ -161,11 +164,18 @@ class EngineCore {
|
|
|
161
164
|
core.Guards.stringValue(EngineCore.CLASS_NAME, "type", type);
|
|
162
165
|
core.Guards.stringValue(EngineCore.CLASS_NAME, "module", module);
|
|
163
166
|
core.Guards.stringValue(EngineCore.CLASS_NAME, "method", method);
|
|
164
|
-
this._typeInitialisers.
|
|
165
|
-
|
|
166
|
-
module
|
|
167
|
-
method
|
|
168
|
-
}
|
|
167
|
+
const currentIndex = this._typeInitialisers.findIndex(t => t.type === type);
|
|
168
|
+
if (currentIndex >= 0) {
|
|
169
|
+
this._typeInitialisers[currentIndex].module = module;
|
|
170
|
+
this._typeInitialisers[currentIndex].method = method;
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
this._typeInitialisers.push({
|
|
174
|
+
type,
|
|
175
|
+
module,
|
|
176
|
+
method
|
|
177
|
+
});
|
|
178
|
+
}
|
|
169
179
|
}
|
|
170
180
|
/**
|
|
171
181
|
* Get the type config for a specific type.
|
|
@@ -203,7 +213,7 @@ class EngineCore {
|
|
|
203
213
|
this.logInfo(core.I18n.formatMessage(`${"engineCore"}.componentStarting`, {
|
|
204
214
|
element: instance.instanceType
|
|
205
215
|
}));
|
|
206
|
-
await instance.component.start(this._context.state.nodeIdentity, EngineCore.
|
|
216
|
+
await instance.component.start(this._context.state.nodeIdentity, EngineCore.LOGGING_COMPONENT_TYPE_NAME);
|
|
207
217
|
}
|
|
208
218
|
}
|
|
209
219
|
this.logInfo(core.I18n.formatMessage(`${"engineCore"}.componentsComplete`));
|
|
@@ -235,7 +245,7 @@ class EngineCore {
|
|
|
235
245
|
element: instance.instanceType
|
|
236
246
|
}));
|
|
237
247
|
try {
|
|
238
|
-
await instance.component.stop(this._context.state.nodeIdentity, EngineCore.
|
|
248
|
+
await instance.component.stop(this._context.state.nodeIdentity, EngineCore.LOGGING_COMPONENT_TYPE_NAME);
|
|
239
249
|
}
|
|
240
250
|
catch (err) {
|
|
241
251
|
this.logError(new core.GeneralError(EngineCore.CLASS_NAME, "componentStopFailed", {
|
|
@@ -353,7 +363,12 @@ class EngineCore {
|
|
|
353
363
|
registeredType = registeredTypes.find(t => t.features?.every(f => features.includes(f)))?.type;
|
|
354
364
|
}
|
|
355
365
|
else {
|
|
356
|
-
|
|
366
|
+
// First look for the default entry
|
|
367
|
+
registeredType = registeredTypes.find(t => t.isDefault)?.type;
|
|
368
|
+
// Can't find a default so just use the first entry
|
|
369
|
+
if (!core.Is.stringValue(registeredType)) {
|
|
370
|
+
registeredType = registeredTypes[0]?.type;
|
|
371
|
+
}
|
|
357
372
|
}
|
|
358
373
|
}
|
|
359
374
|
return registeredType;
|
|
@@ -428,18 +443,11 @@ class EngineCore {
|
|
|
428
443
|
});
|
|
429
444
|
result.factory?.register(finalInstanceType, () => result.component);
|
|
430
445
|
this._context.registeredInstances[typeKey] ??= [];
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
}
|
|
437
|
-
else {
|
|
438
|
-
this._context.registeredInstances[typeKey].push({
|
|
439
|
-
type: finalInstanceType,
|
|
440
|
-
features: typeConfig[i].features
|
|
441
|
-
});
|
|
442
|
-
}
|
|
446
|
+
this._context.registeredInstances[typeKey].push({
|
|
447
|
+
type: finalInstanceType,
|
|
448
|
+
isDefault: typeConfig[i].isDefault,
|
|
449
|
+
features: typeConfig[i].features
|
|
450
|
+
});
|
|
443
451
|
}
|
|
444
452
|
else {
|
|
445
453
|
throw new core.GeneralError("engineCore", "componentUnknownType", {
|
|
@@ -465,23 +473,23 @@ class EngineCore {
|
|
|
465
473
|
}
|
|
466
474
|
});
|
|
467
475
|
this._context.componentInstances.push({
|
|
468
|
-
instanceType: EngineCore.
|
|
476
|
+
instanceType: EngineCore.LOGGING_CONNECTOR_TYPE_NAME,
|
|
469
477
|
component: engineLoggerConnector
|
|
470
478
|
});
|
|
471
|
-
loggingModels.LoggingConnectorFactory.register(EngineCore.
|
|
479
|
+
loggingModels.LoggingConnectorFactory.register(EngineCore.LOGGING_CONNECTOR_TYPE_NAME, () => engineLoggerConnector);
|
|
472
480
|
this._context.registeredInstances.loggingConnector = [
|
|
473
481
|
{
|
|
474
|
-
type: EngineCore.
|
|
482
|
+
type: EngineCore.LOGGING_CONNECTOR_TYPE_NAME
|
|
475
483
|
}
|
|
476
484
|
];
|
|
477
485
|
const engineLoggerComponent = new loggingService.LoggingService({
|
|
478
|
-
loggingConnectorType: EngineCore.
|
|
486
|
+
loggingConnectorType: EngineCore.LOGGING_CONNECTOR_TYPE_NAME
|
|
479
487
|
});
|
|
480
488
|
this._engineLoggingComponent = engineLoggerComponent;
|
|
481
|
-
core.ComponentFactory.register(EngineCore.
|
|
489
|
+
core.ComponentFactory.register(EngineCore.LOGGING_COMPONENT_TYPE_NAME, () => engineLoggerComponent);
|
|
482
490
|
this._context.registeredInstances.loggingComponent = [
|
|
483
491
|
{
|
|
484
|
-
type: EngineCore.
|
|
492
|
+
type: EngineCore.LOGGING_COMPONENT_TYPE_NAME
|
|
485
493
|
}
|
|
486
494
|
];
|
|
487
495
|
}
|
|
@@ -537,7 +545,7 @@ class EngineCore {
|
|
|
537
545
|
this.logInfo(core.I18n.formatMessage(`${"engineCore"}.bootstrapping`, {
|
|
538
546
|
element: instanceName
|
|
539
547
|
}));
|
|
540
|
-
const bootstrapSuccess = await instance.component.bootstrap(EngineCore.
|
|
548
|
+
const bootstrapSuccess = await instance.component.bootstrap(EngineCore.LOGGING_COMPONENT_TYPE_NAME);
|
|
541
549
|
// If the bootstrap method failed then throw an error
|
|
542
550
|
if (!bootstrapSuccess) {
|
|
543
551
|
throw new core.GeneralError(EngineCore.CLASS_NAME, "bootstrapFailed", {
|
|
@@ -603,7 +611,7 @@ class FileStateStorage {
|
|
|
603
611
|
*/
|
|
604
612
|
async load(engineCore) {
|
|
605
613
|
try {
|
|
606
|
-
engineCore.logInfo(core.I18n.formatMessage(`${
|
|
614
|
+
engineCore.logInfo(core.I18n.formatMessage(`${"fileStateStorage"}.loading`, {
|
|
607
615
|
filename: this._filename
|
|
608
616
|
}));
|
|
609
617
|
if (await this.fileExists(this._filename)) {
|
|
@@ -612,7 +620,7 @@ class FileStateStorage {
|
|
|
612
620
|
}
|
|
613
621
|
}
|
|
614
622
|
catch (err) {
|
|
615
|
-
throw new core.GeneralError(FileStateStorage.CLASS_NAME, "
|
|
623
|
+
throw new core.GeneralError(FileStateStorage.CLASS_NAME, "failedLoading", { filename: this._filename }, core.BaseError.fromError(err));
|
|
616
624
|
}
|
|
617
625
|
}
|
|
618
626
|
/**
|
|
@@ -624,7 +632,7 @@ class FileStateStorage {
|
|
|
624
632
|
async save(engineCore, state) {
|
|
625
633
|
if (!this._readonlyMode) {
|
|
626
634
|
try {
|
|
627
|
-
engineCore.logInfo(core.I18n.formatMessage(`${
|
|
635
|
+
engineCore.logInfo(core.I18n.formatMessage(`${"fileStateStorage"}.saving`, {
|
|
628
636
|
filename: this._filename
|
|
629
637
|
}));
|
|
630
638
|
try {
|
|
@@ -634,7 +642,7 @@ class FileStateStorage {
|
|
|
634
642
|
await promises.writeFile(this._filename, JSON.stringify(state, undefined, "\t"), "utf8");
|
|
635
643
|
}
|
|
636
644
|
catch (err) {
|
|
637
|
-
throw new core.GeneralError(FileStateStorage.CLASS_NAME, "
|
|
645
|
+
throw new core.GeneralError(FileStateStorage.CLASS_NAME, "failedSaving", { filename: this._filename }, core.BaseError.fromError(err));
|
|
638
646
|
}
|
|
639
647
|
}
|
|
640
648
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isMainThread } from 'node:worker_threads';
|
|
2
|
-
import { I18n,
|
|
2
|
+
import { I18n, Is, Guards, BaseError, GeneralError, ErrorHelper, ComponentFactory } from '@twin.org/core';
|
|
3
3
|
import { EntitySchemaFactory } from '@twin.org/entity';
|
|
4
4
|
import { ConsoleLoggingConnector } from '@twin.org/logging-connector-console';
|
|
5
5
|
import { SilentLoggingConnector, LoggingConnectorFactory } from '@twin.org/logging-models';
|
|
@@ -43,7 +43,7 @@ class MemoryStateStorage {
|
|
|
43
43
|
* @returns The state of the engine or undefined if it doesn't exist.
|
|
44
44
|
*/
|
|
45
45
|
async load(engineCore) {
|
|
46
|
-
engineCore.logInfo(I18n.formatMessage(`${
|
|
46
|
+
engineCore.logInfo(I18n.formatMessage(`${"memoryStateStorage"}.loading`, {
|
|
47
47
|
filename: this._engineState
|
|
48
48
|
}));
|
|
49
49
|
return this._engineState;
|
|
@@ -56,7 +56,7 @@ class MemoryStateStorage {
|
|
|
56
56
|
*/
|
|
57
57
|
async save(engineCore, state) {
|
|
58
58
|
if (!this._readonlyMode) {
|
|
59
|
-
engineCore.logInfo(I18n.formatMessage(`${
|
|
59
|
+
engineCore.logInfo(I18n.formatMessage(`${"memoryStateStorage"}.saving`));
|
|
60
60
|
this._engineState = state;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -69,12 +69,15 @@ class MemoryStateStorage {
|
|
|
69
69
|
*/
|
|
70
70
|
class EngineCore {
|
|
71
71
|
/**
|
|
72
|
-
* Name for the engine logger, used for direct console logging.
|
|
72
|
+
* Name for the engine logger component, used for direct console logging.
|
|
73
73
|
*/
|
|
74
|
-
static
|
|
74
|
+
static LOGGING_COMPONENT_TYPE_NAME = "engine-logging-service";
|
|
75
|
+
/**
|
|
76
|
+
* Name for the engine logger connector, used for direct console logging.
|
|
77
|
+
*/
|
|
78
|
+
static LOGGING_CONNECTOR_TYPE_NAME = "engine-logging-connector";
|
|
75
79
|
/**
|
|
76
80
|
* Runtime name for the class.
|
|
77
|
-
* @internal
|
|
78
81
|
*/
|
|
79
82
|
static CLASS_NAME = "EngineCore";
|
|
80
83
|
/**
|
|
@@ -159,11 +162,18 @@ class EngineCore {
|
|
|
159
162
|
Guards.stringValue(EngineCore.CLASS_NAME, "type", type);
|
|
160
163
|
Guards.stringValue(EngineCore.CLASS_NAME, "module", module);
|
|
161
164
|
Guards.stringValue(EngineCore.CLASS_NAME, "method", method);
|
|
162
|
-
this._typeInitialisers.
|
|
163
|
-
|
|
164
|
-
module
|
|
165
|
-
method
|
|
166
|
-
}
|
|
165
|
+
const currentIndex = this._typeInitialisers.findIndex(t => t.type === type);
|
|
166
|
+
if (currentIndex >= 0) {
|
|
167
|
+
this._typeInitialisers[currentIndex].module = module;
|
|
168
|
+
this._typeInitialisers[currentIndex].method = method;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
this._typeInitialisers.push({
|
|
172
|
+
type,
|
|
173
|
+
module,
|
|
174
|
+
method
|
|
175
|
+
});
|
|
176
|
+
}
|
|
167
177
|
}
|
|
168
178
|
/**
|
|
169
179
|
* Get the type config for a specific type.
|
|
@@ -201,7 +211,7 @@ class EngineCore {
|
|
|
201
211
|
this.logInfo(I18n.formatMessage(`${"engineCore"}.componentStarting`, {
|
|
202
212
|
element: instance.instanceType
|
|
203
213
|
}));
|
|
204
|
-
await instance.component.start(this._context.state.nodeIdentity, EngineCore.
|
|
214
|
+
await instance.component.start(this._context.state.nodeIdentity, EngineCore.LOGGING_COMPONENT_TYPE_NAME);
|
|
205
215
|
}
|
|
206
216
|
}
|
|
207
217
|
this.logInfo(I18n.formatMessage(`${"engineCore"}.componentsComplete`));
|
|
@@ -233,7 +243,7 @@ class EngineCore {
|
|
|
233
243
|
element: instance.instanceType
|
|
234
244
|
}));
|
|
235
245
|
try {
|
|
236
|
-
await instance.component.stop(this._context.state.nodeIdentity, EngineCore.
|
|
246
|
+
await instance.component.stop(this._context.state.nodeIdentity, EngineCore.LOGGING_COMPONENT_TYPE_NAME);
|
|
237
247
|
}
|
|
238
248
|
catch (err) {
|
|
239
249
|
this.logError(new GeneralError(EngineCore.CLASS_NAME, "componentStopFailed", {
|
|
@@ -351,7 +361,12 @@ class EngineCore {
|
|
|
351
361
|
registeredType = registeredTypes.find(t => t.features?.every(f => features.includes(f)))?.type;
|
|
352
362
|
}
|
|
353
363
|
else {
|
|
354
|
-
|
|
364
|
+
// First look for the default entry
|
|
365
|
+
registeredType = registeredTypes.find(t => t.isDefault)?.type;
|
|
366
|
+
// Can't find a default so just use the first entry
|
|
367
|
+
if (!Is.stringValue(registeredType)) {
|
|
368
|
+
registeredType = registeredTypes[0]?.type;
|
|
369
|
+
}
|
|
355
370
|
}
|
|
356
371
|
}
|
|
357
372
|
return registeredType;
|
|
@@ -426,18 +441,11 @@ class EngineCore {
|
|
|
426
441
|
});
|
|
427
442
|
result.factory?.register(finalInstanceType, () => result.component);
|
|
428
443
|
this._context.registeredInstances[typeKey] ??= [];
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
}
|
|
435
|
-
else {
|
|
436
|
-
this._context.registeredInstances[typeKey].push({
|
|
437
|
-
type: finalInstanceType,
|
|
438
|
-
features: typeConfig[i].features
|
|
439
|
-
});
|
|
440
|
-
}
|
|
444
|
+
this._context.registeredInstances[typeKey].push({
|
|
445
|
+
type: finalInstanceType,
|
|
446
|
+
isDefault: typeConfig[i].isDefault,
|
|
447
|
+
features: typeConfig[i].features
|
|
448
|
+
});
|
|
441
449
|
}
|
|
442
450
|
else {
|
|
443
451
|
throw new GeneralError("engineCore", "componentUnknownType", {
|
|
@@ -463,23 +471,23 @@ class EngineCore {
|
|
|
463
471
|
}
|
|
464
472
|
});
|
|
465
473
|
this._context.componentInstances.push({
|
|
466
|
-
instanceType: EngineCore.
|
|
474
|
+
instanceType: EngineCore.LOGGING_CONNECTOR_TYPE_NAME,
|
|
467
475
|
component: engineLoggerConnector
|
|
468
476
|
});
|
|
469
|
-
LoggingConnectorFactory.register(EngineCore.
|
|
477
|
+
LoggingConnectorFactory.register(EngineCore.LOGGING_CONNECTOR_TYPE_NAME, () => engineLoggerConnector);
|
|
470
478
|
this._context.registeredInstances.loggingConnector = [
|
|
471
479
|
{
|
|
472
|
-
type: EngineCore.
|
|
480
|
+
type: EngineCore.LOGGING_CONNECTOR_TYPE_NAME
|
|
473
481
|
}
|
|
474
482
|
];
|
|
475
483
|
const engineLoggerComponent = new LoggingService({
|
|
476
|
-
loggingConnectorType: EngineCore.
|
|
484
|
+
loggingConnectorType: EngineCore.LOGGING_CONNECTOR_TYPE_NAME
|
|
477
485
|
});
|
|
478
486
|
this._engineLoggingComponent = engineLoggerComponent;
|
|
479
|
-
ComponentFactory.register(EngineCore.
|
|
487
|
+
ComponentFactory.register(EngineCore.LOGGING_COMPONENT_TYPE_NAME, () => engineLoggerComponent);
|
|
480
488
|
this._context.registeredInstances.loggingComponent = [
|
|
481
489
|
{
|
|
482
|
-
type: EngineCore.
|
|
490
|
+
type: EngineCore.LOGGING_COMPONENT_TYPE_NAME
|
|
483
491
|
}
|
|
484
492
|
];
|
|
485
493
|
}
|
|
@@ -535,7 +543,7 @@ class EngineCore {
|
|
|
535
543
|
this.logInfo(I18n.formatMessage(`${"engineCore"}.bootstrapping`, {
|
|
536
544
|
element: instanceName
|
|
537
545
|
}));
|
|
538
|
-
const bootstrapSuccess = await instance.component.bootstrap(EngineCore.
|
|
546
|
+
const bootstrapSuccess = await instance.component.bootstrap(EngineCore.LOGGING_COMPONENT_TYPE_NAME);
|
|
539
547
|
// If the bootstrap method failed then throw an error
|
|
540
548
|
if (!bootstrapSuccess) {
|
|
541
549
|
throw new GeneralError(EngineCore.CLASS_NAME, "bootstrapFailed", {
|
|
@@ -601,7 +609,7 @@ class FileStateStorage {
|
|
|
601
609
|
*/
|
|
602
610
|
async load(engineCore) {
|
|
603
611
|
try {
|
|
604
|
-
engineCore.logInfo(I18n.formatMessage(`${
|
|
612
|
+
engineCore.logInfo(I18n.formatMessage(`${"fileStateStorage"}.loading`, {
|
|
605
613
|
filename: this._filename
|
|
606
614
|
}));
|
|
607
615
|
if (await this.fileExists(this._filename)) {
|
|
@@ -610,7 +618,7 @@ class FileStateStorage {
|
|
|
610
618
|
}
|
|
611
619
|
}
|
|
612
620
|
catch (err) {
|
|
613
|
-
throw new GeneralError(FileStateStorage.CLASS_NAME, "
|
|
621
|
+
throw new GeneralError(FileStateStorage.CLASS_NAME, "failedLoading", { filename: this._filename }, BaseError.fromError(err));
|
|
614
622
|
}
|
|
615
623
|
}
|
|
616
624
|
/**
|
|
@@ -622,7 +630,7 @@ class FileStateStorage {
|
|
|
622
630
|
async save(engineCore, state) {
|
|
623
631
|
if (!this._readonlyMode) {
|
|
624
632
|
try {
|
|
625
|
-
engineCore.logInfo(I18n.formatMessage(`${
|
|
633
|
+
engineCore.logInfo(I18n.formatMessage(`${"fileStateStorage"}.saving`, {
|
|
626
634
|
filename: this._filename
|
|
627
635
|
}));
|
|
628
636
|
try {
|
|
@@ -632,7 +640,7 @@ class FileStateStorage {
|
|
|
632
640
|
await writeFile(this._filename, JSON.stringify(state, undefined, "\t"), "utf8");
|
|
633
641
|
}
|
|
634
642
|
catch (err) {
|
|
635
|
-
throw new GeneralError(FileStateStorage.CLASS_NAME, "
|
|
643
|
+
throw new GeneralError(FileStateStorage.CLASS_NAME, "failedSaving", { filename: this._filename }, BaseError.fromError(err));
|
|
636
644
|
}
|
|
637
645
|
}
|
|
638
646
|
}
|
|
@@ -6,9 +6,17 @@ import type { IEngineCoreOptions } from "./models/IEngineCoreOptions";
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class EngineCore<C extends IEngineCoreConfig = IEngineCoreConfig, S extends IEngineState = IEngineState> implements IEngineCore<C, S> {
|
|
8
8
|
/**
|
|
9
|
-
* Name for the engine logger, used for direct console logging.
|
|
9
|
+
* Name for the engine logger component, used for direct console logging.
|
|
10
10
|
*/
|
|
11
|
-
static readonly
|
|
11
|
+
static readonly LOGGING_COMPONENT_TYPE_NAME: string;
|
|
12
|
+
/**
|
|
13
|
+
* Name for the engine logger connector, used for direct console logging.
|
|
14
|
+
*/
|
|
15
|
+
static readonly LOGGING_CONNECTOR_TYPE_NAME: string;
|
|
16
|
+
/**
|
|
17
|
+
* Runtime name for the class.
|
|
18
|
+
*/
|
|
19
|
+
static readonly CLASS_NAME: string;
|
|
12
20
|
/**
|
|
13
21
|
* The core context.
|
|
14
22
|
*/
|
|
@@ -83,6 +91,7 @@ export declare class EngineCore<C extends IEngineCoreConfig = IEngineCoreConfig,
|
|
|
83
91
|
getRegisteredInstances(): {
|
|
84
92
|
[name: string]: {
|
|
85
93
|
type: string;
|
|
94
|
+
isDefault?: boolean;
|
|
86
95
|
features?: string[];
|
|
87
96
|
}[];
|
|
88
97
|
};
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @twin.org/engine-core - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.2-next.24](https://github.com/twinfoundation/engine/compare/engine-core-v0.0.2-next.23...engine-core-v0.0.2-next.24) (2025-10-08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* maintain isDefault flag for registered instances ([2ac5bee](https://github.com/twinfoundation/engine/commit/2ac5bee094bef42b396cc82b0d18bb6aebe27352))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/engine-models bumped from 0.0.2-next.23 to 0.0.2-next.24
|
|
16
|
+
|
|
17
|
+
## [0.0.2-next.23](https://github.com/twinfoundation/engine/compare/engine-core-v0.0.2-next.22...engine-core-v0.0.2-next.23) (2025-10-07)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* override type initialisers with new registrations ([5b4ff56](https://github.com/twinfoundation/engine/commit/5b4ff561d06b6513c870a72bb20ba23c0653cfe8))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/engine-models bumped from 0.0.2-next.22 to 0.0.2-next.23
|
|
30
|
+
|
|
3
31
|
## [0.0.2-next.22](https://github.com/twinfoundation/engine/compare/engine-core-v0.0.2-next.21...engine-core-v0.0.2-next.22) (2025-10-07)
|
|
4
32
|
|
|
5
33
|
|
|
@@ -38,11 +38,27 @@ The options for the engine.
|
|
|
38
38
|
|
|
39
39
|
## Properties
|
|
40
40
|
|
|
41
|
-
### LOGGING\_TYPE\_NAME
|
|
41
|
+
### LOGGING\_COMPONENT\_TYPE\_NAME
|
|
42
42
|
|
|
43
|
-
> `readonly` `static` **LOGGING\_TYPE\_NAME**: `string` = `"engine-logging-service"`
|
|
43
|
+
> `readonly` `static` **LOGGING\_COMPONENT\_TYPE\_NAME**: `string` = `"engine-logging-service"`
|
|
44
44
|
|
|
45
|
-
Name for the engine logger, used for direct console logging.
|
|
45
|
+
Name for the engine logger component, used for direct console logging.
|
|
46
|
+
|
|
47
|
+
***
|
|
48
|
+
|
|
49
|
+
### LOGGING\_CONNECTOR\_TYPE\_NAME
|
|
50
|
+
|
|
51
|
+
> `readonly` `static` **LOGGING\_CONNECTOR\_TYPE\_NAME**: `string` = `"engine-logging-connector"`
|
|
52
|
+
|
|
53
|
+
Name for the engine logger connector, used for direct console logging.
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### CLASS\_NAME
|
|
58
|
+
|
|
59
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
60
|
+
|
|
61
|
+
Runtime name for the class.
|
|
46
62
|
|
|
47
63
|
***
|
|
48
64
|
|
package/locales/en.json
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"error": {
|
|
3
3
|
"engineCore": {
|
|
4
|
-
"connectorUnknownType": "Unknown connector type \"{type}\" specified for \"{connectorType}\"",
|
|
5
4
|
"componentUnknownType": "Unknown component type \"{type}\" specified for \"{componentType}\"",
|
|
6
|
-
"entityStorageCustomMissing": "Entity storage custom \"{typeCustom}\" missing for component \"{storageName}\"",
|
|
7
|
-
"entityStorageMissing": "Entity storage configuration missing for component \"{storageName}\"",
|
|
8
5
|
"bootstrapFailed": "Bootstrap failed for component \"{component}\", please check the logs for more information",
|
|
9
6
|
"componentStopFailed": "Failed to stop component \"{component}\"",
|
|
10
7
|
"instanceTypeNotFound": "Instance type not found for \"{type}\" with features \"{features}\""
|
|
@@ -24,7 +21,6 @@
|
|
|
24
21
|
"stopping": "Engine is stopping",
|
|
25
22
|
"stopped": "Engine has stopped",
|
|
26
23
|
"configuring": "Configuring {element}",
|
|
27
|
-
"configuringEntityStorage": "Configuring {element} with name \"{storageName}\" using \"{storageType}\" connector",
|
|
28
24
|
"bootstrapStarted": "Bootstrap started",
|
|
29
25
|
"bootstrapComplete": "Bootstrap complete",
|
|
30
26
|
"bootstrapping": "Bootstrap {element}",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/engine-core",
|
|
3
|
-
"version": "0.0.2-next.
|
|
3
|
+
"version": "0.0.2-next.24",
|
|
4
4
|
"description": "Engine core.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@twin.org/core": "next",
|
|
18
18
|
"@twin.org/crypto": "next",
|
|
19
19
|
"@twin.org/data-core": "next",
|
|
20
|
-
"@twin.org/engine-models": "0.0.2-next.
|
|
20
|
+
"@twin.org/engine-models": "0.0.2-next.24",
|
|
21
21
|
"@twin.org/entity": "next",
|
|
22
22
|
"@twin.org/logging-connector-console": "next",
|
|
23
23
|
"@twin.org/logging-models": "next",
|