@dcl/playground-assets 7.26.0 → 7.26.1-31714079767.commit-96e9a29

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 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
@@ -417,6 +453,22 @@ export declare interface BaseComponent<T> {
417
453
  * If the value is undefined, the component was deleted.
418
454
  */
419
455
  onChange(entity: Entity, cb: (value: T | undefined) => void): void;
456
+ /**
457
+ * @public
458
+ *
459
+ */
460
+ validateBeforeChange(entity: Entity, cb: ValidateCallback<T>): void;
461
+ validateBeforeChange(cb: ValidateCallback<T>): void;
462
+ /**
463
+ * Get the CRDT state for an entity (serialized data and timestamp)
464
+ * @param entity - Entity to get the CRDT state for
465
+ * @returns Object with serialized data and timestamp, or null if entity doesn't have the component
466
+ * @public
467
+ */
468
+ getCrdtState(entity: Entity): {
469
+ data: Uint8Array;
470
+ timestamp: number;
471
+ } | null;
420
472
  }
421
473
 
422
474
  /** @public */
@@ -1658,12 +1710,12 @@ export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
1658
1710
  /**
1659
1711
  * @public
1660
1712
  */
1661
- export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1713
+ export declare type CrdtMessage = PutComponentMessage | AuthoritativePutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1662
1714
 
1663
1715
  /**
1664
1716
  * @public
1665
1717
  */
1666
- export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1718
+ export declare type CrdtMessageBody = PutComponentMessageBody | AuthoritativePutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1667
1719
 
1668
1720
  /**
1669
1721
  * Min length = 8 bytes
@@ -1718,7 +1770,8 @@ export declare enum CrdtMessageType {
1718
1770
  PUT_COMPONENT_NETWORK = 5,
1719
1771
  DELETE_COMPONENT_NETWORK = 6,
1720
1772
  DELETE_ENTITY_NETWORK = 7,
1721
- MAX_MESSAGE_TYPE = 8
1773
+ AUTHORITATIVE_PUT_COMPONENT = 8,
1774
+ MAX_MESSAGE_TYPE = 9
1722
1775
  }
1723
1776
 
1724
1777
  /**
@@ -1726,6 +1779,8 @@ export declare enum CrdtMessageType {
1726
1779
  */
1727
1780
  export declare type CrdtNetworkMessageBody = PutNetworkComponentMessageBody | DeleteComponentNetworkMessageBody | DeleteEntityNetworkMessageBody;
1728
1781
 
1782
+ export declare const CreatedBy: ICreatedBy;
1783
+
1729
1784
  /**
1730
1785
  * @public
1731
1786
  */
@@ -2495,6 +2550,12 @@ export declare interface GrowOnlyValueSetComponentDefinition<T> extends BaseComp
2495
2550
 
2496
2551
  export declare type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
2497
2552
 
2553
+ export declare type ICreatedBy = LastWriteWinElementSetComponentDefinition<ICreatedByType>;
2554
+
2555
+ export declare interface ICreatedByType {
2556
+ address: string;
2557
+ }
2558
+
2498
2559
  /**
2499
2560
  * @public
2500
2561
  */
@@ -2970,6 +3031,35 @@ export declare const enum InteractionType {
2970
3031
  PROXIMITY = 1
2971
3032
  }
2972
3033
 
3034
+ /**
3035
+ * Internal component interface that exposes all internal methods for SDK use
3036
+ * This is not exposed to users, only for internal SDK operations
3037
+ */
3038
+ export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
3039
+ /**
3040
+ * @public
3041
+ * Dry run update to check if a CRDT message would be accepted without actually applying it
3042
+ */
3043
+ __dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
3044
+ /**
3045
+ * @public
3046
+ * Get the iterator to every entity has the component
3047
+ */
3048
+ iterator(): Iterable<[Entity, any]>;
3049
+ /**
3050
+ * @public
3051
+ */
3052
+ dirtyIterator(): Iterable<Entity>;
3053
+ /**
3054
+ * @public
3055
+ */
3056
+ __onChangeCallbacks(entity: Entity, value: T): void;
3057
+ /**
3058
+ * @public
3059
+ */
3060
+ __run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
3061
+ }
3062
+
2973
3063
  /**
2974
3064
  * @public
2975
3065
  */
