@chronista-club/unison-client 1.1.0 → 1.1.1

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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  > TypeScript client SDK for the [Unison protocol](https://github.com/chronista-club/club-unison).
4
4
  > Part of the **v1.0 polyglot client base** (= server stays Rust, client polyglot for adoption surface).
5
5
 
6
- **Status**: `1.1.0` — v1.0 GA + `/testing` subpath. Protocol API is frozen and the SDK is shipped to npm. It talks to the Rust server over **real WebTransport** (verified by `tests/integration/webtransport_e2e.test.ts`). See [design/typescript-client-api.md](../../design/typescript-client-api.md) for the SDK design contract.
6
+ **Status**: `1.1.1` — v1.0 GA + `/testing` subpath. Protocol API is frozen and the SDK is shipped to npm. It talks to the Rust server over **real WebTransport** (verified by `tests/integration/webtransport_e2e.test.ts`). See [design/typescript-client-api.md](../../design/typescript-client-api.md) for the SDK design contract.
7
7
 
8
8
  ---
9
9
 
package/dist/index.d.ts CHANGED
@@ -36,5 +36,5 @@ export { JsonCodec } from "./codec/json_codec.js";
36
36
  export { ProtoCodec } from "./codec/proto_codec.js";
37
37
  export type { UnisonConnectOptions } from "./client.js";
38
38
  export { UnisonClient, connect } from "./client.js";
39
- export declare const VERSION = "1.1.0";
39
+ export declare const VERSION = "1.1.1";
40
40
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { J as Xt, A as dt, k as U, c as z, r as mt, h as pt, d as jt, M as v, b as Ct, C as q } from "./frame-CG6S4SVc.js";
1
+ import { J as Xt, A as dt, k as U, c as W, r as mt, h as pt, d as jt, M as v, b as Ct, C as q } from "./frame-CG6S4SVc.js";
2
2
  import { F as on, a as an, P as cn, e as un, f as hn, g as fn, i as ln, j as dn, l as mn, m as pn, n as bn, o as gn, p as wn } from "./frame-CG6S4SVc.js";
3
3
  const Qe = [
4
4
  "transport",
@@ -31,14 +31,14 @@ function Ht(t) {
31
31
  e[n] = Number.parseInt(t.slice(n * 2, n * 2 + 2), 16);
32
32
  return e;
33
33
  }
34
- function Wt(t) {
34
+ function zt(t) {
35
35
  return t === void 0 || t === "system" ? {} : {
36
36
  serverCertificateHashes: [
37
37
  { algorithm: "sha-256", value: Ht(t.certHash) }
38
38
  ]
39
39
  };
40
40
  }
41
- const zt = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1"]);
41
+ const Wt = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1"]);
42
42
  function vt(t, e) {
43
43
  if (e === void 0 || e === "system") return;
44
44
  let n;
@@ -47,7 +47,8 @@ function vt(t, e) {
47
47
  } catch {
48
48
  throw new Error(`invalid connection URL: ${t}`);
49
49
  }
50
- if (!zt.has(n))
50
+ const s = n.replace(/^\[|\]$/g, "");
51
+ if (!Wt.has(s))
51
52
  throw new Error(
52
53
  `cert pinning (skip-verify) is restricted to localhost; got host "${n}"`
53
54
  );
@@ -151,7 +152,7 @@ async function Jt(t, e = { url: t }) {
151
152
  throw new Yt();
152
153
  const { signal: n } = e;
153
154
  n?.throwIfAborted(), vt(t, e.trust);
154
- const s = new WebTransport(t, Wt(e.trust)), r = () => s.close();
155
+ const s = new WebTransport(t, zt(e.trust)), r = () => s.close();
155
156
  n?.addEventListener("abort", r, { once: !0 });
156
157
  try {
157
158
  await s.ready;
@@ -195,7 +196,7 @@ class ee {
195
196
  const n = this.#c++, s = {
196
197
  id: n,
197
198
  method: `${te}${this.name}`,
198
- msgType: z,
199
+ msgType: W,
199
200
  payload: this.#n.encode({})
200
201
  }, r = new Promise((c, u) => {
201
202
  this.#e.set(n, { resolve: c, reject: u });
@@ -285,7 +286,7 @@ class ee {
285
286
  const s = this.#c++, r = U({
286
287
  id: s,
287
288
  method: e,
288
- msgType: z,
289
+ msgType: W,
289
290
  payload: this.#n.encode(n)
290
291
  }), i = new Promise((u, l) => {
291
292
  this.#e.set(s, { resolve: u, reject: l });
@@ -523,7 +524,7 @@ function fe() {
523
524
  }
524
525
  throw new Error("invalid varint");
525
526
  }
526
- function O(t, e, n) {
527
+ function $(t, e, n) {
527
528
  for (let i = 0; i < 28; i = i + 7) {
528
529
  const a = t >>> i, c = !(!(a >>> 7) && e == 0), u = (c ? a | 128 : a) & 255;
529
530
  if (n.push(u), !c)
@@ -825,7 +826,7 @@ function _e(t, e) {
825
826
  const Fe = Symbol(), rt = /* @__PURE__ */ new WeakMap();
826
827
  function Ue(t) {
827
828
  let e;
828
- if (Oe(t)) {
829
+ if ($e(t)) {
829
830
  const n = rt.get(t);
830
831
  let s, r;
831
832
  if (n)
@@ -833,22 +834,22 @@ function Ue(t) {
833
834
  else {
834
835
  s = {}, r = /* @__PURE__ */ new Set();
835
836
  for (const i of t.members)
836
- i.kind != "oneof" && (i.fieldKind != "scalar" && i.fieldKind != "enum" || i.presence != k && (r.add(i), s[i.localName] = $(i)));
837
+ i.kind != "oneof" && (i.fieldKind != "scalar" && i.fieldKind != "enum" || i.presence != k && (r.add(i), s[i.localName] = O(i)));
837
838
  rt.set(t, { prototype: s, members: r });
838
839
  }
839
840
  e = Object.create(s), e.$typeName = t.typeName;
840
841
  for (const i of t.members)
841
- r.has(i) || i.kind == "field" && (i.fieldKind == "message" || (i.fieldKind == "scalar" || i.fieldKind == "enum") && i.presence != k) || (e[i.localName] = $(i));
842
+ r.has(i) || i.kind == "field" && (i.fieldKind == "message" || (i.fieldKind == "scalar" || i.fieldKind == "enum") && i.presence != k) || (e[i.localName] = O(i));
842
843
  } else {
843
844
  e = {
844
845
  $typeName: t.typeName
845
846
  };
846
847
  for (const n of t.members)
847
- (n.kind == "oneof" || n.presence == k) && (e[n.localName] = $(n));
848
+ (n.kind == "oneof" || n.presence == k) && (e[n.localName] = O(n));
848
849
  }
849
850
  return e;
850
851
  }
851
- function Oe(t) {
852
+ function $e(t) {
852
853
  switch (t.file.edition) {
853
854
  case Te:
854
855
  return !1;
@@ -858,7 +859,7 @@ function Oe(t) {
858
859
  return t.fields.some((e) => e.presence != k && e.fieldKind != "message" && !e.oneof);
859
860
  }
860
861
  }
861
- function $(t) {
862
+ function O(t) {
862
863
  if (t.kind == "oneof")
863
864
  return { case: void 0 };
864
865
  if (t.fieldKind == "list")
@@ -903,7 +904,7 @@ var h;
903
904
  t[t.Varint = 0] = "Varint", t[t.Bit64 = 1] = "Bit64", t[t.LengthDelimited = 2] = "LengthDelimited", t[t.StartGroup = 3] = "StartGroup", t[t.EndGroup = 4] = "EndGroup", t[t.Bit32 = 5] = "Bit32";
904
905
  })(h || (h = {}));
905
906
  const Nt = 34028234663852886e22, Tt = -34028234663852886e22, St = 4294967295, _t = 2147483647, Ft = -2147483648;
906
- class $e {
907
+ class Oe {
907
908
  constructor(e = P().encodeUtf8) {
908
909
  this.encodeUtf8 = e, this.stack = [], this.chunks = [], this.buf = [];
909
910
  }
@@ -1044,21 +1045,21 @@ class $e {
1044
1045
  */
1045
1046
  int64(e) {
1046
1047
  let n = f.enc(e);
1047
- return O(n.lo, n.hi, this.buf), this;
1048
+ return $(n.lo, n.hi, this.buf), this;
1048
1049
  }
1049
1050
  /**
1050
1051
  * Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint.
1051
1052
  */
1052
1053
  sint64(e) {
1053
1054
  const n = f.enc(e), s = n.hi >> 31, r = n.lo << 1 ^ s, i = (n.hi << 1 | n.lo >>> 31) ^ s;
1054
- return O(r, i, this.buf), this;
1055
+ return $(r, i, this.buf), this;
1055
1056
  }
1056
1057
  /**
1057
1058
  * Write a `uint64` value, an unsigned 64-bit varint.
1058
1059
  */
1059
1060
  uint64(e) {
1060
1061
  const n = f.uEnc(e);
1061
- return O(n.lo, n.hi, this.buf), this;
1062
+ return $(n.lo, n.hi, this.buf), this;
1062
1063
  }
1063
1064
  }
1064
1065
  class xe {
@@ -1247,7 +1248,7 @@ function De(t, e) {
1247
1248
  let s;
1248
1249
  switch (t.fieldKind) {
1249
1250
  case "list":
1250
- s = `expected ${$t(t)}, got ${N(e)}`;
1251
+ s = `expected ${Ot(t)}, got ${N(e)}`;
1251
1252
  break;
1252
1253
  case "map":
1253
1254
  s = `expected ${xt(t)}, got ${N(e)}`;
@@ -1314,12 +1315,12 @@ function Ut(t, e) {
1314
1315
  }
1315
1316
  }
1316
1317
  function E(t, e, n) {
1317
- return n = typeof n == "string" ? `: ${n}` : `, got ${N(e)}`, t.scalar !== void 0 ? `expected ${Ae(t.scalar)}` + n : t.enum !== void 0 ? `expected ${t.enum.toString()}` + n : `expected ${Ot(t.message)}` + n;
1318
+ return n = typeof n == "string" ? `: ${n}` : `, got ${N(e)}`, t.scalar !== void 0 ? `expected ${Ae(t.scalar)}` + n : t.enum !== void 0 ? `expected ${t.enum.toString()}` + n : `expected ${$t(t.message)}` + n;
1318
1319
  }
1319
1320
  function N(t) {
1320
1321
  switch (typeof t) {
1321
1322
  case "object":
1322
- return t === null ? "null" : t instanceof Uint8Array ? `Uint8Array(${t.length})` : Array.isArray(t) ? `Array(${t.length})` : V(t) ? $t(t.field()) : M(t) ? xt(t.field()) : K(t) ? Ot(t.desc) : wt(t) ? `message ${t.$typeName}` : "object";
1323
+ return t === null ? "null" : t instanceof Uint8Array ? `Uint8Array(${t.length})` : Array.isArray(t) ? `Array(${t.length})` : V(t) ? Ot(t.field()) : M(t) ? xt(t.field()) : K(t) ? $t(t.desc) : wt(t) ? `message ${t.$typeName}` : "object";
1323
1324
  case "string":
1324
1325
  return t.length > 30 ? "string" : `"${t.split('"').join('\\"')}"`;
1325
1326
  case "boolean":
@@ -1332,10 +1333,10 @@ function N(t) {
1332
1333
  return typeof t;
1333
1334
  }
1334
1335
  }
1335
- function Ot(t) {
1336
+ function $t(t) {
1336
1337
  return `ReflectMessage (${t.typeName})`;
1337
1338
  }
1338
- function $t(t) {
1339
+ function Ot(t) {
1339
1340
  switch (t.listKind) {
1340
1341
  case "message":
1341
1342
  return `ReflectList (${t.message.toString()})`;
@@ -1736,13 +1737,13 @@ function Vt(t, e, n, s, r) {
1736
1737
  let c, u;
1737
1738
  const l = (i = t.getUnknown()) !== null && i !== void 0 ? i : [];
1738
1739
  for (; e.pos < a && ([c, u] = e.tag(), !(s && u == h.EndGroup)); ) {
1739
- const W = t.findNumber(c);
1740
- if (!W) {
1740
+ const z = t.findNumber(c);
1741
+ if (!z) {
1741
1742
  const Pt = e.skip(u, c);
1742
1743
  n.readUnknownFields && l.push({ no: c, wireType: u, data: Pt });
1743
1744
  continue;
1744
1745
  }
1745
- Xe(t, e, W, u, n);
1746
+ Xe(t, e, z, u, n);
1746
1747
  }
1747
1748
  if (s && (u != h.EndGroup || c !== r))
1748
1749
  throw new Error("invalid end group tag");
@@ -1882,7 +1883,7 @@ function Ye(t) {
1882
1883
  return t ? Object.assign(Object.assign({}, ft), t) : ft;
1883
1884
  }
1884
1885
  function He(t, e, n) {
1885
- return T(new $e(), Ye(n), F(t, e)).finish();
1886
+ return T(new Oe(), Ye(n), F(t, e)).finish();
1886
1887
  }
1887
1888
  function T(t, e, n) {
1888
1889
  var s;
@@ -1892,14 +1893,14 @@ function T(t, e, n) {
1892
1893
  throw new Error(`cannot encode ${r} to binary: required field not set`);
1893
1894
  continue;
1894
1895
  }
1895
- We(t, e, n, r);
1896
+ ze(t, e, n, r);
1896
1897
  }
1897
1898
  if (e.writeUnknownFields)
1898
1899
  for (const { no: r, wireType: i, data: a } of (s = n.getUnknown()) !== null && s !== void 0 ? s : [])
1899
1900
  t.tag(r, i).raw(a);
1900
1901
  return t;
1901
1902
  }
1902
- function We(t, e, n, s) {
1903
+ function ze(t, e, n, s) {
1903
1904
  var r;
1904
1905
  switch (s.fieldKind) {
1905
1906
  case "scalar":
@@ -1907,7 +1908,7 @@ function We(t, e, n, s) {
1907
1908
  S(t, n.desc.typeName, s.name, (r = s.scalar) !== null && r !== void 0 ? r : o.INT32, s.number, n.get(s));
1908
1909
  break;
1909
1910
  case "list":
1910
- ze(t, e, s, n.get(s));
1911
+ We(t, e, s, n.get(s));
1911
1912
  break;
1912
1913
  case "message":
1913
1914
  Mt(t, e, s, n.get(s));
@@ -1924,7 +1925,7 @@ function S(t, e, n, s, r, i) {
1924
1925
  function Mt(t, e, n, s) {
1925
1926
  n.delimitedEncoding ? T(t.tag(n.number, h.StartGroup), e, s).tag(n.number, h.EndGroup) : T(t.tag(n.number, h.LengthDelimited).fork(), e, s).join();
1926
1927
  }
1927
- function ze(t, e, n, s) {
1928
+ function We(t, e, n, s) {
1928
1929
  var r;
1929
1930
  if (n.listKind == "message") {
1930
1931
  for (const a of s)
@@ -2122,7 +2123,7 @@ async function en(t) {
2122
2123
  }
2123
2124
  return new Ze(n, s, r);
2124
2125
  }
2125
- const nn = "1.1.0";
2126
+ const nn = "1.1.1";
2126
2127
  export {
2127
2128
  dt as AsyncQueue,
2128
2129
  q as CodecError,
@@ -2136,7 +2137,7 @@ export {
2136
2137
  Xt as JsonCodec,
2137
2138
  v as MSG_TYPE_ERROR,
2138
2139
  Ct as MSG_TYPE_EVENT,
2139
- z as MSG_TYPE_REQUEST,
2140
+ W as MSG_TYPE_REQUEST,
2140
2141
  jt as MSG_TYPE_RESPONSE,
2141
2142
  cn as PACKET_VERSION,
2142
2143
  tn as ProtoCodec,