@dcl/ecs 7.20.2-22169778016.commit-030cbfe → 7.20.2-22231111352.commit-d2f6f0a
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/components/index.d.ts +0 -5
- package/dist/components/index.js +2 -5
- package/dist/components/manual/Transform.d.ts +0 -9
- package/dist/components/manual/Transform.js +3 -3
- package/dist/components/types.d.ts +0 -1
- package/dist/engine/component.d.ts +1 -52
- package/dist/engine/grow-only-value-set-component-definition.js +3 -46
- package/dist/engine/input.js +3 -2
- package/dist/engine/lww-element-set-component-definition.d.ts +1 -3
- package/dist/engine/lww-element-set-component-definition.js +12 -65
- package/dist/index.d.ts +1 -2
- package/dist/index.js +0 -1
- package/dist/serialization/crdt/index.d.ts +0 -1
- package/dist/serialization/crdt/index.js +0 -1
- package/dist/serialization/crdt/network/utils.d.ts +9 -0
- package/dist/serialization/crdt/network/utils.js +60 -0
- package/dist/serialization/crdt/types.d.ts +3 -25
- package/dist/serialization/crdt/types.js +1 -3
- package/dist/systems/crdt/index.d.ts +1 -0
- package/dist/systems/crdt/index.js +146 -55
- package/dist-cjs/components/index.d.ts +0 -5
- package/dist-cjs/components/index.js +3 -7
- package/dist-cjs/components/manual/Transform.d.ts +0 -9
- package/dist-cjs/components/manual/Transform.js +3 -3
- package/dist-cjs/components/types.d.ts +0 -1
- package/dist-cjs/engine/component.d.ts +1 -52
- package/dist-cjs/engine/grow-only-value-set-component-definition.js +2 -45
- package/dist-cjs/engine/input.js +3 -2
- package/dist-cjs/engine/lww-element-set-component-definition.d.ts +1 -3
- package/dist-cjs/engine/lww-element-set-component-definition.js +13 -68
- package/dist-cjs/index.d.ts +1 -2
- package/dist-cjs/index.js +1 -2
- package/dist-cjs/serialization/crdt/index.d.ts +0 -1
- package/dist-cjs/serialization/crdt/index.js +0 -1
- package/dist-cjs/serialization/crdt/network/utils.d.ts +9 -0
- package/dist-cjs/serialization/crdt/network/utils.js +67 -0
- package/dist-cjs/serialization/crdt/types.d.ts +3 -25
- package/dist-cjs/serialization/crdt/types.js +1 -3
- package/dist-cjs/systems/crdt/index.d.ts +1 -0
- package/dist-cjs/systems/crdt/index.js +169 -55
- package/package.json +2 -2
- package/dist/components/manual/CreatedBy.d.ts +0 -9
- package/dist/components/manual/CreatedBy.js +0 -8
- package/dist/serialization/crdt/authoritativePutComponent.d.ts +0 -15
- package/dist/serialization/crdt/authoritativePutComponent.js +0 -47
- package/dist-cjs/components/manual/CreatedBy.d.ts +0 -9
- package/dist-cjs/components/manual/CreatedBy.js +0 -10
- package/dist-cjs/serialization/crdt/authoritativePutComponent.d.ts +0 -15
- package/dist-cjs/serialization/crdt/authoritativePutComponent.js +0 -50
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createComponentDefinitionFromSchema = exports.createGetCrdtMessagesForLww = exports.createUpdateLwwFromCrdt = exports.
|
|
3
|
+
exports.createComponentDefinitionFromSchema = exports.createGetCrdtMessagesForLww = exports.createUpdateLwwFromCrdt = exports.createDumpLwwFunctionFromCrdt = exports.incrementTimestamp = void 0;
|
|
4
4
|
const ByteBuffer_1 = require("../serialization/ByteBuffer");
|
|
5
5
|
const crdt_1 = require("../serialization/crdt");
|
|
6
6
|
const utils_1 = require("../systems/crdt/utils");
|
|
@@ -35,12 +35,16 @@ function createDumpLwwFunctionFromCrdt(componentId, timestamps, schema, data) {
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
exports.createDumpLwwFunctionFromCrdt = createDumpLwwFunctionFromCrdt;
|
|
38
|
-
|
|
39
|
-
function createCrdtRuleValidator(timestamps, schema, data) {
|
|
38
|
+
function createUpdateLwwFromCrdt(componentId, timestamps, schema, data) {
|
|
40
39
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
|
|
40
|
+
* Process the received message only if the lamport number recieved is higher
|
|
41
|
+
* than the stored one. If its lower, we spread it to the network to correct the peer.
|
|
42
|
+
* If they are equal, the bigger raw data wins.
|
|
43
|
+
|
|
44
|
+
* Returns the recieved data if the lamport number was bigger than ours.
|
|
45
|
+
* If it was an outdated message, then we return void
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
44
48
|
function crdtRuleForCurrentState(message) {
|
|
45
49
|
const { entityId, timestamp } = message;
|
|
46
50
|
const currentTimestamp = timestamps.get(entityId);
|
|
@@ -50,6 +54,7 @@ function createCrdtRuleValidator(timestamps, schema, data) {
|
|
|
50
54
|
}
|
|
51
55
|
// Outdated Message. Resend our state message through the wire.
|
|
52
56
|
if (currentTimestamp > timestamp) {
|
|
57
|
+
// console.log('2', currentTimestamp, timestamp)
|
|
53
58
|
return crdt_1.ProcessMessageResultType.StateOutdatedTimestamp;
|
|
54
59
|
}
|
|
55
60
|
// Deletes are idempotent
|
|
@@ -66,6 +71,7 @@ function createCrdtRuleValidator(timestamps, schema, data) {
|
|
|
66
71
|
currentDataGreater = (0, utils_1.dataCompare)(null, message.data);
|
|
67
72
|
}
|
|
68
73
|
// Same data, same timestamp. Weirdo echo message.
|
|
74
|
+
// console.log('3', currentDataGreater, writeBuffer.toBinary(), (message as any).data || null)
|
|
69
75
|
if (currentDataGreater === 0) {
|
|
70
76
|
return crdt_1.ProcessMessageResultType.NoChanges;
|
|
71
77
|
}
|
|
@@ -74,38 +80,10 @@ function createCrdtRuleValidator(timestamps, schema, data) {
|
|
|
74
80
|
return crdt_1.ProcessMessageResultType.StateOutdatedData;
|
|
75
81
|
}
|
|
76
82
|
else {
|
|
77
|
-
//
|
|
83
|
+
// Curent data is lower
|
|
78
84
|
return crdt_1.ProcessMessageResultType.StateUpdatedData;
|
|
79
85
|
}
|
|
80
86
|
}
|
|
81
|
-
return crdtRuleForCurrentState;
|
|
82
|
-
}
|
|
83
|
-
exports.createCrdtRuleValidator = createCrdtRuleValidator;
|
|
84
|
-
function createForceUpdateLwwFromCrdt(componentId, timestamps, schema, data) {
|
|
85
|
-
/**
|
|
86
|
-
* Force update component state regardless of timestamp - used for server authoritative messages
|
|
87
|
-
*/
|
|
88
|
-
return (msg) => {
|
|
89
|
-
console.log('[ BOEDO ] [ CASLA ] ', msg);
|
|
90
|
-
const buffer = new ByteBuffer_1.ReadWriteByteBuffer(msg.data);
|
|
91
|
-
const deserializedValue = schema.deserialize(buffer);
|
|
92
|
-
data.set(msg.entityId, deserializedValue);
|
|
93
|
-
timestamps.set(msg.entityId, msg.timestamp);
|
|
94
|
-
return [null, deserializedValue];
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
exports.createForceUpdateLwwFromCrdt = createForceUpdateLwwFromCrdt;
|
|
98
|
-
function createUpdateLwwFromCrdt(componentId, timestamps, schema, data) {
|
|
99
|
-
/**
|
|
100
|
-
* Process the received message only if the lamport number recieved is higher
|
|
101
|
-
* than the stored one. If its lower, we spread it to the network to correct the peer.
|
|
102
|
-
* If they are equal, the bigger raw data wins.
|
|
103
|
-
|
|
104
|
-
* Returns the recieved data if the lamport number was bigger than ours.
|
|
105
|
-
* If it was an outdated message, then we return void
|
|
106
|
-
* @public
|
|
107
|
-
*/
|
|
108
|
-
const crdtRuleForCurrentState = createCrdtRuleValidator(timestamps, schema, data);
|
|
109
87
|
return (msg) => {
|
|
110
88
|
/* istanbul ignore next */
|
|
111
89
|
if (msg.type !== crdt_1.CrdtMessageType.PUT_COMPONENT &&
|
|
@@ -200,7 +178,6 @@ function createComponentDefinitionFromSchema(componentName, componentId, schema)
|
|
|
200
178
|
const dirtyIterator = new Set();
|
|
201
179
|
const timestamps = new Map();
|
|
202
180
|
const onChangeCallbacks = new Map();
|
|
203
|
-
const validateCallbacks = new Map();
|
|
204
181
|
return {
|
|
205
182
|
get componentId() {
|
|
206
183
|
return componentId;
|
|
@@ -292,39 +269,7 @@ function createComponentDefinitionFromSchema(componentName, componentId, schema)
|
|
|
292
269
|
},
|
|
293
270
|
getCrdtUpdates: createGetCrdtMessagesForLww(componentId, timestamps, dirtyIterator, schema, data),
|
|
294
271
|
updateFromCrdt: createUpdateLwwFromCrdt(componentId, timestamps, schema, data),
|
|
295
|
-
__forceUpdateFromCrdt: createForceUpdateLwwFromCrdt(componentId, timestamps, schema, data),
|
|
296
|
-
__dry_run_updateFromCrdt: createCrdtRuleValidator(timestamps, schema, data),
|
|
297
272
|
dumpCrdtStateToBuffer: createDumpLwwFunctionFromCrdt(componentId, timestamps, schema, data),
|
|
298
|
-
validateBeforeChange(entityOrCb, cb) {
|
|
299
|
-
if (arguments.length === 1) {
|
|
300
|
-
// Second overload: just callback (global validation)
|
|
301
|
-
validateCallbacks.set(__GLOBAL_ENTITY, entityOrCb);
|
|
302
|
-
}
|
|
303
|
-
else {
|
|
304
|
-
if (cb) {
|
|
305
|
-
validateCallbacks.set(entityOrCb, cb);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
},
|
|
309
|
-
__run_validateBeforeChange(entity, newValue, senderAddress, createdBy) {
|
|
310
|
-
const cb = entity && validateCallbacks.get(entity);
|
|
311
|
-
const globalCb = validateCallbacks.get(__GLOBAL_ENTITY);
|
|
312
|
-
const currentValue = data.get(entity);
|
|
313
|
-
const value = { entity, currentValue, newValue, senderAddress, createdBy };
|
|
314
|
-
const globalResult = globalCb?.(value) ?? true;
|
|
315
|
-
const entityResult = (globalResult && cb?.(value)) ?? true;
|
|
316
|
-
return globalResult && entityResult;
|
|
317
|
-
},
|
|
318
|
-
getCrdtState(entity) {
|
|
319
|
-
const componentData = data.get(entity);
|
|
320
|
-
const timestamp = timestamps.get(entity);
|
|
321
|
-
if (componentData && timestamp !== undefined) {
|
|
322
|
-
const buffer = new ByteBuffer_1.ReadWriteByteBuffer();
|
|
323
|
-
schema.serialize((0, readonly_1.deepReadonly)(componentData), buffer);
|
|
324
|
-
return { data: buffer.toBinary(), timestamp };
|
|
325
|
-
}
|
|
326
|
-
return null;
|
|
327
|
-
},
|
|
328
273
|
onChange(entity, cb) {
|
|
329
274
|
const cbs = onChangeCallbacks.get(entity) ?? [];
|
|
330
275
|
cbs.push(cb);
|
package/dist-cjs/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export * from './systems/tween';
|
|
|
13
13
|
export * from './systems/triggerArea';
|
|
14
14
|
export * from './engine/entity';
|
|
15
15
|
export * from './components/types';
|
|
16
|
-
import { MaterialComponentDefinitionExtended, MeshColliderComponentDefinitionExtended, MeshRendererComponentDefinitionExtended, TransformComponentExtended, AnimatorComponentDefinitionExtended, AudioSourceComponentDefinitionExtended, AudioStreamComponentDefinitionExtended, ISyncComponents, TweenComponentDefinitionExtended, INetowrkEntity, INetowrkParent, VirtualCameraComponentDefinitionExtended, InputModifierComponentDefinitionExtended, LightSourceComponentDefinitionExtended, TriggerAreaComponentDefinitionExtended
|
|
16
|
+
import { MaterialComponentDefinitionExtended, MeshColliderComponentDefinitionExtended, MeshRendererComponentDefinitionExtended, TransformComponentExtended, AnimatorComponentDefinitionExtended, AudioSourceComponentDefinitionExtended, AudioStreamComponentDefinitionExtended, ISyncComponents, TweenComponentDefinitionExtended, INetowrkEntity, INetowrkParent, VirtualCameraComponentDefinitionExtended, InputModifierComponentDefinitionExtended, LightSourceComponentDefinitionExtended, TriggerAreaComponentDefinitionExtended } from './components/types';
|
|
17
17
|
import { NameComponent } from './components/manual/Name';
|
|
18
18
|
import { TagsComponentDefinitionExtended } from './components/manual/Tags';
|
|
19
19
|
export declare const Transform: TransformComponentExtended;
|
|
@@ -46,7 +46,6 @@ export declare const NetworkEntity: INetowrkEntity;
|
|
|
46
46
|
* Tag a entity to be syncronized through comms
|
|
47
47
|
*/
|
|
48
48
|
export declare const NetworkParent: INetowrkParent;
|
|
49
|
-
export declare const CreatedBy: ICreatedBy;
|
|
50
49
|
export * from './components/generated/global.gen';
|
|
51
50
|
export * from './components/generated/types.gen';
|
|
52
51
|
export * from './serialization/crdt';
|
package/dist-cjs/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.NetworkParent = exports.NetworkEntity = exports.SyncComponents = exports.TriggerArea = exports.LightSource = exports.InputModifier = exports.VirtualCamera = exports.Tween = exports.Tags = exports.Name = exports.MeshCollider = exports.MeshRenderer = exports.Material = exports.AudioStream = exports.AudioSource = exports.Animator = exports.Transform = exports.components = exports.cyclicParentingChecker = void 0;
|
|
30
30
|
// The order of the following imports matters. Please do not auto-sort
|
|
31
31
|
__exportStar(require("./engine"), exports);
|
|
32
32
|
__exportStar(require("./schemas"), exports);
|
|
@@ -79,7 +79,6 @@ exports.NetworkEntity = components.NetworkEntity(initialization_1.engine);
|
|
|
79
79
|
* Tag a entity to be syncronized through comms
|
|
80
80
|
*/
|
|
81
81
|
exports.NetworkParent = components.NetworkParent(initialization_1.engine);
|
|
82
|
-
exports.CreatedBy = components.CreatedBy(initialization_1.engine);
|
|
83
82
|
// export components for global engine
|
|
84
83
|
__exportStar(require("./components/generated/global.gen"), exports);
|
|
85
84
|
__exportStar(require("./components/generated/types.gen"), exports);
|
|
@@ -23,4 +23,3 @@ __exportStar(require("./network/deleteComponentNetwork"), exports);
|
|
|
23
23
|
__exportStar(require("./network/deleteEntityNetwork"), exports);
|
|
24
24
|
__exportStar(require("./types"), exports);
|
|
25
25
|
__exportStar(require("./crdtMessageProtocol"), exports);
|
|
26
|
-
__exportStar(require("./authoritativePutComponent"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Entity } from '../../../engine';
|
|
2
|
+
import { ReceiveMessage, TransformType } from '../../../runtime/types';
|
|
3
|
+
import { ReceiveNetworkMessage } from '../../../systems/crdt/types';
|
|
4
|
+
import { ByteBuffer } from '../../ByteBuffer';
|
|
5
|
+
import { INetowrkEntityType } from '../../../components/types';
|
|
6
|
+
export declare function isNetworkMessage(message: ReceiveMessage): message is ReceiveNetworkMessage;
|
|
7
|
+
export declare function networkMessageToLocal(message: ReceiveNetworkMessage, localEntityId: Entity, buffer: ByteBuffer, destinationBuffer: ByteBuffer): void;
|
|
8
|
+
export declare function localMessageToNetwork(message: ReceiveMessage, network: INetowrkEntityType, buffer: ByteBuffer, destinationBuffer: ByteBuffer): void;
|
|
9
|
+
export declare function fixTransformParent(message: ReceiveMessage, transformValue?: TransformType, parent?: Entity): Uint8Array;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fixTransformParent = exports.localMessageToNetwork = exports.networkMessageToLocal = exports.isNetworkMessage = void 0;
|
|
4
|
+
const ByteBuffer_1 = require("../../ByteBuffer");
|
|
5
|
+
const putComponent_1 = require("../putComponent");
|
|
6
|
+
const types_1 = require("../types");
|
|
7
|
+
const deleteComponent_1 = require("../deleteComponent");
|
|
8
|
+
const deleteEntity_1 = require("../deleteEntity");
|
|
9
|
+
const putComponentNetwork_1 = require("./putComponentNetwork");
|
|
10
|
+
const deleteComponentNetwork_1 = require("./deleteComponentNetwork");
|
|
11
|
+
const deleteEntityNetwork_1 = require("./deleteEntityNetwork");
|
|
12
|
+
const Transform_1 = require("../../../components/manual/Transform");
|
|
13
|
+
/* istanbul ignore next */
|
|
14
|
+
function isNetworkMessage(message) {
|
|
15
|
+
return [
|
|
16
|
+
types_1.CrdtMessageType.DELETE_COMPONENT_NETWORK,
|
|
17
|
+
types_1.CrdtMessageType.DELETE_ENTITY_NETWORK,
|
|
18
|
+
types_1.CrdtMessageType.PUT_COMPONENT_NETWORK
|
|
19
|
+
].includes(message.type);
|
|
20
|
+
}
|
|
21
|
+
exports.isNetworkMessage = isNetworkMessage;
|
|
22
|
+
/* istanbul ignore next */
|
|
23
|
+
function networkMessageToLocal(message, localEntityId, buffer, destinationBuffer) {
|
|
24
|
+
const offset = buffer.currentWriteOffset();
|
|
25
|
+
if (message.type === types_1.CrdtMessageType.PUT_COMPONENT_NETWORK) {
|
|
26
|
+
putComponent_1.PutComponentOperation.write(localEntityId, message.timestamp, message.componentId, message.data, buffer);
|
|
27
|
+
}
|
|
28
|
+
else if (message.type === types_1.CrdtMessageType.DELETE_COMPONENT_NETWORK) {
|
|
29
|
+
deleteComponent_1.DeleteComponent.write(localEntityId, message.componentId, message.timestamp, buffer);
|
|
30
|
+
}
|
|
31
|
+
else if (message.type === types_1.CrdtMessageType.DELETE_ENTITY_NETWORK) {
|
|
32
|
+
deleteEntity_1.DeleteEntity.write(localEntityId, buffer);
|
|
33
|
+
}
|
|
34
|
+
destinationBuffer.writeBuffer(buffer.buffer().subarray(offset, buffer.currentWriteOffset()), false);
|
|
35
|
+
}
|
|
36
|
+
exports.networkMessageToLocal = networkMessageToLocal;
|
|
37
|
+
/* istanbul ignore next */
|
|
38
|
+
function localMessageToNetwork(message, network, buffer, destinationBuffer) {
|
|
39
|
+
const offset = buffer.currentWriteOffset();
|
|
40
|
+
if (message.type === types_1.CrdtMessageType.PUT_COMPONENT) {
|
|
41
|
+
putComponentNetwork_1.PutNetworkComponentOperation.write(network.entityId, message.timestamp, message.componentId, network.networkId, message.data, buffer);
|
|
42
|
+
}
|
|
43
|
+
else if (message.type === types_1.CrdtMessageType.DELETE_COMPONENT) {
|
|
44
|
+
deleteComponentNetwork_1.DeleteComponentNetwork.write(network.entityId, message.componentId, message.timestamp, network.networkId, buffer);
|
|
45
|
+
}
|
|
46
|
+
else if (message.type === types_1.CrdtMessageType.DELETE_ENTITY) {
|
|
47
|
+
deleteEntityNetwork_1.DeleteEntityNetwork.write(network.entityId, network.networkId, buffer);
|
|
48
|
+
}
|
|
49
|
+
destinationBuffer.writeBuffer(buffer.buffer().subarray(offset, buffer.currentWriteOffset()), false);
|
|
50
|
+
}
|
|
51
|
+
exports.localMessageToNetwork = localMessageToNetwork;
|
|
52
|
+
const buffer = new ByteBuffer_1.ReadWriteByteBuffer();
|
|
53
|
+
/* istanbul ignore next */
|
|
54
|
+
function fixTransformParent(message, transformValue, parent) {
|
|
55
|
+
buffer.resetBuffer();
|
|
56
|
+
let transform = transformValue;
|
|
57
|
+
if (!transform && 'data' in message) {
|
|
58
|
+
transform = Transform_1.TransformSchema.deserialize(new ByteBuffer_1.ReadWriteByteBuffer(message.data));
|
|
59
|
+
}
|
|
60
|
+
if (!transform)
|
|
61
|
+
throw new Error('Invalid parent transform');
|
|
62
|
+
// Generate new transform raw data with the parent
|
|
63
|
+
const newTransform = { ...transform, parent };
|
|
64
|
+
Transform_1.TransformSchema.serialize(newTransform, buffer);
|
|
65
|
+
return buffer.toBinary();
|
|
66
|
+
}
|
|
67
|
+
exports.fixTransformParent = fixTransformParent;
|
|
@@ -11,8 +11,7 @@ export declare enum CrdtMessageType {
|
|
|
11
11
|
PUT_COMPONENT_NETWORK = 5,
|
|
12
12
|
DELETE_COMPONENT_NETWORK = 6,
|
|
13
13
|
DELETE_ENTITY_NETWORK = 7,
|
|
14
|
-
|
|
15
|
-
MAX_MESSAGE_TYPE = 9
|
|
14
|
+
MAX_MESSAGE_TYPE = 8
|
|
16
15
|
}
|
|
17
16
|
/**
|
|
18
17
|
* Min length = 8 bytes
|
|
@@ -49,23 +48,6 @@ export type PutNetworkComponentMessageBody = Omit<PutComponentMessageBody, 'type
|
|
|
49
48
|
type: CrdtMessageType.PUT_COMPONENT_NETWORK;
|
|
50
49
|
networkId: number;
|
|
51
50
|
};
|
|
52
|
-
/**
|
|
53
|
-
* Server authoritative message - identical to PutComponentMessageBody but with forced processing
|
|
54
|
-
* Min. length = header (8 bytes) + 16 bytes = 24 bytes
|
|
55
|
-
*
|
|
56
|
-
* @param entity - Uint32 number of the entity
|
|
57
|
-
* @param componentId - Uint32 number of id
|
|
58
|
-
* @param timestamp - Uint32 Lamport timestamp (server's authoritative timestamp)
|
|
59
|
-
* @param data - Uint8[] data of component => length(4 bytes) + block of bytes[0..length-1]
|
|
60
|
-
* @public
|
|
61
|
-
*/
|
|
62
|
-
export type AuthoritativePutComponentMessageBody = {
|
|
63
|
-
type: CrdtMessageType.AUTHORITATIVE_PUT_COMPONENT;
|
|
64
|
-
entityId: Entity;
|
|
65
|
-
componentId: number;
|
|
66
|
-
timestamp: number;
|
|
67
|
-
data: Uint8Array;
|
|
68
|
-
};
|
|
69
51
|
/**
|
|
70
52
|
* Min. length = header (8 bytes) + 16 bytes = 24 bytes
|
|
71
53
|
*
|
|
@@ -132,10 +114,6 @@ export type AppendValueMessage = CrdtMessageHeader & AppendValueMessageBody;
|
|
|
132
114
|
* @public
|
|
133
115
|
*/
|
|
134
116
|
export type PutComponentMessage = CrdtMessageHeader & PutComponentMessageBody;
|
|
135
|
-
/**
|
|
136
|
-
* @public
|
|
137
|
-
*/
|
|
138
|
-
export type AuthoritativePutComponentMessage = CrdtMessageHeader & AuthoritativePutComponentMessageBody;
|
|
139
117
|
/**
|
|
140
118
|
* @public
|
|
141
119
|
*/
|
|
@@ -159,7 +137,7 @@ export type DeleteEntityNetworkMessage = CrdtMessageHeader & DeleteEntityNetwork
|
|
|
159
137
|
/**
|
|
160
138
|
* @public
|
|
161
139
|
*/
|
|
162
|
-
export type CrdtMessage = PutComponentMessage |
|
|
140
|
+
export type CrdtMessage = PutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
|
|
163
141
|
/**
|
|
164
142
|
* @public
|
|
165
143
|
*/
|
|
@@ -167,7 +145,7 @@ export type CrdtNetworkMessageBody = PutNetworkComponentMessageBody | DeleteComp
|
|
|
167
145
|
/**
|
|
168
146
|
* @public
|
|
169
147
|
*/
|
|
170
|
-
export type CrdtMessageBody = PutComponentMessageBody |
|
|
148
|
+
export type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
|
|
171
149
|
export declare enum ProcessMessageResultType {
|
|
172
150
|
/**
|
|
173
151
|
* Typical message and new state set.
|
|
@@ -16,9 +16,7 @@ var CrdtMessageType;
|
|
|
16
16
|
CrdtMessageType[CrdtMessageType["PUT_COMPONENT_NETWORK"] = 5] = "PUT_COMPONENT_NETWORK";
|
|
17
17
|
CrdtMessageType[CrdtMessageType["DELETE_COMPONENT_NETWORK"] = 6] = "DELETE_COMPONENT_NETWORK";
|
|
18
18
|
CrdtMessageType[CrdtMessageType["DELETE_ENTITY_NETWORK"] = 7] = "DELETE_ENTITY_NETWORK";
|
|
19
|
-
|
|
20
|
-
CrdtMessageType[CrdtMessageType["AUTHORITATIVE_PUT_COMPONENT"] = 8] = "AUTHORITATIVE_PUT_COMPONENT";
|
|
21
|
-
CrdtMessageType[CrdtMessageType["MAX_MESSAGE_TYPE"] = 9] = "MAX_MESSAGE_TYPE";
|
|
19
|
+
CrdtMessageType[CrdtMessageType["MAX_MESSAGE_TYPE"] = 8] = "MAX_MESSAGE_TYPE";
|
|
22
20
|
})(CrdtMessageType = exports.CrdtMessageType || (exports.CrdtMessageType = {}));
|
|
23
21
|
/**
|
|
24
22
|
* @public
|