@@ -9949,6 +10039,14 @@ export declare interface UiTransformProps {
9949
10039
  */
9950
10040
  export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
9951
10041
 
10042
+ export declare type ValidateCallback<T> = (value: {
10043
+ entity: Entity;
10044
+ currentValue: T | undefined;
10045
+ newValue: T | undefined;
10046
+ senderAddress: string;
10047
+ createdBy: string;
10048
+ }) => boolean;
10049
+
9952
10050
  /**
9953
10051
  * @public
9954
10052
  */
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
@@ -417,6 +453,22 @@ export declare interface BaseComponent<T> {
417
453
  * If the value is undefined, the component was deleted.
418
454
  */
419
455
  onChange(entity: Entity, cb: (value: T | undefined) => void): void;
456
+ /**
457
+ * @public
458
+ *
459
+ */
460
+ validateBeforeChange(entity: Entity, cb: ValidateCallback<T>): void;
461
+ validateBeforeChange(cb: ValidateCallback<T>): void;
462
+ /**
463
+ * Get the CRDT state for an entity (serialized data and timestamp)
464
+ * @param entity - Entity to get the CRDT state for
465
+ * @returns Object with serialized data and timestamp, or null if entity doesn't have the component
466
+ * @public
467
+ */
468
+ getCrdtState(entity: Entity): {
469
+ data: Uint8Array;
470
+ timestamp: number;
471
+ } | null;
420
472
  }
421
473
 
422
474
  /** @public */
@@ -1658,12 +1710,12 @@ export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
1658
1710
  /**
1659
1711
  * @public
1660
1712
  */
1661
- export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1713
+ export declare type CrdtMessage = PutComponentMessage | AuthoritativePutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1662
1714
 
1663
1715
  /**
1664
1716
  * @public
1665
1717
  */
1666
- export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1718
+ export declare type CrdtMessageBody = PutComponentMessageBody | AuthoritativePutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1667
1719
 
1668
1720
  /**
1669
1721
  * Min length = 8 bytes
@@ -1718,7 +1770,8 @@ export declare enum CrdtMessageType {
1718
1770
  PUT_COMPONENT_NETWORK = 5,
1719
1771
  DELETE_COMPONENT_NETWORK = 6,
1720
1772
  DELETE_ENTITY_NETWORK = 7,
1721
- MAX_MESSAGE_TYPE = 8
1773
+ AUTHORITATIVE_PUT_COMPONENT = 8,
1774
+ MAX_MESSAGE_TYPE = 9
1722
1775
  }
1723
1776
 
1724
1777
  /**
@@ -1726,6 +1779,8 @@ export declare enum CrdtMessageType {
1726
1779
  */
1727
1780
  export declare type CrdtNetworkMessageBody = PutNetworkComponentMessageBody | DeleteComponentNetworkMessageBody | DeleteEntityNetworkMessageBody;
1728
1781
 
1782
+ export declare const CreatedBy: ICreatedBy;
1783
+
1729
1784
  /**
1730
1785
  * @public
1731
1786
  */
@@ -2495,6 +2550,12 @@ export declare interface GrowOnlyValueSetComponentDefinition<T> extends BaseComp
2495
2550
 
2496
2551
  export declare type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
2497
2552
 
2553
+ export declare type ICreatedBy = LastWriteWinElementSetComponentDefinition<ICreatedByType>;
2554
+
2555
+ export declare interface ICreatedByType {
2556
+ address: string;
2557
+ }
2558
+
2498
2559
  /**
2499
2560
  * @public
2500
2561
  */
@@ -2961,6 +3022,35 @@ export declare const enum InteractionType {
2961
3022
  PROXIMITY = 1
2962
3023
  }
2963
3024
 
3025
+ /**
3026
+ * Internal component interface that exposes all internal methods for SDK use
3027
+ * This is not exposed to users, only for internal SDK operations
3028
+ */
3029
+ export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
3030
+ /**
3031
+ * @public
3032
+ * Dry run update to check if a CRDT message would be accepted without actually applying it
3033
+ */
3034
+ __dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
3035
+ /**
3036
+ * @public
3037
+ * Get the iterator to every entity has the component
3038
+ */
3039
+ iterator(): Iterable<[Entity, any]>;
3040
+ /**
3041
+ * @public
3042
+ */
3043
+ dirtyIterator(): Iterable<Entity>;
3044
+ /**
3045
+ * @public
3046
+ */
3047
+ __onChangeCallbacks(entity: Entity, value: T): void;
3048
+ /**
3049
+ * @public
3050
+ */
3051
+ __run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
3052
+ }
3053
+
2964
3054
  /**
2965
3055
  * @public
2966
3056
  */
