@dcl/playground-assets 7.22.5 → 7.22.6-25321038582.commit-63ddb3f

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
@@ -163,6 +163,42 @@ export declare interface AudioStreamComponentDefinitionExtended extends LastWrit
163
163
  getAudioState(entity: Entity): PBAudioEvent | undefined;
164
164
  }
165
165
 
166
+ /**
167
+ * @public
168
+ */
169
+ export declare type AuthoritativePutComponentMessage = CrdtMessageHeader & AuthoritativePutComponentMessageBody;
170
+
171
+ /**
172
+ * Server authoritative message - identical to PutComponentMessageBody but with forced processing
173
+ * Min. length = header (8 bytes) + 16 bytes = 24 bytes
174
+ *
175
+ * @param entity - Uint32 number of the entity
176
+ * @param componentId - Uint32 number of id
177
+ * @param timestamp - Uint32 Lamport timestamp (server's authoritative timestamp)
178
+ * @param data - Uint8[] data of component => length(4 bytes) + block of bytes[0..length-1]
179
+ * @public
180
+ */
181
+ export declare type AuthoritativePutComponentMessageBody = {
182
+ type: CrdtMessageType.AUTHORITATIVE_PUT_COMPONENT;
183
+ entityId: Entity;
184
+ componentId: number;
185
+ timestamp: number;
186
+ data: Uint8Array;
187
+ };
188
+
189
+ /**
190
+ * @public
191
+ */
192
+ export declare namespace AuthoritativePutComponentOperation {
193
+ const MESSAGE_HEADER_LENGTH = 16;
194
+ /**
195
+ * Call this function for an optimal writing data passing the ByteBuffer
196
+ * already allocated
197
+ */
198
+ export function write(entity: Entity, timestamp: number, componentId: number, data: Uint8Array, buf: ByteBuffer): void;
199
+ export function read(buf: ByteBuffer): AuthoritativePutComponentMessage | null;
200
+ }
201
+
166
202
  /** AvatarAnchorPointType determines the part of the avatar's body that anchors the Entity. */
167
203
  /**
168
204
  * @public
@@ -322,6 +358,22 @@ export declare interface BaseComponent<T> {
322
358
  * If the value is undefined, the component was deleted.
323
359
  */
324
360
  onChange(entity: Entity, cb: (value: T | undefined) => void): void;
361
+ /**
362
+ * @public
363
+ *
364
+ */
365
+ validateBeforeChange(entity: Entity, cb: ValidateCallback<T>): void;
366
+ validateBeforeChange(cb: ValidateCallback<T>): void;
367
+ /**
368
+ * Get the CRDT state for an entity (serialized data and timestamp)
369
+ * @param entity - Entity to get the CRDT state for
370
+ * @returns Object with serialized data and timestamp, or null if entity doesn't have the component
371
+ * @public
372
+ */
373
+ getCrdtState(entity: Entity): {
374
+ data: Uint8Array;
375
+ timestamp: number;
376
+ } | null;
325
377
  }
326
378
 
327
379
  /** @public */
@@ -1550,12 +1602,12 @@ export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
1550
1602
  /**
1551
1603
  * @public
1552
1604
  */
1553
- export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1605
+ export declare type CrdtMessage = PutComponentMessage | AuthoritativePutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1554
1606
 
1555
1607
  /**
1556
1608
  * @public
1557
1609
  */
1558
- export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1610
+ export declare type CrdtMessageBody = PutComponentMessageBody | AuthoritativePutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1559
1611
 
1560
1612
  /**
1561
1613
  * Min length = 8 bytes
@@ -1610,7 +1662,8 @@ export declare enum CrdtMessageType {
1610
1662
  PUT_COMPONENT_NETWORK = 5,
1611
1663
  DELETE_COMPONENT_NETWORK = 6,
1612
1664
  DELETE_ENTITY_NETWORK = 7,
1613
- MAX_MESSAGE_TYPE = 8
1665
+ AUTHORITATIVE_PUT_COMPONENT = 8,
1666
+ MAX_MESSAGE_TYPE = 9
1614
1667
  }
1615
1668
 
1616
1669
  /**
@@ -1618,6 +1671,8 @@ export declare enum CrdtMessageType {
1618
1671
  */
