@stinkycomputing/sesame-api-client 1.4.1-beta.1 → 1.4.1-beta.3

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.cjs CHANGED
@@ -13361,15 +13361,22 @@ var sesame = $root.sesame = (() => {
13361
13361
  }
13362
13362
  TransportEvent.prototype.sourceId = "";
13363
13363
  TransportEvent.prototype.userId = "";
13364
+ TransportEvent.prototype.uri = "";
13364
13365
  TransportEvent.prototype.state = 0;
13365
13366
  TransportEvent.prototype.durationUs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
13366
13367
  TransportEvent.prototype.positionUs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
13367
13368
  TransportEvent.prototype.materialPositionUs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
13369
+ TransportEvent.prototype.userTimeMs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
13370
+ TransportEvent.prototype.speed = 0;
13368
13371
  TransportEvent.prototype.userPlaylistId = "";
13369
13372
  TransportEvent.prototype.playlistIndex = 0;
13370
13373
  TransportEvent.prototype.playlistLength = 0;
13371
13374
  TransportEvent.prototype.clipId = $util.Long ? $util.Long.fromBits(0, 0, true) : 0;
13372
13375
  TransportEvent.prototype.clipPositionUs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
13376
+ TransportEvent.prototype.clipDurationUs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
13377
+ TransportEvent.prototype.preroll = 0;
13378
+ TransportEvent.prototype.postroll = 0;
13379
+ TransportEvent.prototype.metadata = "";
13373
13380
  TransportEvent.create = function create(properties) {
13374
13381
  return new TransportEvent(properties);
13375
13382
  };
@@ -13386,51 +13393,86 @@ var sesame = $root.sesame = (() => {
13386
13393
  /* id 2, wireType 2 =*/
13387
13394
  18
13388
13395
  ).string(message.userId);
13396
+ if (message.uri != null && Object.hasOwnProperty.call(message, "uri"))
13397
+ writer.uint32(
13398
+ /* id 3, wireType 2 =*/
13399
+ 26
13400
+ ).string(message.uri);
13389
13401
  if (message.state != null && Object.hasOwnProperty.call(message, "state"))
13390
13402
  writer.uint32(
13391
- /* id 3, wireType 0 =*/
13392
- 24
13403
+ /* id 4, wireType 0 =*/
13404
+ 32
13393
13405
  ).int32(message.state);
13394
13406
  if (message.durationUs != null && Object.hasOwnProperty.call(message, "durationUs"))
13395
13407
  writer.uint32(
13396
- /* id 4, wireType 0 =*/
13397
- 32
13408
+ /* id 5, wireType 0 =*/
13409
+ 40
13398
13410
  ).int64(message.durationUs);
13399
13411
  if (message.positionUs != null && Object.hasOwnProperty.call(message, "positionUs"))
13400
13412
  writer.uint32(
13401
- /* id 5, wireType 0 =*/
13402
- 40
13413
+ /* id 6, wireType 0 =*/
13414
+ 48
13403
13415
  ).int64(message.positionUs);
13404
13416
  if (message.materialPositionUs != null && Object.hasOwnProperty.call(message, "materialPositionUs"))
13405
13417
  writer.uint32(
13406
- /* id 6, wireType 0 =*/
13407
- 48
13418
+ /* id 7, wireType 0 =*/
13419
+ 56
13408
13420
  ).int64(message.materialPositionUs);
13421
+ if (message.userTimeMs != null && Object.hasOwnProperty.call(message, "userTimeMs"))
13422
+ writer.uint32(
13423
+ /* id 8, wireType 0 =*/
13424
+ 64
13425
+ ).int64(message.userTimeMs);
13426
+ if (message.speed != null && Object.hasOwnProperty.call(message, "speed"))
13427
+ writer.uint32(
13428
+ /* id 9, wireType 5 =*/
13429
+ 77
13430
+ ).float(message.speed);
13409
13431
  if (message.userPlaylistId != null && Object.hasOwnProperty.call(message, "userPlaylistId"))
13410
13432
  writer.uint32(
13411
- /* id 7, wireType 2 =*/
13412
- 58
13433
+ /* id 10, wireType 2 =*/
13434
+ 82
13413
13435
  ).string(message.userPlaylistId);
13414
13436
  if (message.playlistIndex != null && Object.hasOwnProperty.call(message, "playlistIndex"))
13415
13437
  writer.uint32(
13416
- /* id 8, wireType 0 =*/
13417
- 64
13438
+ /* id 11, wireType 0 =*/
13439
+ 88
13418
13440
  ).uint32(message.playlistIndex);
13419
13441
  if (message.playlistLength != null && Object.hasOwnProperty.call(message, "playlistLength"))
13420
13442
  writer.uint32(
13421
- /* id 9, wireType 0 =*/
13422
- 72
13443
+ /* id 12, wireType 0 =*/
13444
+ 96
13423
13445
  ).uint32(message.playlistLength);
13424
13446
  if (message.clipId != null && Object.hasOwnProperty.call(message, "clipId"))
13425
13447
  writer.uint32(
13426
- /* id 10, wireType 0 =*/
13427
- 80
13448
+ /* id 13, wireType 0 =*/
13449
+ 104
13428
13450
  ).uint64(message.clipId);
13429
13451
  if (message.clipPositionUs != null && Object.hasOwnProperty.call(message, "clipPositionUs"))
13430
13452
  writer.uint32(
13431
- /* id 11, wireType 0 =*/
13432
- 88
13453
+ /* id 14, wireType 0 =*/
13454
+ 112
13433
13455
  ).int64(message.clipPositionUs);
13456
+ if (message.clipDurationUs != null && Object.hasOwnProperty.call(message, "clipDurationUs"))
13457
+ writer.uint32(
13458
+ /* id 15, wireType 0 =*/
13459
+ 120
13460
+ ).int64(message.clipDurationUs);
13461
+ if (message.preroll != null && Object.hasOwnProperty.call(message, "preroll"))
13462
+ writer.uint32(
13463
+ /* id 16, wireType 0 =*/
13464
+ 128
13465
+ ).uint32(message.preroll);
13466
+ if (message.postroll != null && Object.hasOwnProperty.call(message, "postroll"))
13467
+ writer.uint32(
13468
+ /* id 17, wireType 0 =*/
13469
+ 136
13470
+ ).uint32(message.postroll);
13471
+ if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata"))
13472
+ writer.uint32(
13473
+ /* id 18, wireType 2 =*/
13474
+ 146
13475
+ ).string(message.metadata);
13434
13476
  return writer;
13435
13477
  };
13436
13478
  TransportEvent.encodeDelimited = function encodeDelimited(message, writer) {
@@ -13454,41 +13496,69 @@ var sesame = $root.sesame = (() => {
13454
13496
  break;
13455
13497
  }
13456
13498
  case 3: {
13457
- message.state = reader.int32();
13499
+ message.uri = reader.string();
13458
13500
  break;
13459
13501
  }
13460
13502
  case 4: {
13461
- message.durationUs = reader.int64();
13503
+ message.state = reader.int32();
13462
13504
  break;
13463
13505
  }
13464
13506
  case 5: {
13465
- message.positionUs = reader.int64();
13507
+ message.durationUs = reader.int64();
13466
13508
  break;
13467
13509
  }
13468
13510
  case 6: {
13469
- message.materialPositionUs = reader.int64();
13511
+ message.positionUs = reader.int64();
13470
13512
  break;
13471
13513
  }
13472
13514
  case 7: {
13473
- message.userPlaylistId = reader.string();
13515
+ message.materialPositionUs = reader.int64();
13474
13516
  break;
13475
13517
  }
13476
13518
  case 8: {
13477
- message.playlistIndex = reader.uint32();
13519
+ message.userTimeMs = reader.int64();
13478
13520
  break;
13479
13521
  }
13480
13522
  case 9: {
13481
- message.playlistLength = reader.uint32();
13523
+ message.speed = reader.float();
13482
13524
  break;
13483
13525
  }
13484
13526
  case 10: {
13485
- message.clipId = reader.uint64();
13527
+ message.userPlaylistId = reader.string();
13486
13528
  break;
13487
13529
  }
13488
13530
  case 11: {
13531
+ message.playlistIndex = reader.uint32();
13532
+ break;
13533
+ }
13534
+ case 12: {
13535
+ message.playlistLength = reader.uint32();
13536
+ break;
13537
+ }
13538
+ case 13: {
13539
+ message.clipId = reader.uint64();
13540
+ break;
13541
+ }
13542
+ case 14: {
13489
13543
  message.clipPositionUs = reader.int64();
13490
13544
  break;
13491
13545
  }
13546
+ case 15: {
13547
+ message.clipDurationUs = reader.int64();
13548
+ break;
13549
+ }
13550
+ case 16: {
13551
+ message.preroll = reader.uint32();
13552
+ break;
13553
+ }
13554
+ case 17: {
13555
+ message.postroll = reader.uint32();
13556
+ break;
13557
+ }
13558
+ case 18: {
13559
+ message.metadata = reader.string();
13560
+ break;
13561
+ }
13492
13562
  default:
13493
13563
  reader.skipType(tag & 7);
13494
13564
  break;
@@ -13512,6 +13582,10 @@ var sesame = $root.sesame = (() => {
13512
13582
  if (!$util.isString(message.userId))
13513
13583
  return "userId: string expected";
13514
13584
  }
13585
+ if (message.uri != null && message.hasOwnProperty("uri")) {
13586
+ if (!$util.isString(message.uri))
13587
+ return "uri: string expected";
13588
+ }
13515
13589
  if (message.state != null && message.hasOwnProperty("state"))
13516
13590
  switch (message.state) {
13517
13591
  default:
@@ -13535,6 +13609,14 @@ var sesame = $root.sesame = (() => {
13535
13609
  if (!$util.isInteger(message.materialPositionUs) && !(message.materialPositionUs && $util.isInteger(message.materialPositionUs.low) && $util.isInteger(message.materialPositionUs.high)))
13536
13610
  return "materialPositionUs: integer|Long expected";
13537
13611
  }
13612
+ if (message.userTimeMs != null && message.hasOwnProperty("userTimeMs")) {
13613
+ if (!$util.isInteger(message.userTimeMs) && !(message.userTimeMs && $util.isInteger(message.userTimeMs.low) && $util.isInteger(message.userTimeMs.high)))
13614
+ return "userTimeMs: integer|Long expected";
13615
+ }
13616
+ if (message.speed != null && message.hasOwnProperty("speed")) {
13617
+ if (typeof message.speed !== "number")
13618
+ return "speed: number expected";
13619
+ }
13538
13620
  if (message.userPlaylistId != null && message.hasOwnProperty("userPlaylistId")) {
13539
13621
  if (!$util.isString(message.userPlaylistId))
13540
13622
  return "userPlaylistId: string expected";
@@ -13555,6 +13637,22 @@ var sesame = $root.sesame = (() => {
13555
13637
  if (!$util.isInteger(message.clipPositionUs) && !(message.clipPositionUs && $util.isInteger(message.clipPositionUs.low) && $util.isInteger(message.clipPositionUs.high)))
13556
13638
  return "clipPositionUs: integer|Long expected";
13557
13639
  }
13640
+ if (message.clipDurationUs != null && message.hasOwnProperty("clipDurationUs")) {
13641
+ if (!$util.isInteger(message.clipDurationUs) && !(message.clipDurationUs && $util.isInteger(message.clipDurationUs.low) && $util.isInteger(message.clipDurationUs.high)))
13642
+ return "clipDurationUs: integer|Long expected";
13643
+ }
13644
+ if (message.preroll != null && message.hasOwnProperty("preroll")) {
13645
+ if (!$util.isInteger(message.preroll))
13646
+ return "preroll: integer expected";
13647
+ }
13648
+ if (message.postroll != null && message.hasOwnProperty("postroll")) {
13649
+ if (!$util.isInteger(message.postroll))
13650
+ return "postroll: integer expected";
13651
+ }
13652
+ if (message.metadata != null && message.hasOwnProperty("metadata")) {
13653
+ if (!$util.isString(message.metadata))
13654
+ return "metadata: string expected";
13655
+ }
13558
13656
  return null;
13559
13657
  };
13560
13658
  TransportEvent.fromObject = function fromObject(object) {
@@ -13565,6 +13663,8 @@ var sesame = $root.sesame = (() => {
13565
13663
  message.sourceId = String(object.sourceId);
13566
13664
  if (object.userId != null)
13567
13665
  message.userId = String(object.userId);
13666
+ if (object.uri != null)
13667
+ message.uri = String(object.uri);
13568
13668
  switch (object.state) {
13569
13669
  default:
13570
13670
  if (typeof object.state === "number") {
@@ -13623,6 +13723,18 @@ var sesame = $root.sesame = (() => {
13623
13723
  else if (typeof object.materialPositionUs === "object")
13624
13724
  message.materialPositionUs = new $util.LongBits(object.materialPositionUs.low >>> 0, object.materialPositionUs.high >>> 0).toNumber();
13625
13725
  }
13726
+ if (object.userTimeMs != null) {
13727
+ if ($util.Long)
13728
+ (message.userTimeMs = $util.Long.fromValue(object.userTimeMs)).unsigned = false;
13729
+ else if (typeof object.userTimeMs === "string")
13730
+ message.userTimeMs = parseInt(object.userTimeMs, 10);
13731
+ else if (typeof object.userTimeMs === "number")
13732
+ message.userTimeMs = object.userTimeMs;
13733
+ else if (typeof object.userTimeMs === "object")
13734
+ message.userTimeMs = new $util.LongBits(object.userTimeMs.low >>> 0, object.userTimeMs.high >>> 0).toNumber();
13735
+ }
13736
+ if (object.speed != null)
13737
+ message.speed = Number(object.speed);
13626
13738
  if (object.userPlaylistId != null)
13627
13739
  message.userPlaylistId = String(object.userPlaylistId);
13628
13740
  if (object.playlistIndex != null)
@@ -13649,6 +13761,22 @@ var sesame = $root.sesame = (() => {
13649
13761
  else if (typeof object.clipPositionUs === "object")
13650
13762
  message.clipPositionUs = new $util.LongBits(object.clipPositionUs.low >>> 0, object.clipPositionUs.high >>> 0).toNumber();
13651
13763
  }
13764
+ if (object.clipDurationUs != null) {
13765
+ if ($util.Long)
13766
+ (message.clipDurationUs = $util.Long.fromValue(object.clipDurationUs)).unsigned = false;
13767
+ else if (typeof object.clipDurationUs === "string")
13768
+ message.clipDurationUs = parseInt(object.clipDurationUs, 10);
13769
+ else if (typeof object.clipDurationUs === "number")
13770
+ message.clipDurationUs = object.clipDurationUs;
13771
+ else if (typeof object.clipDurationUs === "object")
13772
+ message.clipDurationUs = new $util.LongBits(object.clipDurationUs.low >>> 0, object.clipDurationUs.high >>> 0).toNumber();
13773
+ }
13774
+ if (object.preroll != null)
13775
+ message.preroll = object.preroll >>> 0;
13776
+ if (object.postroll != null)
13777
+ message.postroll = object.postroll >>> 0;
13778
+ if (object.metadata != null)
13779
+ message.metadata = String(object.metadata);
13652
13780
  return message;
13653
13781
  };
13654
13782
  TransportEvent.toObject = function toObject(message, options) {
@@ -13658,6 +13786,7 @@ var sesame = $root.sesame = (() => {
13658
13786
  if (options.defaults) {
13659
13787
  object.sourceId = "";
13660
13788
  object.userId = "";
13789
+ object.uri = "";
13661
13790
  object.state = options.enums === String ? "SOURCE_TRANSPORT_STATE_STOPPED" : 0;
13662
13791
  if ($util.Long) {
13663
13792
  let long = new $util.Long(0, 0, false);
@@ -13674,6 +13803,12 @@ var sesame = $root.sesame = (() => {
13674
13803
  object.materialPositionUs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
13675
13804
  } else
13676
13805
  object.materialPositionUs = options.longs === String ? "0" : 0;
13806
+ if ($util.Long) {
13807
+ let long = new $util.Long(0, 0, false);
13808
+ object.userTimeMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
13809
+ } else
13810
+ object.userTimeMs = options.longs === String ? "0" : 0;
13811
+ object.speed = 0;
13677
13812
  object.userPlaylistId = "";
13678
13813
  object.playlistIndex = 0;
13679
13814
  object.playlistLength = 0;
@@ -13687,11 +13822,21 @@ var sesame = $root.sesame = (() => {
13687
13822
  object.clipPositionUs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
13688
13823
  } else
13689
13824
  object.clipPositionUs = options.longs === String ? "0" : 0;
13825
+ if ($util.Long) {
13826
+ let long = new $util.Long(0, 0, false);
13827
+ object.clipDurationUs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
13828
+ } else
13829
+ object.clipDurationUs = options.longs === String ? "0" : 0;
13830
+ object.preroll = 0;
13831
+ object.postroll = 0;
13832
+ object.metadata = "";
13690
13833
  }
13691
13834
  if (message.sourceId != null && message.hasOwnProperty("sourceId"))
13692
13835
  object.sourceId = message.sourceId;
13693
13836
  if (message.userId != null && message.hasOwnProperty("userId"))
13694
13837
  object.userId = message.userId;
13838
+ if (message.uri != null && message.hasOwnProperty("uri"))
13839
+ object.uri = message.uri;
13695
13840
  if (message.state != null && message.hasOwnProperty("state"))
13696
13841
  object.state = options.enums === String ? $root.sesame.v1.sources.SourceTransportState[message.state] === void 0 ? message.state : $root.sesame.v1.sources.SourceTransportState[message.state] : message.state;
13697
13842
  if (message.durationUs != null && message.hasOwnProperty("durationUs"))
@@ -13709,6 +13854,13 @@ var sesame = $root.sesame = (() => {
13709
13854
  object.materialPositionUs = options.longs === String ? String(message.materialPositionUs) : message.materialPositionUs;
13710
13855
  else
13711
13856
  object.materialPositionUs = options.longs === String ? $util.Long.prototype.toString.call(message.materialPositionUs) : options.longs === Number ? new $util.LongBits(message.materialPositionUs.low >>> 0, message.materialPositionUs.high >>> 0).toNumber() : message.materialPositionUs;
13857
+ if (message.userTimeMs != null && message.hasOwnProperty("userTimeMs"))
13858
+ if (typeof message.userTimeMs === "number")
13859
+ object.userTimeMs = options.longs === String ? String(message.userTimeMs) : message.userTimeMs;
13860
+ else
13861
+ object.userTimeMs = options.longs === String ? $util.Long.prototype.toString.call(message.userTimeMs) : options.longs === Number ? new $util.LongBits(message.userTimeMs.low >>> 0, message.userTimeMs.high >>> 0).toNumber() : message.userTimeMs;
13862
+ if (message.speed != null && message.hasOwnProperty("speed"))
13863
+ object.speed = options.json && !isFinite(message.speed) ? String(message.speed) : message.speed;
13712
13864
  if (message.userPlaylistId != null && message.hasOwnProperty("userPlaylistId"))
13713
13865
  object.userPlaylistId = message.userPlaylistId;
13714
13866
  if (message.playlistIndex != null && message.hasOwnProperty("playlistIndex"))
@@ -13725,6 +13877,17 @@ var sesame = $root.sesame = (() => {
13725
13877
  object.clipPositionUs = options.longs === String ? String(message.clipPositionUs) : message.clipPositionUs;
13726
13878
  else
13727
13879
  object.clipPositionUs = options.longs === String ? $util.Long.prototype.toString.call(message.clipPositionUs) : options.longs === Number ? new $util.LongBits(message.clipPositionUs.low >>> 0, message.clipPositionUs.high >>> 0).toNumber() : message.clipPositionUs;
13880
+ if (message.clipDurationUs != null && message.hasOwnProperty("clipDurationUs"))
13881
+ if (typeof message.clipDurationUs === "number")
13882
+ object.clipDurationUs = options.longs === String ? String(message.clipDurationUs) : message.clipDurationUs;
13883
+ else
13884
+ object.clipDurationUs = options.longs === String ? $util.Long.prototype.toString.call(message.clipDurationUs) : options.longs === Number ? new $util.LongBits(message.clipDurationUs.low >>> 0, message.clipDurationUs.high >>> 0).toNumber() : message.clipDurationUs;
13885
+ if (message.preroll != null && message.hasOwnProperty("preroll"))
13886
+ object.preroll = message.preroll;
13887
+ if (message.postroll != null && message.hasOwnProperty("postroll"))
13888
+ object.postroll = message.postroll;
13889
+ if (message.metadata != null && message.hasOwnProperty("metadata"))
13890
+ object.metadata = message.metadata;
13728
13891
  return object;
13729
13892
  };
13730
13893
  TransportEvent.prototype.toJSON = function toJSON() {
@@ -21121,6 +21284,7 @@ var sesame = $root.sesame = (() => {
21121
21284
  values[valuesById[3] = "FRAME_TYPE_AUDIO"] = 3;
21122
21285
  values[valuesById[4] = "FRAME_TYPE_MUXED"] = 4;
21123
21286
  values[valuesById[5] = "FRAME_TYPE_DECODER_DATA"] = 5;
21287
+ values[valuesById[6] = "FRAME_TYPE_DATA"] = 6;
21124
21288
  return values;
21125
21289
  }();
21126
21290
  wire.CodecType = function() {
@@ -21562,6 +21726,7 @@ var sesame = $root.sesame = (() => {
21562
21726
  case 3:
21563
21727
  case 4:
21564
21728
  case 5:
21729
+ case 6:
21565
21730
  break;
21566
21731
  }
21567
21732
  if (message.pts != null && message.hasOwnProperty("pts")) {
@@ -21622,6 +21787,10 @@ var sesame = $root.sesame = (() => {
21622
21787
  case 5:
21623
21788
  message.type = 5;
21624
21789
  break;
21790
+ case "FRAME_TYPE_DATA":
21791
+ case 6:
21792
+ message.type = 6;
21793
+ break;
21625
21794
  }
21626
21795
  if (object.pts != null) {
21627
21796
  if ($util.Long)
@@ -22114,10 +22283,33 @@ var RPCClient = class extends import_events.EventEmitter {
22114
22283
  this.connection.on("rpc", (data) => this.messageHandler(data));
22115
22284
  this.connection.on("error", this.errorHandler);
22116
22285
  this.options = options;
22117
- this.service = service.create(this.rpcImpl);
22286
+ this.service = this.wrapServicePromises(service.create(this.rpcImpl));
22118
22287
  this.eventTypes = options.eventTypes || {};
22119
22288
  this.sendTimeout = options.sendTimeout || 5 * 1e3;
22120
22289
  }
22290
+ /**
22291
+ * Wraps service method calls to attach a rejection handler on all returned
22292
+ * promises. This prevents unhandled promise rejections (e.g. from timeouts
22293
+ * while disconnected) from crashing the host process. Callers can still
22294
+ * catch errors normally via await / .catch().
22295
+ */
22296
+ wrapServicePromises(service) {
22297
+ const self = this;
22298
+ return new Proxy(service, {
22299
+ get(target, prop) {
22300
+ const value = target[prop];
22301
+ if (typeof value !== "function") return value;
22302
+ return function(...args) {
22303
+ const result = value.apply(target, args);
22304
+ if (result != null && typeof result.catch === "function") {
22305
+ result.catch(() => {
22306
+ });
22307
+ }
22308
+ return result;
22309
+ };
22310
+ }
22311
+ });
22312
+ }
22121
22313
  async flushMessageBuffer() {
22122
22314
  const messages = [];
22123
22315
  for (const seq in this.messageBuffer) {