@twin.org/engine-core 0.0.1-next.20 → 0.0.1-next.21
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 +11 -1
- package/dist/esm/index.mjs +11 -1
- package/docs/changelog.md +1 -1
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var core = require('@twin.org/core');
|
|
4
|
+
var entity = require('@twin.org/entity');
|
|
4
5
|
var loggingConnectorConsole = require('@twin.org/logging-connector-console');
|
|
5
6
|
var loggingModels = require('@twin.org/logging-models');
|
|
6
7
|
var modules = require('@twin.org/modules');
|
|
@@ -280,10 +281,16 @@ class EngineCore {
|
|
|
280
281
|
* @returns The clone data.
|
|
281
282
|
*/
|
|
282
283
|
getCloneData() {
|
|
284
|
+
const entitySchemas = {};
|
|
285
|
+
const entitySchemaNames = entity.EntitySchemaFactory.names();
|
|
286
|
+
for (const schemaName of entitySchemaNames) {
|
|
287
|
+
entitySchemas[schemaName] = entity.EntitySchemaFactory.get(schemaName);
|
|
288
|
+
}
|
|
283
289
|
const cloneData = {
|
|
284
290
|
config: this._context.config,
|
|
285
291
|
state: this._context.state,
|
|
286
|
-
typeInitialisers: this._typeInitialisers
|
|
292
|
+
typeInitialisers: this._typeInitialisers,
|
|
293
|
+
entitySchemas
|
|
287
294
|
};
|
|
288
295
|
return cloneData;
|
|
289
296
|
}
|
|
@@ -304,6 +311,9 @@ class EngineCore {
|
|
|
304
311
|
stateDirty: false
|
|
305
312
|
};
|
|
306
313
|
this._typeInitialisers = cloneData.typeInitialisers;
|
|
314
|
+
for (const schemaName of Object.keys(cloneData.entitySchemas)) {
|
|
315
|
+
entity.EntitySchemaFactory.register(schemaName, () => cloneData.entitySchemas[schemaName]);
|
|
316
|
+
}
|
|
307
317
|
this._stateStorage = new MemoryStateStorage(true, cloneData.state);
|
|
308
318
|
this._isStarted = false;
|
|
309
319
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { I18n, StringHelper, Is, GeneralError, BaseError, ErrorHelper, Guards } from '@twin.org/core';
|
|
2
|
+
import { EntitySchemaFactory } from '@twin.org/entity';
|
|
2
3
|
import { ConsoleLoggingConnector } from '@twin.org/logging-connector-console';
|
|
3
4
|
import { LoggingConnectorFactory } from '@twin.org/logging-models';
|
|
4
5
|
import { ModuleHelper } from '@twin.org/modules';
|
|
@@ -278,10 +279,16 @@ class EngineCore {
|
|
|
278
279
|
* @returns The clone data.
|
|
279
280
|
*/
|
|
280
281
|
getCloneData() {
|
|
282
|
+
const entitySchemas = {};
|
|
283
|
+
const entitySchemaNames = EntitySchemaFactory.names();
|
|
284
|
+
for (const schemaName of entitySchemaNames) {
|
|
285
|
+
entitySchemas[schemaName] = EntitySchemaFactory.get(schemaName);
|
|
286
|
+
}
|
|
281
287
|
const cloneData = {
|
|
282
288
|
config: this._context.config,
|
|
283
289
|
state: this._context.state,
|
|
284
|
-
typeInitialisers: this._typeInitialisers
|
|
290
|
+
typeInitialisers: this._typeInitialisers,
|
|
291
|
+
entitySchemas
|
|
285
292
|
};
|
|
286
293
|
return cloneData;
|
|
287
294
|
}
|
|
@@ -302,6 +309,9 @@ class EngineCore {
|
|
|
302
309
|
stateDirty: false
|
|
303
310
|
};
|
|
304
311
|
this._typeInitialisers = cloneData.typeInitialisers;
|
|
312
|
+
for (const schemaName of Object.keys(cloneData.entitySchemas)) {
|
|
313
|
+
EntitySchemaFactory.register(schemaName, () => cloneData.entitySchemas[schemaName]);
|
|
314
|
+
}
|
|
305
315
|
this._stateStorage = new MemoryStateStorage(true, cloneData.state);
|
|
306
316
|
this._isStarted = false;
|
|
307
317
|
}
|
package/docs/changelog.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/engine-core",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.21",
|
|
4
4
|
"description": "Engine core.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@twin.org/crypto": "next",
|
|
44
44
|
"@twin.org/data-core": "next",
|
|
45
45
|
"@twin.org/data-schema-org": "next",
|
|
46
|
-
"@twin.org/engine-models": "0.0.1-next.
|
|
46
|
+
"@twin.org/engine-models": "0.0.1-next.21",
|
|
47
47
|
"@twin.org/entity": "next",
|
|
48
48
|
"@twin.org/entity-storage-connector-cosmosdb": "next",
|
|
49
49
|
"@twin.org/entity-storage-connector-dynamodb": "next",
|