@dcl/playground-assets 7.1.3-4440802627.commit-29bc3e6 → 7.1.3-4448471926.commit-264de76

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/index.js CHANGED
@@ -9505,7 +9505,7 @@
9505
9505
  return message;
9506
9506
  },
9507
9507
  };
9508
- var tsProtoGlobalThis$1 = (() => {
9508
+ var tsProtoGlobalThis$3 = (() => {
9509
9509
  if (typeof globalThis !== "undefined") {
9510
9510
  return globalThis;
9511
9511
  }
@@ -9522,7 +9522,7 @@
9522
9522
  })();
9523
9523
  function longToNumber$1(long) {
9524
9524
  if (long.gt(Number.MAX_SAFE_INTEGER)) {
9525
- throw new tsProtoGlobalThis$1.Error("Value is larger than Number.MAX_SAFE_INTEGER");
9525
+ throw new tsProtoGlobalThis$3.Error("Value is larger than Number.MAX_SAFE_INTEGER");
9526
9526
  }
9527
9527
  return long.toNumber();
9528
9528
  }
@@ -11142,7 +11142,7 @@
11142
11142
  return message;
11143
11143
  },
11144
11144
  };
11145
- var tsProtoGlobalThis = (() => {
11145
+ var tsProtoGlobalThis$2 = (() => {
11146
11146
  if (typeof globalThis !== "undefined") {
11147
11147
  return globalThis;
11148
11148
  }
@@ -11159,7 +11159,7 @@
11159
11159
  })();
11160
11160
  function longToNumber(long) {
11161
11161
  if (long.gt(Number.MAX_SAFE_INTEGER)) {
11162
- throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
11162
+ throw new tsProtoGlobalThis$2.Error("Value is larger than Number.MAX_SAFE_INTEGER");
11163
11163
  }
11164
11164
  return long.toNumber();
11165
11165
  }
@@ -16277,41 +16277,680 @@
16277
16277
  Font[Font["F_MONOSPACE"] = 2] = "F_MONOSPACE";
16278
16278
  })(exports.Font || (exports.Font = {}));
16279
16279
 
16280
+ /* eslint-disable */
16281
+ /**
16282
+ * `NullValue` is a singleton enumeration to represent the null value for the
16283
+ * `Value` type union.
16284
+ *
16285
+ * The JSON representation for `NullValue` is JSON `null`.
16286
+ */
16280
16287
  /**
16281
16288
  * @public
16282
- * @deprecated composite is not being supported so far, please do not use this feature
16283
16289
  */
