@eyepop.ai/eyepop 1.14.1 → 1.14.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.
@@ -837,6 +837,7 @@ declare class EyepopLineDecoder {
837
837
  decodeText(bytes: Bytes): string;
838
838
  flush(): string[];
839
839
  }
840
+ declare function readableStreamFromString(s: string): ReadableStream<Uint8Array>;
840
841
 
841
842
  declare class AbstractJob implements ResultStream {
842
843
  protected _getSession: () => Promise<WorkerSession>;
@@ -940,4 +941,4 @@ declare namespace EyePop {
940
941
  function dataEndpoint(opts?: DataOptions): DataEndpoint;
941
942
  }
942
943
 
943
- 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, EyepopLineDecoder, 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 };
944
+ 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, EyepopLineDecoder, 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, readableStreamFromString };
@@ -837,6 +837,7 @@ declare class EyepopLineDecoder {
837
837
  decodeText(bytes: Bytes): string;
838
838
  flush(): string[];
839
839
  }
840
+ declare function readableStreamFromString(s: string): ReadableStream<Uint8Array>;
840
841
 
841
842
  declare class AbstractJob implements ResultStream {
842
843
  protected _getSession: () => Promise<WorkerSession>;
@@ -940,4 +941,4 @@ declare namespace EyePop {
940
941
  function dataEndpoint(opts?: DataOptions): DataEndpoint;
941
942
  }
942
943
 
943
- 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, EyepopLineDecoder, 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 };
944
+ 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, EyepopLineDecoder, 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, readableStreamFromString };
@@ -8692,7 +8692,8 @@ __export(index_exports, {
8692
8692
  WebrtcWhep: () => WebrtcWhep,
8693
8693
  WebrtcWhip: () => WebrtcWhip,
8694
8694
  WorkerEndpoint: () => WorkerEndpoint,
8695
- default: () => index_default
8695
+ default: () => index_default,
8696
+ readableStreamFromString: () => readableStreamFromString
8696
8697
  });
8697
8698
  module.exports = __toCommonJS(index_exports);
8698
8699
 
@@ -8881,6 +8882,14 @@ function readableStreamAsyncIterable(stream) {
8881
8882
  }
8882
8883
  };
8883
8884
  }
8885
+ function readableStreamFromString(s) {
8886
+ return new ReadableStream({
8887
+ start(controller) {
8888
+ controller.enqueue(Buffer.from(s));
8889
+ controller.close();
8890
+ }
8891
+ });
8892
+ }
8884
8893
 
8885
8894
  // worker/worker_types.ts
8886
8895
  var VideoMode = /* @__PURE__ */ ((VideoMode2) => {
@@ -8991,12 +9000,18 @@ var AbstractJob = class {
8991
9000
  } else if (response.status != 200) {
8992
9001
  reject(`upload error ${response.status}: ${await response.text()}`);
8993
9002
  break;
8994
- } else if (!response.body) {
8995
- reject("response body is empty");
8996
- break;
8997
- } else {
9003
+ } else if (response.body) {
8998
9004
  resolve(response.body);
8999
9005
  break;
9006
+ } else {
9007
+ const text = await response.text();
9008
+ if (text) {
9009
+ resolve(readableStreamFromString(text));
9010
+ break;
9011
+ } else {
9012
+ reject("response body is empty");
9013
+ break;
9014
+ }
9000
9015
  }
9001
9016
  } catch (error) {
9002
9017
  if (retries--) {
@@ -9666,13 +9681,13 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9666
9681
  throw new DOMException("resolving a path to a file is not supported in browser");
9667
9682
  };
9668
9683
  } else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
9669
- let RNFSName = "react-native-fs";
9670
- let RNFS;
9671
- let RNFSLoadError;
9684
+ let RNFAName = "react-native-file-access";
9685
+ let RNFA;
9686
+ let RNFALoadError;
9672
9687
  try {
9673
- RNFS = require(RNFSName);
9688
+ RNFA = require(RNFAName);
9674
9689
  } catch (e) {
9675
- RNFSLoadError = e;
9690
+ RNFALoadError = e;
9676
9691
  }
9677
9692
  let EFSName = "expo-file-system";
9678
9693
  let EFS;
@@ -9683,19 +9698,21 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9683
9698
  EFSLoadError = e;
9684
9699
  }
