@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.
@@ -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 ?? null;
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.status != 200) {
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,38 @@ var UploadJob = class extends AbstractJob {
9429
9428
  return Promise.reject("session.baseUrl must not ne null");
9430
9429
  }
9431
9430
  let request;
9432
- const videoModeQuery = this._videoMode ? `&videoMode=${this._videoMode}` : "";
9433
- const versionQuery = this._version ? `&version=${this._version}` : "";
9434
- const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=async&sourceId=${event.source_id}${videoModeQuery}${versionQuery}`;
9435
- if (this._params) {
9436
- const params = JSON.stringify(this._params);
9437
- const paramBlob = new Blob([params], { type: "application/json" });
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
+ }
9458
+ if (this._params.fps) {
9459
+ const blob = new Blob([JSON.stringify(this._params.fps)], { type: "application/json" });
9460
+ formData.append("fps", blob);
9461
+ }
9439
9462
  const fileBlob = await new Response(this._uploadStream).blob();
9440
- formData.append("params", paramBlob);
9441
9463
  formData.append("file", fileBlob);
9442
9464
  const headers = {
9443
9465
  ...session.authenticationHeaders(),
@@ -9502,15 +9524,37 @@ var UploadJob = class extends AbstractJob {
9502
9524
  eyepop: { responseStreaming: true }
9503
9525
  });
9504
9526
  } else {
9505
- const videoModeQuery = this._videoMode ? `&videoMode=${this._videoMode}` : "";
9506
- const versionQuery = this._version ? `&version=${this._version}` : "";
9507
- const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync${videoModeQuery}${versionQuery}`;
9508
- if (this._params) {
9509
- const params = JSON.stringify(this._params);
9510
- const paramBlob = new Blob([params], { type: "application/json" });
9527
+ const queryParams = new URLSearchParams({
9528
+ mode: "queue",
9529
+ processing: "sync"
9530
+ });
9531
+ if (this._videoMode !== void 0) {
9532
+ queryParams.set("videoMode", this._videoMode);
9533
+ }
9534
+ if (this._version !== void 0) {
9535
+ queryParams.set("version", this._version.toString());
9536
+ }
9537
+ if (this._params.motionDetect) {
9538
+ for (const [key, value] of Object.entries(this._params.motionDetect)) {
9539
+ queryParams.set(key, value);
9540
+ }
9541
+ }
9542
+ const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?${queryParams.toString()}`;
9543
+ if (this._params.componentParams || this._params.roi) {
9511
9544
  const formData = new FormData();
9545
+ if (this._params.componentParams) {
9546
+ const blob = new Blob([JSON.stringify(this._params.componentParams)], { type: "application/json" });
9547
+ formData.append("params", blob);
9548
+ }
9549
+ if (this._params.roi) {
9550
+ const blob = new Blob([JSON.stringify(this._params.roi)], { type: "application/json" });
9551
+ formData.append("roi", blob);
9552
+ }
9553
+ if (this._params.fps) {
9554
+ const blob = new Blob([JSON.stringify(this._params.fps)], { type: "application/json" });
9555
+ formData.append("fps", blob);
9556
+ }
9512
9557
  const fileBlob = await new Response(this._uploadStream).blob();
9513
- formData.append("params", paramBlob);
9514
9558
  formData.append("file", fileBlob);
9515
9559
  const headers = {
9516
9560
  ...session.authenticationHeaders(),
@@ -9563,9 +9607,14 @@ var LoadFromJob = class extends AbstractJob {
9563
9607
  const body = {
9564
9608
  sourceType: "URL",
9565
9609
  url: this._location,
9566
- params: this._params,
9610
+ params: this._params.componentParams,
9611
+ roi: this._params.roi,
9612
+ fps: this._params.fps,
9567
9613
  version: this._version
9568
9614
  };
9615
+ if (this._params.motionDetect) {
9616
+ Object.assign(body, this._params.motionDetect);
9617
+ }
9569
9618
  const headers = {
9570
9619
  ...session.authenticationHeaders(),
9571
9620
  Accept: "application/jsonl",
@@ -9598,50 +9647,20 @@ var LoadFromAssetUuidJob = class extends AbstractJob {
9598
9647
  const body = {
9599
9648
  sourceType: "ASSET_UUID",
9600
9649
  assetUuid: this._assetUuid,
9601
- params: this._params,
9650
+ params: this._params.componentParams,
9651
+ roi: this._params.roi,
9652
+ fps: this._params.fps,
9602
9653
  version: this._version
9603
9654
  };
9604
- const headers = {
9605
- ...session.authenticationHeaders(),
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");
9655
+ if (this._params.motionDetect) {
9656
+ Object.assign(body, this._params.motionDetect);
9632
9657
  }
9633
- const body = {
9634
- sourceType: "LIVE_INGRESS",
9635
- liveIngressId: this._ingressId,
9636
- params: this._params,
9637
- version: this._version
9638
- };
9639
9658
  const headers = {
9640
9659
  ...session.authenticationHeaders(),
9641
9660
  Accept: "application/jsonl",
9642
9661
  "Content-Type": "application/json"
9643
9662
  };
9644
- const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=preempt&processing=sync`;
9663
+ const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync`;
9645
9664
  return await this._client.fetch(patchUrl, {
9646
9665
  headers,
9647
9666
  method: "PATCH",
@@ -9682,9 +9701,14 @@ var LoadMediaStreamJob = class extends AbstractJob {
9682
9701
  const body = {
9683
9702
  sourceType: "WHIP",
9684
9703
  whipIngressId: whip.ingressId(),
9685
- params: this._params,
9704
+ params: this._params.componentParams,
9705
+ roi: this._params.roi,
9706
+ fps: this._params.fps,
9686
9707
  version: this._version
9687
9708
  };
9709
+ if (this._params.motionDetect) {
9710
+ Object.assign(body, this._params.motionDetect);
9711
+ }
9688
9712
  const headers = {
9689
9713
  ...session.authenticationHeaders(),
9690
9714
  Accept: "application/jsonl",
@@ -10322,19 +10346,43 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
10322
10346
  popId() {
10323
10347
  return this.options().popId || null;
10324
10348
  }
10325
- async process(source, params) {
10349
+ async process(param1, param2) {
10350
+ if (param1.source !== void 0) {
10351
+ return await this.processV2(param1);
10352
+ } else {
10353
+ return await this.processV1(param1, param2);
10354
+ }
10355
+ }
10356
+ async processV1(source, params) {
10326
10357
  if (source.file !== void 0) {
10327
- return this.uploadFile(source, params);
10358
+ return this.uploadFile(source, { componentParams: params });
10328
10359
  } else if (source.stream !== void 0) {
10329
- return this.uploadStream(source, params);
10360
+ return this.uploadStream(source, { componentParams: params });
10330
10361
  } else if (source.path !== void 0) {
10331
- return this.uploadPath(source, params);
10362
+ return this.uploadPath(source, { componentParams: params });
10332
10363
  } else if (source.url !== void 0) {
10333
- return this.loadFrom(source, params);
10364
+ return this.loadFrom(source, { componentParams: params });
10334
10365
  } else if (source.assetUuid !== void 0) {
10335
- return this.loadFromAssetUuid(source, params);
10366
+ return this.loadFromAssetUuid(source, { componentParams: params });
10336
10367
  } else if (source.mediaStream !== void 0) {
10337
- return this.loadMediaStream(source, params);
10368
+ return this.loadMediaStream(source, { componentParams: params });
10369
+ } else {
10370
+ return Promise.reject("unknown source type");
10371
+ }
10372
+ }
10373
+ async processV2(request) {
10374
+ if (request.source.file !== void 0) {
10375
+ return this.uploadFile(request.source, request);
10376
+ } else if (request.source.stream !== void 0) {
10377
+ return this.uploadStream(request.source, request);
10378
+ } else if (request.source.path !== void 0) {
10379
+ return this.uploadPath(request.source, request);
10380
+ } else if (request.source.url !== void 0) {
10381
+ return this.loadFrom(request.source, request);
10382
+ } else if (request.source.assetUuid !== void 0) {
10383
+ return this.loadFromAssetUuid(request.source, request);
10384
+ } else if (request.source.mediaStream !== void 0) {
10385
+ return this.loadMediaStream(request.source, request);
10338
10386
  } else {
10339
10387
  return Promise.reject("unknown source type");
10340
10388
  }
@@ -10443,9 +10491,12 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
10443
10491
  }
10444
10492
  async loadFrom(source, params) {
10445
10493
  if (source.url.startsWith("file://")) {
10446
- return await this.uploadPath({
10447
- path: source.url.substring("file://".length)
10448
- }, params);
10494
+ return await this.uploadPath(
10495
+ {
10496
+ path: source.url.substring("file://".length)
10497
+ },
10498
+ params
10499
+ );
10449
10500
  }
10450
10501
  if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
10451
10502
  throw new Error("endpoint not connected, use connect()");
@@ -10666,6 +10717,7 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
10666
10717
  const response_content = await response.json();
10667
10718
  sessions = response_content;
10668
10719
  }
10720
+ console.log(sessions);
10669
10721
  if (sessions.length > 0) {
10670
10722
  this._logger.debug(`User has ${sessions.length} sessions, inspecting for active session`);
10671
10723
  for (let s of sessions) {
@@ -10764,13 +10816,7 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
10764
10816
  return result["id"];
10765
10817
  }
10766
10818
  };
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
- ]);
10819
+ _WorkerEndpoint.SESSION_DEAD = /* @__PURE__ */ new Set(["error" /* ERROR */, "failed" /* FAILED */, "stopped" /* STOPPED */, "pipeline_error" /* PIPELINE_ERROR */, "unknown" /* UNKNOWN */]);
10774
10820
  _WorkerEndpoint.WAIT_FOR_IS_READY = 60 * 1e3;
10775
10821
  _WorkerEndpoint.CHECK_FOR_IS_READY_INTERVAL = 250;
10776
10822
  var WorkerEndpoint = _WorkerEndpoint;
@@ -12234,7 +12280,6 @@ var index_default = EyePop;
12234
12280
  InferenceType,
12235
12281
  LoadFromAssetUuidJob,
12236
12282
  LoadFromJob,
12237
- LoadLiveIngressJob,
12238
12283
  LoadMediaStreamJob,
12239
12284
  ModelExportStatus,
12240
12285
  ModelFormat,