@@ -9916,6 +10006,14 @@ export declare interface UiTransformProps {
9916
10006
  */
9917
10007
  export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
9918
10008
 
10009
+ export declare type ValidateCallback<T> = (value: {
10010
+ entity: Entity;
10011
+ currentValue: T | undefined;
10012
+ newValue: T | undefined;
10013
+ senderAddress: string;
10014
+ createdBy: string;
10015
+ }) => boolean;
10016
+
9919
10017
  /**
9920
10018
  * @public
9921
10019
  */
@@ -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
@@ -417,6 +453,22 @@ export declare interface BaseComponent<T> {
417
453
  * If the value is undefined, the component was deleted.
418
454
  */
419
455
  onChange(entity: Entity, cb: (value: T | undefined) => void): void;
456
+ /**
457
+ * @public
458
+ *
459
+ */
460
+ validateBeforeChange(entity: Entity, cb: ValidateCallback<T>): void;
461
+ validateBeforeChange(cb: ValidateCallback<T>): void;
462
+ /**
463
+ * Get the CRDT state for an entity (serialized data and timestamp)
464
+ * @param entity - Entity to get the CRDT state for
465
+ * @returns Object with serialized data and timestamp, or null if entity doesn't have the component
466
+ * @public
467
+ */
468
+ getCrdtState(entity: Entity): {
469
+ data: Uint8Array;
470
+ timestamp: number;
471
+ } | null;
420
472
  }
421
473
 
422
474
  /** @public */
@@ -1658,12 +1710,12 @@ export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
1658
1710
  /**
1659
1711
  * @public
1660
1712
  */
1661
- export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1713
+ export declare type CrdtMessage = PutComponentMessage | AuthoritativePutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1662
1714
 
1663
1715
  /**
1664
1716
  * @public
1665
1717
  */
1666
- export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1718
+ export declare type CrdtMessageBody = PutComponentMessageBody | AuthoritativePutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1667
1719
 
1668
1720
  /**
1669
1721
  * Min length = 8 bytes
@@ -1718,7 +1770,8 @@ export declare enum CrdtMessageType {
1718
1770
  PUT_COMPONENT_NETWORK = 5,
1719
1771
  DELETE_COMPONENT_NETWORK = 6,
1720
1772
  DELETE_ENTITY_NETWORK = 7,
1721
- MAX_MESSAGE_TYPE = 8
1773
+ AUTHORITATIVE_PUT_COMPONENT = 8,
1774
+ MAX_MESSAGE_TYPE = 9
1722
1775
  }
1723
1776
 
1724
1777
  /**
@@ -1726,6 +1779,8 @@ export declare enum CrdtMessageType {
1726
1779
  */
1727
1780
  export declare type CrdtNetworkMessageBody = PutNetworkComponentMessageBody | DeleteComponentNetworkMessageBody | DeleteEntityNetworkMessageBody;
1728
1781
 
1782
+ export declare const CreatedBy: ICreatedBy;
1783
+
1729
1784
  /**
1730
1785
  * @public
1731
1786
  */
@@ -2495,6 +2550,12 @@ export declare interface GrowOnlyValueSetComponentDefinition<T> extends BaseComp
2495
2550
 
2496
2551
  export declare type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
2497
2552
 
2553
+ export declare type ICreatedBy = LastWriteWinElementSetComponentDefinition<ICreatedByType>;
2554
+
2555
+ export declare interface ICreatedByType {
2556
+ address: string;
2557
+ }
2558
+
2498
2559
  /**
2499
2560
  * @public
2500
2561
  */
@@ -2961,6 +3022,35 @@ export declare const enum InteractionType {
2961
3022
  PROXIMITY = 1
2962
3023
  }
2963
3024
 
3025
+ /**
3026
+ * Internal component interface that exposes all internal methods for SDK use
3027
+ * This is not exposed to users, only for internal SDK operations
3028
+ */
3029
+ export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
3030
+ /**
3031
+ * @public
3032
+ * Dry run update to check if a CRDT message would be accepted without actually applying it
3033
+ */
3034
+ __dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
3035
+ /**
3036
+ * @public
3037
+ * Get the iterator to every entity has the component
3038
+ */
3039
+ iterator(): Iterable<[Entity, any]>;
3040
+ /**
3041
+ * @public
3042
+ */
3043
+ dirtyIterator(): Iterable<Entity>;
3044
+ /**
3045
+ * @public
3046
+ */
3047
+ __onChangeCallbacks(entity: Entity, value: T): void;
3048
+ /**
3049
+ * @public
3050
+ */
3051
+ __run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
3052
+ }
3053
+
2964
3054
  /**
2965
3055
  * @public
2966
3056
  */
@@ -9916,6 +10006,14 @@ export declare interface UiTransformProps {
9916
10006
  */
9917
10007
  export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
9918
10008
 
10009
+ export declare type ValidateCallback<T> = (value: {
10010
+ entity: Entity;
10011
+ currentValue: T | undefined;
10012
+ newValue: T | undefined;
10013
+ senderAddress: string;
10014
+ createdBy: string;
10015
+ }) => boolean;
10016
+
9919
10017
  /**
9920
10018
  * @public
9921
10019
  */