@eyepop.ai/eyepop 3.14.1 → 3.14.4
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 +729 -696
- package/dist/eyepop.index.d.ts +729 -696
- package/dist/eyepop.index.js +118 -73
- package/dist/eyepop.index.js.map +1 -1
- package/dist/eyepop.index.mjs +118 -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.mjs
CHANGED
|
@@ -9241,7 +9241,7 @@ var AbstractJob = class {
|
|
|
9241
9241
|
this._responseStream = null;
|
|
9242
9242
|
this._controller = new AbortController();
|
|
9243
9243
|
this._getSession = getSession;
|
|
9244
|
-
this._params = params
|
|
9244
|
+
this._params = params;
|
|
9245
9245
|
this._client = client;
|
|
9246
9246
|
this._requestLogger = requestLogger;
|
|
9247
9247
|
this._version = version;
|
|
@@ -9286,7 +9286,7 @@ var AbstractJob = class {
|
|
|
9286
9286
|
reject(`response ${response.status}: ${response.statusText}`);
|
|
9287
9287
|
break;
|
|
9288
9288
|
}
|
|
9289
|
-
} else if (response.
|
|
9289
|
+
} else if (!response.ok) {
|
|
9290
9290
|
reject(`upload error ${response.status}: ${await response.text()}`);
|
|
9291
9291
|
break;
|
|
9292
9292
|
} else if (response.body) {
|
|
@@ -9348,15 +9348,38 @@ var UploadJob = class extends AbstractJob {
|
|
|
9348
9348
|
return Promise.reject("session.baseUrl must not ne null");
|
|
9349
9349
|
}
|
|
9350
9350
|
let request;
|
|
9351
|
-
const
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9351
|
+
const queryParams = new URLSearchParams({
|
|
9352
|
+
mode: "queue",
|
|
9353
|
+
processing: "async",
|
|
9354
|
+
sourceId: event.source_id
|
|
9355
|
+
});
|
|
9356
|
+
if (this._videoMode !== void 0) {
|
|
9357
|
+
queryParams.set("videoMode", this._videoMode);
|
|
9358
|
+
}
|
|
9359
|
+
if (this._version !== void 0) {
|
|
9360
|
+
queryParams.set("version", this._version.toString());
|
|
9361
|
+
}
|
|
9362
|
+
if (this._params.motionDetect) {
|
|
9363
|
+
for (const [key, value] of Object.entries(this._params.motionDetect)) {
|
|
9364
|
+
queryParams.set(key, value);
|
|
9365
|
+
}
|
|
9366
|
+
}
|
|
9367
|
+
const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?${queryParams.toString()}`;
|
|
9368
|
+
if (this._params.componentParams || this._params.roi) {
|
|
9357
9369
|
const formData = new FormData();
|
|
9370
|
+
if (this._params.componentParams) {
|
|
9371
|
+
const blob = new Blob([JSON.stringify(this._params.componentParams)], { type: "application/json" });
|
|
9372
|
+
formData.append("params", blob);
|
|
9373
|
+
}
|
|
9374
|
+
if (this._params.roi) {
|
|
9375
|
+
const blob = new Blob([JSON.stringify(this._params.roi)], { type: "application/json" });
|
|
9376
|
+
formData.append("roi", blob);
|
|
9377
|
+
}
|
|
9378
|
+
if (this._params.fps) {
|
|
9379
|
+
const blob = new Blob([JSON.stringify(this._params.fps)], { type: "application/json" });
|
|
9380
|
+
formData.append("fps", blob);
|
|
9381
|
+
}
|
|
9358
9382
|
const fileBlob = await new Response(this._uploadStream).blob();
|
|
9359
|
-
formData.append("params", paramBlob);
|
|
9360
9383
|
formData.append("file", fileBlob);
|
|
9361
9384
|
const headers = {
|
|
9362
9385
|
...session.authenticationHeaders(),
|
|
@@ -9421,15 +9444,37 @@ var UploadJob = class extends AbstractJob {
|
|
|
9421
9444
|
eyepop: { responseStreaming: true }
|
|
9422
9445
|
});
|
|
9423
9446
|
} else {
|
|
9424
|
-
const
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9429
|
-
|
|
9447
|
+
const queryParams = new URLSearchParams({
|
|
9448
|
+
mode: "queue",
|
|
9449
|
+
processing: "sync"
|
|
9450
|
+
});
|
|
9451
|
+
if (this._videoMode !== void 0) {
|
|
9452
|
+
queryParams.set("videoMode", this._videoMode);
|
|
9453
|
+
}
|
|
9454
|
+
if (this._version !== void 0) {
|
|
9455
|
+
queryParams.set("version", this._version.toString());
|
|
9456
|
+
}
|
|
9457
|
+
if (this._params.motionDetect) {
|
|
9458
|
+
for (const [key, value] of Object.entries(this._params.motionDetect)) {
|
|
9459
|
+
queryParams.set(key, value);
|
|
9460
|
+
}
|
|
9461
|
+
}
|
|
9462
|
+
const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?${queryParams.toString()}`;
|
|
9463
|
+
if (this._params.componentParams || this._params.roi) {
|
|
9430
9464
|
const formData = new FormData();
|
|
9465
|
+
if (this._params.componentParams) {
|
|
9466
|
+
const blob = new Blob([JSON.stringify(this._params.componentParams)], { type: "application/json" });
|
|
9467
|
+
formData.append("params", blob);
|
|
9468
|
+
}
|
|
9469
|
+
if (this._params.roi) {
|
|
9470
|
+
const blob = new Blob([JSON.stringify(this._params.roi)], { type: "application/json" });
|
|
9471
|
+
formData.append("roi", blob);
|
|
9472
|
+
}
|
|
9473
|
+
if (this._params.fps) {
|
|
9474
|
+
const blob = new Blob([JSON.stringify(this._params.fps)], { type: "application/json" });
|
|
9475
|
+
formData.append("fps", blob);
|
|
9476
|
+
}
|
|
9431
9477
|
const fileBlob = await new Response(this._uploadStream).blob();
|
|
9432
|
-
formData.append("params", paramBlob);
|
|
9433
9478
|
formData.append("file", fileBlob);
|
|
9434
9479
|
const headers = {
|
|
9435
9480
|
...session.authenticationHeaders(),
|
|
@@ -9482,9 +9527,14 @@ var LoadFromJob = class extends AbstractJob {
|
|
|
9482
9527
|
const body = {
|
|
9483
9528
|
sourceType: "URL",
|
|
9484
9529
|
url: this._location,
|
|
9485
|
-
params: this._params,
|
|
9530
|
+
params: this._params.componentParams,
|
|
9531
|
+
roi: this._params.roi,
|
|
9532
|
+
fps: this._params.fps,
|
|
9486
9533
|
version: this._version
|
|
9487
9534
|
};
|
|
9535
|
+
if (this._params.motionDetect) {
|
|
9536
|
+
Object.assign(body, this._params.motionDetect);
|
|
9537
|
+
}
|
|
9488
9538
|
const headers = {
|
|
9489
9539
|
...session.authenticationHeaders(),
|
|
9490
9540
|
Accept: "application/jsonl",
|
|
@@ -9517,50 +9567,20 @@ var LoadFromAssetUuidJob = class extends AbstractJob {
|
|
|
9517
9567
|
const body = {
|
|
9518
9568
|
sourceType: "ASSET_UUID",
|
|
9519
9569
|
assetUuid: this._assetUuid,
|
|
9520
|
-
params: this._params,
|
|
9570
|
+
params: this._params.componentParams,
|
|
9571
|
+
roi: this._params.roi,
|
|
9572
|
+
fps: this._params.fps,
|
|
9521
9573
|
version: this._version
|
|
9522
9574
|
};
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
Accept: "application/jsonl",
|
|
9526
|
-
"Content-Type": "application/json"
|
|
9527
|
-
};
|
|
9528
|
-
const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync`;
|
|
9529
|
-
return await this._client.fetch(patchUrl, {
|
|
9530
|
-
headers,
|
|
9531
|
-
method: "PATCH",
|
|
9532
|
-
body: JSON.stringify(body),
|
|
9533
|
-
signal: this._controller.signal,
|
|
9534
|
-
// @ts-ignore
|
|
9535
|
-
eyepop: { responseStreaming: true }
|
|
9536
|
-
});
|
|
9537
|
-
}
|
|
9538
|
-
};
|
|
9539
|
-
var LoadLiveIngressJob = class extends AbstractJob {
|
|
9540
|
-
constructor(ingressId, params, getSession, client, requestLogger) {
|
|
9541
|
-
super(params, getSession, client, requestLogger);
|
|
9542
|
-
this._ingressId = ingressId;
|
|
9543
|
-
}
|
|
9544
|
-
get [Symbol.toStringTag]() {
|
|
9545
|
-
return "loadLiveIngressJob";
|
|
9546
|
-
}
|
|
9547
|
-
async startJob() {
|
|
9548
|
-
const session = await this._getSession();
|
|
9549
|
-
if (!session.baseUrl) {
|
|
9550
|
-
return Promise.reject("session.baseUrl must not ne null");
|
|
9575
|
+
if (this._params.motionDetect) {
|
|
9576
|
+
Object.assign(body, this._params.motionDetect);
|
|
9551
9577
|
}
|
|
9552
|
-
const body = {
|
|
9553
|
-
sourceType: "LIVE_INGRESS",
|
|
9554
|
-
liveIngressId: this._ingressId,
|
|
9555
|
-
params: this._params,
|
|
9556
|
-
version: this._version
|
|
9557
|
-
};
|
|
9558
9578
|
const headers = {
|
|
9559
9579
|
...session.authenticationHeaders(),
|
|
9560
9580
|
Accept: "application/jsonl",
|
|
9561
9581
|
"Content-Type": "application/json"
|
|
9562
9582
|
};
|
|
9563
|
-
const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=
|
|
9583
|
+
const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync`;
|
|
9564
9584
|
return await this._client.fetch(patchUrl, {
|
|
9565
9585
|
headers,
|
|
9566
9586
|
method: "PATCH",
|
|
@@ -9601,9 +9621,14 @@ var LoadMediaStreamJob = class extends AbstractJob {
|
|
|
9601
9621
|
const body = {
|
|
9602
9622
|
sourceType: "WHIP",
|
|
9603
9623
|
whipIngressId: whip.ingressId(),
|
|
9604
|
-
params: this._params,
|
|
9624
|
+
params: this._params.componentParams,
|
|
9625
|
+
roi: this._params.roi,
|
|
9626
|
+
fps: this._params.fps,
|
|
9605
9627
|
version: this._version
|
|
9606
9628
|
};
|
|
9629
|
+
if (this._params.motionDetect) {
|
|
9630
|
+
Object.assign(body, this._params.motionDetect);
|
|
9631
|
+
}
|
|
9607
9632
|
const headers = {
|
|
9608
9633
|
...session.authenticationHeaders(),
|
|
9609
9634
|
Accept: "application/jsonl",
|
|
@@ -10241,19 +10266,43 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
|
10241
10266
|
popId() {
|
|
10242
10267
|
return this.options().popId || null;
|
|
10243
10268
|
}
|
|
10244
|
-
async process(
|
|
10269
|
+
async process(param1, param2) {
|
|
10270
|
+
if (param1.source !== void 0) {
|
|
10271
|
+
return await this.processV2(param1);
|
|
10272
|
+
} else {
|
|
10273
|
+
return await this.processV1(param1, param2);
|
|
10274
|
+
}
|
|
10275
|
+
}
|
|
10276
|
+
async processV1(source, params) {
|
|
10245
10277
|
if (source.file !== void 0) {
|
|
10246
|
-
return this.uploadFile(source, params);
|
|
10278
|
+
return this.uploadFile(source, { componentParams: params });
|
|
10247
10279
|
} else if (source.stream !== void 0) {
|
|
10248
|
-
return this.uploadStream(source, params);
|
|
10280
|
+
return this.uploadStream(source, { componentParams: params });
|
|
10249
10281
|
} else if (source.path !== void 0) {
|
|
10250
|
-
return this.uploadPath(source, params);
|
|
10282
|
+
return this.uploadPath(source, { componentParams: params });
|
|
10251
10283
|
} else if (source.url !== void 0) {
|
|
10252
|
-
return this.loadFrom(source, params);
|
|
10284
|
+
return this.loadFrom(source, { componentParams: params });
|
|
10253
10285
|
} else if (source.assetUuid !== void 0) {
|
|
10254
|
-
return this.loadFromAssetUuid(source, params);
|
|
10286
|
+
return this.loadFromAssetUuid(source, { componentParams: params });
|
|
10255
10287
|
} else if (source.mediaStream !== void 0) {
|
|
10256
|
-
return this.loadMediaStream(source, params);
|
|
10288
|
+
return this.loadMediaStream(source, { componentParams: params });
|
|
10289
|
+
} else {
|
|
10290
|
+
return Promise.reject("unknown source type");
|
|
10291
|
+
}
|
|
10292
|
+
}
|
|
10293
|
+
async processV2(request) {
|
|
10294
|
+
if (request.source.file !== void 0) {
|
|
10295
|
+
return this.uploadFile(request.source, request);
|
|
10296
|
+
} else if (request.source.stream !== void 0) {
|
|
10297
|
+
return this.uploadStream(request.source, request);
|
|
10298
|
+
} else if (request.source.path !== void 0) {
|
|
10299
|
+
return this.uploadPath(request.source, request);
|
|
10300
|
+
} else if (request.source.url !== void 0) {
|
|
10301
|
+
return this.loadFrom(request.source, request);
|
|
10302
|
+
} else if (request.source.assetUuid !== void 0) {
|
|
10303
|
+
return this.loadFromAssetUuid(request.source, request);
|
|
10304
|
+
} else if (request.source.mediaStream !== void 0) {
|
|
10305
|
+
return this.loadMediaStream(request.source, request);
|
|
10257
10306
|
} else {
|
|
10258
10307
|
return Promise.reject("unknown source type");
|
|
10259
10308
|
}
|
|
@@ -10362,9 +10411,12 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
|
10362
10411
|
}
|
|
10363
10412
|
async loadFrom(source, params) {
|
|
10364
10413
|
if (source.url.startsWith("file://")) {
|
|
10365
|
-
return await this.uploadPath(
|
|
10366
|
-
|
|
10367
|
-
|
|
10414
|
+
return await this.uploadPath(
|
|
10415
|
+
{
|
|
10416
|
+
path: source.url.substring("file://".length)
|
|
10417
|
+
},
|
|
10418
|
+
params
|
|
10419
|
+
);
|
|
10368
10420
|
}
|
|
10369
10421
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
10370
10422
|
throw new Error("endpoint not connected, use connect()");
|
|
@@ -10585,6 +10637,7 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
|
10585
10637
|
const response_content = await response.json();
|
|
10586
10638
|
sessions = response_content;
|
|
10587
10639
|
}
|
|
10640
|
+
console.log(sessions);
|
|
10588
10641
|
if (sessions.length > 0) {
|
|
10589
10642
|
this._logger.debug(`User has ${sessions.length} sessions, inspecting for active session`);
|
|
10590
10643
|
for (let s of sessions) {
|
|
@@ -10683,13 +10736,7 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
|
|
|
10683
10736
|
return result["id"];
|
|
10684
10737
|
}
|
|
10685
10738
|
};
|
|
10686
|
-
_WorkerEndpoint.SESSION_DEAD = /* @__PURE__ */ new Set([
|
|
10687
|
-
"error" /* ERROR */,
|
|
10688
|
-
"failed" /* FAILED */,
|
|
10689
|
-
"stopped" /* STOPPED */,
|
|
10690
|
-
"pipeline_error" /* PIPELINE_ERROR */,
|
|
10691
|
-
"unknown" /* UNKNOWN */
|
|
10692
|
-
]);
|
|
10739
|
+
_WorkerEndpoint.SESSION_DEAD = /* @__PURE__ */ new Set(["error" /* ERROR */, "failed" /* FAILED */, "stopped" /* STOPPED */, "pipeline_error" /* PIPELINE_ERROR */, "unknown" /* UNKNOWN */]);
|
|
10693
10740
|
_WorkerEndpoint.WAIT_FOR_IS_READY = 60 * 1e3;
|
|
10694
10741
|
_WorkerEndpoint.CHECK_FOR_IS_READY_INTERVAL = 250;
|
|
10695
10742
|
var WorkerEndpoint = _WorkerEndpoint;
|
|
@@ -12152,7 +12199,6 @@ export {
|
|
|
12152
12199
|
InferenceType,
|
|
12153
12200
|
LoadFromAssetUuidJob,
|
|
12154
12201
|
LoadFromJob,
|
|
12155
|
-
LoadLiveIngressJob,
|
|
12156
12202
|
LoadMediaStreamJob,
|
|
12157
12203
|
ModelExportStatus,
|
|
12158
12204
|
ModelFormat,
|