@dcl/playground-assets 7.23.1-25397904513.commit-a5e9263 → 7.23.2-25521226778.commit-1828100

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
@@ -218,6 +218,42 @@ export declare interface AudioStreamComponentDefinitionExtended extends LastWrit
218
218
  getAudioState(entity: Entity): PBAudioEvent | undefined;
219
219
  }
220
220
 
221
+ /**
222
+ * @public
223
+ */
224
+ export declare type AuthoritativePutComponentMessage = CrdtMessageHeader & AuthoritativePutComponentMessageBody;
225
+
226
+ /**
227
+ * Server authoritative message - identical to PutComponentMessageBody but with forced processing
228
+ * Min. length = header (8 bytes) + 16 bytes = 24 bytes
229
+ *
230
+ * @param entity - Uint32 number of the entity
231
+ * @param componentId - Uint32 number of id
232
+ * @param timestamp - Uint32 Lamport timestamp (server's authoritative timestamp)
233
+ * @param data - Uint8[] data of component => length(4 bytes) + block of bytes[0..length-1]
234
+ * @public
235
+ */
236
+ export declare type AuthoritativePutComponentMessageBody = {
237
+ type: CrdtMessageType.AUTHORITATIVE_PUT_COMPONENT;
238
+ entityId: Entity;
239
+ componentId: number;
240
+ timestamp: number;
241
+ data: Uint8Array;
242
+ };
243
+
244
+ /**
245
+ * @public
246
+ */
247
+ export declare namespace AuthoritativePutComponentOperation {
248
+ const MESSAGE_HEADER_LENGTH = 16;
249
+ /**
250
+ * Call this function for an optimal writing data passing the ByteBuffer
251
+ * already allocated
252
+ */
253
+ export function write(entity: Entity, timestamp: number, componentId: number, data: Uint8Array, buf: ByteBuffer): void;
254
+ export function read(buf: ByteBuffer): AuthoritativePutComponentMessage | null;
255
+ }
256
+
221
257
  /** AvatarAnchorPointType determines the part of the avatar's body that anchors the Entity. */
222
258
  /**
223
259
  * @public
@@ -380,6 +416,22 @@ export declare interface BaseComponent<T> {
380
416
  * If the value is undefined, the component was deleted.
381
417
  */
382
418
  onChange(entity: Entity, cb: (value: T | undefined) => void): void;
419
+ /**
420
+ * @public
421
+ *
422
+ */
423
+ validateBeforeChange(entity: Entity, cb: ValidateCallback<T>): void;
424
+ validateBeforeChange(cb: ValidateCallback<T>): void;
425
+ /**
426
+ * Get the CRDT state for an entity (serialized data and timestamp)
427
+ * @param entity - Entity to get the CRDT state for
428
+ * @returns Object with serialized data and timestamp, or null if entity doesn't have the component
429
+ * @public
430
+ */
431
+ getCrdtState(entity: Entity): {
432
+ data: Uint8Array;
433
+ timestamp: number;
434
+ } | null;
383
435
  }
384
436
 
385
437
  /** @public */
@@ -1610,12 +1662,12 @@ export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
1610
1662
  /**
1611
1663
  * @public
1612
1664
  */
1613
- export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1665
+ export declare type CrdtMessage = PutComponentMessage | AuthoritativePutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1614
1666
 
1615
1667
  /**
1616
1668
  * @public
1617
1669
  */
1618
- export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1670
+ export declare type CrdtMessageBody = PutComponentMessageBody | AuthoritativePutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1619
1671
 
1620
1672
  /**
1621
1673
  * Min length = 8 bytes
@@ -1670,7 +1722,8 @@ export declare enum CrdtMessageType {
1670
1722
  PUT_COMPONENT_NETWORK = 5,
1671
1723
  DELETE_COMPONENT_NETWORK = 6,
1672
1724
  DELETE_ENTITY_NETWORK = 7,
1673
- MAX_MESSAGE_TYPE = 8
1725
+ AUTHORITATIVE_PUT_COMPONENT = 8,
1726
+ MAX_MESSAGE_TYPE = 9
1674
1727
  }
1675
1728
 
1676
1729
  /**
@@ -1678,6 +1731,8 @@ export declare enum CrdtMessageType {
1678
1731
  */