1619
1672
  export declare type CrdtNetworkMessageBody = PutNetworkComponentMessageBody | DeleteComponentNetworkMessageBody | DeleteEntityNetworkMessageBody;
1620
1673
 
1674
+ export declare const CreatedBy: ICreatedBy;
1675
+
1621
1676
  /**
1622
1677
  * @public
1623
1678
  */
@@ -2337,6 +2392,12 @@ export declare interface GrowOnlyValueSetComponentDefinition<T> extends BaseComp
2337
2392
 
2338
2393
  export declare type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
2339
2394
 
2395
+ export declare type ICreatedBy = LastWriteWinElementSetComponentDefinition<ICreatedByType>;
2396
+
2397
+ export declare interface ICreatedByType {
2398
+ address: string;
2399
+ }
2400
+
2340
2401
  /**
2341
2402
  * @public
2342
2403
  */
@@ -2788,6 +2849,35 @@ export declare const enum InteractionType {
2788
2849
  PROXIMITY = 1
2789
2850
  }
2790
2851
 
2852
+ /**
2853
+ * Internal component interface that exposes all internal methods for SDK use
2854
+ * This is not exposed to users, only for internal SDK operations
2855
+ */
2856
+ export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
2857
+ /**
2858
+ * @public
2859
+ * Dry run update to check if a CRDT message would be accepted without actually applying it
2860
+ */
2861
+ __dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
2862
+ /**
2863
+ * @public
2864
+ * Get the iterator to every entity has the component
2865
+ */
2866
+ iterator(): Iterable<[Entity, any]>;
2867
+ /**
2868
+ * @public
2869
+ */
2870
+ dirtyIterator(): Iterable<Entity>;
2871
+ /**
2872
+ * @public
2873
+ */
2874
+ __onChangeCallbacks(entity: Entity, value: T): void;
2875
+ /**
2876
+ * @public
2877
+ */
2878
+ __run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
2879
+ }
2880
+
2791
2881
  /**
2792
2882
  * @public
2793
2883
  */
@@ -9365,6 +9455,14 @@ export declare interface UiTransformProps {
9365
9455
  */
9366
9456
  export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
9367
9457
 
9458
+ export declare type ValidateCallback<T> = (value: {
9459
+ entity: Entity;
9460
+ currentValue: T | undefined;
9461
+ newValue: T | undefined;
9462
+ senderAddress: string;
9463
+ createdBy: string;
9464
+ }) => boolean;
9465
+
9368
9466
  /**
9369
9467
  * @public
9370
9468
  */
package/dist/beta.d.ts CHANGED
@@ -163,6 +163,42 @@ export declare interface AudioStreamComponentDefinitionExtended extends LastWrit
163
163
  getAudioState(entity: Entity): PBAudioEvent | undefined;
164
164
  }
165
165
 
166
+ /**
167
+ * @public
168
+ */
169
+ export declare type AuthoritativePutComponentMessage = CrdtMessageHeader & AuthoritativePutComponentMessageBody;
170
+
171
+ /**
172
+ * Server authoritative message - identical to PutComponentMessageBody but with forced processing
173
+ * Min. length = header (8 bytes) + 16 bytes = 24 bytes
174
+ *
175
+ * @param entity - Uint32 number of the entity
176
+ * @param componentId - Uint32 number of id
177
+ * @param timestamp - Uint32 Lamport timestamp (server's authoritative timestamp)
178
+ * @param data - Uint8[] data of component => length(4 bytes) + block of bytes[0..length-1]
179
+ * @public
180
+ */
181
+ export declare type AuthoritativePutComponentMessageBody = {
182
+ type: CrdtMessageType.AUTHORITATIVE_PUT_COMPONENT;
183
+ entityId: Entity;
184
+ componentId: number;
185
+ timestamp: number;
186
+ data: Uint8Array;
187
+ };
188
+
189
+ /**
190
+ * @public
191
+ */
192
+ export declare namespace AuthoritativePutComponentOperation {
193
+ const MESSAGE_HEADER_LENGTH = 16;
194
+ /**
195
+ * Call this function for an optimal writing data passing the ByteBuffer
196
+ * already allocated
197
+ */
198
+ export function write(entity: Entity, timestamp: number, componentId: number, data: Uint8Array, buf: ByteBuffer): void;
199
+ export function read(buf: ByteBuffer): AuthoritativePutComponentMessage | null;
200
+ }
201
+
166
202
  /** AvatarAnchorPointType determines the part of the avatar's body that anchors the Entity. */
