@eyepop.ai/eyepop 1.3.0 → 1.5.0

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.
@@ -35,7 +35,7 @@ interface Prediction extends StreamTime {
35
35
  source_id?: string;
36
36
  objects?: Array<PredictedObject>;
37
37
  classes?: Array<PredictedClass>;
38
- labels?: Array<PredictedLabel>;
38
+ texts?: Array<PredictedText>;
39
39
  meshs?: Array<PredictedMesh>;
40
40
  keyPoints?: Array<PredictedKeyPoints>;
41
41
  }
@@ -45,10 +45,10 @@ interface PredictedClass {
45
45
  classLabel: string;
46
46
  category: string;
47
47
  }
48
- interface PredictedLabel {
48
+ interface PredictedText {
49
49
  id: number;
50
50
  confidence: number;
51
- label: string;
51
+ text: string;
52
52
  category: string;
53
53
  }
54
54
  interface Contour {
@@ -73,7 +73,7 @@ interface PredictedObject extends PredictedClass {
73
73
  mask: Mask | undefined;
74
74
  objects: Array<PredictedObject> | undefined;
75
75
  classes: Array<PredictedClass> | undefined;
76
- labels: Array<PredictedLabel> | undefined;
76
+ texts: Array<PredictedText> | undefined;
77
77
  meshs: Array<PredictedMesh> | undefined;
78
78
  keyPoints: Array<PredictedKeyPoints> | undefined;
79
79
  }
@@ -464,6 +464,8 @@ interface DatasetVersion {
464
464
  modifiable: boolean;
465
465
  created_at: Date;
466
466
  updated_at: Date;
467
+ analysis_started_at?: Date;
468
+ auto_annotate_started_at?: Date;
467
469
  hero_asset_uuid?: string;
468
470
  asset_stats?: DatasetVersionAssetStats;
469
471
  }
@@ -477,6 +479,7 @@ interface Dataset {
477
479
  account_uuid: string;
478
480
  created_at: Date;
479
481
  updated_at: Date;
482
+ modifiable_version?: number;
480
483
  versions: DatasetVersion[];
481
484
  }
482
485
  interface DatasetCreate {
@@ -487,7 +490,7 @@ interface DatasetCreate {
487
490
  auto_annotate_params?: AutoAnnotateParams;
488
491
  }
489
492
  interface DatasetUpdate {
490
- name: string;
493
+ name?: string;
491
494
  description?: string;
492
495
  tags?: string[];
493
496
  auto_annotates?: string[];
@@ -573,6 +576,7 @@ interface Model {
573
576
  uuid: string;
574
577
  name: string;
575
578
  description?: string;
579
+ external_id?: string;
576
580
  type: ModelType;
577
581
  status: ModelStatus;
578
582
  status_message?: string;
@@ -586,10 +590,12 @@ interface Model {
586
590
  interface ModelCreate {
587
591
  name: string;
588
592
  description: string;
593
+ external_id?: string;
589
594
  }
590
595
  interface ModelUpdate {
591
596
  name: string;
592
597
  description: string;
598
+ external_id?: string;
593
599
  }
594
600
  declare enum ModelTrainingStage {
595
601
  waiting = "waiting",
@@ -656,10 +662,12 @@ declare class DataEndpoint extends Endpoint<DataEndpoint> {
656
662
  createDataset(data: DatasetCreate): Promise<Dataset>;
657
663
  getDataset(dataset_uuid: string,
658
664
  /** @deprecated */ include_hero_asset?: boolean, include_stats?: boolean): Promise<Dataset>;
659
- updateDataset(dataset_uuid: string, data: DatasetUpdate): Promise<Dataset>;
665
+ updateDataset(dataset_uuid: string, data: DatasetUpdate, start_auto_annotate?: boolean): Promise<Dataset>;
660
666
  updateDatasetHeroAsset(dataset_uuid: string, update: DatasetHeroAssetUpdate): Promise<Dataset>;
661
667
  deleteDataset(dataset_uuid: string): Promise<void>;
662
668
  freezeDatasetVersion(dataset_uuid: string, dataset_version?: number): Promise<Dataset>;
669
+ analyzeDatasetVersion(dataset_uuid: string, dataset_version?: number): Promise<void>;
670
+ autoAnnotateDatasetVersion(dataset_uuid: string, dataset_version?: number, max_assets?: number): Promise<void>;
663
671
  deleteDatasetVersion(dataset_uuid: string, dataset_version: number): Promise<Dataset>;
664
672
  uploadAsset(dataset_uuid: string, dataset_version: number | undefined, blob: Blob, external_id?: string | undefined): Promise<Asset>;
665
673
  importAsset(dataset_uuid: string, dataset_version: number | undefined, asset_import: AssetImport, external_id?: string | undefined): Promise<Asset>;
@@ -673,11 +681,12 @@ declare class DataEndpoint extends Endpoint<DataEndpoint> {
673
681
  downloadAsset(asset_uuid: string, dataset_uuid?: string, dataset_version?: number, transcode_mode?: TranscodeMode): Promise<Blob>;
674
682
  previewAutoAnnotateAsset(asset_uuid: string, auto_annotate: string, auto_annotate_params?: AutoAnnotateParams): Promise<Annotation>;
675
683
  listModels(): Promise<Model[]>;
676
- createModel(dataset_uuid: string, dataset_version: number, data: ModelCreate): Promise<Model>;
684
+ createModel(dataset_uuid: string, dataset_version: number, data: ModelCreate, start_training?: boolean): Promise<Model>;
677
685
  getModel(model_uuid: string): Promise<Model>;
678
686
  getModelTrainingProgress(model_uuid: string): Promise<ModelTrainingProgress>;
679
687
  updateModel(model_uuid: string, data: ModelUpdate): Promise<Model>;
680
688
  deleteModel(model_uuid: string): Promise<void>;
689
+ trainModel(model_uuid: string): Promise<Model>;
681
690
  publishModel(model_uuid: string): Promise<Model>;
682
691
  addAccountEventHandler(eventHandler: OnChangeEvent): void;
683
692
  removeAccountEventHandler(eventHandler: OnChangeEvent): void;
@@ -687,11 +696,16 @@ declare class DataEndpoint extends Endpoint<DataEndpoint> {
687
696
  private dispatchChangeEvent;
688
697
  }
689
698
 
699
+ interface StreamEvent {
700
+ type: string;
701
+ source_id?: string;
702
+ message?: string;
703
+ }
690
704
  declare class Stream<Prediction> implements AsyncIterable<Prediction> {
691
705
  private iterator;
692
706
  controller: AbortController;
693
707
  constructor(iterator: () => AsyncIterator<Prediction>, controller: AbortController);
694
- static iterFromReadableStream<Prediction>(readableStream: Promise<ReadableStream<Uint8Array>>, controller: AbortController): AsyncIterator<Prediction, any, undefined>;
708
+ static iterFromReadableStream<Prediction>(readableStream: Promise<ReadableStream<Uint8Array>>, controller: AbortController, eventHandler: (event: StreamEvent) => Promise<void>): AsyncIterator<Prediction, any, undefined>;
695
709
  /**
696
710
  * Generates a Stream from a newline-separated ReadableStream
697
711
  * where each item is a JSON value.
@@ -721,6 +735,7 @@ declare class AbstractJob implements ResultStream {
721
735
  [Symbol.asyncIterator](): AsyncIterator<Prediction>;
722
736
  protected constructor(params: SourceParams | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
723
737
  protected startJob(): Promise<Response>;
738
+ protected onEvent(event: StreamEvent): Promise<void>;
724
739
  static n: number;
725
740
  start(done: () => void, status: (statusCode: number) => void): AbstractJob;
726
741
  cancel(): void;
@@ -728,8 +743,10 @@ declare class AbstractJob implements ResultStream {
728
743
  declare class UploadJob extends AbstractJob {
729
744
  private readonly _uploadStream;
730
745
  private readonly _mimeType;
746
+ private readonly _needsFullDuplex;
731
747
  get [Symbol.toStringTag](): string;
732
748
  constructor(stream: any, mimeType: string, params: SourceParams | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
749
+ protected onEvent(event: StreamEvent): Promise<void>;
733
750
  protected startJob(): Promise<Response>;
734
751
  }
735
752
  declare class LoadFromJob extends AbstractJob {
@@ -807,4 +824,4 @@ declare namespace EyePop {
807
824
  function dataEndpoint(opts?: DataOptions): DataEndpoint;
808
825
  }
809
826
 
810
- export { AbstractJob, type Annotation, AnnotationType, type Asset, type AssetImport, AssetStatus, type Auth0Options, type Authentication, type AutoAnnotateParams, type BaseComponent, type Box, type ChangeEvent, ChangeType, type ComponentFinderComponent, type Contour, type ContourFinderComponent, ContourType, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, Endpoint, EndpointState, EyePop, type FileSource, type ForwardComponent, ForwardOperatorType, type InferenceComponent, InferenceType, type IngressEvent, type LiveMedia, type LiveSource, LoadFromJob, LoadLiveIngressJob, type Mask, type Model, type ModelCreate, ModelFormat, type ModelInstanceDef, type ModelMetrics, ModelPrecisionType, type ModelSample, ModelStatus, type ModelTrainingProgress, ModelTrainingStage, ModelType, type ModelUpdate, type OAuth2Auth, type OnChangeEvent, type Options, type PathSource, type Point2d, type Point3d, type Pop, type PopComponent, PopComponentType, type PopCrop, type PopForward, type PopForwardOperator, type PredictedClass, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedLabel, type PredictedMesh, type PredictedObject, type Prediction, type ResultStream, type Roi, type SecretKeyAuth, Semaphore, type Session, type SessionAuth, type Source, type SourceParams, type SourcesEntry, Stream, type StreamSource, type StreamTime, type TracingComponent, TranscodeMode, TransientPopId, UploadJob, type UrlSource, UserReview, WebrtcBase, WebrtcWhep, WebrtcWhip, WorkerEndpoint, type WorkerOptions, type WorkerSession, EyePop as default };
827
+ export { AbstractJob, type Annotation, AnnotationType, type Asset, type AssetImport, AssetStatus, type Auth0Options, type Authentication, type AutoAnnotateParams, type BaseComponent, type Box, type ChangeEvent, ChangeType, type ComponentFinderComponent, type Contour, type ContourFinderComponent, ContourType, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, Endpoint, EndpointState, EyePop, type FileSource, type ForwardComponent, ForwardOperatorType, type InferenceComponent, InferenceType, type IngressEvent, type LiveMedia, type LiveSource, LoadFromJob, LoadLiveIngressJob, type Mask, type Model, type ModelCreate, ModelFormat, type ModelInstanceDef, type ModelMetrics, ModelPrecisionType, type ModelSample, ModelStatus, type ModelTrainingProgress, ModelTrainingStage, ModelType, type ModelUpdate, type OAuth2Auth, type OnChangeEvent, type Options, type PathSource, 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 ResultStream, type Roi, type SecretKeyAuth, Semaphore, type Session, type SessionAuth, type Source, type SourceParams, type SourcesEntry, Stream, type StreamEvent, type StreamSource, type StreamTime, type TracingComponent, TranscodeMode, TransientPopId, UploadJob, type UrlSource, UserReview, WebrtcBase, WebrtcWhep, WebrtcWhip, WorkerEndpoint, type WorkerOptions, type WorkerSession, EyePop as default };
@@ -35,7 +35,7 @@ interface Prediction extends StreamTime {
35
35
  source_id?: string;
36
36
  objects?: Array<PredictedObject>;
37
37
  classes?: Array<PredictedClass>;
38
- labels?: Array<PredictedLabel>;
38
+ texts?: Array<PredictedText>;
39
39
  meshs?: Array<PredictedMesh>;
40
40
  keyPoints?: Array<PredictedKeyPoints>;
41
41
  }
@@ -45,10 +45,10 @@ interface PredictedClass {
45
45
  classLabel: string;
46
46
  category: string;
47
47
  }
48
- interface PredictedLabel {
48
+ interface PredictedText {
49
49
  id: number;
50
50
  confidence: number;
51
- label: string;
51
+ text: string;
52
52
  category: string;
53
53
  }
54
54
  interface Contour {
@@ -73,7 +73,7 @@ interface PredictedObject extends PredictedClass {
73
73
  mask: Mask | undefined;
74
74
  objects: Array<PredictedObject> | undefined;
75
75
  classes: Array<PredictedClass> | undefined;
76
- labels: Array<PredictedLabel> | undefined;
76
+ texts: Array<PredictedText> | undefined;
77
77
  meshs: Array<PredictedMesh> | undefined;
78
78
  keyPoints: Array<PredictedKeyPoints> | undefined;
79
79
  }
@@ -464,6 +464,8 @@ interface DatasetVersion {
464
464
  modifiable: boolean;
465
465
  created_at: Date;
466
466
  updated_at: Date;
467
+ analysis_started_at?: Date;
468
+ auto_annotate_started_at?: Date;
467
469
  hero_asset_uuid?: string;
468
470
  asset_stats?: DatasetVersionAssetStats;
469
471
  }
@@ -477,6 +479,7 @@ interface Dataset {
477
479
  account_uuid: string;
478
480
  created_at: Date;
479
481
  updated_at: Date;
482
+ modifiable_version?: number;
480
483
  versions: DatasetVersion[];
481
484
  }
482
485
  interface DatasetCreate {
@@ -487,7 +490,7 @@ interface DatasetCreate {
487
490
  auto_annotate_params?: AutoAnnotateParams;
488
491
  }
489
492
  interface DatasetUpdate {
490
- name: string;
493
+ name?: string;
491
494
  description?: string;
492
495
  tags?: string[];
493
496
  auto_annotates?: string[];
@@ -573,6 +576,7 @@ interface Model {
573
576
  uuid: string;
574
577
  name: string;
575
578
  description?: string;
579
+ external_id?: string;
576
580
  type: ModelType;
577
581
  status: ModelStatus;
578
582
  status_message?: string;
@@ -586,10 +590,12 @@ interface Model {
586
590
  interface ModelCreate {
587
591
  name: string;
588
592
  description: string;
593
+ external_id?: string;
589
594
  }
590
595
  interface ModelUpdate {
591
596
  name: string;
592
597
  description: string;
598
+ external_id?: string;
593
599
  }
594
600
  declare enum ModelTrainingStage {
595
601
  waiting = "waiting",
@@ -656,10 +662,12 @@ declare class DataEndpoint extends Endpoint<DataEndpoint> {
656
662
  createDataset(data: DatasetCreate): Promise<Dataset>;
657
663
  getDataset(dataset_uuid: string,
658
664
  /** @deprecated */ include_hero_asset?: boolean, include_stats?: boolean): Promise<Dataset>;
659
- updateDataset(dataset_uuid: string, data: DatasetUpdate): Promise<Dataset>;
665
+ updateDataset(dataset_uuid: string, data: DatasetUpdate, start_auto_annotate?: boolean): Promise<Dataset>;
660
666
  updateDatasetHeroAsset(dataset_uuid: string, update: DatasetHeroAssetUpdate): Promise<Dataset>;
661
667
  deleteDataset(dataset_uuid: string): Promise<void>;
662
668
  freezeDatasetVersion(dataset_uuid: string, dataset_version?: number): Promise<Dataset>;
669
+ analyzeDatasetVersion(dataset_uuid: string, dataset_version?: number): Promise<void>;
670
+ autoAnnotateDatasetVersion(dataset_uuid: string, dataset_version?: number, max_assets?: number): Promise<void>;
663
671
  deleteDatasetVersion(dataset_uuid: string, dataset_version: number): Promise<Dataset>;
664
672
  uploadAsset(dataset_uuid: string, dataset_version: number | undefined, blob: Blob, external_id?: string | undefined): Promise<Asset>;
665
673
  importAsset(dataset_uuid: string, dataset_version: number | undefined, asset_import: AssetImport, external_id?: string | undefined): Promise<Asset>;
@@ -673,11 +681,12 @@ declare class DataEndpoint extends Endpoint<DataEndpoint> {
673
681
  downloadAsset(asset_uuid: string, dataset_uuid?: string, dataset_version?: number, transcode_mode?: TranscodeMode): Promise<Blob>;
674
682
  previewAutoAnnotateAsset(asset_uuid: string, auto_annotate: string, auto_annotate_params?: AutoAnnotateParams): Promise<Annotation>;
675
683
  listModels(): Promise<Model[]>;
676
- createModel(dataset_uuid: string, dataset_version: number, data: ModelCreate): Promise<Model>;
684
+ createModel(dataset_uuid: string, dataset_version: number, data: ModelCreate, start_training?: boolean): Promise<Model>;
677
685
  getModel(model_uuid: string): Promise<Model>;
678
686
  getModelTrainingProgress(model_uuid: string): Promise<ModelTrainingProgress>;
679
687
  updateModel(model_uuid: string, data: ModelUpdate): Promise<Model>;
680
688
  deleteModel(model_uuid: string): Promise<void>;
689
+ trainModel(model_uuid: string): Promise<Model>;
681
690
  publishModel(model_uuid: string): Promise<Model>;
682
691
  addAccountEventHandler(eventHandler: OnChangeEvent): void;
683
692
  removeAccountEventHandler(eventHandler: OnChangeEvent): void;
@@ -687,11 +696,16 @@ declare class DataEndpoint extends Endpoint<DataEndpoint> {
687
696
  private dispatchChangeEvent;
688
697
  }
689
698
 
699
+ interface StreamEvent {
700
+ type: string;
701
+ source_id?: string;
702
+ message?: string;
703
+ }
690
704
  declare class Stream<Prediction> implements AsyncIterable<Prediction> {
691
705
  private iterator;
692
706
  controller: AbortController;
693
707
  constructor(iterator: () => AsyncIterator<Prediction>, controller: AbortController);
694
- static iterFromReadableStream<Prediction>(readableStream: Promise<ReadableStream<Uint8Array>>, controller: AbortController): AsyncIterator<Prediction, any, undefined>;
708
+ static iterFromReadableStream<Prediction>(readableStream: Promise<ReadableStream<Uint8Array>>, controller: AbortController, eventHandler: (event: StreamEvent) => Promise<void>): AsyncIterator<Prediction, any, undefined>;
695
709
  /**
696
710
  * Generates a Stream from a newline-separated ReadableStream
697
711
  * where each item is a JSON value.
@@ -721,6 +735,7 @@ declare class AbstractJob implements ResultStream {
721
735
  [Symbol.asyncIterator](): AsyncIterator<Prediction>;
722
736
  protected constructor(params: SourceParams | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
723
737
  protected startJob(): Promise<Response>;
738
+ protected onEvent(event: StreamEvent): Promise<void>;
724
739
  static n: number;
725
740
  start(done: () => void, status: (statusCode: number) => void): AbstractJob;
726
741
  cancel(): void;
@@ -728,8 +743,10 @@ declare class AbstractJob implements ResultStream {
728
743
  declare class UploadJob extends AbstractJob {
729
744
  private readonly _uploadStream;
730
745
  private readonly _mimeType;
746
+ private readonly _needsFullDuplex;
731
747
  get [Symbol.toStringTag](): string;
732
748
  constructor(stream: any, mimeType: string, params: SourceParams | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
749
+ protected onEvent(event: StreamEvent): Promise<void>;
733
750
  protected startJob(): Promise<Response>;
734
751
  }
735
752
  declare class LoadFromJob extends AbstractJob {
@@ -807,4 +824,4 @@ declare namespace EyePop {
807
824
  function dataEndpoint(opts?: DataOptions): DataEndpoint;
808
825
  }
809
826
 
810
- export { AbstractJob, type Annotation, AnnotationType, type Asset, type AssetImport, AssetStatus, type Auth0Options, type Authentication, type AutoAnnotateParams, type BaseComponent, type Box, type ChangeEvent, ChangeType, type ComponentFinderComponent, type Contour, type ContourFinderComponent, ContourType, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, Endpoint, EndpointState, EyePop, type FileSource, type ForwardComponent, ForwardOperatorType, type InferenceComponent, InferenceType, type IngressEvent, type LiveMedia, type LiveSource, LoadFromJob, LoadLiveIngressJob, type Mask, type Model, type ModelCreate, ModelFormat, type ModelInstanceDef, type ModelMetrics, ModelPrecisionType, type ModelSample, ModelStatus, type ModelTrainingProgress, ModelTrainingStage, ModelType, type ModelUpdate, type OAuth2Auth, type OnChangeEvent, type Options, type PathSource, type Point2d, type Point3d, type Pop, type PopComponent, PopComponentType, type PopCrop, type PopForward, type PopForwardOperator, type PredictedClass, type PredictedKeyPoint, type PredictedKeyPoints, type PredictedLabel, type PredictedMesh, type PredictedObject, type Prediction, type ResultStream, type Roi, type SecretKeyAuth, Semaphore, type Session, type SessionAuth, type Source, type SourceParams, type SourcesEntry, Stream, type StreamSource, type StreamTime, type TracingComponent, TranscodeMode, TransientPopId, UploadJob, type UrlSource, UserReview, WebrtcBase, WebrtcWhep, WebrtcWhip, WorkerEndpoint, type WorkerOptions, type WorkerSession, EyePop as default };
827
+ export { AbstractJob, type Annotation, AnnotationType, type Asset, type AssetImport, AssetStatus, type Auth0Options, type Authentication, type AutoAnnotateParams, type BaseComponent, type Box, type ChangeEvent, ChangeType, type ComponentFinderComponent, type Contour, type ContourFinderComponent, ContourType, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, Endpoint, EndpointState, EyePop, type FileSource, type ForwardComponent, ForwardOperatorType, type InferenceComponent, InferenceType, type IngressEvent, type LiveMedia, type LiveSource, LoadFromJob, LoadLiveIngressJob, type Mask, type Model, type ModelCreate, ModelFormat, type ModelInstanceDef, type ModelMetrics, ModelPrecisionType, type ModelSample, ModelStatus, type ModelTrainingProgress, ModelTrainingStage, ModelType, type ModelUpdate, type OAuth2Auth, type OnChangeEvent, type Options, type PathSource, 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 ResultStream, type Roi, type SecretKeyAuth, Semaphore, type Session, type SessionAuth, type Source, type SourceParams, type SourcesEntry, Stream, type StreamEvent, type StreamSource, type StreamTime, type TracingComponent, TranscodeMode, TransientPopId, UploadJob, type UrlSource, UserReview, WebrtcBase, WebrtcWhep, WebrtcWhip, WorkerEndpoint, type WorkerOptions, type WorkerSession, EyePop as default };
@@ -8705,7 +8705,7 @@ var Stream = class _Stream {
8705
8705
  this.iterator = iterator;
8706
8706
  this.controller = controller;
8707
8707
  }
8708
- static iterFromReadableStream(readableStream, controller) {
8708
+ static iterFromReadableStream(readableStream, controller, eventHandler) {
8709
8709
  let consumed = false;
8710
8710
  async function* iterLines() {
8711
8711
  const lineDecoder = new LineDecoder();
@@ -8728,7 +8728,16 @@ var Stream = class _Stream {
8728
8728
  try {
8729
8729
  for await (const line of iterLines()) {
8730
8730
  if (done) continue;
8731
- if (line) yield JSON.parse(line);
8731
+ if (line) {
8732
+ const message = JSON.parse(line);
8733
+ const event = message["event"];
8734
+ if (event !== void 0) {
8735
+ eventHandler(event).then(() => {
8736
+ });
8737
+ } else {
8738
+ yield message;
8739
+ }
8740
+ }
8732
8741
  }
8733
8742
  done = true;
8734
8743
  } catch (e) {
@@ -8951,11 +8960,20 @@ var AbstractJob = class {
8951
8960
  if (!this._responseStream) {
8952
8961
  throw Error("logical bug");
8953
8962
  }
8954
- return Stream.iterFromReadableStream(this._responseStream, this._controller);
8963
+ return Stream.iterFromReadableStream(
8964
+ this._responseStream,
8965
+ this._controller,
8966
+ async (event) => {
8967
+ return await this.onEvent(event);
8968
+ }
8969
+ );
8955
8970
  }
8956
8971
  async startJob() {
8957
8972
  return Promise.reject("abstract class");
8958
8973
  }
8974
+ async onEvent(event) {
8975
+ return Promise.resolve();
8976
+ }
8959
8977
  start(done, status) {
8960
8978
  this._responseStream = new Promise(async (resolve, reject) => {
8961
8979
  try {
@@ -9021,50 +9039,126 @@ var UploadJob = class extends AbstractJob {
9021
9039
  super(params, getSession, client, requestLogger);
9022
9040
  this._uploadStream = stream;
9023
9041
  this._mimeType = mimeType;
9042
+ this._needsFullDuplex = mimeType.startsWith("video/");
9043
+ }
9044
+ async onEvent(event) {
9045
+ if (event.type == "prepared") {
9046
+ if (!event.source_id) {
9047
+ return Promise.reject("did not get a prepared sourceId to simulate full duplex");
9048
+ }
9049
+ const session = await this._getSession();
9050
+ if (!session.baseUrl) {
9051
+ return Promise.reject("session.baseUrl must not ne null");
9052
+ }
9053
+ let request;
9054
+ const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=async&sourceId=${event.source_id}`;
9055
+ if (this._params) {
9056
+ this._requestLogger.debug("before POST %s with multipart body because of params", postUrl);
9057
+ const params = JSON.stringify(this._params);
9058
+ const paramBlob = new Blob([params], { type: "application/json" });
9059
+ const formData = new FormData();
9060
+ formData.append("params", paramBlob);
9061
+ formData.append("file", this._uploadStream);
9062
+ const headers = {
9063
+ "Authorization": `Bearer ${session.accessToken}`,
9064
+ "Accept": "application/jsonl"
9065
+ };
9066
+ request = this._client.fetch(postUrl, {
9067
+ headers,
9068
+ method: "POST",
9069
+ body: formData,
9070
+ signal: this._controller.signal,
9071
+ // @ts-ignore
9072
+ duplex: "half"
9073
+ });
9074
+ } else {
9075
+ this._requestLogger.debug("before POST %s with stream as body", postUrl);
9076
+ const headers = {
9077
+ "Authorization": `Bearer ${session.accessToken}`,
9078
+ "Accept": "application/jsonl",
9079
+ "Content-Type": this._mimeType
9080
+ };
9081
+ request = this._client.fetch(postUrl, {
9082
+ headers,
9083
+ method: "POST",
9084
+ body: this._uploadStream,
9085
+ signal: this._controller.signal,
9086
+ // @ts-ignore
9087
+ duplex: "half"
9088
+ });
9089
+ }
9090
+ request.then(async (value) => {
9091
+ if (value.status != 204) {
9092
+ this._requestLogger.debug("unexpected status %d (%s) for POST %s ", value.status, await value.text(), postUrl);
9093
+ }
9094
+ }).catch((reason) => {
9095
+ this._requestLogger.debug("error %v for POST %s ", reason, postUrl);
9096
+ }).finally(() => {
9097
+ this._requestLogger.debug("after POST %s ", postUrl);
9098
+ });
9099
+ }
9100
+ return Promise.resolve();
9024
9101
  }
9025
9102
  async startJob() {
9026
9103
  const session = await this._getSession();
9027
9104
  if (!session.baseUrl) {
9028
9105
  return Promise.reject("session.baseUrl must not ne null");
9029
9106
  }
9030
- const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync`;
9031
9107
  let response;
9032
- if (this._params) {
9033
- this._requestLogger.debug("before POST %s with multipart body because of params");
9034
- const params = JSON.stringify(this._params);
9035
- const paramBlob = new Blob([params], { type: "application/json" });
9036
- const formData = new FormData();
9037
- formData.append("params", paramBlob);
9038
- formData.append("file", this._uploadStream);
9108
+ if (this._needsFullDuplex) {
9109
+ const prepareUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/prepareSource?timeout=10s`;
9039
9110
  const headers = {
9040
9111
  "Authorization": `Bearer ${session.accessToken}`,
9041
9112
  "Accept": "application/jsonl"
9042
9113
  };
9043
- response = await this._client.fetch(postUrl, {
9114
+ this._requestLogger.debug("before POST %s to prepare full duplex upload", prepareUrl);
9115
+ response = await this._client.fetch(prepareUrl, {
9044
9116
  headers,
9045
9117
  method: "POST",
9046
- body: formData,
9047
9118
  signal: this._controller.signal,
9048
9119
  // @ts-ignore
9049
9120
  duplex: "half"
9050
9121
  });
9051
- this._requestLogger.debug("after POST %s with multipart body because of params");
9122
+ this._requestLogger.debug("after POST %s to prepare full duplex upload", prepareUrl);
9052
9123
  } else {
9053
- this._requestLogger.debug("before POST %s with stream as body");
9054
- const headers = {
9055
- "Authorization": `Bearer ${session.accessToken}`,
9056
- "Accept": "application/jsonl",
9057
- "Content-Type": this._mimeType
9058
- };
9059
- response = await this._client.fetch(postUrl, {
9060
- headers,
9061
- method: "POST",
9062
- body: this._uploadStream,
9063
- signal: this._controller.signal,
9064
- // @ts-ignore
9065
- duplex: "half"
9066
- });
9067
- this._requestLogger.debug("after POST %s with stream as body");
9124
+ const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync`;
9125
+ if (this._params) {
9126
+ this._requestLogger.debug("before POST %s with multipart body because of params", postUrl);
9127
+ const params = JSON.stringify(this._params);
9128
+ const paramBlob = new Blob([params], { type: "application/json" });
9129
+ const formData = new FormData();
9130
+ formData.append("params", paramBlob);
9131
+ formData.append("file", this._uploadStream);
9132
+ const headers = {
9133
+ "Authorization": `Bearer ${session.accessToken}`,
9134
+ "Accept": "application/jsonl"
9135
+ };
9136
+ response = await this._client.fetch(postUrl, {
9137
+ headers,
9138
+ method: "POST",
9139
+ body: formData,
9140
+ signal: this._controller.signal,
9141
+ // @ts-ignore
9142
+ duplex: "half"
9143
+ });
9144
+ this._requestLogger.debug("after POST %s with multipart body because of params", postUrl);
9145
+ } else {
9146
+ this._requestLogger.debug("before POST %s with stream as body", postUrl);
9147
+ const headers = {
9148
+ "Authorization": `Bearer ${session.accessToken}`,
9149
+ "Accept": "application/jsonl",
9150
+ "Content-Type": this._mimeType
9151
+ };
9152
+ response = await this._client.fetch(postUrl, {
9153
+ headers,
9154
+ method: "POST",
9155
+ body: this._uploadStream,
9156
+ signal: this._controller.signal,
9157
+ // @ts-ignore
9158
+ duplex: "half"
9159
+ });
9160
+ this._requestLogger.debug("after POST %s with stream as body", postUrl);
9161
+ }
9068
9162
  }
9069
9163
  return response;
9070
9164
  }
@@ -9607,18 +9701,39 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9607
9701
  throw new DOMException("resolving a path to a file is not supported in browser");
9608
9702
  };
9609
9703
  } else {
9704
+ let iteratorToStream = function(iterator) {
9705
+ return new ReadableStream({
9706
+ async pull(controller) {
9707
+ const { value, done } = await iterator.next();
9708
+ if (done) {
9709
+ controller.close();
9710
+ } else {
9711
+ controller.enqueue(new Uint8Array(value));
9712
+ }
9713
+ }
9714
+ });
9715
+ };
9716
+ iteratorToStream2 = iteratorToStream;
9717
+ async function* nodeStreamToIterator(stream) {
9718
+ for await (const chunk of stream) {
9719
+ yield chunk;
9720
+ }
9721
+ }
9610
9722
  resolvePath = async (source) => {
9611
9723
  const mime = require_mime_types();
9612
9724
  const filehandle = require("fs/promises");
9613
9725
  const fd = await filehandle.open(source.path, "r");
9614
9726
  const stream = fd.createReadStream();
9727
+ const iterator = nodeStreamToIterator(stream);
9728
+ const webStream = iteratorToStream(iterator);
9615
9729
  const mimeType = mime.lookup(source.path) || "application/octet-stream";
9616
9730
  return {
9617
- stream,
9731
+ stream: webStream,
9618
9732
  mimeType
9619
9733
  };
9620
9734
  };
9621
9735
  }
9736
+ var iteratorToStream2;
9622
9737
 
9623
9738
  // shims/http_client.ts
9624
9739
  var createHttpClient;
@@ -9653,7 +9768,9 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9653
9768
  const undici = require("undici");
9654
9769
  const agent = new undici.Agent({
9655
9770
  keepAliveTimeout: 1e4,
9656
- connections: 5
9771
+ connections: 5,
9772
+ // two parallel streaming requests to the same host seem to deadlock with pipelining > 0
9773
+ pipelining: 0
9657
9774
  });
9658
9775
  return new HttpClient2(agent);
9659
9776
  };
@@ -11010,8 +11127,8 @@ var DataEndpoint = class extends Endpoint {
11010
11127
  method: "GET"
11011
11128
  });
11012
11129
  }
11013
- async updateDataset(dataset_uuid, data) {
11014
- return this.request(`/datasets/${dataset_uuid}`, {
11130
+ async updateDataset(dataset_uuid, data, start_auto_annotate = true) {
11131
+ return this.request(`/datasets/${dataset_uuid}?start_auto_annotate=${start_auto_annotate}`, {
11015
11132
  method: "PATCH",
11016
11133
  body: JSON.stringify(data)
11017
11134
  });
@@ -11033,6 +11150,19 @@ var DataEndpoint = class extends Endpoint {
11033
11150
  method: "POST"
11034
11151
  });
11035
11152
  }
11153
+ async analyzeDatasetVersion(dataset_uuid, dataset_version) {
11154
+ const versionQuery = dataset_version ? `&dataset_version=${dataset_version}` : "";
11155
+ return this.request(`/datasets/${dataset_uuid}/analyze?${versionQuery}`, {
11156
+ method: "POST"
11157
+ });
11158
+ }
11159
+ async autoAnnotateDatasetVersion(dataset_uuid, dataset_version, max_assets) {
11160
+ const versionQuery = dataset_version ? `&dataset_version=${dataset_version}` : "";
11161
+ const maxAssetsQuery = max_assets ? `&dataset_version=${max_assets}` : "";
11162
+ return this.request(`/datasets/${dataset_uuid}/auto_annotate?${versionQuery}${maxAssetsQuery}`, {
11163
+ method: "POST"
11164
+ });
11165
+ }
11036
11166
  async deleteDatasetVersion(dataset_uuid, dataset_version) {
11037
11167
  return this.request(`/datasets/${dataset_uuid}/delete?dataset_version=${dataset_version}`, {
11038
11168
  method: "POST"
@@ -11143,8 +11273,8 @@ var DataEndpoint = class extends Endpoint {
11143
11273
  method: "GET"
11144
11274
  });
11145
11275
  }
11146
- async createModel(dataset_uuid, dataset_version, data) {
11147
- return this.request(`/models?dataset_uuid=${dataset_uuid}&dataset_version=${dataset_version}`, {
11276
+ async createModel(dataset_uuid, dataset_version, data, start_training = true) {
11277
+ return this.request(`/models?dataset_uuid=${dataset_uuid}&dataset_version=${dataset_version}&start_training=${start_training}`, {
11148
11278
  method: "POST",
11149
11279
  body: JSON.stringify(data)
11150
11280
  });
@@ -11170,6 +11300,11 @@ var DataEndpoint = class extends Endpoint {
11170
11300
  method: "DELETE"
11171
11301
  });
11172
11302
  }
11303
+ async trainModel(model_uuid) {
11304
+ return this.request(`/models/${model_uuid}/train`, {
11305
+ method: "POST"
11306
+ });
11307
+ }
11173
11308
  async publishModel(model_uuid) {
11174
11309
  return this.request(`/models/${model_uuid}/publish`, {
11175
11310
  method: "POST"
@@ -11377,7 +11512,7 @@ var EyePop;
11377
11512
  }
11378
11513
  if (typeof opts.auth.oAuth2 != "undefined") {
11379
11514
  if (typeof opts.auth.oAuth2 === "boolean") {
11380
- if (opts.eyepopUrl.startsWith("https://staging-api.eyepop.ai")) {
11515
+ if (opts.eyepopUrl.startsWith("https://web-api.staging.eyepop.xyz")) {
11381
11516
  opts.auth = {
11382
11517
  oAuth2: {
11383
11518
  domain: "dev-eyepop.us.auth0.com",