1679
1732
  export declare type CrdtNetworkMessageBody = PutNetworkComponentMessageBody | DeleteComponentNetworkMessageBody | DeleteEntityNetworkMessageBody;
1680
1733
 
1734
+ export declare const CreatedBy: ICreatedBy;
1735
+
1681
1736
  /**
1682
1737
  * @public
1683
1738
  */
@@ -2397,6 +2452,12 @@ export declare interface GrowOnlyValueSetComponentDefinition<T> extends BaseComp
2397
2452
 
2398
2453
  export declare type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
2399
2454
 
2455
+ export declare type ICreatedBy = LastWriteWinElementSetComponentDefinition<ICreatedByType>;
2456
+
2457
+ export declare interface ICreatedByType {
2458
+ address: string;
2459
+ }
2460
+
2400
2461
  /**
2401
2462
  * @public
2402
2463
  */
@@ -2850,6 +2911,35 @@ export declare const enum InteractionType {
2850
2911
  PROXIMITY = 1
2851
2912
  }
2852
2913
 
2914
+ /**
2915
+ * Internal component interface that exposes all internal methods for SDK use
2916
+ * This is not exposed to users, only for internal SDK operations
2917
+ */
2918
+ export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
2919
+ /**
2920
+ * @public
2921
+ * Dry run update to check if a CRDT message would be accepted without actually applying it
2922
+ */
2923
+ __dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
2924
+ /**
2925
+ * @public
2926
+ * Get the iterator to every entity has the component
2927
+ */
2928
+ iterator(): Iterable<[Entity, any]>;
2929
+ /**
2930
+ * @public
2931
+ */
2932
+ dirtyIterator(): Iterable<Entity>;
2933
+ /**
2934
+ * @public
2935
+ */
2936
+ __onChangeCallbacks(entity: Entity, value: T): void;
2937
+ /**
2938
+ * @public
2939
+ */
2940
+ __run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
2941
+ }
2942
+
2853
2943
  /**
2854
2944
  * @public
2855
2945
  */
@@ -9496,6 +9586,14 @@ export declare interface UiTransformProps {
9496
9586
  */
9497
9587
  export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
9498
9588
 
9589
+ export declare type ValidateCallback<T> = (value: {
9590
+ entity: Entity;
9591
+ currentValue: T | undefined;
9592
+ newValue: T | undefined;
9593
+ senderAddress: string;
9594
+ createdBy: string;
9595
+ }) => boolean;
9596
+
9499
9597
  /**
9500
9598
  * @public
9501
9599
  */
package/dist/beta.d.ts CHANGED
@@ -218,6 +218,42 @@ export declare interface AudioStreamComponentDefinitionExtended extends LastWrit
218
218
  getAudioState(entity: Entity): PBAudioEvent | undefined;
219
219
  }
220
220
 
221
+ /**
222
+ * @public
223
+ */
224
+ export declare type AuthoritativePutComponentMessage = CrdtMessageHeader & AuthoritativePutComponentMessageBody;
225
+
226
+ /**
227
+ * Server authoritative message - identical to PutComponentMessageBody but with forced processing
228
+ * Min. length = header (8 bytes) + 16 bytes = 24 bytes
229
+ *
230
+ * @param entity - Uint32 number of the entity
231
+ * @param componentId - Uint32 number of id
232
+ * @param timestamp - Uint32 Lamport timestamp (server's authoritative timestamp)
233
+ * @param data - Uint8[] data of component => length(4 bytes) + block of bytes[0..length-1]
234
+ * @public
235
+ */
236
+ export declare type AuthoritativePutComponentMessageBody = {
237
+ type: CrdtMessageType.AUTHORITATIVE_PUT_COMPONENT;
238
+ entityId: Entity;
239
+ componentId: number;
240
+ timestamp: number;
241
+ data: Uint8Array;
242
+ };
243
+
244
+ /**
245
+ * @public
246
+ */
247
+ export declare namespace AuthoritativePutComponentOperation {
248
+ const MESSAGE_HEADER_LENGTH = 16;
249
+ /**
250
+ * Call this function for an optimal writing data passing the ByteBuffer
251
+ * already allocated
252
+ */
253
+ export function write(entity: Entity, timestamp: number, componentId: number, data: Uint8Array, buf: ByteBuffer): void;
254
+ export function read(buf: ByteBuffer): AuthoritativePutComponentMessage | null;
255
+ }
256
+
221
257
  /** AvatarAnchorPointType determines the part of the avatar's body that anchors the Entity. */
