@dcl/playground-assets 7.26.1-32844959441.commit-a2ccd0b → 7.26.1-32860802198.commit-dae48fb

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
  */
@@ -2977,6 +3038,35 @@ export declare const enum InteractionType {
2977
3038
  PROXIMITY = 1
2978
3039
  }
2979
3040
 
3041
+ /**
3042
+ * Internal component interface that exposes all internal methods for SDK use
3043
+ * This is not exposed to users, only for internal SDK operations
3044
+ */
3045
+ export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
3046
+ /**
3047
+ * @public
3048
+ * Dry run update to check if a CRDT message would be accepted without actually applying it
3049
+ */
3050
+ __dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
3051
+ /**
3052
+ * @public
3053
+ * Get the iterator to every entity has the component
3054
+ */
3055
+ iterator(): Iterable<[Entity, any]>;
3056
+ /**
3057
+ * @public
3058
+ */
3059
+ dirtyIterator(): Iterable<Entity>;
3060
+ /**
3061
+ * @public
3062
+ */
3063
+ __onChangeCallbacks(entity: Entity, value: T): void;
3064
+ /**
3065
+ * @public
3066
+ */
3067
+ __run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
3068
+ }
3069
+
2980
3070
  /**
2981
3071
  * @public
2982
3072
  */
@@ -9956,6 +10046,14 @@ export declare interface UiTransformProps {
9956
10046
  */
9957
10047
  export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
9958
10048
 
10049
+ export declare type ValidateCallback<T> = (value: {
10050
+ entity: Entity;
10051
+ currentValue: T | undefined;
10052
+ newValue: T | undefined;
10053
+ senderAddress: string;
10054
+ createdBy: string;
10055
+ }) => boolean;
10056
+
9959
10057
  /**
9960
10058
  * @public
9961
10059
  */
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
  */
@@ -2968,6 +3029,35 @@ export declare const enum InteractionType {
2968
3029
  PROXIMITY = 1
2969
3030
  }
2970
3031
 
3032
+ /**
3033
+ * Internal component interface that exposes all internal methods for SDK use
3034
+ * This is not exposed to users, only for internal SDK operations
3035
+ */
3036
+ export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
3037
+ /**
3038
+ * @public
3039
+ * Dry run update to check if a CRDT message would be accepted without actually applying it
3040
+ */
3041
+ __dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
3042
+ /**
3043
+ * @public
3044
+ * Get the iterator to every entity has the component
3045
+ */
3046
+ iterator(): Iterable<[Entity, any]>;
3047
+ /**
3048
+ * @public
3049
+ */
3050
+ dirtyIterator(): Iterable<Entity>;
3051
+ /**
3052
+ * @public
3053
+ */
3054
+ __onChangeCallbacks(entity: Entity, value: T): void;
3055
+ /**
3056
+ * @public
3057
+ */
3058
+ __run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
3059
+ }
3060
+
2971
3061
  /**
2972
3062
  * @public
2973
3063
  */
@@ -9923,6 +10013,14 @@ export declare interface UiTransformProps {
9923
10013
  */
9924
10014
  export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
9925
10015
 
10016
+ export declare type ValidateCallback<T> = (value: {
10017
+ entity: Entity;
10018
+ currentValue: T | undefined;
10019
+ newValue: T | undefined;
10020
+ senderAddress: string;
10021
+ createdBy: string;
10022
+ }) => boolean;
10023
+
9926
10024
  /**
9927
10025
  * @public
9928
10026
  */
@@ -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
  */
@@ -2968,6 +3029,35 @@ export declare const enum InteractionType {
2968
3029
  PROXIMITY = 1
2969
3030
  }
2970
3031
 
3032
+ /**
3033
+ * Internal component interface that exposes all internal methods for SDK use
3034
+ * This is not exposed to users, only for internal SDK operations
3035
+ */
3036
+ export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
3037
+ /**
3038
+ * @public
3039
+ * Dry run update to check if a CRDT message would be accepted without actually applying it
3040
+ */
3041
+ __dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
3042
+ /**
3043
+ * @public
3044
+ * Get the iterator to every entity has the component
3045
+ */
3046
+ iterator(): Iterable<[Entity, any]>;
3047
+ /**
3048
+ * @public
3049
+ */
3050
+ dirtyIterator(): Iterable<Entity>;
3051
+ /**
3052
+ * @public
3053
+ */
3054
+ __onChangeCallbacks(entity: Entity, value: T): void;
3055
+ /**
3056
+ * @public
3057
+ */
3058
+ __run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
3059
+ }
3060
+
2971
3061
  /**
2972
3062
  * @public
2973
3063
  */
@@ -9923,6 +10013,14 @@ export declare interface UiTransformProps {
9923
10013
  */
9924
10014
  export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
9925
10015
 
10016
+ export declare type ValidateCallback<T> = (value: {
10017
+ entity: Entity;
10018
+ currentValue: T | undefined;
10019
+ newValue: T | undefined;
10020
+ senderAddress: string;
10021
+ createdBy: string;
10022
+ }) => boolean;
10023
+
9926
10024
  /**
9927
10025
  * @public
9928
10026
  */