@eyepop.ai/eyepop 3.14.1 → 3.14.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/README.md +7 -7
- package/dist/eyepop.index.d.mts +727 -695
- package/dist/eyepop.index.d.ts +727 -695
- package/dist/eyepop.index.js +107 -73
- package/dist/eyepop.index.js.map +1 -1
- package/dist/eyepop.index.mjs +107 -72
- package/dist/eyepop.index.mjs.map +1 -1
- package/dist/eyepop.min.js +1 -1
- package/package.json +1 -1
package/dist/eyepop.index.js
CHANGED
|
@@ -8681,7 +8681,6 @@ __export(index_exports, {
|
|
|
8681
8681
|
InferenceType: () => InferenceType,
|
|
8682
8682
|
LoadFromAssetUuidJob: () => LoadFromAssetUuidJob,
|
|
8683
8683
|
LoadFromJob: () => LoadFromJob,
|
|
8684
|
-
LoadLiveIngressJob: () => LoadLiveIngressJob,
|
|
8685
8684
|
LoadMediaStreamJob: () => LoadMediaStreamJob,
|
|
8686
8685
|
ModelExportStatus: () => ModelExportStatus,
|
|
8687
8686
|
ModelFormat: () => ModelFormat,
|
|
@@ -9322,7 +9321,7 @@ var AbstractJob = class {
|
|
|
9322
9321
|
this._responseStream = null;
|
|
9323
9322
|
this._controller = new AbortController();
|
|
9324
9323
|
this._getSession = getSession;
|
|
9325
|
-
this._params = params
|
|
9324
|
+
this._params = params;
|
|
9326
9325
|
this._client = client;
|
|
9327
9326
|
this._requestLogger = requestLogger;
|
|
9328
9327
|
this._version = version;
|
|
@@ -9367,7 +9366,7 @@ var AbstractJob = class {
|
|
|
9367
9366
|
reject(`response ${response.status}: ${response.statusText}`);
|
|
9368
9367
|
break;
|
|
9369
9368
|
}
|
|
9370
|
-
} else if (response.
|
|
9369
|
+
} else if (!response.ok) {
|
|
9371
9370
|
reject(`upload error ${response.status}: ${await response.text()}`);
|
|
9372
9371
|
break;
|
|
9373
9372
|
} else if (response.body) {
|
|
@@ -9429,15 +9428,34 @@ var UploadJob = class extends AbstractJob {
|
|
|
9429
9428
|
return Promise.reject("session.baseUrl must not ne null");
|
|
9430
9429
|
}
|
|
9431
9430
|
let request;
|
|
9432
|
-
const
|
|
9433
|
-
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
|
-
|
|
9431
|
+
const queryParams = new URLSearchParams({
|
|
9432
|
+
mode: "queue",
|
|
9433
|
+
processing: "async",
|
|
9434
|
+
sourceId: event.source_id
|
|
9435
|
+
});
|
|
9436
|
+
if (this._videoMode !== void 0) {
|
|
9437
|
+
queryParams.set("videoMode", this._videoMode);
|
|
9438
|
+
}
|
|
9439
|
+
if (this._version !== void 0) {
|
|
9440
|
+
queryParams.set("version", this._version.toString());
|
|
9441
|
+
}
|
|
9442
|
+
if (this._params.motionDetect) {
|
|
9443
|
+
for (const [key, value] of Object.entries(this._params.motionDetect)) {
|
|
9444
|
+
queryParams.set(key, value);
|
|
9445
|
+
}
|
|
9446
|
+
}
|
|
9447
|
+
const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?${queryParams.toString()}`;
|
|
9448
|
+
if (this._params.componentParams || this._params.roi) {
|
|
9438
9449
|
const formData = new FormData();
|
|
9450
|
+
if (this._params.componentParams) {
|
|
9451
|
+
const blob = new Blob([JSON.stringify(this._params.componentParams)], { type: "application/json" });
|
|
9452
|
+
formData.append("params", blob);
|
|
9453
|
+
}
|
|
9454
|
+
if (this._params.roi) {
|
|
9455
|
+
const blob = new Blob([JSON.stringify(this._params.roi)], { type: "application/json" });
|
|
9456
|
+
formData.append("roi", blob);
|
|
9457
|
+
}
|
|
9439
9458
|
const fileBlob = await new Response(this._uploadStream).blob();
|
|
9440
|
-
formData.append("params", paramBlob);
|
|
9441
9459
|
formData.append("file", fileBlob);
|
|
9442
9460
|
const headers = {
|
|
9443
9461
|
...session.authenticationHeaders(),
|
|
@@ -9502,15 +9520,33 @@ var UploadJob = class extends AbstractJob {
|
|
|
9502
9520
|
eyepop: { responseStreaming: true }
|
|
9503
9521
|
});
|
|
9504
9522
|
} else {
|
|
9505
|
-
const
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9509
|
-
|
|
9510
|
-
|
|
9523
|
+
const queryParams = new URLSearchParams({
|
|
9524
|
+
mode: "queue",
|
|
9525
|
+
processing: "sync"
|
|
9526
|
+
});
|
|
9527
|
+
if (this._videoMode !== void 0) {
|
|
9528
|
+
queryParams.set("videoMode", this._videoMode);
|
|
9529
|
+
}
|
|
9530
|
+
if (this._version !== void 0) {
|
|
9531
|
+
queryParams.set("version", this._version.toString());
|
|
9532
|
+
}
|
|
9533
|
+
if (this._params.motionDetect) {
|
|
9534
|
+
for (const [key, value] of Object.entries(this._params.motionDetect)) {
|
|
9535
|
+
queryParams.set(key, value);
|
|
9536
|
+
}
|
|
9537
|
+
}
|
|
9538
|
+
const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?${queryParams.toString()}`;
|
|
9539
|
+
if (this._params.componentParams || this._params.roi) {
|
|
9511
9540
|
const formData = new FormData();
|
|
9541
|
+
if (this._params.componentParams) {
|
|
9542
|
+
const blob = new Blob([JSON.stringify(this._params.componentParams)], { type: "application/json" });
|
|
9543
|
+
formData.append("params", blob);
|
|
9544
|
+
}
|
|
9545
|
+
if (this._params.roi) {
|
|
9546
|
+
const blob = new Blob([JSON.stringify(this._params.roi)], { type: "application/json" });
|
|
9547
|
+
formData.append("roi", blob);
|
|
9548
|
+
}
|
|
9512
9549
|
const fileBlob = await new Response(this._uploadStream).blob();
|
|
9513
|
-
formData.append("params", paramBlob);
|
|
9514
9550
|
formData.append("file", fileBlob);
|
|
9515
9551
|
const headers = {
|
|
9516
9552
|
...session.authenticationHeaders(),
|
|
@@ -9563,9 +9599,13 @@ var LoadFromJob = class extends AbstractJob {
|
|
|
9563
9599
|
const body = {
|
|
9564
9600
|
sourceType: "URL",
|
|
9565
9601
|
url: this._location,
|
|
9566
|
-
params: this._params,
|
|
9602
|
+
params: this._params.componentParams,
|
|
9603
|
+
roi: this._params.roi,
|
|
9567
9604
|
version: this._version
|
|
9568
9605
|
};
|
|
9606
|
+
if (this._params.motionDetect) {
|
|
9607
|
+
Object.assign(body, this._params.motionDetect);
|
|
9608
|
+
}
|
|
9569
9609
|
const headers = {
|
|
9570
9610
|
...session.authenticationHeaders(),
|
|
9571
9611
|
Accept: "application/jsonl",
|
|
@@ -9598,50 +9638,19 @@ var LoadFromAssetUuidJob = class extends AbstractJob {
|
|
|
9598
9638
|
const body = {
|
|
9599
9639
|
sourceType: "ASSET_UUID",
|
|
9600
9640
|
assetUuid: this._assetUuid,
|
|
9601
|
-
params: this._params,
|
|
9641
|
+
params: this._params.componentParams,
|
|
9642
|
+
roi: this._params.roi,
|
|
9602
9643
|
version: this._version
|
|
9603
9644
|
};
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
Accept: "application/jsonl",
|
|
9607
|
-
"Content-Type": "application/json"
|
|
9608
|
-
};
|
|
9609
|
-
const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync`;
|
|
9610
|
-
return await this._client.fetch(patchUrl, {
|
|
9611
|
-
headers,
|
|
9612
|
-
method: "PATCH",
|
|
9613
|
-
body: JSON.stringify(body),
|
|
9614
|
-
signal: this._controller.signal,
|
|
9615
|
-
// @ts-ignore
|
|
9616
|
-
eyepop: { responseStreaming: true }
|
|
9617
|
-
});
|
|
9618
|
-
}
|
|
9619
|
-
};
|
|
9620
|
-
var LoadLiveIngressJob = class extends AbstractJob {
|
|
9621
|
-
constructor(ingressId, params, getSession, client, requestLogger) {
|
|
9622
|
-
super(params, getSession, client, requestLogger);
|
|
9623
|
-
this._ingressId = ingressId;
|
|
9624
|
-
}
|
|
9625
|
-
get [Symbol.toStringTag]() {
|
|
9626
|
-
return "loadLiveIngressJob";
|
|
9627
|
-
}
|
|
9628
|
-
async startJob() {
|
|
9629
|
-
const session = await this._getSession();
|
|
9630
|
-
if (!session.baseUrl) {
|
|
9631
|
-
return Promise.reject("session.baseUrl must not ne null");
|
|
9645
|
+
if (this._params.motionDetect) {
|
|
9646
|
+
Object.assign(body, this._params.motionDetect);
|
|
9632
9647
|
}
|
|
9633
|
-
const body = {
|
|
9634
|
-
sourceType: "LIVE_INGRESS",
|
|
9635
|
-
liveIngressId: this._ingressId,
|
|
9636
|
-
params: this._params,
|
|
9637
|
-
version: this._version
|
|
9638
|
-
};
|
|
9639
9648
|
const headers = {
|
|
9640
9649
|
...session.authenticationHeaders(),
|
|
9641
9650
|
Accept: "application/jsonl",
|
|
9642
9651
|
"Content-Type": "application/json"
|
|
9643
9652
|
};
|
|
9644
|
-
const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=
|
|
9653
|
+
const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync`;
|
|
9645
9654
|
return await this._client.fetch(patchUrl, {
|
|
9646
9655
|
headers,
|
|
9647
9656
|
method: "PATCH",
|
|
@@ -9682,9 +9691,13 @@ var LoadMediaStreamJob = class extends AbstractJob {
|
|
|
9682
9691
|
const body = {
|
|
9683
9692
|
sourceType: "WHIP",
|
|
9684
9693
|
whipIngressId: whip.ingressId(),
|
|
9685
|
-
params: this._params,
|
|
9694
|
+
params: this._params.componentParams,
|
|
9695
|
+
roi: this._params.roi,
|
|
9686
9696
|
version: this._version
|
|
9687
9697
|
};
|
|
9698
|
+
if (this._params.motionDetect) {
|
|
9699
|
+
Object.assign(body, this._params.motionDetect);
|
|
9700
|
+
}
|
|
9688
9701
|
const headers = {
|
|
9689
9702
|
...session.authenticationHeaders(),
|
|
9690
9703
|
Accept: "application/jsonl",
|
|
@@ -10322,19 +10335,43 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
|
10322
10335
|
popId() {
|
|
10323
10336
|
return this.options().popId || null;
|
|
10324
10337
|
}
|
|
10325
|
-
async process(
|
|
10338
|
+
async process(param1, param2) {
|
|
10339
|
+
if (param1.source !== void 0) {
|
|
10340
|
+
return await this.processV2(param1);
|
|
10341
|
+
} else {
|
|
10342
|
+
return await this.processV1(param1, param2);
|
|
10343
|
+
}
|
|
10344
|
+
}
|
|
10345
|
+
async processV1(source, params) {
|
|
10326
10346
|
if (source.file !== void 0) {
|
|
10327
|
-
return this.uploadFile(source, params);
|
|
10347
|
+
return this.uploadFile(source, { componentParams: params });
|
|
10328
10348
|
} else if (source.stream !== void 0) {
|
|
10329
|
-
return this.uploadStream(source, params);
|
|
10349
|
+
return this.uploadStream(source, { componentParams: params });
|
|
10330
10350
|
} else if (source.path !== void 0) {
|
|
10331
|
-
return this.uploadPath(source, params);
|
|
10351
|
+
return this.uploadPath(source, { componentParams: params });
|
|
10332
10352
|
} else if (source.url !== void 0) {
|
|
10333
|
-
return this.loadFrom(source, params);
|
|
10353
|
+
return this.loadFrom(source, { componentParams: params });
|
|
10334
10354
|
} else if (source.assetUuid !== void 0) {
|
|
10335
|
-
return this.loadFromAssetUuid(source, params);
|
|
10355
|
+
return this.loadFromAssetUuid(source, { componentParams: params });
|
|
10336
10356
|
} else if (source.mediaStream !== void 0) {
|
|
10337
|
-
return this.loadMediaStream(source, params);
|
|
10357
|
+
return this.loadMediaStream(source, { componentParams: params });
|
|
10358
|
+
} else {
|
|
10359
|
+
return Promise.reject("unknown source type");
|
|
10360
|
+
}
|
|
10361
|
+
}
|
|
10362
|
+
async processV2(request) {
|
|
10363
|
+
if (request.source.file !== void 0) {
|
|
10364
|
+
return this.uploadFile(request.source, request);
|
|
10365
|
+
} else if (request.source.stream !== void 0) {
|
|
10366
|
+
return this.uploadStream(request.source, request);
|
|
10367
|
+
} else if (request.source.path !== void 0) {
|
|
10368
|
+
return this.uploadPath(request.source, request);
|
|
10369
|
+
} else if (request.source.url !== void 0) {
|
|
10370
|
+
return this.loadFrom(request.source, request);
|
|
10371
|
+
} else if (request.source.assetUuid !== void 0) {
|
|
10372
|
+
return this.loadFromAssetUuid(request.source, request);
|
|
10373
|
+
} else if (request.source.mediaStream !== void 0) {
|
|
10374
|
+
return this.loadMediaStream(request.source, request);
|
|
10338
10375
|
} else {
|
|
10339
10376
|
return Promise.reject("unknown source type");
|
|
10340
10377
|
}
|
|
@@ -10443,9 +10480,12 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
|
10443
10480
|
}
|
|
10444
10481
|
async loadFrom(source, params) {
|
|
10445
10482
|
if (source.url.startsWith("file://")) {
|
|
10446
|
-
return await this.uploadPath(
|
|
10447
|
-
|
|
10448
|
-
|
|
10483
|
+
return await this.uploadPath(
|
|
10484
|
+
{
|
|
10485
|
+
path: source.url.substring("file://".length)
|
|
10486
|
+
},
|
|
10487
|
+
params
|
|
10488
|
+
);
|
|
10449
10489
|
}
|
|
10450
10490
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
10451
10491
|
throw new Error("endpoint not connected, use connect()");
|
|
@@ -10666,6 +10706,7 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
|
10666
10706
|
const response_content = await response.json();
|
|
10667
10707
|
sessions = response_content;
|
|
10668
10708
|
}
|
|
10709
|
+
console.log(sessions);
|
|
10669
10710
|
if (sessions.length > 0) {
|
|
10670
10711
|
this._logger.debug(`User has ${sessions.length} sessions, inspecting for active session`);
|
|
10671
10712
|
for (let s of sessions) {
|
|
@@ -10764,13 +10805,7 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
|
10764
10805
|
return result["id"];
|
|
10765
10806
|
}
|
|
10766
10807
|
};
|
|
10767
|
-
_WorkerEndpoint.SESSION_DEAD = /* @__PURE__ */ new Set([
|
|
10768
|
-
"error" /* ERROR */,
|
|
10769
|
-
"failed" /* FAILED */,
|
|
10770
|
-
"stopped" /* STOPPED */,
|
|
10771
|
-
"pipeline_error" /* PIPELINE_ERROR */,
|
|
10772
|
-
"unknown" /* UNKNOWN */
|
|
10773
|
-
]);
|
|
10808
|
+
_WorkerEndpoint.SESSION_DEAD = /* @__PURE__ */ new Set(["error" /* ERROR */, "failed" /* FAILED */, "stopped" /* STOPPED */, "pipeline_error" /* PIPELINE_ERROR */, "unknown" /* UNKNOWN */]);
|
|
10774
10809
|
_WorkerEndpoint.WAIT_FOR_IS_READY = 60 * 1e3;
|
|
10775
10810
|
_WorkerEndpoint.CHECK_FOR_IS_READY_INTERVAL = 250;
|
|
10776
10811
|
var WorkerEndpoint = _WorkerEndpoint;
|
|
@@ -12234,7 +12269,6 @@ var index_default = EyePop;
|
|
|
12234
12269
|
InferenceType,
|
|
12235
12270
|
LoadFromAssetUuidJob,
|
|
12236
12271
|
LoadFromJob,
|
|
12237
|
-
LoadLiveIngressJob,
|
|
12238
12272
|
LoadMediaStreamJob,
|
|
12239
12273
|
ModelExportStatus,
|
|
12240
12274
|
ModelFormat,
|