@eyepop.ai/eyepop 3.14.0 → 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.
@@ -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 ?? null;
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.status != 200) {
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,34 @@ var UploadJob = class extends AbstractJob {
9348
9348
  return Promise.reject("session.baseUrl must not ne null");
9349
9349
  }
9350
9350
  let request;
9351
- const videoModeQuery = this._videoMode ? `&videoMode=${this._videoMode}` : "";
9352
- const versionQuery = this._version ? `&version=${this._version}` : "";
9353
- const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=async&sourceId=${event.source_id}${videoModeQuery}${versionQuery}`;
9354
- if (this._params) {
9355
- const params = JSON.stringify(this._params);
9356
- const paramBlob = new Blob([params], { type: "application/json" });
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
+ }
9358
9378
  const fileBlob = await new Response(this._uploadStream).blob();
9359
- formData.append("params", paramBlob);
9360
9379
  formData.append("file", fileBlob);
9361
9380
  const headers = {
9362
9381
  ...session.authenticationHeaders(),
@@ -9421,15 +9440,33 @@ var UploadJob = class extends AbstractJob {
9421
9440
  eyepop: { responseStreaming: true }
9422
9441
  });
9423
9442
  } else {
9424
- const videoModeQuery = this._videoMode ? `&videoMode=${this._videoMode}` : "";
9425
- const versionQuery = this._version ? `&version=${this._version}` : "";
9426
- const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync${videoModeQuery}${versionQuery}`;
9427
- if (this._params) {
9428
- const params = JSON.stringify(this._params);
9429
- const paramBlob = new Blob([params], { type: "application/json" });
9443
+ const queryParams = new URLSearchParams({
9444
+ mode: "queue",
9445
+ processing: "sync"
9446
+ });
9447
+ if (this._videoMode !== void 0) {
9448
+ queryParams.set("videoMode", this._videoMode);
9449
+ }
9450
+ if (this._version !== void 0) {
9451
+ queryParams.set("version", this._version.toString());
9452
+ }
9453
+ if (this._params.motionDetect) {
9454
+ for (const [key, value] of Object.entries(this._params.motionDetect)) {
9455
+ queryParams.set(key, value);
9456
+ }
9457
+ }
9458
+ const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?${queryParams.toString()}`;
9459
+ if (this._params.componentParams || this._params.roi) {
9430
9460
  const formData = new FormData();
9461
+ if (this._params.componentParams) {
9462
+ const blob = new Blob([JSON.stringify(this._params.componentParams)], { type: "application/json" });
9463
+ formData.append("params", blob);
9464
+ }
9465
+ if (this._params.roi) {
9466
+ const blob = new Blob([JSON.stringify(this._params.roi)], { type: "application/json" });
9467
+ formData.append("roi", blob);
9468
+ }
9431
9469
  const fileBlob = await new Response(this._uploadStream).blob();
9432
- formData.append("params", paramBlob);
9433
9470
  formData.append("file", fileBlob);
9434
9471
  const headers = {
9435
9472
  ...session.authenticationHeaders(),
@@ -9482,9 +9519,13 @@ var LoadFromJob = class extends AbstractJob {
9482
9519
  const body = {
9483
9520
  sourceType: "URL",
9484
9521
  url: this._location,
9485
- params: this._params,
9522
+ params: this._params.componentParams,
9523
+ roi: this._params.roi,
9486
9524
  version: this._version
9487
9525
  };
9526
+ if (this._params.motionDetect) {
9527
+ Object.assign(body, this._params.motionDetect);
9528
+ }
9488
9529
  const headers = {
9489
9530
  ...session.authenticationHeaders(),
9490
9531
  Accept: "application/jsonl",
@@ -9517,50 +9558,19 @@ var LoadFromAssetUuidJob = class extends AbstractJob {
9517
9558
  const body = {
9518
9559
  sourceType: "ASSET_UUID",
9519
9560
  assetUuid: this._assetUuid,
9520
- params: this._params,
9561
+ params: this._params.componentParams,
9562
+ roi: this._params.roi,
9521
9563
  version: this._version
9522
9564
  };
9523
- const headers = {
9524
- ...session.authenticationHeaders(),
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");
9565
+ if (this._params.motionDetect) {
9566
+ Object.assign(body, this._params.motionDetect);
9551
9567
  }
9552
- const body = {
9553
- sourceType: "LIVE_INGRESS",
9554
- liveIngressId: this._ingressId,
9555
- params: this._params,
9556
- version: this._version
9557
- };
9558
9568
  const headers = {
9559
9569
  ...session.authenticationHeaders(),
9560
9570
  Accept: "application/jsonl",
9561
9571
  "Content-Type": "application/json"
9562
9572
  };
9563
- const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=preempt&processing=sync`;
9573
+ const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync`;
9564
9574
  return await this._client.fetch(patchUrl, {
9565
9575
  headers,
9566
9576
  method: "PATCH",
@@ -9601,9 +9611,13 @@ var LoadMediaStreamJob = class extends AbstractJob {
9601
9611
  const body = {
9602
9612
  sourceType: "WHIP",
9603
9613
  whipIngressId: whip.ingressId(),
9604
- params: this._params,
9614
+ params: this._params.componentParams,
9615
+ roi: this._params.roi,
9605
9616
  version: this._version
9606
9617
  };
9618
+ if (this._params.motionDetect) {
9619
+ Object.assign(body, this._params.motionDetect);
9620
+ }
9607
9621
  const headers = {
9608
9622
  ...session.authenticationHeaders(),
9609
9623
  Accept: "application/jsonl",
@@ -10241,19 +10255,43 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
10241
10255
  popId() {
10242
10256
  return this.options().popId || null;
10243
10257
  }
10244
- async process(source, params) {
10258
+ async process(param1, param2) {
10259
+ if (param1.source !== void 0) {
10260
+ return await this.processV2(param1);
10261
+ } else {
10262
+ return await this.processV1(param1, param2);
10263
+ }
10264
+ }
10265
+ async processV1(source, params) {
10245
10266
  if (source.file !== void 0) {
10246
- return this.uploadFile(source, params);
10267
+ return this.uploadFile(source, { componentParams: params });
10247
10268
  } else if (source.stream !== void 0) {
10248
- return this.uploadStream(source, params);
10269
+ return this.uploadStream(source, { componentParams: params });
10249
10270
  } else if (source.path !== void 0) {
10250
- return this.uploadPath(source, params);
10271
+ return this.uploadPath(source, { componentParams: params });
10251
10272
  } else if (source.url !== void 0) {
10252
- return this.loadFrom(source, params);
10273
+ return this.loadFrom(source, { componentParams: params });
10253
10274
  } else if (source.assetUuid !== void 0) {
10254
- return this.loadFromAssetUuid(source, params);
10275
+ return this.loadFromAssetUuid(source, { componentParams: params });
10255
10276
  } else if (source.mediaStream !== void 0) {
10256
- return this.loadMediaStream(source, params);
10277
+ return this.loadMediaStream(source, { componentParams: params });
10278
+ } else {
10279
+ return Promise.reject("unknown source type");
10280
+ }
10281
+ }
10282
+ async processV2(request) {
10283
+ if (request.source.file !== void 0) {
10284
+ return this.uploadFile(request.source, request);
10285
+ } else if (request.source.stream !== void 0) {
10286
+ return this.uploadStream(request.source, request);
10287
+ } else if (request.source.path !== void 0) {
10288
+ return this.uploadPath(request.source, request);
10289
+ } else if (request.source.url !== void 0) {
10290
+ return this.loadFrom(request.source, request);
10291
+ } else if (request.source.assetUuid !== void 0) {
10292
+ return this.loadFromAssetUuid(request.source, request);
10293
+ } else if (request.source.mediaStream !== void 0) {
10294
+ return this.loadMediaStream(request.source, request);
10257
10295
  } else {
10258
10296
  return Promise.reject("unknown source type");
10259
10297
  }
@@ -10362,9 +10400,12 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
10362
10400
  }
10363
10401
  async loadFrom(source, params) {
10364
10402
  if (source.url.startsWith("file://")) {
10365
- return await this.uploadPath({
10366
- path: source.url.substring("file://".length)
10367
- }, params);
10403
+ return await this.uploadPath(
10404
+ {
10405
+ path: source.url.substring("file://".length)
10406
+ },
10407
+ params
10408
+ );
10368
10409
  }
10369
10410
  if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
10370
10411
  throw new Error("endpoint not connected, use connect()");
@@ -10585,6 +10626,7 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
10585
10626
  const response_content = await response.json();
10586
10627
  sessions = response_content;
10587
10628
  }
10629
+ console.log(sessions);
10588
10630
  if (sessions.length > 0) {
10589
10631
  this._logger.debug(`User has ${sessions.length} sessions, inspecting for active session`);
10590
10632
  for (let s of sessions) {
@@ -10683,13 +10725,7 @@ var _WorkerEndpoint = class _WorkerEndpoint extends Endpoint {
10683
10725
  return result["id"];
10684
10726
  }
10685
10727
  };
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
- ]);
10728
+ _WorkerEndpoint.SESSION_DEAD = /* @__PURE__ */ new Set(["error" /* ERROR */, "failed" /* FAILED */, "stopped" /* STOPPED */, "pipeline_error" /* PIPELINE_ERROR */, "unknown" /* UNKNOWN */]);
10693
10729
  _WorkerEndpoint.WAIT_FOR_IS_READY = 60 * 1e3;
10694
10730
  _WorkerEndpoint.CHECK_FOR_IS_READY_INTERVAL = 250;
10695
10731
  var WorkerEndpoint = _WorkerEndpoint;
@@ -11914,6 +11950,15 @@ var DataEndpoint = class extends Endpoint {
11914
11950
  headers: { "Content-Type": "application/json" }
11915
11951
  });
11916
11952
  }
11953
+ async resolveAliases(aliases) {
11954
+ const params = new URLSearchParams();
11955
+ aliases.forEach((alias) => {
11956
+ params.append("alias", alias);
11957
+ });
11958
+ return this.request(`/exports/aliases?${params.toString()}`, {
11959
+ method: "GET"
11960
+ });
11961
+ }
11917
11962
  };
11918
11963
 
11919
11964
  // worker/webrtc_whep.ts
@@ -12143,7 +12188,6 @@ export {
12143
12188
  InferenceType,
12144
12189
  LoadFromAssetUuidJob,
12145
12190
  LoadFromJob,
12146
- LoadLiveIngressJob,
12147
12191
  LoadMediaStreamJob,
12148
12192
  ModelExportStatus,
12149
12193
  ModelFormat,