16284
- function compositeFromJson(jsonComposite) {
16285
- if (!jsonComposite)
16286
- throw new Error('Composite is not well defined');
16287
- if (!jsonComposite.id || typeof jsonComposite.id !== 'string')
16288
- throw new Error("Composite doesn't have a valid `id` field");
16289
- const compositeId = jsonComposite.id;
16290
- // TODO: Should be there a .version to identify the schema version?
16291
- if (!Array.isArray(jsonComposite.components))
16292
- throw new Error(`Composite '${compositeId}' fields 'components' is not an array`);
16293
- const composite = {
16294
- id: compositeId,
16295
- components: []
16296
- };
16297
- for (const component of jsonComposite.components) {
16298
- if (!component.name || typeof component.name !== 'string')
16299
- throw new Error(`Composite '${compositeId}': The component doesn't have a valid name`);
16300
- const componentName = component.name;
16301
- const componentData = new Map();
16302
- if (typeof component.data !== 'object' || Array.isArray(component.data))
16303
- throw new Error(`Composite '${compositeId}': Invalid data in component '${component.name}'`);
16304
- for (const [entityStr, data] of Object.entries(component.data)) {
16305
- const entity = parseInt(entityStr);
16306
- componentData.set(entity, data);
16307
- }
16308
- composite.components.push({
16309
- name: componentName,
16310
- data: componentData,
16311
- schema: component.schema
16290
+ var NullValue;
16291
+ (function (NullValue) {
16292
+ /** NULL_VALUE - Null value. */
16293
+ NullValue[NullValue["NULL_VALUE"] = 0] = "NULL_VALUE";
16294
+ })(NullValue || (NullValue = {}));
16295
+ /**
16296
+ * @public
16297
+ */
16298
+ function nullValueFromJSON(object) {
16299
+ switch (object) {
16300
+ case 0:
16301
+ case "NULL_VALUE":
16302
+ return 0 /* NullValue.NULL_VALUE */;
16303
+ default:
16304
+ throw new tsProtoGlobalThis$1.Error("Unrecognized enum value " + object + " for enum NullValue");
16305
+ }
16306
+ }
16307
+ /**
16308
+ * @public
16309
+ */
16310
+ function nullValueToJSON(object) {
16311
+ switch (object) {
16312
+ case 0 /* NullValue.NULL_VALUE */:
16313
+ return "NULL_VALUE";
16314
+ default:
16315
+ throw new tsProtoGlobalThis$1.Error("Unrecognized enum value " + object + " for enum NullValue");
16316
+ }
16317
+ }
16318
+ function createBaseStruct() {
16319
+ return { fields: new Map() };
16320
+ }
16321
+ /**
16322
+ * @public
16323
+ */
16324
+ /**
16325
+ * @internal
16326
+ */
16327
+ const Struct = {
16328
+ encode(message, writer = _m0.Writer.create()) {
16329
+ message.fields.forEach((value, key) => {
16330
+ if (value !== undefined) {
16331
+ Struct_FieldsEntry.encode({ key: key, value }, writer.uint32(10).fork()).ldelim();
16332
+ }
16333
+ });
16334
+ return writer;
16335
+ },
16336
+ decode(input, length) {
16337
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
16338
+ let end = length === undefined ? reader.len : reader.pos + length;
16339
+ const message = createBaseStruct();
16340
+ while (reader.pos < end) {
16341
+ const tag = reader.uint32();
16342
+ switch (tag >>> 3) {
16343
+ case 1:
16344
+ const entry1 = Struct_FieldsEntry.decode(reader, reader.uint32());
16345
+ if (entry1.value !== undefined) {
16346
+ message.fields.set(entry1.key, entry1.value);
16347
+ }
16348
+ break;
16349
+ default:
16350
+ reader.skipType(tag & 7);
16351
+ break;
16352
+ }
16353
+ }
16354
+ return message;
16355
+ },
16356
+ fromJSON(object) {
16357
+ return {
16358
+ fields: isObject$1(object.fields)
16359
+ ? Object.entries(object.fields).reduce((acc, [key, value]) => {
16360
+ acc.set(key, value);
16361
+ return acc;
16362
+ }, new Map())
16363
+ : new Map(),
16364
+ };
16365
+ },
16366
+ toJSON(message) {
16367
+ const obj = {};
16368
+ obj.fields = {};
16369
+ if (message.fields) {
16370
+ message.fields.forEach((v, k) => {
16371
+ obj.fields[k] = v;
16372
+ });
16373
+ }
16374
+ return obj;
16375
+ },
16376
+ wrap(object) {
16377
+ const struct = createBaseStruct();
16378
+ if (object !== undefined) {
16379
+ Object.keys(object).forEach((key) => {
16380
+ struct.fields.set(key, object[key]);
16381
+ });
16382
+ }
16383
+ return struct;
16384
+ },
16385
+ unwrap(message) {
16386
+ const object = {};
16387
+ [...message.fields.keys()].forEach((key) => {
16388
+ object[key] = message.fields.get(key);
16389
+ });
16390
+ return object;
16391
+ },
16392
+ };
16393
+ function createBaseStruct_FieldsEntry() {
16394
+ return { key: "", value: undefined };
16395
+ }
16396
+ /**
16397
+ * @public
16398
+ */
16399
+ /**
16400
+ * @internal
16401
+ */
16402
+ const Struct_FieldsEntry = {
16403
+ encode(message, writer = _m0.Writer.create()) {
16404
+ if (message.key !== "") {
16405
+ writer.uint32(10).string(message.key);
16406
+ }
16407
+ if (message.value !== undefined) {
16408
+ Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).ldelim();
16409
+ }
16410
+ return writer;
16411
+ },
16412
+ decode(input, length) {
16413
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
16414
+ let end = length === undefined ? reader.len : reader.pos + length;
16415
+ const message = createBaseStruct_FieldsEntry();
16416
+ while (reader.pos < end) {
16417
+ const tag = reader.uint32();
16418
+ switch (tag >>> 3) {
16419
+ case 1:
16420
+ message.key = reader.string();
16421
+ break;
16422
+ case 2:
16423
+ message.value = Value.unwrap(Value.decode(reader, reader.uint32()));
16424
+ break;
16425
+ default:
16426
+ reader.skipType(tag & 7);
16427
+ break;
16428
+ }
16429
+ }
16430
+ return message;
16431
+ },
16432
+ fromJSON(object) {
16433
+ return { key: isSet$1(object.key) ? String(object.key) : "", value: isSet$1(object?.value) ? object.value : undefined };
16434
+ },
16435
+ toJSON(message) {
16436
+ const obj = {};
16437
+ message.key !== undefined && (obj.key = message.key);
16438
+ message.value !== undefined && (obj.value = message.value);
16439
+ return obj;
16440
+ },
16441
+ };
16442
+ function createBaseValue() {
16443
+ return { kind: undefined };
16444
+ }
16445
+ /**
16446
+ * @public
16447
+ */
16448
+ /**
16449
+ * @internal
16450
+ */
16451
+ const Value = {
16452
+ encode(message, writer = _m0.Writer.create()) {
16453
+ if (message.kind?.$case === "nullValue") {
16454
+ writer.uint32(8).int32(message.kind.nullValue);
16455
+ }
16456
+ if (message.kind?.$case === "numberValue") {
16457
+ writer.uint32(17).double(message.kind.numberValue);
16458
+ }
16459
+ if (message.kind?.$case === "stringValue") {
16460
+ writer.uint32(26).string(message.kind.stringValue);
16461
+ }
16462
+ if (message.kind?.$case === "boolValue") {
16463
+ writer.uint32(32).bool(message.kind.boolValue);
16464
+ }
16465
+ if (message.kind?.$case === "structValue") {
16466
+ Struct.encode(Struct.wrap(message.kind.structValue), writer.uint32(42).fork()).ldelim();
16467
+ }
16468
+ if (message.kind?.$case === "listValue") {
16469
+ ListValue.encode(ListValue.wrap(message.kind.listValue), writer.uint32(50).fork()).ldelim();
16470
+ }
16471
+ return writer;
16472
+ },
16473
+ decode(input, length) {
16474
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
16475
+ let end = length === undefined ? reader.len : reader.pos + length;
16476
+ const message = createBaseValue();
16477
+ while (reader.pos < end) {
16478
+ const tag = reader.uint32();
16479
+ switch (tag >>> 3) {
16480
+ case 1:
16481
+ message.kind = { $case: "nullValue", nullValue: reader.int32() };
16482
+ break;
16483
+ case 2:
16484
+ message.kind = { $case: "numberValue", numberValue: reader.double() };
16485
+ break;
16486
+ case 3:
16487
+ message.kind = { $case: "stringValue", stringValue: reader.string() };
16488
+ break;
16489
+ case 4:
16490
+ message.kind = { $case: "boolValue", boolValue: reader.bool() };
16491
+ break;
16492
+ case 5:
16493
+ message.kind = { $case: "structValue", structValue: Struct.unwrap(Struct.decode(reader, reader.uint32())) };
16494
+ break;
16495
+ case 6:
16496
+ message.kind = { $case: "listValue", listValue: ListValue.unwrap(ListValue.decode(reader, reader.uint32())) };
16497
+ break;
16498
+ default:
16499
+ reader.skipType(tag & 7);
16500
+ break;
16501
+ }
16502
+ }
16503
+ return message;
16504
+ },
16505
+ fromJSON(object) {
16506
+ return {
16507
+ kind: isSet$1(object.nullValue)
16508
+ ? { $case: "nullValue", nullValue: nullValueFromJSON(object.nullValue) }
16509
+ : isSet$1(object.numberValue)
16510
+ ? { $case: "numberValue", numberValue: Number(object.numberValue) }
16511
+ : isSet$1(object.stringValue)
16512
+ ? { $case: "stringValue", stringValue: String(object.stringValue) }
16513
+ : isSet$1(object.boolValue)
16514
+ ? { $case: "boolValue", boolValue: Boolean(object.boolValue) }
16515
+ : isSet$1(object.structValue)
16516
+ ? { $case: "structValue", structValue: object.structValue }
16517
+ : isSet$1(object.listValue)
16518
+ ? { $case: "listValue", listValue: [...object.listValue] }
16519
+ : undefined,
16520
+ };
16521
+ },
16522
+ toJSON(message) {
16523
+ const obj = {};
16524
+ message.kind?.$case === "nullValue" &&
16525
+ (obj.nullValue = message.kind?.nullValue !== undefined ? nullValueToJSON(message.kind?.nullValue) : undefined);
16526
+ message.kind?.$case === "numberValue" && (obj.numberValue = message.kind?.numberValue);
16527
+ message.kind?.$case === "stringValue" && (obj.stringValue = message.kind?.stringValue);
16528
+ message.kind?.$case === "boolValue" && (obj.boolValue = message.kind?.boolValue);
16529
+ message.kind?.$case === "structValue" && (obj.structValue = message.kind?.structValue);
16530
+ message.kind?.$case === "listValue" && (obj.listValue = message.kind?.listValue);
16531
+ return obj;
16532
+ },
16533
+ wrap(value) {
16534
+ const result = createBaseValue();
16535
+ if (value === null) {
16536
+ result.kind = { $case: "nullValue", nullValue: 0 /* NullValue.NULL_VALUE */ };
16537
+ }
16538
+ else if (typeof value === "boolean") {
16539
+ result.kind = { $case: "boolValue", boolValue: value };
16540
+ }
16541
+ else if (typeof value === "number") {
16542
+ result.kind = { $case: "numberValue", numberValue: value };
16543
+ }
16544
+ else if (typeof value === "string") {
16545
+ result.kind = { $case: "stringValue", stringValue: value };
16546
+ }
16547
+ else if (Array.isArray(value)) {
16548
+ result.kind = { $case: "listValue", listValue: value };
16549
+ }
16550
+ else if (typeof value === "object") {
16551
+ result.kind = { $case: "structValue", structValue: value };
16552
+ }
16553
+ else if (typeof value !== "undefined") {
16554
+ throw new Error("Unsupported any value type: " + typeof value);
16555
+ }
16556
+ return result;
16557
+ },
16558
+ unwrap(message) {
16559
+ if (message.kind?.$case === "nullValue") {
16560
+ return null;
16561
+ }
16562
+ else if (message.kind?.$case === "numberValue") {
16563
+ return message.kind?.numberValue;
16564
+ }
16565
+ else if (message.kind?.$case === "stringValue") {
16566
+ return message.kind?.stringValue;
16567
+ }
16568
+ else if (message.kind?.$case === "boolValue") {
16569
+ return message.kind?.boolValue;
16570
+ }
16571
+ else if (message.kind?.$case === "structValue") {
16572
+ return message.kind?.structValue;
16573
+ }
16574
+ else if (message.kind?.$case === "listValue") {
16575
+ return message.kind?.listValue;
16576
+ }
16577
+ else {
16578
+ return undefined;
16579
+ }
16580
+ },
16581
+ };
16582
+ function createBaseListValue() {
16583
+ return { values: [] };
16584
+ }
16585
+ /**
16586
+ * @public
16587
+ */
16588
+ /**
16589
+ * @internal
16590
+ */
16591
+ const ListValue = {
16592
+ encode(message, writer = _m0.Writer.create()) {
16593
+ for (const v of message.values) {
16594
+ Value.encode(Value.wrap(v), writer.uint32(10).fork()).ldelim();
16595
+ }
16596
+ return writer;
16597
+ },
16598
+ decode(input, length) {
16599
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
16600
+ let end = length === undefined ? reader.len : reader.pos + length;
16601
+ const message = createBaseListValue();
16602
+ while (reader.pos < end) {
16603
+ const tag = reader.uint32();
16604
+ switch (tag >>> 3) {
16605
+ case 1:
16606
+ message.values.push(Value.unwrap(Value.decode(reader, reader.uint32())));
16607
+ break;
16608
+ default:
16609
+ reader.skipType(tag & 7);
16610
+ break;
16611
+ }
16612
+ }
16613
+ return message;
16614
+ },
16615
+ fromJSON(object) {
16616
+ return { values: Array.isArray(object?.values) ? [...object.values] : [] };
16617
+ },
16618
+ toJSON(message) {
16619
+ const obj = {};
16620
+ if (message.values) {
16621
+ obj.values = message.values.map((e) => e);
16622
+ }
16623
+ else {
16624
+ obj.values = [];
16625
+ }
16626
+ return obj;
16627
+ },
16628
+ wrap(value) {
16629
+ const result = createBaseListValue();
16630
+ result.values = value ?? [];
16631
+ return result;
16632
+ },
16633
+ unwrap(message) {
16634
+ return message.values;
16635
+ },
16636
+ };
16637
+ var tsProtoGlobalThis$1 = (() => {
16638
+ if (typeof globalThis !== "undefined") {
16639
+ return globalThis;
16640
+ }
16641
+ if (typeof self !== "undefined") {
16642
+ return self;
16643
+ }
16644
+ if (typeof window !== "undefined") {
16645
+ return window;
16646
+ }
16647
+ if (typeof global !== "undefined") {
16648
+ return global;
16649
+ }
16650
+ throw "Unable to locate global object";
16651
+ })();
16652
+ function isObject$1(value) {
16653
+ return typeof value === "object" && value !== null;
16654
+ }
16655
+ function isSet$1(value) {
16656
+ return value !== null && value !== undefined;
16657
+ }
16658
+
16659
+ /* eslint-disable */
16660
+ function createBaseComponentData() {
16661
+ return { data: undefined };
16662
+ }
16663
+ /**
16664
+ * @public
16665
+ */
16666
+ /**
16667
+ * @internal
16668
+ */
16669
+ const ComponentData = {
16670
+ encode(message, writer = _m0.Writer.create()) {
16671
+ if (message.data?.$case === "json") {
16672
+ Value.encode(Value.wrap(message.data.json), writer.uint32(10).fork()).ldelim();
16673
+ }
16674
+ if (message.data?.$case === "binary") {
16675
+ writer.uint32(18).bytes(message.data.binary);
16676
+ }
16677
+ return writer;
16678
+ },
16679
+ decode(input, length) {
16680
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
16681
+ let end = length === undefined ? reader.len : reader.pos + length;
16682
+ const message = createBaseComponentData();
16683
+ while (reader.pos < end) {
16684
+ const tag = reader.uint32();
16685
+ switch (tag >>> 3) {
16686
+ case 1:
16687
+ message.data = { $case: "json", json: Value.unwrap(Value.decode(reader, reader.uint32())) };
16688
+ break;
16689
+ case 2:
16690
+ message.data = { $case: "binary", binary: reader.bytes() };
16691
+ break;
16692
+ default:
16693
+ reader.skipType(tag & 7);
16694
+ break;
16695
+ }
16696
+ }
16697
+ return message;
16698
+ },
16699
+ fromJSON(object) {
16700
+ return {
16701
+ data: isSet(object.json)
16702
+ ? { $case: "json", json: object.json }
16703
+ : isSet(object.binary)
16704
+ ? { $case: "binary", binary: bytesFromBase64(object.binary) }
16705
+ : undefined,
16706
+ };
16707
+ },
16708
+ toJSON(message) {
16709
+ const obj = {};
16710
+ message.data?.$case === "json" && (obj.json = message.data?.json);
16711
+ message.data?.$case === "binary" &&
16712
+ (obj.binary = message.data?.binary !== undefined ? base64FromBytes(message.data?.binary) : undefined);
16713
+ return obj;
16714
+ },
16715
+ };
16716
+ function createBaseCompositeComponent() {
16717
+ return { name: "", jsonSchema: undefined, data: new Map() };
16718
+ }
16719
+ /**
16720
+ * @public
16721
+ */
16722
+ /**
16723
+ * @internal
16724
+ */
16725
+ const CompositeComponent = {
16726
+ encode(message, writer = _m0.Writer.create()) {
16727
+ if (message.name !== "") {
16728
+ writer.uint32(10).string(message.name);
16729
+ }
16730
+ if (message.jsonSchema !== undefined) {
16731
+ Value.encode(Value.wrap(message.jsonSchema), writer.uint32(18).fork()).ldelim();
16732
+ }
16733
+ message.data.forEach((value, key) => {
16734
+ CompositeComponent_DataEntry.encode({ key: key, value }, writer.uint32(26).fork()).ldelim();
16312
16735
  });
16736
+ return writer;
16737
+ },
16738
+ decode(input, length) {
16739
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
16740
+ let end = length === undefined ? reader.len : reader.pos + length;
16741
+ const message = createBaseCompositeComponent();
16742
+ while (reader.pos < end) {
16743
+ const tag = reader.uint32();
16744
+ switch (tag >>> 3) {
16745
+ case 1:
16746
+ message.name = reader.string();
16747
+ break;
16748
+ case 2:
16749
+ message.jsonSchema = Value.unwrap(Value.decode(reader, reader.uint32()));
16750
+ break;
16751
+ case 3:
16752
+ const entry3 = CompositeComponent_DataEntry.decode(reader, reader.uint32());
16753
+ if (entry3.value !== undefined) {
16754
+ message.data.set(entry3.key, entry3.value);
16755
+ }
16756
+ break;
16757
+ default:
16758
+ reader.skipType(tag & 7);
16759
+ break;
16760
+ }
16761
+ }
16762
+ return message;
16763
+ },
16764
+ fromJSON(object) {
16765
+ return {
16766
+ name: isSet(object.name) ? String(object.name) : "",
16767
+ jsonSchema: isSet(object?.jsonSchema) ? object.jsonSchema : undefined,
16768
+ data: isObject(object.data)
16769
+ ? Object.entries(object.data).reduce((acc, [key, value]) => {
16770
+ acc.set(Number(key), ComponentData.fromJSON(value));
16771
+ return acc;
16772
+ }, new Map())
16773
+ : new Map(),
16774
+ };
16775
+ },
16776
+ toJSON(message) {
16777
+ const obj = {};
16778
+ message.name !== undefined && (obj.name = message.name);
16779
+ message.jsonSchema !== undefined && (obj.jsonSchema = message.jsonSchema);
16780
+ obj.data = {};
16781
+ if (message.data) {
16782
+ message.data.forEach((v, k) => {
16783
+ obj.data[k] = ComponentData.toJSON(v);
16784
+ });
16785
+ }
16786
+ return obj;
16787
+ },
16788
+ };
16789
+ function createBaseCompositeComponent_DataEntry() {
16790
+ return { key: 0, value: undefined };
16791
+ }
16792
+ /**
16793
+ * @public
16794
+ */
16795
+ /**
16796
+ * @internal
16797
+ */
16798
+ const CompositeComponent_DataEntry = {
16799
+ encode(message, writer = _m0.Writer.create()) {
16800
+ if (message.key !== 0) {
16801
+ writer.uint32(8).int32(message.key);
16802
+ }
16803
+ if (message.value !== undefined) {
16804
+ ComponentData.encode(message.value, writer.uint32(18).fork()).ldelim();
16805
+ }
16806
+ return writer;
16807
+ },
16808
+ decode(input, length) {
16809
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
16810
+ let end = length === undefined ? reader.len : reader.pos + length;
16811
+ const message = createBaseCompositeComponent_DataEntry();
16812
+ while (reader.pos < end) {
16813
+ const tag = reader.uint32();
16814
+ switch (tag >>> 3) {
16815
+ case 1:
16816
+ message.key = reader.int32();
16817
+ break;
16818
+ case 2:
16819
+ message.value = ComponentData.decode(reader, reader.uint32());
16820
+ break;
16821
+ default:
16822
+ reader.skipType(tag & 7);
16823
+ break;
16824
+ }
16825
+ }
16826
+ return message;
16827
+ },
16828
+ fromJSON(object) {
16829
+ return {
16830
+ key: isSet(object.key) ? Number(object.key) : 0,
16831
+ value: isSet(object.value) ? ComponentData.fromJSON(object.value) : undefined,
16832
+ };
16833
+ },
16834
+ toJSON(message) {
16835
+ const obj = {};
16836
+ message.key !== undefined && (obj.key = Math.round(message.key));
16837
+ message.value !== undefined && (obj.value = message.value ? ComponentData.toJSON(message.value) : undefined);
16838
+ return obj;
16839
+ },
16840
+ };
16841
+ function createBaseComposite() {
16842
+ return { id: "", components: [] };
16843
+ }
16844
+ /**
16845
+ * @public
16846
+ */
16847
+ /**
16848
+ * @internal
16849
+ */
16850
+ const Composite = {
16851
+ encode(message, writer = _m0.Writer.create()) {
16852
+ if (message.id !== "") {
16853
+ writer.uint32(10).string(message.id);
16854
+ }
16855
+ for (const v of message.components) {
16856
+ CompositeComponent.encode(v, writer.uint32(18).fork()).ldelim();
16857
+ }
16858
+ return writer;
16859
+ },
16860
+ decode(input, length) {
16861
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
16862
+ let end = length === undefined ? reader.len : reader.pos + length;
16863
+ const message = createBaseComposite();
16864
+ while (reader.pos < end) {
16865
+ const tag = reader.uint32();
16866
+ switch (tag >>> 3) {
16867
+ case 1:
16868
+ message.id = reader.string();
16869
+ break;
16870
+ case 2:
16871
+ message.components.push(CompositeComponent.decode(reader, reader.uint32()));
16872
+ break;
16873
+ default:
16874
+ reader.skipType(tag & 7);
16875
+ break;
16876
+ }
16877
+ }
16878
+ return message;
16879
+ },
16880
+ fromJSON(object) {
16881
+ return {
16882
+ id: isSet(object.id) ? String(object.id) : "",
16883
+ components: Array.isArray(object?.components)
16884
+ ? object.components.map((e) => CompositeComponent.fromJSON(e))
16885
+ : [],
16886
+ };
16887
+ },
16888
+ toJSON(message) {
16889
+ const obj = {};
16890
+ message.id !== undefined && (obj.id = message.id);
16891
+ if (message.components) {
16892
+ obj.components = message.components.map((e) => e ? CompositeComponent.toJSON(e) : undefined);
16893
+ }
16894
+ else {
16895
+ obj.components = [];
16896
+ }
16897
+ return obj;
16898
+ },
16899
+ };
16900
+ var tsProtoGlobalThis = (() => {
16901
+ if (typeof globalThis !== "undefined") {
16902
+ return globalThis;
16903
+ }
16904
+ if (typeof self !== "undefined") {
16905
+ return self;
16906
+ }
16907
+ if (typeof window !== "undefined") {
16908
+ return window;
16313
16909
  }
16314
- return composite;
16910
+ if (typeof global !== "undefined") {
16911
+ return global;
16912
+ }
16913
+ throw "Unable to locate global object";
16914
+ })();
16915
+ function bytesFromBase64(b64) {
16916
+ if (tsProtoGlobalThis.Buffer) {
16917
+ return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64"));
16918
+ }
16919
+ else {
16920
+ const bin = tsProtoGlobalThis.atob(b64);
16921
+ const arr = new Uint8Array(bin.length);
16922
+ for (let i = 0; i < bin.length; ++i) {
16923
+ arr[i] = bin.charCodeAt(i);
16924
+ }
16925
+ return arr;
16926
+ }
16927
+ }
16928
+ function base64FromBytes(arr) {
16929
+ if (tsProtoGlobalThis.Buffer) {
16930
+ return tsProtoGlobalThis.Buffer.from(arr).toString("base64");
16931
+ }
16932
+ else {
16933
+ const bin = [];
16934
+ arr.forEach((byte) => {
16935
+ bin.push(String.fromCharCode(byte));
16936
+ });
16937
+ return tsProtoGlobalThis.btoa(bin.join(""));
16938
+ }
16939
+ }
16940
+ function isObject(value) {
16941
+ return typeof value === "object" && value !== null;
16942
+ }
16943
+ function isSet(value) {
16944
+ return value !== null && value !== undefined;
16945
+ }
16946
+
16947
+ /* @public @deprecated */
16948
+ function compositeFromJson(object) {
16949
+ return Composite.fromJSON(object);
16950
+ }
16951
+ /* @public @deprecated */
16952
+ function compositeFromBinary(buffer) {
16953
+ return Composite.decode(buffer);
16315
16954
  }
16316
16955
 
16317
16956
  /**
@@ -16332,8 +16971,47 @@
16332
16971
  });
16333
16972
  }
16334
16973
 
16974
+ /**
16975
+ * Return the component value from composite data
16976
+ * @internal
16977
+ */
16978
+ function getComponentValue(componentDefinition, component) {
16979
+ if (component.data?.$case === 'json') {
16980
+ return component.data.json;
16981
+ }
16982
+ else {
16983
+ return componentDefinition.schema.deserialize(new ReadWriteByteBuffer(component.data?.binary));
16984
+ }
16985
+ }
16986
+ /**
16987
+ * Return the component definition from composite info
16988
+ * @internal
16989
+ */
16990
+ function getComponentDefinition(engine, component) {
16991
+ const existingComponentDefinition = engine.getComponentOrNull(component.name);
16992
+ if (!existingComponentDefinition) {
16993
+ if (component.jsonSchema) {
16994
+ return engine.defineComponentFromSchema(component.name, exports.Schemas.fromJson(component.jsonSchema));
16995
+ }
16996
+ else if (component.name.startsWith('core::')) {
16997
+ if (component.name in componentDefinitionByName) {
16998
+ return componentDefinitionByName[component.name](engine);
16999
+ }
17000
+ else {
17001
+ throw new Error(`The core component ${component.name} was not found.`);
17002
+ }
17003
+ }
17004
+ else {
17005
+ throw new Error(`${component.name} is not defined and there is no schema to define it.`);
17006
+ }
17007
+ }
17008
+ else {
17009
+ return existingComponentDefinition;
17010
+ }
17011
+ }
16335
17012
  /**
16336
17013
  * Return the entity mapping or fail if there is no more
17014
+ * @internal
16337
17015
  */
16338
17016
  function getEntityMapping(compositeEntity, mappedEntities, getNextAvailableEntity) {
16339
17017
  const existingEntity = mappedEntities.get(compositeEntity);
@@ -16380,7 +17058,7 @@
16380
17058
  const childrenComposite = compositeData.components.find((item) => item.name === CompositeRootComponent.componentName);
16381
17059
  if (childrenComposite) {
16382
17060
  for (const [entity, childComposite] of childrenComposite.data) {
16383
- const compositeRoot = childComposite;
17061
+ const compositeRoot = getComponentValue(CompositeRootComponent, childComposite);
16384
17062
  const composite = compositeProvider.getCompositeOrNull(compositeRoot.id);
16385
17063
  if (composite) {
16386
17064
  if (alreadyRequestedId.has(compositeRoot.id) || compositeRoot.id === compositeData.id) {
@@ -16398,32 +17076,13 @@
16398
17076
  continue;
16399
17077
  // ## 3a ##
16400
17078
  // We find the component definition
16401
- let componentDefinition;
16402
- const existingComponentDefinition = engine.getComponentOrNull(component.name);
16403
- if (!existingComponentDefinition) {
16404
- if (component.schema) {
16405
- componentDefinition = engine.defineComponentFromSchema(component.name, exports.Schemas.fromJson(component.schema));
16406
- }
16407
- else if (component.name.startsWith('core::')) {
16408
- if (component.name in componentDefinitionByName) {
16409
- componentDefinition = componentDefinitionByName[component.name](engine);
16410
- }
16411
- else {
16412
- throw new Error(`The core component ${component.name} was not found.`);
16413
- }
16414
- }
16415
- else {
16416
- throw new Error(`${component.name} is not defined and there is no schema to define it.`);
16417
- }
16418
- }
16419
- else {
16420
- componentDefinition = existingComponentDefinition;
16421
- }
17079
+ const componentDefinition = getComponentDefinition(engine, component);
16422
17080
  // ## 3b ##
16423
17081
  // Iterating over all the entities with this component and create the replica
16424
17082
  for (const [entity, compositeComponentValue] of component.data) {
17083
+ const componentValueDeserialized = getComponentValue(componentDefinition, compositeComponentValue);
16425
17084
  const targetEntity = getCompositeEntity(entity);
16426
- const componentValue = componentDefinition.create(targetEntity, compositeComponentValue);
17085
+ const componentValue = componentDefinition.create(targetEntity, componentValueDeserialized);
16427
17086
  // ## 3c ##
16428
17087
  // All entities referenced in the composite probably has a different resolved EntityNumber
16429
17088
  // We'll know with the mappedEntityes
@@ -43117,6 +43776,7 @@
43117
43776
  exports.CRDT_MESSAGE_HEADER_LENGTH = CRDT_MESSAGE_HEADER_LENGTH;
43118
43777
  exports.CameraMode = CameraMode;
43119
43778
  exports.CameraModeArea = CameraModeArea;
43779
+ exports.Composite = Composite;
43120
43780
  exports.DEG2RAD = DEG2RAD;
43121
43781
  exports.Dropdown = Dropdown;
43122
43782
  exports.Engine = Engine;
@@ -43206,6 +43866,7 @@
43206
43866
  exports.VisibilityComponent = VisibilityComponent;
43207
43867
  exports.componentDefinitionByName = componentDefinitionByName;
43208
43868
  exports.components = index;
43869
+ exports.compositeFromBinary = compositeFromBinary;
43209
43870
  exports.compositeFromJson = compositeFromJson;
43210
43871
  exports.createEthereumProvider = createEthereumProvider;
43211
43872
  exports.createInputSystem = createInputSystem;