167
203
  /**
168
204
  * @public
@@ -322,6 +358,22 @@ export declare interface BaseComponent<T> {
322
358
  * If the value is undefined, the component was deleted.
323
359
  */
324
360
  onChange(entity: Entity, cb: (value: T | undefined) => void): void;
361
+ /**
362
+ * @public
363
+ *
364
+ */
365
+ validateBeforeChange(entity: Entity, cb: ValidateCallback<T>): void;
366
+ validateBeforeChange(cb: ValidateCallback<T>): void;
367
+ /**
368
+ * Get the CRDT state for an entity (serialized data and timestamp)
369
+ * @param entity - Entity to get the CRDT state for
370
+ * @returns Object with serialized data and timestamp, or null if entity doesn't have the component
371
+ * @public
372
+ */
373
+ getCrdtState(entity: Entity): {
374
+ data: Uint8Array;
375
+ timestamp: number;
376
+ } | null;
325
377
  }
326
378
 
327
379
  /** @public */
@@ -1550,12 +1602,12 @@ export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
1550
1602
  /**
1551
1603
  * @public
1552
1604
  */
1553
- export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1605
+ export declare type CrdtMessage = PutComponentMessage | AuthoritativePutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1554
1606
 
1555
1607
  /**
1556
1608
  * @public
1557
1609
  */
1558
- export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1610
+ export declare type CrdtMessageBody = PutComponentMessageBody | AuthoritativePutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1559
1611
 
1560
1612
  /**
1561
1613
  * Min length = 8 bytes
@@ -1610,7 +1662,8 @@ export declare enum CrdtMessageType {
1610
1662
  PUT_COMPONENT_NETWORK = 5,
1611
1663
  DELETE_COMPONENT_NETWORK = 6,
1612
1664
  DELETE_ENTITY_NETWORK = 7,
1613
- MAX_MESSAGE_TYPE = 8
1665
+ AUTHORITATIVE_PUT_COMPONENT = 8,
1666
+ MAX_MESSAGE_TYPE = 9
1614
1667
  }
1615
1668
 
1616
1669
  /**
@@ -1618,6 +1671,8 @@ export declare enum CrdtMessageType {
1618
1671
  */
1619
1672
  export declare type CrdtNetworkMessageBody = PutNetworkComponentMessageBody | DeleteComponentNetworkMessageBody | DeleteEntityNetworkMessageBody;
1620
1673
 
1674
+ export declare const CreatedBy: ICreatedBy;
1675
+
1621
1676
  /**
1622
1677
  * @public
1623
1678
  */
@@ -2337,6 +2392,12 @@ export declare interface GrowOnlyValueSetComponentDefinition<T> extends BaseComp
2337
2392
 
2338
2393
  export declare type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
2339
2394
 
2395
+ export declare type ICreatedBy = LastWriteWinElementSetComponentDefinition<ICreatedByType>;
2396
+
2397
+ export declare interface ICreatedByType {
2398
+ address: string;
2399
+ }
2400
+
2340
2401
  /**
2341
2402
  * @public
2342
2403
  */
@@ -2779,6 +2840,35 @@ export declare const enum InteractionType {
2779
2840
  PROXIMITY = 1
2780
2841
  }
2781
2842
 
