@eyepop.ai/eyepop 1.11.3 → 1.11.5
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/eyepop.index.d.mts +0 -11
- package/dist/eyepop.index.d.ts +0 -11
- package/dist/eyepop.index.js +14 -84
- package/dist/eyepop.index.js.map +1 -1
- package/dist/eyepop.index.mjs +14 -84
- package/dist/eyepop.index.mjs.map +1 -1
- package/dist/eyepop.min.js +1 -1
- package/package.json +1 -1
package/dist/eyepop.index.mjs
CHANGED
|
@@ -8655,9 +8655,6 @@ var Stream = class _Stream {
|
|
|
8655
8655
|
const lineDecoder = new EyepopLineDecoder();
|
|
8656
8656
|
const iter = readableStreamAsyncIterable(await readableStream);
|
|
8657
8657
|
for await (let chunk of iter) {
|
|
8658
|
-
if (typeof chunk === "number") {
|
|
8659
|
-
chunk = new Uint8Array([chunk & 255]);
|
|
8660
|
-
}
|
|
8661
8658
|
for (const line of lineDecoder.decode(chunk)) {
|
|
8662
8659
|
yield line;
|
|
8663
8660
|
}
|
|
@@ -8696,48 +8693,6 @@ var Stream = class _Stream {
|
|
|
8696
8693
|
}
|
|
8697
8694
|
return iterator();
|
|
8698
8695
|
}
|
|
8699
|
-
/**
|
|
8700
|
-
* Generates a Stream from a newline-separated ReadableStream
|
|
8701
|
-
* where each item is a JSON value.
|
|
8702
|
-
*/
|
|
8703
|
-
static fromReadableStream(readableStream, controller) {
|
|
8704
|
-
let consumed = false;
|
|
8705
|
-
async function* iterLines() {
|
|
8706
|
-
const lineDecoder = new EyepopLineDecoder();
|
|
8707
|
-
const iter = readableStreamAsyncIterable(readableStream);
|
|
8708
|
-
for await (let chunk of iter) {
|
|
8709
|
-
if (typeof chunk === "number") {
|
|
8710
|
-
chunk = new Uint8Array([chunk & 255]);
|
|
8711
|
-
}
|
|
8712
|
-
for (const line of lineDecoder.decode(chunk)) {
|
|
8713
|
-
yield line;
|
|
8714
|
-
}
|
|
8715
|
-
}
|
|
8716
|
-
for (const line of lineDecoder.flush()) {
|
|
8717
|
-
yield line;
|
|
8718
|
-
}
|
|
8719
|
-
}
|
|
8720
|
-
async function* iterator() {
|
|
8721
|
-
if (consumed) {
|
|
8722
|
-
throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");
|
|
8723
|
-
}
|
|
8724
|
-
consumed = true;
|
|
8725
|
-
let done = false;
|
|
8726
|
-
try {
|
|
8727
|
-
for await (const line of iterLines()) {
|
|
8728
|
-
if (done) continue;
|
|
8729
|
-
if (line) yield JSON.parse(line);
|
|
8730
|
-
}
|
|
8731
|
-
done = true;
|
|
8732
|
-
} catch (e) {
|
|
8733
|
-
if (e instanceof Error && e.name === "AbortError") return;
|
|
8734
|
-
throw e;
|
|
8735
|
-
} finally {
|
|
8736
|
-
if (!done) controller.abort();
|
|
8737
|
-
}
|
|
8738
|
-
}
|
|
8739
|
-
return new _Stream(iterator, controller);
|
|
8740
|
-
}
|
|
8741
8696
|
[Symbol.asyncIterator]() {
|
|
8742
8697
|
return this.iterator();
|
|
8743
8698
|
}
|
|
@@ -8763,34 +8718,6 @@ var Stream = class _Stream {
|
|
|
8763
8718
|
};
|
|
8764
8719
|
return [new _Stream(() => teeIterator(left), this.controller), new _Stream(() => teeIterator(right), this.controller)];
|
|
8765
8720
|
}
|
|
8766
|
-
/**
|
|
8767
|
-
* Converts this stream to a newline-separated ReadableStream of
|
|
8768
|
-
* JSON stringified values in the stream
|
|
8769
|
-
* which can be turned back into a Stream with `Stream.fromReadableStream()`.
|
|
8770
|
-
*/
|
|
8771
|
-
toReadableStream() {
|
|
8772
|
-
const self = this;
|
|
8773
|
-
let iter;
|
|
8774
|
-
const encoder = new TextEncoder();
|
|
8775
|
-
return new ReadableStream({
|
|
8776
|
-
async start() {
|
|
8777
|
-
iter = self[Symbol.asyncIterator]();
|
|
8778
|
-
},
|
|
8779
|
-
async pull(ctrl) {
|
|
8780
|
-
try {
|
|
8781
|
-
const { value, done } = await iter.next();
|
|
8782
|
-
if (done) return ctrl.close();
|
|
8783
|
-
const bytes = encoder.encode(JSON.stringify(value) + "\n");
|
|
8784
|
-
ctrl.enqueue(bytes);
|
|
8785
|
-
} catch (err) {
|
|
8786
|
-
ctrl.error(err);
|
|
8787
|
-
}
|
|
8788
|
-
},
|
|
8789
|
-
async cancel() {
|
|
8790
|
-
await iter.return?.();
|
|
8791
|
-
}
|
|
8792
|
-
});
|
|
8793
|
-
}
|
|
8794
8721
|
};
|
|
8795
8722
|
var _EyepopLineDecoder = class _EyepopLineDecoder {
|
|
8796
8723
|
// TextDecoder found in browsers; not typed to avoid pulling in either "dom" or "node" types.
|
|
@@ -8864,7 +8791,9 @@ _EyepopLineDecoder.NEWLINE_CHARS = /* @__PURE__ */ new Set(["\n", "\r", "\v", "\
|
|
|
8864
8791
|
_EyepopLineDecoder.NEWLINE_REGEXP = /\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g;
|
|
8865
8792
|
var EyepopLineDecoder = _EyepopLineDecoder;
|
|
8866
8793
|
function readableStreamAsyncIterable(stream) {
|
|
8867
|
-
if (stream[Symbol.asyncIterator])
|
|
8794
|
+
if (stream[Symbol.asyncIterator]) {
|
|
8795
|
+
return stream[Symbol.asyncIterator]();
|
|
8796
|
+
}
|
|
8868
8797
|
const reader = stream.getReader();
|
|
8869
8798
|
return {
|
|
8870
8799
|
async next() {
|
|
@@ -9422,7 +9351,7 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9422
9351
|
// worker/webrtc_whip.ts
|
|
9423
9352
|
var WebrtcWhip = class extends WebrtcBase {
|
|
9424
9353
|
constructor(stream, getSession, client, requestLogger) {
|
|
9425
|
-
super(getSession, client, uuidv4().toString(), "
|
|
9354
|
+
super(getSession, client, uuidv4().toString(), "liveIngress/whip", requestLogger);
|
|
9426
9355
|
this._stream = stream;
|
|
9427
9356
|
}
|
|
9428
9357
|
async start() {
|
|
@@ -9505,7 +9434,7 @@ var WebrtcWhip = class extends WebrtcBase {
|
|
|
9505
9434
|
// worker/webrtc_whep.ts
|
|
9506
9435
|
var WebrtcWhep = class extends WebrtcBase {
|
|
9507
9436
|
constructor(ingressId, getSession, client, requestLogger) {
|
|
9508
|
-
super(getSession, client, ingressId, "
|
|
9437
|
+
super(getSession, client, ingressId, "liveIngress/whep", requestLogger);
|
|
9509
9438
|
this._stream = null;
|
|
9510
9439
|
}
|
|
9511
9440
|
async close() {
|
|
@@ -9629,7 +9558,7 @@ var iteratorToStream2;
|
|
|
9629
9558
|
// shims/http_client.ts
|
|
9630
9559
|
var createHttpClient;
|
|
9631
9560
|
if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
9632
|
-
class
|
|
9561
|
+
class BrowserHttpClient {
|
|
9633
9562
|
constructor() {
|
|
9634
9563
|
}
|
|
9635
9564
|
async fetch(input, init) {
|
|
@@ -9640,14 +9569,15 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9640
9569
|
}
|
|
9641
9570
|
createHttpClient = async () => {
|
|
9642
9571
|
console.debug("EyePop: creating HttpClient in browser");
|
|
9643
|
-
return new
|
|
9572
|
+
return new BrowserHttpClient();
|
|
9644
9573
|
};
|
|
9645
|
-
}
|
|
9646
|
-
|
|
9647
|
-
class HttpClient2 {
|
|
9574
|
+
} else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
9575
|
+
class ReactNativeHttpClient {
|
|
9648
9576
|
constructor() {
|
|
9649
9577
|
}
|
|
9650
9578
|
async fetch(input, init) {
|
|
9579
|
+
init || (init = {});
|
|
9580
|
+
init.reactNative = { textStreaming: true };
|
|
9651
9581
|
return await fetch(input, init);
|
|
9652
9582
|
}
|
|
9653
9583
|
async close() {
|
|
@@ -9655,10 +9585,10 @@ if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
|
9655
9585
|
}
|
|
9656
9586
|
createHttpClient = async () => {
|
|
9657
9587
|
console.debug("EyePop: creating HttpClient in ReactNative");
|
|
9658
|
-
return new
|
|
9588
|
+
return new ReactNativeHttpClient();
|
|
9659
9589
|
};
|
|
9660
9590
|
} else {
|
|
9661
|
-
class
|
|
9591
|
+
class NodeHttpClient {
|
|
9662
9592
|
constructor(agent) {
|
|
9663
9593
|
this.agent = agent;
|
|
9664
9594
|
}
|
|
@@ -9680,7 +9610,7 @@ if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
|
9680
9610
|
// two parallel streaming requests to the same host seem to deadlock with pipelining > 0
|
|
9681
9611
|
pipelining: 0
|
|
9682
9612
|
});
|
|
9683
|
-
return new
|
|
9613
|
+
return new NodeHttpClient(agent);
|
|
9684
9614
|
};
|
|
9685
9615
|
}
|
|
9686
9616
|
|