@cloudflare/realtimekit 1.2.4-staging.6 → 1.2.4-staging.7

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.
@@ -14,7 +14,7 @@ var y = (e, s, a) => (qe(e, typeof s != "symbol" ? s + "" : s, a), a), cn = (e,
14
14
  if (!s.has(e))
15
15
  throw TypeError("Cannot " + a);
16
16
  };
17
- var j = (e, s, a) => (cn(e, s, "read from private field"), a ? a.call(e) : s.get(e)), te = (e, s, a) => {
17
+ var j = (e, s, a) => (cn(e, s, "read from private field"), a ? a.call(e) : s.get(e)), ne = (e, s, a) => {
18
18
  if (s.has(e))
19
19
  throw TypeError("Cannot add the same private member more than once");
20
20
  s instanceof WeakSet ? s.add(e) : s.set(e, a);
@@ -35,8 +35,8 @@ var dn = (e, s, a) => new Promise((d, p) => {
35
35
  }, g = (w) => w.done ? d(w.value) : Promise.resolve(w.value).then(m, f);
36
36
  g((a = a.apply(e, s)).next());
37
37
  });
38
- import { MessageType as o, PbLong as se, typeofJsonValue as Ct } from "@protobuf-ts/runtime";
39
- var re = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}, fe = {}, Et = {
38
+ import { MessageType as o, PbLong as te, typeofJsonValue as Ct } from "@protobuf-ts/runtime";
39
+ var se = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {}, fe = {}, Et = {
40
40
  get exports() {
41
41
  return fe;
42
42
  },
@@ -522,19 +522,19 @@ const Ae = /* @__PURE__ */ Nt(Dt);
522
522
  function Ut(e) {
523
523
  throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
524
524
  }
525
- var oe = {}, Bt = {
525
+ var re = {}, Bt = {
526
526
  get exports() {
527
- return oe;
527
+ return re;
528
528
  },
529
529
  set exports(e) {
530
- oe = e;
530
+ re = e;
531
531
  }
532
532
  };
533
533
  (function(e, s) {
534
534
  (function(a, d) {
535
535
  d(s);
536
- })(re, function(a) {
537
- var d = typeof window != "undefined" ? window : typeof re != "undefined" ? re : typeof self != "undefined" ? self : {}, p = function(t, c) {
536
+ })(se, function(a) {
537
+ var d = typeof window != "undefined" ? window : typeof se != "undefined" ? se : typeof self != "undefined" ? self : {}, p = function(t, c) {
538
538
  if (c = c.split(":")[0], t = +t, !t)
539
539
  return !1;
540
540
  switch (c) {
@@ -713,7 +713,7 @@ var oe = {}, Bt = {
713
713
  }
714
714
  N.prototype = { set: at, toString: it }, N.extractProtocol = en, N.location = Xe, N.trimLeft = Ce, N.qs = ce;
715
715
  var Se = N;
716
- function ee(r, t) {
716
+ function X(r, t) {
717
717
  setTimeout(function(c) {
718
718
  return r.call(c);
719
719
  }, 4, t);
@@ -868,7 +868,7 @@ var oe = {}, Bt = {
868
868
  var t = r.type, c = r.target, n = new dt(t);
869
869
  return c && (n.target = c, n.srcElement = c, n.currentTarget = c), n;
870
870
  }
871
- function ne(r) {
871
+ function ee(r) {
872
872
  var t = r.type, c = r.origin, n = r.data, i = r.target, u = new ut(t, {
873
873
  data: n,
874
874
  origin: c
@@ -893,7 +893,7 @@ var oe = {}, Bt = {
893
893
  code: t,
894
894
  reason: c
895
895
  });
896
- ee(function() {
896
+ X(function() {
897
897
  P.removeWebSocket(r, r.url), r.readyState = E.CLOSED, r.dispatchEvent(i), n && n.dispatchEvent(i, n);
898
898
  }, r);
899
899
  }
@@ -909,7 +909,7 @@ var oe = {}, Bt = {
909
909
  type: "error",
910
910
  target: r.target
911
911
  });
912
- ee(function() {
912
+ X(function() {
913
913
  P.removeWebSocket(r, r.url), r.readyState = E.CLOSED, r.dispatchEvent(u), r.dispatchEvent(i), n && n.dispatchEvent(i, n);
914
914
  }, r);
915
915
  }
@@ -931,7 +931,7 @@ var oe = {}, Bt = {
931
931
  if (i === "send")
932
932
  return function(T) {
933
933
  T = ue(T), r.dispatchEvent(
934
- ne({
934
+ ee({
935
935
  type: "message",
936
936
  data: T,
937
937
  origin: this.url,
@@ -990,7 +990,7 @@ var oe = {}, Bt = {
990
990
  function t(n, i) {
991
991
  r.call(this), this._onopen = null, this._onmessage = null, this._onerror = null, this._onclose = null, this.url = Tt(n), i = ft(i), this.protocol = i[0] || "", this.binaryType = "blob", this.readyState = t.CONNECTING;
992
992
  var u = tn(this), l = P.attachWebSocket(u, this.url);
993
- ee(function() {
993
+ X(function() {
994
994
  if (this.readyState === t.CONNECTING)
995
995
  if (l)
996
996
  if (l.options.verifyClient && typeof l.options.verifyClient == "function" && !l.options.verifyClient())
@@ -1035,12 +1035,12 @@ var oe = {}, Bt = {
1035
1035
  var u = this;
1036
1036
  if (this.readyState === t.CONNECTING)
1037
1037
  throw new Error("Failed to execute 'send' on 'WebSocket': Still in CONNECTING state");
1038
- var l = ne({
1038
+ var l = ee({
1039
1039
  type: "server::message",
1040
1040
  origin: this.url,
1041
1041
  data: ue(i)
1042
1042
  }), T = P.serverLookup(this.url);
1043
- T && ee(function() {
1043
+ T && X(function() {
1044
1044
  u.dispatchEvent(l, i);
1045
1045
  }, T);
1046
1046
  }, t.prototype.close = function(i, u) {
@@ -1067,7 +1067,7 @@ var oe = {}, Bt = {
1067
1067
  var l = new Se(n);
1068
1068
  l.pathname || (l.pathname = "/"), this.url = l.toString(), this.readyState = t.CONNECTING, this.protocol = "", this.target = this, typeof i == "string" || typeof i == "object" && i !== null ? this.protocol = i : Array.isArray(i) && i.length > 0 && (this.protocol = i[0]);
1069
1069
  var T = P.attachWebSocket(this, this.url);
1070
- ee(function() {
1070
+ X(function() {
1071
1071
  T ? (this.readyState = t.OPEN, T.dispatchEvent(O({ type: "connection" }), T, this), T.dispatchEvent(O({ type: "connect" }), T, this), this.dispatchEvent(O({ type: "connect", target: this }))) : (this.readyState = t.CLOSED, this.dispatchEvent(O({ type: "error", target: this })), this.dispatchEvent(
1072
1072
  M({
1073
1073
  type: "close",
@@ -1112,7 +1112,7 @@ var oe = {}, Bt = {
1112
1112
  u[l] = arguments[l + 1];
1113
1113
  if (this.readyState !== t.OPEN)
1114
1114
  throw new Error("SocketIO is already in CLOSING or CLOSED state");
1115
- var T = ne({
1115
+ var T = ee({
1116
1116
  type: i,
1117
1117
  origin: this.url,
1118
1118
  data: u
@@ -1176,7 +1176,7 @@ var oe = {}, Bt = {
1176
1176
  }, []);
1177
1177
  };
1178
1178
  function sn() {
1179
- return typeof window != "undefined" ? window : typeof Ae == "object" && typeof Ut == "function" && typeof re == "object" ? re : this;
1179
+ return typeof window != "undefined" ? window : typeof Ae == "object" && typeof Ut == "function" && typeof se == "object" ? se : this;
1180
1180
  }
1181
1181
  var rn = {
1182
1182
  mock: !0,
@@ -1231,14 +1231,14 @@ var oe = {}, Bt = {
1231
1231
  var S = _ instanceof H ? i : k;
1232
1232
  Array.isArray(S) ? _.dispatchEvent.apply(
1233
1233
  _,
1234
- [ne({
1234
+ [ee({
1235
1235
  type: n,
1236
1236
  data: S,
1237
1237
  origin: l.url,
1238
1238
  target: _.target
1239
1239
  })].concat(S)
1240
1240
  ) : _.dispatchEvent(
1241
- ne({
1241
+ ee({
1242
1242
  type: n,
1243
1243
  data: S,
1244
1244
  origin: l.url,
@@ -1277,7 +1277,7 @@ var oe = {}, Bt = {
1277
1277
  var kt = Oe, gt = E, yt = xe;
1278
1278
  a.Server = kt, a.WebSocket = gt, a.SocketIO = yt, Object.defineProperty(a, "__esModule", { value: !0 });
1279
1279
  });
1280
- })(Bt, oe);
1280
+ })(Bt, re);
1281
1281
  var Ge = {}, Gt = {
1282
1282
  get exports() {
1283
1283
  return Ge;
@@ -1996,7 +1996,7 @@ class ms extends o {
1996
1996
  ]);
1997
1997
  }
1998
1998
  }
1999
- const ie = new ms();
1999
+ const ae = new ms();
2000
2000
  class Ts extends o {
2001
2001
  constructor() {
2002
2002
  super("media.ConsumerState", [
@@ -2007,7 +2007,7 @@ class Ts extends o {
2007
2007
  T: 9
2008
2008
  /*ScalarType.STRING*/
2009
2009
  },
2010
- { no: 2, name: "producer_state", kind: "message", T: () => ie },
2010
+ { no: 2, name: "producer_state", kind: "message", T: () => ae },
2011
2011
  { no: 3, name: "producer_track", kind: "message", T: () => us },
2012
2012
  {
2013
2013
  no: 4,
@@ -2730,7 +2730,7 @@ class Ys extends o {
2730
2730
  T: 9
2731
2731
  /*ScalarType.STRING*/
2732
2732
  },
2733
- { no: 2, name: "producer_states", kind: "message", repeat: 1, T: () => ie },
2733
+ { no: 2, name: "producer_states", kind: "message", repeat: 1, T: () => ae },
2734
2734
  {
2735
2735
  no: 3,
2736
2736
  name: "display_name",
@@ -3110,7 +3110,7 @@ class Lr extends o {
3110
3110
  T: 9
3111
3111
  /*ScalarType.STRING*/
3112
3112
  },
3113
- { no: 2, name: "producer_state", kind: "message", T: () => ie }
3113
+ { no: 2, name: "producer_state", kind: "message", T: () => ae }
3114
3114
  ]);
3115
3115
  }
3116
3116
  }
@@ -3125,7 +3125,7 @@ class xr extends o {
3125
3125
  T: 9
3126
3126
  /*ScalarType.STRING*/
3127
3127
  },
3128
- { no: 2, name: "producer_state", kind: "message", T: () => ie },
3128
+ { no: 2, name: "producer_state", kind: "message", T: () => ae },
3129
3129
  {
3130
3130
  no: 3,
3131
3131
  name: "initiator_participant_id",
@@ -3148,7 +3148,7 @@ class Or extends o {
3148
3148
  T: 9
3149
3149
  /*ScalarType.STRING*/
3150
3150
  },
3151
- { no: 2, name: "producer_state", kind: "message", T: () => ie }
3151
+ { no: 2, name: "producer_state", kind: "message", T: () => ae }
3152
3152
  ]);
3153
3153
  }
3154
3154
  }
@@ -3391,10 +3391,10 @@ var ke;
3391
3391
  (function(e) {
3392
3392
  e[e.BROWSER = 0] = "BROWSER", e[e.TRACK = 1] = "TRACK", e[e.COMPOSITE = 2] = "COMPOSITE";
3393
3393
  })(ke || (ke = {}));
3394
- var ae;
3394
+ var oe;
3395
3395
  (function(e) {
3396
3396
  e[e.UNSPECIFIED = 0] = "UNSPECIFIED", e[e.ON_STAGE = 1] = "ON_STAGE", e[e.APPROVED_STAGE = 2] = "APPROVED_STAGE", e[e.REQUESTED_STAGE = 3] = "REQUESTED_STAGE", e[e.OFF_STAGE = 4] = "OFF_STAGE";
3397
- })(ae || (ae = {}));
3397
+ })(oe || (oe = {}));
3398
3398
  var We;
3399
3399
  (function(e) {
3400
3400
  e[e.NONE = 0] = "NONE", e[e.RECORDER = 1] = "RECORDER", e[e.LIVESTREAMER = 2] = "LIVESTREAMER";
@@ -3459,7 +3459,7 @@ class Kr extends o {
3459
3459
  T: 9
3460
3460
  /*ScalarType.STRING*/
3461
3461
  },
3462
- { no: 4, name: "stage_type", kind: "enum", opt: !0, T: () => ["socket.room.StageType", ae, "STAGE_TYPE_"] },
3462
+ { no: 4, name: "stage_type", kind: "enum", opt: !0, T: () => ["socket.room.StageType", oe, "STAGE_TYPE_"] },
3463
3463
  {
3464
3464
  no: 5,
3465
3465
  name: "custom_participant_id",
@@ -3521,7 +3521,7 @@ class Hr extends o {
3521
3521
  T: 9
3522
3522
  /*ScalarType.STRING*/
3523
3523
  },
3524
- { no: 3, name: "stage_type", kind: "enum", opt: !0, T: () => ["socket.room.StageType", ae, "STAGE_TYPE_"] }
3524
+ { no: 3, name: "stage_type", kind: "enum", opt: !0, T: () => ["socket.room.StageType", oe, "STAGE_TYPE_"] }
3525
3525
  ]);
3526
3526
  }
3527
3527
  }
@@ -6371,27 +6371,27 @@ class Di extends o {
6371
6371
  */
6372
6372
  now() {
6373
6373
  const s = this.create(), a = Date.now();
6374
- return s.seconds = se.from(Math.floor(a / 1e3)).toBigInt(), s.nanos = a % 1e3 * 1e6, s;
6374
+ return s.seconds = te.from(Math.floor(a / 1e3)).toBigInt(), s.nanos = a % 1e3 * 1e6, s;
6375
6375
  }
6376
6376
  /**
6377
6377
  * Converts a `Timestamp` to a JavaScript Date.
6378
6378
  */
6379
6379
  toDate(s) {
6380
- return new Date(se.from(s.seconds).toNumber() * 1e3 + Math.ceil(s.nanos / 1e6));
6380
+ return new Date(te.from(s.seconds).toNumber() * 1e3 + Math.ceil(s.nanos / 1e6));
6381
6381
  }
6382
6382
  /**
6383
6383
  * Converts a JavaScript Date to a `Timestamp`.
6384
6384
  */
6385
6385
  fromDate(s) {
6386
6386
  const a = this.create(), d = s.getTime();
6387
- return a.seconds = se.from(Math.floor(d / 1e3)).toBigInt(), a.nanos = d % 1e3 * 1e6, a;
6387
+ return a.seconds = te.from(Math.floor(d / 1e3)).toBigInt(), a.nanos = d % 1e3 * 1e6, a;
6388
6388
  }
6389
6389
  /**
6390
6390
  * In JSON format, the `Timestamp` type is encoded as a string
6391
6391
  * in the RFC 3339 format.
6392
6392
  */
6393
6393
  internalJsonWrite(s, a) {
6394
- let d = se.from(s.seconds).toNumber() * 1e3;
6394
+ let d = te.from(s.seconds).toNumber() * 1e3;
6395
6395
  if (d < Date.parse("0001-01-01T00:00:00Z") || d > Date.parse("9999-12-31T23:59:59Z"))
6396
6396
  throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
6397
6397
  if (s.nanos < 0)
@@ -6418,7 +6418,7 @@ class Di extends o {
6418
6418
  throw new Error("Unable to parse Timestamp from JSON. Invalid value.");
6419
6419
  if (m < Date.parse("0001-01-01T00:00:00Z") || m > Date.parse("9999-12-31T23:59:59Z"))
6420
6420
  throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
6421
- return d || (d = this.create()), d.seconds = se.from(m / 1e3).toBigInt(), d.nanos = 0, p[7] && (d.nanos = parseInt("1" + p[7] + "0".repeat(9 - p[7].length)) - 1e9), d;
6421
+ return d || (d = this.create()), d.seconds = te.from(m / 1e3).toBigInt(), d.nanos = 0, p[7] && (d.nanos = parseInt("1" + p[7] + "0".repeat(9 - p[7].length)) - 1e9), d;
6422
6422
  }
6423
6423
  }
6424
6424
  new Di();
@@ -6528,7 +6528,7 @@ class Gi extends o {
6528
6528
  }
6529
6529
  }
6530
6530
  new Gi();
6531
- const ji = 0, Wi = 1, Fi = 2, Ki = 3, Vi = 4, Hi = 5, Ji = {
6531
+ const ji = 0, Wi = 1, Fi = 2, Ki = 3, Vi = 5, Hi = {
6532
6532
  getPeerInfo: 0,
6533
6533
  updatePeerInfo: 1,
6534
6534
  getRoomPeersInfo: 2,
@@ -6586,19 +6586,16 @@ const ji = 0, Wi = 1, Fi = 2, Ki = 3, Vi = 4, Hi = 5, Ji = {
6586
6586
  recordingPaused: 42,
6587
6587
  getRoomStageState: 43,
6588
6588
  livestreamingInvoked: 44
6589
- }, Zi = {
6589
+ }, Ji = {
6590
6590
  getMessages: 0,
6591
6591
  sendMessageToRoom: 1,
6592
6592
  sendMessageToPeers: 2,
6593
6593
  editMessage: 3,
6594
6594
  deleteMessage: 4,
6595
6595
  getPaginatedMessages: 5,
6596
- sendMessageToChannel: 6,
6597
6596
  searchChannelMessages: 7,
6598
- getAllChatChannels: 8,
6599
- markChannelIndexAsRead: 9,
6600
6597
  pinMessage: 10
6601
- }, zi = {
6598
+ }, Zi = {
6602
6599
  getPlugins: 0,
6603
6600
  addPlugin: 1,
6604
6601
  enablePluginForRoom: 2,
@@ -6612,7 +6609,7 @@ const ji = 0, Wi = 1, Fi = 2, Ki = 3, Vi = 4, Hi = 5, Ji = {
6612
6609
  storeGetKeys: 10,
6613
6610
  storeDeleteKeys: 11,
6614
6611
  storeDelete: 12
6615
- }, Yi = {
6612
+ }, zi = {
6616
6613
  createPoll: 0,
6617
6614
  getPolls: 1,
6618
6615
  votePoll: 2,
@@ -6654,66 +6651,56 @@ const ji = 0, Wi = 1, Fi = 2, Ki = 3, Vi = 4, Hi = 5, Ji = {
6654
6651
  hostControlAllPeers: 94,
6655
6652
  // only for CF
6656
6653
  audioActivity: 100
6657
- }, Qi = {
6658
- createChatChannel: 0,
6659
- getChatChannel: 1,
6660
- deprecatedGetAllChatChannels: 2,
6661
- getChannelMembers: 3,
6662
- updateChatChannel: 4
6663
- }, Xi = {
6654
+ }, Yi = {
6664
6655
  getUserPresets: 0,
6665
6656
  updateUserPreset: 1
6666
6657
  };
6667
- function X(e, s) {
6658
+ function ie(e, s) {
6668
6659
  return Object.keys(s).reduce((a, d) => (a[d] = (e << 16) + s[d], a), {});
6669
6660
  }
6670
6661
  function Yn(e, s) {
6671
6662
  return Object.keys(e).reduce((a, d) => (a[d] = s | e[d], a), {});
6672
6663
  }
6673
- const pe = X(ji, Ji);
6674
- X(Wi, Zi);
6675
- X(
6664
+ const pe = ie(ji, Hi);
6665
+ ie(Wi, Ji);
6666
+ ie(
6676
6667
  Fi,
6677
- zi
6678
- );
6679
- X(Ki, Yi);
6680
- X(
6681
- Vi,
6682
- Qi
6668
+ Zi
6683
6669
  );
6670
+ ie(Ki, zi);
6684
6671
  const De = Yn(zn, 16777216);
6685
6672
  Yn(zn, 50331648);
6686
- X(
6687
- Hi,
6688
- Xi
6673
+ ie(
6674
+ Vi,
6675
+ Yi
6689
6676
  );
6690
6677
  const Qn = "ws://localhost:8080/ws";
6691
- class ec extends oe.WebSocket {
6678
+ class Qi extends re.WebSocket {
6692
6679
  constructor(s, a) {
6693
6680
  super(Qn, a);
6694
6681
  }
6695
6682
  }
6696
6683
  var Y, ye, Q, ve;
6697
- class nc {
6684
+ class Xi {
6698
6685
  constructor() {
6699
- te(this, Y, void 0);
6700
- te(this, ye, []);
6701
- te(this, Q, void 0);
6702
- te(this, ve, 15e3);
6686
+ ne(this, Y, void 0);
6687
+ ne(this, ye, []);
6688
+ ne(this, Q, void 0);
6689
+ ne(this, ve, 15e3);
6703
6690
  y(this, "roomId", "roomId");
6704
6691
  y(this, "roomUuid", "roomUuid");
6705
6692
  // eslint-disable-next-line class-methods-use-this
6706
6693
  y(this, "cleanBuffer", (s) => s.buffer.slice(s.byteOffset, s.byteOffset + s.byteLength));
6707
6694
  }
6708
6695
  init({ peerId: s, mockParticipants: a }) {
6709
- Ne(this, Q, s), window.WebSocket = ec, Ne(this, Y, a);
6696
+ Ne(this, Q, s), window.WebSocket = Qi, Ne(this, Y, a);
6710
6697
  const { RTK_MOCK_SERVER: d } = window;
6711
6698
  if (d)
6712
6699
  try {
6713
6700
  d.close();
6714
6701
  } catch (m) {
6715
6702
  }
6716
- const p = new oe.Server(Qn, { mock: !1 });
6703
+ const p = new re.Server(Qn, { mock: !1 });
6717
6704
  window.RTK_MOCK_SERVER = p, p.on("connection", (m) => {
6718
6705
  j(this, ye).push(m), this.addConnectionListeners(m);
6719
6706
  });
@@ -6732,7 +6719,7 @@ class nc {
6732
6719
  userId: "self-userId",
6733
6720
  displayName: "name",
6734
6721
  waitlisted: !1,
6735
- stageType: ae.ON_STAGE
6722
+ stageType: oe.ON_STAGE
6736
6723
  }
6737
6724
  }));
6738
6725
  break;
@@ -6823,8 +6810,8 @@ class nc {
6823
6810
  }
6824
6811
  }
6825
6812
  Y = new WeakMap(), ye = new WeakMap(), Q = new WeakMap(), ve = new WeakMap();
6826
- function rc(e) {
6827
- new nc().init(e), window.RTCPeerConnection = $t, window.fetch = () => dn(this, null, function* () {
6813
+ function tc(e) {
6814
+ new Xi().init(e), window.RTCPeerConnection = $t, window.fetch = () => dn(this, null, function* () {
6828
6815
  const a = new window.Response(JSON.stringify({}), {
6829
6816
  status: 200,
6830
6817
  headers: {
@@ -6835,5 +6822,5 @@ function rc(e) {
6835
6822
  });
6836
6823
  }
6837
6824
  export {
6838
- rc as setupStubs
6825
+ tc as setupStubs
6839
6826
  };