@livekit/rtc-node 0.13.32 → 0.13.34
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/dist/async_queue.d.ts +2 -3
- package/dist/audio_filter.d.ts +2 -3
- package/dist/audio_frame.d.ts +5 -6
- package/dist/audio_mixer.d.ts +3 -6
- package/dist/audio_resampler.d.ts +3 -6
- package/dist/audio_source.d.ts +5 -6
- package/dist/{audio_stream-4M8XlO4-.d.cts → audio_stream-BNVaONuH.d.cts} +36 -10
- package/dist/audio_stream.d.cts +2 -2
- package/dist/audio_stream.d.ts +61 -18
- package/dist/data_streams/index.d.cts +1 -1
- package/dist/data_streams/index.d.ts +4 -3
- package/dist/data_streams/stream_reader.cjs +97 -58
- package/dist/data_streams/stream_reader.cjs.map +1 -1
- package/dist/data_streams/stream_reader.d.cts +1 -1
- package/dist/data_streams/stream_reader.d.ts +65 -2
- package/dist/data_streams/stream_reader.d.ts.map +1 -1
- package/dist/data_streams/stream_writer.d.cts +1 -1
- package/dist/data_streams/stream_writer.d.ts +5 -7
- package/dist/data_streams/types.cjs.map +1 -1
- package/dist/data_streams/types.d.cts +1 -1
- package/dist/data_streams/types.d.ts +47 -2
- package/dist/data_streams/types.d.ts.map +1 -1
- package/dist/e2ee.cjs +5 -1
- package/dist/e2ee.cjs.map +1 -1
- package/dist/e2ee.d.cts +3 -1
- package/dist/e2ee.d.ts +11 -11
- package/dist/e2ee.d.ts.map +1 -1
- package/dist/ffi_client.d.ts +8 -10
- package/dist/frame_processor.d.ts +8 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +22 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -107
- package/dist/log.d.ts +5 -7
- package/dist/participant.cjs +179 -192
- package/dist/participant.cjs.map +1 -1
- package/dist/participant.d.cts +2 -2
- package/dist/participant.d.ts +169 -18
- package/dist/participant.d.ts.map +1 -1
- package/dist/room.cjs +166 -120
- package/dist/room.cjs.map +1 -1
- package/dist/room.d.cts +2 -2
- package/dist/room.d.ts +228 -18
- package/dist/room.d.ts.map +1 -1
- package/dist/rpc.d.ts +7 -9
- package/dist/tests/e2e_common.cjs +157 -0
- package/dist/tests/e2e_common.cjs.map +1 -0
- package/dist/tests/e2e_common.d.cts +56 -0
- package/dist/tests/e2e_common.d.ts +37 -0
- package/dist/tests/e2e_common.d.ts.map +1 -0
- package/dist/track.d.cts +2 -2
- package/dist/track.d.ts +67 -18
- package/dist/track_publication.d.cts +2 -2
- package/dist/track_publication.d.ts +45 -18
- package/dist/transcription.d.ts +3 -4
- package/dist/{types-_PdPVish.d.ts → types-f7wTlFjs.d.cts} +34 -11
- package/dist/types.d.ts +2 -3
- package/dist/utils.cjs +27 -2
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +8 -1
- package/dist/utils.d.ts +10 -5
- package/dist/utils.d.ts.map +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.cts +1 -1
- package/dist/version.d.ts +2 -3
- package/dist/video_frame.d.ts +4 -5
- package/dist/video_source.d.ts +6 -8
- package/dist/video_stream.d.cts +2 -2
- package/dist/video_stream.d.ts +5 -22
- package/package.json +6 -7
- package/src/audio_stream_room_lifecycle.test.ts +4 -1
- package/src/data_streams/stream_reader.ts +132 -82
- package/src/data_streams/types.ts +6 -0
- package/src/e2ee.ts +7 -0
- package/src/index.ts +8 -1
- package/src/participant.ts +252 -223
- package/src/room.ts +233 -134
- package/src/tests/e2e.test.ts +50 -139
- package/src/tests/e2e_common.ts +163 -0
- package/src/tests/e2e_data_streams.test.ts +639 -0
- package/src/utils.ts +30 -0
- package/src/version.ts +1 -1
- package/dist/async_queue.js +0 -56
- package/dist/async_queue.js.map +0 -1
- package/dist/audio_filter.js +0 -24
- package/dist/audio_filter.js.map +0 -1
- package/dist/audio_frame.js +0 -78
- package/dist/audio_frame.js.map +0 -1
- package/dist/audio_mixer.js +0 -269
- package/dist/audio_mixer.js.map +0 -1
- package/dist/audio_resampler.js +0 -154
- package/dist/audio_resampler.js.map +0 -1
- package/dist/audio_source.js +0 -134
- package/dist/audio_source.js.map +0 -1
- package/dist/audio_stream-CTyN1Ldy.d.ts +0 -523
- package/dist/audio_stream.js +0 -122
- package/dist/audio_stream.js.map +0 -1
- package/dist/data_streams/index.js +0 -3
- package/dist/data_streams/index.js.map +0 -1
- package/dist/data_streams/stream_reader.js +0 -124
- package/dist/data_streams/stream_reader.js.map +0 -1
- package/dist/data_streams/stream_writer.js +0 -26
- package/dist/data_streams/stream_writer.js.map +0 -1
- package/dist/data_streams/types.js +0 -1
- package/dist/data_streams/types.js.map +0 -1
- package/dist/e2ee.js +0 -251
- package/dist/e2ee.js.map +0 -1
- package/dist/ffi_client.js +0 -89
- package/dist/ffi_client.js.map +0 -1
- package/dist/frame_processor.js +0 -29
- package/dist/frame_processor.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/log.js +0 -9
- package/dist/log.js.map +0 -1
- package/dist/participant.js +0 -715
- package/dist/participant.js.map +0 -1
- package/dist/room.js +0 -900
- package/dist/room.js.map +0 -1
- package/dist/rpc.js +0 -65
- package/dist/rpc.js.map +0 -1
- package/dist/track.js +0 -234
- package/dist/track.js.map +0 -1
- package/dist/track_publication.js +0 -100
- package/dist/track_publication.js.map +0 -1
- package/dist/transcription.js +0 -1
- package/dist/transcription.js.map +0 -1
- package/dist/types-_PdPVish.d.cts +0 -87
- package/dist/types.js +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils.js +0 -35
- package/dist/utils.js.map +0 -1
- package/dist/version.js +0 -5
- package/dist/version.js.map +0 -1
- package/dist/video_frame.js +0 -207
- package/dist/video_frame.js.map +0 -1
- package/dist/video_source.js +0 -53
- package/dist/video_source.js.map +0 -1
- package/dist/video_stream.js +0 -70
- package/dist/video_stream.js.map +0 -1
package/dist/rpc.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { RpcError as
|
|
2
|
-
|
|
1
|
+
import type { RpcError as RpcError_Proto } from '@livekit/rtc-ffi-bindings';
|
|
3
2
|
/** Parameters for initiating an RPC call */
|
|
4
|
-
interface PerformRpcParams {
|
|
3
|
+
export interface PerformRpcParams {
|
|
5
4
|
/** The `identity` of the destination participant */
|
|
6
5
|
destinationIdentity: string;
|
|
7
6
|
/** The method name to call */
|
|
@@ -14,7 +13,7 @@ interface PerformRpcParams {
|
|
|
14
13
|
/**
|
|
15
14
|
* Data passed to method handler for incoming RPC invocations
|
|
16
15
|
*/
|
|
17
|
-
interface RpcInvocationData {
|
|
16
|
+
export interface RpcInvocationData {
|
|
18
17
|
/**
|
|
19
18
|
* The unique request ID. Will match at both sides of the call, useful for debugging or logging.
|
|
20
19
|
*/
|
|
@@ -40,7 +39,7 @@ interface RpcInvocationData {
|
|
|
40
39
|
*
|
|
41
40
|
* Built-in types are included but developers may use any string, with a max length of 256 bytes.
|
|
42
41
|
*/
|
|
43
|
-
declare class RpcError extends Error {
|
|
42
|
+
export declare class RpcError extends Error {
|
|
44
43
|
code: typeof RpcError.ErrorCode | number;
|
|
45
44
|
data?: string;
|
|
46
45
|
/**
|
|
@@ -51,8 +50,8 @@ declare class RpcError extends Error {
|
|
|
51
50
|
* Error codes 1001-1999 are reserved for built-in errors (see RpcError.ErrorCode for their meanings).
|
|
52
51
|
*/
|
|
53
52
|
constructor(code: number, message: string, data?: string);
|
|
54
|
-
static fromProto(proto:
|
|
55
|
-
toProto():
|
|
53
|
+
static fromProto(proto: RpcError_Proto): RpcError;
|
|
54
|
+
toProto(): RpcError_Proto;
|
|
56
55
|
static ErrorCode: {
|
|
57
56
|
readonly APPLICATION_ERROR: 1500;
|
|
58
57
|
readonly CONNECTION_TIMEOUT: 1501;
|
|
@@ -76,5 +75,4 @@ declare class RpcError extends Error {
|
|
|
76
75
|
*/
|
|
77
76
|
static builtIn(key: keyof typeof RpcError.ErrorCode, data?: string): RpcError;
|
|
78
77
|
}
|
|
79
|
-
|
|
80
|
-
export { type PerformRpcParams, RpcError, type RpcInvocationData };
|
|
78
|
+
//# sourceMappingURL=rpc.d.ts.map
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var e2e_common_exports = {};
|
|
20
|
+
__export(e2e_common_exports, {
|
|
21
|
+
concatUint8: () => concatUint8,
|
|
22
|
+
connectTestRooms: () => connectTestRooms,
|
|
23
|
+
createJoinToken: () => createJoinToken,
|
|
24
|
+
describeE2E: () => describeE2E,
|
|
25
|
+
getTestEnv: () => getTestEnv,
|
|
26
|
+
hasE2EEnv: () => hasE2EEnv,
|
|
27
|
+
testTimeoutMs: () => testTimeoutMs,
|
|
28
|
+
waitFor: () => waitFor,
|
|
29
|
+
waitForRoomEvent: () => waitForRoomEvent,
|
|
30
|
+
withTimeout: () => withTimeout
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(e2e_common_exports);
|
|
33
|
+
var import_livekit_server_sdk = require("livekit-server-sdk");
|
|
34
|
+
var import_node_crypto = require("node:crypto");
|
|
35
|
+
var import_promises = require("node:timers/promises");
|
|
36
|
+
var import_vitest = require("vitest");
|
|
37
|
+
var import__ = require("../index.cjs");
|
|
38
|
+
const hasE2EEnv = !!process.env.LIVEKIT_URL && !!process.env.LIVEKIT_API_KEY && !!process.env.LIVEKIT_API_SECRET;
|
|
39
|
+
const describeE2E = hasE2EEnv ? import_vitest.describe : import_vitest.describe.skip;
|
|
40
|
+
const testTimeoutMs = 1e4;
|
|
41
|
+
function normalizeLiveKitUrl(url) {
|
|
42
|
+
if (url.startsWith("http://")) return `ws://${url.slice("http://".length)}`;
|
|
43
|
+
if (url.startsWith("https://")) return `wss://${url.slice("https://".length)}`;
|
|
44
|
+
return url;
|
|
45
|
+
}
|
|
46
|
+
function getTestEnv() {
|
|
47
|
+
if (!hasE2EEnv) {
|
|
48
|
+
throw new Error(
|
|
49
|
+
"Missing required env vars for e2e: LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET"
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
url: normalizeLiveKitUrl(process.env.LIVEKIT_URL),
|
|
54
|
+
apiKey: process.env.LIVEKIT_API_KEY,
|
|
55
|
+
apiSecret: process.env.LIVEKIT_API_SECRET
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
async function withTimeout(promise, timeoutMs, message) {
|
|
59
|
+
return await Promise.race([
|
|
60
|
+
promise,
|
|
61
|
+
(async () => {
|
|
62
|
+
await (0, import_promises.setTimeout)(timeoutMs);
|
|
63
|
+
throw new Error(message);
|
|
64
|
+
})()
|
|
65
|
+
]);
|
|
66
|
+
}
|
|
67
|
+
async function waitFor(condition, opts) {
|
|
68
|
+
const intervalMs = opts.intervalMs ?? 50;
|
|
69
|
+
const deadline = Date.now() + opts.timeoutMs;
|
|
70
|
+
while (Date.now() < deadline) {
|
|
71
|
+
if (condition()) return;
|
|
72
|
+
await (0, import_promises.setTimeout)(intervalMs);
|
|
73
|
+
}
|
|
74
|
+
throw new Error(`Timed out waiting for condition${opts.debugName ? ` (${opts.debugName})` : ""}`);
|
|
75
|
+
}
|
|
76
|
+
async function createJoinToken(params) {
|
|
77
|
+
const token = new import_livekit_server_sdk.AccessToken(params.env.apiKey, params.env.apiSecret, {
|
|
78
|
+
identity: params.identity,
|
|
79
|
+
name: params.name,
|
|
80
|
+
ttl: "30m"
|
|
81
|
+
});
|
|
82
|
+
token.addGrant({
|
|
83
|
+
room: params.roomName,
|
|
84
|
+
roomJoin: true,
|
|
85
|
+
roomCreate: true,
|
|
86
|
+
canPublish: true,
|
|
87
|
+
canSubscribe: true
|
|
88
|
+
});
|
|
89
|
+
return await token.toJwt();
|
|
90
|
+
}
|
|
91
|
+
async function connectTestRooms(count, options) {
|
|
92
|
+
const env = getTestEnv();
|
|
93
|
+
const roomName = `test_room_${(0, import_node_crypto.randomUUID)()}`;
|
|
94
|
+
const rooms = await Promise.all(
|
|
95
|
+
Array.from({ length: count }, async (_, i) => {
|
|
96
|
+
const token = await createJoinToken({
|
|
97
|
+
env,
|
|
98
|
+
roomName,
|
|
99
|
+
identity: `p${i}`,
|
|
100
|
+
name: `Participant ${i}`
|
|
101
|
+
});
|
|
102
|
+
const room = new import__.Room();
|
|
103
|
+
await room.connect(env.url, token, {
|
|
104
|
+
autoSubscribe: true,
|
|
105
|
+
dynacast: false,
|
|
106
|
+
...options
|
|
107
|
+
});
|
|
108
|
+
return room;
|
|
109
|
+
})
|
|
110
|
+
);
|
|
111
|
+
const start = Date.now();
|
|
112
|
+
await waitFor(() => rooms.every((r) => r.remoteParticipants.size === count - 1), {
|
|
113
|
+
timeoutMs: 5e3,
|
|
114
|
+
debugName: `participant visibility (${Date.now() - start}ms)`
|
|
115
|
+
});
|
|
116
|
+
return { roomName, rooms };
|
|
117
|
+
}
|
|
118
|
+
function waitForRoomEvent(room, event, timeoutMs, take, match) {
|
|
119
|
+
return withTimeout(
|
|
120
|
+
new Promise((resolve) => {
|
|
121
|
+
const handler = (...args) => {
|
|
122
|
+
if (match && !match(...args)) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
room.off(event, handler);
|
|
126
|
+
resolve(take(...args));
|
|
127
|
+
};
|
|
128
|
+
room.on(event, handler);
|
|
129
|
+
}),
|
|
130
|
+
timeoutMs,
|
|
131
|
+
`Timed out waiting for ${event}`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
function concatUint8(chunks) {
|
|
135
|
+
const len = chunks.reduce((acc, c) => acc + c.byteLength, 0);
|
|
136
|
+
const out = new Uint8Array(len);
|
|
137
|
+
let offset = 0;
|
|
138
|
+
for (const c of chunks) {
|
|
139
|
+
out.set(c, offset);
|
|
140
|
+
offset += c.byteLength;
|
|
141
|
+
}
|
|
142
|
+
return out;
|
|
143
|
+
}
|
|
144
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
145
|
+
0 && (module.exports = {
|
|
146
|
+
concatUint8,
|
|
147
|
+
connectTestRooms,
|
|
148
|
+
createJoinToken,
|
|
149
|
+
describeE2E,
|
|
150
|
+
getTestEnv,
|
|
151
|
+
hasE2EEnv,
|
|
152
|
+
testTimeoutMs,
|
|
153
|
+
waitFor,
|
|
154
|
+
waitForRoomEvent,
|
|
155
|
+
withTimeout
|
|
156
|
+
});
|
|
157
|
+
//# sourceMappingURL=e2e_common.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/tests/e2e_common.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2026 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { AccessToken } from 'livekit-server-sdk';\nimport { randomUUID } from 'node:crypto';\nimport { setTimeout as delay } from 'node:timers/promises';\nimport { describe } from 'vitest';\nimport { Room, type RoomEvent, type RoomOptions } from '../index.js';\n\nexport const hasE2EEnv =\n !!process.env.LIVEKIT_URL && !!process.env.LIVEKIT_API_KEY && !!process.env.LIVEKIT_API_SECRET;\n// Explicitly typed so declaration emit doesn't reference vitest's\n// non-exported internal suite types (TS4023).\nexport const describeE2E: typeof describe = hasE2EEnv\n ? describe\n : (describe.skip as typeof describe);\nexport const testTimeoutMs = 10_000;\n\nexport type TestEnv = {\n url: string;\n apiKey: string;\n apiSecret: string;\n};\n\nfunction normalizeLiveKitUrl(url: string): string {\n if (url.startsWith('http://')) return `ws://${url.slice('http://'.length)}`;\n if (url.startsWith('https://')) return `wss://${url.slice('https://'.length)}`;\n return url;\n}\n\nexport function getTestEnv(): TestEnv {\n if (!hasE2EEnv) {\n throw new Error(\n 'Missing required env vars for e2e: LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET',\n );\n }\n return {\n url: normalizeLiveKitUrl(process.env.LIVEKIT_URL!),\n apiKey: process.env.LIVEKIT_API_KEY!,\n apiSecret: process.env.LIVEKIT_API_SECRET!,\n };\n}\n\nexport async function withTimeout<T>(\n promise: Promise<T>,\n timeoutMs: number,\n message: string,\n): Promise<T> {\n return await Promise.race([\n promise,\n (async () => {\n await delay(timeoutMs);\n throw new Error(message);\n })(),\n ]);\n}\n\nexport async function waitFor(\n condition: () => boolean,\n opts: { timeoutMs: number; intervalMs?: number; debugName?: string },\n): Promise<void> {\n const intervalMs = opts.intervalMs ?? 50;\n const deadline = Date.now() + opts.timeoutMs;\n while (Date.now() < deadline) {\n if (condition()) return;\n await delay(intervalMs);\n }\n throw new Error(`Timed out waiting for condition${opts.debugName ? ` (${opts.debugName})` : ''}`);\n}\n\nexport async function createJoinToken(params: {\n env: TestEnv;\n roomName: string;\n identity: string;\n name: string;\n}): Promise<string> {\n const token = new AccessToken(params.env.apiKey, params.env.apiSecret, {\n identity: params.identity,\n name: params.name,\n ttl: '30m',\n });\n token.addGrant({\n room: params.roomName,\n roomJoin: true,\n roomCreate: true,\n canPublish: true,\n canSubscribe: true,\n });\n return await token.toJwt();\n}\n\nexport async function connectTestRooms(\n count: number,\n /**\n * Extra room options applied to every room, e.g. data stream limits or\n * `encryption` to bring up the whole set with a shared e2ee key.\n */\n options?: Partial<RoomOptions>,\n): Promise<{ roomName: string; rooms: Room[] }> {\n const env = getTestEnv();\n const roomName = `test_room_${randomUUID()}`;\n const rooms = await Promise.all(\n Array.from({ length: count }, async (_, i) => {\n const token = await createJoinToken({\n env,\n roomName,\n identity: `p${i}`,\n name: `Participant ${i}`,\n });\n const room = new Room();\n await room.connect(env.url, token, {\n autoSubscribe: true,\n dynacast: false,\n ...options,\n });\n return room;\n }),\n );\n\n const start = Date.now();\n await waitFor(() => rooms.every((r) => r.remoteParticipants.size === count - 1), {\n timeoutMs: 5000,\n debugName: `participant visibility (${Date.now() - start}ms)`,\n });\n\n return { roomName, rooms };\n}\n\nexport function waitForRoomEvent<R>(\n room: Room,\n event: RoomEvent,\n timeoutMs: number,\n take: (...args: any[]) => R,\n /** Ignore emissions that don't match, e.g. events for another participant. */\n match?: (...args: unknown[]) => boolean,\n): Promise<R> {\n return withTimeout(\n new Promise<R>((resolve) => {\n const handler = (...args: any[]) => {\n if (match && !match(...args)) {\n return;\n }\n // typed-emitter doesn't expose `.once` in the type surface, so do manual once+cleanup.\n room.off(event as any, handler as any);\n resolve(take(...args));\n };\n room.on(event as any, handler as any);\n }),\n timeoutMs,\n `Timed out waiting for ${event}`,\n );\n}\n\nexport function concatUint8(chunks: Uint8Array[]): Uint8Array {\n const len = chunks.reduce((acc, c) => acc + c.byteLength, 0);\n const out = new Uint8Array(len);\n let offset = 0;\n for (const c of chunks) {\n out.set(c, offset);\n offset += c.byteLength;\n }\n return out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gCAA4B;AAC5B,yBAA2B;AAC3B,sBAAoC;AACpC,oBAAyB;AACzB,eAAuD;AAEhD,MAAM,YACX,CAAC,CAAC,QAAQ,IAAI,eAAe,CAAC,CAAC,QAAQ,IAAI,mBAAmB,CAAC,CA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ACF;AAEO,SAAS,YAAY,QAAkC;AAC5D,QAAM,MAAM,OAAO,OAAO,CAAC,KAAK,MAAM,MAAM,EAAE,YAAY,CAAC;AAC3D,QAAM,MAAM,IAAI,WAAW,GAAG;AAC9B,MAAI,SAAS;AACb,aAAW,KAAK,QAAQ;AACtB,QAAI,IAAI,GAAG,MAAM;AACjB,cAAU,EAAE;AAAA,EACd;AACA,SAAO;AACT;","names":["delay"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { describe } from 'vitest';
|
|
2
|
+
import '../ffi_client.cjs';
|
|
3
|
+
import { m as RoomOptions, j as Room, l as RoomEvent } from '../audio_stream-BNVaONuH.cjs';
|
|
4
|
+
import '@livekit/rtc-ffi-bindings';
|
|
5
|
+
import '@livekit/typed-emitter';
|
|
6
|
+
import 'node:stream/web';
|
|
7
|
+
import '../audio_frame.cjs';
|
|
8
|
+
import '../frame_processor.cjs';
|
|
9
|
+
import '../video_frame.cjs';
|
|
10
|
+
import '../audio_source.cjs';
|
|
11
|
+
import '../types-f7wTlFjs.cjs';
|
|
12
|
+
import '../e2ee.cjs';
|
|
13
|
+
import '@livekit/mutex';
|
|
14
|
+
import 'node:fs';
|
|
15
|
+
import '../data_streams/stream_writer.cjs';
|
|
16
|
+
import '../rpc.cjs';
|
|
17
|
+
import '../transcription.cjs';
|
|
18
|
+
import '../types.cjs';
|
|
19
|
+
import '../video_source.cjs';
|
|
20
|
+
|
|
21
|
+
declare const hasE2EEnv: boolean;
|
|
22
|
+
declare const describeE2E: typeof describe;
|
|
23
|
+
declare const testTimeoutMs = 10000;
|
|
24
|
+
type TestEnv = {
|
|
25
|
+
url: string;
|
|
26
|
+
apiKey: string;
|
|
27
|
+
apiSecret: string;
|
|
28
|
+
};
|
|
29
|
+
declare function getTestEnv(): TestEnv;
|
|
30
|
+
declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, message: string): Promise<T>;
|
|
31
|
+
declare function waitFor(condition: () => boolean, opts: {
|
|
32
|
+
timeoutMs: number;
|
|
33
|
+
intervalMs?: number;
|
|
34
|
+
debugName?: string;
|
|
35
|
+
}): Promise<void>;
|
|
36
|
+
declare function createJoinToken(params: {
|
|
37
|
+
env: TestEnv;
|
|
38
|
+
roomName: string;
|
|
39
|
+
identity: string;
|
|
40
|
+
name: string;
|
|
41
|
+
}): Promise<string>;
|
|
42
|
+
declare function connectTestRooms(count: number,
|
|
43
|
+
/**
|
|
44
|
+
* Extra room options applied to every room, e.g. data stream limits or
|
|
45
|
+
* `encryption` to bring up the whole set with a shared e2ee key.
|
|
46
|
+
*/
|
|
47
|
+
options?: Partial<RoomOptions>): Promise<{
|
|
48
|
+
roomName: string;
|
|
49
|
+
rooms: Room[];
|
|
50
|
+
}>;
|
|
51
|
+
declare function waitForRoomEvent<R>(room: Room, event: RoomEvent, timeoutMs: number, take: (...args: any[]) => R,
|
|
52
|
+
/** Ignore emissions that don't match, e.g. events for another participant. */
|
|
53
|
+
match?: (...args: unknown[]) => boolean): Promise<R>;
|
|
54
|
+
declare function concatUint8(chunks: Uint8Array[]): Uint8Array;
|
|
55
|
+
|
|
56
|
+
export { type TestEnv, concatUint8, connectTestRooms, createJoinToken, describeE2E, getTestEnv, hasE2EEnv, testTimeoutMs, waitFor, waitForRoomEvent, withTimeout };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { describe } from 'vitest';
|
|
2
|
+
import { Room, type RoomEvent, type RoomOptions } from '../index.js';
|
|
3
|
+
export declare const hasE2EEnv: boolean;
|
|
4
|
+
export declare const describeE2E: typeof describe;
|
|
5
|
+
export declare const testTimeoutMs = 10000;
|
|
6
|
+
export type TestEnv = {
|
|
7
|
+
url: string;
|
|
8
|
+
apiKey: string;
|
|
9
|
+
apiSecret: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function getTestEnv(): TestEnv;
|
|
12
|
+
export declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, message: string): Promise<T>;
|
|
13
|
+
export declare function waitFor(condition: () => boolean, opts: {
|
|
14
|
+
timeoutMs: number;
|
|
15
|
+
intervalMs?: number;
|
|
16
|
+
debugName?: string;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
export declare function createJoinToken(params: {
|
|
19
|
+
env: TestEnv;
|
|
20
|
+
roomName: string;
|
|
21
|
+
identity: string;
|
|
22
|
+
name: string;
|
|
23
|
+
}): Promise<string>;
|
|
24
|
+
export declare function connectTestRooms(count: number,
|
|
25
|
+
/**
|
|
26
|
+
* Extra room options applied to every room, e.g. data stream limits or
|
|
27
|
+
* `encryption` to bring up the whole set with a shared e2ee key.
|
|
28
|
+
*/
|
|
29
|
+
options?: Partial<RoomOptions>): Promise<{
|
|
30
|
+
roomName: string;
|
|
31
|
+
rooms: Room[];
|
|
32
|
+
}>;
|
|
33
|
+
export declare function waitForRoomEvent<R>(room: Room, event: RoomEvent, timeoutMs: number, take: (...args: any[]) => R,
|
|
34
|
+
/** Ignore emissions that don't match, e.g. events for another participant. */
|
|
35
|
+
match?: (...args: unknown[]) => boolean): Promise<R>;
|
|
36
|
+
export declare function concatUint8(chunks: Uint8Array[]): Uint8Array;
|
|
37
|
+
//# sourceMappingURL=e2e_common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e2e_common.d.ts","sourceRoot":"","sources":["../../src/tests/e2e_common.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAErE,eAAO,MAAM,SAAS,SAC0E,CAAC;AAGjG,eAAO,MAAM,WAAW,EAAE,OAAO,QAEK,CAAC;AACvC,eAAO,MAAM,aAAa,QAAS,CAAC;AAEpC,MAAM,MAAM,OAAO,GAAG;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAQF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@
|
|
|
1
1
|
import '@livekit/rtc-ffi-bindings';
|
|
2
2
|
import './audio_source.cjs';
|
|
3
|
-
export { a as AudioTrack, L as LocalAudioTrack, c as LocalTrack, e as LocalVideoTrack, R as RemoteAudioTrack, g as RemoteTrack, i as RemoteVideoTrack, T as Track, V as VideoTrack } from './audio_stream-
|
|
3
|
+
export { a as AudioTrack, L as LocalAudioTrack, c as LocalTrack, e as LocalVideoTrack, R as RemoteAudioTrack, g as RemoteTrack, i as RemoteVideoTrack, T as Track, V as VideoTrack } from './audio_stream-BNVaONuH.cjs';
|
|
4
4
|
import './ffi_client.cjs';
|
|
5
5
|
import './video_source.cjs';
|
|
6
6
|
import './audio_frame.cjs';
|
|
@@ -8,7 +8,7 @@ import 'node:stream/web';
|
|
|
8
8
|
import './frame_processor.cjs';
|
|
9
9
|
import './video_frame.cjs';
|
|
10
10
|
import '@livekit/typed-emitter';
|
|
11
|
-
import './types-
|
|
11
|
+
import './types-f7wTlFjs.cjs';
|
|
12
12
|
import './e2ee.cjs';
|
|
13
13
|
import '@livekit/mutex';
|
|
14
14
|
import 'node:fs';
|
package/dist/track.d.ts
CHANGED
|
@@ -1,18 +1,67 @@
|
|
|
1
|
-
import '@livekit/rtc-ffi-bindings';
|
|
2
|
-
import './audio_source.js';
|
|
3
|
-
|
|
4
|
-
import './ffi_client.js';
|
|
5
|
-
import './
|
|
6
|
-
import './
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import type { OwnedTrack, StreamState, TrackInfo, TrackKind } from '@livekit/rtc-ffi-bindings';
|
|
2
|
+
import type { AudioSource } from './audio_source.js';
|
|
3
|
+
import type { AudioStreamSource } from './audio_stream.js';
|
|
4
|
+
import { FfiHandle } from './ffi_client.js';
|
|
5
|
+
import type { Room } from './room.js';
|
|
6
|
+
import type { VideoSource } from './video_source.js';
|
|
7
|
+
export declare abstract class Track {
|
|
8
|
+
/** @internal */
|
|
9
|
+
info?: TrackInfo;
|
|
10
|
+
/** @internal */
|
|
11
|
+
ffi_handle: FfiHandle;
|
|
12
|
+
private roomRef;
|
|
13
|
+
private audioStreams;
|
|
14
|
+
private streamFinalizationRegistry;
|
|
15
|
+
private onRoomTokenRefreshed;
|
|
16
|
+
constructor(owned: OwnedTrack);
|
|
17
|
+
/** @internal */
|
|
18
|
+
resolveRoom(): Room | null;
|
|
19
|
+
/** @internal */
|
|
20
|
+
setRoom(room: Room | null): void;
|
|
21
|
+
/** @internal */
|
|
22
|
+
registerAudioStream(stream: AudioStreamSource): void;
|
|
23
|
+
/** @internal */
|
|
24
|
+
unregisterAudioStream(stream: AudioStreamSource): void;
|
|
25
|
+
/**
|
|
26
|
+
* End every {@link AudioStream} attached to this track.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* The FFI keeps feeding an audio stream until the stream's own handle is
|
|
30
|
+
* dropped, so streams on a track that is no longer subscribed would otherwise
|
|
31
|
+
* go on delivering audio for the lifetime of the process.
|
|
32
|
+
*
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
closeAudioStreams(): void;
|
|
36
|
+
private iterateStreams;
|
|
37
|
+
private pushProcessorMetadataToStream;
|
|
38
|
+
get sid(): string | undefined;
|
|
39
|
+
get name(): string | undefined;
|
|
40
|
+
get kind(): TrackKind | undefined;
|
|
41
|
+
get stream_state(): StreamState | undefined;
|
|
42
|
+
get muted(): boolean | undefined;
|
|
43
|
+
close(): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
export declare class LocalAudioTrack extends Track {
|
|
46
|
+
private source?;
|
|
47
|
+
constructor(owned: OwnedTrack, source?: AudioSource);
|
|
48
|
+
static createAudioTrack(name: string, source: AudioSource): LocalAudioTrack;
|
|
49
|
+
close(closeSource?: boolean): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
export declare class LocalVideoTrack extends Track {
|
|
52
|
+
private source?;
|
|
53
|
+
constructor(owned: OwnedTrack, source?: VideoSource);
|
|
54
|
+
static createVideoTrack(name: string, source: VideoSource): LocalVideoTrack;
|
|
55
|
+
close(closeSource?: boolean): Promise<void>;
|
|
56
|
+
}
|
|
57
|
+
export declare class RemoteVideoTrack extends Track {
|
|
58
|
+
constructor(owned: OwnedTrack);
|
|
59
|
+
}
|
|
60
|
+
export declare class RemoteAudioTrack extends Track {
|
|
61
|
+
constructor(owned: OwnedTrack);
|
|
62
|
+
}
|
|
63
|
+
export type LocalTrack = LocalVideoTrack | LocalAudioTrack;
|
|
64
|
+
export type RemoteTrack = RemoteVideoTrack | RemoteAudioTrack;
|
|
65
|
+
export type AudioTrack = LocalAudioTrack | RemoteAudioTrack;
|
|
66
|
+
export type VideoTrack = LocalVideoTrack | RemoteVideoTrack;
|
|
67
|
+
//# sourceMappingURL=track.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@livekit/rtc-ffi-bindings';
|
|
2
|
-
export { d as LocalTrackPublication, h as RemoteTrackPublication,
|
|
2
|
+
export { d as LocalTrackPublication, h as RemoteTrackPublication, o as TrackPublication } from './audio_stream-BNVaONuH.cjs';
|
|
3
3
|
import 'node:stream/web';
|
|
4
4
|
import './audio_frame.cjs';
|
|
5
5
|
import './frame_processor.cjs';
|
|
@@ -7,7 +7,7 @@ import './video_frame.cjs';
|
|
|
7
7
|
import './audio_source.cjs';
|
|
8
8
|
import './ffi_client.cjs';
|
|
9
9
|
import '@livekit/typed-emitter';
|
|
10
|
-
import './types-
|
|
10
|
+
import './types-f7wTlFjs.cjs';
|
|
11
11
|
import './e2ee.cjs';
|
|
12
12
|
import '@livekit/mutex';
|
|
13
13
|
import 'node:fs';
|
|
@@ -1,18 +1,45 @@
|
|
|
1
|
-
import '@livekit/rtc-ffi-bindings';
|
|
2
|
-
|
|
3
|
-
import '
|
|
4
|
-
import './
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import type { EncryptionType } from '@livekit/rtc-ffi-bindings';
|
|
2
|
+
import type { OwnedTrackPublication, TrackKind, TrackPublicationInfo, TrackSource } from '@livekit/rtc-ffi-bindings';
|
|
3
|
+
import { FfiHandle } from '@livekit/rtc-ffi-bindings';
|
|
4
|
+
import type { Track } from './track.js';
|
|
5
|
+
export declare abstract class TrackPublication {
|
|
6
|
+
/** @internal */
|
|
7
|
+
ffiHandle: FfiHandle;
|
|
8
|
+
/** @internal */
|
|
9
|
+
info?: TrackPublicationInfo;
|
|
10
|
+
track?: Track;
|
|
11
|
+
constructor(ownedInfo: OwnedTrackPublication);
|
|
12
|
+
get sid(): string | undefined;
|
|
13
|
+
get name(): string | undefined;
|
|
14
|
+
get kind(): TrackKind | undefined;
|
|
15
|
+
get source(): TrackSource | undefined;
|
|
16
|
+
get simulcasted(): boolean | undefined;
|
|
17
|
+
get width(): number | undefined;
|
|
18
|
+
get height(): number | undefined;
|
|
19
|
+
get mimeType(): string | undefined;
|
|
20
|
+
get muted(): boolean | undefined;
|
|
21
|
+
get encryptionType(): EncryptionType | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Update the publication's info in place. Used by the SDK when the
|
|
24
|
+
* server re-issues IDs / metadata for an existing publication (e.g.
|
|
25
|
+
* after a full reconnect). Application code holding a cached
|
|
26
|
+
* publication reference continues to read fresh values via the
|
|
27
|
+
* unchanged object identity.
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
updateInfo(info: TrackPublicationInfo): void;
|
|
31
|
+
}
|
|
32
|
+
export declare class LocalTrackPublication extends TrackPublication {
|
|
33
|
+
private firstSubscription;
|
|
34
|
+
private firstSubscriptionResolver;
|
|
35
|
+
constructor(ownedInfo: OwnedTrackPublication);
|
|
36
|
+
waitForSubscription(): Promise<void>;
|
|
37
|
+
/** @internal */
|
|
38
|
+
resolveFirstSubscription(): void;
|
|
39
|
+
}
|
|
40
|
+
export declare class RemoteTrackPublication extends TrackPublication {
|
|
41
|
+
subscribed: boolean;
|
|
42
|
+
constructor(ownedInfo: OwnedTrackPublication);
|
|
43
|
+
setSubscribed(subscribed: boolean): void;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=track_publication.d.ts.map
|
package/dist/transcription.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface TranscriptionSegment {
|
|
1
|
+
export interface TranscriptionSegment {
|
|
2
2
|
id: string;
|
|
3
3
|
text: string;
|
|
4
4
|
startTime: bigint;
|
|
@@ -6,10 +6,9 @@ interface TranscriptionSegment {
|
|
|
6
6
|
language: string;
|
|
7
7
|
final: boolean;
|
|
8
8
|
}
|
|
9
|
-
interface Transcription {
|
|
9
|
+
export interface Transcription {
|
|
10
10
|
participantIdentity: string;
|
|
11
11
|
trackSid: string;
|
|
12
12
|
segments: TranscriptionSegment[];
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
export type { Transcription, TranscriptionSegment };
|
|
14
|
+
//# sourceMappingURL=transcription.d.ts.map
|
|
@@ -5,9 +5,34 @@ declare abstract class BaseStreamReader<T extends BaseStreamInfo> {
|
|
|
5
5
|
protected totalByteSize?: number;
|
|
6
6
|
protected _info: T;
|
|
7
7
|
protected bytesReceived: number;
|
|
8
|
+
private closed;
|
|
9
|
+
private activeReader;
|
|
8
10
|
get info(): T;
|
|
9
11
|
constructor(info: T, stream: ReadableStream<DataStream_Chunk>, totalByteSize?: number);
|
|
10
|
-
protected
|
|
12
|
+
protected handleChunkReceived(chunk: DataStream_Chunk): void;
|
|
13
|
+
/** Takes the stream's reader for an iteration, remembering it so that
|
|
14
|
+
* close() can cancel a read that is still in flight. */
|
|
15
|
+
protected acquireReader(): ReadableStreamDefaultReader<DataStream_Chunk>;
|
|
16
|
+
/** Releases the stream lock after an iteration ended on its own — because a
|
|
17
|
+
* read reported end-of-stream, or because the stream itself errored. Either
|
|
18
|
+
* way the stream is in a terminal state and the FFI subscription behind it
|
|
19
|
+
* was already dropped by that terminal event, so there is nothing to cancel.
|
|
20
|
+
*
|
|
21
|
+
* An error raised *around* a read rather than by it — a chunk that failed to
|
|
22
|
+
* process — leaves the stream live, so it has to go through close() instead. */
|
|
23
|
+
protected finishIteration(reader: ReadableStreamDefaultReader<DataStream_Chunk>): void;
|
|
24
|
+
/**
|
|
25
|
+
* Stops receiving this stream and releases the resources behind it.
|
|
26
|
+
*
|
|
27
|
+
* A reader is subscribed to FFI events from the moment it is handed to a
|
|
28
|
+
* stream handler, and only unsubscribes once a read consumes the stream's
|
|
29
|
+
* end-of-stream event. So a reader that is abandoned part-way through, or
|
|
30
|
+
* that a handler never reads at all, has to be closed here or its
|
|
31
|
+
* subscription lives for the rest of the process. Reading to completion — or
|
|
32
|
+
* breaking out of a `for await` — closes the reader for you, and closing an
|
|
33
|
+
* already-closed reader is a no-op.
|
|
34
|
+
*/
|
|
35
|
+
close(): Promise<void>;
|
|
11
36
|
onProgress?: (progress: number | undefined) => void;
|
|
12
37
|
abstract readAll(): Promise<string | Array<Uint8Array>>;
|
|
13
38
|
}
|
|
@@ -15,10 +40,9 @@ declare abstract class BaseStreamReader<T extends BaseStreamInfo> {
|
|
|
15
40
|
* A class to read chunks from a ReadableStream and provide them in a structured format.
|
|
16
41
|
*/
|
|
17
42
|
declare class ByteStreamReader extends BaseStreamReader<ByteStreamInfo> {
|
|
18
|
-
protected handleChunkReceived(chunk: DataStream_Chunk): void;
|
|
19
43
|
[Symbol.asyncIterator](): {
|
|
20
44
|
next: () => Promise<IteratorResult<Uint8Array>>;
|
|
21
|
-
return()
|
|
45
|
+
return: () => Promise<IteratorResult<Uint8Array>>;
|
|
22
46
|
};
|
|
23
47
|
readAll(): Promise<Array<Uint8Array>>;
|
|
24
48
|
}
|
|
@@ -26,13 +50,6 @@ declare class ByteStreamReader extends BaseStreamReader<ByteStreamInfo> {
|
|
|
26
50
|
* A class to read chunks from a ReadableStream and provide them in a structured format.
|
|
27
51
|
*/
|
|
28
52
|
declare class TextStreamReader extends BaseStreamReader<TextStreamInfo> {
|
|
29
|
-
private receivedChunks;
|
|
30
|
-
/**
|
|
31
|
-
* A TextStreamReader instance can be used as an AsyncIterator that returns the entire string
|
|
32
|
-
* that has been received up to the current point in time.
|
|
33
|
-
*/
|
|
34
|
-
constructor(info: TextStreamInfo, stream: ReadableStream<DataStream_Chunk>, totalChunkCount?: number);
|
|
35
|
-
protected handleChunkReceived(chunk: DataStream_Chunk): void;
|
|
36
53
|
/**
|
|
37
54
|
* Async iterator implementation to allow usage of `for await...of` syntax.
|
|
38
55
|
* Yields structured chunks from the stream.
|
|
@@ -40,7 +57,7 @@ declare class TextStreamReader extends BaseStreamReader<TextStreamInfo> {
|
|
|
40
57
|
*/
|
|
41
58
|
[Symbol.asyncIterator](): {
|
|
42
59
|
next: () => Promise<IteratorResult<string>>;
|
|
43
|
-
return()
|
|
60
|
+
return: () => Promise<IteratorResult<string>>;
|
|
44
61
|
};
|
|
45
62
|
readAll(): Promise<string>;
|
|
46
63
|
}
|
|
@@ -76,6 +93,12 @@ interface TextStreamOptions extends DataStreamOptions {
|
|
|
76
93
|
interface ByteStreamOptions extends DataStreamOptions {
|
|
77
94
|
name?: string;
|
|
78
95
|
onProgress?: (progress: number) => void;
|
|
96
|
+
/**
|
|
97
|
+
* Whether the payload may be compressed on the wire. Defaults to true;
|
|
98
|
+
* compression is only applied when it actually reduces the payload size
|
|
99
|
+
* and every recipient supports it.
|
|
100
|
+
*/
|
|
101
|
+
compress?: boolean;
|
|
79
102
|
}
|
|
80
103
|
type ByteStreamHandler = (reader: ByteStreamReader, participantInfo: {
|
|
81
104
|
identity: string;
|
package/dist/types.d.ts
CHANGED
package/dist/utils.cjs
CHANGED
|
@@ -19,8 +19,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var utils_exports = {};
|
|
20
20
|
__export(utils_exports, {
|
|
21
21
|
bigIntToNumber: () => bigIntToNumber,
|
|
22
|
+
byteStreamInfoFromProto: () => byteStreamInfoFromProto,
|
|
22
23
|
numberToBigInt: () => numberToBigInt,
|
|
23
|
-
splitUtf8: () => splitUtf8
|
|
24
|
+
splitUtf8: () => splitUtf8,
|
|
25
|
+
textStreamInfoFromProto: () => textStreamInfoFromProto
|
|
24
26
|
});
|
|
25
27
|
module.exports = __toCommonJS(utils_exports);
|
|
26
28
|
function bigIntToNumber(value) {
|
|
@@ -52,10 +54,33 @@ function splitUtf8(s, n) {
|
|
|
52
54
|
}
|
|
53
55
|
return result;
|
|
54
56
|
}
|
|
57
|
+
function textStreamInfoFromProto(info) {
|
|
58
|
+
return {
|
|
59
|
+
streamId: info.streamId,
|
|
60
|
+
mimeType: info.mimeType,
|
|
61
|
+
topic: info.topic,
|
|
62
|
+
timestamp: bigIntToNumber(info.timestamp),
|
|
63
|
+
totalSize: info.totalLength ? bigIntToNumber(info.totalLength) : void 0,
|
|
64
|
+
attributes: info.attributes
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function byteStreamInfoFromProto(info) {
|
|
68
|
+
return {
|
|
69
|
+
streamId: info.streamId,
|
|
70
|
+
name: info.name ?? "unknown",
|
|
71
|
+
mimeType: info.mimeType,
|
|
72
|
+
topic: info.topic,
|
|
73
|
+
timestamp: bigIntToNumber(info.timestamp),
|
|
74
|
+
totalSize: info.totalLength !== void 0 ? bigIntToNumber(info.totalLength) : void 0,
|
|
75
|
+
attributes: info.attributes
|
|
76
|
+
};
|
|
77
|
+
}
|
|
55
78
|
// Annotate the CommonJS export names for ESM import in node:
|
|
56
79
|
0 && (module.exports = {
|
|
57
80
|
bigIntToNumber,
|
|
81
|
+
byteStreamInfoFromProto,
|
|
58
82
|
numberToBigInt,
|
|
59
|
-
splitUtf8
|
|
83
|
+
splitUtf8,
|
|
84
|
+
textStreamInfoFromProto
|
|
60
85
|
});
|
|
61
86
|
//# sourceMappingURL=utils.cjs.map
|