@dcl/playground-assets 7.24.5-29428555187.commit-fb197d3 → 7.24.6-29505165911.commit-d270434

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
@@ -220,6 +220,42 @@ export declare interface AudioStreamComponentDefinitionExtended extends LastWrit
220
220
  getAudioState(entity: Entity): PBAudioEvent | undefined;
221
221
  }
222
222
 
223
+ /**
224
+ * @public
225
+ */
226
+ export declare type AuthoritativePutComponentMessage = CrdtMessageHeader & AuthoritativePutComponentMessageBody;
227
+
228
+ /**
229
+ * Server authoritative message - identical to PutComponentMessageBody but with forced processing
230
+ * Min. length = header (8 bytes) + 16 bytes = 24 bytes
231
+ *
232
+ * @param entity - Uint32 number of the entity
233
+ * @param componentId - Uint32 number of id
234
+ * @param timestamp - Uint32 Lamport timestamp (server's authoritative timestamp)
235
+ * @param data - Uint8[] data of component => length(4 bytes) + block of bytes[0..length-1]
236
+ * @public
237
+ */
238
+ export declare type AuthoritativePutComponentMessageBody = {
239
+ type: CrdtMessageType.AUTHORITATIVE_PUT_COMPONENT;
240
+ entityId: Entity;
241
+ componentId: number;
242
+ timestamp: number;
243
+ data: Uint8Array;
244
+ };
245
+
246
+ /**
247
+ * @public
248
+ */
249
+ export declare namespace AuthoritativePutComponentOperation {
250
+ const MESSAGE_HEADER_LENGTH = 16;
251
+ /**
252
+ * Call this function for an optimal writing data passing the ByteBuffer
253
+ * already allocated
254
+ */
255
+ export function write(entity: Entity, timestamp: number, componentId: number, data: Uint8Array, buf: ByteBuffer): void;
256
+ export function read(buf: ByteBuffer): AuthoritativePutComponentMessage | null;
257
+ }
258
+
223
259
  /** AvatarAnchorPointType determines the part of the avatar's body that anchors the Entity. */
224
260
  /**
225
261
  * @public
@@ -392,6 +428,22 @@ export declare interface BaseComponent<T> {
392
428
  * If the value is undefined, the component was deleted.
393
429
  */
394
430
  onChange(entity: Entity, cb: (value: T | undefined) => void): void;
431
+ /**
432
+ * @public
433
+ *
434
+ */
435
+ validateBeforeChange(entity: Entity, cb: ValidateCallback<T>): void;
436
+ validateBeforeChange(cb: ValidateCallback<T>): void;
437
+ /**
438
+ * Get the CRDT state for an entity (serialized data and timestamp)
439
+ * @param entity - Entity to get the CRDT state for
440
+ * @returns Object with serialized data and timestamp, or null if entity doesn't have the component
441
+ * @public
442
+ */
443
+ getCrdtState(entity: Entity): {
444
+ data: Uint8Array;
445
+ timestamp: number;
446
+ } | null;
395
447
  }
396
448
 
397
449
  /** @public */
@@ -1630,12 +1682,12 @@ export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
1630
1682
  /**
1631
1683
  * @public
1632
1684
  */
1633
- export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1685
+ export declare type CrdtMessage = PutComponentMessage | AuthoritativePutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1634
1686
 
1635
1687
  /**
1636
1688
  * @public
1637
1689
  */
1638
- export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1690
+ export declare type CrdtMessageBody = PutComponentMessageBody | AuthoritativePutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1639
1691
 
1640
1692
  /**
1641
1693
  * Min length = 8 bytes
@@ -1690,7 +1742,8 @@ export declare enum CrdtMessageType {
1690
1742
  PUT_COMPONENT_NETWORK = 5,
1691
1743
  DELETE_COMPONENT_NETWORK = 6,
1692
1744
  DELETE_ENTITY_NETWORK = 7,
1693
- MAX_MESSAGE_TYPE = 8
1745
+ AUTHORITATIVE_PUT_COMPONENT = 8,
1746
+ MAX_MESSAGE_TYPE = 9
1694
1747
  }
1695
1748
 
1696
1749
  /**
@@ -1698,6 +1751,8 @@ export declare enum CrdtMessageType {
1698
1751
  */
