@eyepop.ai/eyepop 1.17.1 → 1.17.3

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.
@@ -8676,8 +8676,7 @@ var Stream = class _Stream {
8676
8676
  const message = JSON.parse(line);
8677
8677
  const event = message["event"];
8678
8678
  if (event !== void 0) {
8679
- eventHandler(event).then(() => {
8680
- });
8679
+ await eventHandler(event);
8681
8680
  } else {
8682
8681
  yield message;
8683
8682
  }
@@ -8909,6 +8908,9 @@ var AbstractJob = class {
8909
8908
  return Promise.reject("abstract class");
8910
8909
  }
8911
8910
  async onEvent(event) {
8911
+ if (event.type == "error") {
8912
+ return Promise.reject(`Error event for source ${event.source_id}: ${event.message}`);
8913
+ }
8912
8914
  return Promise.resolve();
8913
8915
  }
8914
8916
  start(done, status) {
@@ -9146,6 +9148,40 @@ var LoadFromJob = class extends AbstractJob {
9146
9148
  });
9147
9149
  }
9148
9150
  };
9151
+ var LoadFromAssetUuidJob = class extends AbstractJob {
9152
+ constructor(assetUuid, params, getSession, client, requestLogger) {
9153
+ super(params, getSession, client, requestLogger);
9154
+ this._assetUuid = assetUuid;
9155
+ }
9156
+ get [Symbol.toStringTag]() {
9157
+ return "loadFromAssetUuidJob";
9158
+ }
9159
+ async startJob() {
9160
+ const session = await this._getSession();
9161
+ if (!session.baseUrl) {
9162
+ return Promise.reject("session.baseUrl must not ne null");
9163
+ }
9164
+ const body = {
9165
+ sourceType: "ASSET_UUID",
9166
+ assetUuid: this._assetUuid,
9167
+ params: this._params
9168
+ };
9169
+ const headers = {
9170
+ ...session.authenticationHeaders(),
9171
+ Accept: "application/jsonl",
9172
+ "Content-Type": "application/json"
9173
+ };
9174
+ const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync`;
9175
+ return await this._client.fetch(patchUrl, {
9176
+ headers,
9177
+ method: "PATCH",
9178
+ body: JSON.stringify(body),
9179
+ signal: this._controller.signal,
9180
+ // @ts-ignore
9181
+ eyepop: { responseStreaming: true }
9182
+ });
9183
+ }
9184
+ };
9149
9185
  var LoadLiveIngressJob = class extends AbstractJob {
9150
9186
  constructor(ingressId, params, getSession, client, requestLogger) {
9151
9187
  super(params, getSession, client, requestLogger);
@@ -10353,6 +10389,8 @@ var WorkerEndpoint = class extends Endpoint {
10353
10389
  return this.loadFrom(source, params);
10354
10390
  } else if (source.ingressId !== void 0) {
10355
10391
  return this.loadLiveIngress(source, params);
10392
+ } else if (source.assetUuid !== void 0) {
10393
+ return this.loadFromAssetUuid(source, params);
10356
10394
  } else {
10357
10395
  return Promise.reject("unknown source type");
10358
10396
  }
@@ -10524,6 +10562,35 @@ var WorkerEndpoint = class extends Endpoint {
10524
10562
  throw e;
10525
10563
  }
10526
10564
  }
10565
+ async loadFromAssetUuid(source, params) {
10566
+ if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
10567
+ throw new Error("endpoint not connected, use connect()");
10568
+ }
10569
+ await this._limit.acquire();
10570
+ try {
10571
+ this.updateState();
10572
+ const job = new LoadFromAssetUuidJob(
10573
+ source.assetUuid,
10574
+ params,
10575
+ async () => {
10576
+ return this.session();
10577
+ },
10578
+ this._client,
10579
+ this._requestLogger
10580
+ );
10581
+ return job.start(
10582
+ () => {
10583
+ this.jobDone(job);
10584
+ },
10585
+ (statusCode) => {
10586
+ this.jobStatus(job, statusCode);
10587
+ }
10588
+ );
10589
+ } catch (e) {
10590
+ this._limit.release();
10591
+ throw e;
10592
+ }
10593
+ }
10527
10594
  async loadLiveIngress(source, params) {
10528
10595
  if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
10529
10596
  throw new Error("endpoint not connected, use connect()");
@@ -11722,6 +11789,7 @@ export {
11722
11789
  EyepopLineDecoder,
11723
11790
  ForwardOperatorType,
11724
11791
  InferenceType,
11792
+ LoadFromAssetUuidJob,
11725
11793
  LoadFromJob,
11726
11794
  LoadLiveIngressJob,
11727
11795
  ModelExportStatus,