@dcl/playground-assets 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/alpha.d.ts +162 -46
- package/dist/beta.d.ts +162 -46
- package/dist/index.bundled.d.ts +162 -46
- package/dist/index.js +995 -532
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/playground/sdk/dcl-sdk.package.json +2 -2
- package/dist/playground-assets.d.ts +162 -46
- package/etc/playground-assets.api.json +1608 -431
- package/etc/playground-assets.api.md +166 -46
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/sdk",
|
|
3
|
-
"version": "7.0.6-
|
|
3
|
+
"version": "7.0.6-3832097301.commit-4e46b20",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"typings": "./index.d.ts",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"displayName": "SDK",
|
|
37
37
|
"tsconfig": "./tsconfig.json"
|
|
38
38
|
},
|
|
39
|
-
"commit": "
|
|
39
|
+
"commit": "4e46b208355a0a0d340a899c44f98bebb94d0c8b"
|
|
40
40
|
}
|
|
@@ -202,10 +202,6 @@ export declare type ByteBuffer = {
|
|
|
202
202
|
* @returns The offset when this reserving starts.
|
|
203
203
|
*/
|
|
204
204
|
incrementWriteOffset(amount: number): number;
|
|
205
|
-
/**
|
|
206
|
-
* @returns The total number of bytes writen in the buffer.
|
|
207
|
-
*/
|
|
208
|
-
size(): number;
|
|
209
205
|
/**
|
|
210
206
|
* Take care using this function, if you modify the data after, the
|
|
211
207
|
* returned subarray will change too. If you'll modify the content of the
|
|
@@ -1057,6 +1053,57 @@ export declare type ComponentSchema<T extends [ComponentDefinition<any>, ...Comp
|
|
|
1057
1053
|
[K in keyof T]: T[K] extends ComponentDefinition<any> ? ReturnType<T[K]['getMutable']> : never;
|
|
1058
1054
|
};
|
|
1059
1055
|
|
|
1056
|
+
export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
|
|
1057
|
+
|
|
1058
|
+
export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | DeleteEntityMessage;
|
|
1059
|
+
|
|
1060
|
+
export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessage;
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* Min length = 8 bytes
|
|
1064
|
+
* All message length including
|
|
1065
|
+
* @param length - Uint32 the length of all message (including the header)
|
|
1066
|
+
* @param type - define the function which handles the data
|
|
1067
|
+
*/
|
|
1068
|
+
export declare type CrdtMessageHeader = {
|
|
1069
|
+
length: Uint32;
|
|
1070
|
+
type: Uint32;
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
export declare namespace CrdtMessageProtocol {
|
|
1074
|
+
/**
|
|
1075
|
+
* Validate if the message incoming is completed
|
|
1076
|
+
* @param buf - ByteBuffer
|
|
1077
|
+
*/
|
|
1078
|
+
export function validate(buf: ByteBuffer): boolean;
|
|
1079
|
+
/**
|
|
1080
|
+
* Get the current header, consuming the bytes involved.
|
|
1081
|
+
* @param buf - ByteBuffer
|
|
1082
|
+
* @returns header or null if there is no validated message
|
|
1083
|
+
*/
|
|
1084
|
+
export function readHeader(buf: ByteBuffer): CrdtMessageHeader | null;
|
|
1085
|
+
/**
|
|
1086
|
+
* Get the current header, without consuming the bytes involved.
|
|
1087
|
+
* @param buf - ByteBuffer
|
|
1088
|
+
* @returns header or null if there is no validated message
|
|
1089
|
+
*/
|
|
1090
|
+
export function getHeader(buf: ByteBuffer): CrdtMessageHeader | null;
|
|
1091
|
+
/**
|
|
1092
|
+
* Consume the incoming message without processing it.
|
|
1093
|
+
* @param buf - ByteBuffer
|
|
1094
|
+
* @returns true in case of success or false if there is no valid message.
|
|
1095
|
+
*/
|
|
1096
|
+
export function consumeMessage(buf: ByteBuffer): boolean;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
export declare enum CrdtMessageType {
|
|
1100
|
+
RESERVED = 0,
|
|
1101
|
+
PUT_COMPONENT = 1,
|
|
1102
|
+
DELETE_COMPONENT = 2,
|
|
1103
|
+
DELETE_ENTITY = 3,
|
|
1104
|
+
MAX_MESSAGE_TYPE = 4
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1060
1107
|
export declare function createEthereumProvider(): {
|
|
1061
1108
|
send(message: RPCSendableMessage, callback?: ((error: Error | null, result?: any) => void) | undefined): void;
|
|
1062
1109
|
sendAsync(message: RPCSendableMessage, callback: (error: Error | null, result?: any) => void): void;
|
|
@@ -1162,6 +1209,40 @@ export declare function defineComponent<T>(componentId: number, spec: ISchema<T>
|
|
|
1162
1209
|
*/
|
|
1163
1210
|
export declare const DEG2RAD: number;
|
|
1164
1211
|
|
|
1212
|
+
export declare namespace DeleteComponent {
|
|
1213
|
+
const MESSAGE_HEADER_LENGTH = 20;
|
|
1214
|
+
/**
|
|
1215
|
+
* Write DeleteComponent message
|
|
1216
|
+
*/
|
|
1217
|
+
export function write(entity: Entity, componentId: number, timestamp: number, buf: ByteBuffer): void;
|
|
1218
|
+
export function read(buf: ByteBuffer): DeleteComponentMessage | null;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
export declare type DeleteComponentMessage = CrdtMessageHeader & DeleteComponentMessageBody;
|
|
1222
|
+
|
|
1223
|
+
export declare type DeleteComponentMessageBody = {
|
|
1224
|
+
type: CrdtMessageType.DELETE_COMPONENT;
|
|
1225
|
+
entityId: Entity;
|
|
1226
|
+
componentId: number;
|
|
1227
|
+
timestamp: number;
|
|
1228
|
+
};
|
|
1229
|
+
|
|
1230
|
+
export declare namespace DeleteEntity {
|
|
1231
|
+
const MESSAGE_HEADER_LENGTH = 4;
|
|
1232
|
+
export function write(entity: Entity, buf: ByteBuffer): void;
|
|
1233
|
+
export function read(buf: ByteBuffer): DeleteEntityMessage | null;
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
export declare type DeleteEntityMessage = CrdtMessageHeader & DeleteEntityMessageBody;
|
|
1237
|
+
|
|
1238
|
+
/**
|
|
1239
|
+
* @param entity - Uint32 number of the entity
|
|
1240
|
+
*/
|
|
1241
|
+
export declare type DeleteEntityMessageBody = {
|
|
1242
|
+
type: CrdtMessageType.DELETE_ENTITY;
|
|
1243
|
+
entityId: Entity;
|
|
1244
|
+
};
|
|
1245
|
+
|
|
1165
1246
|
/**
|
|
1166
1247
|
* @public
|
|
1167
1248
|
*/
|
|
@@ -1195,7 +1276,7 @@ export declare type EngineEvent<T extends IEventNames = IEventNames, V = IEvents
|
|
|
1195
1276
|
* Convertion from its compound numbers to entity:
|
|
1196
1277
|
* entity = (entityNumber & MAX_U16) | ((entityVersion & MAX_U16) << 16)
|
|
1197
1278
|
*/
|
|
1198
|
-
export declare type Entity =
|
|
1279
|
+
export declare type Entity = number & {
|
|
1199
1280
|
__entity_type: '';
|
|
1200
1281
|
};
|
|
1201
1282
|
|
|
@@ -1209,14 +1290,16 @@ export declare type EntityComponents = {
|
|
|
1209
1290
|
onMouseUp: Callback;
|
|
1210
1291
|
};
|
|
1211
1292
|
|
|
1212
|
-
export declare function EntityContainer():
|
|
1293
|
+
export declare function EntityContainer(): EntityContainer;
|
|
1294
|
+
|
|
1295
|
+
export declare type EntityContainer = {
|
|
1213
1296
|
generateEntity(): Entity;
|
|
1214
1297
|
removeEntity(entity: Entity): boolean;
|
|
1215
|
-
|
|
1298
|
+
getEntityState(entity: Entity): EntityState;
|
|
1216
1299
|
getExistingEntities(): Set<Entity>;
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1300
|
+
releaseRemovedEntities(): Entity[];
|
|
1301
|
+
updateRemovedEntity(entity: Entity): boolean;
|
|
1302
|
+
updateUsedEntity(entity: Entity): boolean;
|
|
1220
1303
|
};
|
|
1221
1304
|
|
|
1222
1305
|
/**
|
|
@@ -1227,6 +1310,36 @@ export declare type EntityPropTypes = {
|
|
|
1227
1310
|
uiBackground?: UiBackgroundProps;
|
|
1228
1311
|
} & Listeners & Pick<CommonProps, 'key'>;
|
|
1229
1312
|
|
|
1313
|
+
/**
|
|
1314
|
+
* @public
|
|
1315
|
+
*/
|
|
1316
|
+
export declare enum EntityState {
|
|
1317
|
+
Unknown = 0,
|
|
1318
|
+
/**
|
|
1319
|
+
* The entity was generated and added to the usedEntities set
|
|
1320
|
+
*/
|
|
1321
|
+
UsedEntity = 1,
|
|
1322
|
+
/**
|
|
1323
|
+
* The entity was removed from current engine or remotely
|
|
1324
|
+
*/
|
|
1325
|
+
Removed = 2,
|
|
1326
|
+
/**
|
|
1327
|
+
* The entity is reserved number.
|
|
1328
|
+
*/
|
|
1329
|
+
Reserved = 3
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
export declare namespace EntityUtils {
|
|
1333
|
+
/**
|
|
1334
|
+
* @returns [entityNumber, entityVersion]
|
|
1335
|
+
*/
|
|
1336
|
+
export function fromEntityId(entityId: Entity): [number, number];
|
|
1337
|
+
/**
|
|
1338
|
+
* @returns compound number from entityNumber and entityVerison
|
|
1339
|
+
*/
|
|
1340
|
+
export function toEntityId(entityNumber: number, entityVersion: number): Entity;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1230
1343
|
/**
|
|
1231
1344
|
* Constant used to define the minimal number value in Babylon.js
|
|
1232
1345
|
* @public
|
|
@@ -1310,11 +1423,11 @@ export declare type IEngine = {
|
|
|
1310
1423
|
*/
|
|
1311
1424
|
removeEntityWithChildren(firstEntity: Entity): void;
|
|
1312
1425
|
/**
|
|
1313
|
-
* Check
|
|
1426
|
+
* Check the state of an entityin the engine
|
|
1314
1427
|
* @param entity - the entity to validate
|
|
1315
|
-
* @returns
|
|
1428
|
+
* @returns known enum value
|
|
1316
1429
|
*/
|
|
1317
|
-
|
|
1430
|
+
getEntityState(entity: Entity): EntityState;
|
|
1318
1431
|
/**
|
|
1319
1432
|
* Add the system to the engine. It will be called every tick updated.
|
|
1320
1433
|
* @param system - function that receives the delta time between last tick and current one.
|
|
@@ -1430,6 +1543,10 @@ export declare type IEngine = {
|
|
|
1430
1543
|
* @param transport - transport which changes its onmessage to process CRDT messages
|
|
1431
1544
|
*/
|
|
1432
1545
|
addTransport(transport: Transport): void;
|
|
1546
|
+
/**
|
|
1547
|
+
* Entity continaer
|
|
1548
|
+
*/
|
|
1549
|
+
entityContainer: EntityContainer;
|
|
1433
1550
|
/**
|
|
1434
1551
|
* Iterator of registered components
|
|
1435
1552
|
*/
|
|
@@ -2663,7 +2780,7 @@ export declare class ObserverEventState {
|
|
|
2663
2780
|
/**
|
|
2664
2781
|
* @public
|
|
2665
2782
|
*/
|
|
2666
|
-
export declare type OnChangeFunction = (entity: Entity,
|
|
2783
|
+
export declare type OnChangeFunction = (entity: Entity, operation: CrdtMessageType, component?: ComponentDefinition<any>) => void;
|
|
2667
2784
|
|
|
2668
2785
|
export declare const onCommsMessage: Observable<{
|
|
2669
2786
|
sender: string;
|
|
@@ -3770,6 +3887,34 @@ export declare type Position = {
|
|
|
3770
3887
|
|
|
3771
3888
|
export declare type PositionUnit = `${number}px` | `${number}%` | number;
|
|
3772
3889
|
|
|
3890
|
+
export declare type PutComponentMessage = CrdtMessageHeader & PutComponentMessageBody;
|
|
3891
|
+
|
|
3892
|
+
/**
|
|
3893
|
+
* Min. length = header (8 bytes) + 20 bytes = 28 bytes
|
|
3894
|
+
*
|
|
3895
|
+
* @param entity - Uint32 number of the entity
|
|
3896
|
+
* @param componentId - Uint32 number of id
|
|
3897
|
+
* @param timestamp - Uint64 Lamport timestamp
|
|
3898
|
+
* @param data - Uint8[] data of component => length(4 bytes) + block of bytes[0..length-1]
|
|
3899
|
+
*/
|
|
3900
|
+
export declare type PutComponentMessageBody = {
|
|
3901
|
+
type: CrdtMessageType.PUT_COMPONENT;
|
|
3902
|
+
entityId: Entity;
|
|
3903
|
+
componentId: number;
|
|
3904
|
+
timestamp: number;
|
|
3905
|
+
data: Uint8Array;
|
|
3906
|
+
};
|
|
3907
|
+
|
|
3908
|
+
export declare namespace PutComponentOperation {
|
|
3909
|
+
const MESSAGE_HEADER_LENGTH = 20;
|
|
3910
|
+
/**
|
|
3911
|
+
* Call this function for an optimal writing data passing the ByteBuffer
|
|
3912
|
+
* already allocated
|
|
3913
|
+
*/
|
|
3914
|
+
export function write(entity: Entity, timestamp: number, componentDefinition: ComponentDefinition<unknown>, buf: ByteBuffer): void;
|
|
3915
|
+
export function read(buf: ByteBuffer): PutComponentMessage | null;
|
|
3916
|
+
}
|
|
3917
|
+
|
|
3773
3918
|
/**
|
|
3774
3919
|
* @public
|
|
3775
3920
|
* Quaternion is a type and a namespace.
|
|
@@ -4098,13 +4243,8 @@ export declare type ReadonlyComponentSchema<T extends [ComponentDefinition<unkno
|
|
|
4098
4243
|
*/
|
|
4099
4244
|
export declare type ReadonlyPrimitive = number | string | number[] | string[] | boolean | boolean[];
|
|
4100
4245
|
|
|
4101
|
-
export declare type ReceiveMessage = {
|
|
4102
|
-
type: WireMessage.Enum;
|
|
4103
|
-
entity: Entity;
|
|
4104
|
-
componentId: number;
|
|
4105
|
-
timestamp: number;
|
|
4246
|
+
export declare type ReceiveMessage = CrdtMessageBody & {
|
|
4106
4247
|
transportId?: number;
|
|
4107
|
-
data?: Uint8Array;
|
|
4108
4248
|
messageBuffer: Uint8Array;
|
|
4109
4249
|
};
|
|
4110
4250
|
|
|
@@ -4553,6 +4693,8 @@ export declare type UiInputProps = PBUiInput & {
|
|
|
4553
4693
|
/** @public */
|
|
4554
4694
|
export declare const UiInputResult: ComponentDefinition<PBUiInputResult>;
|
|
4555
4695
|
|
|
4696
|
+
export declare type Uint32 = number;
|
|
4697
|
+
|
|
4556
4698
|
/**
|
|
4557
4699
|
* @public It only defines the type explicitly, no effects.
|
|
4558
4700
|
*/
|
|
@@ -5220,32 +5362,6 @@ export declare type Vector3Type = {
|
|
|
5220
5362
|
/** @public */
|
|
5221
5363
|
export declare const VisibilityComponent: ComponentDefinition<PBVisibilityComponent>;
|
|
5222
5364
|
|
|
5223
|
-
export declare namespace WireMessage {
|
|
5224
|
-
export type Uint32 = number;
|
|
5225
|
-
export enum Enum {
|
|
5226
|
-
RESERVED = 0,
|
|
5227
|
-
PUT_COMPONENT = 1,
|
|
5228
|
-
DELETE_COMPONENT = 2,
|
|
5229
|
-
MAX_MESSAGE_TYPE = 3
|
|
5230
|
-
}
|
|
5231
|
-
/**
|
|
5232
|
-
* @param length - Uint32 the length of all message (including the header)
|
|
5233
|
-
* @param type - define the function which handles the data
|
|
5234
|
-
*/
|
|
5235
|
-
export type Header = {
|
|
5236
|
-
length: Uint32;
|
|
5237
|
-
type: Uint32;
|
|
5238
|
-
};
|
|
5239
|
-
const HEADER_LENGTH = 8;
|
|
5240
|
-
/**
|
|
5241
|
-
* Validate if the message incoming is completed
|
|
5242
|
-
* @param buf - ByteBuffer
|
|
5243
|
-
*/
|
|
5244
|
-
export function validate(buf: ByteBuffer): boolean;
|
|
5245
|
-
export function readHeader(buf: ByteBuffer): Header | null;
|
|
5246
|
-
export function getType(component: ComponentDefinition<unknown>, entity: Entity): Enum;
|
|
5247
|
-
}
|
|
5248
|
-
|
|
5249
5365
|
export declare const enum YGAlign {
|
|
5250
5366
|
YGA_AUTO = 0,
|
|
5251
5367
|
YGA_FLEX_START = 1,
|