@eyepop.ai/eyepop 1.12.1 → 1.13.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.
- package/dist/eyepop.index.d.mts +11 -2
- package/dist/eyepop.index.d.ts +11 -2
- package/dist/eyepop.index.js +31 -4
- package/dist/eyepop.index.js.map +1 -1
- package/dist/eyepop.index.mjs +30 -4
- 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
|
@@ -8903,10 +8903,11 @@ var UploadJob = class extends AbstractJob {
|
|
|
8903
8903
|
get [Symbol.toStringTag]() {
|
|
8904
8904
|
return "uploadJob";
|
|
8905
8905
|
}
|
|
8906
|
-
constructor(stream, mimeType, params, getSession, client, requestLogger) {
|
|
8906
|
+
constructor(stream, mimeType, videoMode, params, getSession, client, requestLogger) {
|
|
8907
8907
|
super(params, getSession, client, requestLogger);
|
|
8908
8908
|
this._uploadStream = stream;
|
|
8909
8909
|
this._mimeType = mimeType;
|
|
8910
|
+
this._videoMode = videoMode;
|
|
8910
8911
|
this._needsFullDuplex = !client.isFullDuplex() && mimeType.startsWith("video/");
|
|
8911
8912
|
}
|
|
8912
8913
|
async onEvent(event) {
|
|
@@ -8919,7 +8920,8 @@ var UploadJob = class extends AbstractJob {
|
|
|
8919
8920
|
return Promise.reject("session.baseUrl must not ne null");
|
|
8920
8921
|
}
|
|
8921
8922
|
let request;
|
|
8922
|
-
const
|
|
8923
|
+
const videoModeQuery = this._videoMode ? `&videoMode=${this._videoMode}` : "";
|
|
8924
|
+
const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=async&sourceId=${event.source_id}${videoModeQuery}`;
|
|
8923
8925
|
if (this._params) {
|
|
8924
8926
|
this._requestLogger.debug("before POST %s with multipart body because of params", postUrl);
|
|
8925
8927
|
const params = JSON.stringify(this._params);
|
|
@@ -8990,7 +8992,8 @@ var UploadJob = class extends AbstractJob {
|
|
|
8990
8992
|
});
|
|
8991
8993
|
this._requestLogger.debug("after POST {} to prepare full duplex upload {} {}", prepareUrl, response.status, response.statusText);
|
|
8992
8994
|
} else {
|
|
8993
|
-
const
|
|
8995
|
+
const videoModeQuery = this._videoMode ? `&videoMode=${this._videoMode}` : "";
|
|
8996
|
+
const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync${videoModeQuery}`;
|
|
8994
8997
|
if (this._params) {
|
|
8995
8998
|
this._requestLogger.debug("before POST {} with multipart body because of params", postUrl);
|
|
8996
8999
|
const params = JSON.stringify(this._params);
|
|
@@ -9532,6 +9535,15 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9532
9535
|
resolvePath = async (source) => {
|
|
9533
9536
|
throw new DOMException("resolving a path to a file is not supported in browser");
|
|
9534
9537
|
};
|
|
9538
|
+
} else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
9539
|
+
resolvePath = async (source) => {
|
|
9540
|
+
const response = await fetch(`file://${source.path}`);
|
|
9541
|
+
const blob = await response.blob();
|
|
9542
|
+
return {
|
|
9543
|
+
stream: blob,
|
|
9544
|
+
mimeType: source.mimeType || "image/*"
|
|
9545
|
+
};
|
|
9546
|
+
};
|
|
9535
9547
|
} else {
|
|
9536
9548
|
let iteratorToStream = function(iterator) {
|
|
9537
9549
|
return new ReadableStream({
|
|
@@ -9558,7 +9570,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9558
9570
|
const stream = fd.createReadStream();
|
|
9559
9571
|
const iterator = nodeStreamToIterator(stream);
|
|
9560
9572
|
const webStream = iteratorToStream(iterator);
|
|
9561
|
-
const mimeType = mime.lookup(source.path) || "
|
|
9573
|
+
const mimeType = source.mimeType ? source.mimeType : mime.lookup(source.path) || "image/*";
|
|
9562
9574
|
return {
|
|
9563
9575
|
stream: webStream,
|
|
9564
9576
|
mimeType
|
|
@@ -10331,6 +10343,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10331
10343
|
const job = new UploadJob(
|
|
10332
10344
|
source.file.stream(),
|
|
10333
10345
|
source.file.type,
|
|
10346
|
+
source.videoMode,
|
|
10334
10347
|
params,
|
|
10335
10348
|
async () => {
|
|
10336
10349
|
return this.session();
|
|
@@ -10361,6 +10374,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10361
10374
|
const job = new UploadJob(
|
|
10362
10375
|
source.stream,
|
|
10363
10376
|
source.mimeType,
|
|
10377
|
+
source.videoMode,
|
|
10364
10378
|
params,
|
|
10365
10379
|
async () => {
|
|
10366
10380
|
return this.session();
|
|
@@ -10392,6 +10406,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10392
10406
|
const job = new UploadJob(
|
|
10393
10407
|
streamSource.stream,
|
|
10394
10408
|
streamSource.mimeType,
|
|
10409
|
+
source.videoMode,
|
|
10395
10410
|
params,
|
|
10396
10411
|
async () => {
|
|
10397
10412
|
return this.session();
|
|
@@ -10413,6 +10428,11 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10413
10428
|
}
|
|
10414
10429
|
}
|
|
10415
10430
|
async loadFrom(source, params) {
|
|
10431
|
+
if (source.url.startsWith("file://")) {
|
|
10432
|
+
return await this.uploadPath({
|
|
10433
|
+
path: source.url.substring("file://".length)
|
|
10434
|
+
}, params);
|
|
10435
|
+
}
|
|
10416
10436
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
10417
10437
|
throw new Error("endpoint not connected, use connect() before loadFrom()");
|
|
10418
10438
|
}
|
|
@@ -11501,6 +11521,11 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11501
11521
|
};
|
|
11502
11522
|
|
|
11503
11523
|
// worker/worker_types.ts
|
|
11524
|
+
var VideoMode = /* @__PURE__ */ ((VideoMode2) => {
|
|
11525
|
+
VideoMode2["stream"] = "stream";
|
|
11526
|
+
VideoMode2["buffer"] = "buffer";
|
|
11527
|
+
return VideoMode2;
|
|
11528
|
+
})(VideoMode || {});
|
|
11504
11529
|
var ModelFormat = /* @__PURE__ */ ((ModelFormat2) => {
|
|
11505
11530
|
ModelFormat2["TensorFlowLite"] = "TensorFlowLite";
|
|
11506
11531
|
ModelFormat2["TensorFlowGraphDef"] = "TensorFlowGraphDef";
|
|
@@ -11700,6 +11725,7 @@ export {
|
|
|
11700
11725
|
TransientPopId,
|
|
11701
11726
|
UploadJob,
|
|
11702
11727
|
UserReview,
|
|
11728
|
+
VideoMode,
|
|
11703
11729
|
WebrtcBase,
|
|
11704
11730
|
WebrtcWhep,
|
|
11705
11731
|
WebrtcWhip,
|