@open-wa/schema 5.6.7 → 5.10.0

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 (62) hide show
  1. package/dist/calling-media--BLrFrPc.cjs.map +1 -1
  2. package/dist/calling-media-BNTYvogE.mjs.map +1 -1
  3. package/dist/{calling-media-CeGgSzhw.d.cts → calling-media-TZ9L95OH.d.cts} +2 -1
  4. package/dist/{calling-media-CeGgSzhw.d.cts.map → calling-media-TZ9L95OH.d.cts.map} +1 -1
  5. package/dist/{calling-media-CeGgSzhw.d.mts → calling-media-TZ9L95OH.d.mts} +2 -1
  6. package/dist/{calling-media-CeGgSzhw.d.mts.map → calling-media-TZ9L95OH.d.mts.map} +1 -1
  7. package/dist/calling-media.d.cts +1 -1
  8. package/dist/calling-media.d.mts +1 -1
  9. package/dist/generated/index.cjs +1 -1
  10. package/dist/generated/index.d.cts +141 -581
  11. package/dist/generated/index.d.cts.map +1 -1
  12. package/dist/generated/index.d.mts +141 -581
  13. package/dist/generated/index.d.mts.map +1 -1
  14. package/dist/generated/index.mjs +1 -1
  15. package/dist/{index-HeicIada.d.cts → index-BETdayaV.d.cts} +53 -232
  16. package/dist/index-BETdayaV.d.cts.map +1 -0
  17. package/dist/{index-C3kjyOe-.d.mts → index-DH0WRSA7.d.mts} +53 -232
  18. package/dist/index-DH0WRSA7.d.mts.map +1 -0
  19. package/dist/index.cjs +7 -4
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +4 -4
  22. package/dist/index.d.mts +4 -4
  23. package/dist/index.mjs +3 -3
  24. package/dist/{interactive-DxUwKpzK.d.cts → interactive-BE_M4nur.d.cts} +14 -6
  25. package/dist/interactive-BE_M4nur.d.cts.map +1 -0
  26. package/dist/{interactive-DxUwKpzK.d.mts → interactive-BE_M4nur.d.mts} +14 -6
  27. package/dist/interactive-BE_M4nur.d.mts.map +1 -0
  28. package/dist/interactive-ClvvgmVP.cjs +630 -0
  29. package/dist/interactive-ClvvgmVP.cjs.map +1 -0
  30. package/dist/interactive-Dec4HB2U.mjs +475 -0
  31. package/dist/interactive-Dec4HB2U.mjs.map +1 -0
  32. package/dist/interactive.cjs +26 -304
  33. package/dist/interactive.d.cts +2 -2
  34. package/dist/interactive.d.mts +2 -2
  35. package/dist/interactive.mjs +2 -283
  36. package/dist/methods/index.cjs +1 -1
  37. package/dist/methods/index.d.cts +1 -1
  38. package/dist/methods/index.d.mts +1 -1
  39. package/dist/methods/index.mjs +1 -1
  40. package/dist/{methods-QZbG0hN2.cjs → methods-9kRJiEdZ.cjs} +14 -78
  41. package/dist/methods-9kRJiEdZ.cjs.map +1 -0
  42. package/dist/{methods-CGm5G9VI.mjs → methods-NixIgGkq.mjs} +6 -64
  43. package/dist/methods-NixIgGkq.mjs.map +1 -0
  44. package/package.json +3 -3
  45. package/src/__tests__/booking-time.contract.test.ts +88 -0
  46. package/src/booking-time.ts +39 -0
  47. package/src/calling-media.ts +2 -0
  48. package/src/calling.ts +1 -0
  49. package/src/common-types.ts +1 -1
  50. package/src/effect-projection.ts +90 -47
  51. package/src/generated/asyncapi.json +191 -89
  52. package/src/generated/openapi.json +1681 -1307
  53. package/src/interactive.ts +12 -1
  54. package/src/methods/calls.ts +2 -2
  55. package/dist/index-C3kjyOe-.d.mts.map +0 -1
  56. package/dist/index-HeicIada.d.cts.map +0 -1
  57. package/dist/interactive-DxUwKpzK.d.cts.map +0 -1
  58. package/dist/interactive-DxUwKpzK.d.mts.map +0 -1
  59. package/dist/interactive.cjs.map +0 -1
  60. package/dist/interactive.mjs.map +0 -1
  61. package/dist/methods-CGm5G9VI.mjs.map +0 -1
  62. package/dist/methods-QZbG0hN2.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"calling-media--BLrFrPc.cjs","names":[],"sources":["../src/calling-wire.ts","../src/calling-media.ts"],"sourcesContent":["/** Neutral OpenWA audio framing. Format is negotiated in start/ready JSON. */\nexport const AUDIO_WIRE_VERSION = 1;\nexport const AUDIO_FRAME_HEADER_BYTES = 20;\nexport function encodeAudioPacket(audio: Uint8Array, sequence: number, timestampMs: number): Uint8Array {\n const packet = new Uint8Array(AUDIO_FRAME_HEADER_BYTES + audio.length);\n const view = new DataView(packet.buffer);\n view.setUint32(0, 0x4f574131); // OWA1\n view.setUint32(4, sequence); view.setFloat64(8, timestampMs); view.setUint32(16, audio.length);\n packet.set(audio, AUDIO_FRAME_HEADER_BYTES); return packet;\n}\nexport function decodeAudioPacket(packet: Uint8Array): { audio: Uint8Array; sequence: number; timestampMs: number } {\n if (packet.length < AUDIO_FRAME_HEADER_BYTES) throw new Error('Audio packet is missing its header.');\n const view = new DataView(packet.buffer, packet.byteOffset, packet.byteLength);\n const timestampMs = view.getFloat64(8);\n if (view.getUint32(0) !== 0x4f574131 || view.getUint32(16) !== packet.length - AUDIO_FRAME_HEADER_BYTES || !Number.isFinite(timestampMs)) throw new Error('Invalid OpenWA audio packet.');\n return { audio: packet.subarray(AUDIO_FRAME_HEADER_BYTES), sequence: view.getUint32(4), timestampMs };\n}\n","export { decodeAudioPacket } from './calling-wire';\n/** Device defaults are serializable so embedded and remote clients share the same API. */\nexport const DEFAULT_MIC = 'default:microphone' as const;\nexport const DEFAULT_SPEAKER = 'default:speaker' as const;\nexport const DEFAULT_CAM = 'default:camera' as const;\n\nexport interface RawAudioFormat {\n encoding: 'pcm16le' | 'float32le';\n sampleRate: number;\n channels: 1 | 2;\n}\n\nexport interface MediaDescriptor {\n kind: 'file' | 'url' | 'device' | 'remote';\n path?: string;\n url?: string;\n deviceId?: string;\n raw?: RawAudioFormat;\n headers?: Record<string, string>;\n overwrite?: boolean;\n loop?: boolean;\n /** Internal helper admission; applications use ordinary files/devices/streams. */\n remoteId?: string;\n}\n\nexport type AudioInput = string | MediaDescriptor | ReadableStream<Uint8Array> | Blob | null;\nexport type AudioOutput = string | MediaDescriptor | WritableStream<Uint8Array> | null;\nexport type VideoInput = string | MediaDescriptor | null;\nexport interface CallMediaOptions {\n microphone?: AudioInput;\n speaker?: AudioOutput;\n camera?: VideoInput;\n onMediaFailure?: 'end' | 'keep-open';\n}\nexport interface CallingOptions {\n defaults?: CallMediaOptions;\n preparationTimeoutMs?: number;\n}\n\n/** Keep the cause carried by Effect queue failures, whose own message can be empty. */\nexport function describeCallMediaFailure(error: unknown): string {\n let current = error;\n const seen = new Set<unknown>();\n while (current && typeof current === 'object' && !seen.has(current)) {\n seen.add(current);\n if ('_tag' in current && current._tag === 'TaskTimeoutError' && 'timeoutMs' in current) return `Call audio processing exceeded ${current.timeoutMs} ms.`;\n if ('_tag' in current && current._tag === 'QueueOverloadedError') return 'Call audio processing exceeded its bounded receive queue.';\n if ('cause' in current && current.cause !== undefined) { current = current.cause; continue; }\n if ('message' in current && typeof current.message === 'string' && current.message.trim()) return current.message;\n break;\n }\n return typeof current === 'string' && current.trim() ? current : 'Call media failed without reporting a cause.';\n}\n\nexport function normalizeCallMedia(\n microphone?: AudioInput | CallMediaOptions,\n speaker?: AudioOutput,\n camera?: VideoInput,\n): CallMediaOptions {\n if (microphone && typeof microphone === 'object' && !('kind' in microphone) && !('getReader' in microphone) && !('arrayBuffer' in microphone)) {\n return microphone as CallMediaOptions;\n }\n return { microphone: microphone as AudioInput | undefined, speaker, camera };\n}\n"],"mappings":";;AACA,MAAa,qBAAqB;AAClC,MAAa,2BAA2B;AACxC,SAAgB,kBAAkB,OAAmB,UAAkB,aAAiC;CACtG,MAAM,SAAS,IAAI,WAAA,KAAsC,MAAM,MAAM;CACrE,MAAM,OAAO,IAAI,SAAS,OAAO,MAAM;CACvC,KAAK,UAAU,GAAG,UAAU;CAC5B,KAAK,UAAU,GAAG,QAAQ;CAAG,KAAK,WAAW,GAAG,WAAW;CAAG,KAAK,UAAU,IAAI,MAAM,MAAM;CAC7F,OAAO,IAAI,OAAA,EAA+B;CAAG,OAAO;AACtD;AACA,SAAgB,kBAAkB,QAAkF;CAClH,IAAI,OAAO,SAAA,IAAmC,MAAM,IAAI,MAAM,qCAAqC;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enWA audio framing. Format is negotiated in start/ready JSON. */\nexport const AUDIO_WIRE_VERSION = 1;\nexport const AUDIO_FRAME_HEADER_BYTES = 20;\nexport function encodeAudioPacket(audio: Uint8Array, sequence: number, timestampMs: number): Uint8Array {\n const packet = new Uint8Array(AUDIO_FRAME_HEADER_BYTES + audio.length);\n const view = new DataView(packet.buffer);\n view.setUint32(0, 0x4f574131); // OWA1\n view.setUint32(4, sequence); view.setFloat64(8, timestampMs); view.setUint32(16, audio.length);\n packet.set(audio, AUDIO_FRAME_HEADER_BYTES); return packet;\n}\nexport function decodeAudioPacket(packet: Uint8Array): { audio: Uint8Array; sequence: number; timestampMs: number } {\n if (packet.length < AUDIO_FRAME_HEADER_BYTES) throw new Error('Audio packet is missing its header.');\n const view = new DataView(packet.buffer, packet.byteOffset, packet.byteLength);\n const timestampMs = view.getFloat64(8);\n if (view.getUint32(0) !== 0x4f574131 || view.getUint32(16) !== packet.length - AUDIO_FRAME_HEADER_BYTES || !Number.isFinite(timestampMs)) throw new Error('Invalid OpenWA audio packet.');\n return { audio: packet.subarray(AUDIO_FRAME_HEADER_BYTES), sequence: view.getUint32(4), timestampMs };\n}\n","export { decodeAudioPacket } from './calling-wire';\n/** Device defaults are serializable so embedded and remote clients share the same API. */\nexport const DEFAULT_MIC = 'default:microphone' as const;\nexport const DEFAULT_SPEAKER = 'default:speaker' as const;\nexport const DEFAULT_CAM = 'default:camera' as const;\n\nexport interface RawAudioFormat {\n encoding: 'pcm16le' | 'float32le';\n sampleRate: number;\n channels: 1 | 2;\n}\n\nexport interface MediaDescriptor {\n kind: 'file' | 'url' | 'device' | 'remote';\n path?: string;\n url?: string;\n deviceId?: string;\n raw?: RawAudioFormat;\n headers?: Record<string, string>;\n overwrite?: boolean;\n loop?: boolean;\n /** Internal helper admission; applications use ordinary files/devices/streams. */\n remoteId?: string;\n}\n\nexport type AudioInput = string | MediaDescriptor | ReadableStream<Uint8Array> | Blob | null;\nexport type AudioOutput = string | MediaDescriptor | WritableStream<Uint8Array> | null;\nexport type VideoInput = string | MediaDescriptor | null;\nexport interface CallMediaOptions {\n microphone?: AudioInput;\n speaker?: AudioOutput;\n camera?: VideoInput;\n onMediaFailure?: 'end' | 'keep-open';\n /** Explicitly replace a server-owned source, or return a remote source to the host. */\n takeover?: boolean;\n}\nexport interface CallingOptions {\n defaults?: CallMediaOptions;\n preparationTimeoutMs?: number;\n}\n\n/** Keep the cause carried by Effect queue failures, whose own message can be empty. */\nexport function describeCallMediaFailure(error: unknown): string {\n let current = error;\n const seen = new Set<unknown>();\n while (current && typeof current === 'object' && !seen.has(current)) {\n seen.add(current);\n if ('_tag' in current && current._tag === 'TaskTimeoutError' && 'timeoutMs' in current) return `Call audio processing exceeded ${current.timeoutMs} ms.`;\n if ('_tag' in current && current._tag === 'QueueOverloadedError') return 'Call audio processing exceeded its bounded receive queue.';\n if ('cause' in current && current.cause !== undefined) { current = current.cause; continue; }\n if ('message' in current && typeof current.message === 'string' && current.message.trim()) return current.message;\n break;\n }\n return typeof current === 'string' && current.trim() ? current : 'Call media failed without reporting a cause.';\n}\n\nexport function normalizeCallMedia(\n microphone?: AudioInput | CallMediaOptions,\n speaker?: AudioOutput,\n camera?: VideoInput,\n): CallMediaOptions {\n if (microphone && typeof microphone === 'object' && !('kind' in microphone) && !('getReader' in microphone) && !('arrayBuffer' in microphone)) {\n return microphone as CallMediaOptions;\n }\n return { microphone: microphone as AudioInput | undefined, speaker, camera };\n}\n"],"mappings":";;AACA,MAAa,qBAAqB;AAClC,MAAa,2BAA2B;AACxC,SAAgB,kBAAkB,OAAmB,UAAkB,aAAiC;CACtG,MAAM,SAAS,IAAI,WAAA,KAAsC,MAAM,MAAM;CACrE,MAAM,OAAO,IAAI,SAAS,OAAO,MAAM;CACvC,KAAK,UAAU,GAAG,UAAU;CAC5B,KAAK,UAAU,GAAG,QAAQ;CAAG,KAAK,WAAW,GAAG,WAAW;CAAG,KAAK,UAAU,IAAI,MAAM,MAAM;CAC7F,OAAO,IAAI,OAA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CAAO;AAC7E"}
