@eyepop.ai/eyepop 1.12.0 → 1.12.2
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.mjs
CHANGED
|
@@ -8907,7 +8907,7 @@ var UploadJob = class extends AbstractJob {
|
|
|
8907
8907
|
super(params, getSession, client, requestLogger);
|
|
8908
8908
|
this._uploadStream = stream;
|
|
8909
8909
|
this._mimeType = mimeType;
|
|
8910
|
-
this._needsFullDuplex = mimeType.startsWith("video/");
|
|
8910
|
+
this._needsFullDuplex = !client.isFullDuplex() && mimeType.startsWith("video/");
|
|
8911
8911
|
}
|
|
8912
8912
|
async onEvent(event) {
|
|
8913
8913
|
if (event.type == "prepared") {
|
|
@@ -8980,7 +8980,7 @@ var UploadJob = class extends AbstractJob {
|
|
|
8980
8980
|
...session.authenticationHeaders(),
|
|
8981
8981
|
Accept: "application/jsonl"
|
|
8982
8982
|
};
|
|
8983
|
-
this._requestLogger.debug("before POST
|
|
8983
|
+
this._requestLogger.debug("before POST {} to prepare full duplex upload", prepareUrl);
|
|
8984
8984
|
response = await this._client.fetch(prepareUrl, {
|
|
8985
8985
|
headers,
|
|
8986
8986
|
method: "POST",
|
|
@@ -8988,11 +8988,11 @@ var UploadJob = class extends AbstractJob {
|
|
|
8988
8988
|
// @ts-ignore
|
|
8989
8989
|
duplex: "half"
|
|
8990
8990
|
});
|
|
8991
|
-
this._requestLogger.debug("after POST
|
|
8991
|
+
this._requestLogger.debug("after POST {} to prepare full duplex upload {} {}", prepareUrl, response.status, response.statusText);
|
|
8992
8992
|
} else {
|
|
8993
8993
|
const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync`;
|
|
8994
8994
|
if (this._params) {
|
|
8995
|
-
this._requestLogger.debug("before POST
|
|
8995
|
+
this._requestLogger.debug("before POST {} with multipart body because of params", postUrl);
|
|
8996
8996
|
const params = JSON.stringify(this._params);
|
|
8997
8997
|
const paramBlob = new Blob([params], { type: "application/json" });
|
|
8998
8998
|
const formData = new FormData();
|
|
@@ -9532,6 +9532,15 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9532
9532
|
resolvePath = async (source) => {
|
|
9533
9533
|
throw new DOMException("resolving a path to a file is not supported in browser");
|
|
9534
9534
|
};
|
|
9535
|
+
} else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
9536
|
+
resolvePath = async (source) => {
|
|
9537
|
+
const response = await fetch(`file://${source.path}`);
|
|
9538
|
+
const blob = await response.blob();
|
|
9539
|
+
return {
|
|
9540
|
+
stream: blob,
|
|
9541
|
+
mimeType: source.mimeType || "image/*"
|
|
9542
|
+
};
|
|
9543
|
+
};
|
|
9535
9544
|
} else {
|
|
9536
9545
|
let iteratorToStream = function(iterator) {
|
|
9537
9546
|
return new ReadableStream({
|
|
@@ -9558,7 +9567,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9558
9567
|
const stream = fd.createReadStream();
|
|
9559
9568
|
const iterator = nodeStreamToIterator(stream);
|
|
9560
9569
|
const webStream = iteratorToStream(iterator);
|
|
9561
|
-
const mimeType = mime.lookup(source.path) || "
|
|
9570
|
+
const mimeType = source.mimeType ? source.mimeType : mime.lookup(source.path) || "image/*";
|
|
9562
9571
|
return {
|
|
9563
9572
|
stream: webStream,
|
|
9564
9573
|
mimeType
|
|
@@ -9578,6 +9587,9 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9578
9587
|
}
|
|
9579
9588
|
async close() {
|
|
9580
9589
|
}
|
|
9590
|
+
isFullDuplex() {
|
|
9591
|
+
return false;
|
|
9592
|
+
}
|
|
9581
9593
|
}
|
|
9582
9594
|
createHttpClient = async () => {
|
|
9583
9595
|
return new BrowserHttpClient();
|
|
@@ -9593,6 +9605,9 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9593
9605
|
}
|
|
9594
9606
|
async close() {
|
|
9595
9607
|
}
|
|
9608
|
+
isFullDuplex() {
|
|
9609
|
+
return true;
|
|
9610
|
+
}
|
|
9596
9611
|
}
|
|
9597
9612
|
createHttpClient = async () => {
|
|
9598
9613
|
return new ReactNativeHttpClient();
|
|
@@ -9610,6 +9625,9 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9610
9625
|
async close() {
|
|
9611
9626
|
return this.agent.close();
|
|
9612
9627
|
}
|
|
9628
|
+
isFullDuplex() {
|
|
9629
|
+
return false;
|
|
9630
|
+
}
|
|
9613
9631
|
}
|
|
9614
9632
|
createHttpClient = async () => {
|
|
9615
9633
|
const undici = __require("undici");
|
|
@@ -10404,6 +10422,11 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10404
10422
|
}
|
|
10405
10423
|
}
|
|
10406
10424
|
async loadFrom(source, params) {
|
|
10425
|
+
if (source.url.startsWith("file://")) {
|
|
10426
|
+
return await this.uploadPath({
|
|
10427
|
+
path: source.url.substring("file://".length)
|
|
10428
|
+
}, params);
|
|
10429
|
+
}
|
|
10407
10430
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
10408
10431
|
throw new Error("endpoint not connected, use connect() before loadFrom()");
|
|
10409
10432
|
}
|