@eyepop.ai/eyepop 1.14.1 → 1.14.3
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 +2 -1
- package/dist/eyepop.index.d.ts +2 -1
- package/dist/eyepop.index.js +42 -21
- package/dist/eyepop.index.js.map +1 -1
- package/dist/eyepop.index.mjs +40 -20
- 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
|
@@ -8817,6 +8817,14 @@ function readableStreamAsyncIterable(stream) {
|
|
|
8817
8817
|
}
|
|
8818
8818
|
};
|
|
8819
8819
|
}
|
|
8820
|
+
function readableStreamFromString(s) {
|
|
8821
|
+
return new ReadableStream({
|
|
8822
|
+
start(controller) {
|
|
8823
|
+
controller.enqueue(Buffer.from(s));
|
|
8824
|
+
controller.close();
|
|
8825
|
+
}
|
|
8826
|
+
});
|
|
8827
|
+
}
|
|
8820
8828
|
|
|
8821
8829
|
// worker/worker_types.ts
|
|
8822
8830
|
var VideoMode = /* @__PURE__ */ ((VideoMode2) => {
|
|
@@ -8927,12 +8935,18 @@ var AbstractJob = class {
|
|
|
8927
8935
|
} else if (response.status != 200) {
|
|
8928
8936
|
reject(`upload error ${response.status}: ${await response.text()}`);
|
|
8929
8937
|
break;
|
|
8930
|
-
} else if (
|
|
8931
|
-
reject("response body is empty");
|
|
8932
|
-
break;
|
|
8933
|
-
} else {
|
|
8938
|
+
} else if (response.body) {
|
|
8934
8939
|
resolve(response.body);
|
|
8935
8940
|
break;
|
|
8941
|
+
} else {
|
|
8942
|
+
const text = await response.text();
|
|
8943
|
+
if (text) {
|
|
8944
|
+
resolve(readableStreamFromString(text));
|
|
8945
|
+
break;
|
|
8946
|
+
} else {
|
|
8947
|
+
reject("response body is empty");
|
|
8948
|
+
break;
|
|
8949
|
+
}
|
|
8936
8950
|
}
|
|
8937
8951
|
} catch (error) {
|
|
8938
8952
|
if (retries--) {
|
|
@@ -9602,13 +9616,13 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9602
9616
|
throw new DOMException("resolving a path to a file is not supported in browser");
|
|
9603
9617
|
};
|
|
9604
9618
|
} else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
9605
|
-
let
|
|
9606
|
-
let
|
|
9607
|
-
let
|
|
9619
|
+
let RNFAName = "react-native-file-access";
|
|
9620
|
+
let RNFA;
|
|
9621
|
+
let RNFALoadError;
|
|
9608
9622
|
try {
|
|
9609
|
-
|
|
9623
|
+
RNFA = __require(RNFAName);
|
|
9610
9624
|
} catch (e) {
|
|
9611
|
-
|
|
9625
|
+
RNFALoadError = e;
|
|
9612
9626
|
}
|
|
9613
9627
|
let EFSName = "expo-file-system";
|
|
9614
9628
|
let EFS;
|
|
@@ -9619,19 +9633,21 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9619
9633
|
EFSLoadError = e;
|
|
9620
9634
|
}
|
|
9621
9635
|
resolvePath = async (source, logger) => {
|
|
9622
|
-
if (
|
|
9623
|
-
logger.debug("Using react-native-
|
|
9636
|
+
if (RNFA?.FileSystem?.readFileChunk !== void 0) {
|
|
9637
|
+
logger.debug("Using react-native-file-access to read local file");
|
|
9624
9638
|
const bufferSize = 1024 * 1024;
|
|
9625
9639
|
let pos = 0;
|
|
9640
|
+
const size = (await RNFA.FileSystem.stat(source.path)).size;
|
|
9626
9641
|
let eof = false;
|
|
9627
9642
|
const stream = new ReadableStream({
|
|
9628
9643
|
async pull(controller) {
|
|
9629
9644
|
if (eof) {
|
|
9630
9645
|
return;
|
|
9631
9646
|
}
|
|
9632
|
-
const
|
|
9647
|
+
const chunkSize = Math.min(bufferSize, size - pos);
|
|
9648
|
+
const chunkAsB64 = await RNFA.FileSystem.readFileChunk(source.path, pos, chunkSize, "base64");
|
|
9633
9649
|
if (chunkAsB64.length > 0) {
|
|
9634
|
-
const chunk = Buffer.from(chunkAsB64, "base64");
|
|
9650
|
+
const chunk = Buffer.from(chunkAsB64, "base64").subarray(0, chunkSize);
|
|
9635
9651
|
controller.enqueue(chunk);
|
|
9636
9652
|
pos += chunk.length;
|
|
9637
9653
|
} else {
|
|
@@ -9642,12 +9658,14 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9642
9658
|
});
|
|
9643
9659
|
return {
|
|
9644
9660
|
stream,
|
|
9645
|
-
size
|
|
9661
|
+
size,
|
|
9646
9662
|
mimeType: source.mimeType || "image/*"
|
|
9647
9663
|
};
|
|
9648
|
-
}
|
|
9664
|
+
}
|
|
9665
|
+
if (EFS?.readAsStringAsync !== void 0) {
|
|
9649
9666
|
logger.debug("Using expo-file-system to read local file");
|
|
9650
9667
|
const bufferSize = 1024 * 1024;
|
|
9668
|
+
const size = (await EFS.getInfoAsync(`file://${source.path}`)).size;
|
|
9651
9669
|
let pos = 0;
|
|
9652
9670
|
let eof = false;
|
|
9653
9671
|
const stream = new ReadableStream({
|
|
@@ -9655,8 +9673,9 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9655
9673
|
if (eof) {
|
|
9656
9674
|
return;
|
|
9657
9675
|
}
|
|
9676
|
+
const chunkSize = Math.min(bufferSize, size - pos);
|
|
9658
9677
|
const chunkAsB64 = await EFS.readAsStringAsync(`file://${source.path}`, {
|
|
9659
|
-
length:
|
|
9678
|
+
length: chunkSize,
|
|
9660
9679
|
position: pos,
|
|
9661
9680
|
encoding: "base64"
|
|
9662
9681
|
});
|
|
@@ -9672,11 +9691,11 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9672
9691
|
});
|
|
9673
9692
|
return {
|
|
9674
9693
|
stream,
|
|
9675
|
-
size
|
|
9694
|
+
size,
|
|
9676
9695
|
mimeType: source.mimeType || "image/*"
|
|
9677
9696
|
};
|
|
9678
9697
|
}
|
|
9679
|
-
|
|
9698
|
+
throw new Error(`Could not load '${RNFAName}' (reason" ${RNFALoadError}) or '${EFSName}' (reason" ${EFSLoadError}). Falling back to fetch() which might cause memory issues. Include either of those packages in your application to enable uploads via PathSource - or provide the stream itself via StreamSource.We will try to load file://${source.path} via fetch()`);
|
|
9680
9699
|
};
|
|
9681
9700
|
} else {
|
|
9682
9701
|
let iteratorToStream = function(iterator) {
|
|
@@ -10195,7 +10214,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
10195
10214
|
this.logger
|
|
10196
10215
|
);
|
|
10197
10216
|
} else {
|
|
10198
|
-
this.logger.warn(`[${TcpSockets}] Could not load '${TcpSocketsName}' (reason
|
|
10217
|
+
this.logger.warn(`[${TcpSockets}] Could not load '${TcpSocketsName}' (reason: ${TcpSocketsError}), include this package in your application to enable streamed uploads; without this package local files have to be loaded into memory uploading and this will cause Out-Of-Memory errors for large files.`);
|
|
10199
10218
|
try {
|
|
10200
10219
|
const chunks = [];
|
|
10201
10220
|
const reader = streamBody.getReader();
|
|
@@ -12294,7 +12313,8 @@ export {
|
|
|
12294
12313
|
WebrtcWhep,
|
|
12295
12314
|
WebrtcWhip,
|
|
12296
12315
|
WorkerEndpoint,
|
|
12297
|
-
index_default as default
|
|
12316
|
+
index_default as default,
|
|
12317
|
+
readableStreamFromString
|
|
12298
12318
|
};
|
|
12299
12319
|
/*! Bundled license information:
|
|
12300
12320
|
|