@@ -1 +1 @@
1
- {"version":3,"file":"calling-media-BNTYvogE.mjs","names":[],"sources":["../src/calling-wire.ts","../src/calling-media.ts"],"sourcesContent":["/** Neutral OpenWA audio framing. Format is negotiated in start/ready JSON. */\nexport const AUDIO_WIRE_VERSION = 1;\nexport const AUDIO_FRAME_HEADER_BYTES = 20;\nexport function encodeAudioPacket(audio: Uint8Array, sequence: number, timestampMs: number): Uint8Array {\n const packet = new Uint8Array(AUDIO_FRAME_HEADER_BYTES + audio.length);\n const view = new DataView(packet.buffer);\n view.setUint32(0, 0x4f574131); // OWA1\n view.setUint32(4, sequence); view.setFloat64(8, timestampMs); view.setUint32(16, audio.length);\n packet.set(audio, AUDIO_FRAME_HEADER_BYTES); return packet;\n}\nexport function decodeAudioPacket(packet: Uint8Array): { audio: Uint8Array; sequence: number; timestampMs: number } {\n if (packet.length < AUDIO_FRAME_HEADER_BYTES) throw new Error('Audio packet is missing its header.');\n const view = new DataView(packet.buffer, packet.byteOffset, packet.byteLength);\n const timestampMs = view.getFloat64(8);\n if (view.getUint32(0) !== 0x4f574131 || view.getUint32(16) !== packet.length - AUDIO_FRAME_HEADER_BYTES || !Number.isFinite(timestampMs)) throw new Error('Invalid OpenWA audio packet.');\n return { audio: packet.subarray(AUDIO_FRAME_HEADER_BYTES), sequence: view.getUint32(4), timestampMs };\n}\n","export { decodeAudioPacket } from './calling-wire';\n/** Device defaults are serializable so embedded and remote clients share the same API. */\nexport const DEFAULT_MIC = 'default:microphone' as const;\nexport const DEFAULT_SPEAKER = 'default:speaker' as const;\nexport const DEFAULT_CAM = 'default:camera' as const;\n\nexport interface RawAudioFormat {\n encoding: 'pcm16le' | 'float32le';\n sampleRate: number;\n channels: 1 | 2;\n}\n\nexport interface MediaDescriptor {\n kind: 'file' | 'url' | 'device' | 'remote';\n path?: string;\n url?: string;\n deviceId?: string;\n raw?: RawAudioFormat;\n headers?: Record<string, string>;\n overwrite?: boolean;\n loop?: boolean;\n /** Internal helper admission; applications use ordinary files/devices/streams. */\n remoteId?: string;\n}\n\nexport type AudioInput = string | MediaDescriptor | ReadableStream<Uint8Array> | Blob | null;\nexport type AudioOutput = string | MediaDescriptor | WritableStream<Uint8Array> | null;\nexport type VideoInput = string | MediaDescriptor | null;\nexport interface CallMediaOptions {\n microphone?: AudioInput;\n speaker?: AudioOutput;\n camera?: VideoInput;\n onMediaFailure?: 'end' | 'keep-open';\n}\nexport interface CallingOptions {\n defaults?: CallMediaOptions;\n preparationTimeoutMs?: number;\n}\n\n/** Keep the cause carried by Effect queue failures, whose own message can be empty. */\nexport function describeCallMediaFailure(error: unknown): string {\n let current = error;\n const seen = new Set<unknown>();\n while (current && typeof current === 'object' && !seen.has(current)) {\n seen.add(current);\n if ('_tag' in current && current._tag === 'TaskTimeoutError' && 'timeoutMs' in current) return `Call audio processing exceeded ${current.timeoutMs} ms.`;\n if ('_tag' in current && current._tag === 'QueueOverloadedError') return 'Call audio processing exceeded its bounded receive queue.';\n if ('cause' in current && current.cause !== undefined) { current = current.cause; continue; }\n if ('message' in current && typeof current.message === 'string' && current.message.trim()) return current.message;\n break;\n }\n return typeof current === 'string' && current.trim() ? current : 'Call media failed without reporting a cause.';\n}\n\nexport function normalizeCallMedia(\n microphone?: AudioInput | CallMediaOptions,\n speaker?: AudioOutput,\n camera?: VideoInput,\n): CallMediaOptions {\n if (microphone && typeof microphone === 'object' && !('kind' in microphone) && !('getReader' in microphone) && !('arrayBuffer' in microphone)) {\n return microphone as CallMediaOptions;\n }\n return { microphone: microphone as AudioInput | undefined, speaker, camera };\n}\n"],"mappings":";;AACA,MAAa,qBAAqB;AAClC,MAAa,2BAA2B;AACxC,SAAgB,kBAAkB,OAAmB,UAAkB,aAAiC;CACtG,MAAM,SAAS,IAAI,WAAA,KAAsC,MAAM,MAAM;CACrE,MAAM,OAAO,IAAI,SAAS,OAAO,MAAM;CACvC,KAAK,UAAU,GAAG,UAAU;CAC5B,KAAK,UAAU,GAAG,QAAQ;CAAG,KAAK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Ae,EAAE,eAAe,eAAe,EAAE,iBAAiB,aAChI,OAAO;CAET,OAAO;EAAc;EAAsC;EAAS;CAAO;AAC7E"}
1
+ {"version":3,"file":"calling-media-BNTYvogE.mjs","names":[],"sources":["../src/calling-wire.ts","../src/calling-media.ts"],"sourcesContent":["/** Neutral OpenWA audio framing. Format is negotiated in start/ready JSON. */\nexport const AUDIO_WIRE_VERSION = 1;\nexport const AUDIO_FRAME_HEADER_BYTES = 20;\nexport function encodeAudioPacket(audio: Uint8Array, sequence: number, timestampMs: number): Uint8Array {\n const packet = new Uint8Array(AUDIO_FRAME_HEADER_BYTES + audio.length);\n const view = new DataView(packet.buffer);\n view.setUint32(0, 0x4f574131); // OWA1\n view.setUint32(4, sequence); view.setFloat64(8, timestampMs); view.setUint32(16, audio.length);\n packet.set(audio, AUDIO_FRAME_HEADER_BYTES); return packet;\n}\nexport function decodeAudioPacket(packet: Uint8Array): { audio: Uint8Array; sequence: number; timestampMs: number } {\n if (packet.length < AUDIO_FRAME_HEADER_BYTES) throw new Error('Audio packet is missing its header.');\n const view = new DataView(packet.buffer, packet.byteOffset, packet.byteLength);\n const timestampMs = view.getFloat64(8);\n if (view.getUint32(0) !== 0x4f574131 || view.getUint32(16) !== packet.length - AUDIO_FRAME_HEADER_BYTES || !Number.isFinite(timestampMs)) throw new Error('Invalid OpenWA audio packet.');\n return { audio: packet.subarray(AUDIO_FRAME_HEADER_BYTES), sequence: view.getUint32(4), timestampMs };\n}\n","export { decodeAudioPacket } from './calling-wire';\n/** Device defaults are serializable so embedded and remote clients share the same API. */\nexport const DEFAULT_MIC = 'default:microphone' as const;\nexport const DEFAULT_SPEAKER = 'default:speaker' as const;\nexport const DEFAULT_CAM = 'default:camera' as const;\n\nexport interface RawAudioFormat {\n encoding: 'pcm16le' | 'float32le';\n sampleRate: number;\n channels: 1 | 2;\n}\n\nexport interface MediaDescriptor {\n kind: 'file' | 'url' | 'device' | 'remote';\n path?: string;\n url?: string;\n deviceId?: string;\n raw?: RawAudioFormat;\n headers?: Record<string, string>;\n overwrite?: boolean;\n loop?: boolean;\n /** Internal helper admission; applications use ordinary files/devices/streams. */\n remoteId?: string;\n}\n\nexport type AudioInput = string | MediaDescriptor | ReadableStream<Uint8Array> | Blob | null;\nexport type AudioOutput = string | MediaDescriptor | WritableStream<Uint8Array> | null;\nexport type VideoInput = string | MediaDescriptor | null;\nexport interface CallMediaOptions {\n microphone?: AudioInput;\n speaker?: AudioOutput;\n camera?: VideoInput;\n onMediaFailure?: 'end' | 'keep-open';\n /** Explicitly replace a server-owned source, or return a remote source to the host. */\n takeover?: boolean;\n}\nexport interface CallingOptions {\n defaults?: CallMediaOptions;\n preparationTimeoutMs?: number;\n}\n\n/** Keep the cause carried by Effect queue failures, whose own message can be empty. */\nexport function describeCallMediaFailure(error: unknown): string {\n let current = error;\n const seen = new Set<unknown>();\n while (current && typeof current === 'object' && !seen.has(current)) {\n seen.add(current);\n if ('_tag' in current && current._tag === 'TaskTimeoutError' && 'timeoutMs' in current) return `Call audio processing exceeded ${current.timeoutMs} ms.`;\n if ('_tag' in current && current._tag === 'QueueOverloadedError') return 'Call audio processing exceeded its bounded receive queue.';\n if ('cause' in current && current.cause !== undefined) { current = current.cause; continue; }\n if ('message' in current && typeof current.message === 'string' && current.message.trim()) return current.message;\n break;\n }\n return typeof current === 'string' && current.trim() ? current : 'Call media failed without reporting a cause.';\n}\n\nexport function normalizeCallMedia(\n microphone?: AudioInput | CallMediaOptions,\n speaker?: AudioOutput,\n camera?: VideoInput,\n): CallMediaOptions {\n if (microphone && typeof microphone === 'object' && !('kind' in microphone) && !('getReader' in microphone) && !('arrayBuffer' in microphone)) {\n return microphone as CallMediaOptions;\n }\n return { microphone: microphone as AudioInput | undefined, speaker, camera };\n}\n"],"mappings":";;AACA,MAAa,qBAAqB;AAClC,MAAa,2BAA2B;AACxC,SAAgB,kBAAkB,OAAmB,UAAkB,aAAiC;CACtG,MAAM,SAAS,IAAI,WAAA,KAAsC,MAAM,MAAM;CAC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Q,KAAK,IAAI,UAAU;AACnE;AAEA,SAAgB,mBACd,YACA,SACA,QACkB;CAClB,IAAI,cAAc,OAAO,eAAe,YAAY,EAAE,UAAU,eAAe,EAAE,eAAe,eAAe,EAAE,iBAAiB,aAChI,OAAO;CAET,OAAO;EAAc;EAAsC;EAAS;CAAO;AAC7E"}
@@ -36,6 +36,7 @@ interface CallMediaOptions {
36
36
  speaker?: AudioOutput;
37
37
  camera?: VideoInput;
38
38
  onMediaFailure?: 'end' | 'keep-open';
39
+ takeover?: boolean;
39
40
  }
