@eyepop.ai/eyepop 1.12.0 → 1.12.1

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.
@@ -146,6 +146,7 @@ interface Options {
146
146
  interface HttpClient {
147
147
  fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
148
148
  close(): Promise<void>;
149
+ isFullDuplex(): boolean;
149
150
  }
150
151
 
151
152
  /** Semaphores are initialized with a number of permits that get aquired and released
@@ -287,7 +288,7 @@ interface FileSource {
287
288
  readonly file: File;
288
289
  }
289
290
  interface StreamSource {
290
- readonly stream: ReadableStream<Uint8Array>;
291
+ readonly stream: ReadableStream<Uint8Array> | Blob | BufferSource;
291
292
  readonly mimeType: string;
292
293
  }
293
294
  interface PathSource {
@@ -830,7 +831,7 @@ declare class UploadJob extends AbstractJob {
830
831
  private readonly _mimeType;
831
832
  private readonly _needsFullDuplex;
832
833
  get [Symbol.toStringTag](): string;
833
- constructor(stream: ReadableStream<Uint8Array>, mimeType: string, params: SourceParams | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
834
+ constructor(stream: ReadableStream<Uint8Array> | Blob | BufferSource, mimeType: string, params: SourceParams | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
834
835
  protected onEvent(event: StreamEvent): Promise<void>;
835
836
  protected startJob(): Promise<Response>;
836
837
  }
@@ -146,6 +146,7 @@ interface Options {
146
146
  interface HttpClient {
147
147
  fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
148
148
  close(): Promise<void>;
149
+ isFullDuplex(): boolean;
149
150
  }
150
151
 
151
152
  /** Semaphores are initialized with a number of permits that get aquired and released
@@ -287,7 +288,7 @@ interface FileSource {
287
288
  readonly file: File;
288
289
  }
289
290
  interface StreamSource {
290
- readonly stream: ReadableStream<Uint8Array>;
291
+ readonly stream: ReadableStream<Uint8Array> | Blob | BufferSource;
291
292
  readonly mimeType: string;
292
293
  }
293
294
  interface PathSource {
@@ -830,7 +831,7 @@ declare class UploadJob extends AbstractJob {
830
831
  private readonly _mimeType;
831
832
  private readonly _needsFullDuplex;
832
833
  get [Symbol.toStringTag](): string;
833
- constructor(stream: ReadableStream<Uint8Array>, mimeType: string, params: SourceParams | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
834
+ constructor(stream: ReadableStream<Uint8Array> | Blob | BufferSource, mimeType: string, params: SourceParams | undefined, getSession: () => Promise<WorkerSession>, client: HttpClient, requestLogger: Logger);
834
835
  protected onEvent(event: StreamEvent): Promise<void>;
835
836
  protected startJob(): Promise<Response>;
836
837
  }
@@ -8969,7 +8969,7 @@ var UploadJob = class extends AbstractJob {
8969
8969
  super(params, getSession, client, requestLogger);
8970
8970
  this._uploadStream = stream;
8971
8971
  this._mimeType = mimeType;
8972
- this._needsFullDuplex = mimeType.startsWith("video/");
8972
+ this._needsFullDuplex = !client.isFullDuplex() && mimeType.startsWith("video/");
8973
8973
  }
8974
8974
  async onEvent(event) {
8975
8975
  if (event.type == "prepared") {
@@ -9042,7 +9042,7 @@ var UploadJob = class extends AbstractJob {
9042
9042
  ...session.authenticationHeaders(),
9043
9043
  Accept: "application/jsonl"
9044
9044
  };
9045
- this._requestLogger.debug("before POST %s to prepare full duplex upload", prepareUrl);
9045
+ this._requestLogger.debug("before POST {} to prepare full duplex upload", prepareUrl);
9046
9046
  response = await this._client.fetch(prepareUrl, {
9047
9047
  headers,
9048
9048
  method: "POST",
@@ -9050,11 +9050,11 @@ var UploadJob = class extends AbstractJob {
9050
9050
  // @ts-ignore
9051
9051
  duplex: "half"
9052
9052
  });
9053
- this._requestLogger.debug("after POST %s to prepare full duplex upload", prepareUrl);
9053
+ this._requestLogger.debug("after POST {} to prepare full duplex upload {} {}", prepareUrl, response.status, response.statusText);
9054
9054
  } else {
9055
9055
  const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync`;
9056
9056
  if (this._params) {
9057
- this._requestLogger.debug("before POST %s with multipart body because of params", postUrl);
9057
+ this._requestLogger.debug("before POST {} with multipart body because of params", postUrl);
9058
9058
  const params = JSON.stringify(this._params);
9059
9059
  const paramBlob = new Blob([params], { type: "application/json" });
9060
9060
  const formData = new FormData();
@@ -9640,6 +9640,9 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9640
9640
  }
9641
9641
  async close() {
9642
9642
  }
9643
+ isFullDuplex() {
9644
+ return false;
9645
+ }
9643
9646
  }
9644
9647
  createHttpClient = async () => {
9645
9648
  return new BrowserHttpClient();
@@ -9655,6 +9658,9 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9655
9658
  }
9656
9659
  async close() {
9657
9660
  }
9661
+ isFullDuplex() {
9662
+ return true;
9663
+ }
9658
9664
  }
9659
9665
  createHttpClient = async () => {
9660
9666
  return new ReactNativeHttpClient();
@@ -9672,6 +9678,9 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9672
9678
  async close() {
9673
9679
  return this.agent.close();
9674
9680
  }
9681
+ isFullDuplex() {
9682
+ return false;
9683
+ }
9675
9684
  }
9676
9685
  createHttpClient = async () => {
9677
9686
  const undici = require("undici");