@eyepop.ai/eyepop 1.12.1 → 1.13.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.
@@ -280,19 +280,27 @@ interface LiveMedia {
280
280
  stream(): Promise<MediaStream>;
281
281
  close(): Promise<void>;
282
282
  }
283
+ declare enum VideoMode {
284
+ stream = "stream",
285
+ buffer = "buffer"
286
+ }
283
287
  interface IngressEvent {
284
288
  readonly ingressId: string;
285
289
  readonly event: 'stream-ready' | 'stream-ready';
286
290
  }
287
291
  interface FileSource {
288
292
  readonly file: File;
293
+ readonly videoMode?: VideoMode;
289
294
  }
290
295
  interface StreamSource {
291
296
  readonly stream: ReadableStream<Uint8Array> | Blob | BufferSource;
292
297
  readonly mimeType: string;
298
+ readonly videoMode?: VideoMode;
293
299
  }
294
300
  interface PathSource {
295
301
  readonly path: string;
302
+ readonly mimeType?: string;
303
+ readonly videoMode?: VideoMode;
296
304
  }
297
305
  interface LiveSource {
298
306
  readonly ingressId: string;
@@ -830,8 +838,9 @@ declare class UploadJob extends AbstractJob {
830
838
  private readonly _uploadStream;
831
839
  private readonly _mimeType;
832
840
  private readonly _needsFullDuplex;
841
+ private readonly _videoMode;
833
842
  get [Symbol.toStringTag](): string;
834
- constructor(stream: ReadableStream<Uint8Array> | Blob | BufferSource, mimeType: string, params: SourceParams | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
843
+ constructor(stream: ReadableStream<Uint8Array> | Blob | BufferSource, mimeType: string, videoMode: VideoMode | undefined, params: SourceParams | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
835
844
  protected onEvent(event: StreamEvent): Promise<void>;
836
845
  protected startJob(): Promise<Response>;
837
846
  }
@@ -911,4 +920,4 @@ declare namespace EyePop {
911
920
  function dataEndpoint(opts?: DataOptions): DataEndpoint;
912
921
  }
913
922
 
914
- 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 Contour, type ContourFinderComponent, ContourType, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetParent, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, Endpoint, EndpointState, ExportedBy, EyePop, type FileSource, type ForwardComponent, ForwardOperatorType, type InferenceComponent, InferenceType, type IngressEvent, 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 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 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 };
923
+ 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 Contour, type ContourFinderComponent, ContourType, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetParent, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, Endpoint, EndpointState, ExportedBy, EyePop, type FileSource, type ForwardComponent, ForwardOperatorType, type InferenceComponent, InferenceType, type IngressEvent, 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 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 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, VideoMode, WebrtcBase, WebrtcWhep, WebrtcWhip, WorkerEndpoint, type WorkerOptions, type WorkerSession, EyePop as default };
@@ -280,19 +280,27 @@ interface LiveMedia {
280
280
  stream(): Promise<MediaStream>;
281
281
  close(): Promise<void>;
282
282
  }
283
+ declare enum VideoMode {
284
+ stream = "stream",
285
+ buffer = "buffer"
286
+ }
283
287
  interface IngressEvent {
284
288
  readonly ingressId: string;
285
289
  readonly event: 'stream-ready' | 'stream-ready';
286
290
  }
287
291
  interface FileSource {
288
292
  readonly file: File;
293
+ readonly videoMode?: VideoMode;
289
294
  }
290
295
  interface StreamSource {
291
296
  readonly stream: ReadableStream<Uint8Array> | Blob | BufferSource;
292
297
  readonly mimeType: string;
298
+ readonly videoMode?: VideoMode;
293
299
  }
294
300
  interface PathSource {
295
301
  readonly path: string;
302
+ readonly mimeType?: string;
303
+ readonly videoMode?: VideoMode;
296
304
  }
297
305
  interface LiveSource {
298
306
  readonly ingressId: string;
@@ -830,8 +838,9 @@ declare class UploadJob extends AbstractJob {
830
838
  private readonly _uploadStream;
831
839
  private readonly _mimeType;
832
840
  private readonly _needsFullDuplex;
841
+ private readonly _videoMode;
833
842
  get [Symbol.toStringTag](): string;
834
- constructor(stream: ReadableStream<Uint8Array> | Blob | BufferSource, mimeType: string, params: SourceParams | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
843
+ constructor(stream: ReadableStream<Uint8Array> | Blob | BufferSource, mimeType: string, videoMode: VideoMode | undefined, params: SourceParams | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
835
844
  protected onEvent(event: StreamEvent): Promise<void>;
836
845
  protected startJob(): Promise<Response>;
837
846
  }
@@ -911,4 +920,4 @@ declare namespace EyePop {
911
920
  function dataEndpoint(opts?: DataOptions): DataEndpoint;
912
921
  }
913
922
 
914
- 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 Contour, type ContourFinderComponent, ContourType, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetParent, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, Endpoint, EndpointState, ExportedBy, EyePop, type FileSource, type ForwardComponent, ForwardOperatorType, type InferenceComponent, InferenceType, type IngressEvent, 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 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 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 };
923
+ 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 Contour, type ContourFinderComponent, ContourType, DataEndpoint, type DataOptions, type DataSession, type Dataset, type DatasetCreate, type DatasetHeroAssetUpdate, type DatasetParent, type DatasetUpdate, type DatasetVersion, type DatasetVersionAssetStats, Endpoint, EndpointState, ExportedBy, EyePop, type FileSource, type ForwardComponent, ForwardOperatorType, type InferenceComponent, InferenceType, type IngressEvent, 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 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 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, VideoMode, WebrtcBase, WebrtcWhep, WebrtcWhip, WorkerEndpoint, type WorkerOptions, type WorkerSession, EyePop as default };
@@ -8686,6 +8686,7 @@ __export(index_exports, {
8686
8686
  TransientPopId: () => TransientPopId,
8687
8687
  UploadJob: () => UploadJob,
8688
8688
  UserReview: () => UserReview,
8689
+ VideoMode: () => VideoMode,
8689
8690
  WebrtcBase: () => WebrtcBase,
8690
8691
  WebrtcWhep: () => WebrtcWhep,
8691
8692
  WebrtcWhip: () => WebrtcWhip,
@@ -8965,10 +8966,11 @@ var UploadJob = class extends AbstractJob {
8965
8966
  get [Symbol.toStringTag]() {
8966
8967
  return "uploadJob";
8967
8968
  }
8968
- constructor(stream, mimeType, params, getSession, client, requestLogger) {
8969
+ constructor(stream, mimeType, videoMode, params, getSession, client, requestLogger) {
8969
8970
  super(params, getSession, client, requestLogger);
8970
8971
  this._uploadStream = stream;
8971
8972
  this._mimeType = mimeType;
8973
+ this._videoMode = videoMode;
8972
8974
  this._needsFullDuplex = !client.isFullDuplex() && mimeType.startsWith("video/");
8973
8975
  }
8974
8976
  async onEvent(event) {
@@ -8981,7 +8983,8 @@ var UploadJob = class extends AbstractJob {
8981
8983
  return Promise.reject("session.baseUrl must not ne null");
8982
8984
  }
8983
8985
  let request;
8984
- const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=async&sourceId=${event.source_id}`;
8986
+ const videoModeQuery = this._videoMode ? `&videoMode=${this._videoMode}` : "";
8987
+ const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=async&sourceId=${event.source_id}${videoModeQuery}`;
8985
8988
  if (this._params) {
8986
8989
  this._requestLogger.debug("before POST %s with multipart body because of params", postUrl);
8987
8990
  const params = JSON.stringify(this._params);
@@ -9052,7 +9055,8 @@ var UploadJob = class extends AbstractJob {
9052
9055
  });
9053
9056
  this._requestLogger.debug("after POST {} to prepare full duplex upload {} {}", prepareUrl, response.status, response.statusText);
9054
9057
  } else {
9055
- const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync`;
9058
+ const videoModeQuery = this._videoMode ? `&videoMode=${this._videoMode}` : "";
9059
+ const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync${videoModeQuery}`;
9056
9060
  if (this._params) {
9057
9061
  this._requestLogger.debug("before POST {} with multipart body because of params", postUrl);
9058
9062
  const params = JSON.stringify(this._params);
@@ -9594,6 +9598,15 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9594
9598
  resolvePath = async (source) => {
9595
9599
  throw new DOMException("resolving a path to a file is not supported in browser");
9596
9600
  };
9601
+ } else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
9602
+ resolvePath = async (source) => {
9603
+ const response = await fetch(`file://${source.path}`);
9604
+ const blob = await response.blob();
9605
+ return {
9606
+ stream: blob,
9607
+ mimeType: source.mimeType || "image/*"
9608
+ };
9609
+ };
9597
9610
  } else {
9598
9611
  let iteratorToStream = function(iterator) {
9599
9612
  return new ReadableStream({
@@ -9620,7 +9633,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9620
9633
  const stream = fd.createReadStream();
9621
9634
  const iterator = nodeStreamToIterator(stream);
9622
9635
  const webStream = iteratorToStream(iterator);
9623
- const mimeType = mime.lookup(source.path) || "application/octet-stream";
9636
+ const mimeType = source.mimeType ? source.mimeType : mime.lookup(source.path) || "image/*";
9624
9637
  return {
9625
9638
  stream: webStream,
9626
9639
  mimeType
@@ -10393,6 +10406,7 @@ var WorkerEndpoint = class extends Endpoint {
10393
10406
  const job = new UploadJob(
10394
10407
  source.file.stream(),
10395
10408
  source.file.type,
10409
+ source.videoMode,
10396
10410
  params,
10397
10411
  async () => {
10398
10412
  return this.session();
@@ -10423,6 +10437,7 @@ var WorkerEndpoint = class extends Endpoint {
10423
10437
  const job = new UploadJob(
10424
10438
  source.stream,
10425
10439
  source.mimeType,
10440
+ source.videoMode,
10426
10441
  params,
10427
10442
  async () => {
10428
10443
  return this.session();
@@ -10454,6 +10469,7 @@ var WorkerEndpoint = class extends Endpoint {
10454
10469
  const job = new UploadJob(
10455
10470
  streamSource.stream,
10456
10471
  streamSource.mimeType,
10472
+ source.videoMode,
10457
10473
  params,
10458
10474
  async () => {
10459
10475
  return this.session();
@@ -10475,6 +10491,11 @@ var WorkerEndpoint = class extends Endpoint {
10475
10491
  }
10476
10492
  }
10477
10493
  async loadFrom(source, params) {
10494
+ if (source.url.startsWith("file://")) {
10495
+ return await this.uploadPath({
10496
+ path: source.url.substring("file://".length)
10497
+ }, params);
10498
+ }
10478
10499
  if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
10479
10500
  throw new Error("endpoint not connected, use connect() before loadFrom()");
10480
10501
  }
@@ -11563,6 +11584,11 @@ var DataEndpoint = class extends Endpoint {
11563
11584
  };
11564
11585
 
11565
11586
  // worker/worker_types.ts
11587
+ var VideoMode = /* @__PURE__ */ ((VideoMode2) => {
11588
+ VideoMode2["stream"] = "stream";
11589
+ VideoMode2["buffer"] = "buffer";
11590
+ return VideoMode2;
11591
+ })(VideoMode || {});
11566
11592
  var ModelFormat = /* @__PURE__ */ ((ModelFormat2) => {
11567
11593
  ModelFormat2["TensorFlowLite"] = "TensorFlowLite";
11568
11594
  ModelFormat2["TensorFlowGraphDef"] = "TensorFlowGraphDef";
@@ -11763,6 +11789,7 @@ var index_default = EyePop;
11763
11789
  TransientPopId,
11764
11790
  UploadJob,
11765
11791
  UserReview,
11792
+ VideoMode,
11766
11793
  WebrtcBase,
11767
11794
  WebrtcWhep,
11768
11795
  WebrtcWhip,