40
41
  interface CallingOptions {
41
42
  defaults?: CallMediaOptions;
@@ -45,4 +46,4 @@ declare function describeCallMediaFailure(error: unknown): string;
45
46
  declare function normalizeCallMedia(microphone?: AudioInput | CallMediaOptions, speaker?: AudioOutput, camera?: VideoInput): CallMediaOptions;
46
47
  //#endregion
47
48
  export { DEFAULT_CAM as a, MediaDescriptor as c, describeCallMediaFailure as d, normalizeCallMedia as f, encodeAudioPacket as g, decodeAudioPacket as h, CallingOptions as i, RawAudioFormat as l, AUDIO_WIRE_VERSION as m, AudioOutput as n, DEFAULT_MIC as o, AUDIO_FRAME_HEADER_BYTES as p, CallMediaOptions as r, DEFAULT_SPEAKER as s, AudioInput as t, VideoInput as u };
48
- //# sourceMappingURL=calling-media-CeGgSzhw.d.cts.map
49
+ //# sourceMappingURL=calling-media-TZ9L95OH.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"calling-media-CeGgSzhw.d.cts","names":[],"sources":["../src/calling-wire.ts","../src/calling-media.ts"],"mappings":";cACa;cACA;iBACG,kBAAkB,OAAO,YAAY,kBAAkB,sBAAsB;iBAO7E,kBAAkB,QAAQ;EAAe,OAAO;EAAY;EAAkB;;;;cCRjF;cACA;cACA;UAEI;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA,MAAM;EACN,UAAU;EACV;EACA;EAEA;;KAGU,sBAAsB,kBAAkB,eAAe,cAAc;KACrE,uBAAuB,kBAAkB,eAAe;KACxD,sBAAsB;UACjB;EACf,aAAa;EACb,UAAU;EACV,SAAS;EACT;;UAEe;EACf,WAAW;EACX;;iBAIc,yBAAyB;iBAczB,mBACd,aAAa,aAAa,kBAC1B,UAAU,aACV,SAAS,aACR"}
1
+ {"version":3,"file":"calling-media-TZ9L95OH.d.cts","names":[],"sources":["../src/calling-wire.ts","../src/calling-media.ts"],"mappings":";cACa;cACA;iBACG,kBAAkB,OAAO,YAAY,kBAAkB,sBAAsB;iBAO7E,kBAAkB,QAAQ;EAAe,OAAO;EAAY;EAAkB;;;;cCRjF;cACA;cACA;UAEI;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA,MAAM;EACN,UAAU;EACV;EACA;EAEA;;KAGU,sBAAsB,kBAAkB,eAAe,cAAc;KACrE,uBAAuB,kBAAkB,eAAe;KACxD,sBAAsB;UACjB;EACf,aAAa;EACb,UAAU;EACV,SAAS;EACT;EAEA;;UAEe;EACf,WAAW;EACX;;iBAIc,yBAAyB;iBAczB,mBACd,aAAa,aAAa,kBAC1B,UAAU,aACV,SAAS,aACR"}
@@ -36,6 +36,7 @@ interface CallMediaOptions {
36
36
  speaker?: AudioOutput;
37
37
  camera?: VideoInput;
38
38
  onMediaFailure?: 'end' | 'keep-open';
39
+ takeover?: boolean;
39
40
  }
40
41
  interface CallingOptions {
41
42
  defaults?: CallMediaOptions;
@@ -45,4 +46,4 @@ declare function describeCallMediaFailure(error: unknown): string;
45
46
  declare function normalizeCallMedia(microphone?: AudioInput | CallMediaOptions, speaker?: AudioOutput, camera?: VideoInput): CallMediaOptions;
46
47
  //#endregion
47
48
  export { DEFAULT_CAM as a, MediaDescriptor as c, describeCallMediaFailure as d, normalizeCallMedia as f, encodeAudioPacket as g, decodeAudioPacket as h, CallingOptions as i, RawAudioFormat as l, AUDIO_WIRE_VERSION as m, AudioOutput as n, DEFAULT_MIC as o, AUDIO_FRAME_HEADER_BYTES as p, CallMediaOptions as r, DEFAULT_SPEAKER as s, AudioInput as t, VideoInput as u };
48
- //# sourceMappingURL=calling-media-CeGgSzhw.d.mts.map
49
+ //# sourceMappingURL=calling-media-TZ9L95OH.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"calling-media-CeGgSzhw.d.mts","names":[],"sources":["../src/calling-wire.ts","../src/calling-media.ts"],"mappings":";cACa;cACA;iBACG,kBAAkB,OAAO,YAAY,kBAAkB,sBAAsB;iBAO7E,kBAAkB,QAAQ;EAAe,OAAO;EAAY;EAAkB;;;;cCRjF;cACA;cACA;UAEI;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA,MAAM;EACN,UAAU;EACV;EACA;EAEA;;KAGU,sBAAsB,kBAAkB,eAAe,cAAc;KACrE,uBAAuB,kBAAkB,eAAe;KACxD,sBAAsB;UACjB;EACf,aAAa;EACb,UAAU;EACV,SAAS;EACT;;UAEe;EACf,WAAW;EACX;;iBAIc,yBAAyB;iBAczB,mBACd,aAAa,aAAa,kBAC1B,UAAU,aACV,SAAS,aACR"}
1
+ {"version":3,"file":"calling-media-TZ9L95OH.d.mts","names":[],"sources":["../src/calling-wire.ts","../src/calling-media.ts"],"mappings":";cACa;cACA;iBACG,kBAAkB,OAAO,YAAY,kBAAkB,sBAAsB;iBAO7E,kBAAkB,QAAQ;EAAe,OAAO;EAAY;EAAkB;;;;cCRjF;cACA;cACA;UAEI;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA,MAAM;EACN,UAAU;EACV;EACA;EAEA;;KAGU,sBAAsB,kBAAkB,eAAe,cAAc;KACrE,uBAAuB,kBAAkB,eAAe;KACxD,sBAAsB;UACjB;EACf,aAAa;EACb,UAAU;EACV,SAAS;EACT;EAEA;;UAEe;EACf,WAAW;EACX;;iBAIc,yBAAyB;iBAczB,mBACd,aAAa,aAAa,kBAC1B,UAAU,aACV,SAAS,aACR"}
@@ -1,2 +1,2 @@
1
- import { a as DEFAULT_CAM, c as MediaDescriptor, d as describeCallMediaFailure, f as normalizeCallMedia, h as decodeAudioPacket, i as CallingOptions, l as RawAudioFormat, n as AudioOutput, o as DEFAULT_MIC, r as CallMediaOptions, s as DEFAULT_SPEAKER, t as AudioInput, u as VideoInput } from "./calling-media-CeGgSzhw.cjs";
1
+ import { a as DEFAULT_CAM, c as MediaDescriptor, d as describeCallMediaFailure, f as normalizeCallMedia, h as decodeAudioPacket, i as CallingOptions, l as RawAudioFormat, n as AudioOutput, o as DEFAULT_MIC, r as CallMediaOptions, s as DEFAULT_SPEAKER, t as AudioInput, u as VideoInput } from "./calling-media-TZ9L95OH.cjs";
2
2
  export { AudioInput, AudioOutput, CallMediaOptions, CallingOptions, DEFAULT_CAM, DEFAULT_MIC, DEFAULT_SPEAKER, MediaDescriptor, RawAudioFormat, VideoInput, decodeAudioPacket, describeCallMediaFailure, normalizeCallMedia };
@@ -1,2 +1,2 @@
1
- import { a as DEFAULT_CAM, c as MediaDescriptor, d as describeCallMediaFailure, f as normalizeCallMedia, h as decodeAudioPacket, i as CallingOptions, l as RawAudioFormat, n as AudioOutput, o as DEFAULT_MIC, r as CallMediaOptions, s as DEFAULT_SPEAKER, t as AudioInput, u as VideoInput } from "./calling-media-CeGgSzhw.mjs";
1
+ import { a as DEFAULT_CAM, c as MediaDescriptor, d as describeCallMediaFailure, f as normalizeCallMedia, h as decodeAudioPacket, i as CallingOptions, l as RawAudioFormat, n as AudioOutput, o as DEFAULT_MIC, r as CallMediaOptions, s as DEFAULT_SPEAKER, t as AudioInput, u as VideoInput } from "./calling-media-TZ9L95OH.mjs";
2
2
  export { AudioInput, AudioOutput, CallMediaOptions, CallingOptions, DEFAULT_CAM, DEFAULT_MIC, DEFAULT_SPEAKER, MediaDescriptor, RawAudioFormat, VideoInput, decodeAudioPacket, describeCallMediaFailure, normalizeCallMedia };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_methods = require("../methods-QZbG0hN2.cjs");
2
+ const require_methods = require("../methods-9kRJiEdZ.cjs");
3
3
  const require_implementor = require("../implementor.cjs");
4
4
  //#region src/generated/AliasMap.ts
5
5
  /**