@palbase/web 3.0.0 → 4.0.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.
Files changed (45) hide show
  1. package/dist/_mls-wasm.cjs +32 -0
  2. package/dist/_mls-wasm.cjs.map +1 -0
  3. package/dist/_mls-wasm.js +11 -0
  4. package/dist/_mls-wasm.js.map +1 -0
  5. package/dist/{analytics-facade-BOxQ8IP2.d.cts → analytics-facade-DwOtlXPP.d.cts} +5 -87
  6. package/dist/{analytics-facade-yfMJ69vw.d.ts → analytics-facade-Nk6J9Ncm.d.ts} +5 -87
  7. package/dist/{chunk-S7NAY3MW.js → chunk-NXEPAEF5.js} +1 -8
  8. package/dist/{chunk-S7NAY3MW.js.map → chunk-NXEPAEF5.js.map} +1 -1
  9. package/dist/chunk-PZ5AY32C.js +10 -0
  10. package/dist/chunk-PZ5AY32C.js.map +1 -0
  11. package/dist/{chunk-3HVTEZ7N.js → chunk-TGDS6VMT.js} +51 -36
  12. package/dist/chunk-TGDS6VMT.js.map +1 -0
  13. package/dist/gen/cli.js +2 -1
  14. package/dist/gen/cli.js.map +1 -1
  15. package/dist/index.cjs +59 -37
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +3 -4
  18. package/dist/index.d.ts +3 -4
  19. package/dist/index.js +3 -2
  20. package/dist/internal.cjs +56 -34
  21. package/dist/internal.cjs.map +1 -1
  22. package/dist/internal.d.cts +4 -16
  23. package/dist/internal.d.ts +4 -16
  24. package/dist/internal.js +3 -2
  25. package/dist/next/client.cjs +56 -34
  26. package/dist/next/client.cjs.map +1 -1
  27. package/dist/next/client.js +3 -2
  28. package/dist/next/client.js.map +1 -1
  29. package/dist/next/index.cjs +46 -34
  30. package/dist/next/index.cjs.map +1 -1
  31. package/dist/next/index.d.cts +2 -3
  32. package/dist/next/index.d.ts +2 -3
  33. package/dist/next/index.js +3 -2
  34. package/dist/next/index.js.map +1 -1
  35. package/dist/{pb-B3h3NIPE.d.cts → pb-C9v5dEO6.d.cts} +1 -1
  36. package/dist/{pb-QRISxPd1.d.ts → pb-FG_nV7NR.d.ts} +1 -1
  37. package/dist/react/index.cjs +1 -1
  38. package/dist/react/index.cjs.map +1 -1
  39. package/dist/react/index.d.cts +1 -2
  40. package/dist/react/index.d.ts +1 -2
  41. package/dist/react/index.js +3 -2
  42. package/dist/react/index.js.map +1 -1
  43. package/package.json +9 -2
  44. package/dist/chunk-3HVTEZ7N.js.map +0 -1
  45. package/dist/pkg/palbe_mls_bg.wasm +0 -0
@@ -1,8 +1,7 @@
1
- import { P as PalbeConfig, d as PalbeRuntime } from './analytics-facade-BOxQ8IP2.cjs';
2
- export { e as buildRuntime } from './analytics-facade-BOxQ8IP2.cjs';
1
+ import { P as PalbeConfig } from './analytics-facade-DwOtlXPP.cjs';
2
+ export { d as PalbeRuntime, e as buildRuntime } from './analytics-facade-DwOtlXPP.cjs';
3
3
  import { B as BackendError } from './errors-fDoNdTrJ.cjs';
4
- export { P as PB, c as createBoundClient } from './pb-B3h3NIPE.cjs';
5
- import 'livekit-client';
4
+ export { P as PB, c as createBoundClient } from './pb-C9v5dEO6.cjs';
6
5
  import './storage-BPaeSG8K.cjs';
7
6
  import './pooled-flags-4GtDtsiu.js';
8
7
 
@@ -31,18 +30,7 @@ declare function __registerNamespaces(tree: NamespaceTree): void;
31
30
  * gen file re-registers its static descriptors right after.
32
31
  */
33
32
  declare function __configure(config: PalbeConfig): void;