222
258
  /**
223
259
  * @public
@@ -380,6 +416,22 @@ export declare interface BaseComponent<T> {
380
416
  * If the value is undefined, the component was deleted.
381
417
  */
382
418
  onChange(entity: Entity, cb: (value: T | undefined) => void): void;
419
+ /**
420
+ * @public
421
+ *
422
+ */
423
+ validateBeforeChange(entity: Entity, cb: ValidateCallback<T>): void;
424
+ validateBeforeChange(cb: ValidateCallback<T>): void;
425
+ /**
426
+ * Get the CRDT state for an entity (serialized data and timestamp)
427
+ * @param entity - Entity to get the CRDT state for
428
+ * @returns Object with serialized data and timestamp, or null if entity doesn't have the component
429
+ * @public
430
+ */
431
+ getCrdtState(entity: Entity): {
432
+ data: Uint8Array;
433
+ timestamp: number;
434
+ } | null;
383
435
  }
384
436
 
385
437
  /** @public */
@@ -1610,12 +1662,12 @@ export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
1610
1662
  /**
1611
1663
  * @public
1612
1664
  */
1613
- export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1665
+ export declare type CrdtMessage = PutComponentMessage | AuthoritativePutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1614
1666
 
1615
1667
  /**
1616
1668
  * @public
1617
1669
  */
1618
- export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1670
+ export declare type CrdtMessageBody = PutComponentMessageBody | AuthoritativePutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1619
1671
 
1620
1672
  /**
1621
1673
  * Min length = 8 bytes
@@ -1670,7 +1722,8 @@ export declare enum CrdtMessageType {
1670
1722
  PUT_COMPONENT_NETWORK = 5,
1671
1723
  DELETE_COMPONENT_NETWORK = 6,
1672
1724
  DELETE_ENTITY_NETWORK = 7,
1673
- MAX_MESSAGE_TYPE = 8
1725
+ AUTHORITATIVE_PUT_COMPONENT = 8,
1726
+ MAX_MESSAGE_TYPE = 9
1674
1727
  }
1675
1728
 
1676
1729
  /**
@@ -1678,6 +1731,8 @@ export declare enum CrdtMessageType {
1678
1731
  */
1679
1732
  export declare type CrdtNetworkMessageBody = PutNetworkComponentMessageBody | DeleteComponentNetworkMessageBody | DeleteEntityNetworkMessageBody;
1680
1733
 
1734
+ export declare const CreatedBy: ICreatedBy;
1735
+
1681
1736
  /**
1682
1737
  * @public
1683
1738
  */
@@ -2397,6 +2452,12 @@ export declare interface GrowOnlyValueSetComponentDefinition<T> extends BaseComp
2397
2452
 
2398
2453
  export declare type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
2399
2454
 
2455
+ export declare type ICreatedBy = LastWriteWinElementSetComponentDefinition<ICreatedByType>;
2456
+
2457
+ export declare interface ICreatedByType {
2458
+ address: string;
2459
+ }
2460
+
2400
2461
  /**
2401
2462
  * @public
2402
2463
  */
@@ -2841,6 +2902,35 @@ export declare const enum InteractionType {
2841
2902
  PROXIMITY = 1
2842
2903
  }
2843
2904
 
