@dcl/playground-assets 7.28.1-34907286167.commit-d2f06b5 → 7.28.1-34955459026.commit-7db2d46
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 +111 -13
- package/dist/beta.d.ts +111 -13
- package/dist/index.bundled.d.ts +111 -13
- package/dist/index.js +7 -7
- package/dist/playground/sdk/dcl-sdk.package.json +2 -2
- package/dist/playground-assets.d.ts +111 -13
- package/etc/playground-assets.api.json +1002 -5
- package/etc/playground-assets.api.md +80 -4
- package/package.json +6 -5
package/dist/alpha.d.ts
CHANGED
|
@@ -245,6 +245,42 @@ export declare interface AudioStreamComponentDefinitionExtended extends LastWrit
|
|
|
245
245
|
getAudioState(entity: Entity): PBAudioEvent | undefined;
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
+
/**
|
|
249
|
+
* @public
|
|
250
|
+
*/
|
|
251
|
+
export declare type AuthoritativePutComponentMessage = CrdtMessageHeader & AuthoritativePutComponentMessageBody;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Server authoritative message - identical to PutComponentMessageBody but with forced processing
|
|
255
|
+
* Min. length = header (8 bytes) + 16 bytes = 24 bytes
|
|
256
|
+
*
|
|
257
|
+
* @param entity - Uint32 number of the entity
|
|
258
|
+
* @param componentId - Uint32 number of id
|
|
259
|
+
* @param timestamp - Uint32 Lamport timestamp (server's authoritative timestamp)
|
|
260
|
+
* @param data - Uint8[] data of component => length(4 bytes) + block of bytes[0..length-1]
|
|
261
|
+
* @public
|
|
262
|
+
*/
|
|
263
|
+
export declare type AuthoritativePutComponentMessageBody = {
|
|
264
|
+
type: CrdtMessageType.AUTHORITATIVE_PUT_COMPONENT;
|
|
265
|
+
entityId: Entity;
|
|
266
|
+
componentId: number;
|
|
267
|
+
timestamp: number;
|
|
268
|
+
data: Uint8Array;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* @public
|
|
273
|
+
*/
|
|
274
|
+
export declare namespace AuthoritativePutComponentOperation {
|
|
275
|
+
const MESSAGE_HEADER_LENGTH = 16;
|
|
276
|
+
/**
|
|
277
|
+
* Call this function for an optimal writing data passing the ByteBuffer
|
|
278
|
+
* already allocated
|
|
279
|
+
*/
|
|
280
|
+
export function write(entity: Entity, timestamp: number, componentId: number, data: Uint8Array, buf: ByteBuffer): void;
|
|
281
|
+
export function read(buf: ByteBuffer): AuthoritativePutComponentMessage | null;
|
|
282
|
+
}
|
|
283
|
+
|
|
248
284
|
/** AvatarAnchorPointType determines the part of the avatar's body that anchors the Entity. */
|
|
249
285
|
/**
|
|
250
286
|
* @public
|
|
@@ -420,6 +456,22 @@ export declare interface BaseComponent<T> {
|
|
|
420
456
|
* If the value is undefined, the component was deleted.
|
|
421
457
|
*/
|
|
422
458
|
onChange(entity: Entity, cb: (value: T | undefined) => void): void;
|
|
459
|
+
/**
|
|
460
|
+
* @public
|
|
461
|
+
*
|
|
462
|
+
*/
|
|
463
|
+
validateBeforeChange(entity: Entity, cb: ValidateCallback<T>): void;
|
|
464
|
+
validateBeforeChange(cb: ValidateCallback<T>): void;
|
|
465
|
+
/**
|
|
466
|
+
* Get the CRDT state for an entity (serialized data and timestamp)
|
|
467
|
+
* @param entity - Entity to get the CRDT state for
|
|
468
|
+
* @returns Object with serialized data and timestamp, or null if entity doesn't have the component
|
|
469
|
+
* @public
|
|
470
|
+
*/
|
|
471
|
+
getCrdtState(entity: Entity): {
|
|
472
|
+
data: Uint8Array;
|
|
473
|
+
timestamp: number;
|
|
474
|
+
} | null;
|
|
423
475
|
}
|
|
424
476
|
|
|
425
477
|
/** @public */
|
|
@@ -1662,12 +1714,12 @@ export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
|
|
|
1662
1714
|
/**
|
|
1663
1715
|
* @public
|
|
1664
1716
|
*/
|
|
1665
|
-
export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
|
|
1717
|
+
export declare type CrdtMessage = PutComponentMessage | AuthoritativePutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
|
|
1666
1718
|
|
|
1667
1719
|
/**
|
|
1668
1720
|
* @public
|
|
1669
1721
|
*/
|
|
1670
|
-
export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
|
|
1722
|
+
export declare type CrdtMessageBody = PutComponentMessageBody | AuthoritativePutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
|
|
1671
1723
|
|
|
1672
1724
|
/**
|
|
1673
1725
|
* Min length = 8 bytes
|
|
@@ -1722,7 +1774,8 @@ export declare enum CrdtMessageType {
|
|
|
1722
1774
|
PUT_COMPONENT_NETWORK = 5,
|
|
1723
1775
|
DELETE_COMPONENT_NETWORK = 6,
|
|
1724
1776
|
DELETE_ENTITY_NETWORK = 7,
|
|
1725
|
-
|
|
1777
|
+
AUTHORITATIVE_PUT_COMPONENT = 8,
|
|
1778
|
+
MAX_MESSAGE_TYPE = 9
|
|
1726
1779
|
}
|
|
1727
1780
|
|
|
1728
1781
|
/**
|
|
@@ -1730,6 +1783,8 @@ export declare enum CrdtMessageType {
|
|
|
1730
1783
|
*/
|
|
1731
1784
|
export declare type CrdtNetworkMessageBody = PutNetworkComponentMessageBody | DeleteComponentNetworkMessageBody | DeleteEntityNetworkMessageBody;
|
|
1732
1785
|
|
|
1786
|
+
export declare const CreatedBy: ICreatedBy;
|
|
1787
|
+
|
|
1733
1788
|
/**
|
|
1734
1789
|
* @public
|
|
1735
1790
|
*/
|
|
@@ -2501,6 +2556,12 @@ export declare interface GrowOnlyValueSetComponentDefinition<T> extends BaseComp
|
|
|
2501
2556
|
|
|
2502
2557
|
export declare type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
|
|
2503
2558
|
|
|
2559
|
+
export declare type ICreatedBy = LastWriteWinElementSetComponentDefinition<ICreatedByType>;
|
|
2560
|
+
|
|
2561
|
+
export declare interface ICreatedByType {
|
|
2562
|
+
address: string;
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2504
2565
|
/**
|
|
2505
2566
|
* @public
|
|
2506
2567
|
*/
|
|
@@ -2983,6 +3044,35 @@ export declare const enum InteractionType {
|
|
|
2983
3044
|
PROXIMITY = 1
|
|
2984
3045
|
}
|
|
2985
3046
|
|
|
3047
|
+
/**
|
|
3048
|
+
* Internal component interface that exposes all internal methods for SDK use
|
|
3049
|
+
* This is not exposed to users, only for internal SDK operations
|
|
3050
|
+
*/
|
|
3051
|
+
export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
|
|
3052
|
+
/**
|
|
3053
|
+
* @public
|
|
3054
|
+
* Dry run update to check if a CRDT message would be accepted without actually applying it
|
|
3055
|
+
*/
|
|
3056
|
+
__dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
|
|
3057
|
+
/**
|
|
3058
|
+
* @public
|
|
3059
|
+
* Get the iterator to every entity has the component
|
|
3060
|
+
*/
|
|
3061
|
+
iterator(): Iterable<[Entity, any]>;
|
|
3062
|
+
/**
|
|
3063
|
+
* @public
|
|
3064
|
+
*/
|
|
3065
|
+
dirtyIterator(): Iterable<Entity>;
|
|
3066
|
+
/**
|
|
3067
|
+
* @public
|
|
3068
|
+
*/
|
|
3069
|
+
__onChangeCallbacks(entity: Entity, value: T): void;
|
|
3070
|
+
/**
|
|
3071
|
+
* @public
|
|
3072
|
+
*/
|
|
3073
|
+
__run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
|
|
3074
|
+
}
|
|
3075
|
+
|
|
2986
3076
|
/**
|
|
2987
3077
|
* @public
|
|
2988
3078
|
*/
|
|
@@ -9443,6 +9533,16 @@ export declare type Transport = {
|
|
|
9443
9533
|
onmessage?(message: Uint8Array): void;
|
|
9444
9534
|
filter(message: Omit<TransportMessage, 'messageBuffer'>): boolean;
|
|
9445
9535
|
type?: string;
|
|
9536
|
+
/**
|
|
9537
|
+
* Whether this transport is allowed to mutate reserved-range entities
|
|
9538
|
+
* (root/player/camera + avatars, entity number below `RESERVED_STATIC_ENTITIES`).
|
|
9539
|
+
* Only the trusted host/renderer transport sets this. An inbound DELETE_ENTITY
|
|
9540
|
+
* or component operation (PUT_COMPONENT, DELETE_COMPONENT, APPEND_VALUE,
|
|
9541
|
+
* AUTHORITATIVE_PUT_COMPONENT) on a reserved entity from a transport without
|
|
9542
|
+
* this flag (a comms peer, or any scene-added transport) is rejected — see
|
|
9543
|
+
* `receiveMessages`.
|
|
9544
|
+
*/
|
|
9545
|
+
allowReservedEntities?: boolean;
|
|
9446
9546
|
};
|
|
9447
9547
|
|
|
9448
9548
|
/**
|
|
@@ -9890,16 +9990,6 @@ export declare type UiRendererOptions = {
|
|
|
9890
9990
|
* can use different insets simultaneously.
|
|
9891
9991
|
*/
|
|
9892
9992
|
screenInset?: UiScreenInset;
|
|
9893
|
-
/**
|
|
9894
|
-
* Stacking order of this renderer's UI relative to the other renderers (the main
|
|
9895
|
-
* one and every `addUiRenderer`). Higher values render in front. When omitted,
|
|
9896
|
-
* renderers stack in the order they first render, later ones on top; among those
|
|
9897
|
-
* first rendered in the same tick the main UI goes at the back.
|
|
9898
|
-
*
|
|
9899
|
-
* It is applied to the renderer's root container entity, so it only orders whole
|
|
9900
|
-
* renderers against each other; elements inside a renderer keep their own `zIndex`.
|
|
9901
|
-
*/
|
|
9902
|
-
zIndex?: number;
|
|
9903
9993
|
};
|
|
9904
9994
|
|
|
9905
9995
|
/**
|
|
@@ -10021,6 +10111,14 @@ export declare interface UiTransformProps {
|
|
|
10021
10111
|
*/
|
|
10022
10112
|
export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
|
|
10023
10113
|
|
|
10114
|
+
export declare type ValidateCallback<T> = (value: {
|
|
10115
|
+
entity: Entity;
|
|
10116
|
+
currentValue: T | undefined;
|
|
10117
|
+
newValue: T | undefined;
|
|
10118
|
+
senderAddress: string;
|
|
10119
|
+
createdBy: string;
|
|
10120
|
+
}) => boolean;
|
|
10121
|
+
|
|
10024
10122
|
/**
|
|
10025
10123
|
* @public
|
|
10026
10124
|
*/
|
package/dist/beta.d.ts
CHANGED
|
@@ -245,6 +245,42 @@ export declare interface AudioStreamComponentDefinitionExtended extends LastWrit
|
|
|
245
245
|
getAudioState(entity: Entity): PBAudioEvent | undefined;
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
+
/**
|
|
249
|
+
* @public
|
|
250
|
+
*/
|
|
251
|
+
export declare type AuthoritativePutComponentMessage = CrdtMessageHeader & AuthoritativePutComponentMessageBody;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Server authoritative message - identical to PutComponentMessageBody but with forced processing
|
|
255
|
+
* Min. length = header (8 bytes) + 16 bytes = 24 bytes
|
|
256
|
+
*
|
|
257
|
+
* @param entity - Uint32 number of the entity
|
|
258
|
+
* @param componentId - Uint32 number of id
|
|
259
|
+
* @param timestamp - Uint32 Lamport timestamp (server's authoritative timestamp)
|
|
260
|
+
* @param data - Uint8[] data of component => length(4 bytes) + block of bytes[0..length-1]
|
|
261
|
+
* @public
|
|
262
|
+
*/
|
|
263
|
+
export declare type AuthoritativePutComponentMessageBody = {
|
|
264
|
+
type: CrdtMessageType.AUTHORITATIVE_PUT_COMPONENT;
|
|
265
|
+
entityId: Entity;
|
|
266
|
+
componentId: number;
|
|
267
|
+
timestamp: number;
|
|
268
|
+
data: Uint8Array;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* @public
|
|
273
|
+
*/
|
|
274
|
+
export declare namespace AuthoritativePutComponentOperation {
|
|
275
|
+
const MESSAGE_HEADER_LENGTH = 16;
|
|
276
|
+
/**
|
|
277
|
+
* Call this function for an optimal writing data passing the ByteBuffer
|
|
278
|
+
* already allocated
|
|
279
|
+
*/
|
|
280
|
+
export function write(entity: Entity, timestamp: number, componentId: number, data: Uint8Array, buf: ByteBuffer): void;
|
|
281
|
+
export function read(buf: ByteBuffer): AuthoritativePutComponentMessage | null;
|
|
282
|
+
}
|
|
283
|
+
|
|
248
284
|
/** AvatarAnchorPointType determines the part of the avatar's body that anchors the Entity. */
|
|
249
285
|
/**
|
|
250
286
|
* @public
|
|
@@ -420,6 +456,22 @@ export declare interface BaseComponent<T> {
|
|
|
420
456
|
* If the value is undefined, the component was deleted.
|
|
421
457
|
*/
|
|
422
458
|
onChange(entity: Entity, cb: (value: T | undefined) => void): void;
|
|
459
|
+
/**
|
|
460
|
+
* @public
|
|
461
|
+
*
|
|
462
|
+
*/
|
|
463
|
+
validateBeforeChange(entity: Entity, cb: ValidateCallback<T>): void;
|
|
464
|
+
validateBeforeChange(cb: ValidateCallback<T>): void;
|
|
465
|
+
/**
|
|
466
|
+
* Get the CRDT state for an entity (serialized data and timestamp)
|
|
467
|
+
* @param entity - Entity to get the CRDT state for
|
|
468
|
+
* @returns Object with serialized data and timestamp, or null if entity doesn't have the component
|
|
469
|
+
* @public
|
|
470
|
+
*/
|
|
471
|
+
getCrdtState(entity: Entity): {
|
|
472
|
+
data: Uint8Array;
|
|
473
|
+
timestamp: number;
|
|
474
|
+
} | null;
|
|
423
475
|
}
|
|
424
476
|
|
|
425
477
|
/** @public */
|
|
@@ -1662,12 +1714,12 @@ export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
|
|
|
1662
1714
|
/**
|
|
1663
1715
|
* @public
|
|
1664
1716
|
*/
|
|
1665
|
-
export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
|
|
1717
|
+
export declare type CrdtMessage = PutComponentMessage | AuthoritativePutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
|
|
1666
1718
|
|
|
1667
1719
|
/**
|
|
1668
1720
|
* @public
|
|
1669
1721
|
*/
|
|
1670
|
-
export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
|
|
1722
|
+
export declare type CrdtMessageBody = PutComponentMessageBody | AuthoritativePutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
|
|
1671
1723
|
|
|
1672
1724
|
/**
|
|
1673
1725
|
* Min length = 8 bytes
|
|
@@ -1722,7 +1774,8 @@ export declare enum CrdtMessageType {
|
|
|
1722
1774
|
PUT_COMPONENT_NETWORK = 5,
|
|
1723
1775
|
DELETE_COMPONENT_NETWORK = 6,
|
|
1724
1776
|
DELETE_ENTITY_NETWORK = 7,
|
|
1725
|
-
|
|
1777
|
+
AUTHORITATIVE_PUT_COMPONENT = 8,
|
|
1778
|
+
MAX_MESSAGE_TYPE = 9
|
|
1726
1779
|
}
|
|
1727
1780
|
|
|
1728
1781
|
/**
|
|
@@ -1730,6 +1783,8 @@ export declare enum CrdtMessageType {
|
|
|
1730
1783
|
*/
|
|
1731
1784
|
export declare type CrdtNetworkMessageBody = PutNetworkComponentMessageBody | DeleteComponentNetworkMessageBody | DeleteEntityNetworkMessageBody;
|
|
1732
1785
|
|
|
1786
|
+
export declare const CreatedBy: ICreatedBy;
|
|
1787
|
+
|
|
1733
1788
|
/**
|
|
1734
1789
|
* @public
|
|
1735
1790
|
*/
|
|
@@ -2501,6 +2556,12 @@ export declare interface GrowOnlyValueSetComponentDefinition<T> extends BaseComp
|
|
|
2501
2556
|
|
|
2502
2557
|
export declare type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
|
|
2503
2558
|
|
|
2559
|
+
export declare type ICreatedBy = LastWriteWinElementSetComponentDefinition<ICreatedByType>;
|
|
2560
|
+
|
|
2561
|
+
export declare interface ICreatedByType {
|
|
2562
|
+
address: string;
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2504
2565
|
/**
|
|
2505
2566
|
* @public
|
|
2506
2567
|
*/
|
|
@@ -2974,6 +3035,35 @@ export declare const enum InteractionType {
|
|
|
2974
3035
|
PROXIMITY = 1
|
|
2975
3036
|
}
|
|
2976
3037
|
|
|
3038
|
+
/**
|
|
3039
|
+
* Internal component interface that exposes all internal methods for SDK use
|
|
3040
|
+
* This is not exposed to users, only for internal SDK operations
|
|
3041
|
+
*/
|
|
3042
|
+
export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
|
|
3043
|
+
/**
|
|
3044
|
+
* @public
|
|
3045
|
+
* Dry run update to check if a CRDT message would be accepted without actually applying it
|
|
3046
|
+
*/
|
|
3047
|
+
__dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
|
|
3048
|
+
/**
|
|
3049
|
+
* @public
|
|
3050
|
+
* Get the iterator to every entity has the component
|
|
3051
|
+
*/
|
|
3052
|
+
iterator(): Iterable<[Entity, any]>;
|
|
3053
|
+
/**
|
|
3054
|
+
* @public
|
|
3055
|
+
*/
|
|
3056
|
+
dirtyIterator(): Iterable<Entity>;
|
|
3057
|
+
/**
|
|
3058
|
+
* @public
|
|
3059
|
+
*/
|
|
3060
|
+
__onChangeCallbacks(entity: Entity, value: T): void;
|
|
3061
|
+
/**
|
|
3062
|
+
* @public
|
|
3063
|
+
*/
|
|
3064
|
+
__run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
|
|
3065
|
+
}
|
|
3066
|
+
|
|
2977
3067
|
/**
|
|
2978
3068
|
* @public
|
|
2979
3069
|
*/
|
|
@@ -9410,6 +9500,16 @@ export declare type Transport = {
|
|
|
9410
9500
|
onmessage?(message: Uint8Array): void;
|
|
9411
9501
|
filter(message: Omit<TransportMessage, 'messageBuffer'>): boolean;
|
|
9412
9502
|
type?: string;
|
|
9503
|
+
/**
|
|
9504
|
+
* Whether this transport is allowed to mutate reserved-range entities
|
|
9505
|
+
* (root/player/camera + avatars, entity number below `RESERVED_STATIC_ENTITIES`).
|
|
9506
|
+
* Only the trusted host/renderer transport sets this. An inbound DELETE_ENTITY
|
|
9507
|
+
* or component operation (PUT_COMPONENT, DELETE_COMPONENT, APPEND_VALUE,
|
|
9508
|
+
* AUTHORITATIVE_PUT_COMPONENT) on a reserved entity from a transport without
|
|
9509
|
+
* this flag (a comms peer, or any scene-added transport) is rejected — see
|
|
9510
|
+
* `receiveMessages`.
|
|
9511
|
+
*/
|
|
9512
|
+
allowReservedEntities?: boolean;
|
|
9413
9513
|
};
|
|
9414
9514
|
|
|
9415
9515
|
/**
|
|
@@ -9857,16 +9957,6 @@ export declare type UiRendererOptions = {
|
|
|
9857
9957
|
* can use different insets simultaneously.
|
|
9858
9958
|
*/
|
|
9859
9959
|
screenInset?: UiScreenInset;
|
|
9860
|
-
/**
|
|
9861
|
-
* Stacking order of this renderer's UI relative to the other renderers (the main
|
|
9862
|
-
* one and every `addUiRenderer`). Higher values render in front. When omitted,
|
|
9863
|
-
* renderers stack in the order they first render, later ones on top; among those
|
|
9864
|
-
* first rendered in the same tick the main UI goes at the back.
|
|
9865
|
-
*
|
|
9866
|
-
* It is applied to the renderer's root container entity, so it only orders whole
|
|
9867
|
-
* renderers against each other; elements inside a renderer keep their own `zIndex`.
|
|
9868
|
-
*/
|
|
9869
|
-
zIndex?: number;
|
|
9870
9960
|
};
|
|
9871
9961
|
|
|
9872
9962
|
/**
|
|
@@ -9988,6 +10078,14 @@ export declare interface UiTransformProps {
|
|
|
9988
10078
|
*/
|
|
9989
10079
|
export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
|
|
9990
10080
|
|
|
10081
|
+
export declare type ValidateCallback<T> = (value: {
|
|
10082
|
+
entity: Entity;
|
|
10083
|
+
currentValue: T | undefined;
|
|
10084
|
+
newValue: T | undefined;
|
|
10085
|
+
senderAddress: string;
|
|
10086
|
+
createdBy: string;
|
|
10087
|
+
}) => boolean;
|
|
10088
|
+
|
|
9991
10089
|
/**
|
|
9992
10090
|
* @public
|
|
9993
10091
|
*/
|
package/dist/index.bundled.d.ts
CHANGED
|
@@ -245,6 +245,42 @@ export declare interface AudioStreamComponentDefinitionExtended extends LastWrit
|
|
|
245
245
|
getAudioState(entity: Entity): PBAudioEvent | undefined;
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
+
/**
|
|
249
|
+
* @public
|
|
250
|
+
*/
|
|
251
|
+
export declare type AuthoritativePutComponentMessage = CrdtMessageHeader & AuthoritativePutComponentMessageBody;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Server authoritative message - identical to PutComponentMessageBody but with forced processing
|
|
255
|
+
* Min. length = header (8 bytes) + 16 bytes = 24 bytes
|
|
256
|
+
*
|
|
257
|
+
* @param entity - Uint32 number of the entity
|
|
258
|
+
* @param componentId - Uint32 number of id
|
|
259
|
+
* @param timestamp - Uint32 Lamport timestamp (server's authoritative timestamp)
|
|
260
|
+
* @param data - Uint8[] data of component => length(4 bytes) + block of bytes[0..length-1]
|
|
261
|
+
* @public
|
|
262
|
+
*/
|
|
263
|
+
export declare type AuthoritativePutComponentMessageBody = {
|
|
264
|
+
type: CrdtMessageType.AUTHORITATIVE_PUT_COMPONENT;
|
|
265
|
+
entityId: Entity;
|
|
266
|
+
componentId: number;
|
|
267
|
+
timestamp: number;
|
|
268
|
+
data: Uint8Array;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* @public
|
|
273
|
+
*/
|
|
274
|
+
export declare namespace AuthoritativePutComponentOperation {
|
|
275
|
+
const MESSAGE_HEADER_LENGTH = 16;
|
|
276
|
+
/**
|
|
277
|
+
* Call this function for an optimal writing data passing the ByteBuffer
|
|
278
|
+
* already allocated
|
|
279
|
+
*/
|
|
280
|
+
export function write(entity: Entity, timestamp: number, componentId: number, data: Uint8Array, buf: ByteBuffer): void;
|
|
281
|
+
export function read(buf: ByteBuffer): AuthoritativePutComponentMessage | null;
|
|
282
|
+
}
|
|
283
|
+
|
|
248
284
|
/** AvatarAnchorPointType determines the part of the avatar's body that anchors the Entity. */
|
|
249
285
|
/**
|
|
250
286
|
* @public
|
|
@@ -420,6 +456,22 @@ export declare interface BaseComponent<T> {
|
|
|
420
456
|
* If the value is undefined, the component was deleted.
|
|
421
457
|
*/
|
|
422
458
|
onChange(entity: Entity, cb: (value: T | undefined) => void): void;
|
|
459
|
+
/**
|
|
460
|
+
* @public
|
|
461
|
+
*
|
|
462
|
+
*/
|
|
463
|
+
validateBeforeChange(entity: Entity, cb: ValidateCallback<T>): void;
|
|
464
|
+
validateBeforeChange(cb: ValidateCallback<T>): void;
|
|
465
|
+
/**
|
|
466
|
+
* Get the CRDT state for an entity (serialized data and timestamp)
|
|
467
|
+
* @param entity - Entity to get the CRDT state for
|
|
468
|
+
* @returns Object with serialized data and timestamp, or null if entity doesn't have the component
|
|
469
|
+
* @public
|
|
470
|
+
*/
|
|
471
|
+
getCrdtState(entity: Entity): {
|
|
472
|
+
data: Uint8Array;
|
|
473
|
+
timestamp: number;
|
|
474
|
+
} | null;
|
|
423
475
|
}
|
|
424
476
|
|
|
425
477
|
/** @public */
|
|
@@ -1662,12 +1714,12 @@ export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
|
|
|
1662
1714
|
/**
|
|
1663
1715
|
* @public
|
|
1664
1716
|
*/
|
|
1665
|
-
export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
|
|
1717
|
+
export declare type CrdtMessage = PutComponentMessage | AuthoritativePutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
|
|
1666
1718
|
|
|
1667
1719
|
/**
|
|
1668
1720
|
* @public
|
|
1669
1721
|
*/
|
|
1670
|
-
export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
|
|
1722
|
+
export declare type CrdtMessageBody = PutComponentMessageBody | AuthoritativePutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
|
|
1671
1723
|
|
|
1672
1724
|
/**
|
|
1673
1725
|
* Min length = 8 bytes
|
|
@@ -1722,7 +1774,8 @@ export declare enum CrdtMessageType {
|
|
|
1722
1774
|
PUT_COMPONENT_NETWORK = 5,
|
|
1723
1775
|
DELETE_COMPONENT_NETWORK = 6,
|
|
1724
1776
|
DELETE_ENTITY_NETWORK = 7,
|
|
1725
|
-
|
|
1777
|
+
AUTHORITATIVE_PUT_COMPONENT = 8,
|
|
1778
|
+
MAX_MESSAGE_TYPE = 9
|
|
1726
1779
|
}
|
|
1727
1780
|
|
|
1728
1781
|
/**
|
|
@@ -1730,6 +1783,8 @@ export declare enum CrdtMessageType {
|
|
|
1730
1783
|
*/
|
|
1731
1784
|
export declare type CrdtNetworkMessageBody = PutNetworkComponentMessageBody | DeleteComponentNetworkMessageBody | DeleteEntityNetworkMessageBody;
|
|
1732
1785
|
|
|
1786
|
+
export declare const CreatedBy: ICreatedBy;
|
|
1787
|
+
|
|
1733
1788
|
/**
|
|
1734
1789
|
* @public
|
|
1735
1790
|
*/
|
|
@@ -2501,6 +2556,12 @@ export declare interface GrowOnlyValueSetComponentDefinition<T> extends BaseComp
|
|
|
2501
2556
|
|
|
2502
2557
|
export declare type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
|
|
2503
2558
|
|
|
2559
|
+
export declare type ICreatedBy = LastWriteWinElementSetComponentDefinition<ICreatedByType>;
|
|
2560
|
+
|
|
2561
|
+
export declare interface ICreatedByType {
|
|
2562
|
+
address: string;
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2504
2565
|
/**
|
|
2505
2566
|
* @public
|
|
2506
2567
|
*/
|
|
@@ -2974,6 +3035,35 @@ export declare const enum InteractionType {
|
|
|
2974
3035
|
PROXIMITY = 1
|
|
2975
3036
|
}
|
|
2976
3037
|
|
|
3038
|
+
/**
|
|
3039
|
+
* Internal component interface that exposes all internal methods for SDK use
|
|
3040
|
+
* This is not exposed to users, only for internal SDK operations
|
|
3041
|
+
*/
|
|
3042
|
+
export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
|
|
3043
|
+
/**
|
|
3044
|
+
* @public
|
|
3045
|
+
* Dry run update to check if a CRDT message would be accepted without actually applying it
|
|
3046
|
+
*/
|
|
3047
|
+
__dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
|
|
3048
|
+
/**
|
|
3049
|
+
* @public
|
|
3050
|
+
* Get the iterator to every entity has the component
|
|
3051
|
+
*/
|
|
3052
|
+
iterator(): Iterable<[Entity, any]>;
|
|
3053
|
+
/**
|
|
3054
|
+
* @public
|
|
3055
|
+
*/
|
|
3056
|
+
dirtyIterator(): Iterable<Entity>;
|
|
3057
|
+
/**
|
|
3058
|
+
* @public
|
|
3059
|
+
*/
|
|
3060
|
+
__onChangeCallbacks(entity: Entity, value: T): void;
|
|
3061
|
+
/**
|
|
3062
|
+
* @public
|
|
3063
|
+
*/
|
|
3064
|
+
__run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
|
|
3065
|
+
}
|
|
3066
|
+
|
|
2977
3067
|
/**
|
|
2978
3068
|
* @public
|
|
2979
3069
|
*/
|
|
@@ -9410,6 +9500,16 @@ export declare type Transport = {
|
|
|
9410
9500
|
onmessage?(message: Uint8Array): void;
|
|
9411
9501
|
filter(message: Omit<TransportMessage, 'messageBuffer'>): boolean;
|
|
9412
9502
|
type?: string;
|
|
9503
|
+
/**
|
|
9504
|
+
* Whether this transport is allowed to mutate reserved-range entities
|
|
9505
|
+
* (root/player/camera + avatars, entity number below `RESERVED_STATIC_ENTITIES`).
|
|
9506
|
+
* Only the trusted host/renderer transport sets this. An inbound DELETE_ENTITY
|
|
9507
|
+
* or component operation (PUT_COMPONENT, DELETE_COMPONENT, APPEND_VALUE,
|
|
9508
|
+
* AUTHORITATIVE_PUT_COMPONENT) on a reserved entity from a transport without
|
|
9509
|
+
* this flag (a comms peer, or any scene-added transport) is rejected — see
|
|
9510
|
+
* `receiveMessages`.
|
|
9511
|
+
*/
|
|
9512
|
+
allowReservedEntities?: boolean;
|
|
9413
9513
|
};
|
|
9414
9514
|
|
|
9415
9515
|
/**
|
|
@@ -9857,16 +9957,6 @@ export declare type UiRendererOptions = {
|
|
|
9857
9957
|
* can use different insets simultaneously.
|
|
9858
9958
|
*/
|
|
9859
9959
|
screenInset?: UiScreenInset;
|
|
9860
|
-
/**
|
|
9861
|
-
* Stacking order of this renderer's UI relative to the other renderers (the main
|
|
9862
|
-
* one and every `addUiRenderer`). Higher values render in front. When omitted,
|
|
9863
|
-
* renderers stack in the order they first render, later ones on top; among those
|
|
9864
|
-
* first rendered in the same tick the main UI goes at the back.
|
|
9865
|
-
*
|
|
9866
|
-
* It is applied to the renderer's root container entity, so it only orders whole
|
|
9867
|
-
* renderers against each other; elements inside a renderer keep their own `zIndex`.
|
|
9868
|
-
*/
|
|
9869
|
-
zIndex?: number;
|
|
9870
9960
|
};
|
|
9871
9961
|
|
|
9872
9962
|
/**
|
|
@@ -9988,6 +10078,14 @@ export declare interface UiTransformProps {
|
|
|
9988
10078
|
*/
|
|
9989
10079
|
export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
|
|
9990
10080
|
|
|
10081
|
+
export declare type ValidateCallback<T> = (value: {
|
|
10082
|
+
entity: Entity;
|
|
10083
|
+
currentValue: T | undefined;
|
|
10084
|
+
newValue: T | undefined;
|
|
10085
|
+
senderAddress: string;
|
|
10086
|
+
createdBy: string;
|
|
10087
|
+
}) => boolean;
|
|
10088
|
+
|
|
9991
10089
|
/**
|
|
9992
10090
|
* @public
|
|
9993
10091
|
*/
|