2843
+ /**
2844
+ * Internal component interface that exposes all internal methods for SDK use
2845
+ * This is not exposed to users, only for internal SDK operations
2846
+ */
2847
+ export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
2848
+ /**
2849
+ * @public
2850
+ * Dry run update to check if a CRDT message would be accepted without actually applying it
2851
+ */
2852
+ __dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
2853
+ /**
2854
+ * @public
2855
+ * Get the iterator to every entity has the component
2856
+ */
2857
+ iterator(): Iterable<[Entity, any]>;
2858
+ /**
2859
+ * @public
2860
+ */
2861
+ dirtyIterator(): Iterable<Entity>;
2862
+ /**
2863
+ * @public
2864
+ */
2865
+ __onChangeCallbacks(entity: Entity, value: T): void;
2866
+ /**
2867
+ * @public
2868
+ */
2869
+ __run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
2870
+ }
2871
+
2782
2872
  /**
2783
2873
  * @public
2784
2874
  */
@@ -9332,6 +9422,14 @@ export declare interface UiTransformProps {
9332
9422
  */
9333
9423
  export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
9334
9424
 
9425
+ export declare type ValidateCallback<T> = (value: {
9426
+ entity: Entity;
9427
+ currentValue: T | undefined;
9428
+ newValue: T | undefined;
9429
+ senderAddress: string;
9430
+ createdBy: string;
9431
+ }) => boolean;
9432
+
9335
9433
  /**
9336
9434
  * @public
9337
9435
  */
@@ -163,6 +163,42 @@ export declare interface AudioStreamComponentDefinitionExtended extends LastWrit
163
163
  getAudioState(entity: Entity): PBAudioEvent | undefined;
164
164
  }
165
165
 
166
+ /**
167
+ * @public
168
+ */
169
+ export declare type AuthoritativePutComponentMessage = CrdtMessageHeader & AuthoritativePutComponentMessageBody;
170
+
171
+ /**
172
+ * Server authoritative message - identical to PutComponentMessageBody but with forced processing
173
+ * Min. length = header (8 bytes) + 16 bytes = 24 bytes
174
+ *
175
+ * @param entity - Uint32 number of the entity
176
+ * @param componentId - Uint32 number of id
177
+ * @param timestamp - Uint32 Lamport timestamp (server's authoritative timestamp)
178
+ * @param data - Uint8[] data of component => length(4 bytes) + block of bytes[0..length-1]
179
+ * @public
180
+ */
181
+ export declare type AuthoritativePutComponentMessageBody = {
182
+ type: CrdtMessageType.AUTHORITATIVE_PUT_COMPONENT;
183
+ entityId: Entity;
184
+ componentId: number;
185
+ timestamp: number;
186
+ data: Uint8Array;
187
+ };
188
+
189
+ /**
190
+ * @public
191
+ */
192
+ export declare namespace AuthoritativePutComponentOperation {
193
+ const MESSAGE_HEADER_LENGTH = 16;
194
+ /**
195
+ * Call this function for an optimal writing data passing the ByteBuffer
196
+ * already allocated
197
+ */
198
+ export function write(entity: Entity, timestamp: number, componentId: number, data: Uint8Array, buf: ByteBuffer): void;
199
+ export function read(buf: ByteBuffer): AuthoritativePutComponentMessage | null;
200
+ }
201
+
166
202
  /** AvatarAnchorPointType determines the part of the avatar's body that anchors the Entity. */
167
203
  /**
168
204
  * @public
@@ -322,6 +358,22 @@ export declare interface BaseComponent<T> {
322
358
  * If the value is undefined, the component was deleted.
323
359
  */
324
360
  onChange(entity: Entity, cb: (value: T | undefined) => void): void;
361
+ /**
362
+ * @public
363
+ *
364
+ */
365
+ validateBeforeChange(entity: Entity, cb: ValidateCallback<T>): void;
366
+ validateBeforeChange(cb: ValidateCallback<T>): void;
367
+ /**
368
+ * Get the CRDT state for an entity (serialized data and timestamp)
369
+ * @param entity - Entity to get the CRDT state for
370
+ * @returns Object with serialized data and timestamp, or null if entity doesn't have the component
371
+ * @public
372
+ */
373
+ getCrdtState(entity: Entity): {
374
+ data: Uint8Array;
375
+ timestamp: number;
376
+ } | null;
325
377
  }
