@eyepop.ai/eyepop 1.11.5 → 1.11.7

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.
@@ -8925,8 +8925,9 @@ var UploadJob = class extends AbstractJob {
8925
8925
  const params = JSON.stringify(this._params);
8926
8926
  const paramBlob = new Blob([params], { type: "application/json" });
8927
8927
  const formData = new FormData();
8928
+ const fileBlob = await new Response(this._uploadStream).blob();
8928
8929
  formData.append("params", paramBlob);
8929
- formData.append("file", this._uploadStream);
8930
+ formData.append("file", fileBlob);
8930
8931
  const headers = {
8931
8932
  ...session.authenticationHeaders(),
8932
8933
  Accept: "application/jsonl"
@@ -8995,8 +8996,9 @@ var UploadJob = class extends AbstractJob {
8995
8996
  const params = JSON.stringify(this._params);
8996
8997
  const paramBlob = new Blob([params], { type: "application/json" });
8997
8998
  const formData = new FormData();
8999
+ const fileBlob = await new Response(this._uploadStream).blob();
8998
9000
  formData.append("params", paramBlob);
8999
- formData.append("file", this._uploadStream);
9001
+ formData.append("file", fileBlob);
9000
9002
  const headers = {
9001
9003
  ...session.authenticationHeaders(),
9002
9004
  Accept: "application/jsonl"
@@ -9130,6 +9132,21 @@ var WebrtcBase = class _WebrtcBase {
9130
9132
  ingressId() {
9131
9133
  return this._ingressId;
9132
9134
  }
9135
+ gresUrl(session, location = null) {
9136
+ let urlPath;
9137
+ if (location) {
9138
+ urlPath = path.join(this._urlPath, location);
9139
+ } else {
9140
+ urlPath = this._urlPath;
9141
+ }
9142
+ let baseUrl;
9143
+ if (session.baseUrl?.endsWith("/")) {
9144
+ baseUrl = session.baseUrl;
9145
+ } else {
9146
+ baseUrl = session.baseUrl + "/";
9147
+ }
9148
+ return new URL(urlPath, baseUrl);
9149
+ }
9133
9150
  async onLocalOffer(offer) {
9134
9151
  if (!this._pc) {
9135
9152
  throw new Error("onLocalOffer no peer connection");
@@ -9140,7 +9157,7 @@ var WebrtcBase = class _WebrtcBase {
9140
9157
  this._offerData = _WebrtcBase.parseOffer(offer.sdp);
9141
9158
  await this._pc.setLocalDescription(offer);
9142
9159
  const session = await this._getSession();
9143
- const ingressUrl = new URL(this._urlPath, session.baseUrl);
9160
+ const ingressUrl = this.gresUrl(session);
9144
9161
  this._requestLogger.debug("before POST: %s", ingressUrl);
9145
9162
  const headers = {
9146
9163
  ...session.authenticationHeaders(),
@@ -9169,12 +9186,7 @@ var WebrtcBase = class _WebrtcBase {
9169
9186
  }
9170
9187
  let urlPath = void 0;
9171
9188
  const session = await this._getSession();
9172
- if (this._location) {
9173
- urlPath = path.join(this._urlPath, this._location);
9174
- } else {
9175
- urlPath = this._urlPath;
9176
- }
9177
- const ingressUrl = new URL(urlPath, session.baseUrl);
9189
+ const ingressUrl = this.gresUrl(session, this._location);
9178
9190
  this._requestLogger.debug("before PATCH: %s", ingressUrl);
9179
9191
  const headers = {
9180
9192
  ...session.authenticationHeaders(),
@@ -9356,7 +9368,7 @@ var WebrtcWhip = class extends WebrtcBase {
9356
9368
  }
9357
9369
  async start() {
9358
9370
  const session = await this._getSession();
9359
- const ingressUrl = new URL(this._urlPath, session.baseUrl);
9371
+ const ingressUrl = this.gresUrl(session);
9360
9372
  this._requestLogger.debug("before GET: %s", ingressUrl);
9361
9373
  const response = await this._client.fetch(ingressUrl, {
9362
9374
  headers: session.authenticationHeaders(),
@@ -9457,7 +9469,7 @@ var WebrtcWhep = class extends WebrtcBase {
9457
9469
  }
9458
9470
  async start() {
9459
9471
  const session = await this._getSession();
9460
- const egressUrl = new URL(this._urlPath, session.baseUrl);
9472
+ const egressUrl = this.gresUrl(session);
9461
9473
  this._requestLogger.debug("before GET: %s", egressUrl);
9462
9474
  const response = await this._client.fetch(egressUrl, {
9463
9475
  headers: session.authenticationHeaders(),
@@ -9568,7 +9580,6 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9568
9580
  }
9569
9581
  }
9570
9582
  createHttpClient = async () => {
9571
- console.debug("EyePop: creating HttpClient in browser");
9572
9583
  return new BrowserHttpClient();
9573
9584
  };
9574
9585
  } else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
@@ -9584,7 +9595,6 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9584
9595
  }
9585
9596
  }
9586
9597
  createHttpClient = async () => {
9587
- console.debug("EyePop: creating HttpClient in ReactNative");
9588
9598
  return new ReactNativeHttpClient();
9589
9599
  };
9590
9600
  } else {
@@ -9602,7 +9612,6 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9602
9612
  }
9603
9613
  }
9604
9614
  createHttpClient = async () => {
9605
- console.debug("EyePop: creating HttpClient with undici agent in Node");
9606
9615
  const undici = __require("undici");
9607
9616
  const agent = new undici.Agent({
9608
9617
  keepAliveTimeout: 1e4,
@@ -10257,7 +10266,7 @@ var WorkerEndpoint = class extends Endpoint {
10257
10266
  );
10258
10267
  return whep.start();
10259
10268
  }
10260
- async process(source, params = void 0) {
10269
+ async process(source, params) {
10261
10270
  if (source.file !== void 0) {
10262
10271
  return this.uploadFile(source, params);
10263
10272
  } else if (source.stream !== void 0) {
@@ -10311,7 +10320,7 @@ var WorkerEndpoint = class extends Endpoint {
10311
10320
  try {
10312
10321
  this.updateState();
10313
10322
  const job = new UploadJob(
10314
- source.file,
10323
+ source.file.stream(),
10315
10324
  source.file.type,
10316
10325
  params,
10317
10326
  async () => {