34
- /**
35
- * Register a callback that fires synchronously after every successful
36
- * `__configure` call (including re-configure / watch-mode regen).
37
- *
38
- * Returns an unsubscribe function. Safe to call before the first `__configure`.
39
- *
40
- * @internal — consumed by `palbe/react`; not part of the public `palbe` surface.
41
- */
42
- declare function onConfigured(cb: () => void): () => void;
43
- /** @internal */
44
- declare function getRuntime(): PalbeRuntime;
45
33
  /** Test-only: drop runtime + registered namespaces. */
46
34
  declare function __reset(): void;
47
35
 
48
- export { type EndpointDescriptor, type NamespaceTree, PalbeConfig, PalbeRuntime, __configure, __registerNamespaces, __reset, getRuntime, onConfigured };
36
+ export { type EndpointDescriptor, type NamespaceTree, PalbeConfig, __configure, __registerNamespaces, __reset };
@@ -1,8 +1,7 @@
1
- import { P as PalbeConfig, d as PalbeRuntime } from './analytics-facade-yfMJ69vw.js';
2
- export { e as buildRuntime } from './analytics-facade-yfMJ69vw.js';
1
+ import { P as PalbeConfig } from './analytics-facade-Nk6J9Ncm.js';
2
+ export { d as PalbeRuntime, e as buildRuntime } from './analytics-facade-Nk6J9Ncm.js';
3
3
  import { B as BackendError } from './errors-fDoNdTrJ.js';
4
- export { P as PB, c as createBoundClient } from './pb-QRISxPd1.js';
5
- import 'livekit-client';
4
+ export { P as PB, c as createBoundClient } from './pb-FG_nV7NR.js';
6
5
  import './storage-BPaeSG8K.js';
7
6
  import './pooled-flags-4GtDtsiu.js';
8
7
 
@@ -31,18 +30,7 @@ declare function __registerNamespaces(tree: NamespaceTree): void;
31
30
  * gen file re-registers its static descriptors right after.
32
31
  */
33
32
  declare function __configure(config: PalbeConfig): void;
34
- /**
35
- * Register a callback that fires synchronously after every successful
36
- * `__configure` call (including re-configure / watch-mode regen).
37
- *
38
- * Returns an unsubscribe function. Safe to call before the first `__configure`.
39
- *
40
- * @internal — consumed by `palbe/react`; not part of the public `palbe` surface.
41
- */
42
- declare function onConfigured(cb: () => void): () => void;
43
- /** @internal */
44
- declare function getRuntime(): PalbeRuntime;
45
33
  /** Test-only: drop runtime + registered namespaces. */
46
34
  declare function __reset(): void;
47
35
 
