@dcl/playground-assets 7.31.1-40604676255.commit-cb3ed84 → 7.31.1-40606969412.commit-24c05c3

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dcl/sdk",
3
3
  "description": "",
4
- "version": "7.31.1-40604676255.commit-cb3ed84",
4
+ "version": "7.31.1-40606969412.commit-24c05c3",
5
5
  "author": "Decentraland",
6
6
  "dependencies": {
7
7
  "@dcl/ecs": "file:../ecs",
@@ -33,5 +33,5 @@
33
33
  },
34
34
  "types": "./index.d.ts",
35
35
  "typings": "./index.d.ts",
36
- "commit": "cb3ed840b67e8695a9dfd9461e8a54736d349e03"
36
+ "commit": "24c05c38dee2062d70b9bd7a6790b01cd6e98678"
37
37
  }
@@ -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
@@ -485,6 +521,22 @@ export declare interface BaseComponent<T> {
485
521
  * If the value is undefined, the component was deleted.
486
522
  */
487
523
  onChange(entity: Entity, cb: (value: T | undefined) => void): void;
524
+ /**
525
+ * @public
526
+ *
527
+ */
528
+ validateBeforeChange(entity: Entity, cb: ValidateCallback<T>): void;
529
+ validateBeforeChange(cb: ValidateCallback<T>): void;
530
+ /**
531
+ * Get the CRDT state for an entity (serialized data and timestamp)
532
+ * @param entity - Entity to get the CRDT state for
533
+ * @returns Object with serialized data and timestamp, or null if entity doesn't have the component
534
+ * @public
535
+ */
536
+ getCrdtState(entity: Entity): {
537
+ data: Uint8Array;
538
+ timestamp: number;
539
+ } | null;
488
540
  }
489
541
 
490
542
  /** @public */
@@ -1745,12 +1797,12 @@ export declare const CRDT_MESSAGE_HEADER_LENGTH = 8;
1745
1797
  /**
1746
1798
  * @public
1747
1799
  */
1748
- export declare type CrdtMessage = PutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1800
+ export declare type CrdtMessage = PutComponentMessage | AuthoritativePutComponentMessage | DeleteComponentMessage | AppendValueMessage | DeleteEntityMessage | PutNetworkComponentMessage | DeleteComponentNetworkMessage | DeleteEntityNetworkMessage;
1749
1801
 
1750
1802
  /**
1751
1803
  * @public
1752
1804
  */
1753
- export declare type CrdtMessageBody = PutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1805
+ export declare type CrdtMessageBody = PutComponentMessageBody | AuthoritativePutComponentMessageBody | DeleteComponentMessageBody | DeleteEntityMessageBody | AppendValueMessageBody | CrdtNetworkMessageBody;
1754
1806
 
1755
1807
  /**
1756
1808
  * Min length = 8 bytes
@@ -1805,7 +1857,8 @@ export declare enum CrdtMessageType {
1805
1857
  PUT_COMPONENT_NETWORK = 5,
1806
1858
  DELETE_COMPONENT_NETWORK = 6,
1807
1859
  DELETE_ENTITY_NETWORK = 7,
1808
- MAX_MESSAGE_TYPE = 8
1860
+ AUTHORITATIVE_PUT_COMPONENT = 8,
1861
+ MAX_MESSAGE_TYPE = 9
1809
1862
  }
1810
1863
 
1811
1864
  /**
@@ -1813,6 +1866,8 @@ export declare enum CrdtMessageType {
1813
1866
  */
1814
1867
  export declare type CrdtNetworkMessageBody = PutNetworkComponentMessageBody | DeleteComponentNetworkMessageBody | DeleteEntityNetworkMessageBody;
1815
1868
 
1869
+ export declare const CreatedBy: ICreatedBy;
1870
+
1816
1871
  /**
1817
1872
  * @public
1818
1873
  */
@@ -2610,6 +2665,12 @@ export declare interface GrowOnlyValueSetComponentDefinition<T> extends BaseComp
2610
2665
 
2611
2666
  export declare type GSetComponentGetter<T extends GrowOnlyValueSetComponentDefinition<any>> = (engine: Pick<IEngine, 'defineValueSetComponentFromSchema'>) => T;
2612
2667
 
2668
+ export declare type ICreatedBy = LastWriteWinElementSetComponentDefinition<ICreatedByType>;
2669
+
2670
+ export declare interface ICreatedByType {
2671
+ address: string;
2672
+ }
2673
+
2613
2674
  /**
2614
2675
  * @public
2615
2676
  */
@@ -3096,6 +3157,35 @@ export declare const enum InteractionType {
3096
3157
  PROXIMITY = 1
3097
3158
  }
3098
3159
 
3160
+ /**
3161
+ * Internal component interface that exposes all internal methods for SDK use
3162
+ * This is not exposed to users, only for internal SDK operations
3163
+ */
3164
+ export declare interface InternalBaseComponent<T> extends BaseComponent<T> {
3165
+ /**
3166
+ * @public
3167
+ * Dry run update to check if a CRDT message would be accepted without actually applying it
3168
+ */
3169
+ __dry_run_updateFromCrdt(body: CrdtMessageBody): ProcessMessageResultType;
3170
+ /**
3171
+ * @public
3172
+ * Get the iterator to every entity has the component
3173
+ */
3174
+ iterator(): Iterable<[Entity, any]>;
3175
+ /**
3176
+ * @public
3177
+ */
3178
+ dirtyIterator(): Iterable<Entity>;
3179
+ /**
3180
+ * @public
3181
+ */
3182
+ __onChangeCallbacks(entity: Entity, value: T): void;
3183
+ /**
3184
+ * @public
3185
+ */
3186
+ __run_validateBeforeChange(entity: Entity, newValue: T | undefined, senderAddress: string, createdBy: string): boolean;
3187
+ }
3188
+
3099
3189
  /**
3100
3190
  * @public
3101
3191
  */
@@ -10256,6 +10346,16 @@ export declare type Transport = {
10256
10346
  onmessage?(message: Uint8Array): void;
10257
10347
  filter(message: Omit<TransportMessage, 'messageBuffer'>): boolean;
10258
10348
  type?: string;
10349
+ /**
10350
+ * Whether this transport is allowed to mutate reserved-range entities
10351
+ * (root/player/camera + avatars, entity number below `RESERVED_STATIC_ENTITIES`).
10352
+ * Only the trusted host/renderer transport sets this. An inbound DELETE_ENTITY
10353
+ * or component operation (PUT_COMPONENT, DELETE_COMPONENT, APPEND_VALUE,
10354
+ * AUTHORITATIVE_PUT_COMPONENT) on a reserved entity from a transport without
10355
+ * this flag (a comms peer, or any scene-added transport) is rejected — see
10356
+ * `receiveMessages`.
10357
+ */
10358
+ allowReservedEntities?: boolean;
10259
10359
  };
10260
10360
 
10261
10361
  /**
@@ -10880,6 +10980,14 @@ export declare interface UiVideoTexture {
10880
10980
  */
10881
10981
  export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
10882
10982
 
10983
+ export declare type ValidateCallback<T> = (value: {
10984
+ entity: Entity;
10985
+ currentValue: T | undefined;
10986
+ newValue: T | undefined;
10987
+ senderAddress: string;
10988
+ createdBy: string;
10989
+ }) => boolean;
10990
+
10883
10991
  /**
10884
10992
  * @public
10885
10993
  */