1699
1752
  export declare type CrdtNetworkMessageBody = PutNetworkComponentMessageBody | DeleteComponentNetworkMessageBody | DeleteEntityNetworkMessageBody;
1700
1753
 
1754
+ export declare const CreatedBy: ICreatedBy;
1755
+
1701
1756
  /**
1702
1757
  * @public
1703
1758
  */
@@ -2424,6 +2479,12 @@ export declare interface GrowOnlyValueSetComponentDefinition<T> extends BaseComp
2424
2479
 
2425
2480
  export declare type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
2426
2481
 
2482
+ export declare type ICreatedBy = LastWriteWinElementSetComponentDefinition<ICreatedByType>;
2483
+
2484
+ export declare interface ICreatedByType {
2485
+ address: string;
2486
+ }
2487
+
2427
2488
  /**
2428
2489
  * @public
2429
2490
  */
@@ -2899,6 +2960,35 @@ export declare const enum InteractionType {
2899
2960
  PROXIMITY = 1
2900
2961
  }
2901
2962
 
2963
+ /**
2964
+ * Internal component interface that exposes all internal methods for SDK use
2965
+ * This is not exposed to users, only for internal SDK operations
2966
+ */
2967
+ export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
2968
+ /**
2969
+ * @public
2970
+ * Dry run update to check if a CRDT message would be accepted without actually applying it
2971
+ */
2972
+ __dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
2973
+ /**
2974
+ * @public
2975
+ * Get the iterator to every entity has the component
2976
+ */
2977
+ iterator(): Iterable<[Entity, any]>;
2978
+ /**
2979
+ * @public
2980
+ */
2981
+ dirtyIterator(): Iterable<Entity>;
2982
+ /**
2983
+ * @public
2984
+ */
2985
+ __onChangeCallbacks(entity: Entity, value: T): void;
2986
+ /**
2987
+ * @public
2988
+ */
2989
+ __run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
2990
+ }
2991
+
2902
2992
  /**
2903
2993
  * @public
2904
2994
  */
@@ -9646,6 +9736,14 @@ export declare interface UiTransformProps {
9646
9736
  */
9647
9737
  export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
9648
9738
 
9739
+ export declare type ValidateCallback<T> = (value: {
9740
+ entity: Entity;
9741
+ currentValue: T | undefined;
9742
+ newValue: T | undefined;
9743
+ senderAddress: string;
9744
+ createdBy: string;
9745
+ }) => boolean;
9746
+
9649
9747
  /**
9650
9748
  * @public
9651
9749
  */
package/dist/beta.d.ts CHANGED
@@ -220,6 +220,42 @@ export declare interface AudioStreamComponentDefinitionExtended extends LastWrit
220
220
  getAudioState(entity: Entity): PBAudioEvent | undefined;
221
221
  }
222
222
 
223
+ /**
224
+ * @public
225
+ */
226
+ export declare type AuthoritativePutComponentMessage = CrdtMessageHeader & AuthoritativePutComponentMessageBody;
227
+
228
+ /**
229
+ * Server authoritative message - identical to PutComponentMessageBody but with forced processing
230
+ * Min. length = header (8 bytes) + 16 bytes = 24 bytes
231
+ *
232
+ * @param entity - Uint32 number of the entity
233
+ * @param componentId - Uint32 number of id
234
+ * @param timestamp - Uint32 Lamport timestamp (server's authoritative timestamp)
235
+ * @param data - Uint8[] data of component => length(4 bytes) + block of bytes[0..length-1]
236
+ * @public
237
+ */
238
+ export declare type AuthoritativePutComponentMessageBody = {
239
+ type: CrdtMessageType.AUTHORITATIVE_PUT_COMPONENT;
240
+ entityId: Entity;
241
+ componentId: number;
242
+ timestamp: number;
243
+ data: Uint8Array;
244
+ };
245
+
246
+ /**
247
+ * @public
248
+ */
249
+ export declare namespace AuthoritativePutComponentOperation {
250
+ const MESSAGE_HEADER_LENGTH = 16;
251
+ /**
252
+ * Call this function for an optimal writing data passing the ByteBuffer
253
+ * already allocated
254
+ */
255
+ export function write(entity: Entity, timestamp: number, componentId: number, data: Uint8Array, buf: ByteBuffer): void;
256
+ export function read(buf: ByteBuffer): AuthoritativePutComponentMessage | null;
257
+ }
258
+
223
259
  /** AvatarAnchorPointType determines the part of the avatar's body that anchors the Entity. */
