@dcl/ecs 7.0.6-3824930139.commit-9bd6c05 → 7.0.6-3832097301.commit-4e46b20
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/engine/component.js +3 -3
- package/dist/engine/entity.d.ts +35 -6
- package/dist/engine/entity.js +121 -32
- package/dist/engine/index.js +6 -9
- package/dist/engine/types.d.ts +8 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/runtime/types.d.ts +0 -1
- package/dist/serialization/ByteBuffer/index.d.ts +67 -31
- package/dist/serialization/ByteBuffer/index.js +217 -231
- package/dist/serialization/crdt/deleteComponent.d.ts +11 -0
- package/dist/serialization/crdt/deleteComponent.js +45 -0
- package/dist/serialization/crdt/deleteEntity.d.ts +8 -0
- package/dist/serialization/crdt/deleteEntity.js +28 -0
- package/dist/serialization/crdt/index.d.ts +32 -0
- package/dist/serialization/crdt/index.js +70 -0
- package/dist/serialization/crdt/message.d.ts +3 -0
- package/dist/serialization/crdt/message.js +17 -0
- package/dist/serialization/crdt/putComponent.d.ts +13 -0
- package/dist/serialization/crdt/putComponent.js +44 -0
- package/dist/serialization/crdt/types.d.ts +53 -0
- package/dist/serialization/crdt/types.js +10 -0
- package/dist/systems/crdt/index.d.ts +5 -5
- package/dist/systems/crdt/index.js +189 -80
- package/dist/systems/crdt/types.d.ts +2 -8
- package/dist/systems/events.js +2 -1
- package/package.json +3 -3
- package/dist/serialization/crdt/componentOperation.d.ts +0 -31
- package/dist/serialization/crdt/componentOperation.js +0 -47
- package/dist/serialization/wireMessage.d.ts +0 -41
- package/dist/serialization/wireMessage.js +0 -56
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The wire message is the top-level message that can be packed
|
|
3
|
-
* inside it can contain a data with another structure or protocol
|
|
4
|
-
*
|
|
5
|
-
* Each wire message has three primitive property that it'll never change
|
|
6
|
-
* ---> length uint32 (message size up to 4,294,967,295)
|
|
7
|
-
* ---> version uint32 (for now just a number which is zero)
|
|
8
|
-
* ---> message type uint32
|
|
9
|
-
* The length indicates how many bytes are above self, the version in
|
|
10
|
-
* combination with message type defines the set of handlers that will be
|
|
11
|
-
* available to process the message
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
import { ComponentDefinition, Entity } from '../engine';
|
|
15
|
-
import { ByteBuffer } from './ByteBuffer';
|
|
16
|
-
export declare namespace WireMessage {
|
|
17
|
-
type Uint32 = number;
|
|
18
|
-
enum Enum {
|
|
19
|
-
RESERVED = 0,
|
|
20
|
-
PUT_COMPONENT = 1,
|
|
21
|
-
DELETE_COMPONENT = 2,
|
|
22
|
-
MAX_MESSAGE_TYPE = 3
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* @param length - Uint32 the length of all message (including the header)
|
|
26
|
-
* @param type - define the function which handles the data
|
|
27
|
-
*/
|
|
28
|
-
type Header = {
|
|
29
|
-
length: Uint32;
|
|
30
|
-
type: Uint32;
|
|
31
|
-
};
|
|
32
|
-
const HEADER_LENGTH = 8;
|
|
33
|
-
/**
|
|
34
|
-
* Validate if the message incoming is completed
|
|
35
|
-
* @param buf - ByteBuffer
|
|
36
|
-
*/
|
|
37
|
-
function validate(buf: ByteBuffer): boolean;
|
|
38
|
-
function readHeader(buf: ByteBuffer): Header | null;
|
|
39
|
-
function getType(component: ComponentDefinition<unknown>, entity: Entity): Enum;
|
|
40
|
-
}
|
|
41
|
-
export default WireMessage;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The wire message is the top-level message that can be packed
|
|
3
|
-
* inside it can contain a data with another structure or protocol
|
|
4
|
-
*
|
|
5
|
-
* Each wire message has three primitive property that it'll never change
|
|
6
|
-
* ---> length uint32 (message size up to 4,294,967,295)
|
|
7
|
-
* ---> version uint32 (for now just a number which is zero)
|
|
8
|
-
* ---> message type uint32
|
|
9
|
-
* The length indicates how many bytes are above self, the version in
|
|
10
|
-
* combination with message type defines the set of handlers that will be
|
|
11
|
-
* available to process the message
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
export var WireMessage;
|
|
15
|
-
(function (WireMessage) {
|
|
16
|
-
let Enum;
|
|
17
|
-
(function (Enum) {
|
|
18
|
-
Enum[Enum["RESERVED"] = 0] = "RESERVED";
|
|
19
|
-
// Component Operation
|
|
20
|
-
Enum[Enum["PUT_COMPONENT"] = 1] = "PUT_COMPONENT";
|
|
21
|
-
Enum[Enum["DELETE_COMPONENT"] = 2] = "DELETE_COMPONENT";
|
|
22
|
-
Enum[Enum["MAX_MESSAGE_TYPE"] = 3] = "MAX_MESSAGE_TYPE";
|
|
23
|
-
})(Enum = WireMessage.Enum || (WireMessage.Enum = {}));
|
|
24
|
-
WireMessage.HEADER_LENGTH = 8;
|
|
25
|
-
/**
|
|
26
|
-
* Validate if the message incoming is completed
|
|
27
|
-
* @param buf - ByteBuffer
|
|
28
|
-
*/
|
|
29
|
-
function validate(buf) {
|
|
30
|
-
const rem = buf.remainingBytes();
|
|
31
|
-
if (rem < WireMessage.HEADER_LENGTH) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
const messageLength = buf.getUint32(buf.currentReadOffset());
|
|
35
|
-
if (rem < messageLength) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
WireMessage.validate = validate;
|
|
41
|
-
function readHeader(buf) {
|
|
42
|
-
if (!validate(buf)) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
length: buf.readUint32(),
|
|
47
|
-
type: buf.readUint32()
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
WireMessage.readHeader = readHeader;
|
|
51
|
-
function getType(component, entity) {
|
|
52
|
-
return component.has(entity) ? Enum.PUT_COMPONENT : Enum.DELETE_COMPONENT;
|
|
53
|
-
}
|
|
54
|
-
WireMessage.getType = getType;
|
|
55
|
-
})(WireMessage || (WireMessage = {}));
|
|
56
|
-
export default WireMessage;
|