2905
+ /**
2906
+ * Internal component interface that exposes all internal methods for SDK use
2907
+ * This is not exposed to users, only for internal SDK operations
2908
+ */
2909
+ export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
2910
+ /**
2911
+ * @public
2912
+ * Dry run update to check if a CRDT message would be accepted without actually applying it
2913
+ */
2914
+ __dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
2915
+ /**
2916
+ * @public
2917
+ * Get the iterator to every entity has the component
2918
+ */
2919
+ iterator(): Iterable<[Entity, any]>;
2920
+ /**
2921
+ * @public
2922
+ */
2923
+ dirtyIterator(): Iterable<Entity>;
2924
+ /**
2925
+ * @public
2926
+ */
2927
+ __onChangeCallbacks(entity: Entity, value: T): void;
2928
+ /**
2929
+ * @public
2930
+ */
2931
+ __run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
2932
+ }
2933
+
2844
2934
  /**
2845
2935
  * @public
2846
2936
  */
@@ -9463,6 +9553,14 @@ export declare interface UiTransformProps {
9463
9553
  */
9464
9554
  export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
9465
9555
 
9556
+ export declare type ValidateCallback<T> = (value: {
9557
+ entity: Entity;
9558
+ currentValue: T | undefined;
9559
+ newValue: T | undefined;
9560
+ senderAddress: string;
9561
+ createdBy: string;
9562
+ }) => boolean;
9563
+
9466
9564
  /**
9467
9565
  * @public
9468
9566
  */
@@ -218,6 +218,42 @@ export declare interface AudioStreamComponentDefinitionExtended extends LastWrit
218
218
  getAudioState(entity: Entity): PBAudioEvent | undefined;
219
219
  }
220
220
 
221
+ /**
222
+ * @public
223
+ */
224
+ export declare type AuthoritativePutComponentMessage = CrdtMessageHeader & AuthoritativePutComponentMessageBody;
225
+
226
+ /**
227
+ * Server authoritative message - identical to PutComponentMessageBody but with forced processing
228
+ * Min. length = header (8 bytes) + 16 bytes = 24 bytes
229
+ *
230
+ * @param entity - Uint32 number of the entity
231
+ * @param componentId - Uint32 number of id
232
+ * @param timestamp - Uint32 Lamport timestamp (server's authoritative timestamp)
233
+ * @param data - Uint8[] data of component => length(4 bytes) + block of bytes[0..length-1]
234
+ * @public
235
+ */
236
+ export declare type AuthoritativePutComponentMessageBody = {
237
+ type: CrdtMessageType.AUTHORITATIVE_PUT_COMPONENT;
238
+ entityId: Entity;
239
+ componentId: number;
240
+ timestamp: number;
241
+ data: Uint8Array;
242
+ };
243
+
244
+ /**
245
+ * @public
246
+ */
247
+ export declare namespace AuthoritativePutComponentOperation {
248
+ const MESSAGE_HEADER_LENGTH = 16;
249
+ /**
250
+ * Call this function for an optimal writing data passing the ByteBuffer
251
+ * already allocated
252
+ */
253
+ export function write(entity: Entity, timestamp: number, componentId: number, data: Uint8Array, buf: ByteBuffer): void;
254
+ export function read(buf: ByteBuffer): AuthoritativePutComponentMessage | null;
255
+ }
256
+
221
257
  /** AvatarAnchorPointType determines the part of the avatar's body that anchors the Entity. */
222
258
  /**
223
259
  * @public
@@ -380,6 +416,22 @@ export declare interface BaseComponent<T> {
380
416
  * If the value is undefined, the component was deleted.
381
417
  */
382
418
  onChange(entity: Entity, cb: (value: T | undefined) => void): void;
419
+ /**
420
+ * @public
421
+ *
422
+ */
423
+ validateBeforeChange(entity: Entity, cb: ValidateCallback<T>): void;
424
+ validateBeforeChange(cb: ValidateCallback<T>): void;
425
+ /**
426
+ * Get the CRDT state for an entity (serialized data and timestamp)
427
+ * @param entity - Entity to get the CRDT state for
428
+ * @returns Object with serialized data and timestamp, or null if entity doesn't have the component
429
+ * @public
430
+ */
431
+ getCrdtState(entity: Entity): {
432
+ data: Uint8Array;
433
+ timestamp: number;
434
+ } | null;
383
435
  }