224
260
  /**
225
261
  * @public
@@ -392,6 +428,22 @@ export declare interface BaseComponent<T> {
392
428
  * If the value is undefined, the component was deleted.
393
429
  */
394
430
  onChange(entity: Entity, cb: (value: T | undefined) => void): void;
431
+ /**
432
+ * @public
433
+ *
434
+ */
435
+ validateBeforeChange(entity: Entity, cb: ValidateCallback<T>): void;
436
+ validateBeforeChange(cb: ValidateCallback<T>): void;
437
+ /**
438
+ * Get the CRDT state for an entity (serialized data and timestamp)
439
+ * @param entity - Entity to get the CRDT state for
440
+ * @returns Object with serialized data and timestamp, or null if entity doesn't have the component
441
+ * @public
442
+ */
443
+ getCrdtState(entity: Entity): {
444
+ data: Uint8Array;
445
+ timestamp: number;
446
+ } | null;
395
447
  }
396
448
 
397
449
  /** @public */
@@ -1630,12 +1682,12 @@ export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
1630
1682
  /**
1631
1683
  * @public
1632
1684
  */
1633
- export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1685
+ export declare type CrdtMessage = PutComponentMessage | AuthoritativePutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1634
1686
 
1635
1687
  /**
1636
1688
  * @public
1637
1689
  */
1638
- export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1690
+ export declare type CrdtMessageBody = PutComponentMessageBody | AuthoritativePutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1639
1691
 
1640
1692
  /**
1641
1693
  * Min length = 8 bytes
@@ -1690,7 +1742,8 @@ export declare enum CrdtMessageType {
1690
1742
  PUT_COMPONENT_NETWORK = 5,
1691
1743
  DELETE_COMPONENT_NETWORK = 6,
1692
1744
  DELETE_ENTITY_NETWORK = 7,
1693
- MAX_MESSAGE_TYPE = 8
1745
+ AUTHORITATIVE_PUT_COMPONENT = 8,
1746
+ MAX_MESSAGE_TYPE = 9
1694
1747
  }
1695
1748
 
1696
1749
  /**
@@ -1698,6 +1751,8 @@ export declare enum CrdtMessageType {
1698
1751
  */
1699
1752
  export declare type CrdtNetworkMessageBody = PutNetworkComponentMessageBody | DeleteComponentNetworkMessageBody | DeleteEntityNetworkMessageBody;
1700
1753
 
1754
+ export declare const CreatedBy: ICreatedBy;
1755
+
1701
1756
  /**
1702
1757
  * @public
1703
1758
  */
@@ -2424,6 +2479,12 @@ export declare interface GrowOnlyValueSetComponentDefinition<T> extends BaseComp
2424
2479
 
2425
2480
  export declare type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
2426
2481
 
2482
+ export declare type ICreatedBy = LastWriteWinElementSetComponentDefinition<ICreatedByType>;
2483
+
2484
+ export declare interface ICreatedByType {
2485
+ address: string;
2486
+ }
2487
+
2427
2488
  /**
2428
2489
  * @public
2429
2490
  */
@@ -2890,6 +2951,35 @@ export declare const enum InteractionType {
2890
2951
  PROXIMITY = 1
2891
2952
  }
2892
2953
 
