@eyepop.ai/eyepop 1.14.3 → 1.15.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.
- package/dist/eyepop.index.d.mts +167 -163
- package/dist/eyepop.index.d.ts +167 -163
- package/dist/eyepop.index.js +79 -679
- package/dist/eyepop.index.js.map +1 -1
- package/dist/eyepop.index.mjs +79 -679
- package/dist/eyepop.index.mjs.map +1 -1
- package/dist/eyepop.min.js +1 -1
- package/package.json +1 -1
package/dist/eyepop.index.js
CHANGED
|
@@ -9062,7 +9062,6 @@ var UploadJob = class extends AbstractJob {
|
|
|
9062
9062
|
const videoModeQuery = this._videoMode ? `&videoMode=${this._videoMode}` : "";
|
|
9063
9063
|
const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=async&sourceId=${event.source_id}${videoModeQuery}`;
|
|
9064
9064
|
if (this._params) {
|
|
9065
|
-
this._requestLogger.debug(`before POST ${postUrl} with multipart body because of params`);
|
|
9066
9065
|
const params = JSON.stringify(this._params);
|
|
9067
9066
|
const paramBlob = new Blob([params], { type: "application/json" });
|
|
9068
9067
|
const formData = new FormData();
|
|
@@ -9079,10 +9078,10 @@ var UploadJob = class extends AbstractJob {
|
|
|
9079
9078
|
body: formData,
|
|
9080
9079
|
signal: this._controller.signal,
|
|
9081
9080
|
// @ts-ignore
|
|
9082
|
-
duplex: "half"
|
|
9081
|
+
duplex: "half",
|
|
9082
|
+
eyepop: { responseStreaming: true }
|
|
9083
9083
|
});
|
|
9084
9084
|
} else {
|
|
9085
|
-
this._requestLogger.debug(`before POST ${postUrl} with stream as body`);
|
|
9086
9085
|
const headers = {
|
|
9087
9086
|
...session.authenticationHeaders(),
|
|
9088
9087
|
Accept: "application/jsonl",
|
|
@@ -9097,7 +9096,8 @@ var UploadJob = class extends AbstractJob {
|
|
|
9097
9096
|
body: this._uploadStream,
|
|
9098
9097
|
signal: this._controller.signal,
|
|
9099
9098
|
// @ts-ignore
|
|
9100
|
-
duplex: "half"
|
|
9099
|
+
duplex: "half",
|
|
9100
|
+
eyepop: { responseStreaming: true }
|
|
9101
9101
|
});
|
|
9102
9102
|
}
|
|
9103
9103
|
request.then(async (value) => {
|
|
@@ -9106,8 +9106,6 @@ var UploadJob = class extends AbstractJob {
|
|
|
9106
9106
|
}
|
|
9107
9107
|
}).catch((reason) => {
|
|
9108
9108
|
this._requestLogger.debug(`error ${reason} for POST ${postUrl}`);
|
|
9109
|
-
}).finally(() => {
|
|
9110
|
-
this._requestLogger.debug(`after POST ${postUrl}`);
|
|
9111
9109
|
});
|
|
9112
9110
|
}
|
|
9113
9111
|
return Promise.resolve();
|
|
@@ -9124,20 +9122,18 @@ var UploadJob = class extends AbstractJob {
|
|
|
9124
9122
|
...session.authenticationHeaders(),
|
|
9125
9123
|
Accept: "application/jsonl"
|
|
9126
9124
|
};
|
|
9127
|
-
this._requestLogger.debug(`before POST ${prepareUrl} to prepare full duplex upload`);
|
|
9128
9125
|
response = await this._client.fetch(prepareUrl, {
|
|
9129
9126
|
headers,
|
|
9130
9127
|
method: "POST",
|
|
9131
9128
|
signal: this._controller.signal,
|
|
9132
9129
|
// @ts-ignore
|
|
9133
|
-
duplex: "half"
|
|
9130
|
+
duplex: "half",
|
|
9131
|
+
eyepop: { responseStreaming: true }
|
|
9134
9132
|
});
|
|
9135
|
-
this._requestLogger.debug(`after POST ${prepareUrl} to prepare full duplex upload ${response.status} ${response.statusText}`);
|
|
9136
9133
|
} else {
|
|
9137
9134
|
const videoModeQuery = this._videoMode ? `&videoMode=${this._videoMode}` : "";
|
|
9138
9135
|
const postUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync${videoModeQuery}`;
|
|
9139
9136
|
if (this._params) {
|
|
9140
|
-
this._requestLogger.debug(`before POST ${postUrl} with multipart body because of params`);
|
|
9141
9137
|
const params = JSON.stringify(this._params);
|
|
9142
9138
|
const paramBlob = new Blob([params], { type: "application/json" });
|
|
9143
9139
|
const formData = new FormData();
|
|
@@ -9154,11 +9150,10 @@ var UploadJob = class extends AbstractJob {
|
|
|
9154
9150
|
body: formData,
|
|
9155
9151
|
signal: this._controller.signal,
|
|
9156
9152
|
// @ts-ignore
|
|
9157
|
-
duplex: "half"
|
|
9153
|
+
duplex: "half",
|
|
9154
|
+
eyepop: { responseStreaming: true }
|
|
9158
9155
|
});
|
|
9159
|
-
this._requestLogger.debug(`after POST ${postUrl} with multipart body because of params)`);
|
|
9160
9156
|
} else {
|
|
9161
|
-
this._requestLogger.debug(`before POST ${postUrl} with stream as body`);
|
|
9162
9157
|
const headers = {
|
|
9163
9158
|
...session.authenticationHeaders(),
|
|
9164
9159
|
Accept: "application/jsonl",
|
|
@@ -9175,7 +9170,6 @@ var UploadJob = class extends AbstractJob {
|
|
|
9175
9170
|
// @ts-ignore
|
|
9176
9171
|
duplex: "half"
|
|
9177
9172
|
});
|
|
9178
|
-
this._requestLogger.debug(`after POST ${postUrl} with stream as body`);
|
|
9179
9173
|
}
|
|
9180
9174
|
}
|
|
9181
9175
|
return response;
|
|
@@ -9205,15 +9199,14 @@ var LoadFromJob = class extends AbstractJob {
|
|
|
9205
9199
|
"Content-Type": "application/json"
|
|
9206
9200
|
};
|
|
9207
9201
|
const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=queue&processing=sync`;
|
|
9208
|
-
this.
|
|
9209
|
-
const response = await this._client.fetch(patchUrl, {
|
|
9202
|
+
return await this._client.fetch(patchUrl, {
|
|
9210
9203
|
headers,
|
|
9211
9204
|
method: "PATCH",
|
|
9212
9205
|
body: JSON.stringify(body),
|
|
9213
|
-
signal: this._controller.signal
|
|
9206
|
+
signal: this._controller.signal,
|
|
9207
|
+
// @ts-ignore
|
|
9208
|
+
eyepop: { responseStreaming: true }
|
|
9214
9209
|
});
|
|
9215
|
-
this._requestLogger.debug("after PATCH %s with url %s as source", patchUrl, this._location);
|
|
9216
|
-
return response;
|
|
9217
9210
|
}
|
|
9218
9211
|
};
|
|
9219
9212
|
var LoadLiveIngressJob = class extends AbstractJob {
|
|
@@ -9240,15 +9233,14 @@ var LoadLiveIngressJob = class extends AbstractJob {
|
|
|
9240
9233
|
"Content-Type": "application/json"
|
|
9241
9234
|
};
|
|
9242
9235
|
const patchUrl = `${session.baseUrl.replace(/\/+$/, "")}/pipelines/${session.pipelineId}/source?mode=preempt&processing=sync`;
|
|
9243
|
-
this.
|
|
9244
|
-
const response = await this._client.fetch(patchUrl, {
|
|
9236
|
+
return await this._client.fetch(patchUrl, {
|
|
9245
9237
|
headers,
|
|
9246
9238
|
method: "PATCH",
|
|
9247
9239
|
body: JSON.stringify(body),
|
|
9248
|
-
signal: this._controller.signal
|
|
9240
|
+
signal: this._controller.signal,
|
|
9241
|
+
// @ts-ignore
|
|
9242
|
+
eyepop: { responseStreaming: true }
|
|
9249
9243
|
});
|
|
9250
|
-
this._requestLogger.debug("after PATCH %s with url %s as source", patchUrl, this._ingressId);
|
|
9251
|
-
return response;
|
|
9252
9244
|
}
|
|
9253
9245
|
};
|
|
9254
9246
|
|
|
@@ -9306,7 +9298,6 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9306
9298
|
await this._pc.setLocalDescription(offer);
|
|
9307
9299
|
const session = await this._getSession();
|
|
9308
9300
|
const ingressUrl = this.gresUrl(session);
|
|
9309
|
-
this._requestLogger.debug("before POST: %s", ingressUrl);
|
|
9310
9301
|
const headers = {
|
|
9311
9302
|
...session.authenticationHeaders(),
|
|
9312
9303
|
"Content-Type": "application/sdp"
|
|
@@ -9321,12 +9312,10 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9321
9312
|
}
|
|
9322
9313
|
this._eTag = response.headers.get("ETag") ?? "";
|
|
9323
9314
|
this._location = response.headers.get("Location");
|
|
9324
|
-
return this.onRemoteAnswer(
|
|
9325
|
-
|
|
9326
|
-
|
|
9327
|
-
|
|
9328
|
-
})
|
|
9329
|
-
);
|
|
9315
|
+
return await this.onRemoteAnswer(new RTCSessionDescription({
|
|
9316
|
+
type: "answer",
|
|
9317
|
+
sdp: await response.text()
|
|
9318
|
+
}));
|
|
9330
9319
|
}
|
|
9331
9320
|
async sendLocalCandidates(candidates) {
|
|
9332
9321
|
if (!this._offerData) {
|
|
@@ -9335,7 +9324,6 @@ var WebrtcBase = class _WebrtcBase {
|
|
|
9335
9324
|
let urlPath = void 0;
|
|
9336
9325
|
const session = await this._getSession();
|
|
9337
9326
|
const ingressUrl = this.gresUrl(session, this._location);
|
|
9338
|
-
this._requestLogger.debug("before PATCH: %s", ingressUrl);
|
|
9339
9327
|
const headers = {
|
|
9340
9328
|
...session.authenticationHeaders(),
|
|
9341
9329
|
"Content-Type": "application/trickle-ice-sdpfrag",
|
|
@@ -9517,7 +9505,6 @@ var WebrtcWhip = class extends WebrtcBase {
|
|
|
9517
9505
|
async start() {
|
|
9518
9506
|
const session = await this._getSession();
|
|
9519
9507
|
const ingressUrl = this.gresUrl(session);
|
|
9520
|
-
this._requestLogger.debug("before GET: %s", ingressUrl);
|
|
9521
9508
|
const response = await this._client.fetch(ingressUrl, {
|
|
9522
9509
|
headers: session.authenticationHeaders(),
|
|
9523
9510
|
method: "GET"
|
|
@@ -9525,7 +9512,7 @@ var WebrtcWhip = class extends WebrtcBase {
|
|
|
9525
9512
|
if (response.status >= 300) {
|
|
9526
9513
|
return Promise.reject(`unknown status code for GET '${ingressUrl}': ${response.status} (${response.statusText})`);
|
|
9527
9514
|
}
|
|
9528
|
-
return this.onIceServers(response);
|
|
9515
|
+
return await this.onIceServers(response);
|
|
9529
9516
|
}
|
|
9530
9517
|
async stream() {
|
|
9531
9518
|
if (this._stream) {
|
|
@@ -9618,7 +9605,6 @@ var WebrtcWhep = class extends WebrtcBase {
|
|
|
9618
9605
|
async start() {
|
|
9619
9606
|
const session = await this._getSession();
|
|
9620
9607
|
const egressUrl = this.gresUrl(session);
|
|
9621
|
-
this._requestLogger.debug("before GET: %s", egressUrl);
|
|
9622
9608
|
const response = await this._client.fetch(egressUrl, {
|
|
9623
9609
|
headers: session.authenticationHeaders(),
|
|
9624
9610
|
method: "GET"
|
|
@@ -9650,10 +9636,10 @@ var WebrtcWhep = class extends WebrtcBase {
|
|
|
9650
9636
|
pc.addTransceiver("video", { direction });
|
|
9651
9637
|
pc.onicecandidate = (evt) => this.onLocalCandidate(evt);
|
|
9652
9638
|
this._pc = pc;
|
|
9653
|
-
this._requestLogger.info(
|
|
9639
|
+
this._requestLogger.info(`onIceServers ${pc.iceConnectionState}`);
|
|
9654
9640
|
return new Promise(async (resolve, reject) => {
|
|
9655
9641
|
pc.ontrack = (evt) => {
|
|
9656
|
-
this._requestLogger.debug(
|
|
9642
|
+
this._requestLogger.debug(`new track: ${evt.track.kind}`);
|
|
9657
9643
|
this._stream = evt.streams[0];
|
|
9658
9644
|
resolve(this);
|
|
9659
9645
|
};
|
|
@@ -9661,11 +9647,11 @@ var WebrtcWhep = class extends WebrtcBase {
|
|
|
9661
9647
|
switch (pc.iceConnectionState) {
|
|
9662
9648
|
case "failed":
|
|
9663
9649
|
case "disconnected":
|
|
9664
|
-
this._requestLogger.debug("disconnected");
|
|
9650
|
+
this._requestLogger.debug("oniceconnectionstatechange disconnected");
|
|
9665
9651
|
reject(`peer connection: ${pc.iceConnectionState}`);
|
|
9666
9652
|
break;
|
|
9667
9653
|
case "connected":
|
|
9668
|
-
this._requestLogger.debug("connected");
|
|
9654
|
+
this._requestLogger.debug("oniceconnectionstatechange connected");
|
|
9669
9655
|
break;
|
|
9670
9656
|
}
|
|
9671
9657
|
};
|
|
@@ -9680,88 +9666,6 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9680
9666
|
resolvePath = async (source, logger) => {
|
|
9681
9667
|
throw new DOMException("resolving a path to a file is not supported in browser");
|
|
9682
9668
|
};
|
|
9683
|
-
} else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
9684
|
-
let RNFAName = "react-native-file-access";
|
|
9685
|
-
let RNFA;
|
|
9686
|
-
let RNFALoadError;
|
|
9687
|
-
try {
|
|
9688
|
-
RNFA = require(RNFAName);
|
|
9689
|
-
} catch (e) {
|
|
9690
|
-
RNFALoadError = e;
|
|
9691
|
-
}
|
|
9692
|
-
let EFSName = "expo-file-system";
|
|
9693
|
-
let EFS;
|
|
9694
|
-
let EFSLoadError;
|
|
9695
|
-
try {
|
|
9696
|
-
EFS = require(EFSName);
|
|
9697
|
-
} catch (e) {
|
|
9698
|
-
EFSLoadError = e;
|
|
9699
|
-
}
|
|
9700
|
-
resolvePath = async (source, logger) => {
|
|
9701
|
-
if (RNFA?.FileSystem?.readFileChunk !== void 0) {
|
|
9702
|
-
logger.debug("Using react-native-file-access to read local file");
|
|
9703
|
-
const bufferSize = 1024 * 1024;
|
|
9704
|
-
let pos = 0;
|
|
9705
|
-
const size = (await RNFA.FileSystem.stat(source.path)).size;
|
|
9706
|
-
let eof = false;
|
|
9707
|
-
const stream = new ReadableStream({
|
|
9708
|
-
async pull(controller) {
|
|
9709
|
-
if (eof) {
|
|
9710
|
-
return;
|
|
9711
|
-
}
|
|
9712
|
-
const chunkSize = Math.min(bufferSize, size - pos);
|
|
9713
|
-
const chunkAsB64 = await RNFA.FileSystem.readFileChunk(source.path, pos, chunkSize, "base64");
|
|
9714
|
-
if (chunkAsB64.length > 0) {
|
|
9715
|
-
const chunk = Buffer.from(chunkAsB64, "base64").subarray(0, chunkSize);
|
|
9716
|
-
controller.enqueue(chunk);
|
|
9717
|
-
pos += chunk.length;
|
|
9718
|
-
} else {
|
|
9719
|
-
eof = true;
|
|
9720
|
-
controller.close();
|
|
9721
|
-
}
|
|
9722
|
-
}
|
|
9723
|
-
});
|
|
9724
|
-
return {
|
|
9725
|
-
stream,
|
|
9726
|
-
size,
|
|
9727
|
-
mimeType: source.mimeType || "image/*"
|
|
9728
|
-
};
|
|
9729
|
-
}
|
|
9730
|
-
if (EFS?.readAsStringAsync !== void 0) {
|
|
9731
|
-
logger.debug("Using expo-file-system to read local file");
|
|
9732
|
-
const bufferSize = 1024 * 1024;
|
|
9733
|
-
const size = (await EFS.getInfoAsync(`file://${source.path}`)).size;
|
|
9734
|
-
let pos = 0;
|
|
9735
|
-
let eof = false;
|
|
9736
|
-
const stream = new ReadableStream({
|
|
9737
|
-
async pull(controller) {
|
|
9738
|
-
if (eof) {
|
|
9739
|
-
return;
|
|
9740
|
-
}
|
|
9741
|
-
const chunkSize = Math.min(bufferSize, size - pos);
|
|
9742
|
-
const chunkAsB64 = await EFS.readAsStringAsync(`file://${source.path}`, {
|
|
9743
|
-
length: chunkSize,
|
|
9744
|
-
position: pos,
|
|
9745
|
-
encoding: "base64"
|
|
9746
|
-
});
|
|
9747
|
-
if (chunkAsB64) {
|
|
9748
|
-
const chunk = Buffer.from(chunkAsB64, "base64");
|
|
9749
|
-
controller.enqueue(chunk);
|
|
9750
|
-
pos += chunk.length;
|
|
9751
|
-
} else {
|
|
9752
|
-
eof = true;
|
|
9753
|
-
controller.close();
|
|
9754
|
-
}
|
|
9755
|
-
}
|
|
9756
|
-
});
|
|
9757
|
-
return {
|
|
9758
|
-
stream,
|
|
9759
|
-
size,
|
|
9760
|
-
mimeType: source.mimeType || "image/*"
|
|
9761
|
-
};
|
|
9762
|
-
}
|
|
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()`);
|
|
9764
|
-
};
|
|
9765
9669
|
} else {
|
|
9766
9670
|
let iteratorToStream = function(iterator) {
|
|
9767
9671
|
return new ReadableStream({
|
|
@@ -9797,534 +9701,51 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9797
9701
|
}
|
|
9798
9702
|
var iteratorToStream2;
|
|
9799
9703
|
|
|
9800
|
-
// shims/rn_http_header_parser.ts
|
|
9801
|
-
var startLine = /^[A-Z_]+(\/\d\.\d)? /;
|
|
9802
|
-
var requestLine = /^([A-Z_]+) (.+) [A-Z]+\/(\d)\.(\d)$/;
|
|
9803
|
-
var statusLine = /^[A-Z]+\/(\d)\.(\d) (\d{3}) (.*)$/;
|
|
9804
|
-
function parseHttpHeader(lines, onlyHeaders) {
|
|
9805
|
-
var line = lines[0];
|
|
9806
|
-
var match;
|
|
9807
|
-
if (onlyHeaders && startLine.test(line)) {
|
|
9808
|
-
return parseHeaders(lines);
|
|
9809
|
-
} else if ((match = line.match(requestLine)) !== null) {
|
|
9810
|
-
return {
|
|
9811
|
-
method: match[1],
|
|
9812
|
-
url: match[2],
|
|
9813
|
-
version: { major: parseInt(match[3], 10), minor: parseInt(match[4], 10) },
|
|
9814
|
-
headers: parseHeaders(lines)
|
|
9815
|
-
};
|
|
9816
|
-
} else if ((match = line.match(statusLine)) !== null) {
|
|
9817
|
-
return {
|
|
9818
|
-
version: { major: parseInt(match[1], 10), minor: parseInt(match[2], 10) },
|
|
9819
|
-
statusCode: parseInt(match[3], 10),
|
|
9820
|
-
statusMessage: match[4],
|
|
9821
|
-
headers: parseHeaders(lines)
|
|
9822
|
-
};
|
|
9823
|
-
} else {
|
|
9824
|
-
return parseHeaders(lines);
|
|
9825
|
-
}
|
|
9826
|
-
}
|
|
9827
|
-
function parseHeaders(lines) {
|
|
9828
|
-
var headers = {};
|
|
9829
|
-
var i = 0;
|
|
9830
|
-
var line = lines[i];
|
|
9831
|
-
var index, name, value;
|
|
9832
|
-
if (startLine.test(line)) {
|
|
9833
|
-
line = line[++i];
|
|
9834
|
-
}
|
|
9835
|
-
while (line) {
|
|
9836
|
-
if (line[0] === " " || line[0] === " ") {
|
|
9837
|
-
value += " " + line.trim();
|
|
9838
|
-
i++;
|
|
9839
|
-
if (i < lines.length) {
|
|
9840
|
-
line = lines[i];
|
|
9841
|
-
} else {
|
|
9842
|
-
line = "";
|
|
9843
|
-
}
|
|
9844
|
-
continue;
|
|
9845
|
-
}
|
|
9846
|
-
if (name && value) {
|
|
9847
|
-
addHeaderLine(name, value, headers);
|
|
9848
|
-
}
|
|
9849
|
-
index = line.indexOf(":");
|
|
9850
|
-
name = line.substr(0, index);
|
|
9851
|
-
value = line.substr(index + 1).trim();
|
|
9852
|
-
i++;
|
|
9853
|
-
if (i < lines.length) {
|
|
9854
|
-
line = lines[i];
|
|
9855
|
-
} else {
|
|
9856
|
-
line = "";
|
|
9857
|
-
}
|
|
9858
|
-
}
|
|
9859
|
-
if (name && value) {
|
|
9860
|
-
addHeaderLine(name, value, headers);
|
|
9861
|
-
}
|
|
9862
|
-
return headers;
|
|
9863
|
-
}
|
|
9864
|
-
function addHeaderLine(field, value, dest) {
|
|
9865
|
-
field = field.toLowerCase();
|
|
9866
|
-
switch (field) {
|
|
9867
|
-
// Array headers:
|
|
9868
|
-
case "set-cookie":
|
|
9869
|
-
if (dest[field] !== void 0) {
|
|
9870
|
-
dest[field].push(value);
|
|
9871
|
-
} else {
|
|
9872
|
-
dest[field] = [value];
|
|
9873
|
-
}
|
|
9874
|
-
break;
|
|
9875
|
-
// list is taken from:
|
|
9876
|
-
// https://mxr.mozilla.org/mozilla/source/netwerk/protocol/http/src/nsHttpHeaderArray.cpp
|
|
9877
|
-
case "content-type":
|
|
9878
|
-
case "content-length":
|
|
9879
|
-
case "user-agent":
|
|
9880
|
-
case "referer":
|
|
9881
|
-
case "host":
|
|
9882
|
-
case "authorization":
|
|
9883
|
-
case "proxy-authorization":
|
|
9884
|
-
case "if-modified-since":
|
|
9885
|
-
case "if-unmodified-since":
|
|
9886
|
-
case "from":
|
|
9887
|
-
case "location":
|
|
9888
|
-
case "max-forwards":
|
|
9889
|
-
case "retry-after":
|
|
9890
|
-
case "etag":
|
|
9891
|
-
case "last-modified":
|
|
9892
|
-
case "server":
|
|
9893
|
-
case "age":
|
|
9894
|
-
case "expires":
|
|
9895
|
-
if (dest[field] === void 0) dest[field] = value;
|
|
9896
|
-
break;
|
|
9897
|
-
default:
|
|
9898
|
-
if (typeof dest[field] === "string") {
|
|
9899
|
-
dest[field] += ", " + value;
|
|
9900
|
-
} else {
|
|
9901
|
-
dest[field] = value;
|
|
9902
|
-
}
|
|
9903
|
-
}
|
|
9904
|
-
}
|
|
9905
|
-
|
|
9906
|
-
// shims/rn_http_response_parser.ts
|
|
9907
|
-
var ResponseParser = class {
|
|
9908
|
-
constructor(logger, resolve, reject) {
|
|
9909
|
-
this.responseChunkRemainder = 0;
|
|
9910
|
-
this.logger = logger;
|
|
9911
|
-
this.resolve = resolve;
|
|
9912
|
-
this.reject = reject;
|
|
9913
|
-
this.error = null;
|
|
9914
|
-
this.responseReadBuffer = void 0;
|
|
9915
|
-
this.responseState = 0 /* RECEIVING_HEADER */;
|
|
9916
|
-
this.pullController = void 0;
|
|
9917
|
-
this.pullResolve = void 0;
|
|
9918
|
-
this.pullReject = void 0;
|
|
9919
|
-
}
|
|
9920
|
-
processResponseReadBuffer(data) {
|
|
9921
|
-
if (this.error) {
|
|
9922
|
-
this.logger.info(`RN http streamed response, received ${data.length} bytes in error mode`);
|
|
9923
|
-
return false;
|
|
9924
|
-
}
|
|
9925
|
-
if (this.responseReadBuffer) {
|
|
9926
|
-
this.responseReadBuffer = Buffer.concat([this.responseReadBuffer, data]);
|
|
9927
|
-
} else {
|
|
9928
|
-
this.responseReadBuffer = Buffer.from(data.subarray());
|
|
9929
|
-
}
|
|
9930
|
-
if (this.responseState === 3 /* RECEIVING_COMPLETED */) {
|
|
9931
|
-
if (this.pullController) {
|
|
9932
|
-
this.pullController.close();
|
|
9933
|
-
if (this.pullResolve) {
|
|
9934
|
-
this.pullResolve();
|
|
9935
|
-
}
|
|
9936
|
-
}
|
|
9937
|
-
return false;
|
|
9938
|
-
} else if (this.responseState === 0 /* RECEIVING_HEADER */) {
|
|
9939
|
-
const headerEnd = this.responseReadBuffer.indexOf("\r\n\r\n");
|
|
9940
|
-
if (headerEnd >= 0) {
|
|
9941
|
-
let headerChunk = this.responseReadBuffer.subarray(0, headerEnd + 4);
|
|
9942
|
-
this.responseReadBuffer = Buffer.from(this.responseReadBuffer.subarray(headerEnd + 4));
|
|
9943
|
-
const maxHeaderLines = 128;
|
|
9944
|
-
let responseHeaderLines = [];
|
|
9945
|
-
const lineDecoder = new EyepopLineDecoder();
|
|
9946
|
-
for (const line of lineDecoder.decode(headerChunk)) {
|
|
9947
|
-
if (line.length > 0) {
|
|
9948
|
-
responseHeaderLines.push(line);
|
|
9949
|
-
if (responseHeaderLines.length > maxHeaderLines) {
|
|
9950
|
-
this.error = `Response header exceeds ${maxHeaderLines} lines`;
|
|
9951
|
-
this.reject(this.error);
|
|
9952
|
-
return false;
|
|
9953
|
-
}
|
|
9954
|
-
}
|
|
9955
|
-
}
|
|
9956
|
-
let responseHeader = parseHttpHeader(responseHeaderLines, false);
|
|
9957
|
-
if (responseHeader.statusCode === void 0) {
|
|
9958
|
-
this.logger.warn(`Could not find status header in HTTP response ${JSON.stringify(responseHeader)}`);
|
|
9959
|
-
this.reject("missing status header in HTTP response");
|
|
9960
|
-
return false;
|
|
9961
|
-
}
|
|
9962
|
-
const headers = new Headers(responseHeader.headers);
|
|
9963
|
-
if (headers.has("transfer-encoding")) {
|
|
9964
|
-
if (headers.get("transfer-encoding")?.toLowerCase() === "chunked") {
|
|
9965
|
-
this.responseState = 2 /* RECEIVING_BODY_CHUNKED */;
|
|
9966
|
-
this.responseChunkRemainder = 0;
|
|
9967
|
-
} else {
|
|
9968
|
-
this.error = `Response with unsupported transfer-encoding '${headers.get("transfer-encoding")}'`;
|
|
9969
|
-
this.reject(this.error);
|
|
9970
|
-
return false;
|
|
9971
|
-
}
|
|
9972
|
-
} else if (headers.has("content-length")) {
|
|
9973
|
-
this.responseState = 1 /* RECEIVING_BODY */;
|
|
9974
|
-
this.responseChunkRemainder = parseInt(headers.get("content-length") || "-1");
|
|
9975
|
-
} else {
|
|
9976
|
-
this.responseState = 2 /* RECEIVING_BODY_CHUNKED */;
|
|
9977
|
-
this.responseChunkRemainder = 0;
|
|
9978
|
-
}
|
|
9979
|
-
const responseBody = new ReadableStream({
|
|
9980
|
-
pull: (controller) => {
|
|
9981
|
-
if (this.error || this.responseState == 3 /* RECEIVING_COMPLETED */) {
|
|
9982
|
-
return;
|
|
9983
|
-
}
|
|
9984
|
-
if (this.pull(controller)) {
|
|
9985
|
-
return;
|
|
9986
|
-
}
|
|
9987
|
-
return new Promise((resolve, reject) => {
|
|
9988
|
-
if (this.pullController) {
|
|
9989
|
-
if (this.pullReject) {
|
|
9990
|
-
this.pullReject("pull, we got a pending controller already");
|
|
9991
|
-
}
|
|
9992
|
-
}
|
|
9993
|
-
this.pullController = controller;
|
|
9994
|
-
this.pullResolve = resolve;
|
|
9995
|
-
this.pullReject = reject;
|
|
9996
|
-
});
|
|
9997
|
-
},
|
|
9998
|
-
cancel: (reason) => {
|
|
9999
|
-
if (!this.error) {
|
|
10000
|
-
this.error = `cancelled: ${reason}`;
|
|
10001
|
-
this.reject(this.error);
|
|
10002
|
-
}
|
|
10003
|
-
}
|
|
10004
|
-
});
|
|
10005
|
-
this.resolve(new Response(responseBody, {
|
|
10006
|
-
status: responseHeader.statusCode,
|
|
10007
|
-
statusText: responseHeader.statusText,
|
|
10008
|
-
headers
|
|
10009
|
-
}));
|
|
10010
|
-
}
|
|
10011
|
-
} else if (this.pullController) {
|
|
10012
|
-
if (this.pull(this.pullController)) {
|
|
10013
|
-
this.pullController = void 0;
|
|
10014
|
-
if (this.pullResolve) {
|
|
10015
|
-
this.pullResolve();
|
|
10016
|
-
}
|
|
10017
|
-
this.pullResolve = void 0;
|
|
10018
|
-
this.pullReject = void 0;
|
|
10019
|
-
}
|
|
10020
|
-
}
|
|
10021
|
-
return true;
|
|
10022
|
-
}
|
|
10023
|
-
pull(controller) {
|
|
10024
|
-
if (this.responseState == 3 /* RECEIVING_COMPLETED */) {
|
|
10025
|
-
controller.close();
|
|
10026
|
-
return false;
|
|
10027
|
-
}
|
|
10028
|
-
if (this.responseReadBuffer === void 0) {
|
|
10029
|
-
return false;
|
|
10030
|
-
}
|
|
10031
|
-
if (this.responseState == 1 /* RECEIVING_BODY */) {
|
|
10032
|
-
controller.enqueue(this.responseReadBuffer);
|
|
10033
|
-
this.responseChunkRemainder -= this.responseReadBuffer.length;
|
|
10034
|
-
this.responseReadBuffer = void 0;
|
|
10035
|
-
if (this.responseChunkRemainder <= 0) {
|
|
10036
|
-
this.responseState = 3 /* RECEIVING_COMPLETED */;
|
|
10037
|
-
controller.close();
|
|
10038
|
-
}
|
|
10039
|
-
return true;
|
|
10040
|
-
} else if (this.responseState == 2 /* RECEIVING_BODY_CHUNKED */) {
|
|
10041
|
-
while (this.responseReadBuffer.length > 1) {
|
|
10042
|
-
if (this.responseChunkRemainder == 0) {
|
|
10043
|
-
let chunkHeaderEnd = 0;
|
|
10044
|
-
while (this.responseReadBuffer.length >= 2 && chunkHeaderEnd == 0) {
|
|
10045
|
-
chunkHeaderEnd = this.responseReadBuffer.indexOf("\r\n");
|
|
10046
|
-
if (chunkHeaderEnd == 0) {
|
|
10047
|
-
this.responseReadBuffer = Buffer.from(this.responseReadBuffer.subarray(2));
|
|
10048
|
-
}
|
|
10049
|
-
}
|
|
10050
|
-
if (chunkHeaderEnd > 0) {
|
|
10051
|
-
this.responseChunkRemainder = parseInt(Buffer.from(this.responseReadBuffer, 0, chunkHeaderEnd).toString("utf8"), 16);
|
|
10052
|
-
this.responseReadBuffer = Buffer.from(this.responseReadBuffer.subarray(chunkHeaderEnd + 2));
|
|
10053
|
-
if (this.responseChunkRemainder <= 0) {
|
|
10054
|
-
this.responseState = 3 /* RECEIVING_COMPLETED */;
|
|
10055
|
-
controller.close();
|
|
10056
|
-
return true;
|
|
10057
|
-
}
|
|
10058
|
-
} else if (this.responseReadBuffer.length > 64) {
|
|
10059
|
-
this.error = "Cannot find chunked encoding header within 64 bytes, given up";
|
|
10060
|
-
controller.error(this.error);
|
|
10061
|
-
}
|
|
10062
|
-
}
|
|
10063
|
-
if (this.responseChunkRemainder > 0 && this.responseReadBuffer.length > 0) {
|
|
10064
|
-
const chunk = Buffer.from(this.responseReadBuffer.subarray(0, this.responseChunkRemainder));
|
|
10065
|
-
this.responseReadBuffer = Buffer.from(this.responseReadBuffer.subarray(this.responseChunkRemainder));
|
|
10066
|
-
controller.enqueue(chunk);
|
|
10067
|
-
this.responseChunkRemainder -= chunk.length;
|
|
10068
|
-
return true;
|
|
10069
|
-
} else {
|
|
10070
|
-
break;
|
|
10071
|
-
}
|
|
10072
|
-
}
|
|
10073
|
-
} else {
|
|
10074
|
-
this.error = `Received more data in wrong state ${this.responseState}`;
|
|
10075
|
-
controller.error(this.error);
|
|
10076
|
-
}
|
|
10077
|
-
return false;
|
|
10078
|
-
}
|
|
10079
|
-
};
|
|
10080
|
-
|
|
10081
|
-
// shims/rn_streaming_fetch.ts
|
|
10082
|
-
async function reactNativeStreamingFetch(url, method, headers, body, contentLength, sockets, logger) {
|
|
10083
|
-
const isHttps = url.protocol == "https:";
|
|
10084
|
-
const port = url.port ? parseInt(url.port) : isHttps ? 443 : 80;
|
|
10085
|
-
return new Promise((resolve, reject) => {
|
|
10086
|
-
const connectOptions = {
|
|
10087
|
-
port,
|
|
10088
|
-
host: url.hostname,
|
|
10089
|
-
reuseAddress: true
|
|
10090
|
-
};
|
|
10091
|
-
const clientSocket = new sockets.Socket();
|
|
10092
|
-
const client = isHttps ? new sockets.TLSSocket(clientSocket) : clientSocket;
|
|
10093
|
-
let error;
|
|
10094
|
-
const responseParser = new ResponseParser(logger, resolve, (reason) => {
|
|
10095
|
-
error = reason;
|
|
10096
|
-
reject(error);
|
|
10097
|
-
client.destroy();
|
|
10098
|
-
});
|
|
10099
|
-
client.on("data", function(data) {
|
|
10100
|
-
responseParser.processResponseReadBuffer(data);
|
|
10101
|
-
});
|
|
10102
|
-
client.on("error", function(err) {
|
|
10103
|
-
logger.info(`error: ${err}`);
|
|
10104
|
-
if (!error) {
|
|
10105
|
-
error = err;
|
|
10106
|
-
reject(error);
|
|
10107
|
-
}
|
|
10108
|
-
client.destroy();
|
|
10109
|
-
});
|
|
10110
|
-
client.on("close", function() {
|
|
10111
|
-
if (!error) {
|
|
10112
|
-
error = "socket closed";
|
|
10113
|
-
reject(error);
|
|
10114
|
-
}
|
|
10115
|
-
});
|
|
10116
|
-
client.connect(connectOptions, async () => {
|
|
10117
|
-
const headerLines = [
|
|
10118
|
-
`${method} ${url.pathname}${url.search} HTTP/1.1\r
|
|
10119
|
-
`,
|
|
10120
|
-
`Host: ${url.host}\r
|
|
10121
|
-
`
|
|
10122
|
-
];
|
|
10123
|
-
headers.forEach((value, key) => {
|
|
10124
|
-
headerLines.push(`${key}: ${value}\r
|
|
10125
|
-
`);
|
|
10126
|
-
});
|
|
10127
|
-
headerLines.push("\r\n");
|
|
10128
|
-
const textEncoder = new TextEncoder();
|
|
10129
|
-
const headerChunk = headerLines.join("");
|
|
10130
|
-
const bodyReader = body ? body.getReader() : void 0;
|
|
10131
|
-
let headerEnqueued = false;
|
|
10132
|
-
let eof = false;
|
|
10133
|
-
const readableHeaderChunkedBody = new ReadableStream({
|
|
10134
|
-
async pull(controller) {
|
|
10135
|
-
if (!headerEnqueued) {
|
|
10136
|
-
controller.enqueue(headerChunk);
|
|
10137
|
-
headerEnqueued = true;
|
|
10138
|
-
return;
|
|
10139
|
-
}
|
|
10140
|
-
if (eof) {
|
|
10141
|
-
controller.close();
|
|
10142
|
-
return;
|
|
10143
|
-
}
|
|
10144
|
-
if (!bodyReader) {
|
|
10145
|
-
controller.close();
|
|
10146
|
-
return;
|
|
10147
|
-
}
|
|
10148
|
-
const chunk = await bodyReader.read();
|
|
10149
|
-
if (chunk.value) {
|
|
10150
|
-
let outputChunk;
|
|
10151
|
-
if (contentLength) {
|
|
10152
|
-
outputChunk = chunk.value;
|
|
10153
|
-
} else {
|
|
10154
|
-
outputChunk = Buffer.concat([
|
|
10155
|
-
textEncoder.encode(`${chunk.value.length.toString(16)}\r
|
|
10156
|
-
`),
|
|
10157
|
-
chunk.value,
|
|
10158
|
-
textEncoder.encode(`\r
|
|
10159
|
-
`)
|
|
10160
|
-
]);
|
|
10161
|
-
}
|
|
10162
|
-
controller.enqueue(outputChunk);
|
|
10163
|
-
} else if (chunk.done) {
|
|
10164
|
-
if (!contentLength) {
|
|
10165
|
-
controller.enqueue(Buffer.from(`0\r
|
|
10166
|
-
\r
|
|
10167
|
-
`, "utf8"));
|
|
10168
|
-
}
|
|
10169
|
-
eof = true;
|
|
10170
|
-
}
|
|
10171
|
-
}
|
|
10172
|
-
});
|
|
10173
|
-
const readableHeaderChunkedBodyReader = readableHeaderChunkedBody.getReader();
|
|
10174
|
-
const pipeChunk = async () => {
|
|
10175
|
-
while (true) {
|
|
10176
|
-
try {
|
|
10177
|
-
const chunk = await readableHeaderChunkedBodyReader.read();
|
|
10178
|
-
if (chunk.value) {
|
|
10179
|
-
if (!client.write(chunk.value)) {
|
|
10180
|
-
break;
|
|
10181
|
-
}
|
|
10182
|
-
} else if (chunk.done) {
|
|
10183
|
-
break;
|
|
10184
|
-
}
|
|
10185
|
-
} catch (e) {
|
|
10186
|
-
logger.error(e);
|
|
10187
|
-
break;
|
|
10188
|
-
}
|
|
10189
|
-
}
|
|
10190
|
-
};
|
|
10191
|
-
client.on("drain", pipeChunk);
|
|
10192
|
-
await pipeChunk();
|
|
10193
|
-
});
|
|
10194
|
-
});
|
|
10195
|
-
}
|
|
10196
|
-
|
|
10197
9704
|
// shims/http_client.ts
|
|
10198
9705
|
var createHttpClient;
|
|
9706
|
+
function logLineFromRequest(input, init) {
|
|
9707
|
+
const url = input instanceof Request ? input.url : input;
|
|
9708
|
+
const method = input instanceof Request ? input.method : init?.method || (init?.body !== void 0 ? "POST" : "GET");
|
|
9709
|
+
return `${method} ${url}`;
|
|
9710
|
+
}
|
|
10199
9711
|
if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
10200
9712
|
class BrowserHttpClient {
|
|
10201
|
-
constructor() {
|
|
10202
|
-
}
|
|
10203
|
-
async fetch(input, init) {
|
|
10204
|
-
return await fetch(input, init);
|
|
10205
|
-
}
|
|
10206
|
-
async close() {
|
|
10207
|
-
}
|
|
10208
|
-
isFullDuplex() {
|
|
10209
|
-
return false;
|
|
10210
|
-
}
|
|
10211
|
-
}
|
|
10212
|
-
createHttpClient = async (logger) => {
|
|
10213
|
-
logger.debug("Using browser fetch as http client");
|
|
10214
|
-
return new BrowserHttpClient();
|
|
10215
|
-
};
|
|
10216
|
-
} else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
10217
|
-
let RNName = "react-native";
|
|
10218
|
-
let RN;
|
|
10219
|
-
let TcpSocketsName = "react-native-tcp-socket";
|
|
10220
|
-
let TcpSockets;
|
|
10221
|
-
let TcpSocketsError;
|
|
10222
|
-
try {
|
|
10223
|
-
RN = require(RNName);
|
|
10224
|
-
TcpSockets = require(TcpSocketsName);
|
|
10225
|
-
if (TcpSockets?.TLSSocket) {
|
|
10226
|
-
if (!RN?.NativeModules?.TcpSockets) {
|
|
10227
|
-
TcpSockets = void 0;
|
|
10228
|
-
throw Error(`'${TcpSocketsName}' but not symbol NativeModules?.TcpSockets, native sockets not available when running 'npx expo start', use 'npx expo run:android' or 'npx expo run:ios' instead`);
|
|
10229
|
-
}
|
|
10230
|
-
}
|
|
10231
|
-
} catch (e) {
|
|
10232
|
-
TcpSocketsError = e;
|
|
10233
|
-
}
|
|
10234
|
-
class ReactNativeHttpClient {
|
|
10235
9713
|
constructor(logger) {
|
|
10236
|
-
this.
|
|
9714
|
+
this._logger = logger;
|
|
10237
9715
|
}
|
|
10238
9716
|
async fetch(input, init) {
|
|
10239
|
-
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
}
|
|
10245
|
-
} else if (init?.body instanceof ReadableStream) {
|
|
10246
|
-
streamBody = init.body;
|
|
10247
|
-
}
|
|
10248
|
-
if (streamBody) {
|
|
10249
|
-
if (TcpSockets?.TLSSocket !== void 0) {
|
|
10250
|
-
let url;
|
|
10251
|
-
let method;
|
|
10252
|
-
let headers;
|
|
10253
|
-
if (input instanceof Request) {
|
|
10254
|
-
url = new URL(input.url);
|
|
10255
|
-
method = input.method;
|
|
10256
|
-
headers = input.headers;
|
|
10257
|
-
} else {
|
|
10258
|
-
if (input instanceof URL) {
|
|
10259
|
-
url = input;
|
|
10260
|
-
} else {
|
|
10261
|
-
url = new URL(input);
|
|
10262
|
-
}
|
|
10263
|
-
method = init?.method || "POST";
|
|
10264
|
-
headers = new Headers(init?.headers);
|
|
10265
|
-
}
|
|
10266
|
-
let contentLength = void 0;
|
|
10267
|
-
if (headers.has("content-length")) {
|
|
10268
|
-
contentLength = parseInt(headers.get("content-length") || "");
|
|
10269
|
-
} else {
|
|
10270
|
-
headers.append("Transfer-Encoding", "chunked");
|
|
10271
|
-
}
|
|
10272
|
-
return await reactNativeStreamingFetch(
|
|
10273
|
-
url,
|
|
10274
|
-
method,
|
|
10275
|
-
headers,
|
|
10276
|
-
streamBody,
|
|
10277
|
-
contentLength,
|
|
10278
|
-
TcpSockets,
|
|
10279
|
-
this.logger
|
|
10280
|
-
);
|
|
10281
|
-
} else {
|
|
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.`);
|
|
10283
|
-
try {
|
|
10284
|
-
const chunks = [];
|
|
10285
|
-
const reader = streamBody.getReader();
|
|
10286
|
-
while (true) {
|
|
10287
|
-
const { done, value } = await reader.read();
|
|
10288
|
-
if (done) {
|
|
10289
|
-
break;
|
|
10290
|
-
}
|
|
10291
|
-
chunks.push(value);
|
|
10292
|
-
}
|
|
10293
|
-
if (input instanceof Request) {
|
|
10294
|
-
input = new Request(input, { body: Buffer.concat(chunks) });
|
|
10295
|
-
} else {
|
|
10296
|
-
init.body = Buffer.concat(chunks);
|
|
10297
|
-
}
|
|
10298
|
-
} catch (e) {
|
|
10299
|
-
return Promise.reject(e);
|
|
10300
|
-
}
|
|
10301
|
-
}
|
|
10302
|
-
}
|
|
10303
|
-
init.reactNative = { textStreaming: true };
|
|
10304
|
-
return await fetch(input, init);
|
|
9717
|
+
const logLine = logLineFromRequest(input, init);
|
|
9718
|
+
this._logger.debug(`Browser fetch() BEFORE ${logLine}`);
|
|
9719
|
+
const response = await fetch(input, init);
|
|
9720
|
+
this._logger.debug(`AFTER ${logLine} -> ${response.status}`);
|
|
9721
|
+
return response;
|
|
10305
9722
|
}
|
|
10306
9723
|
async close() {
|
|
10307
9724
|
}
|
|
10308
9725
|
isFullDuplex() {
|
|
10309
|
-
return
|
|
9726
|
+
return false;
|
|
10310
9727
|
}
|
|
10311
9728
|
}
|
|
10312
9729
|
createHttpClient = async (logger) => {
|
|
10313
|
-
|
|
10314
|
-
return new ReactNativeHttpClient(logger);
|
|
9730
|
+
return new BrowserHttpClient(logger);
|
|
10315
9731
|
};
|
|
10316
9732
|
} else {
|
|
10317
9733
|
class NodeHttpClient {
|
|
10318
|
-
constructor(agent) {
|
|
10319
|
-
this.
|
|
9734
|
+
constructor(agent, logger) {
|
|
9735
|
+
this._agent = agent;
|
|
9736
|
+
this._logger = logger;
|
|
10320
9737
|
}
|
|
10321
9738
|
async fetch(input, init) {
|
|
10322
9739
|
init || (init = {});
|
|
10323
|
-
init.dispatcher = this.
|
|
10324
|
-
|
|
9740
|
+
init.dispatcher = this._agent;
|
|
9741
|
+
const logLine = logLineFromRequest(input, init);
|
|
9742
|
+
this._logger.debug(`Node fetch() BEFORE ${logLine}`);
|
|
9743
|
+
const response = await fetch(input, init);
|
|
9744
|
+
this._logger.debug(`AFTER ${logLine} -> ${response.status}`);
|
|
9745
|
+
return response;
|
|
10325
9746
|
}
|
|
10326
9747
|
async close() {
|
|
10327
|
-
return this.
|
|
9748
|
+
return this._agent.close();
|
|
10328
9749
|
}
|
|
10329
9750
|
isFullDuplex() {
|
|
10330
9751
|
return false;
|
|
@@ -10339,7 +9760,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
10339
9760
|
pipelining: 0
|
|
10340
9761
|
});
|
|
10341
9762
|
logger.debug("Using node fetch with undici agent as http client");
|
|
10342
|
-
return new NodeHttpClient(agent);
|
|
9763
|
+
return new NodeHttpClient(agent, logger);
|
|
10343
9764
|
};
|
|
10344
9765
|
}
|
|
10345
9766
|
|
|
@@ -10610,7 +10031,11 @@ var Endpoint = class {
|
|
|
10610
10031
|
} else {
|
|
10611
10032
|
return Promise.reject("option secretKey or environment variable EYEPOP_SECRET_KEY is required");
|
|
10612
10033
|
}
|
|
10613
|
-
this.
|
|
10034
|
+
if (this._options.platformSupport?.createHttpClient !== void 0) {
|
|
10035
|
+
this._client = await this._options.platformSupport.createHttpClient(this._requestLogger);
|
|
10036
|
+
} else {
|
|
10037
|
+
this._client = await createHttpClient(this._requestLogger);
|
|
10038
|
+
}
|
|
10614
10039
|
return await this.reconnect();
|
|
10615
10040
|
}
|
|
10616
10041
|
async disconnect(wait = true) {
|
|
@@ -10704,7 +10129,6 @@ var Endpoint = class {
|
|
|
10704
10129
|
const body = { secret_key: secretKeyAuth.secretKey };
|
|
10705
10130
|
const headers = { "Content-Type": "application/json" };
|
|
10706
10131
|
const post_url = `${this.eyepopUrl()}/authentication/token`;
|
|
10707
|
-
this._requestLogger.debug("before POST %s", post_url);
|
|
10708
10132
|
const response = await this._client.fetch(post_url, {
|
|
10709
10133
|
method: "POST",
|
|
10710
10134
|
headers,
|
|
@@ -10714,7 +10138,6 @@ var Endpoint = class {
|
|
|
10714
10138
|
const message = await response.text();
|
|
10715
10139
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
10716
10140
|
}
|
|
10717
|
-
this._requestLogger.debug("after POST %s", post_url);
|
|
10718
10141
|
const data = await response.json();
|
|
10719
10142
|
const token = data;
|
|
10720
10143
|
this._token = token.access_token;
|
|
@@ -10767,12 +10190,10 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10767
10190
|
const headers = {
|
|
10768
10191
|
Authorization: await this.authorizationHeader()
|
|
10769
10192
|
};
|
|
10770
|
-
this._requestLogger.debug("before DELETE %s", deleteUrl);
|
|
10771
10193
|
let response = await this._client?.fetch(deleteUrl, {
|
|
10772
10194
|
method: "DELETE",
|
|
10773
10195
|
headers
|
|
10774
10196
|
});
|
|
10775
|
-
this._requestLogger.debug("after DELETE %s", deleteUrl);
|
|
10776
10197
|
if (response?.status != 204) {
|
|
10777
10198
|
const message = await response?.text();
|
|
10778
10199
|
this._logger.info(`stoppping pipeline failed, status ${response?.status}: ${message}`);
|
|
@@ -10783,12 +10204,10 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10783
10204
|
const headers = {
|
|
10784
10205
|
Authorization: await this.authorizationHeader()
|
|
10785
10206
|
};
|
|
10786
|
-
this._requestLogger.debug("before DELETE %s", sandboxUrl);
|
|
10787
10207
|
let response = await this._client?.fetch(sandboxUrl, {
|
|
10788
10208
|
method: "DELETE",
|
|
10789
10209
|
headers
|
|
10790
10210
|
});
|
|
10791
|
-
this._requestLogger.debug("after DELETE %s", sandboxUrl);
|
|
10792
10211
|
if (response?.status != 204) {
|
|
10793
10212
|
const message = await response?.text();
|
|
10794
10213
|
this._logger.info(`disconnecting sandbox failed, status ${response?.status}: ${message}`);
|
|
@@ -10834,7 +10253,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10834
10253
|
const client = this._client;
|
|
10835
10254
|
const baseUrl = this._baseUrl;
|
|
10836
10255
|
if (!baseUrl || !client) {
|
|
10837
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10256
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
10838
10257
|
}
|
|
10839
10258
|
let response = await this.fetchWithRetry(async () => {
|
|
10840
10259
|
const session = await this.session();
|
|
@@ -10843,7 +10262,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10843
10262
|
...this._authenticationHeaders(session)
|
|
10844
10263
|
};
|
|
10845
10264
|
const patch_url = `${session.baseUrl}/pipelines/${session.pipelineId}/pop`;
|
|
10846
|
-
this._requestLogger.debug("before PATCH %s - %s", patch_url, JSON.stringify(pop));
|
|
10847
10265
|
return await client.fetch(patch_url, {
|
|
10848
10266
|
method: "PATCH",
|
|
10849
10267
|
body: JSON.stringify(pop),
|
|
@@ -10854,7 +10272,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10854
10272
|
const message = await response.text();
|
|
10855
10273
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
10856
10274
|
}
|
|
10857
|
-
this._requestLogger.debug("after PATCH pop");
|
|
10858
10275
|
if (this._pipeline) {
|
|
10859
10276
|
this._pipeline.pop = pop;
|
|
10860
10277
|
}
|
|
@@ -10879,7 +10296,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10879
10296
|
const client = this._client;
|
|
10880
10297
|
const baseUrl = this._baseUrl;
|
|
10881
10298
|
if (!baseUrl || !client) {
|
|
10882
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10299
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
10883
10300
|
}
|
|
10884
10301
|
const body = {
|
|
10885
10302
|
pipeline: popComp,
|
|
@@ -10924,7 +10341,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10924
10341
|
const client = this._client;
|
|
10925
10342
|
const baseUrl = this._baseUrl;
|
|
10926
10343
|
if (!baseUrl || !client) {
|
|
10927
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10344
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
10928
10345
|
}
|
|
10929
10346
|
const body = {
|
|
10930
10347
|
transform: postTransform
|
|
@@ -10963,7 +10380,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10963
10380
|
}
|
|
10964
10381
|
async liveIngress(stream) {
|
|
10965
10382
|
if (!this._baseUrl || !this._client) {
|
|
10966
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10383
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
10967
10384
|
}
|
|
10968
10385
|
const whip = new WebrtcWhip(
|
|
10969
10386
|
stream,
|
|
@@ -10977,7 +10394,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10977
10394
|
}
|
|
10978
10395
|
async liveEgress(ingressId) {
|
|
10979
10396
|
if (!this._baseUrl || !this._client) {
|
|
10980
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10397
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
10981
10398
|
}
|
|
10982
10399
|
const whep = new WebrtcWhep(
|
|
10983
10400
|
ingressId,
|
|
@@ -11037,7 +10454,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11037
10454
|
}
|
|
11038
10455
|
async uploadFile(source, params) {
|
|
11039
10456
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
11040
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10457
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
11041
10458
|
}
|
|
11042
10459
|
await this._limit.acquire();
|
|
11043
10460
|
try {
|
|
@@ -11069,7 +10486,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11069
10486
|
}
|
|
11070
10487
|
async uploadStream(source, params) {
|
|
11071
10488
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
11072
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10489
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
11073
10490
|
}
|
|
11074
10491
|
await this._limit.acquire();
|
|
11075
10492
|
try {
|
|
@@ -11101,12 +10518,17 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11101
10518
|
}
|
|
11102
10519
|
async uploadPath(source, params) {
|
|
11103
10520
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
11104
|
-
throw new Error("endpoint not connected, use connect()
|
|
10521
|
+
throw new Error("endpoint not connected, use connect()");
|
|
11105
10522
|
}
|
|
11106
10523
|
await this._limit.acquire();
|
|
11107
10524
|
try {
|
|
11108
10525
|
this.updateState();
|
|
11109
|
-
|
|
10526
|
+
let streamSource;
|
|
10527
|
+
if (this._options.platformSupport?.resolvePath) {
|
|
10528
|
+
streamSource = await this._options.platformSupport.resolvePath(source, this._logger);
|
|
10529
|
+
} else {
|
|
10530
|
+
streamSource = await resolvePath(source, this._logger);
|
|
10531
|
+
}
|
|
11110
10532
|
const job = new UploadJob(
|
|
11111
10533
|
streamSource.stream,
|
|
11112
10534
|
streamSource.mimeType,
|
|
@@ -11139,7 +10561,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11139
10561
|
}, params);
|
|
11140
10562
|
}
|
|
11141
10563
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
11142
|
-
throw new Error("endpoint not connected, use connect()
|
|
10564
|
+
throw new Error("endpoint not connected, use connect()");
|
|
11143
10565
|
}
|
|
11144
10566
|
await this._limit.acquire();
|
|
11145
10567
|
try {
|
|
@@ -11168,7 +10590,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11168
10590
|
}
|
|
11169
10591
|
async loadLiveIngress(source, params) {
|
|
11170
10592
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
11171
|
-
throw new Error("endpoint not connected, use connect()
|
|
10593
|
+
throw new Error("endpoint not connected, use connect()");
|
|
11172
10594
|
}
|
|
11173
10595
|
await this._limit.acquire();
|
|
11174
10596
|
try {
|
|
@@ -11220,10 +10642,9 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11220
10642
|
Authorization: await this.authorizationHeader()
|
|
11221
10643
|
};
|
|
11222
10644
|
this.updateState("FetchConfig" /* FetchConfig */);
|
|
11223
|
-
this._requestLogger.debug("before GET %s", config_url);
|
|
11224
10645
|
let response = await this._client.fetch(config_url, { headers });
|
|
11225
10646
|
if (response.status == 401) {
|
|
11226
|
-
this._requestLogger.debug("
|
|
10647
|
+
this._requestLogger.debug("GET %s: 401, about to retry with fresh access token", config_url);
|
|
11227
10648
|
this.statusHandler401(response.status);
|
|
11228
10649
|
const headers2 = {
|
|
11229
10650
|
Authorization: await this.authorizationHeader()
|
|
@@ -11243,7 +10664,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11243
10664
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11244
10665
|
}
|
|
11245
10666
|
let config = await response.json();
|
|
11246
|
-
this._requestLogger.debug("after GET %s", config_url);
|
|
11247
10667
|
if (!config.base_url && this.options().autoStart) {
|
|
11248
10668
|
const auto_start_config_url = `${this.eyepopUrl()}/pops/${this.options().popId}/config?auto_start=true`;
|
|
11249
10669
|
this._requestLogger.debug("pop was not running, trying to autostart with: %s", auto_start_config_url);
|
|
@@ -11269,7 +10689,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11269
10689
|
Authorization: await this.authorizationHeader()
|
|
11270
10690
|
};
|
|
11271
10691
|
const createSandboxUrl = `${this._baseUrl}/sandboxes`;
|
|
11272
|
-
this._requestLogger.debug("before POST %s", createSandboxUrl);
|
|
11273
10692
|
const response3 = await this._client.fetch(createSandboxUrl, {
|
|
11274
10693
|
method: "POST",
|
|
11275
10694
|
headers: headers3
|
|
@@ -11279,7 +10698,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11279
10698
|
return Promise.reject(`Unexpected status ${response3.status}: ${message}`);
|
|
11280
10699
|
}
|
|
11281
10700
|
const responseJson = await response3.json();
|
|
11282
|
-
this._requestLogger.debug("after POST %s", createSandboxUrl);
|
|
11283
10701
|
if (responseJson) {
|
|
11284
10702
|
this._sandboxId = responseJson;
|
|
11285
10703
|
}
|
|
@@ -11299,7 +10717,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11299
10717
|
const headers2 = {
|
|
11300
10718
|
Authorization: await this.authorizationHeader()
|
|
11301
10719
|
};
|
|
11302
|
-
this._requestLogger.debug("before GET %s", get_url);
|
|
11303
10720
|
let response2 = await this._client.fetch(get_url, {
|
|
11304
10721
|
method: "GET",
|
|
11305
10722
|
headers: headers2
|
|
@@ -11308,7 +10725,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11308
10725
|
const message = await response2.text();
|
|
11309
10726
|
return Promise.reject(`Unexpected status ${response2.status}: ${message}`);
|
|
11310
10727
|
}
|
|
11311
|
-
this._requestLogger.debug("after GET %s", get_url);
|
|
11312
10728
|
this._pipeline = await response2.json();
|
|
11313
10729
|
if (this.options().stopJobs) {
|
|
11314
10730
|
const body = { sourceType: "NONE" };
|
|
@@ -11369,7 +10785,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11369
10785
|
"Content-Type": "application/json",
|
|
11370
10786
|
Authorization: await this.authorizationHeader()
|
|
11371
10787
|
};
|
|
11372
|
-
this._requestLogger.debug("before POST %s", post_url);
|
|
11373
10788
|
return client.fetch(post_url, {
|
|
11374
10789
|
method: "POST",
|
|
11375
10790
|
body: JSON.stringify(body),
|
|
@@ -11381,7 +10796,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11381
10796
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11382
10797
|
}
|
|
11383
10798
|
const result = await response.json();
|
|
11384
|
-
this._requestLogger.debug("after POST %s", post_url);
|
|
11385
10799
|
return result["id"];
|
|
11386
10800
|
}
|
|
11387
10801
|
async manifest() {
|
|
@@ -11389,7 +10803,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11389
10803
|
const client = this._client;
|
|
11390
10804
|
const baseUrl = this._baseUrl;
|
|
11391
10805
|
if (!baseUrl || !client) {
|
|
11392
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10806
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
11393
10807
|
}
|
|
11394
10808
|
let get_path;
|
|
11395
10809
|
if (this._sandboxId === null) {
|
|
@@ -11403,23 +10817,20 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11403
10817
|
...this._authenticationHeaders(session),
|
|
11404
10818
|
"Content-Type": "application/json"
|
|
11405
10819
|
};
|
|
11406
|
-
this._requestLogger.debug("before GET %s", get_path);
|
|
11407
10820
|
return client.fetch(get_path, { headers });
|
|
11408
10821
|
});
|
|
11409
10822
|
if (!response.ok) {
|
|
11410
10823
|
const message = await response.text();
|
|
11411
10824
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11412
10825
|
}
|
|
11413
|
-
|
|
11414
|
-
this._requestLogger.debug("after GET %s", get_path);
|
|
11415
|
-
return result;
|
|
10826
|
+
return await response.json();
|
|
11416
10827
|
}
|
|
11417
10828
|
async models() {
|
|
11418
10829
|
this._logger.warn("listModels for development use only");
|
|
11419
10830
|
const client = this._client;
|
|
11420
10831
|
const baseUrl = this._baseUrl;
|
|
11421
10832
|
if (!baseUrl || !client) {
|
|
11422
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10833
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
11423
10834
|
}
|
|
11424
10835
|
let get_path;
|
|
11425
10836
|
if (this._sandboxId === null) {
|
|
@@ -11433,7 +10844,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11433
10844
|
...this._authenticationHeaders(session),
|
|
11434
10845
|
"Content-Type": "application/json"
|
|
11435
10846
|
};
|
|
11436
|
-
this._requestLogger.debug("before GET %s", get_path);
|
|
11437
10847
|
return client.fetch(get_path, { headers });
|
|
11438
10848
|
});
|
|
11439
10849
|
if (!response.ok) {
|
|
@@ -11441,7 +10851,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11441
10851
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11442
10852
|
}
|
|
11443
10853
|
const result = await response.json();
|
|
11444
|
-
this._requestLogger.debug("after GET %s", get_path);
|
|
11445
10854
|
return result;
|
|
11446
10855
|
}
|
|
11447
10856
|
async changeManifest(manifests) {
|
|
@@ -11449,7 +10858,7 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11449
10858
|
const client = this._client;
|
|
11450
10859
|
const baseUrl = this._baseUrl;
|
|
11451
10860
|
if (!baseUrl || !client) {
|
|
11452
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10861
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
11453
10862
|
}
|
|
11454
10863
|
let put_url;
|
|
11455
10864
|
if (this._sandboxId === null) {
|
|
@@ -11463,7 +10872,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11463
10872
|
...this._authenticationHeaders(session),
|
|
11464
10873
|
"Content-Type": "application/json"
|
|
11465
10874
|
};
|
|
11466
|
-
this._requestLogger.debug("before PUT %s", put_url);
|
|
11467
10875
|
return client.fetch(put_url, {
|
|
11468
10876
|
method: "PUT",
|
|
11469
10877
|
body: JSON.stringify(manifests),
|
|
@@ -11474,14 +10882,13 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11474
10882
|
const message = await response.text();
|
|
11475
10883
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11476
10884
|
}
|
|
11477
|
-
this._requestLogger.debug("after PUT %s", put_url);
|
|
11478
10885
|
}
|
|
11479
10886
|
async loadModel(model) {
|
|
11480
10887
|
this._logger.warn("loadModel for development use only");
|
|
11481
10888
|
const client = this._client;
|
|
11482
10889
|
const baseUrl = this._baseUrl;
|
|
11483
10890
|
if (!baseUrl || !client) {
|
|
11484
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10891
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
11485
10892
|
}
|
|
11486
10893
|
let post_url;
|
|
11487
10894
|
if (this._sandboxId === null) {
|
|
@@ -11495,7 +10902,6 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11495
10902
|
...this._authenticationHeaders(session),
|
|
11496
10903
|
"Content-Type": "application/json"
|
|
11497
10904
|
};
|
|
11498
|
-
this._requestLogger.debug("before POST %s", post_url);
|
|
11499
10905
|
return client.fetch(post_url, {
|
|
11500
10906
|
method: "POST",
|
|
11501
10907
|
body: JSON.stringify(model),
|
|
@@ -11506,16 +10912,14 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11506
10912
|
const message = await response.text();
|
|
11507
10913
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11508
10914
|
}
|
|
11509
|
-
|
|
11510
|
-
this._requestLogger.debug("after POST %s", post_url);
|
|
11511
|
-
return result;
|
|
10915
|
+
return await response.json();
|
|
11512
10916
|
}
|
|
11513
10917
|
async unloadModel(modelId) {
|
|
11514
10918
|
this._logger.warn("purgeModel for development use only");
|
|
11515
10919
|
const client = this._client;
|
|
11516
10920
|
const baseUrl = this._baseUrl;
|
|
11517
10921
|
if (!baseUrl || !client) {
|
|
11518
|
-
return Promise.reject("endpoint not connected, use connect()
|
|
10922
|
+
return Promise.reject("endpoint not connected, use connect()");
|
|
11519
10923
|
}
|
|
11520
10924
|
let delete_url;
|
|
11521
10925
|
if (this._sandboxId === null) {
|
|
@@ -11529,14 +10933,12 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
11529
10933
|
...this._authenticationHeaders(session),
|
|
11530
10934
|
"Content-Type": "application/json"
|
|
11531
10935
|
};
|
|
11532
|
-
this._requestLogger.debug("before DELETE %s", delete_url);
|
|
11533
10936
|
return client.fetch(delete_url, { method: "DELETE", headers });
|
|
11534
10937
|
});
|
|
11535
10938
|
if (!response.ok) {
|
|
11536
10939
|
const message = await response.text();
|
|
11537
10940
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11538
10941
|
}
|
|
11539
|
-
this._requestLogger.debug("after DELETE %s", delete_url);
|
|
11540
10942
|
}
|
|
11541
10943
|
};
|
|
11542
10944
|
|
|
@@ -11754,10 +11156,9 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11754
11156
|
Authorization: await this.authorizationHeader()
|
|
11755
11157
|
};
|
|
11756
11158
|
this.updateState("FetchConfig" /* FetchConfig */);
|
|
11757
|
-
this._requestLogger.debug("before GET %s", config_url);
|
|
11758
11159
|
let response = await this._client.fetch(config_url, { headers });
|
|
11759
11160
|
if (response.status == 401) {
|
|
11760
|
-
this._requestLogger.debug("
|
|
11161
|
+
this._requestLogger.debug("GET %s: 401, about to retry with fresh access token", config_url);
|
|
11761
11162
|
this.statusHandler401(response.status);
|
|
11762
11163
|
headers = {
|
|
11763
11164
|
Authorization: await this.authorizationHeader()
|
|
@@ -11773,7 +11174,6 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11773
11174
|
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11774
11175
|
}
|
|
11775
11176
|
let config = await response.json();
|
|
11776
|
-
this._requestLogger.debug("after GET %s", config_url);
|
|
11777
11177
|
const baseUrl = new URL(config.base_url, this.eyepopUrl());
|
|
11778
11178
|
this._baseUrl = baseUrl.toString();
|
|
11779
11179
|
if (this.options().disableWs) {
|