326
378
 
327
379
  /** @public */
@@ -1550,12 +1602,12 @@ export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
1550
1602
  /**
1551
1603
  * @public
1552
1604
  */
1553
- export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1605
+ export declare type CrdtMessage = PutComponentMessage | AuthoritativePutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1554
1606
 
1555
1607
  /**
1556
1608
  * @public
1557
1609
  */
1558
- export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1610
+ export declare type CrdtMessageBody = PutComponentMessageBody | AuthoritativePutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1559
1611
 
1560
1612
  /**
1561
1613
  * Min length = 8 bytes
@@ -1610,7 +1662,8 @@ export declare enum CrdtMessageType {
1610
1662
  PUT_COMPONENT_NETWORK = 5,
1611
1663
  DELETE_COMPONENT_NETWORK = 6,
1612
1664
  DELETE_ENTITY_NETWORK = 7,
1613
- MAX_MESSAGE_TYPE = 8
1665
+ AUTHORITATIVE_PUT_COMPONENT = 8,
1666
+ MAX_MESSAGE_TYPE = 9
1614
1667
  }
1615
1668
 
1616
1669
  /**
@@ -1618,6 +1671,8 @@ export declare enum CrdtMessageType {
1618
1671
  */
1619
1672
  export declare type CrdtNetworkMessageBody = PutNetworkComponentMessageBody | DeleteComponentNetworkMessageBody | DeleteEntityNetworkMessageBody;
1620
1673
 
1674
+ export declare const CreatedBy: ICreatedBy;
1675
+
1621
1676
  /**
1622
1677
  * @public
1623
1678
  */
@@ -2337,6 +2392,12 @@ export declare interface GrowOnlyValueSetComponentDefinition<T> extends BaseComp
2337
2392
 
2338
2393
  export declare type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
2339
2394
 
2395
+ export declare type ICreatedBy = LastWriteWinElementSetComponentDefinition<ICreatedByType>;
2396
+
2397
+ export declare interface ICreatedByType {
2398
+ address: string;
2399
+ }
2400
+
2340
2401
  /**
2341
2402
  * @public
2342
2403
  */
@@ -2779,6 +2840,35 @@ export declare const enum InteractionType {
2779
2840
  PROXIMITY = 1
2780
2841
  }
2781
2842
 
2843
+ /**
2844
+ * Internal component interface that exposes all internal methods for SDK use
2845
+ * This is not exposed to users, only for internal SDK operations
2846
+ */
2847
+ export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
2848
+ /**
2849
+ * @public
2850
+ * Dry run update to check if a CRDT message would be accepted without actually applying it
2851
+ */
2852
+ __dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
2853
+ /**
2854
+ * @public
2855
+ * Get the iterator to every entity has the component
2856
+ */
2857
+ iterator(): Iterable<[Entity, any]>;
2858
+ /**
2859
+ * @public
2860
+ */
2861
+ dirtyIterator(): Iterable<Entity>;
2862
+ /**
2863
+ * @public
2864
+ */
2865
+ __onChangeCallbacks(entity: Entity, value: T): void;
2866
+ /**
2867
+ * @public
2868
+ */
2869
+ __run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
2870
+ }
2871
+
2782
2872
  /**
2783
2873
  * @public
2784
2874
  */
@@ -9332,6 +9422,14 @@ export declare interface UiTransformProps {
9332
9422
  */
9333
9423
  export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
9334
9424
 
9425
+ export declare type ValidateCallback<T> = (value: {
9426
+ entity: Entity;
9427
+ currentValue: T | undefined;
9428
+ newValue: T | undefined;
9429
+ senderAddress: string;
9430
+ createdBy: string;
9431
+ }) => boolean;
9432
+
9335
9433
  /**
9336
9434
  * @public
9337
9435
  */