9685
9700
  resolvePath = async (source, logger) => {
9686
- if (RNFS?.read !== void 0) {
9687
- logger.debug("Using react-native-fs to read local file");
9701
+ if (RNFA?.FileSystem?.readFileChunk !== void 0) {
9702
+ logger.debug("Using react-native-file-access to read local file");
9688
9703
  const bufferSize = 1024 * 1024;
9689
9704
  let pos = 0;
9705
+ const size = (await RNFA.FileSystem.stat(source.path)).size;
9690
9706
  let eof = false;
9691
9707
  const stream = new ReadableStream({
9692
9708
  async pull(controller) {
9693
9709
  if (eof) {
9694
9710
  return;
9695
9711
  }
9696
- const chunkAsB64 = await RNFS.read(source.path, bufferSize, pos, "base64");
9712
+ const chunkSize = Math.min(bufferSize, size - pos);
9713
+ const chunkAsB64 = await RNFA.FileSystem.readFileChunk(source.path, pos, chunkSize, "base64");
9697
9714
  if (chunkAsB64.length > 0) {
9698
- const chunk = Buffer.from(chunkAsB64, "base64");
9715
+ const chunk = Buffer.from(chunkAsB64, "base64").subarray(0, chunkSize);
9699
9716
  controller.enqueue(chunk);
9700
9717
  pos += chunk.length;
9701
9718
  } else {
@@ -9706,12 +9723,14 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9706
9723
  });
9707
9724
  return {
9708
9725
  stream,
9709
- size: (await RNFS.stat(source.path)).size,
9726
+ size,
9710
9727
  mimeType: source.mimeType || "image/*"
9711
9728
  };
9712
- } else if (EFS?.readAsStringAsync !== void 0) {
9729
+ }
9730
+ if (EFS?.readAsStringAsync !== void 0) {
9713
9731
  logger.debug("Using expo-file-system to read local file");
9714
9732
  const bufferSize = 1024 * 1024;
9733
+ const size = (await EFS.getInfoAsync(`file://${source.path}`)).size;
9715
9734
  let pos = 0;
9716
9735
  let eof = false;
9717
9736
  const stream = new ReadableStream({
@@ -9719,8 +9738,9 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9719
9738
  if (eof) {
9720
9739
  return;
9721
9740
  }
9741
+ const chunkSize = Math.min(bufferSize, size - pos);
9722
9742
  const chunkAsB64 = await EFS.readAsStringAsync(`file://${source.path}`, {
9723
- length: bufferSize,
9743
+ length: chunkSize,
9724
9744
  position: pos,
9725
9745
  encoding: "base64"
9726
9746
  });
@@ -9736,11 +9756,11 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9736
9756
  });
9737
9757
  return {
9738
9758
  stream,
9739
- size: (await EFS.getInfoAsync(`file://${source.path}`)).size,
9759
+ size,
9740
9760
  mimeType: source.mimeType || "image/*"
9741
9761
  };
9742
9762
  }
9743
- return Promise.reject(`Could not load '${RNFSName}' (reason" ${RNFSLoadError}) or '${EFSName}' (reason" ${EFSLoadError}), include either of those packages in your application to enable uploads via PathSource - or provide the stream itself via StreamSource.`);
9763
+ throw new Error(`Could not load '${RNFAName}' (reason" ${RNFALoadError}) or '${EFSName}' (reason" ${EFSLoadError}). Falling back to fetch() which might cause memory issues. Include either of those packages in your application to enable uploads via PathSource - or provide the stream itself via StreamSource.We will try to load file://${source.path} via fetch()`);
9744
9764
  };
9745
9765
  } else {
9746
9766
  let iteratorToStream = function(iterator) {
@@ -10259,7 +10279,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
10259
10279
  this.logger
10260
10280
  );
10261
10281
  } else {
10262
- this.logger.warn(`[${TcpSockets}] Could not load '${TcpSocketsName}' (reason" ${TcpSocketsError}), include this package in your application to enable streamed uploads; without this package local files have to be loaded into memory uploading and this will cause Out-Of-Memory errors for large files.`);
10282
+ this.logger.warn(`[${TcpSockets}] Could not load '${TcpSocketsName}' (reason: ${TcpSocketsError}), include this package in your application to enable streamed uploads; without this package local files have to be loaded into memory uploading and this will cause Out-Of-Memory errors for large files.`);
10263
10283
  try {
10264
10284
  const chunks = [];
10265
10285
  const reader = streamBody.getReader();
@@ -12358,7 +12378,8 @@ var index_default = EyePop;
12358
12378
  WebrtcBase,
12359
12379
  WebrtcWhep,
12360
12380
  WebrtcWhip,
12361
- WorkerEndpoint
12381
+ WorkerEndpoint,
12382
+ readableStreamFromString
12362
12383
  });
12363
12384
  /*! Bundled license information:
12364
12385