@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.
@@ -133,7 +133,10 @@ interface LiveSource {
133
133
  interface UrlSource {
134
134
  readonly url: string;
135
135
  }
136
- type Source = FileSource | StreamSource | PathSource | LiveSource | UrlSource;
136
+ interface AssetUuidSource {
137
+ readonly assetUuid: string;
138
+ }
139
+ type Source = FileSource | StreamSource | PathSource | LiveSource | UrlSource | AssetUuidSource;
137
140
  interface ResultStream extends AsyncIterable<Prediction> {
138
141
  cancel(): void;
139
142
  }
@@ -482,6 +485,7 @@ declare class WorkerEndpoint extends Endpoint<WorkerEndpoint> {
482
485
  private uploadStream;
483
486
  private uploadPath;
484
487
  private loadFrom;
488
+ private loadFromAssetUuid;
485
489
  private loadLiveIngress;
486
490
  private jobDone;
487
491
  private jobStatus;
@@ -919,6 +923,12 @@ declare class LoadFromJob extends AbstractJob {
919
923
  get [Symbol.toStringTag](): string;
920
924
  protected startJob(): Promise<Response>;
921
925
  }
926
+ declare class LoadFromAssetUuidJob extends AbstractJob {
927
+ private readonly _assetUuid;
928
+ constructor(assetUuid: string, params: ComponentParams[] | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
929
+ get [Symbol.toStringTag](): string;
930
+ protected startJob(): Promise<Response>;
931
+ }
922
932
  declare class LoadLiveIngressJob extends AbstractJob {
923
933
  private readonly _ingressId;
924
934
  constructor(ingressId: string, params: ComponentParams[] | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
@@ -989,4 +999,4 @@ declare namespace EyePop {
989
999
  function dataEndpoint(opts?: DataOptions): DataEndpoint;
990
1000
  }
991
1001
 
992
- export { AbstractJob, type Annotation, AnnotationType, ArtifactType, type Asset, type AssetImport, AssetStatus, type Auth0Options, type Authentication, type AutoAnnotateParams, type AutoAnnotatePrompt, AutoAnnotateTask, type BaseComponent, type Box, type ChangeEvent, ChangeType, type ComponentFinderComponent, type ComponentParams, type Contour, type ContourFinderComponent, ContourType, type CreateWorkflow, type CreateWorkflowConfig, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetParent, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, Endpoint, EndpointState, ExportedBy, EyePop, EyepopLineDecoder, type FileSource, type ForwardComponent, ForwardOperatorType, type HttpClient, type InferenceComponent, InferenceType, type IngressEvent, type ListWorkFlowItem, type ListWorkFlowItemMetadata, type ListWorkflowItemMetadataLabels, type LiveMedia, type LiveSource, LoadFromJob, LoadLiveIngressJob, type LocalAuth, type Mask, type Model, type ModelCreate, type ModelExport, ModelExportStatus, ModelFormat, type ModelInstanceDef, type ModelMetrics, ModelPrecisionType, type ModelSample, ModelStatus, ModelTask, type ModelTrainingProgress, ModelTrainingStage, ModelType, type ModelUpdate, type OAuth2Auth, type OnChangeEvent, type Options, type PathSource, type PlatformSupport, type Point2d, type Point3d, type Pop, type PopComponent, PopComponentType, type PopCrop, type PopForward, type PopForwardOperator, type PredictedClass, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedObject, type PredictedText, type Prediction, type QcAiHubExportParams, type ResultStream, type SecretKeyAuth, Semaphore, type Session, type SessionAuth, type Source, type SourcesEntry, Stream, type StreamEvent, type StreamSource, type StreamTime, type TracingComponent, TranscodeMode, TransientPopId, UploadJob, type UrlSource, UserReview, VideoMode, WebrtcBase, WebrtcWhep, WebrtcWhip, WorkerEndpoint, type WorkerOptions, type WorkerSession, type Workflow, WorkflowPhase, EyePop as default, readableStreamFromString };
1002
+ export { AbstractJob, type Annotation, AnnotationType, ArtifactType, type Asset, type AssetImport, AssetStatus, type AssetUuidSource, type Auth0Options, type Authentication, type AutoAnnotateParams, type AutoAnnotatePrompt, AutoAnnotateTask, type BaseComponent, type Box, type ChangeEvent, ChangeType, type ComponentFinderComponent, type ComponentParams, type Contour, type ContourFinderComponent, ContourType, type CreateWorkflow, type CreateWorkflowConfig, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetParent, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, Endpoint, EndpointState, ExportedBy, EyePop, EyepopLineDecoder, type FileSource, type ForwardComponent, ForwardOperatorType, type HttpClient, type InferenceComponent, InferenceType, type IngressEvent, type ListWorkFlowItem, type ListWorkFlowItemMetadata, type ListWorkflowItemMetadataLabels, type LiveMedia, type LiveSource, LoadFromAssetUuidJob, LoadFromJob, LoadLiveIngressJob, type LocalAuth, type Mask, type Model, type ModelCreate, type ModelExport, ModelExportStatus, ModelFormat, type ModelInstanceDef, type ModelMetrics, ModelPrecisionType, type ModelSample, ModelStatus, ModelTask, type ModelTrainingProgress, ModelTrainingStage, ModelType, type ModelUpdate, type OAuth2Auth, type OnChangeEvent, type Options, type PathSource, type PlatformSupport, type Point2d, type Point3d, type Pop, type PopComponent, PopComponentType, type PopCrop, type PopForward, type PopForwardOperator, type PredictedClass, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedObject, type PredictedText, type Prediction, type QcAiHubExportParams, type ResultStream, type SecretKeyAuth, Semaphore, type Session, type SessionAuth, type Source, type SourcesEntry, Stream, type StreamEvent, type StreamSource, type StreamTime, type TracingComponent, TranscodeMode, TransientPopId, UploadJob, type UrlSource, UserReview, VideoMode, WebrtcBase, WebrtcWhep, WebrtcWhip, WorkerEndpoint, type WorkerOptions, type WorkerSession, type Workflow, WorkflowPhase, EyePop as default, readableStreamFromString };
@@ -133,7 +133,10 @@ interface LiveSource {
133
133
  interface UrlSource {
134
134
  readonly url: string;
135
135
  }
136
- type Source = FileSource | StreamSource | PathSource | LiveSource | UrlSource;
136
+ interface AssetUuidSource {
137
+ readonly assetUuid: string;
138
+ }
139
+ type Source = FileSource | StreamSource | PathSource | LiveSource | UrlSource | AssetUuidSource;
137
140
  interface ResultStream extends AsyncIterable<Prediction> {
138
141
  cancel(): void;
139
142
  }
@@ -482,6 +485,7 @@ declare class WorkerEndpoint extends Endpoint<WorkerEndpoint> {
482
485
  private uploadStream;
483
486
  private uploadPath;
484
487
  private loadFrom;
488
+ private loadFromAssetUuid;
485
489
  private loadLiveIngress;
486
490
  private jobDone;
487
491
  private jobStatus;
@@ -919,6 +923,12 @@ declare class LoadFromJob extends AbstractJob {
919
923
  get [Symbol.toStringTag](): string;
920
924
  protected startJob(): Promise<Response>;
921
925
  }
926
+ declare class LoadFromAssetUuidJob extends AbstractJob {
927
+ private readonly _assetUuid;
928
+ constructor(assetUuid: string, params: ComponentParams[] | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
929
+ get [Symbol.toStringTag](): string;
930
+ protected startJob(): Promise<Response>;
931
+ }
922
932
  declare class LoadLiveIngressJob extends AbstractJob {
923
933
  private readonly _ingressId;
924
934
  constructor(ingressId: string, params: ComponentParams[] | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
@@ -989,4 +999,4 @@ declare namespace EyePop {
989
999
  function dataEndpoint(opts?: DataOptions): DataEndpoint;
990
1000
  }
991
1001
 
992
- export { AbstractJob, type Annotation, AnnotationType, ArtifactType, type Asset, type AssetImport, AssetStatus, type Auth0Options, type Authentication, type AutoAnnotateParams, type AutoAnnotatePrompt, AutoAnnotateTask, type BaseComponent, type Box, type ChangeEvent, ChangeType, type ComponentFinderComponent, type ComponentParams, type Contour, type ContourFinderComponent, ContourType, type CreateWorkflow, type CreateWorkflowConfig, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetParent, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, Endpoint, EndpointState, ExportedBy, EyePop, EyepopLineDecoder, type FileSource, type ForwardComponent, ForwardOperatorType, type HttpClient, type InferenceComponent, InferenceType, type IngressEvent, type ListWorkFlowItem, type ListWorkFlowItemMetadata, type ListWorkflowItemMetadataLabels, type LiveMedia, type LiveSource, LoadFromJob, LoadLiveIngressJob, type LocalAuth, type Mask, type Model, type ModelCreate, type ModelExport, ModelExportStatus, ModelFormat, type ModelInstanceDef, type ModelMetrics, ModelPrecisionType, type ModelSample, ModelStatus, ModelTask, type ModelTrainingProgress, ModelTrainingStage, ModelType, type ModelUpdate, type OAuth2Auth, type OnChangeEvent, type Options, type PathSource, type PlatformSupport, type Point2d, type Point3d, type Pop, type PopComponent, PopComponentType, type PopCrop, type PopForward, type PopForwardOperator, type PredictedClass, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedObject, type PredictedText, type Prediction, type QcAiHubExportParams, type ResultStream, type SecretKeyAuth, Semaphore, type Session, type SessionAuth, type Source, type SourcesEntry, Stream, type StreamEvent, type StreamSource, type StreamTime, type TracingComponent, TranscodeMode, TransientPopId, UploadJob, type UrlSource, UserReview, VideoMode, WebrtcBase, WebrtcWhep, WebrtcWhip, WorkerEndpoint, type WorkerOptions, type WorkerSession, type Workflow, WorkflowPhase, EyePop as default, readableStreamFromString };
1002
+ export { AbstractJob, type Annotation, AnnotationType, ArtifactType, type Asset, type AssetImport, AssetStatus, type AssetUuidSource, type Auth0Options, type Authentication, type AutoAnnotateParams, type AutoAnnotatePrompt, AutoAnnotateTask, type BaseComponent, type Box, type ChangeEvent, ChangeType, type ComponentFinderComponent, type ComponentParams, type Contour, type ContourFinderComponent, ContourType, type CreateWorkflow, type CreateWorkflowConfig, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetParent, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, Endpoint, EndpointState, ExportedBy, EyePop, EyepopLineDecoder, type FileSource, type ForwardComponent, ForwardOperatorType, type HttpClient, type InferenceComponent, InferenceType, type IngressEvent, type ListWorkFlowItem, type ListWorkFlowItemMetadata, type ListWorkflowItemMetadataLabels, type LiveMedia, type LiveSource, LoadFromAssetUuidJob, LoadFromJob, LoadLiveIngressJob, type LocalAuth, type Mask, type Model, type ModelCreate, type ModelExport, ModelExportStatus, ModelFormat, type ModelInstanceDef, type ModelMetrics, ModelPrecisionType, type ModelSample, ModelStatus, ModelTask, type ModelTrainingProgress, ModelTrainingStage, ModelType, type ModelUpdate, type OAuth2Auth, type OnChangeEvent, type Options, type PathSource, type PlatformSupport, type Point2d, type Point3d, type Pop, type PopComponent, PopComponentType, type PopCrop, type PopForward, type PopForwardOperator, type PredictedClass, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedMesh, type PredictedObject, type PredictedText, type Prediction, type QcAiHubExportParams, type ResultStream, type SecretKeyAuth, Semaphore, type Session, type SessionAuth, type Source, type SourcesEntry, Stream, type StreamEvent, type StreamSource, type StreamTime, type TracingComponent, TranscodeMode, TransientPopId, UploadJob, type UrlSource, UserReview, VideoMode, WebrtcBase, WebrtcWhep, WebrtcWhip, WorkerEndpoint, type WorkerOptions, type WorkerSession, type Workflow, WorkflowPhase, EyePop as default, readableStreamFromString };
@@ -8671,6 +8671,7 @@ __export(index_exports, {
8671
8671
  EyepopLineDecoder: () => EyepopLineDecoder,
8672
8672
  ForwardOperatorType: () => ForwardOperatorType,
8673
8673
  InferenceType: () => InferenceType,
8674
+ LoadFromAssetUuidJob: () => LoadFromAssetUuidJob,
8674
8675
  LoadFromJob: () => LoadFromJob,
8675
8676
  LoadLiveIngressJob: () => LoadLiveIngressJob,
8676
8677
  ModelExportStatus: () => ModelExportStatus,
@@ -8742,8 +8743,7 @@ var Stream = class _Stream {
8742
8743
  const message = JSON.parse(line);
8743
8744
  const event = message["event"];
8744
8745
  if (event !== void 0) {
8745
- eventHandler(event).then(() => {
8746
- });
8746
+ await eventHandler(event);
8747
8747
  } else {
8748
8748
  yield message;
8749
8749
  }
@@ -8975,6 +8975,9 @@ var AbstractJob = class {
8975
8975
  return Promise.reject("abstract class");
8976
8976
  }
8977
8977
  async onEvent(event) {
8978
+ if (event.type == "error") {
8979
+ return Promise.reject(`Error event for source ${event.source_id}: ${event.message}`);
8980
+ }
8978
8981
  return Promise.resolve();
8979
8982
  }
8980
8983
  start(done, status) {
@@ -9212,6 +9215,40 @@ var LoadFromJob = class extends AbstractJob {
9212
9215
  });
9213
9216
  }
9214
9217
  };
9218
+ var LoadFromAssetUuidJob = class extends AbstractJob {
9219
+ constructor(assetUuid, params, getSession, client, requestLogger) {
9220
+ super(params, getSession, client, requestLogger);
9221
+ this._assetUuid = assetUuid;
9222
+ }
9223
+ get [Symbol.toStringTag]() {
9224
+ return "loadFromAssetUuidJob";
9225
+ }
9226
+ async startJob() {
9227
+ const session = await this._getSession();
9228
+ if (!session.baseUrl) {
9229
+ return Promise.reject("session.baseUrl must not ne null");
9230
+ }
9231
+ const body = {
9232
+ sourceType: "ASSET_UUID",
9233
+ assetUuid: this._assetUuid,
9234
+ params: this._params
9235
+ };
9236
+ const headers = {
9237
+ ...session.authenticationHeaders(),
9238
+ Accept: "application/jsonl",
9239
+ "Content-Type": "application/json"
9240
+ };
9241
+ const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync`;
9242
+ return await this._client.fetch(patchUrl, {
9243
+ headers,
9244
+ method: "PATCH",
9245
+ body: JSON.stringify(body),
9246
+ signal: this._controller.signal,
9247
+ // @ts-ignore
9248
+ eyepop: { responseStreaming: true }
9249
+ });
9250
+ }
9251
+ };
9215
9252
  var LoadLiveIngressJob = class extends AbstractJob {
9216
9253
  constructor(ingressId, params, getSession, client, requestLogger) {
9217
9254
  super(params, getSession, client, requestLogger);
@@ -10419,6 +10456,8 @@ var WorkerEndpoint = class extends Endpoint {
10419
10456
  return this.loadFrom(source, params);
10420
10457
  } else if (source.ingressId !== void 0) {
10421
10458
  return this.loadLiveIngress(source, params);
10459
+ } else if (source.assetUuid !== void 0) {
10460
+ return this.loadFromAssetUuid(source, params);
10422
10461
  } else {
10423
10462
  return Promise.reject("unknown source type");
10424
10463
  }
@@ -10590,6 +10629,35 @@ var WorkerEndpoint = class extends Endpoint {
10590
10629
  throw e;
10591
10630
  }
10592
10631
  }
10632
+ async loadFromAssetUuid(source, params) {
10633
+ if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
10634
+ throw new Error("endpoint not connected, use connect()");
10635
+ }
10636
+ await this._limit.acquire();
10637
+ try {
10638
+ this.updateState();
10639
+ const job = new LoadFromAssetUuidJob(
10640
+ source.assetUuid,
10641
+ params,
10642
+ async () => {
10643
+ return this.session();
10644
+ },
10645
+ this._client,
10646
+ this._requestLogger
10647
+ );
10648
+ return job.start(
10649
+ () => {
10650
+ this.jobDone(job);
10651
+ },
10652
+ (statusCode) => {
10653
+ this.jobStatus(job, statusCode);
10654
+ }
10655
+ );
10656
+ } catch (e) {
10657
+ this._limit.release();
10658
+ throw e;
10659
+ }
10660
+ }
10593
10661
  async loadLiveIngress(source, params) {
10594
10662
  if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
10595
10663
  throw new Error("endpoint not connected, use connect()");
@@ -11789,6 +11857,7 @@ var index_default = EyePop;
11789
11857
  EyepopLineDecoder,
11790
11858
  ForwardOperatorType,
11791
11859
  InferenceType,
11860
+ LoadFromAssetUuidJob,
11792
11861
  LoadFromJob,
11793
11862
  LoadLiveIngressJob,
11794
11863
  ModelExportStatus,