2954
+ /**
2955
+ * Internal component interface that exposes all internal methods for SDK use
2956
+ * This is not exposed to users, only for internal SDK operations
2957
+ */
2958
+ export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
2959
+ /**
2960
+ * @public
2961
+ * Dry run update to check if a CRDT message would be accepted without actually applying it
2962
+ */
2963
+ __dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
2964
+ /**
2965
+ * @public
2966
+ * Get the iterator to every entity has the component
2967
+ */
2968
+ iterator(): Iterable<[Entity, any]>;
2969
+ /**
2970
+ * @public
2971
+ */
2972
+ dirtyIterator(): Iterable<Entity>;
2973
+ /**
2974
+ * @public
2975
+ */
2976
+ __onChangeCallbacks(entity: Entity, value: T): void;
2977
+ /**
2978
+ * @public
2979
+ */
2980
+ __run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
2981
+ }
2982
+
2893
2983
  /**
2894
2984
  * @public
2895
2985
  */
@@ -9613,6 +9703,14 @@ export declare interface UiTransformProps {
9613
9703
  */
9614
9704
  export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
9615
9705
 
9706
+ export declare type ValidateCallback<T> = (value: {
9707
+ entity: Entity;
9708
+ currentValue: T | undefined;
9709
+ newValue: T | undefined;
9710
+ senderAddress: string;
9711
+ createdBy: string;
9712
+ }) => boolean;
9713
+
9616
9714
  /**
9617
9715
  * @public
9618
9716
  */
@@ -220,6 +220,42 @@ export declare interface AudioStreamComponentDefinitionExtended extends LastWrit
220
220
  getAudioState(entity: Entity): PBAudioEvent | undefined;
221
221
  }
222
222
 
223
+ /**
224
+ * @public
225
+ */
226
+ export declare type AuthoritativePutComponentMessage = CrdtMessageHeader & AuthoritativePutComponentMessageBody;
227
+
228
+ /**
229
+ * Server authoritative message - identical to PutComponentMessageBody but with forced processing
230
+ * Min. length = header (8 bytes) + 16 bytes = 24 bytes
231
+ *
232
+ * @param entity - Uint32 number of the entity
233
+ * @param componentId - Uint32 number of id
234
+ * @param timestamp - Uint32 Lamport timestamp (server's authoritative timestamp)
235
+ * @param data - Uint8[] data of component => length(4 bytes) + block of bytes[0..length-1]
236
+ * @public
237
+ */
238
+ export declare type AuthoritativePutComponentMessageBody = {
239
+ type: CrdtMessageType.AUTHORITATIVE_PUT_COMPONENT;
240
+ entityId: Entity;
241
+ componentId: number;
242
+ timestamp: number;
243
+ data: Uint8Array;
244
+ };
245
+
246
+ /**
247
+ * @public
248
+ */
249
+ export declare namespace AuthoritativePutComponentOperation {
250
+ const MESSAGE_HEADER_LENGTH = 16;
251
+ /**
252
+ * Call this function for an optimal writing data passing the ByteBuffer
253
+ * already allocated
254
+ */
255
+ export function write(entity: Entity, timestamp: number, componentId: number, data: Uint8Array, buf: ByteBuffer): void;
256
+ export function read(buf: ByteBuffer): AuthoritativePutComponentMessage | null;
257
+ }
258
+
223
259
  /** AvatarAnchorPointType determines the part of the avatar's body that anchors the Entity. */
224
260
  /**
225
261
  * @public
@@ -392,6 +428,22 @@ export declare interface BaseComponent<T> {
392
428
  * If the value is undefined, the component was deleted.
393
429
  */
394
430
  onChange(entity: Entity, cb: (value: T | undefined) => void): void;
431
+ /**
432
+ * @public
433
+ *
434
+ */
435
+ validateBeforeChange(entity: Entity, cb: ValidateCallback<T>): void;
436
+ validateBeforeChange(cb: ValidateCallback<T>): void;
437
+ /**
438
+ * Get the CRDT state for an entity (serialized data and timestamp)
439
+ * @param entity - Entity to get the CRDT state for
440
+ * @returns Object with serialized data and timestamp, or null if entity doesn't have the component
441
+ * @public
442
+ */
443
+ getCrdtState(entity: Entity): {
444
+ data: Uint8Array;
445
+ timestamp: number;
446
+ } | null;
395
447
  }