384
436
 
385
437
  /** @public */
@@ -1610,12 +1662,12 @@ export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
1610
1662
  /**
1611
1663
  * @public
1612
1664
  */
1613
- export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1665
+ export declare type CrdtMessage = PutComponentMessage | AuthoritativePutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1614
1666
 
1615
1667
  /**
1616
1668
  * @public
1617
1669
  */
1618
- export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1670
+ export declare type CrdtMessageBody = PutComponentMessageBody | AuthoritativePutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1619
1671
 
1620
1672
  /**
1621
1673
  * Min length = 8 bytes
@@ -1670,7 +1722,8 @@ export declare enum CrdtMessageType {
1670
1722
  PUT_COMPONENT_NETWORK = 5,
1671
1723
  DELETE_COMPONENT_NETWORK = 6,
1672
1724
  DELETE_ENTITY_NETWORK = 7,
1673
- MAX_MESSAGE_TYPE = 8
1725
+ AUTHORITATIVE_PUT_COMPONENT = 8,
1726
+ MAX_MESSAGE_TYPE = 9
1674
1727
  }
1675
1728
 
1676
1729
  /**
@@ -1678,6 +1731,8 @@ export declare enum CrdtMessageType {
1678
1731
  */
1679
1732
  export declare type CrdtNetworkMessageBody = PutNetworkComponentMessageBody | DeleteComponentNetworkMessageBody | DeleteEntityNetworkMessageBody;
1680
1733
 
1734
+ export declare const CreatedBy: ICreatedBy;
1735
+
1681
1736
  /**
1682
1737
  * @public
1683
1738
  */
@@ -2397,6 +2452,12 @@ export declare interface GrowOnlyValueSetComponentDefinition<T> extends BaseComp
2397
2452
 
2398
2453
  export declare type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
2399
2454
 
2455
+ export declare type ICreatedBy = LastWriteWinElementSetComponentDefinition<ICreatedByType>;
2456
+
2457
+ export declare interface ICreatedByType {
2458
+ address: string;
2459
+ }
2460
+
2400
2461
  /**
2401
2462
  * @public
2402
2463
  */
@@ -2841,6 +2902,35 @@ export declare const enum InteractionType {
2841
2902
  PROXIMITY = 1
2842
2903
  }
2843
2904
 
2905
+ /**
2906
+ * Internal component interface that exposes all internal methods for SDK use
2907
+ * This is not exposed to users, only for internal SDK operations
2908
+ */
2909
+ export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
2910
+ /**
2911
+ * @public
2912
+ * Dry run update to check if a CRDT message would be accepted without actually applying it
2913
+ */
2914
+ __dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
2915
+ /**
2916
+ * @public
2917
+ * Get the iterator to every entity has the component
2918
+ */
2919
+ iterator(): Iterable<[Entity, any]>;
2920
+ /**
2921
+ * @public
2922
+ */
2923
+ dirtyIterator(): Iterable<Entity>;
2924
+ /**
2925
+ * @public
2926
+ */
2927
+ __onChangeCallbacks(entity: Entity, value: T): void;
2928
+ /**
2929
+ * @public
2930
+ */
2931
+ __run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
2932
+ }
2933
+
2844
2934
  /**
2845
2935
  * @public
2846
2936
  */
@@ -9463,6 +9553,14 @@ export declare interface UiTransformProps {
9463
9553
  */
9464
9554
  export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
9465
9555
 
9556
+ export declare type ValidateCallback<T> = (value: {
9557
+ entity: Entity;
9558
+ currentValue: T | undefined;
9559
+ newValue: T | undefined;
9560
+ senderAddress: string;
9561
+ createdBy: string;
9562
+ }) => boolean;
9563
+
9466
9564
  /**
9467
9565
  * @public
9468
9566
  */