@stinkycomputing/sesame-api-client 1.4.1-beta.6 → 1.4.1-beta.8

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.
@@ -8574,7 +8574,7 @@ var sesame = $root.sesame = (() => {
8574
8574
  RecorderClip.prototype.endTimeUs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
8575
8575
  RecorderClip.prototype.lockedStartUs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
8576
8576
  RecorderClip.prototype.lockedEndUs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
8577
- RecorderClip.prototype.userTimeMs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
8577
+ RecorderClip.prototype.userTimeUs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
8578
8578
  RecorderClip.create = function create(properties) {
8579
8579
  return new RecorderClip(properties);
8580
8580
  };
@@ -8621,11 +8621,11 @@ var sesame = $root.sesame = (() => {
8621
8621
  /* id 8, wireType 0 =*/
8622
8622
  64
8623
8623
  ).int64(message.lockedEndUs);
8624
- if (message.userTimeMs != null && Object.hasOwnProperty.call(message, "userTimeMs"))
8624
+ if (message.userTimeUs != null && Object.hasOwnProperty.call(message, "userTimeUs"))
8625
8625
  writer.uint32(
8626
8626
  /* id 9, wireType 0 =*/
8627
8627
  72
8628
- ).int64(message.userTimeMs);
8628
+ ).int64(message.userTimeUs);
8629
8629
  return writer;
8630
8630
  };
8631
8631
  RecorderClip.encodeDelimited = function encodeDelimited(message, writer) {
@@ -8673,7 +8673,7 @@ var sesame = $root.sesame = (() => {
8673
8673
  break;
8674
8674
  }
8675
8675
  case 9: {
8676
- message.userTimeMs = reader.int64();
8676
+ message.userTimeUs = reader.int64();
8677
8677
  break;
8678
8678
  }
8679
8679
  default:
@@ -8723,9 +8723,9 @@ var sesame = $root.sesame = (() => {
8723
8723
  if (!$util.isInteger(message.lockedEndUs) && !(message.lockedEndUs && $util.isInteger(message.lockedEndUs.low) && $util.isInteger(message.lockedEndUs.high)))
8724
8724
  return "lockedEndUs: integer|Long expected";
8725
8725
  }
8726
- if (message.userTimeMs != null && message.hasOwnProperty("userTimeMs")) {
8727
- if (!$util.isInteger(message.userTimeMs) && !(message.userTimeMs && $util.isInteger(message.userTimeMs.low) && $util.isInteger(message.userTimeMs.high)))
8728
- return "userTimeMs: integer|Long expected";
8726
+ if (message.userTimeUs != null && message.hasOwnProperty("userTimeUs")) {
8727
+ if (!$util.isInteger(message.userTimeUs) && !(message.userTimeUs && $util.isInteger(message.userTimeUs.low) && $util.isInteger(message.userTimeUs.high)))
8728
+ return "userTimeUs: integer|Long expected";
8729
8729
  }
8730
8730
  return null;
8731
8731
  };
@@ -8797,15 +8797,15 @@ var sesame = $root.sesame = (() => {
8797
8797
  else if (typeof object.lockedEndUs === "object")
8798
8798
  message.lockedEndUs = new $util.LongBits(object.lockedEndUs.low >>> 0, object.lockedEndUs.high >>> 0).toNumber();
8799
8799
  }
8800
- if (object.userTimeMs != null) {
8800
+ if (object.userTimeUs != null) {
8801
8801
  if ($util.Long)
8802
- (message.userTimeMs = $util.Long.fromValue(object.userTimeMs)).unsigned = false;
8803
- else if (typeof object.userTimeMs === "string")
8804
- message.userTimeMs = parseInt(object.userTimeMs, 10);
8805
- else if (typeof object.userTimeMs === "number")
8806
- message.userTimeMs = object.userTimeMs;
8807
- else if (typeof object.userTimeMs === "object")
8808
- message.userTimeMs = new $util.LongBits(object.userTimeMs.low >>> 0, object.userTimeMs.high >>> 0).toNumber();
8802
+ (message.userTimeUs = $util.Long.fromValue(object.userTimeUs)).unsigned = false;
8803
+ else if (typeof object.userTimeUs === "string")
8804
+ message.userTimeUs = parseInt(object.userTimeUs, 10);
8805
+ else if (typeof object.userTimeUs === "number")
8806
+ message.userTimeUs = object.userTimeUs;
8807
+ else if (typeof object.userTimeUs === "object")
8808
+ message.userTimeUs = new $util.LongBits(object.userTimeUs.low >>> 0, object.userTimeUs.high >>> 0).toNumber();
8809
8809
  }
8810
8810
  return message;
8811
8811
  };
@@ -8848,9 +8848,9 @@ var sesame = $root.sesame = (() => {
8848
8848
  object.lockedEndUs = options.longs === String ? "0" : 0;
8849
8849
  if ($util.Long) {
8850
8850
  let long = new $util.Long(0, 0, false);
8851
- object.userTimeMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
8851
+ object.userTimeUs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
8852
8852
  } else
8853
- object.userTimeMs = options.longs === String ? "0" : 0;
8853
+ object.userTimeUs = options.longs === String ? "0" : 0;
8854
8854
  }
8855
8855
  if (message.id != null && message.hasOwnProperty("id"))
8856
8856
  if (typeof message.id === "number")
@@ -8886,11 +8886,11 @@ var sesame = $root.sesame = (() => {
8886
8886
  object.lockedEndUs = options.longs === String ? String(message.lockedEndUs) : message.lockedEndUs;
8887
8887
  else
8888
8888
  object.lockedEndUs = options.longs === String ? $util.Long.prototype.toString.call(message.lockedEndUs) : options.longs === Number ? new $util.LongBits(message.lockedEndUs.low >>> 0, message.lockedEndUs.high >>> 0).toNumber() : message.lockedEndUs;
8889
- if (message.userTimeMs != null && message.hasOwnProperty("userTimeMs"))
8890
- if (typeof message.userTimeMs === "number")
8891
- object.userTimeMs = options.longs === String ? String(message.userTimeMs) : message.userTimeMs;
8889
+ if (message.userTimeUs != null && message.hasOwnProperty("userTimeUs"))
8890
+ if (typeof message.userTimeUs === "number")
8891
+ object.userTimeUs = options.longs === String ? String(message.userTimeUs) : message.userTimeUs;
8892
8892
  else
8893
- 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;
8893
+ object.userTimeUs = options.longs === String ? $util.Long.prototype.toString.call(message.userTimeUs) : options.longs === Number ? new $util.LongBits(message.userTimeUs.low >>> 0, message.userTimeUs.high >>> 0).toNumber() : message.userTimeUs;
8894
8894
  return object;
8895
8895
  };
8896
8896
  RecorderClip.prototype.toJSON = function toJSON() {
@@ -13703,7 +13703,7 @@ var sesame = $root.sesame = (() => {
13703
13703
  TransportEvent.prototype.durationUs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
13704
13704
  TransportEvent.prototype.positionUs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
13705
13705
  TransportEvent.prototype.materialPositionUs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
13706
- TransportEvent.prototype.userTimeMs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
13706
+ TransportEvent.prototype.userTimeUs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
13707
13707
  TransportEvent.prototype.speed = 0;
13708
13708
  TransportEvent.prototype.userPlaylistId = "";
13709
13709
  TransportEvent.prototype.playlistIndex = 0;
@@ -13713,7 +13713,7 @@ var sesame = $root.sesame = (() => {
13713
13713
  TransportEvent.prototype.clipDurationUs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
13714
13714
  TransportEvent.prototype.preroll = 0;
13715
13715
  TransportEvent.prototype.postroll = 0;
13716
- TransportEvent.prototype.metadata = "";
13716
+ TransportEvent.prototype.metadata = null;
13717
13717
  TransportEvent.create = function create(properties) {
13718
13718
  return new TransportEvent(properties);
13719
13719
  };
@@ -13755,11 +13755,11 @@ var sesame = $root.sesame = (() => {
13755
13755
  /* id 7, wireType 0 =*/
13756
13756
  56
13757
13757
  ).int64(message.materialPositionUs);
13758
- if (message.userTimeMs != null && Object.hasOwnProperty.call(message, "userTimeMs"))
13758
+ if (message.userTimeUs != null && Object.hasOwnProperty.call(message, "userTimeUs"))
13759
13759
  writer.uint32(
13760
13760
  /* id 8, wireType 0 =*/
13761
13761
  64
13762
- ).int64(message.userTimeMs);
13762
+ ).int64(message.userTimeUs);
13763
13763
  if (message.speed != null && Object.hasOwnProperty.call(message, "speed"))
13764
13764
  writer.uint32(
13765
13765
  /* id 9, wireType 5 =*/
@@ -13806,10 +13806,10 @@ var sesame = $root.sesame = (() => {
13806
13806
  136
13807
13807
  ).uint32(message.postroll);
13808
13808
  if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata"))
13809
- writer.uint32(
13809
+ $root.sesame.v1.common.TransportMetadata.encode(message.metadata, writer.uint32(
13810
13810
  /* id 18, wireType 2 =*/
13811
13811
  146
13812
- ).string(message.metadata);
13812
+ ).fork()).ldelim();
13813
13813
  return writer;
13814
13814
  };
13815
13815
  TransportEvent.encodeDelimited = function encodeDelimited(message, writer) {
@@ -13853,7 +13853,7 @@ var sesame = $root.sesame = (() => {
13853
13853
  break;
13854
13854
  }
13855
13855
  case 8: {
13856
- message.userTimeMs = reader.int64();
13856
+ message.userTimeUs = reader.int64();
13857
13857
  break;
13858
13858
  }
13859
13859
  case 9: {
@@ -13893,7 +13893,7 @@ var sesame = $root.sesame = (() => {
13893
13893
  break;
13894
13894
  }
13895
13895
  case 18: {
13896
- message.metadata = reader.string();
13896
+ message.metadata = $root.sesame.v1.common.TransportMetadata.decode(reader, reader.uint32());
13897
13897
  break;
13898
13898
  }
13899
13899
  default:
@@ -13946,9 +13946,9 @@ var sesame = $root.sesame = (() => {
13946
13946
  if (!$util.isInteger(message.materialPositionUs) && !(message.materialPositionUs && $util.isInteger(message.materialPositionUs.low) && $util.isInteger(message.materialPositionUs.high)))
13947
13947
  return "materialPositionUs: integer|Long expected";
13948
13948
  }
13949
- if (message.userTimeMs != null && message.hasOwnProperty("userTimeMs")) {
13950
- if (!$util.isInteger(message.userTimeMs) && !(message.userTimeMs && $util.isInteger(message.userTimeMs.low) && $util.isInteger(message.userTimeMs.high)))
13951
- return "userTimeMs: integer|Long expected";
13949
+ if (message.userTimeUs != null && message.hasOwnProperty("userTimeUs")) {
13950
+ if (!$util.isInteger(message.userTimeUs) && !(message.userTimeUs && $util.isInteger(message.userTimeUs.low) && $util.isInteger(message.userTimeUs.high)))
13951
+ return "userTimeUs: integer|Long expected";
13952
13952
  }
13953
13953
  if (message.speed != null && message.hasOwnProperty("speed")) {
13954
13954
  if (typeof message.speed !== "number")
@@ -13987,8 +13987,9 @@ var sesame = $root.sesame = (() => {
13987
13987
  return "postroll: integer expected";
13988
13988
  }
13989
13989
  if (message.metadata != null && message.hasOwnProperty("metadata")) {
13990
- if (!$util.isString(message.metadata))
13991
- return "metadata: string expected";
13990
+ let error = $root.sesame.v1.common.TransportMetadata.verify(message.metadata);
13991
+ if (error)
13992
+ return "metadata." + error;
13992
13993
  }
13993
13994
  return null;
13994
13995
  };
@@ -14060,15 +14061,15 @@ var sesame = $root.sesame = (() => {
14060
14061
  else if (typeof object.materialPositionUs === "object")
14061
14062
  message.materialPositionUs = new $util.LongBits(object.materialPositionUs.low >>> 0, object.materialPositionUs.high >>> 0).toNumber();
14062
14063
  }
14063
- if (object.userTimeMs != null) {
14064
+ if (object.userTimeUs != null) {
14064
14065
  if ($util.Long)
14065
- (message.userTimeMs = $util.Long.fromValue(object.userTimeMs)).unsigned = false;
14066
- else if (typeof object.userTimeMs === "string")
14067
- message.userTimeMs = parseInt(object.userTimeMs, 10);
14068
- else if (typeof object.userTimeMs === "number")
14069
- message.userTimeMs = object.userTimeMs;
14070
- else if (typeof object.userTimeMs === "object")
14071
- message.userTimeMs = new $util.LongBits(object.userTimeMs.low >>> 0, object.userTimeMs.high >>> 0).toNumber();
14066
+ (message.userTimeUs = $util.Long.fromValue(object.userTimeUs)).unsigned = false;
14067
+ else if (typeof object.userTimeUs === "string")
14068
+ message.userTimeUs = parseInt(object.userTimeUs, 10);
14069
+ else if (typeof object.userTimeUs === "number")
14070
+ message.userTimeUs = object.userTimeUs;
14071
+ else if (typeof object.userTimeUs === "object")
14072
+ message.userTimeUs = new $util.LongBits(object.userTimeUs.low >>> 0, object.userTimeUs.high >>> 0).toNumber();
14072
14073
  }
14073
14074
  if (object.speed != null)
14074
14075
  message.speed = Number(object.speed);
@@ -14112,8 +14113,11 @@ var sesame = $root.sesame = (() => {
14112
14113
  message.preroll = object.preroll >>> 0;
14113
14114
  if (object.postroll != null)
14114
14115
  message.postroll = object.postroll >>> 0;
14115
- if (object.metadata != null)
14116
- message.metadata = String(object.metadata);
14116
+ if (object.metadata != null) {
14117
+ if (typeof object.metadata !== "object")
14118
+ throw TypeError(".sesame.v1.status.TransportEvent.metadata: object expected");
14119
+ message.metadata = $root.sesame.v1.common.TransportMetadata.fromObject(object.metadata);
14120
+ }
14117
14121
  return message;
14118
14122
  };
14119
14123
  TransportEvent.toObject = function toObject(message, options) {
@@ -14142,9 +14146,9 @@ var sesame = $root.sesame = (() => {
14142
14146
  object.materialPositionUs = options.longs === String ? "0" : 0;
14143
14147
  if ($util.Long) {
14144
14148
  let long = new $util.Long(0, 0, false);
14145
- object.userTimeMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
14149
+ object.userTimeUs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
14146
14150
  } else
14147
- object.userTimeMs = options.longs === String ? "0" : 0;
14151
+ object.userTimeUs = options.longs === String ? "0" : 0;
14148
14152
  object.speed = 0;
14149
14153
  object.userPlaylistId = "";
14150
14154
  object.playlistIndex = 0;
@@ -14166,7 +14170,7 @@ var sesame = $root.sesame = (() => {
14166
14170
  object.clipDurationUs = options.longs === String ? "0" : 0;
14167
14171
  object.preroll = 0;
14168
14172
  object.postroll = 0;
14169
- object.metadata = "";
14173
+ object.metadata = null;
14170
14174
  }
14171
14175
  if (message.sourceId != null && message.hasOwnProperty("sourceId"))
14172
14176
  object.sourceId = message.sourceId;
@@ -14191,11 +14195,11 @@ var sesame = $root.sesame = (() => {
14191
14195
  object.materialPositionUs = options.longs === String ? String(message.materialPositionUs) : message.materialPositionUs;
14192
14196
  else
14193
14197
  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;
14194
- if (message.userTimeMs != null && message.hasOwnProperty("userTimeMs"))
14195
- if (typeof message.userTimeMs === "number")
14196
- object.userTimeMs = options.longs === String ? String(message.userTimeMs) : message.userTimeMs;
14198
+ if (message.userTimeUs != null && message.hasOwnProperty("userTimeUs"))
14199
+ if (typeof message.userTimeUs === "number")
14200
+ object.userTimeUs = options.longs === String ? String(message.userTimeUs) : message.userTimeUs;
14197
14201
  else
14198
- 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;
14202
+ object.userTimeUs = options.longs === String ? $util.Long.prototype.toString.call(message.userTimeUs) : options.longs === Number ? new $util.LongBits(message.userTimeUs.low >>> 0, message.userTimeUs.high >>> 0).toNumber() : message.userTimeUs;
14199
14203
  if (message.speed != null && message.hasOwnProperty("speed"))
14200
14204
  object.speed = options.json && !isFinite(message.speed) ? String(message.speed) : message.speed;
14201
14205
  if (message.userPlaylistId != null && message.hasOwnProperty("userPlaylistId"))
@@ -14224,7 +14228,7 @@ var sesame = $root.sesame = (() => {
14224
14228
  if (message.postroll != null && message.hasOwnProperty("postroll"))
14225
14229
  object.postroll = message.postroll;
14226
14230
  if (message.metadata != null && message.hasOwnProperty("metadata"))
14227
- object.metadata = message.metadata;
14231
+ object.metadata = $root.sesame.v1.common.TransportMetadata.toObject(message.metadata, options);
14228
14232
  return object;
14229
14233
  };
14230
14234
  TransportEvent.prototype.toJSON = function toJSON() {
@@ -22317,8 +22321,8 @@ var RPCClient = class extends import_events.EventEmitter {
22317
22321
  } else {
22318
22322
  throw new Error("Unsupported RPC message payload");
22319
22323
  }
22320
- } catch (cause) {
22321
- const error = new Error("got invalid message");
22324
+ } catch (err) {
22325
+ const error = new Error(`Got invalid message: ${err instanceof Error ? err.message : String(err)}`);
22322
22326
  this.errorHandler(error);
22323
22327
  }
22324
22328
  };
@@ -22393,8 +22397,8 @@ var RPCClient = class extends import_events.EventEmitter {
22393
22397
  try {
22394
22398
  payload = type.decode(event.payload);
22395
22399
  object = type.toObject(payload, { longs: Number });
22396
- } catch (cause) {
22397
- const error = new Error("could not decode event payload");
22400
+ } catch (err) {
22401
+ const error = new Error(`Could not decode event payload: ${err instanceof Error ? err.message : String(err)}`);
22398
22402
  this.errorHandler(error);
22399
22403
  return;
22400
22404
  }
@@ -22549,14 +22553,29 @@ var SesameConnection = class extends import_events2.EventEmitter {
22549
22553
  this.socket.addEventListener("close", this.boundCloseHandler);
22550
22554
  this.socket.addEventListener("error", this.boundErrorHandler);
22551
22555
  this.socket.binaryType = "arraybuffer";
22552
- await new Promise((resolve) => {
22553
- const done = () => {
22554
- this.removeListener("open", done);
22555
- this.removeListener("close", done);
22556
- resolve(null);
22556
+ await new Promise((resolve, reject) => {
22557
+ const cleanup = () => {
22558
+ this.removeListener("open", onOpen);
22559
+ this.removeListener("close", onClose);
22560
+ this.removeListener("error", onError);
22561
+ };
22562
+ const onOpen = () => {
22563
+ cleanup();
22564
+ resolve();
22557
22565
  };
22558
- this.on("open", done);
22559
- this.on("close", done);
22566
+ const onError = (err) => {
22567
+ cleanup();
22568
+ reject(err instanceof Error ? err : new Error("WebSocket connection error"));
22569
+ };
22570
+ const onClose = () => {
22571
+ if (!this.isConnected()) {
22572
+ cleanup();
22573
+ reject(new Error("WebSocket connection closed before opening"));
22574
+ }
22575
+ };
22576
+ this.on("open", onOpen);
22577
+ this.on("close", onClose);
22578
+ this.on("error", onError);
22560
22579
  });
22561
22580
  }
22562
22581
  /**
@@ -22700,7 +22719,6 @@ var JobsApi = class {
22700
22719
  if (!config.filename) throw new Error("Filename is required");
22701
22720
  exportReq.config = {
22702
22721
  ...config,
22703
- filename: config.filename,
22704
22722
  videoCodec: config.videoCodec ?? sesame.v1.common.CodecId.CODEC_ID_H264,
22705
22723
  videoBitrateKbps: config.videoBitrateKbps ?? 1024,
22706
22724
  audioCodec: config.audioCodec ?? sesame.v1.jobs.AudioCodecId.AUDIO_CODEC_ID_AAC,
@@ -22709,18 +22727,18 @@ var JobsApi = class {
22709
22727
  audioRouting: config.audioRouting ?? [0, 1, 2, 3]
22710
22728
  };
22711
22729
  exportReq.items = playlist.clips.map((clip) => ({
22712
- id: clip.id,
22713
- recorderId: clip.recorderId,
22730
+ ...clip,
22714
22731
  transitionTimeUs: clip.transitionTimeUs ?? 0,
22715
22732
  transitionType: clip.transitionType ?? sesame.v1.recorder.TransitionType.TRANSITION_TYPE_MIX,
22716
22733
  transitionFadeColor: clip.transitionFadeColor ?? { x: 0, y: 0, z: 0, w: 0 },
22717
- speed: clip.speed ?? 1,
22718
- audioRouting: clip.audioRouting,
22719
- startTimeUs: clip.startTimeUs,
22720
- endTimeUs: clip.endTimeUs
22734
+ speed: clip.speed ?? 1
22721
22735
  }));
22722
22736
  const msg = sesame.v1.jobs.JobStartRequest.create({ exportRequest: exportReq });
22723
- await this.rpc.service.startJob(msg);
22737
+ const job = await this.rpc.service.startJob(msg);
22738
+ if (job.error) {
22739
+ throw new Error(job.error);
22740
+ }
22741
+ return job;
22724
22742
  }
22725
22743
  async abortJob(jobId) {
22726
22744
  const msg = { jobId };