396
448
 
397
449
  /** @public */
@@ -1630,12 +1682,12 @@ export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
1630
1682
  /**
1631
1683
  * @public
1632
1684
  */
1633
- export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1685
+ export declare type CrdtMessage = PutComponentMessage | AuthoritativePutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1634
1686
 
1635
1687
  /**
1636
1688
  * @public
1637
1689
  */
1638
- export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1690
+ export declare type CrdtMessageBody = PutComponentMessageBody | AuthoritativePutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1639
1691
 
1640
1692
  /**
1641
1693
  * Min length = 8 bytes
@@ -1690,7 +1742,8 @@ export declare enum CrdtMessageType {
1690
1742
  PUT_COMPONENT_NETWORK = 5,
1691
1743
  DELETE_COMPONENT_NETWORK = 6,
1692
1744
  DELETE_ENTITY_NETWORK = 7,
1693
- MAX_MESSAGE_TYPE = 8
1745
+ AUTHORITATIVE_PUT_COMPONENT = 8,
1746
+ MAX_MESSAGE_TYPE = 9
1694
1747
  }
1695
1748
 
1696
1749
  /**
@@ -1698,6 +1751,8 @@ export declare enum CrdtMessageType {
1698
1751
  */
1699
1752
  export declare type CrdtNetworkMessageBody = PutNetworkComponentMessageBody | DeleteComponentNetworkMessageBody | DeleteEntityNetworkMessageBody;
1700
1753
 
1754
+ export declare const CreatedBy: ICreatedBy;
1755
+
1701
1756
  /**
1702
1757
  * @public
1703
1758
  */
@@ -2424,6 +2479,12 @@ export declare interface GrowOnlyValueSetComponentDefinition<T> extends BaseComp
2424
2479
 
2425
2480
  export declare type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
2426
2481
 
2482
+ export declare type ICreatedBy = LastWriteWinElementSetComponentDefinition<ICreatedByType>;
2483
+
2484
+ export declare interface ICreatedByType {
2485
+ address: string;
2486
+ }
2487
+
2427
2488
  /**
2428
2489
  * @public
2429
2490
  */
@@ -2890,6 +2951,35 @@ export declare const enum InteractionType {
2890
2951
  PROXIMITY = 1
2891
2952
  }
2892
2953
 
2954
+ /**
2955
+ * Internal component interface that exposes all internal methods for SDK use
2956
+ * This is not exposed to users, only for internal SDK operations
2957
+ */
2958
+ export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
2959
+ /**
2960
+ * @public
2961
+ * Dry run update to check if a CRDT message would be accepted without actually applying it
2962
+ */
2963
+ __dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
2964
+ /**
2965
+ * @public
2966
+ * Get the iterator to every entity has the component
2967
+ */
2968
+ iterator(): Iterable<[Entity, any]>;
2969
+ /**
2970
+ * @public
2971
+ */
2972
+ dirtyIterator(): Iterable<Entity>;
2973
+ /**
2974
+ * @public
2975
+ */
2976
+ __onChangeCallbacks(entity: Entity, value: T): void;
2977
+ /**
2978
+ * @public
2979
+ */
2980
+ __run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
2981
+ }
2982
+
2893
2983
  /**
2894
2984
  * @public
2895
2985
  */
@@ -9613,6 +9703,14 @@ export declare interface UiTransformProps {
9613
9703
  */
9614
9704
  export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
9615
9705
 
9706
+ export declare type ValidateCallback<T> = (value: {
9707
+ entity: Entity;
9708
+ currentValue: T | undefined;
9709
+ newValue: T | undefined;
9710
+ senderAddress: string;
9711
+ createdBy: string;
9712
+ }) => boolean;
9713
+
9616
9714
  /**
9617
9715
  * @public
9618
9716
  */