48
- export { type EndpointDescriptor, type NamespaceTree, PalbeConfig, PalbeRuntime, __configure, __registerNamespaces, __reset, getRuntime, onConfigured };
36
+ export { type EndpointDescriptor, type NamespaceTree, PalbeConfig, __configure, __registerNamespaces, __reset };
package/dist/internal.js CHANGED
@@ -6,8 +6,9 @@ import {
6
6
  createBoundClient,
7
7
  getRuntime,
8
8
  onConfigured
9
- } from "./chunk-3HVTEZ7N.js";
10
- import "./chunk-S7NAY3MW.js";
9
+ } from "./chunk-TGDS6VMT.js";
10
+ import "./chunk-NXEPAEF5.js";
11
+ import "./chunk-PZ5AY32C.js";
11
12
  export {
12
13
  __configure,
13
14
  __registerNamespaces,
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/next/client.ts
@@ -1564,19 +1574,29 @@ var PalbeAuth = class {
1564
1574
 
1565
1575
  // src/calls/facade.ts
1566
1576
  var import_livekit_client = require("livekit-client");
1567
- var Call = class {
1577
+ var Call = class _Call {
1568
1578
  id;
1569
1579
  _state = "connecting";
1570
1580
  _participants = /* @__PURE__ */ new Map();
1571
1581
  _listeners = /* @__PURE__ */ new Set();
1572
1582
  _room;
1573
1583
  _keyProvider;
1574
- /** @internal obtain via PalbeCalls.start() / .accept() */
1584
+ // PRIVATE constructor + `@internal` factory: the media-engine types (`Room`,
1585
+ // `ExternalE2EEKeyProvider`) appear ONLY on a private constructor and an
1586
+ // `@internal` static factory, both of which `stripInternal` (set in this
1587
+ // package's tsconfig) removes from the emitted public `.d.ts`. So no engine type
1588
+ // ever reaches the public API surface — the same "no engine type in the public
1589
+ // interface" contract the iOS SDK enforces. Consumers obtain a `Call` only
1590
+ // through `pb.calls.start()` / `.accept()`.
1575
1591
  constructor(callId, room, keyProvider) {
1576
1592
  this.id = callId;
1577
1593
  this._room = room;
1578
1594
  this._keyProvider = keyProvider;
1579
- this._wireRoomEvents();
1595
+ this._wireMediaEvents();
1596
+ }
1597
+ /** @internal — facade-only factory; stripped from the public `.d.ts`. */
1598
+ static _create(callId, room, keyProvider) {
1599
+ return new _Call(callId, room, keyProvider);
1580
1600
  }
1581
1601
  // ─── State ──────────────────────────────────────────────────────────────
1582
1602
  get state() {
@@ -1586,9 +1606,9 @@ var Call = class {
1586
1606
  get participants() {
1587
1607
  return Array.from(this._participants.values());
1588
1608
  }
1589
- get localParticipant() {
1590
- return this._room.localParticipant;
1591
- }
1609
+ // (No `localParticipant` accessor: it would return a raw media-engine participant
1610
+ // object and leak the engine type onto the public API. Local mic/camera control is
1611
+ // exposed engine-agnostically via `mute()` / `setCamera()` below.)
1592
1612
  // ─── Subscribe ──────────────────────────────────────────────────────────
1593
1613
  /**
1594
1614
  * Subscribe to call changes (state + participant updates).
@@ -1612,7 +1632,7 @@ var Call = class {
1612
1632
  /**
1613
1633
  * Set a raw frame encryption key (ArrayBuffer) for this call.
1614
1634
  * Design seam for SP-1.x web-MLS: call this with the MLS exporter secret
1615
- * to enable frame-level E2EE via ExternalE2EEKeyProvider.
1635
+ * to enable frame-level E2EE via the media engine's external key provider.
1616
1636
  *
1617
1637
  * NOTE: The room must have been opened with `e2ee` options for this to take
1618
1638
  * effect. Currently calls connect WITHOUT e2ee — see module docstring.
@@ -1622,7 +1642,7 @@ var Call = class {
1622
1642
  async setMediaKey(key) {
1623
1643
  await this._keyProvider.setKey(key);
1624
1644
  }
1625
- /** Leave the call and disconnect from the LiveKit room. */
1645
+ /** Leave the call and disconnect from the media room. */
1626
1646
  async leave() {
1627
1647
  await this._room.disconnect();
1628
1648
  this._setState("ended");
@@ -1664,7 +1684,7 @@ var Call = class {
1664
1684
  }
1665
1685
  this._emit();
1666
1686
  }
1667
- _wireRoomEvents() {
1687
+ _wireMediaEvents() {
1668
1688
  this._room.on(import_livekit_client.RoomEvent.Connected, () => {
1669
1689
  this._setState("active");
1670
1690
  }).on(
@@ -1705,9 +1725,9 @@ var PalbeCalls = class {
1705
1725
  *
1706
1726
  * @param groupId - Messaging group display-id (`grp_<uuidv7>`)
1707
1727
  * @param media - Which media tracks to publish (default: audio + video)
1708
- * @returns A `Call` in `connecting` state; transitions to `active` once LiveKit connects.
1728
+ * @returns A `Call` in `connecting` state; transitions to `active` once the media room connects.
1709
1729
  *
1710
- * @throws BackendError('network', { code: 'call_service_unavailable' }) if LiveKit SFU is down (503)
1730
+ * @throws BackendError('network', { code: 'call_service_unavailable' }) if the SFU is down (503)
1711
1731
  * @throws BackendError('forbidden', { code: 'not_group_member' }) if the caller is not a member (403)
1712
1732
  * @throws BackendError('conflict', { code: 'call_room_full' }) if the room is full (409)
1713
1733
  */
@@ -1764,7 +1784,7 @@ var PalbeCalls = class {
1764
1784
  adaptiveStream: true,
1765
1785
  dynacast: true
1766
1786
  });
1767
- const call = new Call(callId, room, keyProvider);
1787
+ const call = Call._create(callId, room, keyProvider);
1768
1788
  await room.connect(edgeUrl, token);
1769
1789
  if (media.includes("audio")) {
1770
1790
  await room.localParticipant.setMicrophoneEnabled(true);
@@ -6247,31 +6267,29 @@ function date_now() {
6247
6267
  }
6248
6268
 
6249
6269
  // src/messaging/wasm/loader.ts
6250
- var import_meta = {};
6251
6270
  var GLUE_MODULE = "./palbe_mls_bg.js";
6252
6271
  var SNIPPET_MODULE = "./snippets/mls-rs-core-f99cdecbb456b09c/inline0.js";
6253
6272
  var inflight = null;
6254
6273
  var ready = null;
6255
- async function loadWasmModule() {
6256
- const wasmUrl = new URL("./pkg/palbe_mls_bg.wasm", import_meta.url);
6257
- if (wasmUrl.protocol === "file:") {
6258
- const fsSpecifier = ["node", "fs/promises"].join(":");
6259
- const { readFile } = await import(
6260
- /* webpackIgnore: true */
6261
- fsSpecifier
6262
- );
6263
- const bytes = await readFile(wasmUrl);
6264
- return WebAssembly.compile(bytes);
6274
+ function decodeBase64(encoded) {
6275
+ if (typeof encoded !== "string" || encoded.length === 0 || typeof globalThis.atob !== "function") {
6276
+ throw new Error("palbe-mls WASM asset is invalid");
6265
6277
  }
6266
- const response = await fetch(wasmUrl);
6267
- if (typeof WebAssembly.compileStreaming === "function") {
6268
- try {
6269
- return await WebAssembly.compileStreaming(Promise.resolve(response));
6270
- } catch {
6271
- }
6278
+ let binary;
6279
+ try {
6280
+ binary = globalThis.atob(encoded);
6281
+ } catch {
6282
+ throw new Error("palbe-mls WASM asset is invalid");
6283
+ }
6284
+ const bytes = new Uint8Array(binary.length);
6285
+ for (let index = 0; index < binary.length; index += 1) {
6286
+ bytes[index] = binary.charCodeAt(index);
6272
6287
  }
6273
- const buffer = await response.arrayBuffer();
6274
- return WebAssembly.compile(buffer);
6288
+ return bytes.buffer;
6289
+ }
6290
+ async function loadWasmModule() {
6291
+ const asset = await import("#palbase-mls-wasm");
6292
+ return WebAssembly.compile(decodeBase64(asset.default));
6275
6293
  }
6276
6294
  function buildImports() {
6277
6295
  return {
@@ -6282,7 +6300,7 @@ function buildImports() {
6282
6300
  function initMls() {
6283
6301
  if (ready) return Promise.resolve(ready);
6284
6302
  if (inflight) return inflight;
6285
- inflight = (async () => {
6303
+ const attempt = (async () => {
6286
6304
  const module2 = await loadWasmModule();
6287
6305
  const instance = await WebAssembly.instantiate(module2, buildImports());
6288
6306
  const setWasm = __wbg_set_wasm;
@@ -6301,7 +6319,11 @@ function initMls() {
6301
6319
  ready = g;
6302
6320
  return g;
6303
6321
  })();
6304
- return inflight;
6322
+ inflight = attempt;
6323
+ void attempt.catch(() => {
6324
+ if (inflight === attempt) inflight = null;
6325
+ });
6326
+ return attempt;
6305
6327
  }
6306
6328
  function requireMls() {
6307
6329
  if (!ready) {
@@ -8754,7 +8776,7 @@ function defaultSessionStorage(key) {
8754
8776
  }
8755
8777
 
8756
8778
  // src/version.ts
8757
- var VERSION = "3.0.0";
8779
+ var VERSION = "4.0.1";
8758
8780
 
8759
8781
  // src/runtime.ts
8760
8782
  function buildRuntime(config) {